23w13a
This commit is contained in:
1 parent
23b7aa0945
commit
4171f9b784
7 files changed
+31
-9
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.BuddingAmethystBlock;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(BlockBehaviour.BlockStateBase.class)
|
||||
public abstract class BlockBehaviourBlockStateBase_mixin
|
||||
{
|
||||
@Shadow public abstract Block getBlock();
|
||||
|
||||
@Inject(method = "getPistonPushReaction", at = @At("HEAD"), cancellable = true)
|
||||
private void onGetPistonPushReaction(CallbackInfoReturnable<PushReaction> cir)
|
||||
{
|
||||
if (CarpetSettings.movableAmethyst && getBlock() instanceof BuddingAmethystBlock)
|
||||
{
|
||||
cir.setReturnValue(PushReaction.NORMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,11 +26,6 @@ public class BuddingAmethystBlock_movableAmethystMixin extends Block {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "getPistonPushReaction(Lnet/minecraft/world/level/block/state/BlockState;)Lnet/minecraft/world/level/material/PushReaction;", cancellable = true)
|
||||
void getPistonBehavior(BlockState state, CallbackInfoReturnable<PushReaction> cir) {
|
||||
if (CarpetSettings.movableAmethyst) cir.setReturnValue(PushReaction.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) {
|
||||
super.playerDestroy(world, player, pos, state, blockEntity, stack);
|
||||
|
||||
Reference in new issue
Block a user