Jump to content

MrBendelScrolls

Members
  • Posts

    115
  • Joined

  • Last visited

Posts posted by MrBendelScrolls

  1. 1 hour ago, Animefan8888 said:

    Also you will need to move your ModelRegistryEvent to another class or it will crash the dedicated server as it is a Client side only class. You also will need to put @SideOnly(SIde.CLIENT) at the top of your class.

    Isn't forge smart enough to call the method with ModelRegistryEvent on the client only?
    I didn't have any problems with this being in the common class.
    And, isn't @SideOnly kind of... "forbidden"?

    • Like 1
    1. Register methods must be static.
    2. You put what you register ;). You can create new items right in that event and then take them from @ObjectHolder class later, or do some form of storage (array, separate instances).
    3. To keep code clean, it's better to move your model registries into the model RegisterHandler and completely get rid of _Items class.
    • Like 1
  2. new ModelResourceLocation(new ResourceLocation(...))?

    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(new ResourceLocation(item.getRegistryName().toString()), "inventory"));

    It should be

    ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));

     

  3. I tried 2nd way and looks like it works fine. So, is this code okay in performance?
     

        @Override
        public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) {
            if (!player.isSneaking()) {
                RayTraceResult rayTrace = rayTrace(player.getEntityWorld(), player, false);
                switch (rayTrace.sideHit.getAxis()) {
                    case X:
                        break;
                    case Y:
                        break;
                    case Z:
                        break;
                }
            }
            return super.onBlockStartBreak(itemstack, pos, player);
        }

    And do I have to check the side to run it on the server only?

×
×
  • Create New...

Important Information

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