Skip to content

Commit d49c0e9

Browse files
Add class check to LeavesBlockMixin (#6 from @samedifferent)
2 parents ecf50b9 + c5352ab commit d49c0e9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/io/github/therookiecoder/snowyleavesplus/mixin/LeavesBlockMixin.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,18 @@ public class LeavesBlockMixin {
2121
// Add the snowiness property to leaf blocks
2222
@Inject(method = "appendProperties", at = @At("TAIL"))
2323
private void appendPropertiesInject(StateManager.Builder<Block, BlockState> builder, CallbackInfo ci) {
24+
if (!this.getClass().equals(LeavesBlock.class)) {
25+
return;
26+
}
2427
builder.add(SNOWINESS);
2528
}
2629

2730
// Set the default snowiness to none
2831
@Inject(method = "<init>", at = @At("TAIL"))
2932
private void initInject(AbstractBlock.Settings settings, CallbackInfo ci) {
33+
if (!this.getClass().equals(LeavesBlock.class)) {
34+
return;
35+
}
3036
((BlockInvoker) this)
3137
.invokeSetDefaultState(
3238
((LeavesBlock)(Object) this)
@@ -40,6 +46,9 @@ private void initInject(AbstractBlock.Settings settings, CallbackInfo ci) {
4046
// Always randomly tick leaf blocks
4147
@Inject(method = "hasRandomTicks", at = @At("RETURN"), cancellable = true)
4248
private void hasRandomTicksInject(BlockState state, CallbackInfoReturnable<Boolean> cir) {
49+
if (!this.getClass().equals(LeavesBlock.class)) {
50+
return;
51+
}
4352
cir.setReturnValue(true);
4453
}
4554

@@ -51,6 +60,9 @@ private void randomTickInject(
5160
Random random,
5261
CallbackInfo ci
5362
) {
63+
if (!this.getClass().equals(LeavesBlock.class)) {
64+
return;
65+
}
5466
Snowiness currentSnowiness = state.get(SNOWINESS);
5567
if (
5668
// If it's snowing

0 commit comments

Comments
 (0)