Jump to content

MineDen

Members
  • Posts

    47
  • Joined

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

MineDen's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  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!
×
×
  • Create New...

Important Information

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