cactus and block rotator

This commit is contained in:
gnembon committed 2019-06-08 01:11:34 -03:00
1 parent fa2ff94258
commit e9d2be34c0
9 files changed
+209 -30

No files matched your search

@@ -0,0 +1,30 @@
package carpet.mixins;
import carpet.helpers.BlockRotator;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerInteractionManager;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
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(ServerPlayerInteractionManager.class)
public class ServerPlayerInteractionManager_cactusMixin
{
@Redirect(method = "interactBlock", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/BlockState;activate(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;Lnet/minecraft/util/hit/BlockHitResult;)Z"
))
private boolean activateWithOptionalCactus(BlockState blockState, World world_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1)
{
Boolean flipped = BlockRotator.flipBlockWithCactus(blockState, world_1, playerEntity_1, hand_1, blockHitResult_1);
if (flipped)
return true;
return blockState.activate(world_1, playerEntity_1, hand_1, blockHitResult_1);
}
}