From 0619039d40f58b4b6cb5f485fade299fe5e02cea Mon Sep 17 00:00:00 2001 From: Voidsong Dragonfly Date: Sun, 31 Dec 2023 12:28:40 -0500 Subject: [PATCH] Insert balloon directly to inventory --- .../common/blocks/cloth/BalloonBlockEntity.java | 15 ++++++++++++++- .../immersiveengineering/manual/en_us/balloon.txt | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/blusunrize/immersiveengineering/common/blocks/cloth/BalloonBlockEntity.java b/src/main/java/blusunrize/immersiveengineering/common/blocks/cloth/BalloonBlockEntity.java index f964bcc9aa..21a4019fda 100644 --- a/src/main/java/blusunrize/immersiveengineering/common/blocks/cloth/BalloonBlockEntity.java +++ b/src/main/java/blusunrize/immersiveengineering/common/blocks/cloth/BalloonBlockEntity.java @@ -30,6 +30,7 @@ import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; @@ -145,7 +146,19 @@ public Vec3 getConnectionOffset(ConnectionPoint here, ConnectionPoint other, Wir @Override public boolean interact(Direction side, Player player, InteractionHand hand, ItemStack heldItem, float hitX, float hitY, float hitZ) { - if(!heldItem.isEmpty()&&heldItem.getItem() instanceof IShaderItem) + if(player.isShiftKeyDown()) + { + if(!level.isClientSide) + { + ItemEntity entityitem = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), + new ItemStack(level.getBlockState(getBlockPos()).getBlock()), + 0, 0, 0); + level.removeBlock(getBlockPos(), false); + level.addFreshEntity(entityitem); + } + return true; + } + else if(!heldItem.isEmpty()&&heldItem.getItem() instanceof IShaderItem) { this.shader.setShaderItem(ItemHandlerHelper.copyStackWithSize(heldItem, 1)); markContainingBlockForUpdate(null); diff --git a/src/main/resources/assets/immersiveengineering/manual/en_us/balloon.txt b/src/main/resources/assets/immersiveengineering/manual/en_us/balloon.txt index 61502ed082..e1c2f64cb9 100644 --- a/src/main/resources/assets/immersiveengineering/manual/en_us/balloon.txt +++ b/src/main/resources/assets/immersiveengineering/manual/en_us/balloon.txt @@ -3,6 +3,6 @@ Balloon <&recipe>Balloons are sacks of fabric with a heatsource below to keep them afloat. They will emit light, but despite the torch, they are not a fire hazard. Balloons can be placed like normal blocks, or when no block is targeted, they will be placed in the air infront of you. Similar to you can attach Hemp Rope and Steel Wire to the balloon. -Sneak-clicking allows you to set a height offset for the balloon, allowing you to place it up to 5 blocks above the target. +Sneak-clicking while placing allows you to set a height offset for the balloon, allowing you to place it up to 5 blocks above the target. Sneaking and right-clicking will pick the balloon up. You can also use dyes on a placed balloon; which part you dye depends on where you target it. Rightclicking with an Engineer's Hammer will toggle the balloon's design between horizontal or vertical stripes. \ No newline at end of file