diff options
author | Blood-Asp <bloodasphendrik@gmail.com> | 2015-12-25 14:37:56 +0100 |
---|---|---|
committer | Blood-Asp <bloodasphendrik@gmail.com> | 2015-12-25 14:37:56 +0100 |
commit | 68a19fd70c37ae4554d1dc834196ac6e9b6517c7 (patch) | |
tree | 19da5f9245b4a6417779aa5e63309e2e95ec715f /src/main/java/gregtech/api/items | |
parent | a448be8d4a118b85a64e68f53309c4ea38893b91 (diff) | |
download | GT5-Unofficial-68a19fd70c37ae4554d1dc834196ac6e9b6517c7.tar.gz GT5-Unofficial-68a19fd70c37ae4554d1dc834196ac6e9b6517c7.tar.bz2 GT5-Unofficial-68a19fd70c37ae4554d1dc834196ac6e9b6517c7.zip |
Overriding IC2 fuel rods
Diffstat (limited to 'src/main/java/gregtech/api/items')
-rw-r--r-- | src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java | 52 | ||||
-rw-r--r-- | src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java | 5 |
2 files changed, 44 insertions, 13 deletions
diff --git a/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java b/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java index 9be65b1586..2faf2d2456 100644 --- a/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java +++ b/src/main/java/gregtech/api/items/GT_RadioactiveCellIC_Item.java @@ -19,8 +19,10 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement public final float sEnergy; public final int sRadiation; public final float sHeat; + public final ItemStack sDepleted; + public final boolean sMox; - public GT_RadioactiveCellIC_Item(String aUnlocalized, String aEnglish, int aCellcount, int maxDamage, float aEnergy, int aRadiation, float aHeat) { + public GT_RadioactiveCellIC_Item(String aUnlocalized, String aEnglish, int aCellcount, int maxDamage, float aEnergy, int aRadiation, float aHeat, ItemStack aDepleted, boolean aMox) { super(aUnlocalized, aEnglish, aCellcount); setMaxStackSize(64); this.maxDmg = maxDamage; @@ -28,6 +30,8 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement this.sEnergy = aEnergy; this.sRadiation = aRadiation; this.sHeat = aHeat; + this.sDepleted = aDepleted; + this.sMox = aMox; } @@ -54,8 +58,12 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement } else { pulses += checkPulseable(reactor, x - 1, y, yourStack, x, y, heatrun) + checkPulseable(reactor, x + 1, y, yourStack, x, y, heatrun) + checkPulseable(reactor, x, y - 1, yourStack, x, y, heatrun) + checkPulseable(reactor, x, y + 1, yourStack, x, y, heatrun); - int heat = sumUp(pulses) * 4; +// int heat = sumUp(pulses) * 4; + int heat = triangularNumber(pulses) * 4; + + heat = getFinalHeat(reactor, yourStack, x, y, heat); + ArrayList<ItemStackCoord> heatAcceptors = new ArrayList(); checkHeatAcceptor(reactor, x - 1, y, heatAcceptors); checkHeatAcceptor(reactor, x + 1, y, heatAcceptors); @@ -76,20 +84,33 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement } } if (getDamageOfStack(yourStack) >= getMaxDamageEx() - 1) { - switch (this.numberOfCells) { - case 1: - reactor.setItemAt(x, y, ItemList.Depleted_Thorium_1.get(1, new Object[0])); - break; - case 2: - reactor.setItemAt(x, y, ItemList.Depleted_Thorium_2.get(1, new Object[0])); - break; - case 4: - reactor.setItemAt(x, y, ItemList.Depleted_Thorium_4.get(1, new Object[0])); - } +// switch (this.numberOfCells) { +// case 1: +// reactor.setItemAt(x, y, ItemList.Depleted_Thorium_1.get(1, new Object[0])); +// break; +// case 2: +// reactor.setItemAt(x, y, ItemList.Depleted_Thorium_2.get(1, new Object[0])); +// break; +// case 4: +// reactor.setItemAt(x, y, ItemList.Depleted_Thorium_4.get(1, new Object[0])); +// } + reactor.setItemAt(x, y, sDepleted.copy()); } else if (heatrun) { damageItemStack(yourStack, 1); } } + + protected int getFinalHeat(IReactor reactor, ItemStack stack, int x, int y, int heat) + { + if (sMox&&reactor.isFluidCooled()) + { + float breedereffectiveness = reactor.getHeat() / reactor.getMaxHeat(); + if (breedereffectiveness > 0.5D) { + heat *= 2; + } + } + return heat; + } private void checkHeatAcceptor(IReactor reactor, int x, int y, ArrayList<ItemStackCoord> heatAcceptors) { ItemStack thing = reactor.getItemAt(x, y); @@ -101,7 +122,12 @@ public class GT_RadioactiveCellIC_Item extends GT_RadioactiveCell_Item implement public boolean acceptUraniumPulse(IReactor reactor, ItemStack yourStack, ItemStack pulsingStack, int youX, int youY, int pulseX, int pulseY, boolean heatrun) { if (!heatrun) { - reactor.addOutput((float) (1.0F * this.sEnergy)); + if(sMox){ + float breedereffectiveness = reactor.getHeat() / reactor.getMaxHeat(); + float ReaktorOutput = 1.5F * breedereffectiveness + 1.0F; + reactor.addOutput(ReaktorOutput); + }else{ + reactor.addOutput((float) (1.0F * this.sEnergy));} } return true; } diff --git a/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java b/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java index 7ceaf43f2e..f2169085d6 100644 --- a/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java +++ b/src/main/java/gregtech/api/items/GT_RadioactiveCell_Item.java @@ -36,6 +36,11 @@ public class GT_RadioactiveCell_Item } return b; } + + protected static int triangularNumber(int x) + { + return (x * x + x) / 2; + } protected boolean outputPulseForStack(ItemStack aStack) { NBTTagCompound tNBT = aStack.getTagCompound(); |