diff --git a/build.gradle b/build.gradle index c75b83e..2483cfc 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group = 'net.momirealms' -version = '2.0.7' +version = '2.0.8' repositories { mavenCentral() diff --git a/src/main/java/net/momirealms/customcrops/api/crop/Crop.java b/src/main/java/net/momirealms/customcrops/api/crop/Crop.java index 50d991c..a37606a 100644 --- a/src/main/java/net/momirealms/customcrops/api/crop/Crop.java +++ b/src/main/java/net/momirealms/customcrops/api/crop/Crop.java @@ -36,11 +36,11 @@ public interface Crop { GiganticCrop getGiganticCrop(); - double getSkillXP(); - OtherLoot[] getOtherLoots(); ActionInterface[] getActions(); String getKey(); + + boolean canRotate(); } diff --git a/src/main/java/net/momirealms/customcrops/config/CropConfig.java b/src/main/java/net/momirealms/customcrops/config/CropConfig.java index 6c3542b..538655c 100644 --- a/src/main/java/net/momirealms/customcrops/config/CropConfig.java +++ b/src/main/java/net/momirealms/customcrops/config/CropConfig.java @@ -104,6 +104,7 @@ public class CropConfig { if (option.equals("return")) { crop.setReturnStage(config.getString(key + ".return")); } + crop.setCanRotate(config.getBoolean(key + ".rotation", true)); if (option.equals("requirements")) { List requirementList = new ArrayList<>(); for (String requirement : Objects.requireNonNull(config.getConfigurationSection(key + ".requirements")).getKeys(false)) { diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java index 79f6b10..0cc3aa0 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/HandlerP.java @@ -541,7 +541,7 @@ public abstract class HandlerP extends Function { CustomWorld customWorld = cropManager.getCustomWorld(seedLoc.getWorld()); if (customWorld == null) return false; - if (MainConfig.OraxenHook) { + if (!MainConfig.OraxenHook) { if (FurnitureUtil.hasFurniture(seedLoc.clone().add(0.5,0.5,0.5))) return false; } else { @@ -606,7 +606,7 @@ public abstract class HandlerP extends Function { else { ItemFrame itemFrame = customInterface.placeFurniture(seedLoc, cropName + "_stage_1"); if (itemFrame == null) return false; - itemFrame.setRotation(FurnitureUtil.getRandomRotation()); + if (crop.canRotate()) itemFrame.setRotation(FurnitureUtil.getRandomRotation()); } customWorld.addCrop(seedLoc, cropName); return true; @@ -645,8 +645,4 @@ public abstract class HandlerP extends Function { customWorld.addCrop(location, crop.getKey()); return false; } - - protected void waterCanSoundsActionBar() { - - } } diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameCropImpl.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameCropImpl.java index 3405034..bb074cd 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameCropImpl.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameCropImpl.java @@ -82,11 +82,11 @@ public class ItemsAdderFrameCropImpl implements CropModeInterface { if (MainConfig.enableCrow && cropManager.crowJudge(location, itemFrame)) return true; if (fertilizer instanceof SpeedGrow speedGrow && Math.random() < speedGrow.getChance()) { if (customInterface.doesExist(temp + (nextStage+1))) { - addStage(itemFrame, temp + (nextStage + 1)); + addStage(itemFrame, temp + (nextStage + 1), crop.canRotate()); } } else if (certainGrow || Math.random() < MainConfig.dryGrowChance) { - addStage(itemFrame, temp + nextStage); + addStage(itemFrame, temp + nextStage, crop.canRotate()); } } else { @@ -115,10 +115,10 @@ public class ItemsAdderFrameCropImpl implements CropModeInterface { return false; } - private void addStage(ItemFrame itemFrame, String stage) { + private void addStage(ItemFrame itemFrame, String stage, boolean rotate) { CustomFurniture.remove(itemFrame, false); CustomFurniture customFurniture = CustomFurniture.spawn(stage, itemFrame.getLocation().getBlock()); - if (customFurniture.getArmorstand() instanceof ItemFrame frame) { + if (rotate && customFurniture.getArmorstand() instanceof ItemFrame frame) { frame.setRotation(FurnitureUtil.getRandomRotation()); } } diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java index 2316bd9..1a16231 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/itemsadder/ItemsAdderFrameHandler.java @@ -244,7 +244,7 @@ public class ItemsAdderFrameHandler extends ItemsAdderHandler { if (crop == null) return; if (super.onInteractRipeCrop(location, crop, player)) return; CustomFurniture customFurniture = CustomFurniture.spawn(crop.getReturnStage(), location.getBlock()); - if (customFurniture != null) { + if (crop.canRotate() && customFurniture != null) { if (customFurniture instanceof ItemFrame itemFrame) { itemFrame.setRotation(FurnitureUtil.getRandomRotation()); } diff --git a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java index 96ea570..1d0c7ed 100644 --- a/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java +++ b/src/main/java/net/momirealms/customcrops/integrations/customplugin/oraxen/OraxenFrameHandler.java @@ -217,7 +217,7 @@ public class OraxenFrameHandler extends OraxenHandler { if (crop == null) return; if (super.onInteractRipeCrop(location, crop, player)) return; ItemFrame itemFrame = cropManager.getCustomInterface().placeFurniture(location, crop.getReturnStage()); - if (itemFrame != null) { + if (crop.canRotate() && itemFrame != null) { itemFrame.setRotation(FurnitureUtil.getRandomRotation()); } } diff --git a/src/main/java/net/momirealms/customcrops/objects/CCCrop.java b/src/main/java/net/momirealms/customcrops/objects/CCCrop.java index 4e18db9..da01d55 100644 --- a/src/main/java/net/momirealms/customcrops/objects/CCCrop.java +++ b/src/main/java/net/momirealms/customcrops/objects/CCCrop.java @@ -29,10 +29,10 @@ public class CCCrop implements Crop { private String returnStage; private QualityLoot qualityLoot; private GiganticCrop giganticCrop; - private double skillXP; private OtherLoot[] otherLoots; private ActionInterface[] actions; private final String key; + private boolean rotation; public CCCrop(String key) { this.key = key; @@ -66,10 +66,6 @@ public class CCCrop implements Crop { return giganticCrop; } - public double getSkillXP() { - return skillXP; - } - public OtherLoot[] getOtherLoots() { return otherLoots; } @@ -94,10 +90,6 @@ public class CCCrop implements Crop { this.giganticCrop = giganticCrop; } - public void setSkillXP(double skillXP) { - this.skillXP = skillXP; - } - public void setOtherLoots(OtherLoot[] otherLoots) { this.otherLoots = otherLoots; } @@ -105,4 +97,12 @@ public class CCCrop implements Crop { public void setActions(ActionInterface[] actions) { this.actions = actions; } + + public boolean canRotate() { + return rotation; + } + + public void setCanRotate(boolean rotation) { + this.rotation = rotation; + } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index de7953b..96b49ac 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -180,12 +180,13 @@ mechanics: # 将原版物品转换为customcrops插件农作物 # 你需要为此制作额外的模型和配置 convert-to-customcrops: - enable: false + enable: true list: - WHEAT_SEEDS: wheat - CARROT: carrot - POTATO: potato - BEETROOT_SEEDS: beetroot + APPLE: apple + #WHEAT_SEEDS: wheat + #CARROT: carrot + #POTATO: potato + #BEETROOT_SEEDS: beetroot # This option requires a skill-plugin hook # Which would increase the amount of crops player get diff --git a/src/main/resources/crops_itemsadder.yml b/src/main/resources/crops_itemsadder.yml index ac6660e..a6d37f7 100644 --- a/src/main/resources/crops_itemsadder.yml +++ b/src/main/resources/crops_itemsadder.yml @@ -129,4 +129,81 @@ corn: 3: customcrops:corn_golden_star season: - Summer - - Autumn \ No newline at end of file + - Autumn + + +apple: + other-loots: + loot_1: + item: APPLE + min_amount: 1 + max_amount: 2 + chance: 0.8 + loot_2: + item: APPLE + min_amount: 1 + max_amount: 2 + chance: 1 + return: customcrops:apple_stage_4 + + +pineapple: + quality-loots: + amount: 1~1 + quality: + 1: customcrops:pineapple + 2: customcrops:pineapple_silver_star + 3: customcrops:pineapple_golden_star + gigantic-crop: + block: customcrops:gigantic_pineapple + chance: 0.01 + season: + - Summer + + +pitaya: + quality-loots: + amount: 2~5 + quality: + 1: customcrops:pitaya + 2: customcrops:pitaya_silver_star + 3: customcrops:pitaya_golden_star + return: customcrops:pitaya_stage_4 + + +eggplant: + quality-loots: + amount: 3~7 + quality: + 1: customcrops:eggplant + 2: customcrops:eggplant_silver_star + 3: customcrops:eggplant_golden_star + season: + - Summer + + +chinesecabbage: + quality-loots: + amount: 1~1 + quality: + 1: customcrops:chinese_cabbage + 2: customcrops:chinese_cabbage_silver_star + 3: customcrops:chinese_cabbage_golden_star + season: + - Autumn + - Winter + + +hop: + # Only works in item_frame mode + # To prevent rotation + rotation: false + quality-loots: + amount: 2~5 + quality: + 1: customcrops:hop + 2: customcrops:hop_silver_star + 3: customcrops:hop_golden_star + return: customcrops:hop_stage_1 + season: + - Summer \ No newline at end of file diff --git a/src/main/resources/crops_oraxen.yml b/src/main/resources/crops_oraxen.yml index 2e556fa..d027d79 100644 --- a/src/main/resources/crops_oraxen.yml +++ b/src/main/resources/crops_oraxen.yml @@ -129,4 +129,78 @@ corn: 3: corn_golden_star season: - Summer - - Autumn \ No newline at end of file + - Autumn + + +apple: + other-loots: + loot_1: + item: APPLE + min_amount: 1 + max_amount: 2 + chance: 0.8 + loot_2: + item: APPLE + min_amount: 1 + max_amount: 2 + chance: 1 + return: apple_stage_4 + + +pineapple: + quality-loots: + amount: 1~1 + quality: + 1: pineapple + 2: pineapple_silver_star + 3: pineapple_golden_star + gigantic-crop: + block: gigantic_pineapple + chance: 0.01 + season: + - Summer + + +pitaya: + quality-loots: + amount: 2~5 + quality: + 1: pitaya + 2: pitaya_silver_star + 3: pitaya_golden_star + return: pitaya_stage_4 + + +eggplant: + quality-loots: + amount: 3~7 + quality: + 1: eggplant + 2: eggplant_silver_star + 3: eggplant_golden_star + season: + - Summer + + +chinesecabbage: + quality-loots: + amount: 1~1 + quality: + 1: chinese_cabbage + 2: chinese_cabbage_silver_star + 3: chinese_cabbage_golden_star + season: + - Autumn + - Winter + + +hop: + quality-loots: + amount: 2~5 + quality: + 1: hop + 2: hop_silver_star + 3: hop_golden_star + return: hop_stage_1 + season: + - Summer \ No newline at end of file