diff --git a/resources/assets/tinker/lang/de_DE.lang b/resources/assets/tinker/lang/de_DE.lang index 38ecddc9..cee7ccae 100644 --- a/resources/assets/tinker/lang/de_DE.lang +++ b/resources/assets/tinker/lang/de_DE.lang @@ -453,6 +453,7 @@ tile.fluid.molten.manyullyn.name=Geschmolzenes Manyullyn tile.fluid.molten.alumite.name=Geschmolzenes Alumit tile.fluid.molten.obsidian.name=Geschmolzenes Obsidian tile.fluid.molten.steel.name=Geschmolzener Stahl +tile.fluid.molten.pigiron.name=Geschmolzenes Schweineisen tile.fluid.molten.glass.name=Geschmolzenes Glas tile.molten.stone.name=Versengtes Gestein tile.molten.emerald.name=Verflüssigter Smaragd diff --git a/resources/assets/tinker/lang/en_PT.lang b/resources/assets/tinker/lang/en_PT.lang index 9a930851..c6640096 100644 --- a/resources/assets/tinker/lang/en_PT.lang +++ b/resources/assets/tinker/lang/en_PT.lang @@ -466,6 +466,7 @@ tile.fluid.molten.manyullyn.name=Molten Manyullyn tile.fluid.molten.alumite.name=Molten Alumite tile.fluid.molten.obsidian.name=Molten Obsidian tile.fluid.molten.steel.name=Molten Steel +tile.fluid.molten.pigiron.name=Molten Pig Iron tile.fluid.molten.glass.name=Molten Glass tile.molten.stone.name=Seared Stone tile.molten.emerald.name=Liquified Emerald diff --git a/resources/assets/tinker/lang/en_US.lang b/resources/assets/tinker/lang/en_US.lang index 8065e42c..3041c157 100644 --- a/resources/assets/tinker/lang/en_US.lang +++ b/resources/assets/tinker/lang/en_US.lang @@ -55,7 +55,7 @@ block.ore.gravel.gold.name=Gold Gravel Ore block.ore.gravel.copper.name=Copper Gravel Ore block.ore.gravel.tin.name=Tin Gravel Ore block.ore.gravel.aluminum.name=Aluminum Gravel Ore -block.ore.gravel.Cobalt.name=Cobalt Gravel Ore +block.ore.gravel.cobalt.name=Cobalt Gravel Ore block.brownstone.rough.name=Rough Brownstone block.brownstone.rough.road.name=Brownstone Road @@ -459,7 +459,7 @@ tile.fluid.molten.gold.name=Molten Gold tile.fluid.molten.copper.name=Molten Copper tile.fluid.molten.tin.name=Liquid Tin tile.fluid.molten.aluminum.name=Molten Aluminum -tile.fluid.molten.Cobalt.name=Molten Cobalt +tile.fluid.molten.cobalt.name=Molten Cobalt tile.fluid.molten.ardite.name=Molten Ardite tile.fluid.molten.bronze.name=Molten Bronze tile.fluid.molten.alubrass.name=Molten Aluminum Brass @@ -467,6 +467,7 @@ tile.fluid.molten.manyullyn.name=Molten Manyullyn tile.fluid.molten.alumite.name=Molten Alumite tile.fluid.molten.obsidian.name=Molten Obsidian tile.fluid.molten.steel.name=Molten Steel +tile.fluid.molten.pigiron.name=Molten Pig Iron tile.fluid.molten.glass.name=Molten Glass tile.molten.stone.name=Seared Stone tile.molten.emerald.name=Liquified Emerald diff --git a/resources/assets/tinker/textures/gui/newhearts.png b/resources/assets/tinker/textures/gui/newhearts.png index 5b0e326a..be6b93ae 100644 Binary files a/resources/assets/tinker/textures/gui/newhearts.png and b/resources/assets/tinker/textures/gui/newhearts.png differ diff --git a/src/main/java/tconstruct/armor/ArmorProxyClient.java b/src/main/java/tconstruct/armor/ArmorProxyClient.java index f7f15e8f..503dc96a 100644 --- a/src/main/java/tconstruct/armor/ArmorProxyClient.java +++ b/src/main/java/tconstruct/armor/ArmorProxyClient.java @@ -207,7 +207,7 @@ public class ArmorProxyClient extends ArmorProxyCommon @SubscribeEvent public void renderHealthbar (RenderGameOverlayEvent.Pre event) { - if (!Loader.isModLoaded("tukmc_Vz"))// Loader check to avoid conflicting + if (!Loader.isModLoaded("tukmc_Vz") || Loader.isModLoaded("borderlands"))// Loader check to avoid conflicting // with a GUI mod (thanks Vazkii!) { if (event.type == ElementType.HEALTH) @@ -243,6 +243,12 @@ public class ArmorProxyClient extends ArmorProxyCommon int left = scaledWidth / 2 - 91; int top = scaledHeight - GuiIngameForge.left_height; + if (!GuiIngameForge.renderExperiance) + { + top += 7; + yBasePos += 7; + } + int regen = -1; if (mc.thePlayer.isPotionActive(Potion.regeneration)) { @@ -297,12 +303,13 @@ public class ArmorProxyClient extends ArmorProxyCommon } } + int potionOffset = 0; PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither); if (potion != null) - return; + potionOffset = 18; potion = mc.thePlayer.getActivePotionEffect(Potion.poison); if (potion != null) - return; + potionOffset = 9; // Extra hearts this.mc.getTextureManager().bindTexture(hearts); @@ -315,11 +322,14 @@ public class ArmorProxyClient extends ArmorProxyCommon renderHearts = 10; for (int i = 0; i < renderHearts; i++) { - this.drawTexturedModalRect(xBasePos + 8 * i, yBasePos, 0 + 18 * iter, 0, 8, 8); + int y = 0; + if (i == regen) + y -= 2; + this.drawTexturedModalRect(xBasePos + 8 * i, yBasePos + y, 0 + 18 * iter, potionOffset, 9, 9); } if (hp % 2 == 1 && renderHearts < 10) { - this.drawTexturedModalRect(xBasePos + 8 * renderHearts, yBasePos, 9 + 18 * iter, 0, 8, 8); + this.drawTexturedModalRect(xBasePos + 8 * renderHearts, yBasePos, 9 + 18 * iter, potionOffset, 9, 9); } } diff --git a/src/main/java/tconstruct/blocks/slime/SlimeGrass.java b/src/main/java/tconstruct/blocks/slime/SlimeGrass.java index 091a307f..eb58ca4c 100644 --- a/src/main/java/tconstruct/blocks/slime/SlimeGrass.java +++ b/src/main/java/tconstruct/blocks/slime/SlimeGrass.java @@ -17,10 +17,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; +import tconstruct.TConstruct; import tconstruct.library.TConstructRegistry; +import tconstruct.smeltery.TinkerSmeltery; import tconstruct.tools.TinkerTools; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import tconstruct.world.TinkerWorld; public class SlimeGrass extends MantleBlock { @@ -103,36 +106,37 @@ public class SlimeGrass extends MantleBlock } @Override - public void updateTick (World par1World, int par2, int par3, int par4, Random par5Random) + public void updateTick (World world, int x, int y, int z, Random random) { - if (!par1World.isRemote) + if (!world.isRemote) { - if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2) + if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2) { - par1World.setBlock(par2, par3, par4, TinkerTools.craftedSoil, 5, 3); + world.setBlock(x, y, z, TinkerTools.craftedSoil, 5, 3); } - else if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) + else if (world.getBlockLightValue(x, y + 1, z) >= 9) { for (int l = 0; l < 4; ++l) { - int posX = par2 + par5Random.nextInt(3) - 1; - int posY = par3 + par5Random.nextInt(5) - 3; - int posZ = par4 + par5Random.nextInt(3) - 1; - Block l1 = par1World.getBlock(posX, posY + 1, posZ); + int posX = x + random.nextInt(3) - 1; + int posY = y + random.nextInt(5) - 3; + int posZ = z + random.nextInt(3) - 1; + Block blockAbove = world.getBlock(posX, posY + 1, posZ); - if (par1World.getBlockLightValue(posX, posY + 1, posZ) >= 4 && par1World.getBlockLightOpacity(posX, posY + 1, posZ) <= 2) + if (world.getBlockLightValue(posX, posY + 1, posZ) >= 4 && world.getBlockLightOpacity(posX, posY + 1, posZ) <= 2 + && blockAbove != TinkerTools.craftedSoil && blockAbove != this) { - Block block = par1World.getBlock(posX, posY, posZ); + Block block = world.getBlock(posX, posY, posZ); if (block == Blocks.dirt) { - par1World.setBlock(posX, posY, posZ, (Block) this, 1, 3); + world.setBlock(posX, posY, posZ, (Block) this, 1, 3); return; } - int blockMeta = par1World.getBlockMetadata(posX, posY, posZ); + int blockMeta = world.getBlockMetadata(posX, posY, posZ); if (block == TinkerTools.craftedSoil) { if (blockMeta == 5) - par1World.setBlock(posX, posY, posZ, (Block) this, 0, 3); + world.setBlock(posX, posY, posZ, (Block) this, 0, 3); } } } diff --git a/src/main/java/tconstruct/client/CustomBowRenderer.java b/src/main/java/tconstruct/client/CustomBowRenderer.java index 9b5daec9..75a9031b 100644 --- a/src/main/java/tconstruct/client/CustomBowRenderer.java +++ b/src/main/java/tconstruct/client/CustomBowRenderer.java @@ -48,13 +48,7 @@ public class CustomBowRenderer implements IItemRenderer { GL11.glPushMatrix(); - Block block = null; - if (stack.getItem() instanceof ItemBlock) - { - block = BlockUtils.getBlockFromItem(stack.getItem()); - } - - IIcon icon = null; // living.getItemIcon(stack, renderPass); + IIcon icon = null; if (living instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) living; diff --git a/src/main/java/tconstruct/client/ToolCoreRenderer.java b/src/main/java/tconstruct/client/ToolCoreRenderer.java index 09a0b35e..61c9bbf3 100644 --- a/src/main/java/tconstruct/client/ToolCoreRenderer.java +++ b/src/main/java/tconstruct/client/ToolCoreRenderer.java @@ -12,19 +12,31 @@ import org.lwjgl.opengl.GL12; import tconstruct.TConstruct; import tconstruct.library.tools.ToolCore; +import tconstruct.tools.entity.DaggerEntity; public class ToolCoreRenderer implements IItemRenderer { + private final boolean isEntity; + + public ToolCoreRenderer(boolean isEntity) { + this.isEntity = isEntity; + } + @Override public boolean handleRenderType (ItemStack item, ItemRenderType type) { + if(!item.hasTagCompound()) + return false; + switch (type) { case ENTITY: + //GL11.glTranslatef(-0.0625F, -0.0625F, 0F); return true; case EQUIPPED: GL11.glTranslatef(0.03f, 0F, -0.09375F); case EQUIPPED_FIRST_PERSON: + return !isEntity; case INVENTORY: return true; default: @@ -52,7 +64,9 @@ public class ToolCoreRenderer implements IItemRenderer if (data.length > 1) ent = (Entity) data[1]; - int iconParts = toolIcons;// tool.getRenderPasses(item.getItemDamage()); + int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage()); + // TODO: have the tools define how many render passes they have + // (requires more logic rewrite than it sounds like) IIcon[] tempParts = new IIcon[iconParts]; label: @@ -78,8 +92,7 @@ public class ToolCoreRenderer implements IItemRenderer for (int i = 0; i < iconParts; ++i) { IIcon part = tempParts[i]; - if (part == null)// || part == ToolCore.blankSprite | part == - // ToolCore.emptyIcon) + if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) ++count; else parts[i - count] = part; @@ -98,8 +111,6 @@ public class ToolCoreRenderer implements IItemRenderer float[] yMin = new float[iconParts]; float[] xMin = new float[iconParts]; float[] yMax = new float[iconParts]; - int[] sheetWidth = new int[iconParts]; - int[] sheetHeight = new int[iconParts]; float depth = 1f / 16f; float[] width = new float[iconParts]; @@ -115,14 +126,12 @@ public class ToolCoreRenderer implements IItemRenderer xMax[i] = icon.getMaxU(); yMin[i] = icon.getMinV(); yMax[i] = icon.getMaxV(); - sheetWidth[i] = icon.getIconWidth(); - sheetHeight[i] = icon.getIconHeight(); + width[i] = icon.getIconWidth(); + height[i] = icon.getIconHeight(); xDiff[i] = xMin[i] - xMax[i]; yDiff[i] = yMin[i] - yMax[i]; - width[i] = sheetWidth[i] * xDiff[i]; - height[i] = sheetHeight[i] * yDiff[i]; - xSub[i] = 0.5f * (xMax[i] - xMin[i]) / sheetWidth[i]; - ySub[i] = 0.5f * (yMax[i] - yMin[i]) / sheetHeight[i]; + xSub[i] = 0.5f * (xMax[i] - xMin[i]) / width[i]; + ySub[i] = 0.5f * (yMax[i] - yMin[i]) / height[i]; } GL11.glPushMatrix(); @@ -153,7 +162,7 @@ public class ToolCoreRenderer implements IItemRenderer GL11.glTranslatef(0, -4 / 16f, 0); break; case ENTITY: - GL11.glTranslatef(0, 4 / 16f, 0); + GL11.glTranslatef(-0.5f, 0f, depth); break; default: } @@ -185,19 +194,19 @@ public class ToolCoreRenderer implements IItemRenderer // make it have "depth" tess.startDrawingQuads(); tess.setNormal(-1, 0, 0); - int k; float pos; float iconPos; for (int i = 0; i < iconParts; ++i) { - for (k = 0; k < width[i]; ++k) + float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i]; + for (int k = 0, e = (int)w; k < e; ++k) { - pos = k / width[i]; - iconPos = xMax[i] + xDiff[i] * pos - xSub[i]; + pos = k / w; + iconPos = m + d * pos - s; tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]); - tess.addVertexWithUV(pos, 0, 0, iconPos, yMax[i]); - tess.addVertexWithUV(pos, 1, 0, iconPos, yMin[i]); + tess.addVertexWithUV(pos, 0, 0, iconPos, yMax[i]); + tess.addVertexWithUV(pos, 1, 0, iconPos, yMin[i]); tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin[i]); } } @@ -209,14 +218,16 @@ public class ToolCoreRenderer implements IItemRenderer for (int i = 0; i < iconParts; ++i) { - for (k = 0; k < width[i]; ++k) + float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i]; + float d2 = 1f / w; + for (int k = 0, e = (int)w; k < e; ++k) { - pos = k / width[i]; - iconPos = xMax[i] + xDiff[i] * pos - xSub[i]; - posEnd = pos + 1 / width[i]; + pos = k / w; + iconPos = m + d * pos - s; + posEnd = pos + d2; tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin[i]); - tess.addVertexWithUV(posEnd, 1, 0, iconPos, yMin[i]); - tess.addVertexWithUV(posEnd, 0, 0, iconPos, yMax[i]); + tess.addVertexWithUV(posEnd, 1, 0, iconPos, yMin[i]); + tess.addVertexWithUV(posEnd, 0, 0, iconPos, yMax[i]); tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax[i]); } } @@ -227,13 +238,15 @@ public class ToolCoreRenderer implements IItemRenderer for (int i = 0; i < iconParts; ++i) { - for (k = 0; k < height[i]; ++k) + float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i]; + float d2 = 1f / h; + for (int k = 0, e = (int)h; k < e; ++k) { - pos = k / height[i]; - iconPos = yMax[i] + yDiff[i] * pos - ySub[i]; - posEnd = pos + 1 / height[i]; - tess.addVertexWithUV(0, posEnd, 0, xMax[i], iconPos); - tess.addVertexWithUV(1, posEnd, 0, xMin[i], iconPos); + pos = k / h; + iconPos = m + d * pos - s; + posEnd = pos + d2; + tess.addVertexWithUV(0, posEnd, 0, xMax[i], iconPos); + tess.addVertexWithUV(1, posEnd, 0, xMin[i], iconPos); tess.addVertexWithUV(1, posEnd, -depth, xMin[i], iconPos); tess.addVertexWithUV(0, posEnd, -depth, xMax[i], iconPos); } @@ -245,12 +258,13 @@ public class ToolCoreRenderer implements IItemRenderer for (int i = 0; i < iconParts; ++i) { - for (k = 0; k < height[i]; ++k) + float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i]; + for (int k = 0, e = (int)h; k < e; ++k) { - pos = k / height[i]; - iconPos = yMax[i] + yDiff[i] * pos - ySub[i]; - tess.addVertexWithUV(1, pos, 0, xMin[i], iconPos); - tess.addVertexWithUV(0, pos, 0, xMax[i], iconPos); + pos = k / h; + iconPos = m + d * pos - s; + tess.addVertexWithUV(1, pos, 0, xMin[i], iconPos); + tess.addVertexWithUV(0, pos, 0, xMax[i], iconPos); tess.addVertexWithUV(0, pos, -depth, xMax[i], iconPos); tess.addVertexWithUV(1, pos, -depth, xMin[i], iconPos); } diff --git a/src/main/java/tconstruct/client/entity/projectile/DaggerRenderCustom.java b/src/main/java/tconstruct/client/entity/projectile/DaggerRenderCustom.java index 84928e11..a26ee505 100644 --- a/src/main/java/tconstruct/client/entity/projectile/DaggerRenderCustom.java +++ b/src/main/java/tconstruct/client/entity/projectile/DaggerRenderCustom.java @@ -52,6 +52,7 @@ public class DaggerRenderCustom extends Render if (shake > 0.0F) GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1); GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f); + GL11.glTranslatef(0.5f, 0f, -1 / 16f); // compensates the translation in the toolcorerenderer float scale = 1.35f; GL11.glScalef(scale, scale, scale); ForgeHooksClient.renderEntityItem(null, item, 0, 0, random, renderManager.renderEngine, field_147909_c, 1); diff --git a/src/main/java/tconstruct/library/tools/AbilityHelper.java b/src/main/java/tconstruct/library/tools/AbilityHelper.java index 6b1fdf2f..1c7b3ac4 100644 --- a/src/main/java/tconstruct/library/tools/AbilityHelper.java +++ b/src/main/java/tconstruct/library/tools/AbilityHelper.java @@ -680,4 +680,45 @@ public class AbilityHelper return world.func_147447_a(vec3, vec31, par3, !par3, par3); } + public static float calcToolSpeed(ToolCore tool, NBTTagCompound tags) + { + float mineSpeed = tags.getInteger("MiningSpeed"); + int heads = 1; + if (tags.hasKey("MiningSpeed2")) + { + mineSpeed += tags.getInteger("MiningSpeed2"); + heads++; + } + + if (tags.hasKey("MiningSpeedHandle")) + { + mineSpeed += tags.getInteger("MiningSpeedHandle"); + heads++; + } + + if (tags.hasKey("MiningSpeedExtra")) + { + mineSpeed += tags.getInteger("MiningSpeedExtra"); + heads++; + } + float speedMod = 1f; + if(tool instanceof HarvestTool) + speedMod = ((HarvestTool) tool).breakSpeedModifier(); + + float trueSpeed = mineSpeed / (heads * 100f) * speedMod; + trueSpeed += calcStoneboundBonus(tool, tags); + + return trueSpeed; + } + + public static float calcStoneboundBonus(ToolCore tool, NBTTagCompound tags) + { + int durability = tags.getInteger("Damage"); + float stonebound = tags.getFloat("Shoddy"); + float stoneboundMod = 72f; + if(tool instanceof HarvestTool) + stoneboundMod = ((HarvestTool) tool).stoneboundModifier(); + + return (float) Math.log(durability / stoneboundMod + 1) * 2 * stonebound; + } } diff --git a/src/main/java/tconstruct/library/tools/HarvestTool.java b/src/main/java/tconstruct/library/tools/HarvestTool.java index 7fbd82e0..5117c594 100644 --- a/src/main/java/tconstruct/library/tools/HarvestTool.java +++ b/src/main/java/tconstruct/library/tools/HarvestTool.java @@ -141,38 +141,14 @@ public abstract class HarvestTool extends ToolCore public float calculateStrength (NBTTagCompound tags, Block block, int meta) { - float mineSpeed = tags.getInteger("MiningSpeed"); - int heads = 1; - if (tags.hasKey("MiningSpeed2")) - { - mineSpeed += tags.getInteger("MiningSpeed2"); - heads++; - } - if (tags.hasKey("MiningSpeedHandle")) - { - mineSpeed += tags.getInteger("MiningSpeedHandle"); - heads++; - } - - if (tags.hasKey("MiningSpeedExtra")) - { - mineSpeed += tags.getInteger("MiningSpeedExtra"); - heads++; - } - float trueSpeed = mineSpeed / (heads * 100f) * breakSpeedModifier(); int hlvl = block.getHarvestLevel(meta); - int durability = tags.getInteger("Damage"); + if (hlvl > tags.getInteger("HarvestLevel")) + return 0.1f; - float stonebound = tags.getFloat("Shoddy"); - float bonusLog = (float) Math.log(durability / stoneboundModifier() + 1) * 2 * stonebound; - trueSpeed += bonusLog; - - if (hlvl <= tags.getInteger("HarvestLevel")) - return trueSpeed; - return 0.1f; + return AbilityHelper.calcToolSpeed(this, tags); } - + public float breakSpeedModifier() { return 1.0f; diff --git a/src/main/java/tconstruct/plugins/te4/TinkerTE4.java b/src/main/java/tconstruct/plugins/te4/TinkerTE4.java index 8abaf009..938fe557 100644 --- a/src/main/java/tconstruct/plugins/te4/TinkerTE4.java +++ b/src/main/java/tconstruct/plugins/te4/TinkerTE4.java @@ -36,7 +36,7 @@ public class TinkerTE4 TE4Helper.addSmelterRecipe(4000, new ItemStack(TinkerTools.materials, 1, 9), new ItemStack(TinkerTools.materials, 3, 11), new ItemStack(TinkerTools.materials, 4, 14), null, 0); // Dust Recipes - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(materials, 1, 41), "dustArdite", "dustCobalt")); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(materials, 4, 42), "dustAluminum", "dustAluminum", "dustAluminum", "dustCopper")); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerTools.materials, 1, 41), "dustArdite", "dustCobalt")); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkerTools.materials, 4, 42), "dustAluminum", "dustAluminum", "dustAluminum", "dustCopper")); } } diff --git a/src/main/java/tconstruct/smeltery/TinkerSmeltery.java b/src/main/java/tconstruct/smeltery/TinkerSmeltery.java index 95258856..6e8955fb 100644 --- a/src/main/java/tconstruct/smeltery/TinkerSmeltery.java +++ b/src/main/java/tconstruct/smeltery/TinkerSmeltery.java @@ -845,9 +845,9 @@ public class TinkerSmeltery proxy.initialize(); craftingTableRecipes(); addRecipesForSmeltery(); - addOreDictionarySmelteryRecipes(); addRecipesForTableCasting(); addRecipesForBasinCasting(); + addOreDictionarySmelteryRecipes(); } @Handler @@ -956,7 +956,11 @@ public class TinkerSmeltery // NetherOres support Smeltery.addDictionaryMelting("oreNether" + fluidTypeName, ft, 75, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsPerOre * 2)); + // DenseOres support + Smeltery.addDictionaryMelting("denseore" + fluidTypeName, ft, 75, (int) (TConstruct.ingotLiquidValue * PHConstruct.ingotsPerOre * 3)); + // Blocks + registerBlockCasting(ft, "block" + fluidTypeName); Smeltery.addDictionaryMelting("block" + fluidTypeName, ft, 100, TConstruct.blockLiquidValue); if (ft.isToolpart) @@ -1089,39 +1093,47 @@ public class TinkerSmeltery 50); // Golden Food Stuff - FluidStack goldAmount = null; - if (PHConstruct.goldAppleRecipe) - { - goldAmount = new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 8); - } - else - { - goldAmount = new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.nuggetLiquidValue * 8); - } + FluidStack goldAmount = new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 8); tableCasting.addCastingRecipe(new ItemStack(Items.golden_apple, 1), goldAmount, new ItemStack(Items.apple), true, 50); tableCasting.addCastingRecipe(new ItemStack(Items.golden_carrot, 1), goldAmount, new ItemStack(Items.carrot), true, 50); tableCasting.addCastingRecipe(new ItemStack(Items.speckled_melon, 1), goldAmount, new ItemStack(Items.melon), true, 50); if(TinkerWorld.goldHead != null) tableCasting.addCastingRecipe(new ItemStack(TinkerWorld.goldHead), goldAmount, new ItemStack(Items.skull, 1, 3), true, 50); + + // Ensure TConstruct ingots are always first. Otherwise you might get ingots from other mods from casting + if(PHConstruct.tconComesFirst && TinkerTools.materials != null) { + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 9), new FluidStack(moltenCopperFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Copper + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 10), new FluidStack(moltenTinFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Tin + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 11), new FluidStack(moltenAluminumFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Aluminum + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 3), new FluidStack(moltenCobaltFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Cobalt + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 4), new FluidStack(moltenArditeFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Ardite + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 5), new FluidStack(moltenManyullynFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Manyullyn + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 13), new FluidStack(moltenBronzeFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Bronze + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 14), new FluidStack(moltenAlubrassFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Alubrass + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 15), new FluidStack(moltenAlumiteFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Alumite + tableCasting.addCastingRecipe(new ItemStack(TinkerTools.materials, 1, 16), new FluidStack(moltenSteelFluid, TConstruct.ingotLiquidValue), ingotcast, false, 50); //Steel + } } - protected static void addRecipesForBasinCasting () + protected void addRecipesForBasinCasting () { LiquidCasting basinCasting = TConstructRegistry.getBasinCasting(); // Block Casting basinCasting.addCastingRecipe(new ItemStack(Blocks.iron_block), new FluidStack(TinkerSmeltery.moltenIronFluid, TConstruct.blockLiquidValue), null, true, 100); // Iron basinCasting.addCastingRecipe(new ItemStack(Blocks.gold_block), new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.blockLiquidValue), null, true, 100); // gold - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 3), new FluidStack(TinkerSmeltery.moltenCopperFluid, TConstruct.blockLiquidValue), null, true, 100); // copper - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 5), new FluidStack(TinkerSmeltery.moltenTinFluid, TConstruct.blockLiquidValue), null, true, 100); // tin - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 6), new FluidStack(TinkerSmeltery.moltenAluminumFluid, TConstruct.blockLiquidValue), null, true, 100); // aluminum - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 0), new FluidStack(TinkerSmeltery.moltenCobaltFluid, TConstruct.blockLiquidValue), null, true, 100); // cobalt - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 1), new FluidStack(TinkerSmeltery.moltenArditeFluid, TConstruct.blockLiquidValue), null, true, 100); // ardite - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 4), new FluidStack(TinkerSmeltery.moltenBronzeFluid, TConstruct.blockLiquidValue), null, true, 100); // bronze - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 7), new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.blockLiquidValue), null, true, 100); // albrass - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 2), new FluidStack(TinkerSmeltery.moltenManyullynFluid, TConstruct.blockLiquidValue), null, true, 100); // manyullyn - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 8), new FluidStack(TinkerSmeltery.moltenAlumiteFluid, TConstruct.blockLiquidValue), null, true, 100); // alumite + if(PHConstruct.tconComesFirst) { + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 3), new FluidStack(TinkerSmeltery.moltenCopperFluid, TConstruct.blockLiquidValue), null, true, 100); // copper + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 5), new FluidStack(TinkerSmeltery.moltenTinFluid, TConstruct.blockLiquidValue), null, true, 100); // tin + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 6), new FluidStack(TinkerSmeltery.moltenAluminumFluid, TConstruct.blockLiquidValue), null, true, 100); // aluminum + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 0), new FluidStack(TinkerSmeltery.moltenCobaltFluid, TConstruct.blockLiquidValue), null, true, 100); // cobalt + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 1), new FluidStack(TinkerSmeltery.moltenArditeFluid, TConstruct.blockLiquidValue), null, true, 100); // ardite + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 4), new FluidStack(TinkerSmeltery.moltenBronzeFluid, TConstruct.blockLiquidValue), null, true, 100); // bronze + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 7), new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.blockLiquidValue), null, true, 100); // albrass + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 2), new FluidStack(TinkerSmeltery.moltenManyullynFluid, TConstruct.blockLiquidValue), null, true, 100); // manyullyn + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 8), new FluidStack(TinkerSmeltery.moltenAlumiteFluid, TConstruct.blockLiquidValue), null, true, 100); // alumite + basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 9), new FluidStack(TinkerSmeltery.moltenSteelFluid, TConstruct.blockLiquidValue), null, true, 100); // steel + } basinCasting.addCastingRecipe(new ItemStack(Blocks.obsidian), new FluidStack(TinkerSmeltery.moltenObsidianFluid, TConstruct.oreLiquidValue), null, true, 100);// obsidian - basinCasting.addCastingRecipe(new ItemStack(TinkerWorld.metalBlock, 1, 9), new FluidStack(TinkerSmeltery.moltenSteelFluid, TConstruct.blockLiquidValue), null, true, 100); // steel basinCasting.addCastingRecipe(new ItemStack(TinkerSmeltery.clearGlass, 1, 0), new FluidStack(TinkerSmeltery.moltenGlassFluid, FluidContainerRegistry.BUCKET_VOLUME), null, true, 100); // glass basinCasting.addCastingRecipe(new ItemStack(TinkerSmeltery.smeltery, 1, 4), new FluidStack(TinkerSmeltery.moltenStoneFluid, TConstruct.ingotLiquidValue), null, true, 100); // seared // stone @@ -1333,6 +1345,14 @@ public class TinkerSmeltery } } + private void registerBlockCasting (FluidType ft, String name) + { + for (ItemStack ore : OreDictionary.getOres(name)) + { + TConstructRegistry.getBasinCasting().addCastingRecipe(new ItemStack(ore.getItem(), 1, ore.getItemDamage()), new FluidStack(ft.fluid, TConstruct.ingotLiquidValue), 100); + } + } + public void modIntegration () { /* Natura */ diff --git a/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java b/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java index df0d9857..3cd735ed 100644 --- a/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/CastingChannelBlock.java @@ -1,14 +1,17 @@ package tconstruct.smeltery.blocks; +import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import tconstruct.library.TConstructRegistry; +import tconstruct.smeltery.TinkerSmeltery; import tconstruct.smeltery.logic.CastingChannelLogic; import tconstruct.smeltery.model.BlockRenderCastingChannel; @@ -34,9 +37,13 @@ public class CastingChannelBlock extends BlockContainer ItemStack stack = player.getCurrentEquippedItem(); CastingChannelLogic tile = (CastingChannelLogic) world.getTileEntity(x, y, z); - if (stack == null) + if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerSmeltery.castingChannel)) + return false; + else + { tile.changeOutputs(player, side, hitX, hitY, hitZ); - return true; + return true; + } } @Override diff --git a/src/main/java/tconstruct/smeltery/blocks/LavaTankBlock.java b/src/main/java/tconstruct/smeltery/blocks/LavaTankBlock.java index 8900ff4c..ea3ec739 100644 --- a/src/main/java/tconstruct/smeltery/blocks/LavaTankBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/LavaTankBlock.java @@ -323,4 +323,22 @@ public class LavaTankBlock extends BlockContainer } } } + + //Comparator + + @Override + public boolean hasComparatorInputOverride() { + return true; + } + + @Override + public int getComparatorInputOverride(World world, int x, int y, int z, int comparatorSide) + { + return getTankLogic(world, x, y, z).comparatorStrength(); + } + + public static LavaTankLogic getTankLogic(IBlockAccess blockAccess, int par1, int par2, int par3) + { + return (LavaTankLogic)blockAccess.getTileEntity(par1, par2, par3); + } } \ No newline at end of file diff --git a/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java b/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java index 9bf0375f..844bd260 100644 --- a/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/SearedBlock.java @@ -278,30 +278,34 @@ public class SearedBlock extends InventoryBlock } else { - FaucetLogic logic = (FaucetLogic) world.getTileEntity(x, y, z); + TileEntity te = world.getTileEntity(x, y, z); float xMin = 0.25F; float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F; - switch (logic.getRenderDirection()) + if(te instanceof FaucetLogic) { - case 2: - zMin = 0.625F; - zMax = 1.0F; - break; - case 3: - zMax = 0.375F; - zMin = 0F; - break; - case 4: - xMin = 0.625F; - xMax = 1.0F; - break; - case 5: - xMax = 0.375F; - xMin = 0F; - break; + FaucetLogic logic = (FaucetLogic) te; + switch (logic.getRenderDirection()) + { + case 2: + zMin = 0.625F; + zMax = 1.0F; + break; + case 3: + zMax = 0.375F; + zMin = 0F; + break; + case 4: + xMin = 0.625F; + xMax = 1.0F; + break; + case 5: + xMax = 0.375F; + xMin = 0F; + break; + } } this.setBlockBounds(xMin, 0.25F, zMin, xMax, 0.625F, zMax); diff --git a/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java b/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java index f0f1d9b4..53d8d069 100644 --- a/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java +++ b/src/main/java/tconstruct/smeltery/blocks/SmelteryBlock.java @@ -13,6 +13,7 @@ import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -320,4 +321,31 @@ public class SmelteryBlock extends InventoryBlock } super.breakBlock(world, x, y, z, blockID, meta); } + + //Comparator + + public boolean hasComparatorInputOverride () + { + return true; + } + + public int getComparatorInputOverride (World world, int x, int y, int z, int comparatorSide) + { + int meta = world.getBlockMetadata(x, y, z); + if (meta == 0) + { + if (PHConstruct.newSmeltery) + return 0; + else + return Container.calcRedstoneFromInventory(((SmelteryLogic) world.getTileEntity(x, y, z))); + } + if (meta == 1) + { + if (PHConstruct.newSmeltery) + return 0; + else + return ((SmelteryDrainLogic) world.getTileEntity(x, y, z)).comparatorStrength(); + } + return 0; + } } \ No newline at end of file diff --git a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java index ae2b0fe4..32db27bb 100644 --- a/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java +++ b/src/main/java/tconstruct/smeltery/gui/SmelteryGui.java @@ -433,14 +433,18 @@ public class SmelteryGui extends NewContainerGui } } - public void drawLiquidRect (int startU, int startV, IIcon par3Icon, int endU, int endV) + public void drawLiquidRect (int startU, int startV, IIcon icon, int endU, int endV) { + float top = icon.getInterpolatedV(16 - endV); + float bottom = icon.getMaxV(); + float left = icon.getMinU(); + float right = icon.getInterpolatedU(endU); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(startU + 0, startV + endV, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV());// Bottom left - tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());// Bottom right - tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV());// Top right - tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); // Top left + tessellator.addVertexWithUV(startU + 0, startV + endV, this.zLevel, left, bottom);//Bottom left + tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, right, bottom);//Bottom right + tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, right, top);//Top right + tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, left, top); //Top left tessellator.draw(); } diff --git a/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java b/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java index c1e5ee42..62b09a1f 100644 --- a/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/CastingChannelLogic.java @@ -26,7 +26,7 @@ import cpw.mods.fml.relauncher.SideOnly; public class CastingChannelLogic extends TileEntity implements IFluidHandler { - public final static int fillMax = TConstruct.ingotLiquidValue; + public final static int fillMax = TConstruct.ingotLiquidValue * 3; public final static int outputMax = TConstruct.ingotLiquidValue; FluidTank internalTank = new FluidTank(fillMax); HashMap subTanks = new HashMap(); @@ -48,10 +48,10 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler validOutputs.add(ForgeDirection.EAST); validOutputs.add(ForgeDirection.WEST); - subTanks.put(ForgeDirection.NORTH, new FluidTank(TConstruct.ingotLiquidValue / 4)); - subTanks.put(ForgeDirection.SOUTH, new FluidTank(TConstruct.ingotLiquidValue / 4)); - subTanks.put(ForgeDirection.WEST, new FluidTank(TConstruct.ingotLiquidValue / 4)); - subTanks.put(ForgeDirection.EAST, new FluidTank(TConstruct.ingotLiquidValue / 4)); + subTanks.put(ForgeDirection.NORTH, new FluidTank(fillMax / 4)); + subTanks.put(ForgeDirection.SOUTH, new FluidTank(fillMax / 4)); + subTanks.put(ForgeDirection.WEST, new FluidTank(fillMax / 4)); + subTanks.put(ForgeDirection.EAST, new FluidTank(fillMax / 4)); } @Override @@ -65,9 +65,9 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler if (possibleFaucet != null && possibleFaucet instanceof FaucetLogic) flagActiveFaucet = ((FaucetLogic) possibleFaucet).active; - if (ticks == 6 && !flagActiveFaucet) + if (ticks == 6)// && !flagActiveFaucet) this.distributeFluids(); - if (ticks >= 12 && !flagActiveFaucet) + if (ticks >= 12)// && !flagActiveFaucet) { if (recentlyFilledDelay != 0) recentlyFilledDelay--; @@ -85,14 +85,14 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler if(player.isSneaking()) { - if(mode == null || mode == CastingChannelMode.SINGLEDRAIN) - mode = CastingChannelMode.CONTINUEDRAIN; - else - mode = CastingChannelMode.SINGLEDRAIN; + if(mode == null || mode == CastingChannelMode.SINGLEDRAIN) + mode = CastingChannelMode.CONTINUEDRAIN; + else + mode = CastingChannelMode.SINGLEDRAIN; - String s = "Casting Channel Mode "+(worldObj.isRemote?"client side: ":"server side: "); - player.addChatMessage(s+mode.toString()); - return; + String s = "Casting Channel Mode "+(worldObj.isRemote?"client side: ":"server side: "); + player.addChatMessage(s+mode.toString()); + return; } */ @@ -168,7 +168,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler } } - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); } private void distributeFluids () @@ -185,7 +185,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler if (connected.contains(lastProvider)) connected.remove(lastProvider); - int output = Math.min(internalTank.getFluidAmount(), 12); + int output = Math.min(internalTank.getFluidAmount(), outputMax); int connectedAmount = connected.size(); if (connectedAmount < 1) connectedAmount = 1; @@ -218,7 +218,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler debugLog.add("Internal Tank now contains: "+internalTank.getFluidAmount()+"mb"); debugLog.add("SubTank now contains: "+subTanks.get(dirOut).getFluidAmount()+"mb"); */ - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); } /* DEBUG if(printDebugLog) @@ -237,7 +237,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler /* DEBUG debugLog.add("Importing from "+lastProvider+"ern SubTank"); */ - FluidStack tempFS = new FluidStack(inputTank.getFluid().getFluid(), Math.min(inputTank.getFluidAmount(), 12)); + FluidStack tempFS = new FluidStack(inputTank.getFluid().getFluid(), Math.min(inputTank.getFluidAmount(), outputMax)); int fit = internalTank.fill(tempFS, false); /* DEBUG debugLog.add("Internal Tank will accept "+fit+"mb"); @@ -256,8 +256,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler debugLog.add("Internal Tank now contains: "+internalTank.getFluidAmount()+"mb"); debugLog.add("SubTank now contains: "+inputTank.getFluidAmount()+"mb"); */ - - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); } /* DEBUG if(printDebugLog) @@ -281,7 +280,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler connected.remove(lastProvider); if (connected.containsKey(ForgeDirection.DOWN) && this.internalTank.getFluid() != null) // Prioritizes FluidHandlers below { - int output = Math.min(internalTank.getFluid().amount, 12); + int output = Math.min(internalTank.getFluid().amount, outputMax); FluidStack tempFS = new FluidStack(internalTank.getFluid().getFluid(), output); int fittingBelow = ((IFluidHandler) connected.get(ForgeDirection.DOWN)).fill(ForgeDirection.UP, tempFS, false); if (fittingBelow > 0) @@ -300,7 +299,7 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler /* DEBUG debugLog.add("Exporting from "+dir+"ern SubTank"); */ - FluidStack tempFS = new FluidStack(subTanks.get(dir).getFluid().getFluid(), Math.min(subTanks.get(dir).getFluidAmount(), 12)); + FluidStack tempFS = new FluidStack(subTanks.get(dir).getFluid().getFluid(), Math.min(subTanks.get(dir).getFluidAmount(), outputMax)); int fit = ((IFluidHandler) connected.get(dir)).fill(dir.getOpposite(), tempFS, false); /* DEBUG debugLog.add("New Channel will accept "+fit+"mb"); @@ -347,6 +346,11 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler return 0.5f; } + private void markDirtyForRendering() + { + this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + } + public HashMap getOutputs () { HashMap map = new HashMap(); @@ -368,10 +372,10 @@ public class CastingChannelLogic extends TileEntity implements IFluidHandler { if (doFill) { - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); + markDirtyForRendering(); this.lastProvider = from; - if (this.internalTank.getFluid() == null) - this.recentlyFilledDelay = 2; + //if (this.internalTank.getFluid() == null) + //this.recentlyFilledDelay = 2; } if (from == ForgeDirection.UP) diff --git a/src/main/java/tconstruct/smeltery/logic/LavaTankLogic.java b/src/main/java/tconstruct/smeltery/logic/LavaTankLogic.java index 2d885dc1..990b97d5 100644 --- a/src/main/java/tconstruct/smeltery/logic/LavaTankLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/LavaTankLogic.java @@ -183,4 +183,9 @@ public class LavaTankLogic extends MultiServantLogic implements IFluidHandler worldObj.func_147479_m(xCoord, yCoord, zCoord); } } + + public int comparatorStrength() + { + return 15 * tank.getFluidAmount() / tank.getCapacity(); + } } \ No newline at end of file diff --git a/src/main/java/tconstruct/smeltery/logic/SmelteryDrainLogic.java b/src/main/java/tconstruct/smeltery/logic/SmelteryDrainLogic.java index 91b71af2..0e75836d 100644 --- a/src/main/java/tconstruct/smeltery/logic/SmelteryDrainLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/SmelteryDrainLogic.java @@ -2,6 +2,7 @@ package tconstruct.smeltery.logic; import mantle.blocks.abstracts.MultiServantLogic; import mantle.blocks.iface.IFacingLogic; +import mantle.world.CoordTuple; import net.minecraft.entity.EntityLivingBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -185,4 +186,11 @@ public class SmelteryDrainLogic extends MultiServantLogic implements IFluidHandl readFromNBT(packet.func_148857_g()); worldObj.func_147479_m(xCoord, yCoord, zCoord); } + + public int comparatorStrength() + { + CoordTuple master = this.getMasterPosition(); + SmelteryLogic smeltery = (SmelteryLogic) worldObj.getTileEntity(master.x, master.y, master.z); + return 15 * smeltery.currentLiquid / smeltery.maxLiquid; + } } \ No newline at end of file diff --git a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java index 650f8ba6..be4f55b9 100644 --- a/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java +++ b/src/main/java/tconstruct/smeltery/logic/SmelteryLogic.java @@ -307,6 +307,9 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci void detectEntities () { + if(centerPos == null) + return; + AxisAlignedBB box = AxisAlignedBB.getBoundingBox(centerPos.x, centerPos.y, centerPos.z, centerPos.x + 1.0D, centerPos.y + 1.0D, centerPos.z + 1.0D).expand(1.0D, 0.0D, 1.0D); List list = worldObj.getEntitiesWithinAABB(Entity.class, box); diff --git a/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java b/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java index aace4fa4..37fb78fe 100644 --- a/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java +++ b/src/main/java/tconstruct/smeltery/model/BlockRenderCastingChannel.java @@ -148,7 +148,7 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler { float liquidAmount = (float) tankMain.fluid.amount / (float) tankMain.capacity * 0.125f; double startY = tile.tankBelow(); - renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.5 + liquidAmount, 0.625D); //Center + renderer.setRenderBounds(0.375D, startY, 0.375D, 0.625D, 0.51 + liquidAmount, 0.625D); //Center renderLiquidPart(world, x, y, z, block, renderer, tankMain.fluid, false); } for (ForgeDirection dir : outputs) @@ -160,8 +160,8 @@ public class BlockRenderCastingChannel implements ISimpleBlockRenderingHandler if (tankSub == null || tankSub.fluid == null) break; float liquidAmount = (float) tankSub.fluid.amount / (float) tankSub.capacity * 0.125f / 2; - renderer.setRenderBounds(bounds[0], 0.5, bounds[1], bounds[2], 0.5 + liquidAmount, bounds[3]); - renderLiquidPart(world, x, y, z, block, renderer, tankSub.fluid, true); + renderer.setRenderBounds(bounds[0], 0.51, bounds[1], bounds[2], 0.5 + liquidAmount, bounds[3]); + renderLiquidPart(world, x, y, z, block, renderer, tankSub.fluid, false); } } return true; diff --git a/src/main/java/tconstruct/tools/ToolProxyClient.java b/src/main/java/tconstruct/tools/ToolProxyClient.java index 6932aafd..21151481 100644 --- a/src/main/java/tconstruct/tools/ToolProxyClient.java +++ b/src/main/java/tconstruct/tools/ToolProxyClient.java @@ -79,8 +79,9 @@ public class ToolProxyClient extends ToolProxyCommon RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRenderCustom()); RenderingRegistry.registerEntityRenderingHandler(FancyEntityItem.class, new FancyItemRender()); - MinecraftForgeClient.registerItemRenderer(TinkerTools.shortbow, new CustomBowRenderer()); - ToolCoreRenderer renderer = new ToolCoreRenderer(); + //MinecraftForgeClient.registerItemRenderer(TinkerTools.shortbow, new CustomBowRenderer()); + MinecraftForgeClient.registerItemRenderer(TinkerTools.shortbow, new ToolCoreRenderer(false)); + ToolCoreRenderer renderer = new ToolCoreRenderer(true); MinecraftForgeClient.registerItemRenderer(TinkerTools.arrow, renderer); MinecraftForgeClient.registerItemRenderer(TinkerTools.dagger, renderer); } diff --git a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java index 27760f2d..ce2fefcd 100644 --- a/src/main/java/tconstruct/tools/gui/CraftingStationGui.java +++ b/src/main/java/tconstruct/tools/gui/CraftingStationGui.java @@ -17,6 +17,7 @@ import net.minecraft.world.World; import org.lwjgl.opengl.GL11; import tconstruct.library.armor.ArmorCore; +import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.HarvestTool; import tconstruct.library.tools.ToolCore; import tconstruct.tools.logic.CraftingStationLogic; @@ -315,30 +316,9 @@ public class CraftingStationGui extends GuiContainer } else if (categories.contains("harvest")) { - float mineSpeed = tags.getInteger("MiningSpeed"); - int heads = 1; + float trueSpeed = AbilityHelper.calcToolSpeed(tool, tags); + float stoneboundSpeed = AbilityHelper.calcToolSpeed(tool, tags); - if (tags.hasKey("MiningSpeed2")) - { - mineSpeed += tags.getInteger("MiningSpeed2"); - heads++; - } - - if (tags.hasKey("MiningSpeedHandle")) - { - mineSpeed += tags.getInteger("MiningSpeedHandle"); - heads++; - } - - if (tags.hasKey("MiningSpeedExtra")) - { - mineSpeed += tags.getInteger("MiningSpeedExtra"); - heads++; - } - - float trueSpeed = mineSpeed / (heads * 100f) * ((HarvestTool) tool).breakSpeedModifier(); - - float stoneboundSpeed = (float) Math.log(durability / ((HarvestTool) tool).stoneboundModifier() + 1) * 2 * stonebound; DecimalFormat df = new DecimalFormat("##.##"); df.setRoundingMode(RoundingMode.DOWN); trueSpeed += stoneboundSpeed; @@ -346,7 +326,7 @@ public class CraftingStationGui extends GuiContainer trueSpeed = 0; fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation14") + df.format(trueSpeed), offsetX + 8, base + offset * 10, 0xffffff); offset++; - if (stoneboundSpeed != 0) + if (stoneboundSpeed != 0 && !Float.isNaN(stoneboundSpeed)) { String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5"); fontRendererObj.drawString(bloss + df.format(stoneboundSpeed), xSize + 8, base + offset * 10, 0xffffff); diff --git a/src/main/java/tconstruct/tools/gui/ToolStationGui.java b/src/main/java/tconstruct/tools/gui/ToolStationGui.java index 681c1998..c4908322 100644 --- a/src/main/java/tconstruct/tools/gui/ToolStationGui.java +++ b/src/main/java/tconstruct/tools/gui/ToolStationGui.java @@ -21,6 +21,7 @@ import org.lwjgl.opengl.GL11; import tconstruct.TConstruct; import tconstruct.library.client.TConstructClientRegistry; import tconstruct.library.client.ToolGuiElement; +import tconstruct.library.tools.AbilityHelper; import tconstruct.library.tools.HarvestTool; import tconstruct.library.tools.ToolCore; import tconstruct.library.util.HarvestLevels; @@ -324,30 +325,9 @@ public class ToolStationGui extends GuiContainer } else if (categories.contains("harvest")) { - float mineSpeed = tags.getInteger("MiningSpeed"); - int heads = 1; + float trueSpeed = AbilityHelper.calcToolSpeed(tool, tags); + float stoneboundSpeed = AbilityHelper.calcToolSpeed(tool, tags); - if (tags.hasKey("MiningSpeed2")) - { - mineSpeed += tags.getInteger("MiningSpeed2"); - heads++; - } - - if (tags.hasKey("MiningSpeedHandle")) - { - mineSpeed += tags.getInteger("MiningSpeedHandle"); - heads++; - } - - if (tags.hasKey("MiningSpeedExtra")) - { - mineSpeed += tags.getInteger("MiningSpeedExtra"); - heads++; - } - - float trueSpeed = mineSpeed / (heads * 100f) * ((HarvestTool) tool).breakSpeedModifier(); - - float stoneboundSpeed = (float) Math.log(durability / ((HarvestTool) tool).stoneboundModifier() + 1) * 2 * stonebound; DecimalFormat df = new DecimalFormat("##.##"); df.setRoundingMode(RoundingMode.DOWN); trueSpeed += stoneboundSpeed; @@ -355,7 +335,7 @@ public class ToolStationGui extends GuiContainer trueSpeed = 0; fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation14") + df.format(trueSpeed), 294, base + offset * 10, 0xffffff); offset++; - if (stoneboundSpeed != 0) + if (stoneboundSpeed != 0 && !Float.isNaN(stoneboundSpeed)) { String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5"); fontRendererObj.drawString(bloss + df.format(stoneboundSpeed), 294, base + offset * 10, 0xffffff); diff --git a/src/main/java/tconstruct/util/config/PHConstruct.java b/src/main/java/tconstruct/util/config/PHConstruct.java index 0148080a..314b2e1f 100644 --- a/src/main/java/tconstruct/util/config/PHConstruct.java +++ b/src/main/java/tconstruct/util/config/PHConstruct.java @@ -66,6 +66,8 @@ public class PHConstruct denyMattock = config.get("Difficulty Changes", "Deny creation of non-metal mattocks", false).getBoolean(false); craftEndstone = config.get("Difficulty Changes", "Allow creation of endstone", true).getBoolean(true); + naturalSlimeSpawn = config.get("Mobs", "Blue Slime spawn chance", 1, "Set to 0 to disable").getInt(1); + ingotsPerOre = config.get("Smeltery Output Modification", "Ingots per ore", 2, "Number of ingots returned from smelting ores in the smeltery").getDouble(2); ingotsBronzeAlloy = config.get("Smeltery Output Modification", "Bronze ingot return", 4, "Number of ingots returned from smelting Bronze in the smeltery").getDouble(4); ingotsAluminumBrassAlloy = config.get("Smeltery Output Modification", "Aluminum Brass ingot return", 4, "Number of ingots returned from smelting Aluminum Brass in the smeltery").getDouble(4); @@ -154,6 +156,7 @@ public class PHConstruct aluminumBushMaxY = config.get("Worldgen", "Aluminum Bush Max Y", 60).getInt(60); seaLevel = config.get("general", "Sea level", 64).getInt(64); + tconComesFirst = config.get("general", "Always cast TConstruct ingots", true, "You will always get a TConstruct item from casting an ingot or block.").getBoolean(); enableHealthRegen = config.get("Ultra Hardcore Changes", "Passive Health Regen", true).getBoolean(true); goldAppleRecipe = config.get("Ultra Hardcore Changes", "Change Crafting Recipes", false, "Makes recipes for gold apples, carrots, and melon potions more expensive").getBoolean(false); @@ -272,8 +275,10 @@ public class PHConstruct public static int aluminumBushMaxY; public static int seaLevel; + public static boolean tconComesFirst; // Mobs + public static int naturalSlimeSpawn; // Difficulty modifiers public static boolean keepHunger; diff --git a/src/main/java/tconstruct/world/TinkerWorld.java b/src/main/java/tconstruct/world/TinkerWorld.java index 1a4285c9..fd535e3e 100644 --- a/src/main/java/tconstruct/world/TinkerWorld.java +++ b/src/main/java/tconstruct/world/TinkerWorld.java @@ -9,6 +9,7 @@ import net.minecraft.block.Block.SoundType; import net.minecraft.block.BlockDispenser; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EnumCreatureType; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -16,6 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.potion.Potion; import net.minecraft.util.WeightedRandomChestContent; +import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fluids.Fluid; @@ -51,6 +53,7 @@ import tconstruct.tools.entity.FancyEntityItem; import tconstruct.tools.entity.LaunchedPotion; import tconstruct.tools.itemblocks.MultiBrickFancyItem; import tconstruct.tools.itemblocks.MultiBrickItem; +import tconstruct.util.config.PHConstruct; import tconstruct.world.blocks.ConveyorBase; import tconstruct.world.blocks.GravelOre; import tconstruct.world.blocks.MeatBlock; @@ -308,8 +311,7 @@ public class TinkerWorld } - public void createEntities () - { + public void createEntities () { EntityRegistry.registerModEntity(FancyEntityItem.class, "Fancy Item", 0, TConstruct.instance, 32, 5, true); EntityRegistry.registerModEntity(DaggerEntity.class, "Dagger", 1, TConstruct.instance, 32, 5, true); EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 3, true); @@ -321,6 +323,16 @@ public class TinkerWorld EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true); // EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, // TConstruct.instance, 64, 5, true); + + if (PHConstruct.naturalSlimeSpawn > 0) { + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.FOREST)); + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.PLAINS)); + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.MOUNTAIN)); + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.HILLS)); + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.SWAMP)); + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.JUNGLE)); + EntityRegistry.addSpawn(BlueSlime.class, PHConstruct.naturalSlimeSpawn, 4, 20, EnumCreatureType.monster, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.WASTELAND)); + } } private void craftingTableRecipes() diff --git a/src/main/java/tconstruct/world/entity/BlueSlime.java b/src/main/java/tconstruct/world/entity/BlueSlime.java index 9075dd52..6827e24c 100644 --- a/src/main/java/tconstruct/world/entity/BlueSlime.java +++ b/src/main/java/tconstruct/world/entity/BlueSlime.java @@ -39,7 +39,11 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData public BlueSlime(World world) { super(world); - // this.texture = "/mods/tinker/textures/mob/slimeedible.png"; + initializeSlime(); + } + + protected void initializeSlime () + { int offset = this.rand.nextInt(299); if (offset < 149) offset = 1; @@ -52,7 +56,6 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData this.slimeJumpDelay = this.rand.nextInt(120) + 40; this.setSlimeSize(size); this.jumpMovementFactor = 0.004F * size + 0.01F; - this.setHealth(getMaxHealthForSize()); } protected void damageEntity (DamageSource damageSource, int damage) @@ -186,6 +189,28 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData int y = MathHelper.floor_double(this.boundingBox.minY); int z = MathHelper.floor_double(this.posZ); + if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, x, y, z) > this.rand.nextInt(32)) + { + return false; + } + else + { + int light = this.worldObj.getBlockLightValue(x, y, z); + + if (this.worldObj.isThundering()) + { + int i1 = this.worldObj.skylightSubtracted; + this.worldObj.skylightSubtracted = 10; + light = this.worldObj.getBlockLightValue(x, y, z); + this.worldObj.skylightSubtracted = i1; + } + + return light <= this.rand.nextInt(8); + } + /*int x = MathHelper.floor_double(this.posX); + int y = MathHelper.floor_double(this.boundingBox.minY); + int z = MathHelper.floor_double(this.posZ); + if (y < 60 && rand.nextInt(5) != 0) { return false; @@ -208,7 +233,7 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData } return light <= this.rand.nextInt(8); - } + }*/ } @Override @@ -223,8 +248,8 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData this.dataWatcher.updateObject(16, new Byte((byte) size)); this.setSize(0.6F * (float) size, 0.6F * (float) size); this.setPosition(this.posX, this.posY, this.posZ); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealth()); - this.setHealth(this.getMaxHealth()); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.getMaxHealthForSize()); + this.setHealth(this.getMaxHealthForSize()); this.experienceValue = size + 2 ^ (size); if (size >= 8) @@ -334,7 +359,8 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData protected void updateEntityActionState () { // Minecraft.getMinecraft().getLogAgent().logInfo("Collided with "+entity.getEntityName()); - this.despawnEntity(); + if (this.getSlimeSize() < 8) + this.despawnEntity(); EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D); if (entityplayer != null) @@ -450,13 +476,13 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData { ToolCore tool = getValidTool(); - Item accessory = tool.getAccessoryItem(); - ItemStack accessoryStack = accessory != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null; - ItemStack toolStack = ToolBuilder.instance.buildTool(new ItemStack(tool.getHeadItem(), 1, 17), new ItemStack(tool.getHandleItem(), 1, 17), accessoryStack, + ItemStack accessoryStack = tool.getAccessoryItem() != null ? new ItemStack(tool.getAccessoryItem(), 1, 17) : null; + ItemStack extraStack = tool.getExtraItem() != null ? new ItemStack(tool.getExtraItem(), 1, 17) : null; + ItemStack toolStack = ToolBuilder.instance.buildTool(new ItemStack(tool.getHeadItem(), 1, 17), new ItemStack(tool.getHandleItem(), 1, 17), accessoryStack, extraStack, "King Slime " + tool.getToolName()); NBTTagCompound tags = toolStack.getTagCompound().getCompoundTag("InfiTool"); - tags.setInteger("Attack", 3 + tool.getDamageVsEntity(null)); + tags.setInteger("Attack", 5 + tool.getDamageVsEntity(null)); tags.setInteger("TotalDurability", 2500); tags.setInteger("BaseDurability", 2500); tags.setInteger("MiningSpeed", 1400); @@ -473,8 +499,8 @@ public class BlueSlime extends EntityLiving implements IMob, IBossDisplayData ToolCore getValidTool () { ToolCore tool = TConstructRegistry.tools.get(rand.nextInt(TConstructRegistry.tools.size())); - if (tool.getAccessoryItem() != null) - tool = getValidTool(); + /*if (tool.getExtraItem() != null) + tool = getValidTool();*/ return tool; }