package party._2a03.mc.mixin; import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.RespawnAnchorBlock; import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; import net.minecraft.world.World; 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.Mixin; import org.spongepowered.asm.mixin.Shadow; import party._2a03.mc.server.Config; @Mixin(RespawnAnchorBlock.class) public abstract class MixinRespawnAnchorBlock extends Block { @Shadow public static final IntProperty CHARGES = Properties.CHARGES; public MixinRespawnAnchorBlock(Block.Settings settings) { super(settings); this.setDefaultState((BlockState)this.stateManager.getDefaultState().with(CHARGES, 0)); } @Inject(method = "explode", at = @At("HEAD"), cancellable = true) private void onExplode(CallbackInfo ci) { if (Config.getBool("disableRespawnAnchorExplosions") == true) ci.cancel(); } }