Jump to content

SuperKid

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by SuperKid

  1. I tried to do it but aint sure how. my machine does ItemStack itemstack = new ItemStack(OthersMod.customFood); mixerItemStacks[2] = itemstack.copy(); but that just makes the item with the status i declared on the mods class customFood = new CustomFood(5,false); GameRegistry.registerItem(customFood,customFood.getUnlocalizedName()); how can i change it before i copy it to have the information? i dont need to make a new item for each? causse if i change the OthersMod.customFood then it changes every instance of it. Edit: i pretty sure its not the right way but i am giving it nbt data like public void createItemStackNBT(ItemStack itemStack) { itemStack.stackTagCompound = new NBTTagCompound(); } public void setItemStackHealth(ItemStack itemstack, int i) { System.out.println(i); itemstack.stackTagCompound.setInteger("health", i); } and calling it like public void createItemStackNBT(ItemStack itemStack) { itemStack.stackTagCompound = new NBTTagCompound(); } public void setItemStackHealth(ItemStack itemstack, int i) { System.out.println(i); itemstack.stackTagCompound.setInteger("health", i); } seems to start to work this way. the only thing i didnt figure out is the icon thing, as you dont get the itemstack on the getIconFromDamage function EDIT: After changing @Override public int getRenderPasses(int metadata) { return requiresMultipleRenderPasses() ? 2 : 1; } @Override @SideOnly(Side.CLIENT) public boolean requiresMultipleRenderPasses() { return true; } i could override @Override @SideOnly(Side.CLIENT) public IIcon getIcon(ItemStack stack, int pass) that it let me use the stack nbt data! the particles when eating are still weird... but meh
  2. ahh, i see what you mean. so i am suppose to make new ItemStack of the instance declared item like ItemStack itemstack = new ItemStack(OthersMod.customFood); mixerItemStacks[2] = itemstack.copy(); I am having some issues changing the icon after this, but i will keep trying.
  3. I got a tile entity that mixes between a potion and a food, and it goes like mixerItemStacks[2] = new ItemStack((Item)new CustomFood(health,this.mixerItemStacks[1].getItem(),this.mixerItemStacks[0].getItem())); to the constructor public CustomFood(int health,Item food,Item potion) { this(health, false); _food=food; //_potion=potion; } i can see that something is wrong at the moment with it as the item created (the custom food) disappears after relloging Edit: I guess the dissapearing thing is just me not saving the _food info
  4. i did override the public IIcon getIconFromDamage(int par1) as i shown on the post before (sorry i added the code a bit late)
  5. For some reason its having issues spawning the particles when setting the icon this way my class public class CustomFood extends ItemFood { private Item _food; public CustomFood(int health, boolean isWolfFood) { super(health, isWolfFood); this.setUnlocalizedName("customFood"); this.setCreativeTab(OthersMod.othersTab); this.setAlwaysEdible(); } public CustomFood(int health,Item food) { this(health, false); _food=food; } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int par1) { if(_food != null) return _food.getIconFromDamage(par1); else return super.getIconFromDamage(par1); } }
  6. Thanks for the answer! i made it like @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int par1) { if(_food != null) return _food.getIconFromDamage(par1); else return super.getIconFromDamage(par1); } sure is better way, but it works for now
  7. Hello, I am trying to imitate some items by getting their texture. How can i get the texture name. like i can set it using setTextureName("") but there is no getTextureName. The only thing like it is getIconString() but its not public. Thanks for the help!
  8. I fixed the issue, thanks anyways. the problem was with syncing to server @Override public Packet getDescriptionPacket() { NBTTagCompound var1 = new NBTTagCompound(); this.writeToNBT(var1); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 2, var1); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) { super.onDataPacket(net, packet); readFromNBT(packet.func_148857_g()); }
  9. Hello, I am making a "multiblock" structure that requires 3 blocks one of top of the other to make it full, if it full it changes a variable called fullPole to true I aint sure why, i change the variable when the last block is placed, but when i try to read it from other class it doesnt work. public class TileEntityShowerPole extends TileEntity { public boolean fullPole; public void readFromNBT(NBTTagCompound nbtdata) { super.readFromNBT(nbtdata); this.fullPole = nbtdata.getBoolean("fullPole"); } public void writeToNBT(NBTTagCompound nbtdata) { super.writeToNBT(nbtdata); nbtdata.setBoolean("fullPole", this.fullPole); } public TileEntityShowerPole() { fullPole=false; } public void TestFullPole(World world,int x,int y,int z) { if (world.getBlock(x, y-1, z) == OthersMod.showerPole) { if (world.getBlock(x, y-2, z) == OthersMod.showerPole) { fullPole=true; return; } } fullPole=false; } } When i try to read it like @Override public boolean canPlaceBlockAt(World world, int x, int y, int z) { TileEntityShowerPole tileEntityShowerPole = (TileEntityShowerPole)world.getTileEntity(x, y, z-1); if (tileEntityShowerPole!=null) System.out.println(tileEntityShowerPole.fullPole); } i always get false. when i right click the block @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if(!world.isRemote){ TileEntityShowerPole tileEntityShowerPole = (TileEntityShowerPole)world.getTileEntity(x, y, z); if (tileEntityShowerPole!=null) System.out.println(tileEntityShowerPole.fullPole); } return true; } i get true. i am running the TestFullPole on the ShowerPole onBlockAdded Someone know what i am doing wrong? Edit: The z-1 thing on can place is intentional, after printing the coordinates its the exact same.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.