mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-25 18:09:28 +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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user