mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-04 15:41:38 +00:00
fix(block): 修复作物生长问题
This commit is contained in:
@@ -82,11 +82,9 @@ public class CropBlockBehavior extends BushBlockBehavior {
|
|||||||
if (getRawBrightness(level, pos) >= minGrowLight) {
|
if (getRawBrightness(level, pos) >= minGrowLight) {
|
||||||
int age = this.getAge(state);
|
int age = this.getAge(state);
|
||||||
float randomFloat = RandomUtils.generateRandomFloat(0, 1);
|
float randomFloat = RandomUtils.generateRandomFloat(0, 1);
|
||||||
System.out.println("age: " + age + "ageProperty.max: " + this.ageProperty.max + " -> " + (age < this.ageProperty.max));
|
if (age < this.ageProperty.max && randomFloat < 1.0 / Math.floor(25.0 / this.growSpeed + 1.0)) {
|
||||||
System.out.println("randomFloat: " + randomFloat + "growSpeed: " + this.growSpeed + " -> " + (randomFloat < this.growSpeed));
|
|
||||||
if (age < this.ageProperty.max && randomFloat >= this.growSpeed) {
|
|
||||||
System.out.println("grow");
|
System.out.println("grow");
|
||||||
Reflections.method$Level$setBlock.invoke(level, pos, getStateForAge(state, age + 1), UpdateOption.UPDATE_NONE.flags());
|
Reflections.method$Level$setBlock.invoke(level, pos, getStateForAge(state, age + 1), UpdateOption.UPDATE_ALL.flags());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user