aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorPrometheus0000 <prometheus0000000@gmail.com>2020-10-12 19:51:21 -0400
committerGitHub <noreply@github.com>2020-10-12 19:51:21 -0400
commitd8896f251fb8980555a12b5e827cd710cce90814 (patch)
treee4ad63c58c4ffd5f94921c6a91878224ce3797f5 /src/main/java/gregtech/api/metatileentity
parent9c7f9fa6e4ab8d1ad45f43c59ee27ebade3011b8 (diff)
parent3ff33adbffd26a70cdcce3162da14c48ed60c668 (diff)
downloadGT5-Unofficial-d8896f251fb8980555a12b5e827cd710cce90814.tar.gz
GT5-Unofficial-d8896f251fb8980555a12b5e827cd710cce90814.tar.bz2
GT5-Unofficial-d8896f251fb8980555a12b5e827cd710cce90814.zip
Merge pull request #1 from GTNewHorizons/experimental
update
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java13
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java97
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java13
3 files changed, 77 insertions, 46 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 2a275a5354..cfb34eb34e 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -447,11 +447,16 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
if (getRandomNumber(1000) == 0) {
+ int precipitationHeightAtSide2 = worldObj.getPrecipitationHeight(xCoord, zCoord - 1);
+ int precipitationHeightAtSide3 = worldObj.getPrecipitationHeight(xCoord, zCoord + 1);
+ int precipitationHeightAtSide4 = worldObj.getPrecipitationHeight(xCoord - 1, zCoord);
+ int precipitationHeightAtSide5 = worldObj.getPrecipitationHeight(xCoord + 1, zCoord);
+
if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord)
- || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) {
+ || (getCoverIDAtSide((byte) 2) == 0 && precipitationHeightAtSide2 - 1 < yCoord && precipitationHeightAtSide2 > -1)
+ || (getCoverIDAtSide((byte) 3) == 0 && precipitationHeightAtSide3 - 1 < yCoord && precipitationHeightAtSide3 > -1)
+ || (getCoverIDAtSide((byte) 4) == 0 && precipitationHeightAtSide4 - 1 < yCoord && precipitationHeightAtSide4 > -1)
+ || (getCoverIDAtSide((byte) 5) == 0 && precipitationHeightAtSide5 - 1 < yCoord && precipitationHeightAtSide5 > -1)) {
if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
if (getRandomNumber(10) == 0) {
try{
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<calculatePollutionReduction(100);
- if(GT_Pollution.getPollution(getBaseMetaTileEntity())>= 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;
+ 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 < calculatePollutionReduction(100);
+ if (GT_Pollution.getPollution(getBaseMetaTileEntity()) >= 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);
}
}
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..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,8 +617,19 @@ 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)
+ {
+ if(oldTime == 1)
+ break;
+ xEUt *= oldTime * (perfectOC ? 1:2);
+ break;
+ }
+ else
+ {
+ xEUt <<= ocTimeShift;
+ }
}
if(xEUt > Integer.MAX_VALUE - 1) {
mEUt = Integer.MAX_VALUE - 1;