diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-07-16 12:57:19 +0200 |
---|---|---|
committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-07-16 12:57:40 +0200 |
commit | 9a65150aaab8c3fdec2e173946a5836ad7a63135 (patch) | |
tree | f5dca318f9b6a606a910878803e9a37115c791c5 /src/main | |
parent | f70471bab9f21d9073aa184c23a10b3d04d604dd (diff) | |
download | GT5-Unofficial-9a65150aaab8c3fdec2e173946a5836ad7a63135.tar.gz GT5-Unofficial-9a65150aaab8c3fdec2e173946a5836ad7a63135.tar.bz2 GT5-Unofficial-9a65150aaab8c3fdec2e173946a5836ad7a63135.zip |
added GT++ compat, fixed bugs, improved code
+added qualifiers to a lot of stuff,
+wrote a GT++ compat for the radio hatch
+fixed a typo in he bacterial vat description
+made the bio vat loose his output when sv arent delivered though the whole process
+hopefully fixed the stackoverflow for ores
+buffed output on siftable ores
+made my werkstoffsystem work with the biovat
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: 1f414f3ebc7b214f85c89e1cd597910d4dfec2f1
Diffstat (limited to 'src/main')
19 files changed, 560 insertions, 63 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_HeatedWaterPump.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_HeatedWaterPump.java index c252d5f935..44dc931a23 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_HeatedWaterPump.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_HeatedWaterPump.java @@ -35,20 +35,20 @@ public class BW_GUIContainer_HeatedWaterPump extends GuiContainer { public BW_GUIContainer_HeatedWaterPump(Container p_i1072_1_) { super(p_i1072_1_); - container = (BW_Container_HeatedWaterPump) p_i1072_1_; + this.container = (BW_Container_HeatedWaterPump) p_i1072_1_; } @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(furnaceGuiTextures); + this.mc.getTextureManager().bindTexture(BW_GUIContainer_HeatedWaterPump.furnaceGuiTextures); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); // this.drawString(this.fontRendererObj, "Fuel:" + container.fuel + " Water:" + container.water, k, l, 0xffffff); if (this.container.fuel > 0) { - this.mc.getTextureManager().bindTexture(furnaceGuiTextures); + this.mc.getTextureManager().bindTexture(BW_GUIContainer_HeatedWaterPump.furnaceGuiTextures); int ik = this.container.maxfuel > 200 ? this.container.maxfuel : 200; int i1 = ((this.container.fuel * 13) / ik); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 13 - i1, 14, i1 + 1); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java index bdffce07ee..788bcb379a 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/BW_GUIContainer_RadLevel.java @@ -26,6 +26,7 @@ import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.server.container.BW_Container_RadioHatch; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Container; import net.minecraft.util.ResourceLocation; @@ -37,7 +38,7 @@ public class BW_GUIContainer_RadLevel extends GuiContainer { public BW_GUIContainer_RadLevel(Container p_i1072_1_) { super(p_i1072_1_); - container = (BW_Container_RadioHatch) p_i1072_1_; + this.container = (BW_Container_RadioHatch) p_i1072_1_; } @@ -45,16 +46,16 @@ public class BW_GUIContainer_RadLevel extends GuiContainer { protected void drawGuiContainerBackgroundLayer(float f, int x, int y) { GL11.glColor3f(1, 1, 1); this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID, "textures/GUI/GUI_RSC.png")); - drawTexturedModalRect(guiLeft - 79, guiTop, 0, 0, 256, 165); + this.drawTexturedModalRect(this.guiLeft - 79, this.guiTop, 0, 0, 256, 165); } @Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - int y = 51 + (container.coverage / 2 - 3); + int y = 51 + (this.container.coverage / 2 - 3); int x = -63; - if (container.coverage != 100 && container.coverage != 0) - drawRect(x, y, x + 51, y + 1, 0xFF60D82E); - drawRect(x, 48, x + 51, y, 0xFF8B8B8B); - this.fontRendererObj.drawString(Byte.toString(container.coverage), 88 - 79, 50, 16448255); + if (this.container.coverage != 100 && this.container.coverage != 0) + Gui.drawRect(x, y, x + 51, y + 1, 0xFF60D82E); + Gui.drawRect(x, 48, x + 51, y, 0xFF8B8B8B); + this.fontRendererObj.drawString(Byte.toString(this.container.coverage), 88 - 79, 50, 16448255); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_CircuitProgrammer.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_CircuitProgrammer.java index 34574929db..8f31fc31db 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_CircuitProgrammer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_CircuitProgrammer.java @@ -44,7 +44,7 @@ public class GT_GUIContainer_CircuitProgrammer extends GuiContainer { @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1F, 1F, 1F, 1F); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - drawTexturedModalRect(guiLeft - 79, guiTop, 0, 0, 256, 165); + Minecraft.getMinecraft().getTextureManager().bindTexture(GT_GUIContainer_CircuitProgrammer.texture); + this.drawTexturedModalRect(this.guiLeft - 79, this.guiTop, 0, 0, 256, 165); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java index c1998f4bfe..e672eebe94 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_Destructopack.java @@ -43,8 +43,8 @@ public class GT_GUIContainer_Destructopack extends GuiContainer { @Override public void drawGuiContainerBackgroundLayer(float f, int j, int i) { GL11.glColor4f(1F, 1F, 1F, 1F); - Minecraft.getMinecraft().getTextureManager().bindTexture(texture); - drawTexturedModalRect(guiLeft, guiTop, 0, 0, 175, 165); + Minecraft.getMinecraft().getTextureManager().bindTexture(GT_GUIContainer_Destructopack.texture); + this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 175, 165); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java index 336c9fab92..540f597051 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_LESU.java @@ -46,9 +46,9 @@ public class GT_GUIContainer_LESU extends GT_GUIContainer { private GT_TileEntity_LESU c; public GT_GUIContainer_LESU(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { - super(new GT_Container_LESU(aInventoryPlayer, aTileEntity), texture.getResourceDomain()); - mContainer = ((GT_Container_LESU) this.inventorySlots); - c = ((GT_TileEntity_LESU) (this.mContainer.mTileEntity.getMetaTileEntity())); + super(new GT_Container_LESU(aInventoryPlayer, aTileEntity), GT_GUIContainer_LESU.texture.getResourceDomain()); + this.mContainer = ((GT_Container_LESU) this.inventorySlots); + this.c = ((GT_TileEntity_LESU) (this.mContainer.mTileEntity.getMetaTileEntity())); } @Override @@ -60,7 +60,7 @@ public class GT_GUIContainer_LESU extends GT_GUIContainer { this.drawString(this.fontRendererObj, "MAX: " + (this.c.getBaseMetaTileEntity().isActive() ? String.valueOf(this.mContainer.mOutput) + percell : Integer.toString(0)), 11, 24, 16448255); this.drawString(this.fontRendererObj, "MAX EU/t IN: " + String.valueOf(this.mContainer.mInput), 11, 32, 16448255); this.drawString(this.fontRendererObj, "EU/t OUT: " + String.valueOf(this.mContainer.mOutput), 11, 40, 16448255); - this.drawString(this.fontRendererObj, "AMP/t IN/OUT: " + String.valueOf(c.getBaseMetaTileEntity().getInputAmperage()), 11, 48, 16448255); + this.drawString(this.fontRendererObj, "AMP/t IN/OUT: " + String.valueOf(this.c.getBaseMetaTileEntity().getInputAmperage()), 11, 48, 16448255); if (c.maxEUStore() >= Long.MAX_VALUE - 1) { this.drawString(this.fontRendererObj, StatCollector.translateToLocal("tooltip.LESU.0.name"), 11, 56, Color.YELLOW.getRGB()); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java index 2ae5bf6317..d214b4b09e 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/gui/GT_GUIContainer_RadioHatch.java @@ -26,6 +26,8 @@ import com.github.bartimaeusnek.bartworks.API.BioVatLogicAdder; import com.github.bartimaeusnek.bartworks.MainMod; import com.github.bartimaeusnek.bartworks.common.tileentities.tiered.GT_MetaTileEntity_RadioHatch; import com.github.bartimaeusnek.bartworks.server.container.GT_Container_RadioHatch; +import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; +import com.github.bartimaeusnek.bartworks.util.BW_Util; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; @@ -45,28 +47,28 @@ public class GT_GUIContainer_RadioHatch extends GT_GUIContainerMetaTile_Machine super(new GT_Container_RadioHatch(aInventoryPlayer, aTileEntity), MainMod.MOD_ID + ":textures/GUI/RadHatch.png"); this.mName = "Radio Hatch"; this.mContainer.detectAndSendChanges(); - maxSv = BioVatLogicAdder.RadioHatch.getMaxSv(); + GT_GUIContainer_RadioHatch.maxSv = BioVatLogicAdder.RadioHatch.getMaxSv(); } protected void drawGuiContainerForegroundLayer(int par1, int par2) { - long timer = ByteBuffer.wrap(((GT_Container_RadioHatch) mContainer).teTimer).getLong(); - double maxT = ((GT_Container_RadioHatch) mContainer).mass * (GT_MetaTileEntity_RadioHatch.calcDecayTicks(((GT_Container_RadioHatch) mContainer).sievert)); + long timer = ByteBuffer.wrap(((GT_Container_RadioHatch) this.mContainer).teTimer).getLong(); + double maxT = ((GT_Container_RadioHatch) this.mContainer).mass * (GT_MetaTileEntity_RadioHatch.calcDecayTicks(((GT_Container_RadioHatch) this.mContainer).sievert)); double rem = maxT - timer % maxT; this.fontRendererObj.drawString(this.mName, 8, 4, 4210752); this.mc.getTextureManager().bindTexture(new ResourceLocation(MainMod.MOD_ID + ":textures/GUI/RadHatch.png")); - if (((GT_Container_RadioHatch) mContainer).mass > 0) { - GL11.glColor3f(((GT_Container_RadioHatch) mContainer).r / 255f, ((GT_Container_RadioHatch) mContainer).g / 255f, ((GT_Container_RadioHatch) mContainer).b / 255f); + if (((GT_Container_RadioHatch) this.mContainer).mass > 0) { + GL11.glColor3f(((GT_Container_RadioHatch) this.mContainer).r / 255f, ((GT_Container_RadioHatch) this.mContainer).g / 255f, ((GT_Container_RadioHatch) this.mContainer).b / 255f); this.drawTexturedModalRect(124, 18, 124, 18, 16, 48); } GL11.glColor3f(1f, 1f, 1f); this.drawTexturedModalRect(124, 18, 176, 0, 16, 48 - (int) Math.ceil(48 * (rem / maxT))); - this.drawTexturedModalRect(65, 13, 192, 0, (48 * (((GT_Container_RadioHatch) mContainer).sv)) / (maxSv), 16); + this.drawTexturedModalRect(65, 13, 192, 0, (48 * (((GT_Container_RadioHatch) this.mContainer).sv)) / (GT_GUIContainer_RadioHatch.maxSv), 16); -// this.fontRendererObj.drawString("Sv: " + ((GT_Container_RadioHatch) mContainer).sievert, 8, 50, BW_Util.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); -// this.fontRendererObj.drawString("Kg: " + ((GT_Container_RadioHatch) mContainer).mass, 8, 68, BW_Util.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); -// this.fontRendererObj.drawString("Time: " + timer, 8, 76, BW_Util.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); +// this.fontRendererObj.drawString("Sv: " + ((GT_Container_RadioHatch) mContainer).sievert, 8, 50, BW_ColorUtil.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); +// this.fontRendererObj.drawString("Kg: " + ((GT_Container_RadioHatch) mContainer).mass, 8, 68, BW_ColorUtil.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); +// this.fontRendererObj.drawString("Time: " + timer, 8, 76, BW_ColorUtil.getColorFromRGBArray(new short[]{((GT_Container_RadioHatch) mContainer).r, ((GT_Container_RadioHatch) mContainer).g, ((GT_Container_RadioHatch) mContainer).b})); } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java index 76625e06bc..b3fce2c4ac 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_BioVat.java @@ -80,7 +80,7 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { private boolean needsVisualUpdate = true; private byte mGlassTier = 0; private int mSievert = 0; - + private int mNeededSievert = 0; public GT_TileEntity_BioVat(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -203,12 +203,14 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { if (gtRecipe == null) return false; - if (!BW_Util.areStacksEqual((ItemStack) gtRecipe.mSpecialItems, itemStack)) + if (!BW_Util.areStacksEqualOrNull((ItemStack) gtRecipe.mSpecialItems, itemStack)) return false; int[] conditions = specialValueUnpack(gtRecipe.mSpecialValue); - if (conditions[2] == 0 ? (this.mSievert < conditions[3] || this.mGlassTier < conditions[0]) : (this.mSievert != conditions[3] || this.mGlassTier < conditions[0])) + this.mNeededSievert = conditions[3]; + + if (conditions[2] == 0 ? (this.mSievert < this.mNeededSievert || this.mGlassTier < conditions[0]) : (this.mSievert != conditions[3] || this.mGlassTier < conditions[0])) return false; int times = 1; @@ -494,7 +496,7 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { height = reCalculateHeight(); if (this.mFluid != null && height > 1 && this.reCalculateFluidAmmount() > 0) { - if ((!(BW_Util.areStacksEqual(aStack, mStack))) || (needsVisualUpdate && this.getBaseMetaTileEntity().getTimer() % TIMERDIVIDER == 1)) { + if ((!(BW_Util.areStacksEqualOrNull(aStack, mStack))) || (needsVisualUpdate && this.getBaseMetaTileEntity().getTimer() % TIMERDIVIDER == 1)) { for (int x = -1; x < 2; x++) { for (int y = 1; y < height; y++) { for (int z = -1; z < 2; z++) { @@ -529,8 +531,11 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { if (height != reCalculateHeight()) needsVisualUpdate = true; doAllVisualThings(); - if (this.getBaseMetaTileEntity().isServerSide() && this.mRadHatches.size() == 1) + if (this.getBaseMetaTileEntity().isServerSide() && this.mRadHatches.size() == 1) { this.mSievert = this.mRadHatches.get(0).getSievert(); + if (this.getBaseMetaTileEntity().isActive() && this.mNeededSievert > this.mSievert) + this.mOutputFluids = null; + } } @Override @@ -543,6 +548,8 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { } if (this.mFluid != null) aNBT.setString("mFluid", mFluid.getName()); + aNBT.setInteger("mSievert",this.mSievert); + aNBT.setInteger("mNeededSievert",this.mNeededSievert); super.saveNBTData(aNBT); } @@ -580,10 +587,12 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { @Override public void loadNBTData(NBTTagCompound aNBT) { - height = aNBT.getInteger("mFluidHeight"); - mCulture = BioCulture.getBioCulture(aNBT.getString("mCulture")); + this.height = aNBT.getInteger("mFluidHeight"); + this.mCulture = BioCulture.getBioCulture(aNBT.getString("mCulture")); if (!aNBT.getString("mFluid").isEmpty()) - mFluid = FluidRegistry.getFluid(aNBT.getString("mFluid")); + this.mFluid = FluidRegistry.getFluid(aNBT.getString("mFluid")); + this.mSievert = aNBT.getInteger("mSievert"); + this.mNeededSievert = aNBT.getInteger("mNeededSievert"); super.loadNBTData(aNBT); } @@ -610,6 +619,6 @@ public class GT_TileEntity_BioVat extends GT_MetaTileEntity_MultiBlockBase { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == aFacing ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[MCASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)} : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[MCASING_INDEX]}; + return aSide == aFacing ? new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[GT_TileEntity_BioVat.MCASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)} : new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[MCASING_INDEX]}; } }
\ No newline at end of file diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java index 1eab412c16..b88c6209a0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/tiered/GT_MetaTileEntity_RadioHatch.java @@ -29,6 +29,8 @@ import com.github.bartimaeusnek.bartworks.client.gui.GT_GUIContainer_RadioHatch; import com.github.bartimaeusnek.bartworks.server.container.GT_Container_RadioHatch; import com.github.bartimaeusnek.bartworks.util.BW_ColorUtil; import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; +import com.github.bartimaeusnek.crossmod.GTpp.loader.RadioHatchCompat; +import cpw.mods.fml.common.Loader; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -75,13 +77,13 @@ public class GT_MetaTileEntity_RadioHatch extends GT_MetaTileEntity_Hatch { public static long calcDecayTicks(int x) { long ret = 0; - if (x >= 83 && x <= 100) - ret = (long) Math.ceil((8000D * Math.tanh(-x / 20D) + 8000D) * 1000D); - else if (x == 43) + if (x == 43) ret = 5000; else if (x == 61) ret = 4500; - else if (x > 100) + else if (x <= 100) + ret = (long) Math.ceil((8000D * Math.tanh(-x / 20D) + 8000D) * 1000D); + else ret = (long) Math.ceil(((8000D * Math.tanh(-x / 65D) + 8000D))); return ret;//*20; } @@ -170,19 +172,26 @@ public class GT_MetaTileEntity_RadioHatch extends GT_MetaTileEntity_Hatch { if (lStack == null) return; - if (lStack.getItem() instanceof IRadMaterial) { - IRadMaterial material = ((IRadMaterial) lStack.getItem()); - int sv = material.getRadiationLevel(lStack); + + IRadMaterial radmat = null; + //gt++ compat + if (Loader.isModLoaded("miscutils")) + radmat = RadioHatchCompat.GTppRadChecker(lStack); + + if (lStack.getItem() instanceof IRadMaterial || radmat != null) { + if (radmat == null) + radmat = ((IRadMaterial) lStack.getItem()); + int sv = radmat.getRadiationLevel(lStack); if (sv > BioVatLogicAdder.RadioHatch.getMaxSv()) BioVatLogicAdder.RadioHatch.MaxSV = sv; if (this.mass == 0 || this.sievert == sv) { - if (this.mass < this.cap) { - this.mass = material.getAmountOfMaterial(lStack); + if (this.mass + radmat.getAmountOfMaterial(lStack) <= this.cap) { + this.mass += radmat.getAmountOfMaterial(lStack); this.sievert = sv; this.mInventory[0].stackSize--; this.updateSlots(); - this.colorForGUI = material.getColorForGUI(lStack); - this.material = material.getNameForGUI(lStack); + this.colorForGUI = radmat.getColorForGUI(lStack); + this.material = radmat.getNameForGUI(lStack); return; } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java index 1f494dffab..662cfbea5a 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/WerkstoffLoader.java @@ -717,7 +717,7 @@ public class WerkstoffLoader implements Runnable { WerkstoffLoader.getCorresopndingItemStack(dust, werkstoff) }, new int[]{ - 100, 400, 1500, 2000, 4000, 5000 + 200, 1000, 2500, 2000, 4000, 5000 }, 800, 16 diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java index 1c4ffbb8cb..ebc432d1b5 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_OreLayer.java @@ -23,6 +23,7 @@ package com.github.bartimaeusnek.bartworks.system.oregen; import com.github.bartimaeusnek.bartworks.MainMod; +import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Ores; import com.github.bartimaeusnek.bartworks.system.material.Werkstoff; import gregtech.api.GregTech_API; @@ -149,10 +150,16 @@ public abstract class BW_OreLayer extends GT_Worldgen { } public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int aMetaData, boolean isSmallOre) { + //security stuff to prevent crashes with 2 TileEntites on the same Spot + TileEntity te = aWorld.getTileEntity(aX,aY,aZ); + if (te instanceof BW_MetaGeneratedOreTE || te instanceof GT_TileEntity_Ores) + return true; + if ((aMetaData == this.mSporadicMeta && (this.bwOres & 0b0001) != 0) || (aMetaData == this.mBetweenMeta && (this.bwOres & 0b0010) != 0) || (aMetaData == this.mPrimaryMeta && (this.bwOres & 0b1000) != 0) || (aMetaData == this.mSecondaryMeta && (this.bwOres & 0b0100) != 0)) { - return BW_MetaGenerated_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false, getDefaultBlockToReplace()); + return BW_MetaGenerated_Ores.setOreBlock(aWorld, aX, aY, aZ, aMetaData, false, this.getDefaultBlockToReplace()); } - return setGTOreBlockSpace(aWorld, aX, aY, aZ, aMetaData, getDefaultBlockToReplace()); + + return this.setGTOreBlockSpace(aWorld, aX, aY, aZ, aMetaData, this.getDefaultBlockToReplace()); } public boolean setGTOreBlockSpace(World aWorld, int aX, int aY, int aZ, int aMetaData, Block block){ diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java index b07c84d493..c380f3399b 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BWRecipes.java @@ -560,7 +560,7 @@ public class BWRecipes { // Check the Recipe which has been used last time in order to not have to search for it again, if possible. if (aRecipe != null) - if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqual((ItemStack) aRecipe.mSpecialItems, aSpecialSlot)) + if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqualOrNull((ItemStack) aRecipe.mSpecialItems, aSpecialSlot)) return aRecipe.mEnabled && aVoltage * mAmperage >= aRecipe.mEUt ? aRecipe : null; // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. @@ -570,12 +570,12 @@ public class BWRecipes { Collection<GT_Recipe> tRecipes = mRecipeItemMap.get(new GT_ItemStack(tStack)); if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqual((ItemStack) tRecipe.mSpecialItems, aSpecialSlot)) + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqualOrNull((ItemStack) tRecipe.mSpecialItems, aSpecialSlot)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; tRecipes = mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(GT_Values.W, tStack))); if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqual((ItemStack) tRecipe.mSpecialItems, aSpecialSlot)) + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqualOrNull((ItemStack) tRecipe.mSpecialItems, aSpecialSlot)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; } @@ -585,7 +585,7 @@ public class BWRecipes { if (aFluid != null) { Collection<GT_Recipe> tRecipes = mRecipeFluidMap.get(aFluid.getFluid()); if (tRecipes != null) for (GT_Recipe tRecipe : tRecipes) - if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqual((ItemStack) tRecipe.mSpecialItems, aSpecialSlot)) + if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, aDontCheckStackSizes, aFluids, aInputs) && BW_Util.areStacksEqualOrNull((ItemStack) tRecipe.mSpecialItems, aSpecialSlot)) return tRecipe.mEnabled && aVoltage * mAmperage >= tRecipe.mEUt ? tRecipe : null; } @@ -601,7 +601,7 @@ public class BWRecipes { if (aRecipe.mFluidInputs.length < this.mMinimalInputFluids && aRecipe.mInputs.length < this.mMinimalInputItems) { return null; } else { - return aCheckForCollisions && isthere != null && BW_Util.areStacksEqual((ItemStack) isthere.mSpecialItems, (ItemStack) aRecipe.mSpecialItems) ? null : this.add(aRecipe); + return aCheckForCollisions && isthere != null && BW_Util.areStacksEqualOrNull((ItemStack) isthere.mSpecialItems, (ItemStack) aRecipe.mSpecialItems) ? null : this.add(aRecipe); } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java index 64ea87132f..f7312eeab2 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/util/BW_Util.java @@ -32,6 +32,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import ic2.api.item.IElectricItem; import net.minecraft.block.Block; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -50,7 +51,6 @@ public class BW_Util { public static final int CLEANROOM = -100; public static final int LOWGRAVITY = -200; - public static String subscriptNumbers(String b){ char[] chars = b.toCharArray(); char[] nu = new char[chars.length]; @@ -182,7 +182,7 @@ public class BW_Util { return 8 << (2*tier); } - public static boolean areStacksEqual(ItemStack aStack1, ItemStack aStack2) { + public static boolean areStacksEqualOrNull(ItemStack aStack1, ItemStack aStack2) { return (aStack1 == null && aStack2 == null) || GT_Utility.areStacksEqual(aStack1, aStack2); } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java index 65fbb0f6a7..0fb357cdb3 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/BartWorksCrossmod.java @@ -23,17 +23,17 @@ package com.github.bartimaeusnek.crossmod; import com.github.bartimaeusnek.bartworks.common.commands.SummonRuin; +import com.github.bartimaeusnek.crossmod.GTpp.loader.RadioHatchCompat; import com.github.bartimaeusnek.crossmod.galacticraft.GalacticraftProxy; import com.github.bartimaeusnek.crossmod.thaumcraft.CustomAspects; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.event.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import java.util.List; + @Mod( modid = BartWorksCrossmod.MOD_ID, name = BartWorksCrossmod.NAME, version = BartWorksCrossmod.VERSION, dependencies = "required-after:IC2; " @@ -42,6 +42,7 @@ import org.apache.logging.log4j.Logger; + "after:GalacticraftMars; " + "after:GalacticraftCore; " + "after:Micdoodlecore; " + + "after:miscutils;" ) public class BartWorksCrossmod { public static final String NAME = "BartWorks Mod Additions"; @@ -70,8 +71,16 @@ public class BartWorksCrossmod { public void postInit(FMLPostInitializationEvent init) { if (Loader.isModLoaded("GalacticraftCore")) GalacticraftProxy.postInit(init); + if (Loader.isModLoaded("miscutils")) + new RadioHatchCompat().run(); } +// @Mod.EventHandler +// public void onFMLMissingMappingsEvent(FMLMissingMappingsEvent event){ +// for (FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()){ +// if (mapping.name.equalsIgnoreCase()) +// } +// } @Mod.EventHandler public void onFMLServerStart(FMLServerStartingEvent event) { diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/GTpp/loader/RadioHatchCompat.java b/src/main/java/com/github/bartimaeusnek/crossmod/GTpp/loader/RadioHatchCompat.java new file mode 100644 index 0000000000..2d63cae904 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/GTpp/loader/RadioHatchCompat.java @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.GTpp.loader; + +import com.github.bartimaeusnek.bartworks.API.IRadMaterial; +import com.github.bartimaeusnek.bartworks.system.log.DebugLog; +import com.github.bartimaeusnek.crossmod.BartWorksCrossmod; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.ModContainer; +import cpw.mods.fml.common.registry.GameData; +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.RegistryNamespaced; +import net.minecraftforge.oredict.OreDictionary; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.util.*; + +public class RadioHatchCompat implements Runnable { + + private static Class intf; + private static Class materialClass; + private static Class enu; + private static Class materialStackClass; + + private static Field isRadioactive; + private static Field f; + private static Field componentType; + private static Field radlevel; + private static Field protons; + + private static Field vMaterialInput; + private static Field stackMaterial; + private static Field RGBA; + private static Field localizedName; + private static Field unlocalizedName; + + private static Object rod; + private static Object longRod; + static{ + try { + RadioHatchCompat.intf = Class.forName("gtPlusPlus.core.item.base.BaseItemComponent"); + RadioHatchCompat.enu = Class.forName("gtPlusPlus.core.item.base.BaseItemComponent$ComponentTypes"); + RadioHatchCompat.materialClass = Class.forName("gtPlusPlus.core.material.Material"); + RadioHatchCompat.materialStackClass = Class.forName("gtPlusPlus.core.material.MaterialStack"); + + RadioHatchCompat.f = RadioHatchCompat.intf.getField("componentMaterial"); + RadioHatchCompat.isRadioactive = RadioHatchCompat.materialClass.getField("isRadioactive"); + RadioHatchCompat.componentType = RadioHatchCompat.intf.getDeclaredField("componentType"); + RadioHatchCompat.radlevel = RadioHatchCompat.materialClass.getField("vRadiationLevel"); + + RadioHatchCompat.vMaterialInput = RadioHatchCompat.materialClass.getDeclaredField("vMaterialInput"); + RadioHatchCompat.stackMaterial = RadioHatchCompat.materialStackClass.getDeclaredField("stackMaterial"); + RadioHatchCompat.protons = RadioHatchCompat.materialClass.getDeclaredField("vProtons"); + RadioHatchCompat.RGBA = RadioHatchCompat.materialClass.getDeclaredField("RGBA"); + RadioHatchCompat.localizedName = RadioHatchCompat.materialClass.getDeclaredField("localizedName"); + RadioHatchCompat.unlocalizedName = RadioHatchCompat.materialClass.getDeclaredField("unlocalizedName"); + + RadioHatchCompat.vMaterialInput.setAccessible(true); + RadioHatchCompat.stackMaterial.setAccessible(true); + RadioHatchCompat.protons.setAccessible(true); + RadioHatchCompat.RGBA.setAccessible(true); + RadioHatchCompat.localizedName.setAccessible(true); + RadioHatchCompat.unlocalizedName.setAccessible(true); + + Object[] arr = enu.getEnumConstants(); + for (Object o : arr){ + if (RadioHatchCompat.rod != null && RadioHatchCompat.longRod != null) + break; + else if (o.toString().equalsIgnoreCase("ROD")) + RadioHatchCompat.rod = o; + else if (o.toString().equalsIgnoreCase("RODLONG")) + RadioHatchCompat.longRod = o; + } + + } catch (NoSuchFieldException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + + @Override + public void run() { + DebugLog.log("Starting Generation of missing GT++ rods/longrods"); + try { + Class rodclass = Class.forName("gtPlusPlus.core.item.base.rods.BaseItemRod"); + Class longrodclass = Class.forName("gtPlusPlus.core.item.base.rods.BaseItemRodLong"); + Constructor c1 = rodclass.getConstructor(RadioHatchCompat.materialClass); + Constructor c2 = longrodclass.getConstructor(RadioHatchCompat.materialClass); + Field cOwners = GameData.class.getDeclaredField("customOwners"); + cOwners.setAccessible(true); + Field map = RegistryNamespaced.class.getDeclaredField("field_148758_b"); + map.setAccessible(true); + Map<Item,String> UniqueIdentifierMap = (Map) map.get(GameData.getItemRegistry()); + + Map<GameRegistry.UniqueIdentifier, ModContainer> ownerItems = (Map<GameRegistry.UniqueIdentifier, ModContainer>) cOwners.get(null); + ModContainer gtpp = null; + ModContainer bartworks = null; + + for (ModContainer container : Loader.instance().getModList()){ + if (gtpp != null && bartworks != null) + break; + else if (container.getModId().equalsIgnoreCase(BartWorksCrossmod.MOD_ID)) + bartworks=container; + else if (container.getModId().equalsIgnoreCase("miscutils")) + gtpp=container; + } + + for (Object mats : (Set) RadioHatchCompat.materialClass.getField("mMaterialMap").get(null)) { + if (RadioHatchCompat.isRadioactive.getBoolean(mats)) { + + if (OreDictionary.getOres("stick" + RadioHatchCompat.unlocalizedName.get(mats)).isEmpty()) { + Item it = (Item) c1.newInstance(mats); + UniqueIdentifierMap.replace(it,"miscutils:"+it.getUnlocalizedName()); + GameRegistry.UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor(it); + ownerItems.replace(ui,bartworks,gtpp); + + DebugLog.log("Generate: " + RadioHatchCompat.rod + RadioHatchCompat.unlocalizedName.get(mats)); + } + if (OreDictionary.getOres("stickLong" + RadioHatchCompat.unlocalizedName.get(mats)).isEmpty()) { + Item it2 = (Item) c2.newInstance(mats); + UniqueIdentifierMap.replace(it2,"miscutils:"+it2.getUnlocalizedName()); + GameRegistry.UniqueIdentifier ui2 = GameRegistry.findUniqueIdentifierFor(it2); + ownerItems.replace(ui2,bartworks,gtpp); + + DebugLog.log("Generate: " + RadioHatchCompat.longRod + RadioHatchCompat.unlocalizedName.get(mats)); + } + } + } + } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException | InstantiationException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + + public static IRadMaterial GTppRadChecker(ItemStack lStack){ + try { + if (RadioHatchCompat.intf.isAssignableFrom(lStack.getItem().getClass())){ + if (!RadioHatchCompat.isRadioactive.getBoolean(RadioHatchCompat.f.get(lStack.getItem()))) + return null; + return new RadioHatchCompat.GTPPRadAdapter(RadioHatchCompat.componentType.get(lStack.getItem()).equals(RadioHatchCompat.rod) ? 1 : RadioHatchCompat.componentType.get(lStack.getItem()).equals(RadioHatchCompat.longRod) ? 2 : 0, RadioHatchCompat.f.get(lStack.getItem())); + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } + + static class GTPPRadAdapter implements IRadMaterial{ + + static final HashMap<Object,Integer> BUFFER = new HashMap<>(); + + public GTPPRadAdapter(Object m) { + this.m = m; + } + + public GTPPRadAdapter(int amount, Object m) { + this.amount = (byte) amount; + this.m = m; + } + + byte amount; + final Object m; + + private static ArrayList getMaterialInput(Object GTPPMaterial) throws IllegalAccessException { + Object ret = RadioHatchCompat.vMaterialInput.get(GTPPMaterial); + return ret instanceof ArrayList ? (ArrayList) ret : new ArrayList(); + } + + private static boolean isElement(Object GTPPMaterial) throws IllegalAccessException { + return RadioHatchCompat.GTPPRadAdapter.getMaterialInput(GTPPMaterial).isEmpty(); + } + + private static List getElemets(Object GTPPMaterial) throws IllegalAccessException { + ArrayList elements = new ArrayList(); + Queue toCheck = new LinkedList(); + ArrayList materialInputs = RadioHatchCompat.GTPPRadAdapter.getMaterialInput(GTPPMaterial); + if (materialInputs.isEmpty()) + return Collections.singletonList(GTPPMaterial); + for (Object materialStack : materialInputs){ + if (!RadioHatchCompat.GTPPRadAdapter.isElement(RadioHatchCompat.stackMaterial.get(materialStack))) + toCheck.add(RadioHatchCompat.stackMaterial.get(materialStack)); + else + elements.add(RadioHatchCompat.stackMaterial.get(materialStack)); + } + while (!toCheck.isEmpty()){ + elements.addAll(getElemets(toCheck.poll())); + } + return elements; + } + + private static Integer calulateRad(Object m){ + int ret = 0; + try { + List pureElements = RadioHatchCompat.GTPPRadAdapter.getElemets(m); + for (Object materialObj : pureElements) + if (RadioHatchCompat.isRadioactive.getBoolean(materialObj)) + ret += ((int) RadioHatchCompat.radlevel.getByte(m) + RadioHatchCompat.GTPPRadAdapter.clampToZero(RadioHatchCompat.protons.getLong(materialObj))); + else + ret += ((int) RadioHatchCompat.radlevel.getByte(m)); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return ret; + } + + @Override + public int getRadiationLevel(ItemStack aStack) { + return RadioHatchCompat.GTPPRadAdapter.BUFFER.computeIfAbsent(this.m, radlvl -> RadioHatchCompat.GTPPRadAdapter.calulateRad(this.m)); + } + + private static long clampToZero(long number){ + return number > 0 ? number : 0; + } + + @Override + public byte getAmountOfMaterial(ItemStack aStack) { + return this.amount; + } + + @Override + public short[] getColorForGUI(ItemStack aStack) { + short[] rgba = {0,0,0,0}; + try { + rgba = (short[]) RadioHatchCompat.RGBA.get(this.m); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return rgba; + } + + @Override + public String getNameForGUI(ItemStack aStack) { + String ret = ""; + try { + ret = (String) RadioHatchCompat.localizedName.get(this.m); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + return ret; + } + + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java index 22e95e6d02..c1e7e7a6c8 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/galacticraft/UniversalTeleportType.java @@ -46,7 +46,7 @@ public class UniversalTeleportType implements ITeleportType { @Override public Vector3 getPlayerSpawnLocation(WorldServer world, EntityPlayerMP player) { - return getEntitySpawnLocation(world, player); + return this.getEntitySpawnLocation(world, player); } @Override diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_Multi_IndustrialCrucible.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_Multi_IndustrialCrucible.java new file mode 100644 index 0000000000..3700e89287 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_Multi_IndustrialCrucible.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.crossmod.thaumcraft.tile; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import net.minecraft.item.ItemStack; + +public class GT_Multi_IndustrialCrucible extends GT_MetaTileEntity_MultiBlockBase { + + public GT_Multi_IndustrialCrucible(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_Multi_IndustrialCrucible(String aName) { + super(aName); + } + + @Override + public boolean isCorrectMachinePart(ItemStack itemStack) { + return false; + } + + @Override + public boolean checkRecipe(ItemStack itemStack) { + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return false; + } + + @Override + public int getMaxEfficiency(ItemStack itemStack) { + return 0; + } + + @Override + public int getPollutionPerTick(ItemStack itemStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack itemStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack itemStack) { + return false; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return null; + } + + @Override + public String[] getDescription() { + return new String[0]; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity iGregTechTileEntity, byte b, byte b1, byte b2, boolean b3, boolean b4) { + return new ITexture[0]; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java index c16398795e..3daa758a88 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/tile/GT_WandBuffer.java @@ -22,8 +22,16 @@ package com.github.bartimaeusnek.crossmod.thaumcraft.tile; +import com.github.bartimaeusnek.crossmod.thaumcraft.util.ThaumcraftHandler; import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.item.ItemStack; public class GT_WandBuffer extends GT_MetaTileEntity_BasicBatteryBuffer { public GT_WandBuffer(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) { @@ -38,5 +46,84 @@ public class GT_WandBuffer extends GT_MetaTileEntity_BasicBatteryBuffer { super(aName, aTier, aDescription, aTextures, aSlotCount); } + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; + this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; + this.mBatteryCount = 0; + this.mChargeableCount = 0; + ItemStack[] var4 = this.mInventory; + int var5 = var4.length; + + for(int var6 = 0; var6 < var5; ++var6) { + ItemStack tStack = var4[var6]; + if (ThaumcraftHandler.isWand(tStack)) { + ++this.mBatteryCount; + ++this.mChargeableCount; + } + } + } + + } + + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return ThaumcraftHandler.isWand(aStack); + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return ThaumcraftHandler.isWand(aStack); + } + + public int getInventoryStackLimit() { + return 1; + } + + public long[] getStoredEnergy() { + boolean scaleOverflow = false; + boolean storedOverflow = false; + long tScale = this.getBaseMetaTileEntity().getEUCapacity(); + long tStored = this.getBaseMetaTileEntity().getStoredEU(); + long tStep = 0L; + if (this.mInventory != null) { + ItemStack[] var9 = this.mInventory; + int var10 = var9.length; + + for(int var11 = 0; var11 < var10; ++var11) { + ItemStack aStack = var9[var11]; + if (GT_ModHandler.isElectricItem(aStack)) { + if (aStack.getItem() instanceof GT_MetaBase_Item) { + Long[] stats = ((GT_MetaBase_Item)aStack.getItem()).getElectricStats(aStack); + if (stats != null) { + if (stats[0] > 4611686018427387903L) { + scaleOverflow = true; + } + + tScale += stats[0]; + tStep = ((GT_MetaBase_Item)aStack.getItem()).getRealCharge(aStack); + if (tStep > 4611686018427387903L) { + storedOverflow = true; + } + + tStored += tStep; + } + } else if (aStack.getItem() instanceof IElectricItem) { + tStored += (long)ElectricItem.manager.getCharge(aStack); + tScale += (long)((IElectricItem)aStack.getItem()).getMaxCharge(aStack); + } + } + } + } + + if (scaleOverflow) { + tScale = 9223372036854775807L; + } + + if (storedOverflow) { + tStored = 9223372036854775807L; + } + + return new long[]{tStored, tScale}; + } + } diff --git a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java index d0df9188a2..3d984ed063 100644 --- a/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java +++ b/src/main/java/com/github/bartimaeusnek/crossmod/thaumcraft/util/ThaumcraftHandler.java @@ -39,6 +39,24 @@ public class ThaumcraftHandler { private static Integer taintBiomeID; + private static Class mWandInterface; + + static { + try { + ThaumcraftHandler.mWandInterface = Class.forName("thaumcraft.common.items.wands.ItemWandCasting"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + + public static boolean isWand(ItemStack aStack) { + try { + return aStack != null && ThaumcraftHandler.mWandInterface.isAssignableFrom(aStack.getItem().getClass()); + } catch (Throwable var3) { + return false; + } + } + public static boolean isTaintBiome(int biomeID){ if (ThaumcraftHandler.taintBiomeID == null) { try { diff --git a/src/main/resources/assets/bartworks/lang/en_US.lang b/src/main/resources/assets/bartworks/lang/en_US.lang index 0388c0cb46..0aac211cdf 100644 --- a/src/main/resources/assets/bartworks/lang/en_US.lang +++ b/src/main/resources/assets/bartworks/lang/en_US.lang @@ -103,7 +103,7 @@ tooltip.tile.waterpump.2.name=Must be placed on the Ground. tooltip.tile.mbf.0.name=Controller Block for the Mega Blast Furnace;Size(WxHxD): 15x20x15 (Hollow);Controller: 3nd Layer Middle Center;Inner 13x18x13 Heating Coils (Hollow);Outer 15x18x15 Boronsilicate Glass;The glass limits the Energy Input tier;1+ Input Hatch/Bus (Any casing);1+ Output Bus (Any casing);1+ Energy Hatch (Any casing);1x Maintenance Hatch (Any casing);13x13 Muffler Hatches (Top middle);Heat Proof Machine Casings for the outer 15x15 (Layer 20);1+ Output Hatch to recover CO2/CO/SO2 (optional, any top layer casing); Recovery scales with Muffler Hatch tier;Heat Proof Machine Casings for Base;Each 900K over the min. Heat Capacity grants 5% speedup (multiplicatively);Each 1800K over the min. Heat Capacity allows for one upgraded overclock;Upgraded overclocks reduce recipe time to 25% and increase EU/t to 400%;Causes maximum tooltip.tile.mbf.1.name=Pollution per second tooltip.tile.mvf.0.name=Controller Block for the Mega Vacuum Freezer;Super cools hot ingots and cells;Size(WxHxD): 15x15x15 (Hollow);Controller: (Front centered);1x Input Bus (Any casing);1x Output Bus (Any casing);1x Maintenance Hatch (Any casing);1x Energy Hatch (Any casing);Frost Proof Machine Casings for the rest -tooltip.tile.bvat.0.name=Controller Block for the Bacterial Vat;Size(WxHxD): 5x4x5;Bottom and top are Stainless Steel Casings;Bottom and top must contain:;1x Maintenance, 1x Output Hatch;1 or more Input Hatches, 1 or more Input Buses, 0-1 Radiation Input Bus;The two middle layers must be build out of glass, hollow;The glass can be any glass, i.e. Tinkers Construct Clear Glass;Some Recipes need more advanced Glass Types;For maximum efficiency boost keep the Output Hatch always half filled! +tooltip.tile.bvat.0.name=Controller Block for the Bacterial Vat;Size(WxHxD): 5x4x5;Bottom and top are Stainless Steel Casings;Bottom or top must contain:;1x Maintenance, 1x Output Hatch;1 or more Input Hatches, 1 or more Input Buses, 0-1 Radio Hatch;The two middle layers must be build out of glass, hollow;The glass can be any glass, i.e. Tinkers Construct Clear Glass;Some Recipes need more advanced Glass Types;For maximum efficiency boost keep the Output Hatch always half filled! tooltip.tile.windmill.0.name=A primitive Grinder powered by Kinetic energy.;Size(WxHxD): 7x12x7;Layer 1: 7x7 Bricks, corners are air, controller at front centered.;Layer 2-5: 5x5 Hardened Clay, corners are air, can contain one door,;hollow, Wall must contain at least one Dispenser;Layer 6: 5x5 Wood Planks. Corners are filled, hollow.;Layer 7: 7x7 Wood Planks. Corners are air, hollow.;Layer 8: 7x7 Wood Planks. Corners are air, hollow,;front centered must be a Primitive Kinetic Shaftbox;Layer 9: 7x7 Wood Planks. Corners are air, hollow.;Layer 10: 5x5 Wood Planks. Corners are filled, hollow.;Layer 11: 3x3 Wood Planks. Corners are filled, hollow.;Layer 12: 1x1 Wood Plank.;Needs a Wind Mill Rotor in the Shaftbox to operate;Input items in Controller;Output items will appear in the dispensers;It is faster in regions with more wind (like IC2 Windmills) tooltip.tile.lesu.0.name=Controller Block for the GT2-Styled L.E.S.U.;Size: ANY tooltip.tile.lesu.1.name=Storage per LESU Casing: |