From c02fafbd34ea4fbfb8386e3264c4448da774ad64 Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 2 Jul 2013 21:05:59 +1000 Subject: [PATCH] Fixed the Glob, Jungle Spiders and Rosesters --- src/minecraft/biomesoplenty/ClientProxy.java | 24 ++++++-- .../biomesoplenty/entities/EntityGlob.java | 22 ++----- .../entities/EntityJungleSpider.java | 38 ++++-------- .../entities/EntityRosester.java | 13 ++-- .../entities/{ => render}/RenderGlob.java | 18 +++++- .../entities/render/RenderJungleSpider.java | 38 ++++++++++++ .../entities/render/RenderRosester.java | 60 +++++++++++++++++++ 7 files changed, 157 insertions(+), 56 deletions(-) rename src/minecraft/biomesoplenty/entities/{ => render}/RenderGlob.java (72%) create mode 100644 src/minecraft/biomesoplenty/entities/render/RenderJungleSpider.java create mode 100644 src/minecraft/biomesoplenty/entities/render/RenderRosester.java diff --git a/src/minecraft/biomesoplenty/ClientProxy.java b/src/minecraft/biomesoplenty/ClientProxy.java index 96e42407a..6db5ef982 100644 --- a/src/minecraft/biomesoplenty/ClientProxy.java +++ b/src/minecraft/biomesoplenty/ClientProxy.java @@ -1,6 +1,7 @@ package biomesoplenty; import net.minecraft.client.Minecraft; +import net.minecraft.client.model.ModelChicken; import net.minecraft.client.model.ModelSlime; import net.minecraft.client.particle.EntityBreakingFX; import net.minecraft.client.particle.EntityFX; @@ -19,7 +20,11 @@ import biomesoplenty.blocks.renderers.RenderUtils; import biomesoplenty.blocks.renderers.SmallBlockRenderer; import biomesoplenty.blocks.renderers.TileEntityGraveRenderer; import biomesoplenty.entities.EntityGlob; -import biomesoplenty.entities.RenderGlob; +import biomesoplenty.entities.EntityJungleSpider; +import biomesoplenty.entities.EntityRosester; +import biomesoplenty.entities.render.RenderGlob; +import biomesoplenty.entities.render.RenderJungleSpider; +import biomesoplenty.entities.render.RenderRosester; import biomesoplenty.items.projectiles.EntityDart; import biomesoplenty.items.projectiles.EntityMudball; import biomesoplenty.items.projectiles.RenderDart; @@ -50,6 +55,8 @@ public class ClientProxy extends CommonProxy { RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart()); RenderingRegistry.registerEntityRenderingHandler(EntityGlob.class, new RenderGlob(new ModelSlime(16), new ModelSlime(0), 0.25F)); + RenderingRegistry.registerEntityRenderingHandler(EntityJungleSpider.class, new RenderJungleSpider()); + RenderingRegistry.registerEntityRenderingHandler(EntityRosester.class, new RenderRosester(new ModelChicken(), 0.3F)); RenderingRegistry.registerBlockHandler(new FoliageRenderer()); RenderingRegistry.registerBlockHandler(new PlantsRenderer()); @@ -67,13 +74,20 @@ public class ClientProxy extends CommonProxy { { EntityFX entityfx = null; - if (string == "mud") { + if (string == "mud") + { entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.mudball.get()); - } else if (string == "dart") { + } + else if (string == "dart") + { entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.dart.get()); - } else if (string == "dandelion") { + } + else if (string == "dandelion") + { entityfx = new EntityDandelionFX(mc.theWorld, x, y, z, 2.0F); - } else if (string == "steam") { + } + else if (string == "steam") + { entityfx = new EntitySteamFX(mc.theWorld, x, y, z, 0.0D, 0.0D, 0.0D); } diff --git a/src/minecraft/biomesoplenty/entities/EntityGlob.java b/src/minecraft/biomesoplenty/entities/EntityGlob.java index 20c8bfd69..ecfcf7048 100644 --- a/src/minecraft/biomesoplenty/entities/EntityGlob.java +++ b/src/minecraft/biomesoplenty/entities/EntityGlob.java @@ -43,25 +43,19 @@ public class EntityGlob extends EntityLiving implements IMob protected void setGlobSize(int par1) { - dataWatcher.updateObject(16, new Byte((byte)par1)); - this.setSize(0.6F * par1, 0.6F * par1); - this.setPosition(posX, posY, posZ); + this.dataWatcher.updateObject(16, new Byte((byte)par1)); + this.setSize(0.6F * (float)par1, 0.6F * (float)par1); + this.setPosition(this.posX, this.posY, this.posZ); this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a((double)(par1 * par1)); this.setEntityHealth(this.func_110138_aP()); - experienceValue = par1; + this.experienceValue = par1; } - /** - * Returns the size of the Glob. - */ public int getGlobSize() { return dataWatcher.getWatchableObjectByte(16); } - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ @Override public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { @@ -69,9 +63,6 @@ public class EntityGlob extends EntityLiving implements IMob par1NBTTagCompound.setInteger("Size", this.getGlobSize() - 1); } - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ @Override public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { @@ -79,9 +70,6 @@ public class EntityGlob extends EntityLiving implements IMob this.setGlobSize(par1NBTTagCompound.getInteger("Size") + 1); } - /** - * Returns the name of the sound played when the Glob jumps. - */ protected String getJumpSound() { return "mob.slime." + (this.getGlobSize() > 1 ? "big" : "small"); @@ -346,3 +334,5 @@ public class EntityGlob extends EntityLiving implements IMob return this.getGlobSize() > 2; } } + + diff --git a/src/minecraft/biomesoplenty/entities/EntityJungleSpider.java b/src/minecraft/biomesoplenty/entities/EntityJungleSpider.java index 442efdc47..7353f70c2 100644 --- a/src/minecraft/biomesoplenty/entities/EntityJungleSpider.java +++ b/src/minecraft/biomesoplenty/entities/EntityJungleSpider.java @@ -2,6 +2,7 @@ package biomesoplenty.entities; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; @@ -12,31 +13,18 @@ public class EntityJungleSpider extends EntitySpider public EntityJungleSpider(World par1World) { super(par1World); - //texture = "/mods/BiomesOPlenty/textures/mobs/junglespider.png"; this.setSize(0.4F, 0.3F); - //moveSpeed = 1.1F; } - /*@Override - public int getMaxHealth() - { - return 8; - }*/ - - /** - * How large the spider should be scaled. - */ - /*@Override - public float spiderScaleAmount() - { - return 0.4F; - }*/ - - @Override - public float getShadowSize() - { - return 0.0F; - } + @Override + protected void func_110147_ax() + { + super.func_110147_ax(); + //Max health + this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(8.0D); + //Movement speed + this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(1.1D); + } @Override public boolean attackEntityAsMob(Entity par1Entity) @@ -69,10 +57,4 @@ public class EntityJungleSpider extends EntitySpider } else return false; } - - /** - * Initialize this creature. - */ - /*@Override - public void initCreature() {}*/ } diff --git a/src/minecraft/biomesoplenty/entities/EntityRosester.java b/src/minecraft/biomesoplenty/entities/EntityRosester.java index d53596d1b..ffbf3fd03 100644 --- a/src/minecraft/biomesoplenty/entities/EntityRosester.java +++ b/src/minecraft/biomesoplenty/entities/EntityRosester.java @@ -1,6 +1,7 @@ package biomesoplenty.entities; import net.minecraft.entity.EntityAgeable; +import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIFollowParent; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMate; @@ -54,11 +55,13 @@ public class EntityRosester extends EntityChicken return true; } - /*@Override - public int getMaxHealth() - { - return 4; - }*/ + @Override + protected void func_110147_ax() + { + super.func_110147_ax(); + //Max health + this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(4.0D); + } /** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons diff --git a/src/minecraft/biomesoplenty/entities/RenderGlob.java b/src/minecraft/biomesoplenty/entities/render/RenderGlob.java similarity index 72% rename from src/minecraft/biomesoplenty/entities/RenderGlob.java rename to src/minecraft/biomesoplenty/entities/render/RenderGlob.java index 90eee52f6..db5fa896e 100644 --- a/src/minecraft/biomesoplenty/entities/RenderGlob.java +++ b/src/minecraft/biomesoplenty/entities/render/RenderGlob.java @@ -1,12 +1,14 @@ -package biomesoplenty.entities; +package biomesoplenty.entities.render; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.client.resources.ResourceLocation; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import org.lwjgl.opengl.GL11; +import biomesoplenty.entities.EntityGlob; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -55,10 +57,22 @@ public class RenderGlob extends RenderLiving float f3 = 1.0F / (f2 + 1.0F); GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1); } + + @Override + protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) + { + this.scaleGlob((EntityGlob)par1EntityLivingBase, par2); + } @Override protected ResourceLocation func_110775_a(Entity entity) { - return new ResourceLocation("mods/BiomesOPlenty/textures/mobs/glob.png"); + return new ResourceLocation("BiomesOPlenty:textures/mobs/glob.png"); } + + @Override + protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3) + { + return this.shouldGlobRenderPass((EntityGlob)par1EntityLivingBase, par2, par3); + } } \ No newline at end of file diff --git a/src/minecraft/biomesoplenty/entities/render/RenderJungleSpider.java b/src/minecraft/biomesoplenty/entities/render/RenderJungleSpider.java new file mode 100644 index 000000000..7961061c1 --- /dev/null +++ b/src/minecraft/biomesoplenty/entities/render/RenderJungleSpider.java @@ -0,0 +1,38 @@ +package biomesoplenty.entities.render; + +import net.minecraft.client.renderer.entity.RenderSpider; +import net.minecraft.client.resources.ResourceLocation; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; + +import org.lwjgl.opengl.GL11; + +import biomesoplenty.entities.EntityJungleSpider; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class RenderJungleSpider extends RenderSpider +{ + public RenderJungleSpider() + { + this.shadowSize *= 0.0F; + } + + protected void scaleSpider(EntityJungleSpider entityjunglespider, float par2) + { + GL11.glScalef(0.4F, 0.4F, 0.3F); + } + + @Override + protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) + { + this.scaleSpider((EntityJungleSpider)par1EntityLivingBase, par2); + } + + @Override + protected ResourceLocation func_110775_a(Entity entity) + { + return new ResourceLocation("BiomesOPlenty:textures/mobs/junglespider.png"); + } +} diff --git a/src/minecraft/biomesoplenty/entities/render/RenderRosester.java b/src/minecraft/biomesoplenty/entities/render/RenderRosester.java new file mode 100644 index 000000000..83b667a0e --- /dev/null +++ b/src/minecraft/biomesoplenty/entities/render/RenderRosester.java @@ -0,0 +1,60 @@ +package biomesoplenty.entities.render; + +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.RenderLiving; +import net.minecraft.client.resources.ResourceLocation; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; +import biomesoplenty.entities.EntityRosester; + +public class RenderRosester extends RenderLiving +{ + public RenderRosester(ModelBase par1ModelBase, float par2) + { + super(par1ModelBase, par2); + } + + public void renderRosester(EntityRosester par1EntityRosester, double par2, double par4, double par6, float par8, float par9) + { + super.doRenderLiving(par1EntityRosester, par2, par4, par6, par8, par9); + } + + protected float getWingRotation(EntityRosester par1EntityRosester, float par2) + { + float f1 = par1EntityRosester.field_70888_h + (par1EntityRosester.field_70886_e - par1EntityRosester.field_70888_h) * par2; + float f2 = par1EntityRosester.field_70884_g + (par1EntityRosester.destPos - par1EntityRosester.field_70884_g) * par2; + return (MathHelper.sin(f1) + 1.0F) * f2; + } + + @Override + public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) + { + this.renderRosester((EntityRosester)par1EntityLiving, par2, par4, par6, par8, par9); + } + + @Override + protected float handleRotationFloat(EntityLivingBase par1EntityLivingBase, float par2) + { + return this.getWingRotation((EntityRosester)par1EntityLivingBase, par2); + } + + @Override + public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9) + { + this.renderRosester((EntityRosester)par1EntityLivingBase, par2, par4, par6, par8, par9); + } + + @Override + public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) + { + this.renderRosester((EntityRosester)par1Entity, par2, par4, par6, par8, par9); + } + + @Override + protected ResourceLocation func_110775_a(Entity entity) + { + return new ResourceLocation("BiomesOPlenty:textures/mobs/rosester.png"); + } +}