From 92b95b9ff059fa4b7d4fff0f91f3d01436cbcb86 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Tue, 9 Jun 2015 13:29:17 +0100 Subject: [PATCH] added some fixes, added documentation --- .../techreborn/api/recipe/RecipeCrafter.java | 7 +++++-- .../techreborn/api/upgrade/UpgradeHandler.java | 2 ++ .../java/techreborn/items/ItemUpgrade.java | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/java/techreborn/api/recipe/RecipeCrafter.java b/src/main/java/techreborn/api/recipe/RecipeCrafter.java index 9b006c8bc..1af0c1204 100644 --- a/src/main/java/techreborn/api/recipe/RecipeCrafter.java +++ b/src/main/java/techreborn/api/recipe/RecipeCrafter.java @@ -282,8 +282,11 @@ public class RecipeCrafter { } public void addSpeedMulti(double amount){ - if(speedMultiplier + amount >= 0.99) - speedMultiplier += amount; + if(speedMultiplier + amount <= 0.99){ + speedMultiplier += amount; + } else { + speedMultiplier = 0.99; + } } public void resetSpeedMulti(){ diff --git a/src/main/java/techreborn/api/upgrade/UpgradeHandler.java b/src/main/java/techreborn/api/upgrade/UpgradeHandler.java index f70f37c8e..fd1623d12 100644 --- a/src/main/java/techreborn/api/upgrade/UpgradeHandler.java +++ b/src/main/java/techreborn/api/upgrade/UpgradeHandler.java @@ -33,5 +33,7 @@ public class UpgradeHandler { ((IMachineUpgrade) stack.getItem()).processUpgrade(crafter, stack); } } + if(crafter.currentRecipe != null) + crafter.currentNeededTicks = (int)(crafter.currentRecipe.tickTime() * (1.0 - crafter.getSpeedMultiplier())); } } diff --git a/src/main/java/techreborn/items/ItemUpgrade.java b/src/main/java/techreborn/items/ItemUpgrade.java index a6a88258e..7cbe42a52 100644 --- a/src/main/java/techreborn/items/ItemUpgrade.java +++ b/src/main/java/techreborn/items/ItemUpgrade.java @@ -30,7 +30,7 @@ public class ItemUpgrade extends ItemTR implements IMachineUpgrade { } public static final String[] types = new String[] - {"20xSpeed", "20xPower"}; + {"0.2Speed", "0.2Power", "0.5Speed"}; private IIcon[] textures; @@ -38,6 +38,7 @@ public class ItemUpgrade extends ItemTR implements IMachineUpgrade { setUnlocalizedName("techreborn.upgrade"); setHasSubtypes(true); setCreativeTab(TechRebornCreativeTabMisc.instance); + setMaxStackSize(1); } @Override @@ -81,12 +82,19 @@ public class ItemUpgrade extends ItemTR implements IMachineUpgrade { @Override public void processUpgrade(RecipeCrafter crafter, ItemStack stack) { - if(stack.getItemDamage() == 0){ - crafter.addSpeedMulti(0.2); - crafter.addPowerMulti(0.5); + //Remember the max speed multiplier can only be 0.99!! + + if(stack.getItemDamage() == 0){//Check the meta data here + crafter.addSpeedMulti(0.2);//This will set the speed multiplier to 0.8 + crafter.addPowerMulti(0.5);//This will use eu/tick x 1.5 + //crafter.addPowerMulti(2); This will use twice the amount of power. } if(stack.getItemDamage() == 1){ - crafter.addPowerMulti(-0.2); + crafter.addPowerMulti(-0.2);//This will use eu/tick 0.8 + } + if(stack.getItemDamage() == 2){ + crafter.addSpeedMulti(0.5); + crafter.addPowerMulti(1); } } } \ No newline at end of file