mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-29 11:59:15 +00:00
untested offline growth
This commit is contained in:
@@ -42,10 +42,10 @@ public interface ConditionManager extends Reloadable {
|
||||
|
||||
@Nullable ConditionFactory getConditionFactory(String type);
|
||||
|
||||
static boolean isConditionMet(CustomCropsBlock block, Condition... conditions) {
|
||||
static boolean isConditionMet(CustomCropsBlock block, boolean offline, Condition... conditions) {
|
||||
if (conditions == null) return true;
|
||||
for (Condition condition : conditions) {
|
||||
if (!condition.isConditionMet(block)) {
|
||||
if (!condition.isConditionMet(block, offline)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ import net.momirealms.customcrops.api.mechanic.world.CustomCropsBlock;
|
||||
|
||||
public interface Condition {
|
||||
|
||||
boolean isConditionMet(CustomCropsBlock block);
|
||||
boolean isConditionMet(CustomCropsBlock block, boolean offline);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SimpleLocation {
|
||||
return worldName;
|
||||
}
|
||||
|
||||
public ChunkPos getChunkCoordinate() {
|
||||
public ChunkPos getChunkPos() {
|
||||
return new ChunkPos(x >> 4, z >> 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,5 +2,5 @@ package net.momirealms.customcrops.api.mechanic.world;
|
||||
|
||||
public interface Tickable {
|
||||
|
||||
void tick(int interval);
|
||||
void tick(int interval, boolean offline);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class WorldSetting implements Cloneable {
|
||||
private final int potPerChunk;
|
||||
private final int sprinklerPerChunk;
|
||||
private final int randomTickSpeed;
|
||||
private final int maxOfflineTime;
|
||||
private final boolean tickCropRandomly;
|
||||
private final boolean tickPotRandomly;
|
||||
private final boolean tickSprinklerRandomly;
|
||||
@@ -47,6 +48,7 @@ public class WorldSetting implements Cloneable {
|
||||
boolean tickSprinklerRandomly,
|
||||
int tickSprinklerInterval,
|
||||
boolean offlineGrow,
|
||||
int maxOfflineTime,
|
||||
boolean enableSeason,
|
||||
boolean autoSeasonChange,
|
||||
int seasonDuration,
|
||||
@@ -61,6 +63,7 @@ public class WorldSetting implements Cloneable {
|
||||
this.tickPotInterval = tickPotInterval;
|
||||
this.tickSprinklerInterval = tickSprinklerInterval;
|
||||
this.offlineGrow = offlineGrow;
|
||||
this.maxOfflineTime = maxOfflineTime;
|
||||
this.enableSeason = enableSeason;
|
||||
this.autoSeasonChange = autoSeasonChange;
|
||||
this.seasonDuration = seasonDuration;
|
||||
@@ -84,6 +87,7 @@ public class WorldSetting implements Cloneable {
|
||||
boolean tickSprinklerRandomly,
|
||||
int tickSprinklerInterval,
|
||||
boolean offlineGrow,
|
||||
int maxOfflineTime,
|
||||
boolean enableSeason,
|
||||
boolean autoSeasonChange,
|
||||
int seasonDuration,
|
||||
@@ -102,6 +106,7 @@ public class WorldSetting implements Cloneable {
|
||||
tickSprinklerRandomly,
|
||||
tickSprinklerInterval,
|
||||
offlineGrow,
|
||||
maxOfflineTime,
|
||||
enableSeason,
|
||||
autoSeasonChange,
|
||||
seasonDuration,
|
||||
@@ -168,15 +173,6 @@ public class WorldSetting implements Cloneable {
|
||||
return scheduledTick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldSetting clone() {
|
||||
try {
|
||||
return (WorldSetting) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean randomTickCrop() {
|
||||
return tickCropRandomly;
|
||||
}
|
||||
@@ -188,4 +184,17 @@ public class WorldSetting implements Cloneable {
|
||||
public boolean randomTickPot() {
|
||||
return tickPotRandomly;
|
||||
}
|
||||
|
||||
public int getMaxOfflineTime() {
|
||||
return maxOfflineTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldSetting clone() {
|
||||
try {
|
||||
return (WorldSetting) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user