diff --git a/src/minecraft/biomesoplenty/ClientProxy.java b/src/minecraft/biomesoplenty/ClientProxy.java index 92d43d197..1638baa1b 100644 --- a/src/minecraft/biomesoplenty/ClientProxy.java +++ b/src/minecraft/biomesoplenty/ClientProxy.java @@ -10,6 +10,7 @@ import biomesoplenty.blocks.renderers.FoliageRenderer; import biomesoplenty.blocks.renderers.PlantsRenderer; import biomesoplenty.items.projectiles.EntityDart; import biomesoplenty.items.projectiles.EntityMudball; +import biomesoplenty.items.projectiles.EntityPoisonDart; import biomesoplenty.items.projectiles.RenderDart; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -21,7 +22,8 @@ public class ClientProxy extends CommonProxy { public void registerRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityMudball.class, new RenderSnowball(Items.mudball.get(), 0)); - RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart()); + RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart(0)); + RenderingRegistry.registerEntityRenderingHandler(EntityPoisonDart.class, new RenderDart(1)); RenderingRegistry.registerBlockHandler(new FoliageRenderer()); RenderingRegistry.registerBlockHandler(new PlantsRenderer()); diff --git a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java index 7f11aeca8..590b0bfca 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java +++ b/src/minecraft/biomesoplenty/configuration/BOPConfiguration.java @@ -317,6 +317,7 @@ public class BOPConfiguration { public static int entityMudballID; public static int entityDartID; + public static int entityPoisonDartID; public static int jungleSpiderID; public static int rosesterID; @@ -707,6 +708,7 @@ public class BOPConfiguration { //Projectile IDs entityMudballID = config.get("Entity IDs", "Mudball ID", 103, null).getInt();; entityDartID = config.get("Entity IDs", "Dart ID", 104, null).getInt();; + entityPoisonDartID = config.get("Entity IDs", "Poison Dart ID", 105, null).getInt();; System.out.println("Generating Biome ID's"); diff --git a/src/minecraft/biomesoplenty/configuration/BOPEntities.java b/src/minecraft/biomesoplenty/configuration/BOPEntities.java index 9362343b6..08e5f13ca 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPEntities.java +++ b/src/minecraft/biomesoplenty/configuration/BOPEntities.java @@ -7,6 +7,7 @@ import biomesoplenty.api.Biomes; import biomesoplenty.api.Entities; import biomesoplenty.items.projectiles.EntityDart; import biomesoplenty.items.projectiles.EntityMudball; +import biomesoplenty.items.projectiles.EntityPoisonDart; import biomesoplenty.mobs.EntityJungleSpider; import biomesoplenty.mobs.EntityRosester; import cpw.mods.fml.common.registry.EntityRegistry; @@ -41,6 +42,7 @@ public class BOPEntities { { EntityRegistry.registerModEntity(EntityMudball.class, "MudBall", BOPConfiguration.entityMudballID, BiomesOPlenty.instance, 80, 3, true); EntityRegistry.registerModEntity(EntityDart.class, "Dart", BOPConfiguration.entityDartID, BiomesOPlenty.instance, 80, 3, true); + EntityRegistry.registerModEntity(EntityPoisonDart.class, "PoisonDart", BOPConfiguration.entityPoisonDartID, BiomesOPlenty.instance, 80, 3, true); EntityRegistry.registerModEntity(EntityJungleSpider.class, "JungleSpider", BOPConfiguration.jungleSpiderID, BiomesOPlenty.instance, 80, 3, true); EntityRegistry.registerModEntity(EntityRosester.class, "Rosester", BOPConfiguration.rosesterID, BiomesOPlenty.instance, 80, 3, true); diff --git a/src/minecraft/biomesoplenty/items/ItemDartBlower.java b/src/minecraft/biomesoplenty/items/ItemDartBlower.java index 960df7815..898cbe9bf 100644 --- a/src/minecraft/biomesoplenty/items/ItemDartBlower.java +++ b/src/minecraft/biomesoplenty/items/ItemDartBlower.java @@ -11,6 +11,7 @@ import net.minecraft.world.World; import biomesoplenty.BiomesOPlenty; import biomesoplenty.api.Items; import biomesoplenty.items.projectiles.EntityDart; +import biomesoplenty.items.projectiles.EntityPoisonDart; public class ItemDartBlower extends Item { @@ -32,10 +33,9 @@ public class ItemDartBlower extends Item { boolean flag = par3EntityPlayer.capabilities.isCreativeMode; - if (flag || par3EntityPlayer.inventory.hasItem(Items.dart.get().itemID)) + if (par3EntityPlayer.inventory.hasItem(Items.dart.get().itemID)) { //EntityArrow entitydart = new EntityArrow(par2World, par3EntityPlayer, 2.0F); - EntityDart entitydart = new EntityDart(par2World, par3EntityPlayer, 2.0F); itemStack.damageItem(1, par3EntityPlayer); par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 2.0F / (1.0F * 0.4F + 1.2F) + 1.0F * 0.5F); @@ -43,9 +43,11 @@ public class ItemDartBlower extends Item if (!flag) par3EntityPlayer.inventory.consumeInventoryItem(Items.dart.get().itemID); - if (!par2World.isRemote) - par2World.spawnEntityInWorld(entitydart); + if (par3EntityPlayer.inventory.hasItemStack(new ItemStack(Items.dart.get().itemID, 1, 0))) + par2World.spawnEntityInWorld(new EntityDart(par2World, par3EntityPlayer, 2.0F)); + else + par2World.spawnEntityInWorld(new EntityPoisonDart(par2World, par3EntityPlayer, 2.0F)); } return itemStack; diff --git a/src/minecraft/biomesoplenty/items/projectiles/EntityPoisonDart.java b/src/minecraft/biomesoplenty/items/projectiles/EntityPoisonDart.java index 928d4bce4..5200a81c2 100644 --- a/src/minecraft/biomesoplenty/items/projectiles/EntityPoisonDart.java +++ b/src/minecraft/biomesoplenty/items/projectiles/EntityPoisonDart.java @@ -51,7 +51,6 @@ public class EntityPoisonDart extends EntityArrow super(par1World, par2, par4, par6); } - @Override public void onUpdate() { super.onUpdate(); @@ -169,7 +168,6 @@ public class EntityPoisonDart extends EntityArrow int i1 = MathHelper.ceiling_double_int((double)f2 * this.damage); ((EntityLiving)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 100)); - System.out.println("HIIIIII"); if (this.getIsCritical()) { diff --git a/src/minecraft/biomesoplenty/items/projectiles/RenderDart.java b/src/minecraft/biomesoplenty/items/projectiles/RenderDart.java index 3db9df5de..af0b8bca9 100644 --- a/src/minecraft/biomesoplenty/items/projectiles/RenderDart.java +++ b/src/minecraft/biomesoplenty/items/projectiles/RenderDart.java @@ -1,5 +1,6 @@ package biomesoplenty.items.projectiles; +import biomesoplenty.BiomesOPlenty; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.Tessellator; @@ -13,9 +14,19 @@ import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) public class RenderDart extends Render { + private static int dartMeta; + + public RenderDart(int meta) + { + dartMeta = meta; + } + public void renderArrow(EntityArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9) { - this.loadTexture("/mods/BiomesOPlenty/textures/projectiles/dart.png"); + if (dartMeta == 0) + this.loadTexture("/mods/BiomesOPlenty/textures/projectiles/dart.png"); + if (dartMeta == 1) + this.loadTexture("/mods/BiomesOPlenty/textures/projectiles/poisondart.png"); GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4, (float)par6); GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); diff --git a/src/minecraft/biomesoplenty/items/projectiles/RenderPoisonDart.java b/src/minecraft/biomesoplenty/items/projectiles/RenderPoisonDart.java deleted file mode 100644 index 5518044da..000000000 --- a/src/minecraft/biomesoplenty/items/projectiles/RenderPoisonDart.java +++ /dev/null @@ -1,88 +0,0 @@ -package biomesoplenty.items.projectiles; - -import biomesoplenty.BiomesOPlenty; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -@SideOnly(Side.CLIENT) -public class RenderPoisonDart extends Render -{ - - public void renderPoisonDart(EntityPoisonDart par1EntityPoisonDart, double par2, double par4, double par6, float par8, float par9) - { - this.loadTexture("/mods/BiomesOPlenty/textures/projectiles/poisondart.png"); - GL11.glPushMatrix(); - GL11.glTranslatef((float)par2, (float)par4, (float)par6); - GL11.glRotatef(par1EntityPoisonDart.prevRotationYaw + (par1EntityPoisonDart.rotationYaw - par1EntityPoisonDart.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(par1EntityPoisonDart.prevRotationPitch + (par1EntityPoisonDart.rotationPitch - par1EntityPoisonDart.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); - Tessellator tessellator = Tessellator.instance; - byte b0 = 0; - float f2 = 0.0F; - float f3 = 0.5F; - float f4 = (float)(0 + b0 * 10) / 32.0F; - float f5 = (float)(5 + b0 * 10) / 32.0F; - float f6 = 0.0F; - float f7 = 0.15625F; - float f8 = (float)(5 + b0 * 10) / 32.0F; - float f9 = (float)(10 + b0 * 10) / 32.0F; - float f10 = 0.05625F; - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - float f11 = (float)par1EntityPoisonDart.arrowShake - par9; - - if (f11 > 0.0F) - { - float f12 = -MathHelper.sin(f11 * 3.0F) * f11; - GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); - } - - GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); - GL11.glScalef(f10, f10, f10); - GL11.glTranslatef(-4.0F, 0.0F, 0.0F); - GL11.glNormal3f(f10, 0.0F, 0.0F); - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f9); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f9); - tessellator.draw(); - GL11.glNormal3f(-f10, 0.0F, 0.0F); - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double)f6, (double)f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double)f7, (double)f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double)f7, (double)f9); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double)f6, (double)f9); - tessellator.draw(); - - for (int i = 0; i < 4; ++i) - { - GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL11.glNormal3f(0.0F, 0.0F, f10); - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); - tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); - tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); - tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); - tessellator.draw(); - } - - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glPopMatrix(); - } - - /** - * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then - * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic - * (Render