mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +00:00
Merge pull request #724 from squeek502/1.7.10-merge-1.6.4
Merge some unmerged pull requests from 1.6.4 branch
This commit is contained in:
commit
1affd6d909
6 files changed
+86
-38
No files matched your search
@@ -26,20 +26,23 @@ public class ModRepair extends ItemModifier
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
if ((input[0] == null && input[1] == null))
|
||||
return false;
|
||||
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (tags.getInteger("Damage") > 0)
|
||||
{
|
||||
int headID = tags.getInteger("Head");
|
||||
if (input[0] != null && input[1] != null)
|
||||
return headID == PatternBuilder.instance.getPartID(input[0]) && headID == PatternBuilder.instance.getPartID(input[1]) && calculateIfNecessary(tool, input);
|
||||
else if (input[0] != null && input[1] == null)
|
||||
return headID == PatternBuilder.instance.getPartID(input[0]);
|
||||
else if (input[0] == null && input[1] != null)
|
||||
return headID == PatternBuilder.instance.getPartID(input[1]);
|
||||
|
||||
boolean areInputsValid = true;
|
||||
for (ItemStack curInput : input)
|
||||
{
|
||||
if (curInput != null && headID != PatternBuilder.instance.getPartID(curInput))
|
||||
{
|
||||
areInputsValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areInputsValid)
|
||||
{
|
||||
return calculateIfNecessary(tool, input);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -48,22 +51,31 @@ public class ModRepair extends ItemModifier
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
int damage = tags.getInteger("Damage");
|
||||
int valueSlot1 = 0;
|
||||
int valueSlot2 = 0;
|
||||
if (input[0] != null)
|
||||
valueSlot1 = calculateIncrease(tool, PatternBuilder.instance.getPartValue(input[0]));
|
||||
if (input[1] != null)
|
||||
valueSlot2 = calculateIncrease(tool, PatternBuilder.instance.getPartValue(input[1]));
|
||||
int numInputs = 0;
|
||||
int materialValue = 0;
|
||||
for (ItemStack curInput : input)
|
||||
{
|
||||
if (curInput != null)
|
||||
{
|
||||
materialValue += PatternBuilder.instance.getPartValue(curInput);
|
||||
numInputs++;
|
||||
}
|
||||
}
|
||||
if (numInputs == 0)
|
||||
return false;
|
||||
|
||||
return ((damage - valueSlot1) > 0) && ((damage - valueSlot2) > 0);
|
||||
int totalRepairValue = calculateIncrease(tool, materialValue, numInputs);
|
||||
float averageRepairValue = totalRepairValue / numInputs;
|
||||
|
||||
return numInputs == 1 || (damage - totalRepairValue >= -averageRepairValue);
|
||||
}
|
||||
|
||||
private int calculateIncrease (ItemStack tool, int materialValue)
|
||||
private int calculateIncrease (ItemStack tool, int materialValue, int itemsUsed)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag("InfiTool");
|
||||
int damage = tags.getInteger("Damage");
|
||||
int dur = tags.getInteger("BaseDurability");
|
||||
int increase = (int) (50 + (dur * 0.4f * materialValue));
|
||||
int increase = (int) (50 * itemsUsed + (dur * 0.4f * materialValue));
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
float mods = 1.0f;
|
||||
@@ -95,18 +107,16 @@ public class ModRepair extends ItemModifier
|
||||
int itemsUsed = 0;
|
||||
|
||||
int materialValue = 0;
|
||||
if (input[0] != null)
|
||||
for (ItemStack curInput : input)
|
||||
{
|
||||
materialValue += PatternBuilder.instance.getPartValue(input[0]);
|
||||
itemsUsed++;
|
||||
}
|
||||
if (input[1] != null)
|
||||
{
|
||||
materialValue += PatternBuilder.instance.getPartValue(input[1]);
|
||||
itemsUsed++;
|
||||
if (curInput != null)
|
||||
{
|
||||
materialValue += PatternBuilder.instance.getPartValue(curInput);
|
||||
itemsUsed++;
|
||||
}
|
||||
}
|
||||
|
||||
int increase = calculateIncrease(tool, materialValue);
|
||||
int increase = calculateIncrease(tool, materialValue, itemsUsed);
|
||||
int repair = tags.getInteger("RepairCount");
|
||||
repair += itemsUsed;
|
||||
tags.setInteger("RepairCount", repair);
|
||||
|
||||
@@ -320,9 +320,10 @@ public class SearedBlock extends InventoryBlock
|
||||
}
|
||||
else
|
||||
{
|
||||
FaucetLogic logic = (FaucetLogic) world.getTileEntity(x, y, z);
|
||||
if (logic != null)
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof FaucetLogic)
|
||||
{
|
||||
FaucetLogic logic = (FaucetLogic) tile;
|
||||
float xMin = 0.25F;
|
||||
float xMax = 0.75F;
|
||||
float zMin = 0.25F;
|
||||
|
||||
@@ -136,7 +136,7 @@ public class CraftingStationGui extends GuiContainer
|
||||
// Attack
|
||||
if (categories.contains("weapon"))
|
||||
{
|
||||
int attack = (int) (tags.getInteger("Attack"));
|
||||
int attack = (int) (tags.getInteger("Attack"))+1;
|
||||
float stoneboundDamage = (float) Math.log(durability / 72f + 1) * -2 * stonebound;
|
||||
attack += stoneboundDamage;
|
||||
attack *= tool.getDamageModifier();
|
||||
@@ -152,9 +152,10 @@ public class CraftingStationGui extends GuiContainer
|
||||
|
||||
if (stoneboundDamage != 0)
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
heart = stoneboundDamage == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
String bloss = stoneboundDamage > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
this.fontRendererObj.drawString(bloss + (int) stoneboundDamage / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
this.fontRendererObj.drawString(bloss + df.format(stoneboundDamage / 2f) + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
offset++;
|
||||
@@ -217,11 +218,11 @@ public class CraftingStationGui extends GuiContainer
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
|
||||
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f;
|
||||
float stoneboundSpeed = (float) Math.log(durability / 90f + 1) * 2 * stonebound;
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
float trueSpeed = mineSpeed + stoneboundSpeed;
|
||||
float trueSpeed2 = mineSpeed + stoneboundSpeed;
|
||||
float trueSpeed2 = mineSpeed2 + stoneboundSpeed;
|
||||
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation12"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
@@ -266,7 +267,7 @@ public class CraftingStationGui extends GuiContainer
|
||||
|
||||
float trueSpeed = mineSpeed / (heads * 100f);
|
||||
|
||||
float stoneboundSpeed = (float) Math.log(durability / 90f + 1) * 2 * stonebound;
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
trueSpeed += stoneboundSpeed;
|
||||
|
||||
@@ -231,9 +231,10 @@ public class ToolStationGui extends GuiContainer
|
||||
|
||||
if (stoneboundDamage != 0)
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
heart = stoneboundDamage == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
String bloss = stoneboundDamage > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
this.fontRendererObj.drawString(bloss + (int) stoneboundDamage / 2 + heart, 294, base + offset * 10, 0xffffff);
|
||||
this.fontRendererObj.drawString(bloss + df.format(stoneboundDamage / 2f) + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
offset++;
|
||||
@@ -300,7 +301,7 @@ public class ToolStationGui extends GuiContainer
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
float trueSpeed = mineSpeed + stoneboundSpeed;
|
||||
float trueSpeed2 = mineSpeed + stoneboundSpeed;
|
||||
float trueSpeed2 = mineSpeed2 + stoneboundSpeed;
|
||||
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation12"), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
@@ -35,7 +36,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
* 3-16: Chest
|
||||
*/
|
||||
|
||||
public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacingLogic
|
||||
public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacingLogic, ISidedInventory
|
||||
{
|
||||
boolean active;
|
||||
public int fuel;
|
||||
@@ -43,6 +44,9 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
|
||||
public int progress;
|
||||
public int fuelScale = 200;
|
||||
byte direction;
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_bottom = new int[] {2, 1};
|
||||
private static final int[] slots_sides = new int[] {1};
|
||||
|
||||
public FurnaceLogic()
|
||||
{
|
||||
@@ -373,4 +377,33 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
|
||||
public void closeInventory ()
|
||||
{
|
||||
}
|
||||
|
||||
public static boolean isItemFuel(ItemStack par0ItemStack)
|
||||
{
|
||||
return getItemBurnTime(par0ItemStack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
return par1 == 2 ? false : (par1 == 1 ? isItemFuel(par2ItemStack) : true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int par1)
|
||||
{
|
||||
return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_sides);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3)
|
||||
{
|
||||
return this.isItemValidForSlot(par1, par2ItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3)
|
||||
{
|
||||
return par3 != 0 || par1 != 1 || par2ItemStack.getItem() == Items.bucket;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user