Jump to content

Aga12s

Members
  • Posts

    4
  • Joined

  • Last visited

Aga12s's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hello, I would like to add a mechanic in my mod where I can render the same entity with different textures based on RNG (Random Number Generation). The concept is similar to Villagers in minecraft and their professions. Here is my code currently (not knowing that the constructor for RenderWanderingPlayer is only called once, not everytime the entity spawned) package xyz.gatya.itmulti.render; import java.util.Random; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.util.ResourceLocation; import xyz.gatya.itmulti.entity.EntityInformation; import xyz.gatya.itmulti.entity.EntityWanderingPlayer; import xyz.gatya.itmulti.util.ModInformation; public class RenderWanderingPlayer extends RenderLiving<EntityWanderingPlayer> { private static final ResourceLocation TEXTURES = new ResourceLocation( ModInformation.MOD_ID + ":textures/entity/" + EntityInformation.WANDERING_NPC_SKINS[(int) (Math.random() * EntityInformation.WANDERING_NPC_SKINS.length + 1)] + ".png" ); public RenderWanderingPlayer(RenderManager rendermanagerIn) { super(rendermanagerIn, new ModelPlayer(0.0F, false), 0.3F); } @Override protected ResourceLocation getEntityTexture(EntityWanderingPlayer entity) { return TEXTURES; } } Code : EntityInformation -> Contains some information of the entity i.e id, available skins for the entity and etc. WANDERING_NPC_SKINS -> Array of strings of possible skins How do I get it to work? The code is just for demonstration
  2. Alright, I will look up the BucketItem class in Eclipse, that is actually a really good reference point. Thank you both for your help
  3. i get the idea, but can you please provide an example for me at least with the hasContainerItem or getContainerItem methods?
  4. Hello, I am creating a mod that requires this kind of mechanic (see the Linked Example) but I couldn't find any reference to implement this, could someone point me to a code snippet or a short tutorial of how to implement this mechanic? Use Case Example : Shapeless crafting : 1 Knife + 1 Chicken = 9 Chicken Nuggets and the Knife drops the durability Thank you
×
×
  • Create New...

Important Information

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