WildHeart
-
Posts
236 -
Joined
-
Last visited
Posts posted by WildHeart
-
-
18 minutes ago, larsgerrits said:
No, that is not possible.
Why do you want to do that? There may be another way to do that.
"There may be another way to do that." Example?
-
Is it possible to register items or blocks during the game, and not during initialization?
-
Solved, my fail...
-
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?
-
5 minutes ago, xalcon said:
This event allows you to change the looting level when an entity is killed.
Thank you!
Solved.
-
Hello, i found this event LootingLevelEvent, but I don't know what it does?
-
33 minutes ago, Alpvax said:
What is not practical about it? It is the new method for a reason, the old one was rather buggy and often didn't work correctly.
Maybe...
-
3 minutes ago, Choonster said:
So it's working now?
If that's the event then Yes, but if the normal registration no. Check the edit to my previous post.
-
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.
-
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
-
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); }
-
4 minutes ago, larsgerrits said:
You should register models in the ModelRegistryEvent.
What if you the old-fashioned way?
-
4 minutes ago, Jay Avery said:
Where are you calling your model registration code? Is it actually being executed?
In init method. Yes the code is runs.
-
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
-
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?
-
Thank you! Topic can be closed.
-
8 minutes ago, diesieben07 said:
Define "complains about".
Once again, this makes no sense. The client is not a server.
Spoiler -
-
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
-
I have in the ClientProxy is the super class super.preinit();
-
Register in ServerProxy -> preInit
RenderRegister in ClientProxy -> init
-
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:
SpoilerRegister: 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!
-
7 minutes ago, diesieben07 said:
What on earth do you need an example for? You literally replace new ItemBlock with new ItemMultiTexture.
Solved
-
8 minutes ago, diesieben07 said:
No.
Pls, example.
[1.11] Register items in game, not initialization.
in Modder Support
Posted
Hrm. Okay, thank you.