Skip to content

Commit

Permalink
Inventory Pickup: Toolbox, Wires, Balloons, Fluorescent Tubes, Samples (
Browse files Browse the repository at this point in the history
#5834)

* Insert coils direct to inventory with wirecutters

* Insert toolbox directly to inventory

* Insert balloon directly to inventory

* Insert fluorescent tube directly to inventory

* Insert core samples directly to inventory

* Update wording for shift => sneak

* Update wording for balloon & clean manual entry
  • Loading branch information
voidsong-dragonfly authored Jan 1, 2024
1 parent 07c44de commit a11c16f
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import net.minecraft.nbt.Tag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
Expand Down Expand Up @@ -201,6 +203,13 @@ public void removeAndDropConnection(Connection c, BlockPos dropAt, Level world)
world.addFreshEntity(new ItemEntity(world, dx, dy, dz, c.type.getWireCoil(c)));
}

public void removeInsertAndDropConnection(Connection c, Player player, Level world)
{
removeConnection(c);
if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS))
world.addFreshEntity(new ItemEntity(world, player.getX(), player.getY(), player.getZ(), c.type.getWireCoil(c), 0, 0, 0));
}

private void splitNet(LocalWireNetwork oldNet)
{
Collection<LocalWireNetwork> newNets = oldNet.split(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ public boolean interact(Direction side, Player player, InteractionHand hand, Ite
{
if(!level.isClientSide)
{
ItemEntity entityitem = new ItemEntity(level, getBlockPos().getX()+.5, getBlockPos().getY()+.5,
getBlockPos().getZ()+.5, getPickBlock(player, getBlockState(), new BlockHitResult(new Vec3(hitX, hitY, hitZ), side, worldPosition, false)));
entityitem.setDefaultPickUpDelay();
ItemEntity entityitem = new ItemEntity(level, player.getX(), player.getY(), player.getZ(),
getPickBlock(player, getBlockState(), new BlockHitResult(new Vec3(hitX, hitY, hitZ), side, worldPosition, false)),
0, 0, 0);
level.removeBlock(getBlockPos(), false);
level.addFreshEntity(entityitem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public boolean interact(Direction side, Player player, InteractionHand hand, Ite
{
if(!level.isClientSide)
{
ItemEntity entityitem = new ItemEntity(level, getBlockPos().getX()+.5, getBlockPos().getY()+.5, getBlockPos().getZ()+.5,
coresample);
entityitem.setDefaultPickUpDelay();
ItemEntity entityitem = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), coresample, 0, 0, 0);
level.removeBlock(worldPosition, false);
level.addFreshEntity(entityitem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ public InteractionResult interactAt(Player player, Vec3 targetVec3, InteractionH
entityData.set(dataMarker_angleHorizontal, angleHorizontal);
return InteractionResult.SUCCESS;
}
else if (player.isShiftKeyDown())
{
if(isAlive()&&!level.isClientSide&&player.getItemInHand(hand).isEmpty())
{
ItemStack tube = new ItemStack(Misc.FLUORESCENT_TUBE);
FluorescentTubeItem.setRGB(tube, rgb);
ItemEntity ent = new ItemEntity(level, player.getX(), player.getY(), player.getZ(), tube, 0, 0, 0);
level.addFreshEntity(ent);
discard();
}
return InteractionResult.SUCCESS;
}
return super.interactAt(player, targetVec3, hand);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.GameRules;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
Expand Down Expand Up @@ -155,7 +156,8 @@ public InteractionResult useOn(UseOnContext context)
AtomicBoolean cut = new AtomicBoolean(false);
net.removeAllConnectionsAt(nodeHere, conn -> {
ItemStack coil = conn.type.getWireCoil(conn);
world.addFreshEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), coil));
if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS))
world.addFreshEntity(new ItemEntity(world, player.getX(), player.getY(), player.getZ(), coil, 0, 0, 0));
cut.set(true);
});
if(cut.get())
Expand All @@ -180,7 +182,7 @@ public InteractionResultHolder<ItemStack> use(Level world, Player player, @Nonnu
Connection target = WireUtils.getTargetConnection(world, player, null, reachDistance);
if(target!=null)
{
GlobalWireNetwork.getNetwork(world).removeAndDropConnection(target, player.blockPosition(), world);
GlobalWireNetwork.getNetwork(world).removeInsertAndDropConnection(target, player, world);
damageStack(stack, player, hand);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ Balloon
...just make 99 of them
<&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 <link;metalconstruction;Structural Connectors;connector_recipes> 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.
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.

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 on a balloon will let you pick it 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.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ The coil is disabled unless supplied with a redstone signal. Rightclicking it wi
In addition to damage, the shocks will also apply a lingering debuff, "Stunned", preventing the entity from teleporting.
Rightclicking the coil with an Engineer's Screwdriver while sneaking will toggle the coil between high- and low-power mode. to be able to do so safely the coil has to be turned off. It is in high-power mode by default. When the coil is in low-power mode it will use half the usual energy and have half the range.<np>
<&faraday_recipes>If you are wearing a full Faraday suit, a coil in low-power mode won't harm you, but still shoot lightning at you. The suit will also protect you from uninsulated wiring. Coils in high-power mode use special techniques to make their discharges more lethal and will cause the suit to melt, thereby increasing the damage done to you and additionally damaging the suit.<np>
<&tube_recipes>Fluorescent tubes glow when placed inside a strong high-frequency electric field. Such a frequency is generated by any tesla coil, so placing a tube near an active tesla coil will cause it to glow. The range is about 1.5 times the range in which you will be hit by lightning. They can be colored in the engineer's workbench and rotated by shift + rightclicking them with an Engineer's Hammer.
<&tube_recipes>Fluorescent tubes glow when placed inside a strong high-frequency electric field. Such a frequency is generated by any tesla coil, so placing a tube near an active tesla coil will cause it to glow. The range is about 1.5 times the range in which you will be hit by lightning. They can be colored in the engineer's workbench and rotated by sneak + rightclicking them with an Engineer's Hammer. Tubes can be picked up directly by sneak + rightclicking with an empty hand.

0 comments on commit a11c16f

Please sign in to comment.