Jump to content

MineDen

Members
  • Posts

    47
  • Joined

Everything posted by MineDen

  1. Oh, I forgot that my TE doesn't extend TileEntityFurnace, and I also forgot to change checking in block code!
  2. Also I want to open furnace GUI but it doesn't open. Here is my code: Block: public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityFurnace) { playerIn.displayGUIChest((TileEntityFurnace) tileentity); playerIn.addStat(TestMod.CHEMICAL_LABORATORY_INTERACT); } return true; } } TileEntity: @Nonnull public String getGuiID() { return "minecraft:furnace"; } @Nonnull public Container createContainer(@Nonnull InventoryPlayer playerInventory, @Nonnull EntityPlayer playerIn) { return new ContainerFurnace(playerInventory, this); }
  3. Okay, I'll try this. UPD: there is no overloads, only string. Is this should be like "testmod:my_tileentity"?
  4. Today I copied and edited furnace tileentity and then started testing. But now I have "TileEntity is missing a mapping! This is a bug!" exception. In 1.9 I can fix it by registering TE with GameRegistry.registerTileEntity(...) but in 1.12 I should use RegistryEvents and here is described types of events, and there is no TileEntity! So how I can register my TE?
  5. Math.round(Math.random() * <count> - 1) is the JavaScript arrays way, and it's my favourite way, so shut up i will use this way.
  6. Is this code right? It works. public static CreativeTabs decoration = new CreativeTabs("mtest_decoration") { @Override public ItemStack getTabIconItem() { int index = (int) Math.round(Math.random() * (MBlocks.BLOCKS.size() - 1)); Block block = MBlocks.BLOCKS.get(index); NonNullList<ItemStack> subBlocks = NonNullList.create(); block.getSubBlocks(CreativeTabs.SEARCH, subBlocks); System.out.println(subBlocks); int meta = (int) Math.round(Math.random() * (subBlocks.size() - 1)); ItemStack is = new ItemStack(block, 1, meta); return is; } };
  7. This method returns void, what I can do?
  8. Sorry, but I can't understand this chain getSubItems>NonNullList>List>ItemStack, CreativeTabs... It is better to make own game on LWJGL 3 with bulit-in modloader always return random block with metadata 0.
  9. This method requires NonNullList of ItemStacks. But why? I trying to call this method from an instance of Item.
  10. But what if i have other block with only one variant?
  11. Hello, I need to get maximum meta value of block. I created a creative tab and returning random block as icon, but I have colored blocks. And I want to return random meta. But I don't know how to get maximum meta value of block. Now my creative tab code looks like this: public static CreativeTabs decoration = new CreativeTabs("mtest_decoration") { @Override public ItemStack getTabIconItem() { int index = (int) Math.round(Math.random() * (MBlocks.BLOCKS.size() - 1)); Block block = MBlocks.BLOCKS.get(index); int meta = 0; ItemStack is = new ItemStack(block, 1, meta); return is; } };
  12. Thanks, Draco18s, diesieben07, Kokkie, loordgek! All works properly!
  13. Here. Lol. Sorry, I'm read only 0.2% of this comments.
  14. I'm adding energy on server side.
  15. RETEST: NBT don't saves automatically. Only /blockdata changes NBT, and after world reload, NBT entered in /blockdata restored.
  16. In 1.12.1, method this.getState() not exist. What method i need to use?
  17. After i typed /blockdata ... ... ... {Energy:5000}, energy changed to 5000 properly. When I reloaded world, energy saved and readed properly! GUI shows 5034 (this is previous value). But /blockdata shows 5000. I need to send energy level to client?
  18. Energy don't change, but after world restart it always maximum. I think, that this is storage creating or update() method problem.
  19. I can record video of what changes in my world.
  20. getEnergy() always returns 10000. /blockdata <x> <y> <z> {} shows {Energy: 10000}.
  21. I recrated zero-argument constructor and uploaded new code to GitHub.
×
×
  • Create New...

Important Information

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