Jump to content

Hugofounda

Members
  • Posts

    6
  • Joined

  • Last visited

Hugofounda's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. I can't use getRabbitType for humans entities
  2. package net.minecraft.client.renderer.entity; import net.minecraft.client.model.ModelBase; import net.minecraft.entity.passive.EntityRabbit; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderRabbit extends RenderLiving<EntityRabbit> { private static final ResourceLocation BROWN = new ResourceLocation("textures/entity/rabbit/brown.png"); private static final ResourceLocation WHITE = new ResourceLocation("textures/entity/rabbit/white.png"); private static final ResourceLocation BLACK = new ResourceLocation("textures/entity/rabbit/black.png"); private static final ResourceLocation GOLD = new ResourceLocation("textures/entity/rabbit/gold.png"); private static final ResourceLocation SALT = new ResourceLocation("textures/entity/rabbit/salt.png"); private static final ResourceLocation WHITE_SPLOTCHED = new ResourceLocation("textures/entity/rabbit/white_splotched.png"); private static final ResourceLocation TOAST = new ResourceLocation("textures/entity/rabbit/toast.png"); private static final ResourceLocation CAERBANNOG = new ResourceLocation("textures/entity/rabbit/caerbannog.png"); public RenderRabbit(RenderManager renderManagerIn, ModelBase modelBaseIn, float shadowSizeIn) { super(renderManagerIn, modelBaseIn, shadowSizeIn); } /** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityRabbit entity) { String s = TextFormatting.getTextWithoutFormattingCodes(entity.getName()); if (s != null && "Toast".equals(s)) { return TOAST; } else { switch (entity.getRabbitType()) { case 0: default: return BROWN; case 1: return WHITE; case 2: return BLACK; case 3: return WHITE_SPLOTCHED; case 4: return GOLD; case 5: return SALT; case 99: return CAERBANNOG; } } } } This is the best to do but I have an error at: switch (entity.getRabbitType()) I don't know what I must write
  3. Hey guys, Today I would like to have 2 textures for 1 entity. But I don't know how to do it package fr.hard.mod.Render; import fr.hard.mod.Entity.EntityAssassin; import fr.hard.mod.Entity.EntityBandit; import fr.hard.mod.Models.ModelAssassin; import fr.hard.mod.Models.ModelBandit; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLiving; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderBandit<T extends EntityLiving> extends RenderLiving<EntityBandit> { private static final ResourceLocation BANDIT1_TEXTURE = new ResourceLocation("hard", "textures/humans/Bandit1.png"); public RenderBandit(RenderManager renderManagerIn, ModelBandit modelBandit, float f) { super(renderManagerIn, new ModelBandit(), 0.4F); } protected ResourceLocation getEntityTexture(EntityBandit entity) { return BANDIT1_TEXTURE; } } Thanks
  4. I fixed my issue lol, in the assets, you need to create packages, not file
  5. Hey guys I created a mob, it works but I want to add customs sounds (Ambient/ death) but my code doesn't works Here is my class for the Entity package fr.hardmod.Entity; import fr.hardmod.HardMod; import fr.hardmod.Reference; import fr.hardmod.SoundHandler; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackMelee; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.ai.EntityAIZombieAttack; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.world.World; public class EntityGalopin extends EntityMob { public EntityGalopin(World worldIn) { super(worldIn); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.applyEntityAI(); } protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(35.0D); this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.52456856D); this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(5.0D); this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(17.5D); } protected void applyEntityAI() { this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityVillager.class, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true)); } protected SoundEvent getAmbientSound() { return SoundHandler.GALOPIN_AMBIENT; } protected SoundEvent getDeathSound() { return SoundHandler.GALOPIN_DEATH; } } Here is my sound Handler package fr.hardmod; import net.minecraft.init.Bootstrap; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; public class SoundHandler { public static SoundEvent GALOPIN_AMBIENT; public static SoundEvent GALOPIN_DEATH; private static SoundEvent getRegisteredSoundEvent(String id) { SoundEvent soundevent = (SoundEvent)SoundEvent.REGISTRY.getObject(new ResourceLocation(id)); if (soundevent == null) { throw new IllegalStateException("Invalid Sound requested: " + id); } else { return soundevent; } } static { if (!Bootstrap.isRegistered()) { throw new RuntimeException("Accessed Sounds before Bootstrap!"); } else { GALOPIN_AMBIENT = getRegisteredSoundEvent("entity.galopin.galopin_ambient"); GALOPIN_DEATH = getRegisteredSoundEvent("entity.galopin.galopin_death"); } } } And, this is my sounds.json { "entity.galopin.galopin_ambient": { "category": "hostile", "subtitle": "entity.galopin.galopin_ambient", "sounds": [ { "name": "hardmod:galopin_ambient", "stream": true } ] }, "entity.galopin.galopin_death": { "category": "hostile", "subtitle": "entity.galopin.galopin_death", "sounds": [ { "name": "hardmod:galopin_death", "stream": true } ] } } The file location is: C:\Users\Hugo\Desktop\forge-1.10.2-12.18.3.2422-mdk\src\main\resources\assets\hardmod\sounds Thanks for your help !
×
×
  • Create New...

Important Information

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