aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java63
-rw-r--r--src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java3
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java1
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java69
-rw-r--r--src/main/java/com/github/technus/tectech/thing/CustomItemList.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java156
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java145
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPollutor.java31
-rw-r--r--src/main/resources/assets/gregtech/textures/blocks/iconsets/POLLUTOR.pngbin0 -> 849 bytes
12 files changed, 409 insertions, 75 deletions
diff --git a/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java b/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java
index f7b3895a80..c924099375 100644
--- a/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java
+++ b/src/main/java/com/github/technus/tectech/chunkData/ChunkDataHandler.java
@@ -130,38 +130,39 @@ public class ChunkDataHandler {
dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
}
- @SideOnly(Side.SERVER)
@SubscribeEvent
public void onWorldTickEvent(TickEvent.WorldTickEvent aEvent) {
- int dim=aEvent.world.provider.dimensionId;
- clientSyncHandlers.forEach(chunkMetaDataHandler -> {
- ChunkHashMap data=dimensionWiseMetaChunkData
- .get(chunkMetaDataHandler.getTagName()).get(dim);
- int cycle=chunkMetaDataHandler.pushPayloadSpreadPeriod();
- int epoch=(int)(aEvent.world.getTotalWorldTime()%cycle);
- ArrayList<ChunkCoordIntPair> work;
- if(epoch==0){
- int per=data.dirtyBoys.size()/cycle;
- int mod=data.dirtyBoys.size()%cycle;
- Iterator<ChunkCoordIntPair> iter=data.dirtyBoys.iterator();
- for (int periodWork = 0; periodWork < cycle; periodWork++) {
- work=data.workLoad.get(periodWork);
- for (int i = 0; i < per; i++) {
- work.add(iter.next());
- }
- if(periodWork<mod){
- work.add(iter.next());
+ if(aEvent.side.isServer()) {
+ int dim = aEvent.world.provider.dimensionId;
+ clientSyncHandlers.forEach(chunkMetaDataHandler -> {
+ ChunkHashMap data = dimensionWiseMetaChunkData
+ .get(chunkMetaDataHandler.getTagName()).get(dim);
+ int cycle = chunkMetaDataHandler.pushPayloadSpreadPeriod();
+ int epoch = (int) (aEvent.world.getTotalWorldTime() % cycle);
+ ArrayList<ChunkCoordIntPair> work;
+ if (epoch == 0) {
+ int per = data.dirtyBoys.size() / cycle;
+ int mod = data.dirtyBoys.size() % cycle;
+ Iterator<ChunkCoordIntPair> iter = data.dirtyBoys.iterator();
+ for (int periodWork = 0; periodWork < cycle; periodWork++) {
+ work = data.workLoad.get(periodWork);
+ for (int i = 0; i < per; i++) {
+ work.add(iter.next());
+ }
+ if (periodWork < mod) {
+ work.add(iter.next());
+ }
}
+ data.dirtyBoys.clear();
}
- data.dirtyBoys.clear();
- }
- work=data.workLoad.get(epoch);
- chunkMetaDataHandler.pushPayload(dim,work);
- work.clear();
- });
- worldHandlers.forEach(chunkMetaDataHandler ->
- chunkMetaDataHandler.tickWorld(
- dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
+ work = data.workLoad.get(epoch);
+ chunkMetaDataHandler.pushPayload(dim, work);
+ work.clear();
+ });
+ worldHandlers.forEach(chunkMetaDataHandler ->
+ chunkMetaDataHandler.tickWorld(
+ dimensionWiseMetaChunkData.get(chunkMetaDataHandler.getTagName()), aEvent));
+ }
}
@SubscribeEvent
@@ -196,7 +197,7 @@ public class ChunkDataHandler {
clientSyncHandlers.add(handler);
}
} catch (NoSuchMethodException e) {
- throw new RuntimeException("Cannot register common event handlers!");
+ throw new RuntimeException("Cannot register common event handlers!",e);
}
if(FMLCommonHandler.instance().getEffectiveSide().isServer()) {
try {
@@ -204,7 +205,7 @@ public class ChunkDataHandler {
worldHandlers.add(handler);
}
} catch (NoSuchMethodException e) {
- throw new RuntimeException("Cannot register client event handlers!");
+ throw new RuntimeException("Cannot register server event handlers!",e);
}
}
if(FMLCommonHandler.instance().getEffectiveSide().isClient()) {
@@ -216,7 +217,7 @@ public class ChunkDataHandler {
renderHandlers.add(handler);
}
} catch (NoSuchMethodException e) {
- throw new RuntimeException("Cannot register client event handlers!");
+ throw new RuntimeException("Cannot register client event handlers!",e);
}
}
}
diff --git a/src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java b/src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java
index b904f09f33..920d09c26a 100644
--- a/src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java
+++ b/src/main/java/com/github/technus/tectech/chunkData/IChunkMetaDataHandler.java
@@ -16,9 +16,7 @@ public interface IChunkMetaDataHandler {
NBTTagCompound createData();
@SideOnly(Side.CLIENT)
default void requestData(ChunkEvent.Load aEvent){}
- @SideOnly(Side.SERVER)
default void pushData(int world, ChunkCoordIntPair chunk){}
- @SideOnly(Side.SERVER)
default void pushPayload(int world, ArrayList<ChunkCoordIntPair> chunk){
chunk.forEach(chunkCoordIntPair -> pushData(world,chunkCoordIntPair));
}
@@ -30,7 +28,6 @@ public interface IChunkMetaDataHandler {
@SideOnly(Side.CLIENT)
default void tickClient(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ClientTickEvent aEvent){}
default void tickServer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.ServerTickEvent event){}
- @SideOnly(Side.SERVER)
default void tickWorld(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.WorldTickEvent aEvent){}
default void tickPlayer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.PlayerTickEvent aEvent){}
}
diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
index e734a4f8a3..e9fe5cfb19 100644
--- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java
@@ -595,6 +595,7 @@ public class MachineLoader implements Runnable {
// ===================================================================================================
// Debug Stuff
// ===================================================================================================
+ Machine_DebugPollutor.set(new GT_MetaTileEntity_DebugPollutor(15495,"debug.tt.pollutor","Debug Pollution Generator",15).getStackForm(1));
hatch_CreativeData.set(new GT_MetaTileEntity_Hatch_CreativeData(15496,"debug.tt.data","Debug Data Hatch",15).getStackForm(1));
hatch_CreativeMaitenance.set(new GT_MetaTileEntity_Hatch_CreativeMaintenance(15497, "debug.tt.maintenance", "Debug Maintenance Hatch", 15).getStackForm(1L));
Machine_DebugGenny.set(new GT_MetaTileEntity_DebugPowerGenerator(15498, "debug.tt.genny", "Debug Power Generator", 15).getStackForm(1L));
diff --git a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
index f45d3a5df5..c52ffc185f 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/anomaly/AnomalyHandler.java
@@ -20,7 +20,7 @@ import java.util.HashMap;
public class AnomalyHandler implements IChunkMetaDataHandler {
private static final double SWAP_THRESHOLD = dAtomDefinition.getSomethingHeavy().getMass() * 10000D;
- private static final double PER_PARTICLE=SWAP_THRESHOLD/64;
+ private static final double PER_PARTICLE=SWAP_THRESHOLD/32;
private static final String INTENSITY = "intensity";
private static final int MEAN_DELAY =50;
@@ -42,27 +42,27 @@ public class AnomalyHandler implements IChunkMetaDataHandler {
@Override
public void tickWorld(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.WorldTickEvent aEvent) {
- if(TecTech.RANDOM.nextInt(MEAN_DELAY)==0) {
- int dim=aEvent.world.provider.dimensionId;
- ArrayList<Chunk> worldDataArrayList =new ArrayList<>(1024);
- data.get(dim).forEach((chunkCoordIntPair, compound) -> {
- if (compound.getDouble(INTENSITY) >= SWAP_THRESHOLD) {
- Chunk chunk=aEvent.world.getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos,chunkCoordIntPair.chunkZPos);
- if(chunk.isChunkLoaded){
- worldDataArrayList.add(chunk);
- }
+ if (TecTech.RANDOM.nextInt(MEAN_DELAY) == 0) {
+ int dim = aEvent.world.provider.dimensionId;
+ ArrayList<Chunk> worldDataArrayList = new ArrayList<>(1024);
+ data.get(dim).forEach((chunkCoordIntPair, compound) -> {
+ if (compound.getDouble(INTENSITY) >= SWAP_THRESHOLD) {
+ Chunk chunk = aEvent.world.getChunkFromChunkCoords(chunkCoordIntPair.chunkXPos, chunkCoordIntPair.chunkZPos);
+ if (chunk.isChunkLoaded) {
+ worldDataArrayList.add(chunk);
}
- });
- if(worldDataArrayList.size()>=2) {
- Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size()));
- Chunk b = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size()));
- data.get(dim).get(a.getChunkCoordIntPair()).setDouble(INTENSITY,SWAP_THRESHOLD*TecTech.RANDOM.nextFloat()*0.25F);
- data.get(dim).get(b.getChunkCoordIntPair()).setDouble(INTENSITY,SWAP_THRESHOLD*TecTech.RANDOM.nextFloat()*0.25F);
- data.get(dim).markForTransmissionToClient(a.getChunkCoordIntPair());
- data.get(dim).markForTransmissionToClient(b.getChunkCoordIntPair());
- swapSomething(a,b);
}
+ });
+ if (worldDataArrayList.size() >= 2) {
+ Chunk a = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size()));
+ Chunk b = worldDataArrayList.remove(TecTech.RANDOM.nextInt(worldDataArrayList.size()));
+ data.get(dim).get(a.getChunkCoordIntPair()).setDouble(INTENSITY, SWAP_THRESHOLD * TecTech.RANDOM.nextFloat() * 0.25F);
+ data.get(dim).get(b.getChunkCoordIntPair()).setDouble(INTENSITY, SWAP_THRESHOLD * TecTech.RANDOM.nextFloat() * 0.25F);
+ data.get(dim).markForTransmissionToClient(a.getChunkCoordIntPair());
+ data.get(dim).markForTransmissionToClient(b.getChunkCoordIntPair());
+ swapSomething(a, b);
}
+ }
}
private void swapSomething(Chunk a,Chunk b){
@@ -97,27 +97,29 @@ public class AnomalyHandler implements IChunkMetaDataHandler {
@Override
public void tickPlayer(HashMap<Integer, ChunkDataHandler.ChunkHashMap> data, TickEvent.PlayerTickEvent aEvent) {
- ChunkCoordIntPair pair=new ChunkCoordIntPair(aEvent.player.chunkCoordX,aEvent.player.chunkCoordZ);
- NBTTagCompound compound=data.get(aEvent.player.worldObj.provider.dimensionId).get(pair);
- if(compound!=null) {
- double intensity = compound.getDouble(INTENSITY);
- if (aEvent.side.isClient()) {
- for (int i = 0; i < intensity / PER_PARTICLE; i++) {
+ if (aEvent.side.isClient()) {
+ ChunkCoordIntPair pair = new ChunkCoordIntPair(aEvent.player.chunkCoordX, aEvent.player.chunkCoordZ);
+ NBTTagCompound compound = data.get(aEvent.player.worldObj.provider.dimensionId).get(pair);
+ if (compound != null) {
+ for (int i = 0, pow = (int)Math.min(32,compound.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) {
TecTech.proxy.em_particle(aEvent.player.worldObj,
aEvent.player.posX - 32D + TecTech.RANDOM.nextFloat() * 64D,
aEvent.player.posY - 32D + TecTech.RANDOM.nextFloat() * 64D,
aEvent.player.posZ - 32D + TecTech.RANDOM.nextFloat() * 64D);
}
}
+
+ data.get(aEvent.player.worldObj.provider.dimensionId).forEach((chunkCoordIntPair, dat) -> {
+ if (Math.abs(chunkCoordIntPair.getCenterXPos() - aEvent.player.posX) + Math.abs(chunkCoordIntPair.getCenterZPosition() - aEvent.player.posZ) < 256) {
+ for (int i = 0, pow = (int)Math.min(32,dat.getDouble(INTENSITY) / PER_PARTICLE); i < pow; i++) {
+ TecTech.proxy.em_particle(aEvent.player.worldObj,
+ (chunkCoordIntPair.chunkXPos << 4) + TecTech.RANDOM.nextFloat() * 48D - 16D,
+ aEvent.player.posY + TecTech.RANDOM.nextFloat() * 128D - 64D,
+ (chunkCoordIntPair.chunkZPos << 4) + TecTech.RANDOM.nextFloat() * 48D - 16D);
+ }
+ }
+ });
}
- data.get(aEvent.player.worldObj.provider.dimensionId).forEach((chunkCoordIntPair, dat) -> {
- for (int i = 0,pow=(int)(dat.getDouble(INTENSITY)/PER_PARTICLE); i < pow; i++) {
- TecTech.proxy.em_particle(aEvent.player.worldObj,
- (chunkCoordIntPair.chunkXPos<<4)+TecTech.RANDOM.nextFloat() * 48D-16D,
- aEvent.player.posY+TecTech.RANDOM.nextFloat() * 128D-64D,
- (chunkCoordIntPair.chunkZPos<<4)+TecTech.RANDOM.nextFloat() * 48D-16D);
- }
- });
}
@Override
@@ -147,6 +149,7 @@ public class AnomalyHandler implements IChunkMetaDataHandler {
}
public void addAnomaly(int world, ChunkCoordIntPair chunk, double amount) {
+ amount=Math.abs(amount);
NBTTagCompound old = TecTech.chunkDataHandler.getChunkData(this, world, chunk);
if (old == null) {
NBTTagCompound data = new NBTTagCompound();
diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
index 14f1bd1296..cd3d1cccd8 100644
--- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
+++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
@@ -28,7 +28,7 @@ public enum CustomItemList implements IItemContainer {
Machine_BuckConverter_IV,Machine_BuckConverter_LuV,Machine_BuckConverter_ZPM,
Machine_BuckConverter_UV,Machine_BuckConverter_UHV,Machine_BuckConverter_UEV,
Machine_BuckConverter_UIV,Machine_BuckConverter_UMV, Machine_BuckConverter_UXV,
- Machine_DebugWriter,Machine_DebugGenny,UnusedStuff,
+ Machine_DebugWriter,Machine_DebugGenny,UnusedStuff, Machine_DebugPollutor,
EMpipe, DATApipe, LASERpipe, rack_Hatch, holder_Hatch, capacitor_Hatch,
eM_dynamomulti4_IV, eM_dynamomulti16_IV, eM_dynamomulti64_IV,
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java
index e3dc732c99..18eb8b8c72 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java
@@ -38,8 +38,8 @@ import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Mult
public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity_Hatch {
private static Textures.BlockIcons.CustomIcon EM_T_SIDES;
private static Textures.BlockIcons.CustomIcon EM_T_ACTIVE;
- private static Textures.BlockIcons.CustomIcon MufflerEM;
- private static Textures.BlockIcons.CustomIcon MufflerEMidle;
+ public static Textures.BlockIcons.CustomIcon MufflerEM;
+ public static Textures.BlockIcons.CustomIcon MufflerEMidle;
private float overflowMatter;
public final float overflowMax;
private final float overflowDisperse;
@@ -159,8 +159,8 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity
aBaseMetaTileEntity.getWorld().updateLightByType(EnumSkyBlock.Block, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord());
}
}
- } else if (aBaseMetaTileEntity.isClientSide() && getBaseMetaTileEntity().isActive()) {
- TecTech.proxy.em_particle(getBaseMetaTileEntity(), getBaseMetaTileEntity().getFrontFacing());
+ } else if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) {
+ TecTech.proxy.em_particle(aBaseMetaTileEntity, aBaseMetaTileEntity.getFrontFacing());
}
super.onPostTick(aBaseMetaTileEntity, aTick);
//DOES NOT CHECK FOR TOO MUCH, it is done only while putting stuff in (OPTIMIZATION!!!)
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
index 2ba49d0849..90e69c4fb7 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java
@@ -1307,8 +1307,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt
eOutputData.clear();
eInputData.clear();
- if (getBaseMetaTileEntity() instanceof BaseTileEntity) {
- ((BaseTileEntity) getBaseMetaTileEntity()).ignoreUnloadedChunks = mMachine;
+ if (aBaseMetaTileEntity instanceof BaseTileEntity) {
+ ((BaseTileEntity) aBaseMetaTileEntity).ignoreUnloadedChunks = mMachine;
}
mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]);
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java
index 4badeb2d7c..3331430cb9 100644
--- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java
@@ -108,7 +108,7 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements IConn
@Override
public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
- if(getBaseMetaTileEntity().isClientSide()){
+ if(aBaseMetaTileEntity.isClientSide()){
NetworkDispatcher.INSTANCE.sendToServer(new PipeActivityMessage.PipeActivityQuery(this));
}
onPostTick(aBaseMetaTileEntity, 31);
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java
new file mode 100644
index 0000000000..d3b6b3aff8
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPollutor.java
@@ -0,0 +1,156 @@
+package com.github.technus.tectech.thing.metaTileEntity.single;
+
+import com.github.technus.tectech.CommonValues;
+import com.github.technus.tectech.TecTech;
+import com.github.technus.tectech.Util;
+import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OverflowElemental;
+import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_Container_DebugPollutor;
+import com.github.technus.tectech.thing.metaTileEntity.single.gui.GT_GUIContainer_DebugPollutor;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.common.GT_Pollution;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+
+import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS;
+
+/**
+ * Created by Tec on 23.03.2017.
+ */
+public class GT_MetaTileEntity_DebugPollutor extends GT_MetaTileEntity_TieredMachineBlock {
+ private static GT_RenderedTexture POLLUTOR;
+ public int pollution=0;
+ public float anomaly=0;
+
+ public GT_MetaTileEntity_DebugPollutor(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 0, "Shit genny broke!");
+ Util.setTier(aTier,this);
+ }
+
+ public GT_MetaTileEntity_DebugPollutor(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 0, aDescription, aTextures);
+ Util.setTier(aTier,this);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_DebugPollutor(mName, mTier, mDescription, mTextures);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister aBlockIconRegister) {
+ super.registerIcons(aBlockIconRegister);
+ POLLUTOR = new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/POLLUTOR"));
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? aActive? new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEM): new GT_RenderedTexture(GT_MetaTileEntity_Hatch_OverflowElemental.MufflerEMidle) : POLLUTOR};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return null;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_DebugPollutor(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_DebugPollutor(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, byte b, ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("ePollution",pollution);
+ aNBT.setFloat("eAnomaly",anomaly);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ pollution=aNBT.getInteger("ePollution");
+ anomaly=aNBT.getFloat("eAnomaly");
+ getBaseMetaTileEntity().setActive(anomaly>0||pollution>0);
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ aBaseMetaTileEntity.setActive(anomaly>0||pollution>0);
+ if (anomaly > 0) {
+ TecTech.anomalyHandler.addAnomaly(aBaseMetaTileEntity,anomaly);
+ }
+ if (pollution > 0) {
+ GT_Pollution.addPollution(aBaseMetaTileEntity, pollution);
+ }
+ } else if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) {
+ for(byte i=0;i<6;i++){
+ if(i!=aBaseMetaTileEntity.getFrontFacing()){
+ TecTech.proxy.em_particle(aBaseMetaTileEntity, i);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ CommonValues.TEC_MARK_GENERAL, mDescription,
+ EnumChatFormatting.BLUE + "Infinite Producer/Consumer",
+ EnumChatFormatting.BLUE + "Since i wanted one..."
+ };
+ }
+
+ @Override
+ public boolean isElectric() {
+ return false;
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java
new file mode 100644
index 0000000000..8db50abd96
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPollutor.java
@@ -0,0 +1,145 @@
+package com.github.technus.tectech.thing.metaTileEntity.single.gui;
+
+import com.github.technus.tectech.Util;
+import com.github.technus.tectech.thing.metaTileEntity.single.GT_MetaTileEntity_DebugPollutor;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.gui.GT_ContainerMetaTile_Machine;
+import gregtech.api.gui.GT_Slot_Holo;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class GT_Container_DebugPollutor
+ extends GT_ContainerMetaTile_Machine {
+ public int pollution =0;
+ public float anomaly =0;
+
+ public GT_Container_DebugPollutor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(aInventoryPlayer, aTileEntity);
+ }
+
+ @Override
+ public void addSlots(InventoryPlayer aInventoryPlayer) {
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 59, false, false, 1));
+
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 59, false, false, 1));
+
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 59, false, false, 1));
+
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 59, false, false, 1));
+ }
+
+ @Override
+ public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) {
+ if (aSlotIndex < 0) {
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ Slot tSlot = (Slot) inventorySlots.get(aSlotIndex);
+ if (tSlot != null && mTileEntity.getMetaTileEntity() != null) {
+ GT_MetaTileEntity_DebugPollutor dpg = (GT_MetaTileEntity_DebugPollutor) mTileEntity.getMetaTileEntity();
+ switch (aSlotIndex) {
+ case 0:
+ dpg.pollution -= aShifthold == 1 ? 512 : 64;
+ break;
+ case 1:
+ dpg.pollution /= aShifthold == 1 ? 512 : 64;
+ break;
+ case 2:
+ dpg.anomaly -= aShifthold == 1 ? 512 : 64;
+ break;
+ case 3:
+ dpg.anomaly /= aShifthold == 1 ? 512 : 64;
+ break;
+ case 4:
+ dpg.pollution -= aShifthold == 1 ? 16 : 1;
+ break;
+ case 5:
+ dpg.pollution /= aShifthold == 1 ? 16 : 2;
+ break;
+ case 6:
+ dpg.anomaly -= aShifthold == 1 ? 16 : 1;
+ break;
+ case 7:
+ dpg.anomaly /= aShifthold == 1 ? 16 : 2;
+ break;
+ case 8:
+ dpg.pollution += aShifthold == 1 ? 512 : 64;
+ break;
+ case 9:
+ dpg.pollution *= aShifthold == 1 ? 512 : 64;
+ break;
+ case 10:
+ dpg.anomaly += aShifthold == 1 ? 512 : 64;
+ break;
+ case 11:
+ dpg.anomaly *= aShifthold == 1 ? 512 : 64;
+ break;
+ case 12:
+ dpg.pollution += aShifthold == 1 ? 16 : 1;
+ break;
+ case 13:
+ dpg.pollution *= aShifthold == 1 ? 16 : 2;
+ break;
+ case 14:
+ dpg.anomaly += aShifthold == 1 ? 16 : 1;
+ break;
+ case 15:
+ dpg.anomaly *= aShifthold == 1 ? 16 : 2;
+ break;
+ default: return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+ return null;
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) {
+ return;
+ }
+
+ GT_MetaTileEntity_DebugPollutor dpg = (GT_MetaTileEntity_DebugPollutor) mTileEntity.getMetaTileEntity();
+ pollution =dpg.pollution;
+ anomaly =dpg.anomaly;
+
+ for (Object crafter : crafters) {
+ ICrafting var1 = (ICrafting) crafter;
+ Util.sendInteger(pollution,this,var1,100);
+ Util.sendFloat(anomaly,this,var1,102);
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 100:
+ case 101:
+ pollution = Util.receiveInteger(pollution,100,par1,par2);
+ break;
+ case 102:
+ case 103:
+ anomaly = Util.receiveFloat(anomaly,102,par1,par2);
+ break;
+ }
+ }
+}
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPollutor.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPollutor.java
new file mode 100644
index 0000000000..39c67f1b50
--- /dev/null
+++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPollutor.java
@@ -0,0 +1,31 @@
+package com.github.technus.tectech.thing.metaTileEntity.single.gui;
+
+import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import net.minecraft.entity.player.InventoryPlayer;
+
+import static gregtech.api.enums.GT_Values.RES_PATH_GUI;
+
+public class GT_GUIContainer_DebugPollutor extends GT_GUIContainerMetaTile_Machine {
+ public GT_GUIContainer_DebugPollutor(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
+ super(new GT_Container_DebugPollutor(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Teleporter.png");
+ }
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ fontRendererObj.drawString("Pollutor", 46, 8, 16448255);
+ if (mContainer != null) {
+ GT_Container_DebugPollutor dpg = (GT_Container_DebugPollutor) mContainer;
+ fontRendererObj.drawString("Pollution: " + dpg.pollution, 46, 24, 16448255);
+ fontRendererObj.drawString("Anomaly: " + dpg.anomaly, 46, 32, 16448255);
+ }
+ }
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ super.drawGuiContainerBackgroundLayer(par1, par2, par3);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+}
diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/POLLUTOR.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/POLLUTOR.png
new file mode 100644
index 0000000000..c8c32d0ab4
--- /dev/null
+++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/POLLUTOR.png
Binary files differ