Jump to content

WildHeart

Members
  • Posts

    236
  • Joined

  • Last visited

Posts posted by WildHeart

  1. 8 minutes ago, larsgerrits said:

    We can't know what other way is possible without knowing what you want to do.

     

    Now that I've read my previous answer again, I understand why it might sound weird. What I meant to say was: if we know what you want to do, why might be able to come up with another solution instead of registering during the game.

    Hrm. Okay, thank you.

  2. Hello, i have a gui, that gives things at the click of a button. I know I need to send packets, do so, but the subject is not given.

    public class SPacketGiveItem extends AbstractPacket<SPacketGiveItem>
    {
        public SPacketGiveItem(){}
    
        @Override
        public void handleClientSide(EntityPlayer player) {
    
        }
    
        @Override
        public void handleServerSide(EntityPlayerMP player)
        {
            player.inventory.addItemStackToInventory(new ItemStack(Items.apple));
        }
    
        @Override
        public void fromBytes(ByteBuf buf)
        {
    
        }
    
        @Override
        public void toBytes(ByteBuf buf)
        {
    
        }
    }

    What could be wrong?

  3. 8 minutes ago, Choonster said:

    If you missed it, please see the edit to my previous post. You're registering models for multiple instances of ItemGreen instead of the single instance you registered.

    There is progress, put this code in the event and my items and variations began to appear.

        @SubscribeEvent
        public void model(ModelRegistryEvent e)
        {
            for(final EnumType type : EnumType.values())
            {
                ModelLoader.setCustomModelResourceLocation(ItemsInit.GREEN, type.getMeta(), new ModelResourceLocation(ItemsInit.GREEN.getRegistryName() + "_" + type.getName(), "inventory"));
            }
        }

    About the new instance, I accidentally ordered new ItemGreen when I added the code here. And so I have everything as it should be, in a variable.

     

    Edit:

    But still for me the innovation in the form of adding models into the event as it is not very practical, I would like the old-fashioned register.

  4. 5 minutes ago, Choonster said:

     

    That's strange. I'm not sure why the FML log wouldn't be created.

     

    If you use ModelLoader.setCustomModelResourceLocation in ModelRegistryEvent, do you get any model errors in the log? Do your items render as the missing model (pink and black cube with the model location string overlayed) or as the desired model with the missing texture (pink and black squares)?

    By the way, another bug, does not display the text object(which was introduced in 1.11). The model uses variation

    2017-06-29_18.27.59.png

  5. 16 minutes ago, Choonster said:

     

    The FML log is fml-client-latest.log, not latest.log.

     

    ModelLoader methods need to be called in ModelRegistryEvent (or preInit, but that's not recommended). They won't work if called in init or later.

     

    If you want help, post more of your code. We need to see when you're registering your models.

    Im not have a fml-client-latest.log

     

    Code in ItemsInit class:

        public void renderRegister()
        {
            for(final EnumType type : EnumType.values())
            {
                this.setRender(new ItemGreen(), type.getMeta(), type.getName());
            }
        }
    
        @SideOnly(Side.CLIENT)
        private void setRender(Item item, final int meta, final String name)
        {
            Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(item.getRegistryName() + "_" + name, "inventory"));
            ModelBakery.registerItemVariants(item, new ResourceLocation(item.getRegistryName() + "_" + name));
        }

     

    Code in ClientProxy class:

    ItemsInit.INSTANCE.renderRegister();

     

    Code in Main class:

        @Mod.EventHandler
        private void init(final FMLInitializationEvent e)
        {
            proxy.init(e);
        }

     

    Screenshot_2.png

  6. 2 hours ago, Choonster said:

    This hasn't changed. If it's not working, there should be an error in the FML log telling you what went wrong.

     

    If you can't figure it out, post your code and the FML log.

     

    One thing that has changed is the order of events: Registry events are now fired after preInit instead of before preInit. If you register everything in the appropriate registry event, you shouldn't need to worry about this.

     

    Side note: ModelLoader.setCustomModelResourceLocation automatically calls ModelBakery.registerItemVariants, you don't need to call it yourself.

    So, i use my old code:

    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(item.getRegistryName() + "_" + name, "inventory"));
    ModelBakery.registerItemVariants(item, new ResourceLocation(item.getRegistryName() + "_" + name));

    And he not work. 1.11.2 in this code works and is already on 1.12 no. latest.log

  7. Hello, I encountered a problem when migrating to 1.12, something seems to have happened with the registration of the options the subject with metadata. I use:

    ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName() + "_" + name, "inventory"));
    ModelBakery.registerItemVariants(item, new ResourceLocation(Reference.MODID, item.getRegistryName() + "_" + name));

    for register models. How to fix?

  8. Problem solved! I use CelientProxy extend ServerProxy. I also have one last question, sometimes entering the world of I have a problem with packages. Ie I have sent the package from the server to the client about how many now of the toxicity of the player. And throws error with NULL

  9. Hello, i created a Entity and took the model of the player. But the problem is that after registration, nothing has changed, the essence was as white cube and left. Here is the code:

    Spoiler
    
    Register:
    EntityRegistry.registerModEntity(new ResourceLocation("modid", "test"), EntityTest.claa, "test", ++i, Modid.INSTANCE, 64, 1, true);
    
    RenderRegister:
    RenderingRegistry.registerEntityRenderingHandler(EntityTest.class, manager -> new RenderTest(manager));//Here IRenderFactory
    
    Entity:
    public class EntityTest extends EntityMob
    {
        public EntityTest(World worldIn)
        {
            super(worldIn);
        }
    }
    
    Render:
    public class RenderTest extends RenderBiped<EntityCiri>
    {
        private static final ResourceLocation TEXTURE = new ResourceLocation("textures/entity/skeleton/skeleton.png");
    
        public RenderTest(RenderManager rendermanagerIn)
        {
            super(rendermanagerIn, new ModelPlayer(1.0F, false), 1);
        }
    
        @Override
        protected ResourceLocation getEntityTexture(EntityCiri entity)
        {
            return TEXTURE;
        }
    }

     

    P.s. all of the code just for the test has been created!

×
×
  • Create New...

Important Information

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