aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java14
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java24
-rw-r--r--src/main/java/gregtech/common/GT_Pollution.java59
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java7
4 files changed, 94 insertions, 10 deletions
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 ce507ff871..1bb1e6fa48 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
@@ -13,7 +13,7 @@ import net.minecraft.world.ChunkPosition;
public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Might cause acidic rains and poisoning.)");
+ super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Might cause acidic rains and poisoning)");
}
public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -75,12 +75,12 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
return false;
}
- @Override
- public String[] getInfoData() {
- return new String[]{
- "Reduces pollution by: "+ EnumChatFormatting.GREEN + (6*(mTier-1))+ EnumChatFormatting.RESET+" %"
- };
- }
+ //@Override
+ //public String[] getInfoData() {
+ // return new String[]{
+ // "Reduces pollution by: "+ EnumChatFormatting.GREEN + (6*(mTier-1))+ EnumChatFormatting.RESET+" %"
+ // };
+ //}
public int getPollutionReduction() {
return 6*(mTier-1);
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 5303d0d244..f6c1027a72 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
@@ -10,12 +10,15 @@ import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Pollution;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -191,6 +194,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ //if (this.mMachine && aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) {
+ // pollutionParticles(aBaseMetaTileEntity);
+ //}
if (aBaseMetaTileEntity.isServerSide()) {
if (mEfficiency < 0) mEfficiency = 0;
if (--mUpdate == 0 || --mStartUpCheck == 0) {
@@ -305,6 +311,24 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
return mPollution < 10000;
}
+ //MAKE THE POLLUTION ROLL!!!
+ public void pollutionParticles(IGregTechTileEntity aBaseMetaTileEntity){
+ for (MetaTileEntity tTileEntity : mMufflerHatches) {
+ IGregTechTileEntity muffler = tTileEntity.getBaseMetaTileEntity();
+ byte mufflerFront = muffler.getFrontFacing();
+ aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", muffler.getOffsetX(mufflerFront, 1) + (new XSTR()).nextFloat(), muffler.getOffsetY(mufflerFront, 1) + (new XSTR()).nextFloat(), muffler.getOffsetZ(mufflerFront, 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D);
+ }
+ if(!GT_Mod.gregtechproxy.mPollution)return;
+ if(GT_Pollution.getPollutionAtCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord())>GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ for (MetaTileEntity tTileEntity : mMufflerHatches) {
+ IGregTechTileEntity muffler = tTileEntity.getBaseMetaTileEntity();
+ byte mufflerFront = muffler.getFrontFacing();
+ aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", muffler.getOffsetX(mufflerFront, 1) + (new XSTR()).nextFloat(), muffler.getOffsetY(mufflerFront, 1) + (new XSTR()).nextFloat(), muffler.getOffsetZ(mufflerFront, 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D + (new XSTR()).nextFloat(), 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", muffler.getOffsetX(mufflerFront, 1) + (new XSTR()).nextFloat(), muffler.getOffsetY(mufflerFront, 1) + (new XSTR()).nextFloat(), muffler.getOffsetZ(mufflerFront, 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D + (new XSTR()).nextFloat(), 0.0D);
+ }
+ }
+ }
+
/**
* Called every tick the Machine runs
*/
diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java
index 7125afd739..5f1becfb78 100644
--- a/src/main/java/gregtech/common/GT_Pollution.java
+++ b/src/main/java/gregtech/common/GT_Pollution.java
@@ -76,7 +76,7 @@ public class GT_Pollution {
List<EntityLivingBase> tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk);
for(EntityLivingBase tEnt : tEntitys){
if(tRan.nextInt(tPollution/25000) > 10){
- tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, (int)Math.max((long)tPollution/1000,1000), 1));
+ tEnt.addPotionEffect(new PotionEffect(Potion.blindness.id, Math.min(tPollution/1000,1000), 1));
}
}
// Poison effects
@@ -85,7 +85,7 @@ public class GT_Pollution {
//List<EntityLiving> tEntitys = aWorld.getEntitiesWithinAABB(EntityLiving.class, chunk);
for(EntityLivingBase tEnt : tEntitys){
if(tRan.nextInt(tPollution/25000) > 20){
- tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, (int)Math.max((long)tPollution/4000,1000), 1));
+ tEnt.addPotionEffect(new PotionEffect(Potion.poison.id, Math.min(tPollution/4000,1000), 1));
}
}
// killing plants
@@ -171,4 +171,59 @@ public class GT_Pollution {
}
}catch(Exception e){}
}
+
+ //PLACE HOLDER
+ public static void onWorldTickClient(World aWorld, int aTick){
+ if(!GT_Mod.gregtechproxy.mPollution)return;
+ if(aTick == 0 || (tList==null && GT_Proxy.chunkData!=null)){
+ tList = new ArrayList<ChunkPosition>(GT_Proxy.chunkData.keySet());
+ loops = (tList.size()/1000) + 1;
+// System.out.println("new Pollution loop"+aTick);
+ }
+ if(tList!=null && tList.size() > 0){
+ int i = 0;
+ for(; i < loops ; i++){
+ ChunkPosition tPos = tList.get(0);
+ tList.remove(0);
+ if(tPos!=null && GT_Proxy.chunkData.containsKey(tPos)){
+ int tPollution = GT_Proxy.chunkData.get(tPos)[1];
+
+ if(tPollution<=0){tPollution = 0;}else{
+
+ int[] tArray = GT_Proxy.chunkData.get(tPos);
+ tArray[1] = tPollution;
+ GT_Proxy.chunkData.remove(tPos);
+ GT_Proxy.chunkData.put(tPos, tArray);
+ //Create Pollution effects
+// Smog filter TODO
+ if(tPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ doSmog(tPos,aWorld,tPollution);
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ private static void doSmog(ChunkPosition tPos, World aWorld, int tPollution) {
+ if(aWorld.isRemote) {
+ int i = Math.max(tPollution/5000,300);
+ for (; i > 0; i -= 1)
+ aWorld.spawnParticle("largesmoke", tPos.chunkPosX * 16 + (new XSTR()).nextFloat() * 16, (new XSTR()).nextFloat() * 250, tPos.chunkPosZ * 16 + (new XSTR()).nextFloat() * 16, 0.0D, 0.3D, 0.0D);
+ }
+ }
+
+ public static int getPollutionAtCoords(int aX, int aZ){
+ ChunkPosition tPos = new ChunkPosition(aX>>4, 1, aZ>>4);
+ if(GT_Proxy.chunkData.containsKey(tPos)){
+ int[] tPollution = GT_Proxy.chunkData.get(tPos);
+ if(tPollution.length>1 && tPollution[1]>0){
+ return tPollution[1];
+ }else{
+ return 0;
+ }
+ }
+ return 0;
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java
index 06226833cb..7906cf479c 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java
@@ -186,9 +186,14 @@ public class GT_MetaTileEntity_BronzeBlastFurnace
}
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if ((aBaseMetaTileEntity.isClientSide()) &&
+ if (this.mMachine && (aBaseMetaTileEntity.isClientSide()) &&
(aBaseMetaTileEntity.isActive())) {
aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D, 0.0D);
+ //Pollution particles intensify
+ if(GT_Pollution.getPollutionAtCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord())>GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D+(new XSTR()).nextFloat(), 0.0D);
+ aBaseMetaTileEntity.getWorld().spawnParticle("largesmoke", aBaseMetaTileEntity.getOffsetX(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), aBaseMetaTileEntity.getOffsetY(aBaseMetaTileEntity.getBackFacing(), 1), aBaseMetaTileEntity.getOffsetZ(aBaseMetaTileEntity.getBackFacing(), 1) + (new XSTR()).nextFloat(), 0.0D, 0.3D+(new XSTR()).nextFloat(), 0.0D);
+ }
}
if (aBaseMetaTileEntity.isServerSide()) {
if (this.mUpdate-- == 0) {