Skip to content

Commit

Permalink
possible ticking world exception fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yurisuika committed Feb 21, 2022
1 parent 534a7e3 commit 6d01f99
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.12

# Mod Properties
mod_version = 1.0.2
mod_version = 1.0.3
maven_group = com.yurisuika.blossom
archives_base_name = blossom

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ private static BlockState updateDistanceFromLogs(BlockState state, WorldAccess w
private static int getDistanceFromLog(BlockState state) {
if (state.isIn(BlockTags.LOGS)) {
return 0;
} else if (state.isIn(BlockTags.LEAVES)) {
return state.get(DISTANCE);
} else {
return 7;
return (state.getBlock() instanceof LeavesBlock || state.getBlock() instanceof FloweringLeavesBlock) ? state.get(DISTANCE) : 7;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.yurisuika.blossom.mixin.block;

import com.yurisuika.blossom.block.FloweringLeavesBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeavesBlock;
import net.minecraft.tag.BlockTags;
Expand All @@ -17,8 +18,8 @@ public class LeavesBlockMixin {
private static void injectDistance(BlockState state, CallbackInfoReturnable<Integer> info) {
if (state.isIn(BlockTags.LOGS)) {
info.setReturnValue(0);
} else if (state.isIn(BlockTags.LEAVES)) {
info.setReturnValue(state.get(DISTANCE));
} else if (state.getBlock() instanceof LeavesBlock || state.getBlock() instanceof FloweringLeavesBlock) {
info.setReturnValue((Integer)state.get(DISTANCE));
} else {
info.setReturnValue(7);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ private void injectTick(CallbackInfo ci) {
bl = true;
intProperty = floweringLeavesBlock.getAgeProperty();
}
} else if (block instanceof LeavesBlock leavesBlock) {
}
else if (block instanceof LeavesBlock leavesBlock) {
if (leavesBlock == Blocks.OAK_LEAVES) {
bl = true;
}
Expand All @@ -54,7 +55,7 @@ private void injectTick(CallbackInfo ci) {
.with(PERSISTENT, blockState.get(PERSISTENT))
);
}
else {
else if (block instanceof FloweringLeavesBlock) {
entity.world.setBlockState(blockPos, blockState.with(intProperty, blockState.get(intProperty) + 1));
}
entity.addCropCounter();
Expand Down

0 comments on commit 6d01f99

Please sign in to comment.