diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerBlock.java index 7c002e81a..c94a8b49d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerBlock.java @@ -67,11 +67,13 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IBE .25f) { + .subtract(Vec3.atCenterOf(context.getClickedPos()) + .subtract(normal.scale(.5))) + .multiply(normal); + if (location.length() > .75f) { if (!context.getLevel().isClientSide) withBlockEntityDo(context.getLevel(), context.getClickedPos(), DeployerBlockEntity::changeMode); return InteractionResult.SUCCESS; @@ -110,11 +112,13 @@ public class DeployerBlock extends DirectionalAxisKineticBlock implements IBE getBlockEntities() { + return blockEntities.values(); + } public Iterable getRenderedBlockEntities() { return renderedBlockEntities; diff --git a/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java index 608f3d612..6f16bda7e 100644 --- a/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java +++ b/src/main/java/com/simibubi/create/content/schematics/filtering/SchematicInstances.java @@ -6,17 +6,20 @@ import javax.annotation.Nullable; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; +import com.simibubi.create.content.contraptions.components.structureMovement.StructureTransform; import com.simibubi.create.content.schematics.SchematicWorld; import com.simibubi.create.content.schematics.item.SchematicItem; import com.simibubi.create.foundation.utility.WorldAttached; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtUtils; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; @@ -65,6 +68,11 @@ public class SchematicInstances { StructurePlaceSettings settings = SchematicItem.getSettings(schematic); activeTemplate.placeInWorld(world, anchor, anchor, settings, wrapped.getRandom(), Block.UPDATE_CLIENTS); + StructureTransform transform = new StructureTransform(settings.getRotationPivot(), Direction.Axis.Y, + settings.getRotation(), settings.getMirror()); + for (BlockEntity be : world.getBlockEntities()) + transform.apply(be); + return world; } diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueSettingsInputHandler.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueSettingsInputHandler.java index cb91df4d9..6050198c0 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueSettingsInputHandler.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/ValueSettingsInputHandler.java @@ -15,6 +15,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; @@ -63,15 +64,20 @@ public class ValueSettingsInputHandler { if (valueSettingsBehaviour.onlyVisibleWithWrench() && !AllItemTags.WRENCH.matches(player.getItemInHand(hand))) continue; - if (valueSettingsBehaviour.getSlotPositioning()instanceof ValueBoxTransform.Sided sidedSlot) + if (valueSettingsBehaviour.getSlotPositioning()instanceof ValueBoxTransform.Sided sidedSlot) { + if (!sidedSlot.isSideActive(sbe.getBlockState(), ray.getDirection())) + continue; sidedSlot.fromSide(ray.getDirection()); - if (!valueSettingsBehaviour.testHit(ray.getLocation())) + } + + boolean fakePlayer = player instanceof FakePlayer; + if (!valueSettingsBehaviour.testHit(ray.getLocation()) && !fakePlayer) continue; event.setCanceled(true); event.setCancellationResult(InteractionResult.SUCCESS); - if (!valueSettingsBehaviour.acceptsValueSettings()) { + if (!valueSettingsBehaviour.acceptsValueSettings() || fakePlayer) { valueSettingsBehaviour.onShortInteract(player, hand, ray.getDirection()); return; }