Posted July 6, 20169 yr So, I was trying to add a custom crafting table but when I place it and right-click it it will for 1 frame (I think) show the gui and then close it again, I know it shows something because when I right-click I get black stripes for a short amount of time (< 1 second) and when I immediately press E it wont open my inventory, my block class: public class CheeseBlocks { public static Block CHEESE_BLOCK; public static Block CHEESE_ORE; public static Block CHEESE_ORE_NETHER; public static Block CHEESE_ORE_END; public static Block QUICK_CHEESE; public static Block COMPLIMENT_MACHINE; public static Block BELGIUM_FLAG; public static Block CHEESE_WORKBENCH; public CheeseBlocks() { init(); register(); } public static void init() { CHEESE_ORE = new CheeseOre().setCreativeTab(DeGeweldigeMod.tabCheeseStuff).setHardness(2F); CHEESE_ORE_NETHER = new CheeseOreNether().setCreativeTab(DeGeweldigeMod.tabCheeseStuff).setHardness(2F); CHEESE_ORE_END = new CheeseOreEnd().setCreativeTab(DeGeweldigeMod.tabCheeseStuff).setHardness(2F); CHEESE_BLOCK = new Block(Material.ROCK).setCreativeTab(DeGeweldigeMod.tabCheeseStuff).setHardness(3F); QUICK_CHEESE = new QuickCheese().setHardness(4F); COMPLIMENT_MACHINE = new ComplimentsMachine(Material.PISTON).setCreativeTab(DeGeweldigeMod.tabCheeseStuff).setHardness(3F); BELGIUM_FLAG = new BelgiumFlag().setCreativeTab(DeGeweldigeMod.tabCheeseStuff).setHardness(2F); CHEESE_WORKBENCH = new CheeseWorkbench().setCreativeTab(DeGeweldigeMod.tabCheeseStuff).setHardness(2F).setUnlocalizedName("cheese_crafting_table"); CheeseUtils.setNames(CHEESE_ORE, "cheese_ore"); CheeseUtils.setNames(CHEESE_ORE_NETHER, "cheese_ore_nether"); CheeseUtils.setNames(CHEESE_ORE_END, "cheese_ore_end"); CheeseUtils.setNames(CHEESE_BLOCK, "cheese_block"); CheeseUtils.setNames(QUICK_CHEESE, "quick_cheese"); CheeseUtils.setNames(COMPLIMENT_MACHINE, "compliment_machine"); CheeseUtils.setNames(BELGIUM_FLAG, "belgium_flag"); CheeseUtils.setNames(CHEESE_WORKBENCH, "cheese_crafting_table"); } public void register() { this.registerBlock(CHEESE_ORE); this.registerBlock(CHEESE_ORE_NETHER); this.registerBlock(CHEESE_ORE_END); this.registerBlock(CHEESE_BLOCK); this.registerBlock(QUICK_CHEESE); this.registerBlock(COMPLIMENT_MACHINE); this.registerBlock(BELGIUM_FLAG); this.registerBlock(CHEESE_WORKBENCH); } private void registerBlock(Block block) { GameRegistry.register(block); GameRegistry.register(new ItemBlock(block).setUnlocalizedName(block.getUnlocalizedName()).setRegistryName(block.getRegistryName())); } } My custom crafting table class: public class CheeseWorkbench extends Block { protected CheeseWorkbench() { super(Material.WOOD); } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { playerIn.displayGui(new CheeseWorkbench.InterfaceCraftingTable(worldIn, pos)); playerIn.addStat(StatList.CRAFTING_TABLE_INTERACTION); return true; } } public static class InterfaceCraftingTable implements IInteractionObject { private final World world; private final BlockPos position; public InterfaceCraftingTable(World worldIn, BlockPos pos) { this.world = worldIn; this.position = pos; } public String getName() { return null; } public boolean hasCustomName() { return false; } public ITextComponent getDisplayName() { return new TextComponentTranslation(CheeseBlocks.CHEESE_WORKBENCH.getUnlocalizedName() + ".name", new Object[0]); } public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { return new ContainerWorkbench(playerInventory, this.world, this.position); } public String getGuiID() { return "minecraft:crafting_table"; } } } http://i.imgur.com/J4rrGt6.png[/img]
July 6, 20169 yr Author Also, my ClientProxy: public class ClientProxy extends CommonProxy { public void registerModels() { registerItemModel(CheeseItems.CHEESE, 0); registerItemModel(CheeseItems.CHEESE_COOKED, 0); registerItemModel(CheeseItems.BREAD_CHEESE, 0); registerItemModel(CheeseItems.CHEESE_APPLE, 0); registerItemModel(CheeseItems.CHEESE_BUCKET, 0); registerItemModel(CheeseItems.CHEESE_INGOT, 0); registerItemModel(CheeseItems.CHEESE_SWORD, 0); registerItemModel(CheeseItems.CHEESE_PICKAXE, 0); registerItemModel(CheeseItems.CHEESE_AXE, 0); registerItemModel(CheeseItems.CHEESE_SHOVEL, 0); registerItemModel(CheeseItems.CHEESE_HOE, 0); registerItemModel(CheeseItems.CHEESE_FLY_STICK, 0); registerItemModel(CheeseItems.CHEESE_HELMET, 0); registerItemModel(CheeseItems.CHEESE_CHESTPLATE, 0); registerItemModel(CheeseItems.CHEESE_LEGGINGS, 0); registerItemModel(CheeseItems.CHEESE_BOOTS, 0); registerBlockModel(CheeseBlocks.CHEESE_ORE, 0); registerBlockModel(CheeseBlocks.CHEESE_ORE_NETHER, 0); registerBlockModel(CheeseBlocks.CHEESE_ORE_END, 0); registerBlockModel(CheeseBlocks.CHEESE_BLOCK, 0); registerBlockModel(CheeseBlocks.QUICK_CHEESE, 0); registerBlockModel(CheeseBlocks.COMPLIMENT_MACHINE, 0); registerBlockModel(CheeseBlocks.BELGIUM_FLAG, 0); registerBlockModel(CheeseBlocks.CHEESE_WORKBENCH, 0); } public void renderEntities() { RenderingRegistry.registerEntityRenderingHandler(EntityCheeseCow.class, new RenderingHandlerCheeseCow()); } private void registerItemModel(Item item, int meta) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), "inventory")); } private void registerBlockModel(Block block, int meta) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(block.getRegistryName(), "inventory")); } } http://i.imgur.com/J4rrGt6.png[/img]
July 7, 20169 yr isRemote does opposite of what you think (and initially anyone else). illogical, but rename probably won't happen. switch that and work from there (i honestly can't tell what else is wrong).
July 7, 20169 yr Author Now, it opens but I can't move any items etc. in it http://i.imgur.com/J4rrGt6.png[/img]
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.