Disable respawn anchor explosions
This commit is contained in:
parent
e84fab4abf
commit
654cdbd09a
@ -0,0 +1,34 @@
|
||||
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("disableTntExplosions") == true)
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"server": [
|
||||
"MixinGameModeCommand",
|
||||
"MixinRespawnAnchorBlock",
|
||||
"MixinServerPlayerEntity",
|
||||
"MixinTntBlock",
|
||||
"MixinTntEntity"
|
||||
|
Loading…
Reference in New Issue
Block a user