Jump to content

TheMinecraftBox

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by TheMinecraftBox

  1. This is my code: @SubscribeEvent public void saveEnchBlock(ChunkDataEvent.Save data) { for (NBTTagCompound nbt : this.blockEnchList) { if (nbt != null) { NBTTagList nbtList = this.getBlockEnchList(nbt); for (int y = 0; y < nbtList.tagCount(); y++) { NBTTagCompound tag = nbtList.getCompoundTagAt(y); for (int size = 0; size < this.blockEnchList.size(); size++) { if (tag != null) { BlockPos pos = new BlockPos(tag.getInteger("x"), tag.getInteger("y"), tag.getInteger("z")); IBlockState state = world.getBlockState(pos); Block block = state.getBlock(); if (block != null && !(block instanceof BlockLiquid) && !(block instanceof BlockFire) && block != Blocks.AIR) { data.getData().setTag("Block_ENCH" + "_" + size, tag); } else if (block == null || block instanceof BlockLiquid || block instanceof BlockFire || block == Blocks.AIR) { this.removeBlockEnch(tag); } } } } } } } @SubscribeEvent public void loadEnchBlock(ChunkDataEvent.Load data) { for (int j = 1; j < data.getData().getSize(); j++) { if (data.getData().hasKey("Block_ENCH" + "_" + j, 10)) { NBTTagCompound tag = data.getData().getCompoundTag("Block_ENCH" + "_" + j); if (tag != null && !tag.hasNoTags()) { World world = data.getWorld(); if (world != null && !world.isRemote && tag.hasKey("x", 99) && tag.hasKey("y", 99) && tag.hasKey("z", 99)) { this.addNBTToList(tag); //This is the method to add the registered nbt to my blockEnchList. data.getData().removeTag("Block_ENCH" + "_" + j); this.removeNBTTagCompound(tag); //It's for more security. } } else { data.getData().removeTag("Block_ENCH" + "_" + j); this.removeNBTTagCompound(tag); //It's for more security too. } } } } (There are small bugs with the rendering in my code)...
  2. Hello, in my mod, I create data with NBTTagCompound and I use the methods: ChuckDataEvent (Save and Load) and ChunkEvent (Unload). Backup works and loading too. The problem is that when I want to delete the NBT when the player loads the chuck, it works but if the player quits Minecraft and reopens the game. The NBT is added even if it has been deleted during the last connection... How can I fix this?
  3. I found the socution! I changed in the EntityUnicorn x by the this.getEntityId() and I use in the Gui: world.getEntityByID(x). Thank you so much!!!
  4. Yes, I know, but if I make other conditions, it doesn't work... I tried for the entityID but the GUI didn't open... For that, I have to use the getEntityID() instead of my guiID (GUI_UNICORN) ?
  5. Hello, I have created a new entity. They are unicorns and I want them to look like basic horses. But I don't know how to add a graphical interface. I use entityPlayer.openGui but the interface opens and closes instantly... EntityUnicorn: playerEntity.openGui(ModInstance.instance, Gui.GUI_UNICORN, worldIn, pos.getX(), pos.getY(), pos.getZ()); Gui: @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if (new EntityUnicorn(world) != null && new EntityUnicorn(world) instanceof EntityUnicorn) { EntityUnicorn unicorn = new EntityUnicorn(world); return new ContainerUnicornInventory(player.inventory, unicorn.getUnicornChest(), horse, player); } } -------------------------------------------------------------------------------------------------------------------------------------------------- @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { if (new EntityUnicorn(world) != null && new EntityUnicorn(world) instanceof EntityUnicorn) { EntityUnicorn unicorn = new EntityUnicorn(world); return new GuiUnicornInventory(player.inventory, unicorn.getUnicornChest(), unicorn); } } The GUI ID is the 7. Thank you for help me.
  6. I don't know how to add a position in the world with a rendering. I prefer they be like the enchantment particles.
  7. When the block has a custom property (in my custom file and placed in the world), for the visual, I would like to add an animation on the texture of the block. (Like the glint of enchantment: it's a render on the texture). The runes would be my custom texture on the block texture and there would be movement. The runes would be semi-transparent and move diagonally upwards. I hope I'm being clear.
  8. I think add runes can be interesting on the block. Maybe for the shapes, I can use a custom texture. You think there are a more simply solution? The deplacement can be in the diagonal in the up. A litle like the enchantment glint movement.
  9. Okay, I create a custom class and I stock with multi events some datas. I use NBTTagCompound for this and it work. Now I want add an animation in front of the texture of blocks when there are a custom property (NBT) . (In the tag, there are the blocks position, etc... with the custom property). The problem is I don't know how I can add this render. I think RenderWorldLastEvent can resolved that, but I'm not good for the render. Can you help me for add a position for the render or if I can use a better method?
  10. Hello, I no sure to understand. Do you want to change the texture when the player right-click and when the item has invalid texture?
  11. Hum, euh no. I fact I would like add this animation for all blocks had the property and no for juste one. It's for that I think to use RenderWorldLastEvent. Sorry for this misunderstanding. Can you show me an example?
  12. Hello, I working for a mod and I would like add when the block has custom property an animation on the basic textures. I would like using RenderWorldLastEvent but I don't know how I can add the animation position and in front of the block texture. Thank you for help me.
  13. Create a TileEntity and how can I add all blocks Minecraft (in one file if it's possible). Or else, how I can create a NBT with singletons? If it's so hard, I can make one file for one block but it's will so longers...
  14. Okay, I would like that when the player place a enchanted block in the world, the game save the enchantment when the block is broken. With my NBT on my event class, it work but juste for one block. If the player place two blocks with this nbt, there are juste one block with this NBT.
  15. Hello, I'm here because I would like to create more information for every block. I successful to add a nbt but it's juste for one block and for evry world... How can I add a NBTTag for every block placed and for one world and not just one NBT for one block and for every world? I would like use the same system that TileEntities, Entities or ItemStack. (I can't use the TileEntity because I want add this NBTTag for every vanilla Blocks). I'm use the Events: PlaceEvent, HarvestDropsEvent, BreakEvent, ChunkDataEvent.Save and ChunkDataEvent.Load. Thank you for write me!
  16. Hum... yes, if the effect could be move look like the enchanted effect. But how I can use this?
  17. Yes, but the TileEntityRenderer are registered in the TileEntityItemStackRenderer with the method renderTileEntityAt (for the EntityItem) and directly with renderTileEntityAt for the placed block. I have apply the glint texture on my custom chest but there aren't the movement. If I change the rotation, it's for the ModelChest and not the texture... Have you got an idea?
  18. Hello, I create a custom chest with the enchantment animation but I can't apply the animation effect on the chest. How I can add the movement on the Chest? Thank you for the help!
×
×
  • Create New...

Important Information

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