added TNTDoNotUpdate mixins

This commit is contained in:
DeadlyMC committed 2019-05-18 12:26:18 +05:30
1 parent 16dbf17af0
commit 277f0e96a7
2 files changed
+23 -1

No files matched your search

@@ -0,0 +1,21 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.TntBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(TntBlock.class)
public abstract class TntBlockMixin
{
// Add carpet rule check for TNTDoNotUpdate to an if statement.
@Redirect(method = "onBlockAdded", at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/World;isReceivingRedstonePower(Lnet/minecraft/util/math/BlockPos;)Z"))
private boolean isTNTDoNotUpdate(World world, BlockPos blockPos)
{
return !CarpetSettings.getBool("TNTDoNotUpdate") && world.isReceivingRedstonePower(blockPos);
}
}