mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-27 23:33:14 +00:00
New stuff for the mirrored jar
Added new icon by HellFirePvP
This commit is contained in:
1 parent
2df0995c0d
commit
f711061253
15 files changed
+363
-46
No files matched your search
@@ -2,17 +2,22 @@ package makeo.gadomancy.common.blocks;
|
||||
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileRemoteJar;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileStickyJar;
|
||||
import makeo.gadomancy.common.registration.RegisteredItems;
|
||||
import makeo.gadomancy.common.utils.NBTHelper;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
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.World;
|
||||
import thaumcraft.common.blocks.BlockJar;
|
||||
import thaumcraft.common.config.ConfigItems;
|
||||
import thaumcraft.common.tiles.TileJarFillable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -48,6 +53,23 @@ public class BlockRemoteJar extends BlockJar {
|
||||
this.iconJarBottom = ir.registerIcon(Gadomancy.MODID + ":transparent");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> drops = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
|
||||
for(ItemStack drop : drops) {
|
||||
if(drop.getItem() == ConfigItems.itemJarFilled || drop.getItem() == Item.getItemFromBlock(this)) {
|
||||
drop.func_150996_a(Item.getItemFromBlock(this));
|
||||
|
||||
TileRemoteJar tile = getJarTile(world, x, y, z);
|
||||
if(tile.networkId != null) {
|
||||
NBTHelper.setUUID(NBTHelper.getData(drop), "networkId", tile.networkId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return drops;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float these, float are, float variables) {
|
||||
ItemStack heldItem = player.getHeldItem();
|
||||
@@ -59,4 +81,20 @@ public class BlockRemoteJar extends BlockJar {
|
||||
}
|
||||
return super.onBlockActivated(world, x, y, z, player, side, these, are, variables);
|
||||
}
|
||||
|
||||
public static TileRemoteJar getJarTile(TileEntity tile) {
|
||||
if (tile != null) {
|
||||
if (tile instanceof TileRemoteJar) {
|
||||
return (TileRemoteJar) tile;
|
||||
}
|
||||
if (tile instanceof TileStickyJar && ((TileStickyJar) tile).getParent() instanceof TileRemoteJar) {
|
||||
return (TileRemoteJar) ((TileStickyJar) tile).getParent();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static TileRemoteJar getJarTile(World world, int x, int y, int z) {
|
||||
return getJarTile(world.getTileEntity(x, y, z));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user