From 0100d40712cbfa3c96b1dbdeddd1f7504a2fa7d6 Mon Sep 17 00:00:00 2001 From: kekzdealer Date: Wed, 13 May 2020 14:52:04 +0200 Subject: Made it so that my jars drop their label when mined (alongside the jar) --- .../common/blocks/Block_ThaumiumReinforcedJar.java | 31 ++++++++++++++++++++-- src/main/resources/assets/kekztech/lang/en_US.lang | 6 ++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java b/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java index d9064214d2..eeb209307e 100644 --- a/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java +++ b/src/main/java/common/blocks/Block_ThaumiumReinforcedJar.java @@ -1,5 +1,6 @@ package common.blocks; +import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -12,14 +13,19 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.Explosion; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.api.aspects.AspectList; import thaumcraft.common.blocks.BlockJar; import thaumcraft.common.config.ConfigBlocks; +import thaumcraft.common.config.ConfigItems; public class Block_ThaumiumReinforcedJar extends BlockJar { @@ -78,7 +84,6 @@ public class Block_ThaumiumReinforcedJar extends BlockJar { final TE_ThaumiumReinforcedVoidJar ite = (TE_ThaumiumReinforcedVoidJar) te; breakBlockWarpy(world, x, y, z, ite.amount, 50, 1.0F); } - super.breakBlock(world, x, y, z, par5, par6); } @@ -111,7 +116,29 @@ public class Block_ThaumiumReinforcedJar extends BlockJar { @Override public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) { - return new ArrayList<>(Collections.singleton(new ItemStack(this, 1, (meta == 3) ? 3 : 0))); + final ArrayList drops = new ArrayList<>(); + drops.add(new ItemStack(this, 1, (meta == 3) ? 3 : 0)); + final TileEntity te = world.getTileEntity(x, y, z); + if(te instanceof TE_ThaumiumReinforcedJar) { + final TE_ThaumiumReinforcedJar ite = (TE_ThaumiumReinforcedJar) te; + if(ite.aspectFilter != null){ + final ItemStack droppedLabel = new ItemStack(ConfigItems.itemResource, 1, 13); + droppedLabel.setTagCompound(new NBTTagCompound()); + final AspectList aspect = new AspectList().add(ite.aspectFilter,0); + aspect.writeToNBT(droppedLabel.getTagCompound()); + drops.add(droppedLabel); + } + } else if(te instanceof TE_ThaumiumReinforcedVoidJar) { + final TE_ThaumiumReinforcedVoidJar ite = (TE_ThaumiumReinforcedVoidJar) te; + if(ite.aspectFilter != null) { + final ItemStack droppedLabel = new ItemStack(ConfigItems.itemResource, 1, 13); + droppedLabel.setTagCompound(new NBTTagCompound()); + final AspectList aspect = new AspectList().add(ite.aspectFilter,0); + aspect.writeToNBT(droppedLabel.getTagCompound()); + drops.add(droppedLabel); + } + } + return drops; } @Override diff --git a/src/main/resources/assets/kekztech/lang/en_US.lang b/src/main/resources/assets/kekztech/lang/en_US.lang index f25ebcbb33..44e72e1cd0 100644 --- a/src/main/resources/assets/kekztech/lang/en_US.lang +++ b/src/main/resources/assets/kekztech/lang/en_US.lang @@ -138,9 +138,9 @@ item.kekztech_crafting_item.16.name=Item Server Blade tile.kekztech_itemproxycable_block.name=Item Proxy Network Cable tile.kekztech_itemproxycable_block.0.desc=Connects Item Proxy Nodes tile.kekztech_itemproxysource_block.name=Item Proxy Network Source -tile:kekztech_itemproxysource_block.0.desc=Point to an inventory to act as source for the item proxy network -tile:kekztech_itemproxysource_block.1.desc=Insert an Integrated Circuit to set the network channel -tile:kekztech_itemproxysource_block.2.desc=Only one source can use one channel on the same network +tile.kekztech_itemproxysource_block.0.desc=Point to an inventory to act as source for the item proxy network +tile.kekztech_itemproxysource_block.1.desc=Insert an Integrated Circuit to set the network channel +tile.kekztech_itemproxysource_block.2.desc=Only one source can use one channel on the same network tile.kekztech_itemproxyendpoint_block.name=Item Proxy Network Endpoint tile.kekztech_itemproxyendpoint_block.0.desc=Point the marked side to where you want to provide an inventory proxy to tile.kekztech_itemproxyendpoint_block.1.desc=Insert an Integrated Circuit to set the network channel -- cgit