-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrostedIceBlockMixin.java
More file actions
34 lines (29 loc) · 1.32 KB
/
FrostedIceBlockMixin.java
File metadata and controls
34 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package westeroscraft.mixin;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.FrostedIceBlock;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import westeroscraft.config.WesterosCraftConfig;
@Mixin(FrostedIceBlock.class)
public abstract class FrostedIceBlockMixin {
protected FrostedIceBlockMixin() {}
@Inject(method = "tick", at = @At("HEAD"), cancellable=true)
private void doTick(BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, RandomSource randomSource, CallbackInfo ci) {
if (WesterosCraftConfig.disableIceMelt) {
ci.cancel();
}
}
@Inject(method = "slightlyMelt", at = @At("HEAD"), cancellable=true)
private void doSlightlyMelt(BlockState bs, Level lvl, BlockPos pos, CallbackInfoReturnable<Boolean> ci) {
if (WesterosCraftConfig.disableIceMelt) {
ci.setReturnValue(Boolean.FALSE);
}
}
}