1
0
Fork 0

Disable respawn anchor explosions

This commit is contained in:
Ryan Fox 2020-08-02 21:40:41 +00:00
parent e84fab4abf
commit 654cdbd09a
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
2 changed files with 35 additions and 0 deletions

View File

@ -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();
}
}

View File

@ -4,6 +4,7 @@
"compatibilityLevel": "JAVA_8",
"server": [
"MixinGameModeCommand",
"MixinRespawnAnchorBlock",
"MixinServerPlayerEntity",
"MixinTntBlock",
"MixinTntEntity"