Jump to content

ItsAMysteriousYT

Members
  • Posts

    785
  • Joined

  • Last visited

Everything posted by ItsAMysteriousYT

  1. OnBlockPlacedBy doesn't work for me either - i try setting rotation of a tileentity with it. Probably this is a forge bug?
  2. Is there a way to bind a texture to a 3dmodel without using a resourcelocation?
  3. Am i able to create moving lights with that?
  4. Im searching for a way to store a player in another players IEEP and the player should still be in there when the other player changes his name. What variable of EntityPlayer do i have to use for that?
  5. No, don't do that - render classes can only be registered on the CLIENT, whereas TileEntities themselves need to be registered on both sides (i.e. 'common' code). You are just asking to crash your mod when you play it multiplayer by writing code like that - rendering registrations should all be in the ClientProxy. EDIT: I reread your post and see that snippet IS in your ClientProxy, in which case are you also registering the TileEntities on the server? Because the server will need to know about them, too, and it won't if they only get registered in the ClientProxy. No actually they don't - thanks for that
  6. Nono, its okay, just was wondering about where i had to update it Thanks!
  7. For the updating procedure, do i just call onUpdate in my TileEntity then or do i have to make that out of the itemStack somehow so it does not forcecrash the game?
  8. So i just have to get the value change it and saveit back all in the NBT? Okay, strange that minecraft hasn't got a better way yet.
  9. Oh - true, i tried that once, where else should i store it? IEEP would make sense here i think.
  10. Better? @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected); if(!stack.hasTagCompound()){ NBTTagCompound batteryTag = new NBTTagCompound(); batteryTag.setFloat("Voltage", voltage); stack.writeToNBT(batteryTag); }else { NBTTagCompound batteryTag = stack.getTagCompound(); batteryTag.setFloat("Voltage", voltage); stack.writeToNBT(batteryTag); } }
  11. Okay - ill add a check then if the stack holds a tag already.
  12. Im sorry - struggeling with this atm too. Here is a tutorial that should help: http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571597-forge-1-6-4-1-8-custom-inventories-in-items-and
  13. Okay - im doing this right now - is this right? package itsamysterious.mods.reallifemod.core.items; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; public class ItemBattery extends Item{ private float voltage; public ItemBattery() { this.voltage=100; setUnlocalizedName("itemBattery"); GameRegistry.registerItem(this, getUnlocalizedName().substring(5)); } @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected); NBTTagCompound batteryTag = new NBTTagCompound(); batteryTag.setFloat("Voltage", voltage); stack.writeToNBT(batteryTag); } public boolean updateItemStackNBT(NBTTagCompound nbt) { NBTTagCompound batteryTag = nbt.getCompoundTag("BatteryTag"); this.voltage=batteryTag.getFloat("Voltage"); return true; } }
  14. Oh - than this is the problem. Make the IInventory thing in your ItemClass i would say.
  15. Yea - i would do that, also - if you don't wanna pay for your server, triangle is a good service, but atm they are in beta and the free servers do not work. Link is http://www.triangle.gs
  16. You need to do super.readFromNBT(combound) and super.writeToNBT(combound)
  17. You can keep it, but its not necessary, just have a method in your clientproxy in which you register all your tileentities. If you wanna make it a bit more easy and don't wanna have all that GameRegistry.registerTileEntity stuff for each of your tiles-use this generic method: private void setupTile(Class<? extends TileEntity> class1, TileEntitySpecialRenderer render) { try { ClientRegistry.bindTileEntitySpecialRenderer(class1, render.getClass().newInstance()); } catch (Exception e) { e.printStackTrace(); } GameRegistry.registerTileEntity(class1, class1.getName()); } It takes in the TileEntity and the relatet renderer
  18. I wanna creat a batteryitem that gets empty after a while when in use(equipped in a specific TileEntity OR Item). How can i save the current energyvalue and where do i have to update it? There is a method called onUpdate i think - anything i have to do special in there e.g only update server/clientSide any packethandling stuff or just changing the energyvalue?
  19. Probably yes, 4.2k views. I think many people wanna make an energysystem here
  20. Yea, my problem is i do not know how to acces the coordinates in the packet or do i have to send them to some static variables?
  21. But it seems to be working perfectly fine.And my packet still won't work.
  22. Okay - the energysystem is working pretty well now, just two thing - first: The blocks do not immediatly update their lighting value(e.g. lanterns) Second: The rotation still does not work in onBlockPlacedBy: My code is @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntity_Electric){ TileEntity_Electric tile = (TileEntity_Electric)tileentity; tile.rotation = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; System.out.println("Succesfully rotated "+tile.getClass().getName()); } } Perhaps it is necessary to say that im extending my own CustomBlock class and not the default BlockClass for the electrisity blocks?
  23. A well okay - now. I found a way doing it with a clientOnly method and render it on the tileentity - see: @SideOnly(Side.CLIENT) public float clientVoltage; //Update method if(worldObj.isRemote) { this.clientVoltage=getVoltage(); } SO, that thing is fixed now - thanks
×
×
  • Create New...

Important Information

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