|
| 1 | +package com.cak.pattern_schematics.mixin; |
| 2 | + |
| 3 | +import com.simibubi.create.AllBlocks; |
| 4 | +import com.simibubi.create.Create; |
| 5 | +import com.simibubi.create.content.contraptions.AbstractContraptionEntity; |
| 6 | +import com.simibubi.create.content.contraptions.Contraption; |
| 7 | +import com.simibubi.create.content.contraptions.behaviour.MovementContext; |
| 8 | +import net.minecraft.core.BlockPos; |
| 9 | +import net.minecraft.core.Direction; |
| 10 | +import net.minecraft.world.InteractionHand; |
| 11 | +import net.minecraft.world.entity.player.Player; |
| 12 | +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; |
| 13 | +import org.apache.commons.lang3.tuple.Pair; |
| 14 | +import org.spongepowered.asm.mixin.Mixin; |
| 15 | +import org.spongepowered.asm.mixin.Shadow; |
| 16 | +import org.spongepowered.asm.mixin.injection.At; |
| 17 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 18 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
| 19 | + |
| 20 | +/** |
| 21 | + * Adding interaction for applying schematics onto deployers that are in assembled schematics |
| 22 | + * */ |
| 23 | +@Mixin(value = AbstractContraptionEntity.class, remap = false) |
| 24 | +public class AbstractContraptionEntityMixin { |
| 25 | + |
| 26 | +// @Shadow protected Contraption contraption; |
| 27 | +// |
| 28 | +// @Inject(method = "handlePlayerInteraction", at = @At("HEAD"), cancellable = true) |
| 29 | +// public void handlePlayerInteraction( |
| 30 | +// Player player, BlockPos localPos, Direction side, |
| 31 | +// InteractionHand interactionHand, CallbackInfoReturnable<Boolean> cir |
| 32 | +// ) { |
| 33 | +// Pair<StructureTemplate.StructureBlockInfo, MovementContext> actor = contraption.getActorAt(localPos); |
| 34 | +// if (actor != null && actor.getLeft().state().is(AllBlocks.DEPLOYER.get())) { |
| 35 | +// Create.LOGGER.info("Found deployer"); |
| 36 | +// cir.setReturnValue(true); |
| 37 | +// } |
| 38 | +// } |
| 39 | + |
| 40 | +} |
0 commit comments