mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-27 10:59:20 +00:00
2.0.8
This commit is contained in:
@@ -36,11 +36,11 @@ public interface Crop {
|
||||
|
||||
GiganticCrop getGiganticCrop();
|
||||
|
||||
double getSkillXP();
|
||||
|
||||
OtherLoot[] getOtherLoots();
|
||||
|
||||
ActionInterface[] getActions();
|
||||
|
||||
String getKey();
|
||||
|
||||
boolean canRotate();
|
||||
}
|
||||
|
||||
@@ -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<RequirementInterface> requirementList = new ArrayList<>();
|
||||
for (String requirement : Objects.requireNonNull(config.getConfigurationSection(key + ".requirements")).getKeys(false)) {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -129,4 +129,81 @@ corn:
|
||||
3: customcrops:corn_golden_star
|
||||
season:
|
||||
- Summer
|
||||
- Autumn
|
||||
- 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
|
||||
@@ -129,4 +129,78 @@ corn:
|
||||
3: corn_golden_star
|
||||
season:
|
||||
- Summer
|
||||
- Autumn
|
||||
- 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
|
||||
Reference in New Issue
Block a user