added liquidDamageDisabled inspired by TIS additions and ported by permission by Fallen Breath
This commit is contained in:
1 parent
4a580a5a42
commit
5b80c845c6
3 files changed
+39
No files matched your search
@@ -513,6 +513,9 @@ public class CarpetSettings
|
|||||||
@Rule(desc = "placing blocks cause block updates", category = CREATIVE)
|
@Rule(desc = "placing blocks cause block updates", category = CREATIVE)
|
||||||
public static boolean interactionUpdates = true;
|
public static boolean interactionUpdates = true;
|
||||||
|
|
||||||
|
@Rule(desc = "Disables breaking of blocks caused by flowing liquids", category = CREATIVE)
|
||||||
|
public static boolean liquidDamageDisabled = false;
|
||||||
|
|
||||||
@Rule(
|
@Rule(
|
||||||
desc = "smooth client animations with low tps settings",
|
desc = "smooth client animations with low tps settings",
|
||||||
extra = "works only in SP, and will slow down players",
|
extra = "works only in SP, and will slow down players",
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Material;
|
||||||
|
import net.minecraft.fluid.FlowableFluid;
|
||||||
|
import net.minecraft.fluid.Fluid;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(FlowableFluid.class)
|
||||||
|
public class FlowableFluid_liquidDamageDisabledMixin
|
||||||
|
{
|
||||||
|
@Inject(
|
||||||
|
method = "canFill",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/block/Material;blocksMovement()Z"
|
||||||
|
),
|
||||||
|
cancellable = true
|
||||||
|
)
|
||||||
|
private void stopBreakingBlock(BlockView world, BlockPos pos, BlockState state, Fluid fluid, CallbackInfoReturnable<Boolean> cir)
|
||||||
|
{
|
||||||
|
if (CarpetSettings.liquidDamageDisabled)
|
||||||
|
{
|
||||||
|
Material material = state.getMaterial();
|
||||||
|
cir.setReturnValue(material == Material.AIR || material.isLiquid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
"Structure_fillUpdatesMixin",
|
"Structure_fillUpdatesMixin",
|
||||||
"ServerPlayNetworkHandler_interactionUpdatesMixin",
|
"ServerPlayNetworkHandler_interactionUpdatesMixin",
|
||||||
|
|
||||||
|
"FlowableFluid_liquidDamageDisabledMixin",
|
||||||
|
|
||||||
"ServerMetadata_motdMixin",
|
"ServerMetadata_motdMixin",
|
||||||
"MinecraftServer_pingPlayerSampleLimit",
|
"MinecraftServer_pingPlayerSampleLimit",
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user