Jump to content

petersx34

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

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

petersx34's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm working on making a chest that also has a crafting table in the GUI. Everything is working properly with the exception of the crafting result rendering in the first slot of the players hotbar (index 0). If I click on the rendered result, it "moves" to the correct craftResult position. I'm setting the index of craftResult to 99 which through logging, is most definitely the correct position. Does anyone have any ideas on what I'm doing incorrectly? Update: I found what's causing my issue. In InventoryCraffResult the function /** * Removes a stack from the given slot and returns it. */ public ItemStack removeStackFromSlot(int index) { return ItemStackHelper.getAndRemove(this.stackResult, 0); } is sending the resultant to index 0. Final update: Was just easier to shift around my indexing...
  2. Digging into everything a bit further, even though my console says I'm running Forge 14.23.4.2705, my gradle cache shows forge version 1.12.2-14.23.3.2655. I'll update this.
  3. I'm using the recommended MDK Forge version 14.23.4.2705 Are there any that you recommend? The ForgeDocs don't really provide example code but rather a description. Being new to this, it is very useful to be able to compile and run working code that can then be picked apart to understand how things work.
  4. This is McJty's coding style. I am following his tutorial path. If this is incorrect, do you have tutorials available? GameRegistry.registerTileEntity is not deprecated Bullet 1 Bullet 1
  5. Hey all, I need some help getting a tile entity to register properly. I am following McJty's modding tutorial for making a GUI and inventory that can be found on his wiki. I noticed he is using ITileEntityProvider instead of overriding createTileEntity and hasTileEntity so I've modified my code to do so. However, when trying to launch the game, I get the following error in CommonProxy on registering the ItemBlock: java.lang.NullPointerException: null at com.petersx34.rfutilities.proxy.CommonProxy.registerItems(CommonProxy.java:60) ~[CommonProxy.class:?] Any guidance on this would be much appreciated. I have been struggling with it for the better half of the day. Block Code public class SmartCrafterBlock extends Block { public static final int GUI_ID = 1; public SmartCrafterBlock() { super(Material.WOOD); setUnlocalizedName(RFUtilities.MODID + ".smartcrafterblock"); setRegistryName("smartcrafterblock"); setCreativeTab(CreativeTabs.MISC); } @SideOnly(Side.CLIENT) public void initModel() { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory")); } @Override public TileEntity createTileEntity(World world, IBlockState state) { return new SmartCrafterTileEntity(); } @Override public boolean hasTileEntity(IBlockState state) { return true; } @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } TileEntity te = world.getTileEntity(pos); if (!(te instanceof SmartCrafterTileEntity)) { return false; } player.openGui(RFUtilities.instance, GUI_ID, world, pos.getX(), pos.getY(), pos.getZ()); return true; } } ModBlocks public class ModBlocks { @GameRegistry.ObjectHolder("rfutilities:smartcrafterblock") public static SmartCrafterBlock smartCrafterBlock; @SideOnly(Side.CLIENT) public static void initModels() { smartCrafterBlock.initModel(); } @SideOnly(Side.CLIENT) public static void initItemModels() { } } CommonProxy @Mod.EventBusSubscriber public class CommonProxy{ public static Configuration config; public void preInit(FMLPreInitializationEvent e) { File directory = e.getModConfigurationDirectory(); config = new Configuration(new File(directory.getPath(), "rfutilities.cfg")); Config.readConfig(); } public void init(FMLInitializationEvent e) { NetworkRegistry.INSTANCE.registerGuiHandler(RFUtilities.instance, new GuiProxy()); } public void postInit(FMLPostInitializationEvent e) { if (config.hasChanged()) { config.save(); } } @SubscribeEvent public static void registerBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().register(new SmartCrafterBlock()); GameRegistry.registerTileEntity(SmartCrafterTileEntity.class, RFUtilities.MODID + "_smartcrafterblock"); } @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(new ItemLightningBoots()); event.getRegistry().register(new ItemBlock(ModBlocks.smartCrafterBlock).setRegistryName(ModBlocks.smartCrafterBlock.getRegistryName())); } }
×
×
  • Create New...

Important Information

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