diff --git a/mods/tinker/resources/lang/en_US.xml b/mods/tinker/resources/lang/en_US.xml index c66be4b8..e94fa855 100644 --- a/mods/tinker/resources/lang/en_US.xml +++ b/mods/tinker/resources/lang/en_US.xml @@ -206,6 +206,13 @@ Blank Pattern Blank Cast + Bowstring + Enchanted Bowstring + Feather Fletching + Leaf Fletching + Slime Fletching + Slime Fletching + Materials and You Materials and You Mighty Smelting @@ -229,7 +236,7 @@ Bucket o' Blood Bowstring - Enchanted Bowstring + Enchanted Bowstring Molten Iron Molten Gold diff --git a/mods/tinker/tconstruct/TConstruct.java b/mods/tinker/tconstruct/TConstruct.java index d18ba7a6..1cff6a24 100644 --- a/mods/tinker/tconstruct/TConstruct.java +++ b/mods/tinker/tconstruct/TConstruct.java @@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry; * @dependencies: IC2 API, MFR API */ -@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.4.dev.15", dependencies = "required-after:Forge@[7.7.1.675,)") +@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.4.dev.16", dependencies = "required-after:Forge@[7.7.1.675,)") @NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class) public class TConstruct { diff --git a/mods/tinker/tconstruct/client/entity/projectile/ArrowRender.java b/mods/tinker/tconstruct/client/entity/projectile/ArrowRender.java index ece954e2..888d4910 100644 --- a/mods/tinker/tconstruct/client/entity/projectile/ArrowRender.java +++ b/mods/tinker/tconstruct/client/entity/projectile/ArrowRender.java @@ -156,7 +156,7 @@ public class ArrowRender extends Render GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-rotation * 15, 0.0F, 0.0F, 1.0F);*/ GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 30.0F, 0.0F, 0.0F, 1.0F); + GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F, 0.0F, 0.0F, 1.0F); float f12 = 0.0625F; f11 = 0.021875F; ItemStack itemstack = arrow.getEntityItem(); diff --git a/mods/tinker/tconstruct/client/gui/SmelteryGui.java b/mods/tinker/tconstruct/client/gui/SmelteryGui.java index ca0f0c45..6448fae9 100644 --- a/mods/tinker/tconstruct/client/gui/SmelteryGui.java +++ b/mods/tinker/tconstruct/client/gui/SmelteryGui.java @@ -122,6 +122,8 @@ public class SmelteryGui extends NewContainerGui int total = logic.getTotalLiquid(); int liquidLayers = (total / 20000 + 1) * 20000; liquidSize = liquid.amount * 52 / liquidLayers; + if (liquidSize == 0) + liquidSize = 1; base += liquidSize; } @@ -208,6 +210,8 @@ public class SmelteryGui extends NewContainerGui int total = logic.getTotalLiquid(); int liquidLayers = (total / 20000 + 1) * 20000; int liquidSize = liquid.amount * 52 / liquidLayers; + if (liquidSize == 0) + liquidSize = 1; while (liquidSize > 0) { int size = liquidSize >= 16 ? 16 : liquidSize; diff --git a/mods/tinker/tconstruct/client/gui/ToolForgeGui.java b/mods/tinker/tconstruct/client/gui/ToolForgeGui.java index 392946fd..0e084c49 100644 --- a/mods/tinker/tconstruct/client/gui/ToolForgeGui.java +++ b/mods/tinker/tconstruct/client/gui/ToolForgeGui.java @@ -137,8 +137,8 @@ public class ToolForgeGui extends ToolStationGui slotY = new int[] { 28, 46, 28, 28 }; break; case 7: - slotX = new int[] { 56, 56, 56 }; // Three parts reverse - slotY = new int[] { 19, 37, 55 }; + slotX = new int[] { 56, 56, 56, 14 }; // Three parts reverse + slotY = new int[] { 19, 37, 55, 37 }; break; } toolSlots.resetSlots(slotX, slotY); diff --git a/mods/tinker/tconstruct/client/gui/ToolStationGui.java b/mods/tinker/tconstruct/client/gui/ToolStationGui.java index 5af81ba5..2fe725c5 100644 --- a/mods/tinker/tconstruct/client/gui/ToolStationGui.java +++ b/mods/tinker/tconstruct/client/gui/ToolStationGui.java @@ -255,21 +255,30 @@ public class ToolStationGui extends NewContainerGui float mass = tags.getFloat("Mass"); float shatter = tags.getFloat("BreakChance"); float accuracy = tags.getFloat("Accuracy"); - + + this.fontRenderer.drawString("Base Attack:", xSize + 8, base + offset * 10, 0xffffff); + offset++; String heart = attack == 2 ? " Heart" : " Hearts"; if (attack % 2 == 0) - this.fontRenderer.drawString("Attack: " + attack / 2 + heart, xSize + 8, base + offset * 10, 0xffffff); + this.fontRenderer.drawString("- "+attack / 2 + heart, xSize + 8, base + offset * 10, 0xffffff); else - this.fontRenderer.drawString("Attack: " + attack / 2f + heart, xSize + 8, base + offset * 10, 0xffffff); + this.fontRenderer.drawString("- "+attack / 2f + heart, xSize + 8, base + offset * 10, 0xffffff); + offset++; + int minAttack = attack; + int maxAttack = attack *2; + heart = " Hearts"; + this.fontRenderer.drawString("Shortbow Attack:", xSize + 8, base + offset * 10, 0xffffff); + offset++; + this.fontRenderer.drawString(df.format(minAttack / 2f)+"-"+df.format(maxAttack / 2f)+heart, xSize + 8, base + offset * 10, 0xffffff); + offset++; offset++; this.fontRenderer.drawString("Weight: " + df.format(mass), xSize + 8, base + offset * 10, 0xffffff); offset++; + this.fontRenderer.drawString("Accuracy: " + df.format(accuracy-4)+"%", xSize + 8, base + offset * 10, 0xffffff); offset++; - this.fontRenderer.drawString("Accuracy: " + df.format(accuracy)+"%", xSize + 8, base + offset * 10, 0xffffff); - offset++; - this.fontRenderer.drawString("Chance to break: " + df.format(shatter)+"%", xSize + 8, base + offset * 10, 0xffffff); - offset++; + /*this.fontRenderer.drawString("Chance to break: " + df.format(shatter)+"%", xSize + 8, base + offset * 10, 0xffffff); + offset++;*/ offset++; } diff --git a/mods/tinker/tconstruct/common/TContent.java b/mods/tinker/tconstruct/common/TContent.java index 12c5c73e..bca97d17 100644 --- a/mods/tinker/tconstruct/common/TContent.java +++ b/mods/tinker/tconstruct/common/TContent.java @@ -608,7 +608,7 @@ public class TContent implements IFuelHandler TConstructRegistry.addToolMaterial(0, "Wood", "Wooden ", 0, 59, 200, 0, 1.0F, 0, 0f, "\u00A7e", ""); TConstructRegistry.addToolMaterial(1, "Stone", 1, 131, 400, 1, 0.5F, 0, 1f, "", "Stonebound"); TConstructRegistry.addToolMaterial(2, "Iron", 2, 250, 600, 2, 1.3F, 1, 0f, "\u00A7f", ""); - TConstructRegistry.addToolMaterial(3, "Flint", 1, 171, 525, 2, 0.7F, 0, -1F, "\u00A78", "Jagged"); + TConstructRegistry.addToolMaterial(3, "Flint", 1, 171, 525, 2, 0.7F, 0, 0f, "\u00A78", ""); TConstructRegistry.addToolMaterial(4, "Cactus", 1, 150, 500, 2, 1.0F, 0, -1f, "\u00A72", "Jagged"); TConstructRegistry.addToolMaterial(5, "Bone", 1, 200, 400, 1, 1.0F, 0, 0f, "\u00A7e", ""); TConstructRegistry.addToolMaterial(6, "Obsidian", 3, 89, 700, 2, 0.8F, 3, 0f, "\u00A7d", ""); @@ -652,8 +652,8 @@ public class TContent implements IFuelHandler TConstructRegistry.addArrowMaterial(5, 0.69F, 1.0F, 90F); //Bone TConstructRegistry.addArrowMaterial(6, 2.4F, 1.0F, 100F); //Obsidian TConstructRegistry.addArrowMaterial(7, 3.5F, 1.0F, 100F); //Netherrack - TConstructRegistry.addArrowMaterial(8, 0.69F, 0.0F, 100F); //Slime - TConstructRegistry.addArrowMaterial(9, 0.75F, 3.0F, 80F); //Paper + TConstructRegistry.addArrowMaterial(8, 0.42F, 0.0F, 100F); //Slime + TConstructRegistry.addArrowMaterial(9, 1.1F, 3.0F, 80F); //Paper TConstructRegistry.addArrowMaterial(10, 8.9F, 0.25F, 100F); //Cobalt TConstructRegistry.addArrowMaterial(11, 7.2F, 0.25F, 100F); //Ardite TConstructRegistry.addArrowMaterial(12, 10.6F, 0.1F, 100F); //Manyullyn @@ -661,13 +661,13 @@ public class TContent implements IFuelHandler TConstructRegistry.addArrowMaterial(14, 7.9F, 0.25F, 100F); //Bronze TConstructRegistry.addArrowMaterial(15, 4.7F, 0.25F, 100F); //Alumite TConstructRegistry.addArrowMaterial(16, 7.6F, 0.25F, 100F); //Steel - TConstructRegistry.addArrowMaterial(17, 0.69F, 0.0F, 100F); //Blue Slime + TConstructRegistry.addArrowMaterial(17, 0.42F, 0.0F, 100F); //Blue Slime TConstructRegistry.addBowstringMaterial(0, 2, new ItemStack(Item.silk), new ItemStack(bowstring, 1, 0), 1F, 1F, 1f); //String - TConstructRegistry.addFletchingMaterial(0, 2, new ItemStack(Item.feather), new ItemStack(fletching, 1, 0), 100F, 0F); //Feather - TConstructRegistry.addFletchingMaterial(1, 2, new ItemStack(Block.leaves), new ItemStack(fletching, 1, 1), 75F, 0F); //Leaves - TConstructRegistry.addFletchingMaterial(2, 2, new ItemStack(materials, 1, 1), new ItemStack(fletching, 1, 2), 100F, 0F); //Slime - TConstructRegistry.addFletchingMaterial(3, 2, new ItemStack(materials, 1, 17), new ItemStack(fletching, 1, 3), 100F, 0F); //BlueSlime + TConstructRegistry.addFletchingMaterial(0, 2, new ItemStack(Item.feather), new ItemStack(fletching, 1, 0), 100F, 0F, 0.05F); //Feather + TConstructRegistry.addFletchingMaterial(1, 2, new ItemStack(Block.leaves), new ItemStack(fletching, 1, 1), 75F, 0F, 0.2F); //Leaves + TConstructRegistry.addFletchingMaterial(2, 2, new ItemStack(materials, 1, 1), new ItemStack(fletching, 1, 2), 100F, 0F, 0.12F); //Slime + TConstructRegistry.addFletchingMaterial(3, 2, new ItemStack(materials, 1, 17), new ItemStack(fletching, 1, 3), 100F, 0F, 0.12F); //BlueSlime PatternBuilder pb = PatternBuilder.instance; if (PHConstruct.enableTWood) @@ -1443,8 +1443,9 @@ public class TContent implements IFuelHandler TConstructRegistry.addPartMapping(woodPattern.itemID, meta + 1, 31, new ItemStack(patternOutputs[meta], 1, 31)); } - TConstructRegistry.addBowstringMaterial(1, 2, new ItemStack((Item) obj, 1, 7), new ItemStack(bowstring, 1, 1), 1F, 1F, 0.85f); + TConstructRegistry.addBowstringMaterial(1, 2, new ItemStack((Item) obj, 1, 7), new ItemStack(bowstring, 1, 1), 1F, 1F, 0.9f); TConstructRegistry.addBowMaterial(31, 576, 40, 1.2f); + TConstructRegistry.addArrowMaterial(31, 1.8F, 0.5F, 100F); } else { diff --git a/mods/tinker/tconstruct/entity/ai/GAIFellTree.java b/mods/tinker/tconstruct/entity/ai/GAIFellTree.java index 8233129f..9be4d786 100644 --- a/mods/tinker/tconstruct/entity/ai/GAIFellTree.java +++ b/mods/tinker/tconstruct/entity/ai/GAIFellTree.java @@ -1,10 +1,6 @@ package mods.tinker.tconstruct.entity.ai; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import mods.tinker.tconstruct.entity.GolemBase; -import mods.touhou_alice_dolls.DollRegistry; import net.minecraft.block.Block; import net.minecraft.block.StepSound; import net.minecraft.util.MathHelper; diff --git a/mods/tinker/tconstruct/entity/projectile/ArrowEntity.java b/mods/tinker/tconstruct/entity/projectile/ArrowEntity.java index 97b61247..caa6bac0 100644 --- a/mods/tinker/tconstruct/entity/projectile/ArrowEntity.java +++ b/mods/tinker/tconstruct/entity/projectile/ArrowEntity.java @@ -31,6 +31,8 @@ import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnData { public ItemStack returnStack; + public float mass; + public int baseDamage; public ArrowEntity(World par1World) { @@ -41,6 +43,9 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa { super(world, living, baseSpeed); this.returnStack = stack; + NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool"); + this.mass = toolTag.getFloat("Mass"); + this.baseDamage = toolTag.getInteger("Attack"); } @Override @@ -135,7 +140,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int l; - float f1; + float ySpeed; for (l = 0; l < list.size(); ++l) { @@ -143,8 +148,8 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { - f1 = 0.3F; - AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) f1, (double) f1, (double) f1); + ySpeed = 0.3F; + AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand((double) ySpeed, (double) ySpeed, (double) ySpeed); MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); if (movingobjectposition1 != null) @@ -175,21 +180,29 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa } } - float f2; + float speed; float f3; if (movingobjectposition != null) { if (movingobjectposition.entityHit != null) { - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); - int i1 = MathHelper.ceiling_double_int((double) f2 * this.damage); + speed = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + double damageSpeed = (double) speed * this.damage; + damageSpeed *= baseDamage; + damageSpeed /= 5D; + int damageInflicted = MathHelper.ceiling_double_int(damageSpeed); if (this.getIsCritical()) { - i1 += this.rand.nextInt(i1 / 2 + 2); + damageInflicted += this.rand.nextInt(damageInflicted / 2 + 2); } + if (!worldObj.isRemote) + { + System.out.println("Speed: "+damageSpeed); + System.out.println("Damage: "+damageInflicted); + } DamageSource damagesource = null; if (this.shootingEntity == null) @@ -206,7 +219,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa movingobjectposition.entityHit.setFire(5); } - if (movingobjectposition.entityHit.attackEntityFrom(damagesource, i1)) + if (movingobjectposition.entityHit.attackEntityFrom(damagesource, damageInflicted)) { if (movingobjectposition.entityHit instanceof EntityLiving) { @@ -280,10 +293,10 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa this.motionX = (double) ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = (double) ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = (double) ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); - this.posX -= this.motionX / (double) f2 * 0.05000000074505806D; - this.posY -= this.motionY / (double) f2 * 0.05000000074505806D; - this.posZ -= this.motionZ / (double) f2 * 0.05000000074505806D; + speed = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + this.posX -= this.motionX / (double) speed * 0.05000000074505806D; + this.posY -= this.motionY / (double) speed * 0.05000000074505806D; + this.posZ -= this.motionZ / (double) speed * 0.05000000074505806D; this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); this.inGround = true; this.arrowShake = 7; @@ -308,10 +321,10 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + speed = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) + for (this.rotationPitch = (float) (Math.atan2(this.motionY, (double) speed) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) { ; } @@ -333,8 +346,9 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa this.rotationPitch = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * 0.2F; this.rotationYaw = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * 0.2F; - float f4 = 0.99F; - f1 = 0.05F; + float dropSpeed = 0.99F; + float speedMod = 1.05f + (mass / 1.26F) / 6F; + ySpeed = 0.05F * speedMod; if (this.isInWater()) { @@ -345,13 +359,13 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa this.motionY, this.motionZ); } - f4 = 0.8F; + dropSpeed = 0.8F; } - this.motionX *= (double) f4; - this.motionY *= (double) f4; - this.motionZ *= (double) f4; - this.motionY -= (double) f1; + this.motionX *= (double) dropSpeed; + this.motionY *= (double) dropSpeed; + this.motionZ *= (double) dropSpeed; + this.motionY -= (double) ySpeed; this.setPosition(this.posX, this.posY, this.posZ); this.doBlockCollisions(); } @@ -547,6 +561,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa NBTTagCompound tags = returnStack.getTagCompound().getCompoundTag("InfiTool"); data.writeShort(returnStack.itemID); data.writeFloat(rotationYaw); + data.writeFloat(mass); data.writeInt(tags.getInteger("RenderHandle")); data.writeInt(tags.getInteger("RenderHead")); data.writeInt(tags.getInteger("RenderAccessory")); @@ -588,6 +603,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa { returnStack = new ItemStack(data.readShort(), 1, 0); rotationYaw = data.readFloat(); + mass = data.readFloat(); NBTTagCompound compound = new NBTTagCompound(); NBTTagCompound toolTag = new NBTTagCompound(); toolTag.setInteger("RenderHandle", data.readInt()); diff --git a/mods/tinker/tconstruct/inventory/SlotTool.java b/mods/tinker/tconstruct/inventory/SlotTool.java index a7d31064..9d7fa8ec 100644 --- a/mods/tinker/tconstruct/inventory/SlotTool.java +++ b/mods/tinker/tconstruct/inventory/SlotTool.java @@ -57,8 +57,10 @@ public class SlotTool extends Slot { tags.getCompoundTag("InfiTool").setBoolean("Built", true); Boolean full = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null); - for (int i = 1; i <= 3; i++) + for (int i = 2; i <= 3; i++) inventory.decrStackSize(i, 1); + int amount = inventory.getStackInSlot(1).getItem() instanceof ToolCore ? stack.stackSize : 1; + inventory.decrStackSize(1, amount); if (!player.worldObj.isRemote && full) player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "sounds.little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F); //player.worldObj.playAuxSFX(1021, (int)player.posX, (int)player.posY, (int)player.posZ, 0); diff --git a/mods/tinker/tconstruct/inventory/ToolStationContainer.java b/mods/tinker/tconstruct/inventory/ToolStationContainer.java index e2819d42..62bccc7e 100644 --- a/mods/tinker/tconstruct/inventory/ToolStationContainer.java +++ b/mods/tinker/tconstruct/inventory/ToolStationContainer.java @@ -3,6 +3,7 @@ package mods.tinker.tconstruct.inventory; import java.util.Random; import mods.tinker.tconstruct.blocks.logic.ToolStationLogic; +import mods.tinker.tconstruct.library.tools.ToolCore; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; @@ -132,8 +133,10 @@ public class ToolStationContainer extends ActiveContainer if (!tags.getCompoundTag("InfiTool").hasKey("Built")) { tags.getCompoundTag("InfiTool").setBoolean("Built", true); - for (int i = 1; i <= 3; i++) + for (int i = 2; i <= 3; i++) logic.decrStackSize(i, 1); + int amount = logic.getStackInSlot(1).getItem() instanceof ToolCore ? stack.stackSize : 1; + logic.decrStackSize(1, amount); logic.worldObj.playSoundEffect(logic.xCoord, logic.yCoord, logic.zCoord, "sounds.little_saw", 1.0F, (random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F); /*if (!player.worldObj.isRemote) diff --git a/mods/tinker/tconstruct/items/Bowstring.java b/mods/tinker/tconstruct/items/Bowstring.java index 25852580..8dbaff69 100644 --- a/mods/tinker/tconstruct/items/Bowstring.java +++ b/mods/tinker/tconstruct/items/Bowstring.java @@ -5,6 +5,7 @@ import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import mods.tinker.tconstruct.common.TContent; import mods.tinker.tconstruct.library.util.IToolPart; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -43,4 +44,11 @@ public class Bowstring extends CraftingItem implements IToolPart { return stack.getItemDamage(); } + + public void getSubItems (int id, CreativeTabs tab, List list) + { + list.add(new ItemStack(id, 1, 0)); + if (TContent.thaumcraftAvailable) + list.add(new ItemStack(id, 1, 1)); + } } diff --git a/mods/tinker/tconstruct/items/tools/Arrow.java b/mods/tinker/tconstruct/items/tools/Arrow.java index 56146183..0546133b 100644 --- a/mods/tinker/tconstruct/items/tools/Arrow.java +++ b/mods/tinker/tconstruct/items/tools/Arrow.java @@ -2,18 +2,25 @@ package mods.tinker.tconstruct.items.tools; import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + import mods.tinker.tconstruct.common.TContent; import mods.tinker.tconstruct.library.crafting.ToolBuilder; import mods.tinker.tconstruct.library.tools.ToolCore; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; public class Arrow extends ToolCore { public Arrow(int id) { - super(id, 1); + super(id, 3); this.setUnlocalizedName("InfiTool.Arrow"); this.setMaxStackSize(64); this.setMaxDamage(0); @@ -78,6 +85,48 @@ public class Arrow extends ToolCore { return new String[] {"ammo"}; } + + @Override + public void getSubItems (int id, CreativeTabs tab, List list) + { + //Vanilla style arrow + Item accessory = getAccessoryItem(); + ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null; + Item extra = getExtraItem(); + ItemStack extraStack = extra != null ? new ItemStack(extra, 1, 0) : null; + ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, 3), new ItemStack(getHandleItem(), 1, 0), accessoryStack, extraStack, ""); + if (tool == null) + { + System.out.println("Creative builder failed tool for Vanilla style" + this.getToolName()); + System.out.println("Make sure you do not have item ID conflicts"); + } + else + { + tool.stackSize = 1; + tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true); + list.add(tool); + } + + //Random arrow + accessory = getAccessoryItem(); + accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, random.nextInt(4)) : null; + extra = getExtraItem(); + extraStack = extra != null ? new ItemStack(extra, 1, 0) : null; + tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, random.nextInt(18)), new ItemStack(getHandleItem(), 1, random.nextInt(18)), accessoryStack, extraStack, "Random Streamer"); + + if (tool == null) + { + System.out.println("Creative builder failed tool for Vanilla style" + this.getToolName()); + System.out.println("Make sure you do not have item ID conflicts"); + } + else + { + tool.stackSize = 1; + tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true); + list.add(tool); + } + super.getSubItems(id, tab, list); + } @Override public void buildTool (int id, String name, List list) @@ -99,4 +148,78 @@ public class Arrow extends ToolCore list.add(tool); } } + + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ) + { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) + { + if (!stack.hasTagCompound()) + return; + + NBTTagCompound tags = stack.getTagCompound(); + if (tags.hasKey("charge")) + { + String color = ""; + //double joules = this.getJoules(stack); + int power = tags.getInteger("charge"); + + if (power != 0) + { + if (power <= this.getMaxCharge(stack) / 3) + color = "\u00a74"; + else if (power > this.getMaxCharge(stack) * 2 / 3) + color = "\u00a72"; + else + color = "\u00a76"; + } + + String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge(stack)).append(" EU").toString(); + list.add(charge); + } + if (tags.hasKey("InfiTool")) + { + boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken"); + if (broken) + list.add("\u00A7oBroken"); + else + { + int head = tags.getCompoundTag("InfiTool").getInteger("Head"); + int handle = tags.getCompoundTag("InfiTool").getInteger("Handle"); + + String headName = getAbilityNameForType(head); + if (!headName.equals("")) + list.add(getStyleForType(head) + headName); + + String handleName = getAbilityNameForType(handle); + if (!handleName.equals("") && handle != head) + list.add(getStyleForType(handle) + handleName); + + int unbreaking = tags.getCompoundTag("InfiTool").getInteger("Unbreaking"); + String reinforced = getReinforcedName(head, handle, 0, 0, unbreaking); + if (!reinforced.equals("")) + list.add(reinforced); + + boolean displayToolTips = true; + int tipNum = 0; + while (displayToolTips) + { + tipNum++; + String tooltip = "Tooltip" + tipNum; + if (tags.getCompoundTag("InfiTool").hasKey(tooltip)) + { + String tipName = tags.getCompoundTag("InfiTool").getString(tooltip); + if (!tipName.equals("")) + list.add(tipName); + } + else + displayToolTips = false; + } + } + } + } } diff --git a/mods/tinker/tconstruct/items/tools/Shortbow.java b/mods/tinker/tconstruct/items/tools/Shortbow.java index ccc0d753..d8e7f07a 100644 --- a/mods/tinker/tconstruct/items/tools/Shortbow.java +++ b/mods/tinker/tconstruct/items/tools/Shortbow.java @@ -1,13 +1,18 @@ package mods.tinker.tconstruct.items.tools; +import java.util.List; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mods.tinker.tconstruct.common.TContent; +import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.library.tools.BowBase; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class Shortbow extends BowBase @@ -83,9 +88,105 @@ public class Shortbow extends BowBase ItemStack usingItem = player.getItemInUse(); if (usingItem != null && usingItem.getItem() == this) { - player.movementInput.moveForward *= 1.3F; - player.movementInput.moveStrafe *= 1.3F; + player.movementInput.moveForward *= 2.0F; + player.movementInput.moveStrafe *= 2.0F; } } } + + @Override + @SideOnly(Side.CLIENT) + public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) + { + if (!stack.hasTagCompound()) + return; + + NBTTagCompound tags = stack.getTagCompound(); + if (tags.hasKey("charge")) + { + String color = ""; + //double joules = this.getJoules(stack); + int power = tags.getInteger("charge"); + + if (power != 0) + { + if (power <= this.getMaxCharge(stack) / 3) + color = "\u00a74"; + else if (power > this.getMaxCharge(stack) * 2 / 3) + color = "\u00a72"; + else + color = "\u00a76"; + } + + String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxCharge(stack)).append(" EU").toString(); + list.add(charge); + } + if (tags.hasKey("InfiTool")) + { + boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken"); + if (broken) + list.add("\u00A7oBroken"); + else + { + int head = tags.getCompoundTag("InfiTool").getInteger("Head"); + int handle = tags.getCompoundTag("InfiTool").getInteger("Handle"); + int binding = tags.getCompoundTag("InfiTool").getInteger("Accessory"); + int extra = tags.getCompoundTag("InfiTool").getInteger("Extra"); + + String headName = getAbilityNameForType(head); + if (!headName.equals("")) + list.add(getStyleForType(head) + headName); + + String handleName = getBowstringName(handle); + if (!handleName.equals("") && handle != head) + list.add(handleName); + + if (getPartAmount() >= 3) + { + String bindingName = getAbilityNameForType(binding); + if (!bindingName.equals("") && binding != head && binding != handle) + list.add(getStyleForType(binding) + bindingName); + } + + if (getPartAmount() >= 4) + { + String extraName = getAbilityNameForType(extra); + if (!extraName.equals("") && extra != head && extra != handle && extra != binding) + list.add(getStyleForType(extra) + extraName); + } + + int unbreaking = tags.getCompoundTag("InfiTool").getInteger("Unbreaking"); + String reinforced = getReinforcedName(head, handle, binding, extra, unbreaking); + if (!reinforced.equals("")) + list.add(reinforced); + + boolean displayToolTips = true; + int tipNum = 0; + while (displayToolTips) + { + tipNum++; + String tooltip = "Tooltip" + tipNum; + if (tags.getCompoundTag("InfiTool").hasKey(tooltip)) + { + String tipName = tags.getCompoundTag("InfiTool").getString(tooltip); + if (!tipName.equals("")) + list.add(tipName); + } + else + displayToolTips = false; + } + } + } + } + + public String getBowstringName (int type) + { + switch (type) + { + case 0: return ""; + case 1: return "\u00A7bEnchanted"; + default: return ""; + } + //return TConstructRegistry.getMaterial(type).ability(); + } } diff --git a/mods/tinker/tconstruct/library/TConstructRegistry.java b/mods/tinker/tconstruct/library/TConstructRegistry.java index c21fc13f..85b87395 100644 --- a/mods/tinker/tconstruct/library/TConstructRegistry.java +++ b/mods/tinker/tconstruct/library/TConstructRegistry.java @@ -358,9 +358,9 @@ public class TConstructRegistry customMaterials.add(mat); } - public static void addFletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingMaterial, float accuracy, float breakChance) + public static void addFletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingMaterial, float accuracy, float breakChance, float mass) { - FletchingMaterial mat = new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance); + FletchingMaterial mat = new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance, mass); customMaterials.add(mat); } diff --git a/mods/tinker/tconstruct/library/tools/BowBase.java b/mods/tinker/tconstruct/library/tools/BowBase.java index d73559c8..15042586 100644 --- a/mods/tinker/tconstruct/library/tools/BowBase.java +++ b/mods/tinker/tconstruct/library/tools/BowBase.java @@ -60,11 +60,13 @@ public abstract class BowBase extends ToolCore boolean creative = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0; int slotID = getInventorySlotContainItem(TContent.arrow.itemID, player.inventory); - ItemStack arrow = null; + int arrowID = getInventorySlotContainItem(Item.arrow.itemID, player.inventory); + int arrowState = 0; + ItemStack tinkerArrow = null; if (slotID != -1) - arrow = player.inventory.getStackInSlot(slotID); + tinkerArrow = player.inventory.getStackInSlot(slotID); - if (creative || arrow != null || player.inventory.hasItem(Item.arrow.itemID)) + if (creative || tinkerArrow != null || arrowID != -1) { NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool"); float drawTime = toolTag.getInteger("DrawSpeed"); @@ -83,9 +85,10 @@ public abstract class BowBase extends ToolCore } EntityArrow arrowEntity = null; - if (arrow != null) + //if (tinkerArrow != null) + if (slotID != 1 && (arrowID == -1 || slotID < arrowID)) { - ItemStack arrowStack = arrow.copy(); + ItemStack arrowStack = tinkerArrow.copy(); arrowStack.stackSize = 1; arrowEntity = new ArrowEntity(world, player, speedBase * 2.0F, arrowStack); } @@ -135,7 +138,8 @@ public abstract class BowBase extends ToolCore } else { - if (arrow != null) + //if (tinkerArrow != null) + if (slotID != 1 && (arrowID == -1 || slotID < arrowID)) { player.inventory.consumeInventoryItem(TContent.arrow.itemID); } @@ -212,6 +216,11 @@ public abstract class BowBase extends ToolCore return stack; } + + public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ) + { + return false; + } @SideOnly(Side.CLIENT) @Override @@ -506,7 +515,7 @@ public abstract class BowBase extends ToolCore { return getIcon3(stack, renderPass); } - if (useTime >= (drawTime * 3 / 5)) + if (useTime >= (drawTime * 2 / 3)) { return getIcon2(stack, renderPass); } diff --git a/mods/tinker/tconstruct/library/tools/FletchingMaterial.java b/mods/tinker/tconstruct/library/tools/FletchingMaterial.java index 2cb5d5a0..077e3fbc 100644 --- a/mods/tinker/tconstruct/library/tools/FletchingMaterial.java +++ b/mods/tinker/tconstruct/library/tools/FletchingMaterial.java @@ -6,10 +6,12 @@ public class FletchingMaterial extends CustomMaterial { public final float accuracy; public final float breakChance; - public FletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, float accuracy, float breakChance) + public final float mass; + public FletchingMaterial(int materialID, int value, ItemStack input, ItemStack craftingItem, float accuracy, float breakChance, float mass) { super(materialID, value, input, craftingItem); this.accuracy = accuracy; this.breakChance = breakChance; + this.mass = mass; } } diff --git a/mods/tinker/tconstruct/library/tools/ToolCore.java b/mods/tinker/tconstruct/library/tools/ToolCore.java index 3efcec7d..48b400fb 100644 --- a/mods/tinker/tconstruct/library/tools/ToolCore.java +++ b/mods/tinker/tconstruct/library/tools/ToolCore.java @@ -525,7 +525,7 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox Item accessory = getAccessoryItem(); ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, id) : null; Item extra = getExtraItem(); - ItemStack extraStack = extra != null ? new ItemStack(getExtraItem(), 1, id) : null; + ItemStack extraStack = extra != null ? new ItemStack(extra, 1, id) : null; ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name + getToolName()); if (tool == null) { diff --git a/mods/tinker/tconstruct/modifiers/ModAttack.java b/mods/tinker/tconstruct/modifiers/ModAttack.java index 2b7e8e10..9cfa24df 100644 --- a/mods/tinker/tconstruct/modifiers/ModAttack.java +++ b/mods/tinker/tconstruct/modifiers/ModAttack.java @@ -112,13 +112,14 @@ public class ModAttack extends ToolMod public boolean validType(ToolCore tool) { - List list = Arrays.asList(tool.toolCategories()); - return list.contains("melee") || list.contains("harvest"); + return true; + /*List list = Arrays.asList(tool.toolCategories()); + return list.contains("melee") || list.contains("harvest") || list.contains("ammo");*/ } public boolean nerfType(ToolCore tool) { List list = Arrays.asList(tool.toolCategories()); - return list.contains("throwing"); + return list.contains("throwing") || list.contains("ammo"); } } diff --git a/mods/tinker/tconstruct/util/TEventHandler.java b/mods/tinker/tconstruct/util/TEventHandler.java index 072f654c..3d57a153 100644 --- a/mods/tinker/tconstruct/util/TEventHandler.java +++ b/mods/tinker/tconstruct/util/TEventHandler.java @@ -119,7 +119,7 @@ public class TEventHandler if (head != null && shaft != null && fletching != null) { - float mass = (head.mass / 5f + shaft.mass) / 1.2f; + float mass = head.mass / 5f + shaft.mass + fletching.mass; float shatter = (head.breakChance + shaft.breakChance + fletching.breakChance) / 4f; float accuracy = (head.accuracy + shaft.accuracy + fletching.accuracy) / 3;