From efbaa3fcb94da0aea4a4d51519b58df4641e68d9 Mon Sep 17 00:00:00 2001 From: botn365 <42187820+botn365@users.noreply.github.com> Date: Fri, 18 Sep 2020 22:31:23 +0200 Subject: fix energy consumption on OC past tick limit fix the energy consumption of the large chemical reactor where it would reduce the energy consumption if the it OCd past the tick limit --- .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index c6828c707e..c41d2ca316 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -617,8 +617,17 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { while (tempEUt <= V[mTier - 1] * mAmperage) { tempEUt <<= 2;//this actually controls overclocking //xEUt *= 4;//this is effect of everclocking + int oldTime = mMaxProgresstime; mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking - xEUt = mMaxProgresstime==0 ? xEUt >> ocTimeShift : xEUt << 2;//U know, if the time is less than 1 tick make the machine use less power + if (mMaxProgresstime <1) + { + xEUt *= oldTime * (perfectOC ? 1:2); + break; + } + else + { + xEUt <<= ocTimeShift; + } } if(xEUt > Integer.MAX_VALUE - 1) { mEUt = Integer.MAX_VALUE - 1; -- cgit From ce56bfde0fd9d9e032fbbd5b431923dbf0d679a4 Mon Sep 17 00:00:00 2001 From: DreamMasterXXL Date: Sat, 19 Sep 2020 19:40:57 +0200 Subject: Revert "fix energy consumption on OC past tick limit" This reverts commit efbaa3fcb94da0aea4a4d51519b58df4641e68d9. --- .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index c41d2ca316..c6828c707e 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -617,17 +617,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { while (tempEUt <= V[mTier - 1] * mAmperage) { tempEUt <<= 2;//this actually controls overclocking //xEUt *= 4;//this is effect of everclocking - int oldTime = mMaxProgresstime; mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking - if (mMaxProgresstime <1) - { - xEUt *= oldTime * (perfectOC ? 1:2); - break; - } - else - { - xEUt <<= ocTimeShift; - } + xEUt = mMaxProgresstime==0 ? xEUt >> ocTimeShift : xEUt << 2;//U know, if the time is less than 1 tick make the machine use less power } if(xEUt > Integer.MAX_VALUE - 1) { mEUt = Integer.MAX_VALUE - 1; -- cgit From 40a6b42cd5e2ad4f6a97fffebf991d56c3ac50fc Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Sat, 19 Sep 2020 19:55:01 +0200 Subject: fix to much power on non perfect OC --- .../implementations/GT_MetaTileEntity_MultiBlockBase.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index c41d2ca316..6d2110baee 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -621,6 +621,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking if (mMaxProgresstime <1) { + if(oldTime == 1) + break; xEUt *= oldTime * (perfectOC ? 1:2); break; } -- cgit From 305d6832b7e2a501b45eb41bf2cdb8e4edb65cfb Mon Sep 17 00:00:00 2001 From: korneel vandamme Date: Sat, 19 Sep 2020 20:30:48 +0200 Subject: put back oldTime --- .../metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index a64073d67e..6d2110baee 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -617,6 +617,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { while (tempEUt <= V[mTier - 1] * mAmperage) { tempEUt <<= 2;//this actually controls overclocking //xEUt *= 4;//this is effect of everclocking + int oldTime = mMaxProgresstime; mMaxProgresstime >>= ocTimeShift;//this is effect of overclocking if (mMaxProgresstime <1) { -- cgit From 749e36968f3a2b392f497e59934ad521f4c78742 Mon Sep 17 00:00:00 2001 From: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> Date: Sun, 4 Oct 2020 23:36:56 +0200 Subject: Invalid Muffler Hatch Facing Added the ability to change the invalid facing orientation on the Muffler Hatch Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> --- .../GT_MetaTileEntity_Hatch_Muffler.java | 97 +++++++++++++--------- 1 file changed, 56 insertions(+), 41 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 9cadeaddc2..b3998b62e7 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -12,6 +12,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import java.util.Arrays; + import static gregtech.api.objects.XSTR.XSTR_INSTANCE; public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @@ -53,10 +55,23 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { return true; } + private int[] mFacings; + + /*private void init()*/ { + setInValidFacings(ForgeDirection.DOWN); + } + + public void setInValidFacings(ForgeDirection... aFacings) { + mFacings = Arrays.stream(aFacings).mapToInt(Enum::ordinal).toArray(); + } + @Override public boolean isFacingValid(byte aFacing) { - return aFacing != 0; - } + for (int x : mFacings) + if (x == aFacing) + return false; + return true; + } @Override public boolean isAccessAllowed(EntityPlayer aPlayer) { @@ -80,9 +95,9 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { } return false; } - - public int calculatePollutionReduction(int aPollution){ - return (int) (aPollution *(Math.pow(0.85F, mTier - 1))); + + public int calculatePollutionReduction(int aPollution) { + return (int) (aPollution * (Math.pow(0.85F, mTier - 1))); } @Override @@ -98,51 +113,51 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if(aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive()) - pollutionParticles(this.getBaseMetaTileEntity().getWorld(),"largesmoke"); - } - - public void pollutionParticles(World aWorld,String name){ - boolean chk1,chk2,chk3; - float ran1=XSTR_INSTANCE.nextFloat(),ran2=0,ran3=0; - chk1=ran1*100= GT_Mod.gregtechproxy.mPollutionSmogLimit){ - ran2=XSTR_INSTANCE.nextFloat(); - ran3=XSTR_INSTANCE.nextFloat(); - chk2=ran2*100= GT_Mod.gregtechproxy.mPollutionSmogLimit) { + ran2 = XSTR_INSTANCE.nextFloat(); + ran3 = XSTR_INSTANCE.nextFloat(); + chk2 = ran2 * 100 < calculatePollutionReduction(100); + chk3 = ran3 * 100 < calculatePollutionReduction(100); + if (!(chk1 || chk2 || chk3)) return; + } else { + if (!chk1) return; + chk2 = chk3 = false; } - IGregTechTileEntity aMuffler=this.getBaseMetaTileEntity(); - ForgeDirection aDir=ForgeDirection.getOrientation(aMuffler.getFrontFacing()); - float xPos=aDir.offsetX*0.76F+aMuffler.getXCoord()+0.25F; - float yPos=aDir.offsetY*0.76F+aMuffler.getYCoord()+0.25F; - float zPos=aDir.offsetZ*0.76F+aMuffler.getZCoord()+0.25F; + IGregTechTileEntity aMuffler = this.getBaseMetaTileEntity(); + ForgeDirection aDir = ForgeDirection.getOrientation(aMuffler.getFrontFacing()); + float xPos = aDir.offsetX * 0.76F + aMuffler.getXCoord() + 0.25F; + float yPos = aDir.offsetY * 0.76F + aMuffler.getYCoord() + 0.25F; + float zPos = aDir.offsetZ * 0.76F + aMuffler.getZCoord() + 0.25F; - float ySpd=aDir.offsetY*0.1F+0.2F+0.1F*XSTR_INSTANCE.nextFloat(); + float ySpd = aDir.offsetY * 0.1F + 0.2F + 0.1F * XSTR_INSTANCE.nextFloat(); float xSpd; float zSpd; - if(aDir.offsetY==-1){ - float temp=XSTR_INSTANCE.nextFloat()*2*(float)Math.PI; - xSpd=(float)Math.sin(temp)*0.1F; - zSpd=(float)Math.cos(temp)*0.1F; - }else{ - xSpd=aDir.offsetX*(0.1F+0.2F*XSTR_INSTANCE.nextFloat()); - zSpd=aDir.offsetZ*(0.1F+0.2F*XSTR_INSTANCE.nextFloat()); + if (aDir.offsetY == -1) { + float temp = XSTR_INSTANCE.nextFloat() * 2 * (float) Math.PI; + xSpd = (float) Math.sin(temp) * 0.1F; + zSpd = (float) Math.cos(temp) * 0.1F; + } else { + xSpd = aDir.offsetX * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); + zSpd = aDir.offsetZ * (0.1F + 0.2F * XSTR_INSTANCE.nextFloat()); } - if(chk1) - aWorld.spawnParticle(name, xPos + ran1*0.5F, yPos + XSTR_INSTANCE.nextFloat()*0.5F, zPos + XSTR_INSTANCE.nextFloat()*0.5F, xSpd, ySpd, zSpd); + if (chk1) + aWorld.spawnParticle(name, xPos + ran1 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - if(chk2) - aWorld.spawnParticle(name, xPos + ran2*0.5F, yPos + XSTR_INSTANCE.nextFloat()*0.5F, zPos + XSTR_INSTANCE.nextFloat()*0.5F, xSpd, ySpd, zSpd); + if (chk2) + aWorld.spawnParticle(name, xPos + ran2 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - if(chk3) - aWorld.spawnParticle(name, xPos + ran3*0.5F, yPos + XSTR_INSTANCE.nextFloat()*0.5F, zPos + XSTR_INSTANCE.nextFloat()*0.5F, xSpd, ySpd, zSpd); + if (chk3) + aWorld.spawnParticle(name, xPos + ran3 * 0.5F, yPos + XSTR_INSTANCE.nextFloat() * 0.5F, zPos + XSTR_INSTANCE.nextFloat() * 0.5F, xSpd, ySpd, zSpd); } } -- cgit