aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common
diff options
context:
space:
mode:
authorKiwi <42833050+Kiwi233@users.noreply.github.com>2020-12-13 21:24:20 +0800
committerGitHub <noreply@github.com>2020-12-13 21:24:20 +0800
commitd567ee9f63c6e11f2b21f26687cfc2ecaed200a1 (patch)
tree8e4c275624a966c4482b90ad85cda2375c6a63b9 /src/main/java/gregtech/common
parentcec32d0a604156802eee3f9e8fefccb40a62d7ef (diff)
parent7ce77a615de68add2bb0fa71818b3e36241a02a7 (diff)
downloadGT5-Unofficial-d567ee9f63c6e11f2b21f26687cfc2ecaed200a1.tar.gz
GT5-Unofficial-d567ee9f63c6e11f2b21f26687cfc2ecaed200a1.tar.bz2
GT5-Unofficial-d567ee9f63c6e11f2b21f26687cfc2ecaed200a1.zip
Merge pull request #2 from GTNewHorizons/experimental
5.09.33.57
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r--src/main/java/gregtech/common/GT_Client.java49
-rw-r--r--src/main/java/gregtech/common/GT_Pollution.java71
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java5
-rw-r--r--src/main/java/gregtech/common/bees/GT_AlleleBeeSpecies.java14
-rw-r--r--src/main/java/gregtech/common/bees/GT_AlleleHelper.java11
-rw-r--r--src/main/java/gregtech/common/bees/GT_Bee_Mutation.java5
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings6.java2
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Casings8.java6
-rw-r--r--src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java4
-rw-r--r--src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java9
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Arm.java367
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java80
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java158
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java123
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java111
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java4
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java248
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java88
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java120
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java80
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Pump.java2
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java119
-rw-r--r--src/main/java/gregtech/common/covers/GT_Cover_Shutter.java82
-rw-r--r--src/main/java/gregtech/common/entities/GT_EntityFXPollution.java59
-rw-r--r--src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java2
-rw-r--r--src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java2
-rw-r--r--src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java14
-rw-r--r--src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java26
-rw-r--r--src/main/java/gregtech/common/items/GT_VolumetricFlask.java18
-rw-r--r--src/main/java/gregtech/common/misc/GT_ClientPollutionMap.java156
-rw-r--r--src/main/java/gregtech/common/misc/GT_Command.java50
-rw-r--r--src/main/java/gregtech/common/render/GT_PollutionRenderer.java242
-rw-r--r--src/main/java/gregtech/common/render/GT_Renderer_Block.java58
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java86
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java3
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java6
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java11
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java61
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java88
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java42
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java29
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java31
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java103
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java42
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java38
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java99
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java35
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java48
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java192
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java33
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java34
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java34
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java37
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java35
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java44
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java75
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java44
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java35
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java32
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java35
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java85
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java38
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java39
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java63
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java39
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java58
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java30
-rw-r--r--src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java42
70 files changed, 3449 insertions, 693 deletions
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java
index 51f5e30c28..e528323da4 100644
--- a/src/main/java/gregtech/common/GT_Client.java
+++ b/src/main/java/gregtech/common/GT_Client.java
@@ -33,6 +33,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatFileWriter;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.oredict.OreDictionary;
@@ -56,7 +57,8 @@ public class GT_Client extends GT_Proxy
});
}
- private final HashSet mCapeList = new HashSet();
+ private final HashSet<String> mCapeList = new HashSet<>();
+ public final static GT_PollutionRenderer mPollutionRenderer = new GT_PollutionRenderer();
private final GT_CapeRenderer mCapeRenderer;
private final List mPosR;
private final List mPosG;
@@ -247,45 +249,6 @@ public class GT_Client extends GT_Proxy
drawGrid(aEvent, false);
}
- //TODO less bad
- //@SubscribeEvent
- //public void manipulateDensity(EntityViewRenderEvent.FogDensity event) {
- // if(GT_Pollution.mPlayerPollution > (GT_Mod.gregtechproxy.mPollutionSmogLimit)){
- // event.density = (0.15f*(Math.min(GT_Pollution.mPlayerPollution/((float)GT_Mod.gregtechproxy.mPollutionSourRainLimit),1.0f)))+0.1f;
- // event.setCanceled(true);
- // }
- //}
-
- //@SubscribeEvent
- //public void manipulateColor(EntityViewRenderEvent.FogColors event) {
- // if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
- // event.red = 140f/255f;
- // event.green = 80f/255f;
- // event.blue = 40f/255f;
- // }
- //}
-
- //@SubscribeEvent
- //public void manipulateGrassColor(BiomeEvent.GetGrassColor event) {
- // if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
- // event.newColor = 0xD2691E;
- // }
- //}
-
- //@SubscribeEvent
- //public void manipulateWaterColor(BiomeEvent.GetWaterColor event) {
- // if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
- // event.newColor = 0x556B2F;
- // }
- //}
-
- //@SubscribeEvent
- //public void manipulateFoliageColor(BiomeEvent.GetFoliageColor event) {
- // if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
- // event.newColor = 0xCD853F;
- // }
- //}
-
public boolean isServerSide() {
return true;
}
@@ -329,6 +292,8 @@ public class GT_Client extends GT_Proxy
mCapeList.add(tName.toLowerCase());
}
(new Thread(this)).start();
+
+ mPollutionRenderer.preLoad();
}
public void onLoad() {
@@ -730,4 +695,8 @@ public class GT_Client extends GT_Proxy
return 0;
}
}
+
+ public static void recieveChunkPollutionPacket(ChunkCoordIntPair chunk, int pollution) {
+ mPollutionRenderer.processPacket(chunk, pollution);
+ }
}
diff --git a/src/main/java/gregtech/common/GT_Pollution.java b/src/main/java/gregtech/common/GT_Pollution.java
index f25c21f86a..be49e57e4a 100644
--- a/src/main/java/gregtech/common/GT_Pollution.java
+++ b/src/main/java/gregtech/common/GT_Pollution.java
@@ -1,12 +1,18 @@
package gregtech.common;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
+import cpw.mods.fml.common.network.NetworkRegistry;
import gregtech.GT_Mod;
+import gregtech.api.enums.GT_Values;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.net.GT_Packet_Pollution;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@@ -15,6 +21,8 @@ import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.world.ChunkWatchEvent;
import java.util.ArrayList;
import java.util.HashMap;
@@ -64,6 +72,10 @@ public class GT_Pollution {
private final World aWorld;
public static int mPlayerPollution;
+ private static int POLLUTIONPACKET_MINVALUE = 1000;
+
+ private static GT_PollutionEventHandler EVENT_HANDLER;
+
public GT_Pollution(World world){
aWorld=world;
chunkData=dimensionWiseChunkData.get(aWorld.provider.dimensionId);
@@ -72,6 +84,11 @@ public class GT_Pollution {
dimensionWiseChunkData.put(world.provider.dimensionId,chunkData);
}
dimensionWisePollution.put(aWorld.provider.dimensionId,this);
+
+ if (EVENT_HANDLER == null) {
+ EVENT_HANDLER = new GT_PollutionEventHandler();
+ MinecraftForge.EVENT_BUS.register(EVENT_HANDLER);
+ }
}
public static void onWorldTick(TickEvent.WorldTickEvent aEvent){//called from proxy
@@ -130,7 +147,9 @@ public class GT_Pollution {
AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(actualPos.chunkXPos << 4, 0, actualPos.chunkZPos << 4, (actualPos.chunkXPos << 4) + 16, 256, (actualPos.chunkZPos << 4) + 16);
List<EntityLivingBase> tEntitys = aWorld.getEntitiesWithinAABB(EntityLivingBase.class, chunk);
for (EntityLivingBase tEnt : tEntitys) {
- if (!GT_Utility.isWearingFullGasHazmat(tEnt)) {
+ if (tEnt instanceof EntityPlayerMP && ((EntityPlayerMP) tEnt).capabilities.isCreativeMode)
+ continue;
+ if (!(GT_Utility.isWearingFullGasHazmat(tEnt))) {
switch (XSTR_INSTANCE.nextInt(3)) {
default:
tEnt.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, Math.min(tPollution / 1000, 1000), tPollution / 400000));
@@ -148,6 +167,8 @@ public class GT_Pollution {
//AxisAlignedBB chunk = AxisAlignedBB.getBoundingBox(tPos.chunkPosX*16, 0, tPos.chunkPosZ*16, tPos.chunkPosX*16+16, 256, tPos.chunkPosZ*16+16);
//List<EntityLiving> tEntitys = aWorld.getEntitiesWithinAABB(EntityLiving.class, chunk);
for (EntityLivingBase tEnt : tEntitys) {
+ if (tEnt instanceof EntityPlayerMP && ((EntityPlayerMP) tEnt).capabilities.isCreativeMode)
+ continue;
if (!GT_Utility.isWearingFullGasHazmat(tEnt)) {
switch (XSTR_INSTANCE.nextInt(4)) {
default:
@@ -178,15 +199,21 @@ public class GT_Pollution {
}
//Write new pollution to Hashmap !!!
chunkData.get(actualPos)[GTPOLLUTION] = tPollution;
+
+ //Send new value to players nearby
+ if (tPollution > POLLUTIONPACKET_MINVALUE) {
+ NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(aWorld.provider.dimensionId, (actualPos.chunkXPos << 4), 64, (actualPos.chunkZPos << 4), 256);
+ GT_Values.NW.sendToAllAround(new GT_Packet_Pollution(actualPos, tPollution), point);
+ }
}
}
-
+
private static void damageBlock(World world, int x, int y, int z, boolean sourRain){
if (world.isRemote) return;
Block tBlock = world.getBlock(x, y, z);
int tMeta = world.getBlockMetadata(x, y, z);
if (tBlock == Blocks.air || tBlock == Blocks.stone || tBlock == Blocks.sand|| tBlock == Blocks.deadbush)return;
-
+
if (tBlock == Blocks.leaves || tBlock == Blocks.leaves2 || tBlock.getMaterial() == Material.leaves)
world.setBlockToAir(x, y, z);
if (tBlock == Blocks.reeds) {
@@ -199,12 +226,12 @@ public class GT_Pollution {
tBlock.dropBlockAsItem(world, x, y, z, tMeta, 0);
world.setBlockToAir(x, y, z);
}
- if (tBlock == Blocks.waterlily || tBlock == Blocks.wheat || tBlock == Blocks.cactus ||
+ if (tBlock == Blocks.waterlily || tBlock == Blocks.wheat || tBlock == Blocks.cactus ||
tBlock.getMaterial() == Material.cactus || tBlock == Blocks.melon_block || tBlock == Blocks.melon_stem) {
tBlock.dropBlockAsItem(world, x, y, z, tMeta, 0);
world.setBlockToAir(x, y, z);
}
- if (tBlock == Blocks.red_flower || tBlock == Blocks.yellow_flower || tBlock == Blocks.carrots ||
+ if (tBlock == Blocks.red_flower || tBlock == Blocks.yellow_flower || tBlock == Blocks.carrots ||
tBlock == Blocks.potatoes || tBlock == Blocks.pumpkin || tBlock == Blocks.pumpkin_stem) {
tBlock.dropBlockAsItem(world, x, y, z, tMeta, 0);
world.setBlockToAir(x, y, z);
@@ -218,12 +245,12 @@ public class GT_Pollution {
if (tBlock == Blocks.mossy_cobblestone)
world.setBlock(x, y, z, Blocks.cobblestone);
if (tBlock == Blocks.grass || tBlock.getMaterial() == Material.grass )
- world.setBlock(x, y, z, Blocks.dirt);
+ world.setBlock(x, y, z, Blocks.dirt);
if(tBlock == Blocks.farmland || tBlock == Blocks.dirt){
- world.setBlock(x, y, z, Blocks.sand);
+ world.setBlock(x, y, z, Blocks.sand);
}
-
- if(sourRain && world.isRaining() && (tBlock == Blocks.stone || tBlock == Blocks.gravel || tBlock == Blocks.cobblestone) &&
+
+ if(sourRain && world.isRaining() && (tBlock == Blocks.stone || tBlock == Blocks.gravel || tBlock == Blocks.cobblestone) &&
world.getBlock(x, y+1, z) == Blocks.air && world.canBlockSeeTheSky(x, y, z)){
if(tBlock == Blocks.stone){world.setBlock(x, y, z, Blocks.cobblestone); }
else if(tBlock == Blocks.cobblestone){world.setBlock(x, y, z, Blocks.gravel); }
@@ -256,19 +283,22 @@ public class GT_Pollution {
}
public static int getPollution(Chunk ch){
- if(!GT_Mod.gregtechproxy.mPollution)return 0;
+ if(!GT_Mod.gregtechproxy.mPollution)
+ return 0;
HashMap<ChunkCoordIntPair,int[]> dataMap=dimensionWiseChunkData.get(ch.worldObj.provider.dimensionId);
if(dataMap==null || dataMap.get(ch.getChunkCoordIntPair())==null) return 0;
return dataMap.get(ch.getChunkCoordIntPair())[GTPOLLUTION];
}
- public static int getPollution(ChunkCoordIntPair aCh, int aDim){
- if(!GT_Mod.gregtechproxy.mPollution)return 0;
- HashMap<ChunkCoordIntPair,int[]> dataMap=dimensionWiseChunkData.get(aDim);
- if(dataMap==null || dataMap.get(aCh)==null) return 0;
+ public static int getPollution(ChunkCoordIntPair aCh, int aDim) {
+ if (!GT_Mod.gregtechproxy.mPollution)
+ return 0;
+ HashMap<ChunkCoordIntPair, int[]> dataMap = dimensionWiseChunkData.get(aDim);
+ if (dataMap == null || dataMap.get(aCh) == null)
+ return 0;
return dataMap.get(aCh)[GTPOLLUTION];
}
-
+
//Add compatibility with old code
@Deprecated /*Don't use it... too weird way of passing position*/
public static void addPollution(World aWorld, ChunkPosition aPos, int aPollution){
@@ -276,4 +306,15 @@ public class GT_Pollution {
//is just bad especially when that is both used to store ChunkPos and BlockPos depending on context
addPollution(aWorld.getChunkFromBlockCoords(aPos.chunkPosX,aPos.chunkPosZ),aPollution);
}
+
+ public class GT_PollutionEventHandler {
+ @SubscribeEvent
+ public void chunkWatch(ChunkWatchEvent.Watch event) {
+ if (chunkData.containsKey(event.chunk)) {
+ int pollution = chunkData.get(event.chunk)[GTPOLLUTION];
+ if (pollution > POLLUTIONPACKET_MINVALUE)
+ GT_Values.NW.sendToPlayer(new GT_Packet_Pollution(event.chunk, pollution), event.player);
+ }
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 26b971a093..5b762d6d58 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -1490,11 +1490,6 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
aEvent.player.addExhaustion(Math.max(1.0F, tCount / 666.6F));
}
}
- if (aEvent.player.ticksExisted % 10 == 0) {
- int tPollution = 0;
- tPollution = GT_Pollution.getPollution(new ChunkCoordIntPair(aEvent.player.chunkCoordX,aEvent.player.chunkCoordZ), aEvent.player.dimension);
- if(aEvent.player instanceof EntityPlayerMP)GT_Values.NW.sendToPlayer(new GT_Packet_Pollution(tPollution), (EntityPlayerMP) aEvent.player);
- }
}
}
diff --git a/src/main/java/gregtech/common/bees/GT_AlleleBeeSpecies.java b/src/main/java/gregtech/common/bees/GT_AlleleBeeSpecies.java
index 83dc82e6f9..41726b4fc5 100644
--- a/src/main/java/gregtech/common/bees/GT_AlleleBeeSpecies.java
+++ b/src/main/java/gregtech/common/bees/GT_AlleleBeeSpecies.java
@@ -8,9 +8,19 @@ import forestry.apiculture.genetics.alleles.AlleleBeeSpecies;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
+import java.awt.*;
+
public class GT_AlleleBeeSpecies extends AlleleBeeSpecies {
- public GT_AlleleBeeSpecies(String uid, boolean dominant, String unlocalizedName, String authority, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
- super(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor);
+ public GT_AlleleBeeSpecies(String uid,
+ boolean dominant,
+ String unlocalizedName,
+ String authority,
+ String unlocalizedDescription,
+ IClassification branch,
+ String binomial,
+ Color primaryColor,
+ Color secondaryColor) {
+ super(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor.getRGB(), secondaryColor.getRGB());
AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPECIES);
}
diff --git a/src/main/java/gregtech/common/bees/GT_AlleleHelper.java b/src/main/java/gregtech/common/bees/GT_AlleleHelper.java
index cb54f5d4a1..e1db4c2ac0 100644
--- a/src/main/java/gregtech/common/bees/GT_AlleleHelper.java
+++ b/src/main/java/gregtech/common/bees/GT_AlleleHelper.java
@@ -21,7 +21,7 @@ public class GT_AlleleHelper extends AlleleHelper {
private static final String modId = Constants.ID;
- private Map<Class, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
+ private Map<Class<?>, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
public void init() {
if (PluginManager.Module.APICULTURE.isEnabled()) {
@@ -114,12 +114,17 @@ public class GT_AlleleHelper extends AlleleHelper {
}
alleleMaps.put(Boolean.class, booleans);
}
-
+ @SuppressWarnings("unchecked")
public static void initialisation(){
GT_AlleleHelper helper = new GT_AlleleHelper();
try {
- helper.alleleMaps = (Map<Class, Map<?, ? extends IAllele>>) FieldUtils.readField(FieldUtils.getField(AlleleHelper.class,"alleleMaps",true),AlleleHelper.instance,true);
+ helper.alleleMaps = (Map<Class<?>, Map<?, ? extends IAllele>>)
+ FieldUtils.readField(
+ FieldUtils.getField(AlleleHelper.class,"alleleMaps",true),
+ AlleleHelper.instance,
+ true
+ );
} catch (IllegalAccessException e) {
e.printStackTrace();
}
diff --git a/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java b/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java
index 7b61505fc7..ca919e7cf2 100644
--- a/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java
+++ b/src/main/java/gregtech/common/bees/GT_Bee_Mutation.java
@@ -16,7 +16,7 @@ import java.util.List;
public class GT_Bee_Mutation extends BeeMutation {
- private float split = 1;
+ private final float split;
public GT_Bee_Mutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance, float split) {
super(bee0, bee1, result, chance);
@@ -52,6 +52,7 @@ public class GT_Bee_Mutation extends BeeMutation {
return processedChance;
}
+ @SuppressWarnings("unchecked")
private float getBasicChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
float mutationChance = this.getBaseChance();
List<IMutationCondition> mutationConditions = null;
@@ -61,7 +62,7 @@ public class GT_Bee_Mutation extends BeeMutation {
if (f == null)
return mutationChance;
try {
- mutationConditions = f.get(this) instanceof List ? (List) f.get(this) : null;
+ mutationConditions = f.get(this) instanceof List ? (List<IMutationCondition>) f.get(this) : null;
} catch (IllegalAccessException e) {
e.printStackTrace();
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java
index 2cba79d6e3..d7e8ad23f0 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java
@@ -26,7 +26,7 @@ public class GT_Block_Casings6
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".5.name", "Hermetic Casing V");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Hermetic Casing VI");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Hermetic Casing VII");
- GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Hermetic Casing VII");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Hermetic Casing VIII");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Hermetic Casing IX");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Hermetic Casing X");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Hermetic Casing XI");
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
index 8d2c976b1b..0f3aac4518 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java
@@ -15,18 +15,20 @@ public class GT_Block_Casings8
//WATCH OUT FOR TEXTURE ID's
public GT_Block_Casings8() {
super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE);
- for (int i = 0; i < 4; i = (i + 1)) {
+ for (int i = 0; i < 5; i = (i + 1)) {
Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i);
}
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".2.name", "Mining Neutronium Casing");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".3.name", "Mining Black Plutonium Casing");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".4.name", "Extreme Engine Intake Casing");
ItemList.Casing_Chemically_Inert.set(new ItemStack(this, 1, 0));
ItemList.Casing_Pipe_Polytetrafluoroethylene.set(new ItemStack(this, 1, 1));
ItemList.Casing_MiningNeutronium.set(new ItemStack(this, 1, 2));
ItemList.Casing_MiningBlackPlutonium.set(new ItemStack(this, 1, 3));
+ ItemList.Casing_ExtremeEngineIntake.set(new ItemStack(this, 1, 4));
}
@Override
@@ -41,6 +43,8 @@ public class GT_Block_Casings8
return Textures.BlockIcons.MACHINE_CASING_MINING_NEUTRONIUM.getIcon();
case 3:
return Textures.BlockIcons.MACHINE_CASING_MINING_BLACKPLUTONIUM.getIcon();
+ case 4:
+ return Textures.BlockIcons.MACHINE_CASING_EXTREME_ENGINE_INTAKE.getIcon();//changed color in a terrible way
}
return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
}
diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java
index 32ce6e78f9..ec31cb212c 100644
--- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java
+++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java
@@ -55,6 +55,7 @@ public class GT_Block_Reinforced extends GT_Generic_Block {
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Titanium Reinforced Block");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Naquadah Reinforced Block");
GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Neutronium Reinforced Block");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Raw Deep Dark Portal Block");
ItemList.Block_BronzePlate.set(new ItemStack(this.setHardness(60.0f).setResistance(150.0f), 1, 0));
ItemList.Block_IridiumTungstensteel.set(new ItemStack(this.setHardness(400.0f).setResistance(600.0f), 1, 1));
ItemList.Block_Plascrete.set(new ItemStack(this.setHardness(40.0f).setResistance(100.0f), 1, 2));
@@ -67,6 +68,7 @@ public class GT_Block_Reinforced extends GT_Generic_Block {
ItemList.Block_TitaniumPlate.set(new ItemStack(this.setHardness(200.0f).setResistance(300.0f), 1, 9));
ItemList.Block_NaquadahPlate.set(new ItemStack(this.setHardness(500.0f).setResistance(1000.0f), 1, 10));
ItemList.Block_NeutroniumPlate.set(new ItemStack(this.setHardness(750.0f).setResistance(2500.0f), 1, 11));
+ ItemList.Block_BedrockiumCompressed.set(new ItemStack(this.setHardness(1500.0f).setResistance(5000.0f), 1, 12));
//GT_ModHandler.addCraftingRecipe(ItemList.Block_BronzePlate.get(1L, new Object[0]),GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"hP ", "PBP", " P ", 'P', OrePrefixes.plate.get(Materials.Bronze), 'B', OrePrefixes.stone.get(Materials.GraniteBlack)});
//GT_ModHandler.addCraftingRecipe(ItemList.Block_BronzePlate.get(1L, new Object[0]),GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"hP ", "PBP", " P ", 'P', OrePrefixes.plate.get(Materials.Bronze), 'B', OrePrefixes.stone.get(Materials.GraniteRed)});
//GT_ModHandler.addCraftingRecipe(ItemList.Block_IridiumTungstensteel.get(1L, new Object[0]),GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"hBP", 'P', OrePrefixes.plate.get(Materials.Iridium), 'B', ItemList.Block_TungstenSteelReinforced.get(1L, new Object[0])});
@@ -116,6 +118,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block {
return Textures.BlockIcons.BLOCK_NAQUADAHPREIN.getIcon();
case 11:
return Textures.BlockIcons.BLOCK_NEUTRONIUMPREIN.getIcon();
+ case 12:
+ return Textures.BlockIcons.BLOCK_DEEP_DARK_RAW.getIcon();
}
}
return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java
index 6c4a03420d..2eb100599b 100644
--- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java
+++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java
@@ -132,7 +132,14 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit
public Packet getDescriptionPacket() {
if (!this.worldObj.isRemote) {
- if ((this.mBlocked == (GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord + 1, this.yCoord, this.zCoord)) && (GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord - 1, this.yCoord, this.zCoord)) && (GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord)) && (GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord - 1, this.zCoord)) && (GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord + 1)) && (GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord - 1)) ? 1 : 0) == 0) {
+ if (!(this.mBlocked = (
+ GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord + 1, this.yCoord, this.zCoord) &&
+ GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord - 1, this.yCoord, this.zCoord) &&
+ GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord) &&
+ GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord - 1, this.zCoord) &&
+ GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord + 1) &&
+ GT_Utility.isOpaqueBlock(this.worldObj, this.xCoord, this.yCoord, this.zCoord - 1)
+ ))) {
GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, new GT_Packet_Ores(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), this.xCoord, this.zCoord);
}
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java
index 70d0340d1f..77558e001d 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Arm.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Arm.java
@@ -1,58 +1,162 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiFakeItemButton;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconButton;
+import gregtech.api.gui.widgets.GT_GuiIntegerTextBox;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IMachineProgress;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid;
public class GT_Cover_Arm
extends GT_CoverBehavior {
public final int mTickRate;
+ //msb converted, 2nd : direction (1=export)
+ //right 14 bits: internalSlot, next 14 bits adjSlot, 0 = all, slot = -1
+ protected final static int EXPORT_MASK = 0x40000000;
+ protected final static int SLOT_ID_MASK = 0x3FFF;
+ protected final static int SLOT_ID_MIN = 0;
+ protected final static int CONVERTED_BIT = 0x80000000;
public GT_Cover_Arm(int aTickRate) {
this.mTickRate = aTickRate;
}
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
- if ((aCoverVariable == 0) || (((aTileEntity instanceof IMachineProgress)) && (!((IMachineProgress) aTileEntity).isAllowedToWork()))) {
+ if ((((aTileEntity instanceof IMachineProgress)) && (!((IMachineProgress) aTileEntity).isAllowedToWork()))) {
return aCoverVariable;
}
- TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(aSide);
- //aTileEntity.decreaseStoredEnergyUnits(1L, true);
+
+ //Convert from ver. 5.09.33.50, check if 3 last bits are equal
+ if ((aCoverVariable >>> 29) == 0) {
+ aCoverVariable = CONVERTED_BIT | (((aCoverVariable+1) & SLOT_ID_MASK) << 14) | EXPORT_MASK;
+ } else if ((aCoverVariable >>> 29) == 7) {
+ aCoverVariable = CONVERTED_BIT | Math.min(Math.abs(aCoverVariable-1), SLOT_ID_MASK);
+ }
+
+ boolean usePower = false;
if (aTileEntity.getUniversalEnergyCapacity() >= 128L) {
if (aTileEntity.isUniversalEnergyStored(256L)) {
- aTileEntity.decreaseStoredEnergyUnits(4 * GT_Utility.moveOneItemStackIntoSlot(aCoverVariable > 0 ? aTileEntity : tTileEntity, aCoverVariable > 0 ? tTileEntity : aTileEntity, aCoverVariable > 0 ? aSide : GT_Utility.getOppositeSide(aSide), Math.abs(aCoverVariable) - 1, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1), true);
+ usePower = true;
+ } else {
+ return aCoverVariable;
}
+ }
+
+ TileEntity toTile, fromTile;
+ int toSlot, fromSlot;
+
+ if ((aCoverVariable & EXPORT_MASK) > 0) {
+ fromTile = (TileEntity) aTileEntity;
+ toTile = aTileEntity.getTileEntityAtSide(aSide);
+ fromSlot = aCoverVariable & SLOT_ID_MASK;
+ toSlot = (aCoverVariable>>14) & SLOT_ID_MASK;
} else {
- GT_Utility.moveOneItemStackIntoSlot(aCoverVariable > 0 ? aTileEntity : tTileEntity, aCoverVariable > 0 ? tTileEntity : aTileEntity, aCoverVariable > 0 ? aSide : GT_Utility.getOppositeSide(aSide), Math.abs(aCoverVariable) - 1, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ fromTile = aTileEntity.getTileEntityAtSide(aSide);
+ toTile = (TileEntity) aTileEntity;
+ fromSlot = (aCoverVariable>>14) & SLOT_ID_MASK;
+ toSlot = aCoverVariable & SLOT_ID_MASK;
}
+
+ byte movedItems = 0;
+ if(fromSlot > 0 && toSlot > 0) {
+ if (fromTile instanceof IInventory && toTile instanceof IInventory)
+ movedItems = GT_Utility.moveFromSlotToSlot((IInventory) fromTile, (IInventory) toTile, fromSlot-1, toSlot-1, null, false, (byte)64, (byte)1, (byte)64, (byte)1);
+ } else if (toSlot > 0) {
+ byte side;
+ if ((aCoverVariable & EXPORT_MASK) > 0)
+ side = aSide;
+ else
+ side = GT_Utility.getOppositeSide(aSide);
+ movedItems = GT_Utility.moveOneItemStackIntoSlot(fromTile, toTile, side, toSlot-1, null, false, (byte)64, (byte)1, (byte)64, (byte)1);
+ } else if (fromSlot > 0) {
+ byte toSide;
+ if ((aCoverVariable & EXPORT_MASK) > 0)
+ toSide = aSide;
+ else
+ toSide = GT_Utility.getOppositeSide(aSide);
+ if (fromTile instanceof IInventory)
+ movedItems = GT_Utility.moveFromSlotToSide((IInventory) fromTile, toTile, fromSlot-1, toSide, null, false, (byte)64, (byte)1, (byte)64, (byte)1);
+ } else {
+ byte fromSide, toSide;
+ if ((aCoverVariable & EXPORT_MASK) > 0) {
+ fromSide = aSide;
+ toSide = GT_Utility.getOppositeSide(aSide);
+ } else {
+ fromSide = GT_Utility.getOppositeSide(aSide);
+ toSide = aSide;
+ }
+ movedItems = GT_Utility.moveOneItemStack(fromTile, toTile, fromSide, toSide, null, false, (byte)64, (byte)1, (byte)64, (byte)1);
+ }
+
+ if (usePower)
+ aTileEntity.decreaseStoredEnergyUnits(4*movedItems, true);
+
return aCoverVariable;
}
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ int step = 0;
if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
- aCoverVariable += aPlayer.isSneaking() ? 256 : 16;
+ step += aPlayer.isSneaking() ? 256 : 16;
} else {
- aCoverVariable += aPlayer.isSneaking() ? 256 : 16;
+ step -= aPlayer.isSneaking() ? 256 : 16;
}
- GT_Utility.sendChatToPlayer(aPlayer, (aCoverVariable > 0 ? trans("001","Puts out into adjacent Slot #") : trans("002","Grabs in for own Slot #")) + (Math.abs(aCoverVariable) - 1));
+ aCoverVariable = getNewVar(aCoverVariable, step);
+ sendMessageToPlayer(aPlayer, aCoverVariable);
return aCoverVariable;
}
public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) {
- aCoverVariable++;
- } else {
- aCoverVariable--;
- }
- GT_Utility.sendChatToPlayer(aPlayer, (aCoverVariable > 0 ? trans("001","Puts out into adjacent Slot #") : trans("002","Grabs in for own Slot #")) + (Math.abs(aCoverVariable) - 1));
+ int step = (GT_Utility.getClickedFacingCoords(aSide, aX, aY, aZ)[0] >= 0.5F) ? 1 : -1;
+ aCoverVariable = getNewVar(aCoverVariable, step);
+ sendMessageToPlayer(aPlayer, aCoverVariable);
aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
return true;
}
+ private void sendMessageToPlayer(EntityPlayer aPlayer, int var) {
+ if ((var & EXPORT_MASK) != 0)
+ GT_Utility.sendChatToPlayer(aPlayer, trans("001","Puts out into adjacent Slot #") + (((var >> 14) & SLOT_ID_MASK) - 1));
+ else
+ GT_Utility.sendChatToPlayer(aPlayer, trans("002","Grabs in for own Slot #") + ((var & SLOT_ID_MASK) - 1));
+ }
+
+ private int getNewVar(int var, int step) {
+ int intSlot = (var & SLOT_ID_MASK);
+ int adjSlot = (var >> 14) & SLOT_ID_MASK;
+ if ((var & EXPORT_MASK) == 0) {
+ int x = (intSlot + step);
+ if (x > SLOT_ID_MASK )
+ return createVar(0, SLOT_ID_MASK, 0);
+ else if (x < 1)
+ return createVar(-step - intSlot + 1, 0, EXPORT_MASK);
+ else
+ return createVar(0, x, 0);
+ } else {
+ int x = (adjSlot - step);
+ if (x > SLOT_ID_MASK)
+ return createVar(SLOT_ID_MASK, 0, EXPORT_MASK);
+ else if (x < 1)
+ return createVar(0, +step - adjSlot + 1, 0);
+ else
+ return createVar(x, 0, EXPORT_MASK);
+ }
+ }
+
+ private int createVar(int adjSlot, int intSlot, int export){
+ return CONVERTED_BIT | export | ((adjSlot & SLOT_ID_MASK) << 14) | (intSlot & SLOT_ID_MASK);
+ }
+
public boolean letsRedstoneGoIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return true;
}
@@ -92,4 +196,239 @@ public class GT_Cover_Arm
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return this.mTickRate;
}
+
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GT_Cover_Arm.GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private GT_GuiIntegerTextBox intSlot, adjSlot;
+ private GT_GuiFakeItemButton intSlotIcon, adjSlotIcon;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ private final String ANY_TEXT = trans("ANY", "Any");
+
+ private boolean export;
+ private int internalSlotID, adjacentSlotID;
+
+ private final int maxIntSlot, maxAdjSlot;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ export = (coverVariable & EXPORT_MASK) > 0;
+ internalSlotID = (coverVariable & SLOT_ID_MASK);
+ adjacentSlotID = (coverVariable >> 14) & SLOT_ID_MASK;
+
+ new GT_GuiIconButton(this, 0, startX + spaceX * 0, startY + spaceY * 0, GT_GuiIcon.EXPORT).setTooltipText(trans("006", "Export"));
+ new GT_GuiIconButton(this, 1, startX + spaceX * 1, startY + spaceY * 0, GT_GuiIcon.IMPORT).setTooltipText(trans("007", "Import"));
+
+ intSlot = new GT_GuiIntegerTextBox(this, 2, startX + spaceX * 0, startY + spaceY * 1 + 2, spaceX * 2+5, 12);
+ setBoxText(intSlot, internalSlotID-1);
+ intSlot.setMaxStringLength(6);
+
+ adjSlot = new GT_GuiIntegerTextBox(this, 3, startX + spaceX * 0, startY + spaceY * 2 + 2, spaceX * 2+5, 12);
+ setBoxText(adjSlot, adjacentSlotID-1);
+ adjSlot.setMaxStringLength(6);
+
+ //intSlotIcon = new GT_GuiFakeItemButton(this, startX + spaceX * 8-4, startY + spaceY * 1, GT_GuiIcon.SLOT_GRAY);
+ //adjSlotIcon = new GT_GuiFakeItemButton(this, startX + spaceX * 8-4, startY + spaceY * 2, GT_GuiIcon.SLOT_GRAY);
+
+ if (super.tile instanceof TileEntity && !super.tile.isDead()) {
+ maxIntSlot = tile.getSizeInventory()-1;
+
+ TileEntity adj = super.tile.getTileEntityAtSide(side);
+ if (adj instanceof IInventory)
+ maxAdjSlot = ((IInventory) adj).getSizeInventory()-1;
+ else
+ maxAdjSlot = -1;
+ } else {
+ maxIntSlot = -1;
+ maxAdjSlot = -1;
+ }
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ if (export)
+ this.getFontRenderer().drawString(trans("006", "Export"), startX + spaceX*3, 4+startY+spaceY*0, 0xFF555555);
+ else
+ this.getFontRenderer().drawString(trans("007", "Import"), startX + spaceX*3, 4+startY+spaceY*0, 0xFF555555);
+
+ this.getFontRenderer().drawString(trans("254", "Internal slot#"), startX + spaceX*3, 4+startY+spaceY*1, 0xFF555555);
+ this.getFontRenderer().drawString(trans("255", "Adjacent slot#"), startX + spaceX*3, 4+startY+spaceY*2, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ intSlot.setFocused(true);
+ updateButtons();
+
+ //updateInventorySlots();
+ }
+
+ @Override
+ public void buttonClicked(GuiButton btn) {
+ if (buttonClickable(btn.id)) {
+ export = btn.id == 0;
+ coverVariable = getNewCoverVariable();
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons() {
+ GuiButton b;
+ for (Object o : buttonList) {
+ b = (GuiButton) o;
+ b.enabled = buttonClickable(b.id);
+ }
+ }
+
+ @Override
+ public void onMouseWheel(int x, int y, int delta) {
+ for (GT_GuiIntegerTextBox box : textBoxes) {
+ if (box.isFocused()) {
+ int step = Math.max(1, Math.abs(delta / 120));
+ step = (isShiftKeyDown() ? 50 : isCtrlKeyDown() ? 5 : 1) * (delta > 0 ? step : -step);
+ int maxSlot = box.id == 3 ? maxAdjSlot : maxIntSlot;
+ int val = parseTextBox(box, maxSlot);
+ if (val < 0)
+ val = -1;
+ val = val + step;
+
+ if (maxSlot < val)
+ if (maxSlot < 0)
+ val = -1;
+ else
+ val = maxSlot;
+ else if (val < SLOT_ID_MIN)
+ val = -1;
+
+ setBoxText(box, val);
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void applyTextBox(GT_GuiIntegerTextBox box) {
+ int val = -1;
+
+ if (box.id == 2) {
+ val = parseTextBox(box, maxIntSlot);
+ internalSlotID = val+1;
+ }
+ else if (box.id == 3) {
+ val = parseTextBox(box, maxAdjSlot);
+ adjacentSlotID = val+1;
+ }
+
+ setBoxText(box, val);
+ coverVariable = getNewCoverVariable();
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ //updateInventorySlots();
+ }
+
+ @Override
+ public void resetTextBox(GT_GuiIntegerTextBox box) {
+ int val = 0;
+ if (box.id == 2)
+ val = internalSlotID-1;
+ else if (box.id == 3)
+ val = adjacentSlotID-1;
+ setBoxText(box, val);
+ }
+
+ private void setBoxText(GT_GuiIntegerTextBox box, int val) {
+ box.setText( val < 0 ? ANY_TEXT : String.valueOf(val));
+ }
+
+ private int parseTextBox(GT_GuiIntegerTextBox box, int maxSlot) {
+ String text = box.getText();
+ if (text == null)
+ return -1;
+ text = text.trim();
+ if (text.startsWith(ANY_TEXT))
+ text = text.substring(ANY_TEXT.length());
+
+ if (text.isEmpty())
+ return -1;
+
+ int val;
+ try {
+ val = Integer.parseInt(text);
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+
+ if (maxSlot < val)
+ if (maxSlot < 0)
+ return -1;
+ else
+ return maxSlot;
+ else if (val < SLOT_ID_MIN)
+ return SLOT_ID_MIN;
+ return val;
+ }
+
+ private int getNewCoverVariable() {
+ return (export ? EXPORT_MASK : 0) | ((adjacentSlotID & SLOT_ID_MASK) << 14) | (internalSlotID & SLOT_ID_MASK) | CONVERTED_BIT;
+ }
+
+ private boolean buttonClickable(int id) {
+ if (id == 0)
+ return !export;
+ return export;
+ }
+
+// getStackInSlot wasn't available client side..
+// private void updateInventorySlots() {
+// updateInventorySlot(intSlotIcon, internalSlotID, true);
+// updateInventorySlot(adjSlotIcon, adjacentSlotID, false);
+// }
+//
+// private void updateInventorySlot(GT_GuiFakeItemButton button, int slotID, boolean internal) {
+// if (slotID == SLOT_ID_ANY) {
+// button.setItem(null);
+// return;
+// }
+//
+// if (super.tile instanceof TileEntity && !super.tile.isDead()) {
+// TileEntity tile;
+// if (internal)
+// tile = (TileEntity) super.tile;
+// else
+// tile = super.tile.getTileEntityAtSide(side);
+//
+// if (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() >= slotID) {
+// ItemStack item = ((IInventory) tile).getStackInSlot(slotID);
+// button.setItem(item);
+// return;
+// }
+// }
+// button.setItem(null);
+// }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java
index 96a2d4a2b8..9624b68464 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_ControlsWork.java
@@ -1,9 +1,15 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconButton;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IMachineProgress;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fluids.Fluid;
@@ -70,4 +76,78 @@ public class GT_Cover_ControlsWork
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 1;
}
+
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GT_Cover_ControlsWork.GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ GuiButton b;
+ b = new GT_GuiIconButton(this, 0, startX + spaceX * 0, startY + spaceY * 0, GT_GuiIcon.REDSTONE_ON);
+ b = new GT_GuiIconButton(this, 1, startX + spaceX * 0, startY + spaceY * 1, GT_GuiIcon.REDSTONE_OFF);
+ b = new GT_GuiIconButton(this, 2, startX + spaceX * 0, startY + spaceY * 2, GT_GuiIcon.CROSS);
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ this.fontRendererObj.drawString(trans("243", "Enable with Redstone"), 3+startX + spaceX*1, 4+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString(trans("244", "Disable with Redstone"),3+startX + spaceX*1, 4+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString(trans("245", "Disable machine"), 3+startX + spaceX*1, 4+startY+spaceY*2, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn) {
+ if (getClickable(btn.id)) {
+ coverVariable = getNewCoverVariable(btn.id);
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons() {
+ GuiButton b;
+ for (Object o : buttonList) {
+ b = (GuiButton) o;
+ b.enabled = getClickable(b.id);
+ }
+ }
+
+ private int getNewCoverVariable(int id) {
+ return id;
+ }
+
+ private boolean getClickable(int id) {
+ return id != coverVariable;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java
index d781f10915..aee46b7aab 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Conveyor.java
@@ -1,13 +1,21 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconButton;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IMachineProgress;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid;
+import static gregtech.api.util.GT_Utility.moveMultipleItemStacks;
+
public class GT_Cover_Conveyor extends GT_CoverBehavior {
public final int mTickRate;
private final int mMaxStacks;
@@ -36,19 +44,29 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior {
boolean costsEnergy = ((aCoverVariable % 2 == 0) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= 128L);
byte moved;
- for(int i=0 ; i < this.mMaxStacks ; i++) {
- // Costs energy but we don't have enough, bail
- if ((costsEnergy && !aTileEntity.isUniversalEnergyStored(256L)))
- break;
- moved = GT_Utility.moveOneItemStack(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ if (costsEnergy) {
+ long tStoredEnergy = aTileEntity.getUniversalEnergyStored();
+ int tMaxStacks = (int)(tStoredEnergy/(4*64*this.mMaxStacks));
+ if (tMaxStacks > this.mMaxStacks)
+ tMaxStacks = this.mMaxStacks;
+ int tCost = moveMultipleItemStacks(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,tMaxStacks);
+ aTileEntity.decreaseStoredEnergyUnits(4 * tCost, true);
+ } else {
+ moveMultipleItemStacks(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,this.mMaxStacks);
+ }
- if(moved == 0)
- break;
- if (costsEnergy)
- aTileEntity.decreaseStoredEnergyUnits(4 * moved, true);
- }
+// for(int i=0 ; i < this.mMaxStacks ; i++) {
+// // Costs energy but we don't have enough, bail
+// if ((costsEnergy && !aTileEntity.isUniversalEnergyStored(256L)))
+// break;
+//
+// moved = GT_Utility.moveOneItemStack(fromEntity, toEntity, fromSide , toSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+//
+// if(moved == 0)
+// break;
+// }
return aCoverVariable;
}
@@ -112,4 +130,124 @@ public class GT_Cover_Conveyor extends GT_CoverBehavior {
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return this.mTickRate;
}
+
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GT_Cover_Conveyor.GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ GT_GuiIconButton b;
+ b = new GT_GuiIconButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.EXPORT).setTooltipText(trans("006","Export"));
+ b = new GT_GuiIconButton(this, 1, startX + spaceX*1, startY+spaceY*0, GT_GuiIcon.IMPORT).setTooltipText(trans("007","Import"));
+ b = new GT_GuiIconButton(this, 2, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.CHECKMARK).setTooltipText(trans("224","Ignore"));
+ b = new GT_GuiIconButton(this, 3, startX + spaceX*1, startY+spaceY*1, GT_GuiIcon.REDSTONE_ON).setTooltipText(trans("225","Conditional"));
+ b = new GT_GuiIconButton(this, 4, startX + spaceX*2, startY+spaceY*1, GT_GuiIcon.REDSTONE_OFF).setTooltipText(trans("226","Invert Condition"));
+ b = new GT_GuiIconButton(this, 5, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.ALLOW_INPUT).setTooltipText(trans("227","Allow Input"));
+ b = new GT_GuiIconButton(this, 6, startX + spaceX*1, startY+spaceY*2, GT_GuiIcon.BLOCK_INPUT).setTooltipText(trans("228","Block Input"));
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ this.fontRendererObj.drawString(trans("229","Import/Export" ), startX + spaceX*3, 3+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString(trans("230","Conditional"), startX + spaceX*3, 3+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString(trans("231", "Enable Input"), startX + spaceX*3, 3+startY+spaceY*2, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn){
+ if (getClickable(btn.id)){
+ coverVariable = getNewCoverVariable(btn.id);
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons(){
+ GuiButton b;
+ for (Object o : buttonList) {
+ b = (GuiButton) o;
+ b.enabled = getClickable(b.id);
+ }
+ }
+
+ private int getNewCoverVariable(int id) {
+ switch (id) {
+ case 0:
+ return coverVariable & ~0x1;
+ case 1:
+ return coverVariable | 0x1;
+ case 2:
+ if (coverVariable > 5)
+ return 0x6 | (coverVariable & ~0xE);
+ return (coverVariable & ~0xE);
+ case 3:
+ if (coverVariable > 5)
+ return 0x8 | (coverVariable & ~0xE);
+ return 0x2 | (coverVariable & ~0xE);
+ case 4:
+ if (coverVariable > 5)
+ return 0xA | (coverVariable & ~0xE);
+ return (0x4 | (coverVariable & ~0xE));
+ case 5:
+ if (coverVariable <= 5)
+ return coverVariable + 6;
+ break;
+ case 6:
+ if (coverVariable > 5)
+ return coverVariable - 6;
+ }
+ return coverVariable;
+ }
+
+ private boolean getClickable(int id) {
+ if (coverVariable < 0 | 11 < coverVariable)
+ return false;
+
+ switch (id) {
+ case 0: case 1:
+ return (0x1 & coverVariable) != id;
+ case 2:
+ return (coverVariable % 6) >= 2;
+ case 3:
+ return (coverVariable % 6) < 2 | 4 <= (coverVariable % 6);
+ case 4:
+ return (coverVariable % 6) < 4;
+ case 5:
+ return coverVariable < 6;
+ case 6:
+ return coverVariable >= 6;
+ }
+ return false;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java
index 963b519f34..f2a37dd3cc 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_DoesWork.java
@@ -1,9 +1,16 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconButton;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IMachineProgress;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fluids.Fluid;
@@ -31,10 +38,10 @@ public class GT_Cover_DoesWork
aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % 4;
if(aCoverVariable <0){aCoverVariable = 3;}
switch(aCoverVariable) {
- case 0: GT_Utility.sendChatToPlayer(aPlayer, trans("018", "Normal")); break;
- case 1: GT_Utility.sendChatToPlayer(aPlayer, trans("019", "Inverted")); break;
- case 2: GT_Utility.sendChatToPlayer(aPlayer, trans("020", "Ready to work")); break;
- case 3: GT_Utility.sendChatToPlayer(aPlayer, trans("021", "Not ready to work")); break;
+ case 0: GT_Utility.sendChatToPlayer(aPlayer, trans("018", "Normal")); break; // Progress scaled
+ case 1: GT_Utility.sendChatToPlayer(aPlayer, trans("019", "Inverted")); break; // ^ inverted
+ case 2: GT_Utility.sendChatToPlayer(aPlayer, trans("020", "Ready to work")); break; // Not Running
+ case 3: GT_Utility.sendChatToPlayer(aPlayer, trans("021", "Not ready to work")); break; // Running
}
return aCoverVariable;
}
@@ -70,4 +77,112 @@ public class GT_Cover_DoesWork
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 5;
}
+
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GT_Cover_DoesWork.GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ GuiButton b;
+ b = new GT_GuiIconButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.PROGRESS);
+ b = new GT_GuiIconButton(this, 1, startX + spaceX*1, startY+spaceY*0, GT_GuiIcon.CHECKMARK);
+ b = new GT_GuiIconCheckButton(this, 2, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.REDSTONE_ON, GT_GuiIcon.REDSTONE_OFF);
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ String s1, s2;
+ if ((coverVariable & 0x2) > 0)
+ s1 = trans("242", "Machine idle");
+ else
+ s1 = trans("241", "Recipe progress");
+ if ((coverVariable & 0x1) > 0)
+ s2 = trans("INVERTED","Inverted");
+ else
+ s2 = trans("NORMAL","Normal");
+ this.fontRendererObj.drawString(s1, startX + spaceX*3, 4+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString(s2, startX + spaceX*3, 4+startY+spaceY*1, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn){
+ if (getClickable(btn.id)){
+ boolean state = false;
+ if (btn.id == 2)
+ state = ((GT_GuiIconCheckButton) btn).isChecked();
+
+ coverVariable = getNewCoverVariable(btn.id, state);
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons(){
+ GuiButton b;
+ for (Object o : buttonList) {
+ b = (GuiButton) o;
+ if(b.id == 2){
+ ((GT_GuiIconCheckButton) b).setChecked((coverVariable & 0x1) > 0);
+ } else {
+ b.enabled = getClickable(b.id);
+ }
+ }
+ }
+
+ private int getNewCoverVariable(int id, boolean buttonState) {
+ switch (id) {
+ case 0:
+ return coverVariable & ~0x2;
+ case 1:
+ return coverVariable | 0x2;
+ case 2:
+ if (buttonState)
+ return coverVariable & ~0x1;
+ return coverVariable | 0x1;
+ }
+ return coverVariable;
+ }
+
+ private boolean getClickable(int id) {
+ switch (id) {
+ case 0:
+ return (coverVariable & 0x2) > 0;
+ case 1:
+ return (coverVariable & 0x2) == 0;
+ case 2:
+ return true;
+ }
+ return false;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java
index 13aafe90df..d12034d3a7 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_EUMeter.java
@@ -1,14 +1,20 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaBase_Item;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
import ic2.api.item.IElectricItem;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
@@ -141,4 +147,109 @@ public class GT_Cover_EUMeter
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 20;
}
+
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ GuiButton b;
+ b = new GT_GuiIconCheckButton(this, 0, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("256", "Universal Storage"));
+ b = new GT_GuiIconCheckButton(this, 1, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("257", "Electricity Storage"));
+ b = new GT_GuiIconCheckButton(this, 2, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("258", "Steam Storage"));
+ b = new GT_GuiIconCheckButton(this, 3, startX + spaceX*4, startY+spaceY*1, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("259", "Average Electric Input"));
+ b = new GT_GuiIconCheckButton(this, 4, startX + spaceX*4, startY+spaceY*2, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("260", "Average Electric Output"));
+ b = new GT_GuiIconCheckButton(this, 5, startX + spaceX*4, startY+spaceY*0, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("261", "Electricity Storage(Including Batteries)"));
+ b = new GT_GuiIconCheckButton(this, 6, startX + spaceX*0, startY+spaceY*3+4, GT_GuiIcon.REDSTONE_ON, GT_GuiIcon.REDSTONE_OFF);
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ String s2;
+ if ((coverVariable & 0x1) > 0)
+ s2 = trans("INVERTED","Inverted");
+ else
+ s2 = trans("NORMAL","Normal");
+ this.fontRendererObj.drawString(s2, startX + spaceX*1, 8+startY+spaceY*3, 0xFF555555);
+
+ this.fontRendererObj.drawString("Universal",
+ startX + spaceX*1, 4+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString("Int. EU",
+ startX + spaceX*1, 4+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString("Steam",
+ startX + spaceX*1, 4+startY+spaceY*2, 0xFF555555);
+ this.fontRendererObj.drawString("Avg. Input",
+ startX + spaceX*5, 4+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString("Avg. Output",
+ startX + spaceX*5, 4+startY+spaceY*2, 0xFF555555);
+ this.fontRendererObj.drawString("EU stored",
+ startX + spaceX*5, 4+startY+spaceY*0, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn){
+ if (btn.id == 6 || !isEnabled(btn.id)){
+ coverVariable = getNewCoverVariable(btn.id, ((GT_GuiIconCheckButton) btn).isChecked());
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons(){
+ for (Object o : buttonList)
+ ((GT_GuiIconCheckButton) o).setChecked(isEnabled(((GT_GuiIconCheckButton) o).id));
+ }
+
+ private int getNewCoverVariable(int id, boolean checked) {
+ if (id == 6) {
+ if (checked)
+ return coverVariable & ~0x1;
+ else
+ return coverVariable | 0x1;
+ }
+ return (coverVariable & 0x1) | (id << 1) ;
+ }
+
+ private boolean isEnabled(int id) {
+ if (id == 6)
+ return (coverVariable & 0x1) > 0;
+ return (coverVariable >> 1) == id;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java
index 0a213bb844..bc966d3f54 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Fluidfilter.java
@@ -184,8 +184,8 @@ public class GT_Cover_Fluidfilter extends GT_CoverBehavior {
this.coverVariable = aCoverVariable;
GT_GuiIconButton b;
- b = new GT_GuiIconButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.EXPORT).setTooltipText(trans("232","Filter Input"));
- b = new GT_GuiIconButton(this, 1, startX + spaceX*1, startY+spaceY*0, GT_GuiIcon.IMPORT).setTooltipText(trans("233","Filter Output"));
+ b = new GT_GuiIconButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.IMPORT).setTooltipText(trans("232","Filter Input"));
+ b = new GT_GuiIconButton(this, 1, startX + spaceX*1, startY+spaceY*0, GT_GuiIcon.EXPORT).setTooltipText(trans("233","Filter Output"));
b = new GT_GuiIconButton(this, 2, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.BLOCK_INPUT).setTooltipText(trans("234", "Block Output"));
b = new GT_GuiIconButton(this, 3, startX + spaceX*1, startY+spaceY*2, GT_GuiIcon.ALLOW_INPUT).setTooltipText(trans("235", "Allow Output"));
b = new GT_GuiIconButton(this, 4, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.WHITELIST).setTooltipText(trans("236","Whitelist Fluid"));
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java
index 40706721c9..83b03b65a5 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java
@@ -1,21 +1,45 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiFakeItemButton;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
+import gregtech.api.gui.widgets.GT_GuiIntegerTextBox;
import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.Fluid;
public class GT_Cover_ItemMeter
extends GT_CoverBehavior {
+
+ // format:
+ private static final int SLOT_MASK = 0x3FFFFFF; // 0 = all, 1 = 0 ...
+ private static final int CONVERTED_BIT = 0x80000000;
+ private static final int INVERT_BIT = 0x40000000;
+
public int doCoverThings(byte aSide, byte aInputRedstone, int aCoverID, int aCoverVariable, ICoverable aTileEntity, long aTimer) {
+ //Convert from ver. 5.09.33.50
+ if ((CONVERTED_BIT & aCoverVariable) == 0)
+ if (aCoverVariable == 0)
+ aCoverVariable = CONVERTED_BIT;
+ else if (aCoverVariable == 1)
+ aCoverVariable = CONVERTED_BIT | INVERT_BIT;
+ else if (aCoverVariable > 1)
+ aCoverVariable = CONVERTED_BIT | Math.min((aCoverVariable - 2), SLOT_MASK);
+
int[] tSlots;
- if (aCoverVariable < 2) {
+ if ((aCoverVariable & SLOT_MASK) > 0)
+ tSlots = new int[]{(aCoverVariable & SLOT_MASK) - 1};
+ else
tSlots = aTileEntity.getAccessibleSlotsFromSide(aSide);
- } else {
- tSlots = new int[]{aCoverVariable - 2};
- }
+
int tMax = 0;
int tUsed = 0;
for (int i : tSlots) {
@@ -26,23 +50,39 @@ public class GT_Cover_ItemMeter
tUsed += (tStack.stackSize<<6)/tStack.getMaxStackSize();
}
}
+
+ boolean inverted = (aCoverVariable & INVERT_BIT) == INVERT_BIT;
if(tUsed==0)//nothing
- aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 15 : 0));
+ aTileEntity.setOutputRedstoneSignal(aSide, (byte)(inverted ? 15 : 0));
else if(tUsed >= tMax)//full
- aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 0 : 15));
+ aTileEntity.setOutputRedstoneSignal(aSide, (byte)(inverted ? 0 : 15));
else//1-14 range
- aTileEntity.setOutputRedstoneSignal(aSide, (byte)(aCoverVariable == 1 ? 14-((14*tUsed)/tMax) : 1+((14*tUsed)/tMax)) );
+ aTileEntity.setOutputRedstoneSignal(aSide, (byte)(inverted ? 14-((14*tUsed)/tMax) : 1+((14*tUsed)/tMax)) );
return aCoverVariable;
}
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- aCoverVariable = (aCoverVariable + (aPlayer.isSneaking()? -1 : 1)) % (2 + aTileEntity.getSizeInventory());
- switch(aCoverVariable) {
- case 0: GT_Utility.sendChatToPlayer(aPlayer, trans("051", "Normal")); break;
- case 1: GT_Utility.sendChatToPlayer(aPlayer, trans("052", "Inverted")); break;
- default: GT_Utility.sendChatToPlayer(aPlayer, trans("053", "Slot: ") + (aCoverVariable - 2)); break;
+ if (aPlayer.isSneaking()) {
+ if ((aCoverVariable & INVERT_BIT) == INVERT_BIT) {
+ aCoverVariable = aCoverVariable & ~INVERT_BIT;
+ GT_Utility.sendChatToPlayer(aPlayer, trans("NORMAL","Normal"));
+ }
+ else {
+ aCoverVariable = aCoverVariable | INVERT_BIT;
+ GT_Utility.sendChatToPlayer(aPlayer, trans("INVERTED","Inverted"));
+ }
+ return aCoverVariable;
}
- return aCoverVariable;
+
+ int slot = (aCoverVariable & SLOT_MASK) + 1;
+ if (slot > aTileEntity.getSizeInventory() || slot > SLOT_MASK)
+ slot = 0;
+
+ if (slot == 0)
+ GT_Utility.sendChatToPlayer(aPlayer, trans("053", "Slot: ") + trans("ALL", "All"));
+ else
+ GT_Utility.sendChatToPlayer(aPlayer, trans("053", "Slot: ") + (slot - 1));
+ return CONVERTED_BIT | (aCoverVariable & INVERT_BIT) | slot;
}
public boolean letsEnergyIn(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
@@ -76,4 +116,186 @@ public class GT_Cover_ItemMeter
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 5;
}
+
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private final GT_GuiIconCheckButton button;
+ private final GT_GuiIntegerTextBox intSlot;
+ private final GT_GuiFakeItemButton intSlotIcon;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ private final int maxSlot;
+
+ private final String ALL = trans("ALL", "All");
+ private final String INVERTED = trans("INVERTED","Inverted");
+ private final String NORMAL = trans("NORMAL","Normal");
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ button = new GT_GuiIconCheckButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.REDSTONE_ON, GT_GuiIcon.REDSTONE_OFF);
+
+ intSlot = new GT_GuiIntegerTextBox(this, 1, startX + spaceX * 0, startY + spaceY * 1 + 2, spaceX * 2+5, 12);
+ intSlot.setMaxStringLength(6);
+
+ //only shows if opened gui of block sadly, should've used container.
+ intSlotIcon = new GT_GuiFakeItemButton(this, startX + spaceX * 8-4, startY + spaceY * 1, GT_GuiIcon.SLOT_GRAY);
+
+ if (tile instanceof TileEntity && !super.tile.isDead())
+ maxSlot = Math.min(tile.getSizeInventory() - 1, SLOT_MASK-1);
+ else
+ maxSlot = -1;
+
+ if (maxSlot == -1)
+ intSlot.setEnabled(false);
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ if (isInverted())
+ this.getFontRenderer().drawString(INVERTED, startX + spaceX*3, 4+startY+spaceY*0, 0xFF555555);
+ else
+ this.getFontRenderer().drawString(NORMAL, startX + spaceX*3, 4+startY+spaceY*0, 0xFF555555);
+
+ this.getFontRenderer().drawString(trans("254", "Detect slot#"), startX + spaceX*3, 4+startY+spaceY*1, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ update();
+ if (intSlot.isEnabled())
+ intSlot.setFocused(true);
+ }
+
+ @Override
+ public void buttonClicked(GuiButton btn) {
+ if (isInverted())
+ coverVariable = (coverVariable & ~INVERT_BIT);
+ else
+ coverVariable = (coverVariable | INVERT_BIT);
+
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ update();
+ }
+
+ private void update() {
+ resetTextBox(intSlot);
+ button.setChecked(isInverted());
+
+ int slot = getSlot();
+ if (slot < 0) {
+ intSlotIcon.setItem(null);
+ return;
+ }
+ if (tile instanceof TileEntity && !super.tile.isDead()) {
+ if (tile.getSizeInventory() >= slot) {
+ ItemStack item = tile.getStackInSlot(slot);
+ intSlotIcon.setItem(item);
+ return;
+ }
+ }
+ intSlotIcon.setItem(null);
+ }
+
+ @Override
+ public void onMouseWheel(int x, int y, int delta) {
+ for (GT_GuiIntegerTextBox box : textBoxes) {
+ if (box.isFocused()) {
+ int step = Math.max(1, Math.abs(delta / 120));
+ step = (isShiftKeyDown() ? 50 : isCtrlKeyDown() ? 5 : 1) * (delta > 0 ? step : -step);
+ int val = parseTextBox(box);
+
+ if (val < 0)
+ val = -1;
+
+ val = val + step;
+
+ if (val < 0)
+ val = -1;
+ else if (val > maxSlot )
+ val = maxSlot;
+
+ box.setText(val < 0 ? ALL : String.valueOf(val));
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void applyTextBox(GT_GuiIntegerTextBox box) {
+ int val = parseTextBox(box)+1;
+
+ if (val > SLOT_MASK)
+ val = SLOT_MASK;
+ else if (val < 0)
+ val = 0;
+
+ coverVariable = val | CONVERTED_BIT | (coverVariable & INVERT_BIT);
+
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ update();
+ }
+
+ @Override
+ public void resetTextBox(GT_GuiIntegerTextBox box) {
+ box.setText(getSlot() < 0 ? ALL : String.valueOf(getSlot()));
+ }
+
+ private int parseTextBox(GT_GuiIntegerTextBox box) {
+ String text = box.getText();
+ if (text == null)
+ return -1;
+ text = text.trim();
+ if (text.startsWith(ALL))
+ text = text.substring(ALL.length());
+
+ if (text.isEmpty())
+ return -1;
+
+ int val;
+ try {
+ val = Integer.parseInt(text);
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+
+ if (val < 0)
+ return -1;
+ else if (maxSlot < val)
+ return maxSlot;
+ return val;
+ }
+
+ private boolean isInverted() {
+ return ((coverVariable & INVERT_BIT) != 0);
+ }
+
+ private int getSlot() {
+ return (coverVariable & SLOT_MASK) - 1;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java
index 5a0bb2e7d2..9ca2f77d62 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_LiquidMeter.java
@@ -1,8 +1,14 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
@@ -42,9 +48,9 @@ public class GT_Cover_LiquidMeter
public int onCoverScrewdriverclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
if (aCoverVariable == 0) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("054", "Inverted"));
- } else {
GT_Utility.sendChatToPlayer(aPlayer, trans("055", "Normal"));
+ } else {
+ GT_Utility.sendChatToPlayer(aPlayer, trans("054", "Inverted"));
}
return aCoverVariable == 0 ? 1 : 0;
}
@@ -80,4 +86,82 @@ public class GT_Cover_LiquidMeter
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 5;
}
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+ new GT_GuiIconCheckButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.REDSTONE_ON, GT_GuiIcon.REDSTONE_OFF);
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ String s2;
+ if (coverVariable == 0)
+ s2 = trans("INVERTED","Inverted");
+ else
+ s2 = trans("NORMAL","Normal");
+
+ this.fontRendererObj.drawString(s2, startX + spaceX*1, 4+startY+spaceY*0, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn){
+ boolean state = false;
+ if (btn.id == 0)
+ state = ((GT_GuiIconCheckButton) btn).isChecked();
+
+ coverVariable = getNewCoverVariable(btn.id, state);
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ updateButtons();
+ }
+
+ private void updateButtons(){
+ GuiButton b;
+ for (Object o : buttonList) {
+ b = (GuiButton) o;
+ if(b.id == 0)
+ ((GT_GuiIconCheckButton) b).setChecked(coverVariable == 0);
+ }
+ }
+
+ private int getNewCoverVariable(int id, boolean buttonState) {
+ if (id == 0) {
+ if (buttonState)
+ return coverVariable | 0x1;
+ else
+ return coverVariable & ~0x1;
+ }
+ return coverVariable;
+ }
+ }
} \ No newline at end of file
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java
index 3316b204dc..43160aa908 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_NeedMaintainance.java
@@ -1,12 +1,18 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
@@ -139,5 +145,119 @@ public class GT_Cover_NeedMaintainance extends GT_CoverBehavior {
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 60;
}
+ /**
+ * GUI Stuff
+ */
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final String[] tooltiptext = {
+ trans("056", "Emit if 1 Maintenance Needed"),
+ trans("058", "Emit if 2 Maintenance Needed"),
+ trans("060", "Emit if 3 Maintenance Needed"),
+ trans("062", "Emit if 4 Maintenance Needed"),
+ trans("064", "Emit if 5 Maintenance Needed"),
+ trans("066", "Emit if rotor needs maintenance low accuracy mod"),
+ trans("068", "Emit if rotor needs maintenance high accuracy mod"),
+ };
+
+ private final String[] buttontext = {
+ trans("247", "1 Issue"),
+ trans("248", "2 Issues"),
+ trans("249", "3 Issues"),
+ trans("250", "4 Issues"),
+ trans("251", "5 Issues"),
+ trans("252", "Rotor < 80%"),
+ trans("253", "Rotor < 100%"),
+
+ trans("INVERTED","Inverted"),
+ trans("NORMAL","Normal"),
+ };
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ GuiButton b;
+ b = new GT_GuiIconCheckButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.CHECKMARK, null).setTooltipText(tooltiptext[0]);
+ b = new GT_GuiIconCheckButton(this, 1, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.CHECKMARK, null).setTooltipText(tooltiptext[1]);
+ b = new GT_GuiIconCheckButton(this, 2, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.CHECKMARK, null).setTooltipText(tooltiptext[2]);
+ b = new GT_GuiIconCheckButton(this, 3, startX + spaceX*0, startY+spaceY*3, GT_GuiIcon.CHECKMARK, null).setTooltipText(tooltiptext[3]);
+ b = new GT_GuiIconCheckButton(this, 4, startX + spaceX*4 + 4, startY+spaceY*0, GT_GuiIcon.CHECKMARK, null).setTooltipText(tooltiptext[4]);
+ b = new GT_GuiIconCheckButton(this, 5, startX + spaceX*4 + 4, startY+spaceY*1, GT_GuiIcon.CHECKMARK, null).setTooltipText(tooltiptext[5]);
+ b = new GT_GuiIconCheckButton(this, 6, startX + spaceX*4 + 4, startY+spaceY*2, GT_GuiIcon.CHECKMARK, null).setTooltipText(tooltiptext[6]);
+ b = new GT_GuiIconCheckButton(this, 7, startX + spaceX*4 + 4, startY+spaceY*3, GT_GuiIcon.REDSTONE_ON, GT_GuiIcon.REDSTONE_OFF);
+ }
+
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+
+ this.fontRendererObj.drawString(buttontext[0],startX + spaceX*1, 4+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString(buttontext[1],startX + spaceX*1, 4+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString(buttontext[2],startX + spaceX*1, 4+startY+spaceY*2, 0xFF555555);
+ this.fontRendererObj.drawString(buttontext[3],startX + spaceX*1, 4+startY+spaceY*3, 0xFF555555);
+ this.fontRendererObj.drawString(buttontext[4],startX + spaceX*5 + 4, 4+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString(buttontext[5],startX + spaceX*5 + 4, 4+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString(buttontext[6],startX + spaceX*5 + 4, 4+startY+spaceY*2, 0xFF555555);
+ // inverted normal
+ String s2 = ((coverVariable & 0x1) > 0) ? buttontext[7] : buttontext[8];
+ this.fontRendererObj.drawString(s2, startX + spaceX*5 + 4, 4+startY+spaceY*3, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn){
+ if (btn.id == 7 || !isEnabled(btn.id)){
+ coverVariable = getNewCoverVariable(btn.id, ((GT_GuiIconCheckButton) btn).isChecked());
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons(){
+ for (Object o : buttonList)
+ ((GT_GuiIconCheckButton) o).setChecked(isEnabled(((GT_GuiIconCheckButton) o).id));
+ }
+
+ private int getNewCoverVariable(int id, boolean checked) {
+ if (id == 7) {
+ if (checked)
+ return coverVariable & ~0x1;
+ else
+ return coverVariable | 0x1;
+ }
+ return (coverVariable & 0x1) | (id << 1) ;
+ }
+
+ private boolean isEnabled(int id) {
+ if (id == 7)
+ return (coverVariable & 0x1) > 0;
+ return (coverVariable >>> 1) == id;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java
index 9e6c764170..57f52ab42d 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_PlayerDetector.java
@@ -1,9 +1,15 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fluids.Fluid;
@@ -94,5 +100,79 @@ public class GT_Cover_PlayerDetector extends GT_CoverBehavior {
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 20;
}
+ /**
+ * GUI Stuff
+ */
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ new GT_GuiIconCheckButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("068", "Emit if any Player is close"));
+ new GT_GuiIconCheckButton(this, 1, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("069", "Emit if other Player is close"));
+ new GT_GuiIconCheckButton(this, 2, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.CHECKMARK, null)
+ .setTooltipText(trans("070", "Emit if you are close"));
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ this.fontRendererObj.drawString("Any player",
+ startX + spaceX*1, 4+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString("Other players",
+ startX + spaceX*1, 4+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString("Only owner",
+ startX + spaceX*1, 4+startY+spaceY*2, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn){
+ if (!isEnabled(btn.id)){
+ coverVariable = getNewCoverVariable(btn.id, ((GT_GuiIconCheckButton) btn).isChecked());
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons(){
+ for (Object o : buttonList)
+ ((GT_GuiIconCheckButton) o).setChecked(isEnabled(((GT_GuiIconCheckButton) o).id));
+ }
+
+ private int getNewCoverVariable(int id, boolean checked) {
+ return id;
+ }
+
+ private boolean isEnabled(int id) {
+ return coverVariable == id;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
index 364229f6f8..a6f7d653b9 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Pump.java
@@ -2,13 +2,13 @@ package gregtech.common.covers;
import gregtech.api.enums.GT_Values;
import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
import gregtech.api.gui.widgets.GT_GuiIconButton;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IMachineProgress;
import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
-import gregtech.api.gui.widgets.GT_GuiIcon;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java
index a359d20aa9..1407311b88 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_RedstoneWirelessBase.java
@@ -1,7 +1,12 @@
package gregtech.common.covers;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIntegerTextBox;
+import gregtech.api.interfaces.IGuiScreen;
import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
@@ -78,4 +83,118 @@ public abstract class GT_Cover_RedstoneWirelessBase
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 1;
}
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private GT_GuiIntegerTextBox fBox;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ fBox = new GT_GuiIntegerTextBoxWithMinus(this, 2,startX + spaceX*0,startY+spaceY*0 + 2, spaceX*4-3,12);
+ fBox.setText(String.valueOf(coverVariable));
+ fBox.setMaxStringLength(12);
+
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ this.getFontRenderer().drawString(trans("246","Frequency" ), startX + spaceX*4, 4+startY+spaceY*0, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ fBox.setFocused(true);
+ }
+
+ @Override
+ public void onMouseWheel(int x, int y, int delta) {
+ for (GT_GuiIntegerTextBox box : textBoxes){
+ if (box.isFocused()) {
+ int step = Math.max(1, Math.abs(delta / 120));
+ step = (isShiftKeyDown() ? 1000 : isCtrlKeyDown() ? 50 : 1) * (delta > 0 ? step : -step);
+ long i;
+ try {
+ i = Long.parseLong(box.getText());
+ } catch (NumberFormatException e) {
+ return;
+ }
+ i = i + step;
+ if (i > Integer.MAX_VALUE)
+ i = Integer.MAX_VALUE;
+ else if (i < Integer.MIN_VALUE)
+ i = Integer.MIN_VALUE;
+
+ box.setText(String.valueOf(i));
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void applyTextBox(GT_GuiIntegerTextBox box) {
+ long i;
+ String s = box.getText().trim();
+ try {
+ i = Long.parseLong(s);
+ } catch (NumberFormatException e) {
+ resetTextBox(box);
+ return;
+ }
+
+ if (i > Integer.MAX_VALUE)
+ i = Integer.MAX_VALUE;
+ else if (i < Integer.MIN_VALUE)
+ i = Integer.MIN_VALUE;
+
+
+ coverVariable = (int) i;
+ fBox.setText(String.valueOf(coverVariable));
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+
+ @Override
+ public void resetTextBox(GT_GuiIntegerTextBox box) {
+ box.setText(String.valueOf(coverVariable));
+ }
+
+ private class GT_GuiIntegerTextBoxWithMinus extends GT_GuiIntegerTextBox {
+
+ public GT_GuiIntegerTextBoxWithMinus(IGuiScreen gui, int id, int x, int y, int width, int height) {
+ super(gui, id, x, y, width, height);
+ }
+
+ @Override
+ public boolean validChar(char c, int key) {
+ if (getCursorPosition() == 0 && key == 12) // minus first allowed.
+ return true;
+ return super.validChar(c, key);
+ }
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java
index b43cbe0122..b1c0c5c3af 100644
--- a/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java
+++ b/src/main/java/gregtech/common/covers/GT_Cover_Shutter.java
@@ -1,9 +1,15 @@
package gregtech.common.covers;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUICover;
+import gregtech.api.gui.widgets.GT_GuiIcon;
+import gregtech.api.gui.widgets.GT_GuiIconCheckButton;
import gregtech.api.interfaces.tileentity.ICoverable;
import gregtech.api.interfaces.tileentity.IMachineProgress;
+import gregtech.api.net.GT_Packet_TileEntityCover;
import gregtech.api.util.GT_CoverBehavior;
import gregtech.api.util.GT_Utility;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fluids.Fluid;
@@ -64,4 +70,80 @@ public class GT_Cover_Shutter
public int getTickRate(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
return 0;
}
+
+ /**
+ * GUI Stuff
+ */
+
+ @Override
+ public boolean hasCoverGUI() {
+ return true;
+ }
+
+ @Override
+ public Object getClientGUI(byte aSide, int aCoverID, int coverData, ICoverable aTileEntity) {
+ return new GUI(aSide, aCoverID, coverData, aTileEntity);
+ }
+
+ private class GUI extends GT_GUICover {
+ private final byte side;
+ private final int coverID;
+ private int coverVariable;
+
+ private final static int startX = 10;
+ private final static int startY = 25;
+ private final static int spaceX = 18;
+ private final static int spaceY = 18;
+
+ public GUI(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity) {
+ super(aTileEntity, 176, 107, GT_Utility.intToStack(aCoverID));
+ this.side = aSide;
+ this.coverID = aCoverID;
+ this.coverVariable = aCoverVariable;
+
+ new GT_GuiIconCheckButton(this, 0, startX + spaceX*0, startY+spaceY*0, GT_GuiIcon.CHECKMARK, null);
+ new GT_GuiIconCheckButton(this, 1, startX + spaceX*0, startY+spaceY*1, GT_GuiIcon.CHECKMARK, null);
+ new GT_GuiIconCheckButton(this, 2, startX + spaceX*0, startY+spaceY*2, GT_GuiIcon.CHECKMARK, null);
+ new GT_GuiIconCheckButton(this, 3, startX + spaceX*0, startY+spaceY*3, GT_GuiIcon.CHECKMARK, null);
+ }
+
+ @Override
+ public void drawExtras(int mouseX, int mouseY, float parTicks) {
+ super.drawExtras(mouseX, mouseY, parTicks);
+ this.fontRendererObj.drawString(trans("082", "Open if work enabled"),
+ 3+startX + spaceX*1, 4+startY+spaceY*0, 0xFF555555);
+ this.fontRendererObj.drawString(trans("083", "Open if work disabled"),
+ 3+startX + spaceX*1, 4+startY+spaceY*1, 0xFF555555);
+ this.fontRendererObj.drawString(trans("084", "Only Output allowed"),
+ 3+startX + spaceX*1, 4+startY+spaceY*2, 0xFF555555);
+ this.fontRendererObj.drawString(trans("085", "Only Input allowed"),
+ 3+startX + spaceX*1, 4+startY+spaceY*3, 0xFF555555);
+ }
+
+ @Override
+ protected void onInitGui(int guiLeft, int guiTop, int gui_width, int gui_height) {
+ updateButtons();
+ }
+
+ public void buttonClicked(GuiButton btn){
+ if (!isEnabled(btn.id)){
+ coverVariable = getNewCoverVariable(btn.id, ((GT_GuiIconCheckButton) btn).isChecked());
+ GT_Values.NW.sendToServer(new GT_Packet_TileEntityCover(side, coverID, coverVariable, tile));
+ }
+ updateButtons();
+ }
+
+ private void updateButtons(){
+ for (Object o : buttonList)
+ ((GT_GuiIconCheckButton) o).setChecked(isEnabled(((GT_GuiIconCheckButton) o).id));
+ }
+
+ private int getNewCoverVariable(int id, boolean checked) {
+ return id;
+ }
+
+ private boolean isEnabled(int id) {
+ return coverVariable == id;
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/entities/GT_EntityFXPollution.java b/src/main/java/gregtech/common/entities/GT_EntityFXPollution.java
new file mode 100644
index 0000000000..b44f90f7ea
--- /dev/null
+++ b/src/main/java/gregtech/common/entities/GT_EntityFXPollution.java
@@ -0,0 +1,59 @@
+package gregtech.common.entities;
+
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.world.World;
+
+import java.util.Random;
+
+public class GT_EntityFXPollution extends EntityFX {
+
+ public GT_EntityFXPollution(World world, double x, double y, double z) {
+ super(world, x, y, z,0 ,0 ,0);
+
+ this.particleRed = 0.25F;
+ this.particleGreen = 0.2F;
+ this.particleBlue = 0.25F;
+
+ this.motionX *= 0.1D;
+ this.motionY *= -0.1D;
+ this.motionZ *= 0.1F;
+
+ Random random = world.rand;
+ this.motionX += random.nextFloat() * -1.9D * random.nextFloat() * 0.1D;
+ this.motionY += random.nextFloat() * -0.5D * random.nextFloat() * 0.1D * 5.0D;
+ this.motionZ += random.nextFloat() * -1.9D * random.nextFloat() * 0.1D;
+
+ this.particleTextureIndexX = 0;
+ this.particleTextureIndexY = 0;
+
+ this.particleMaxAge = (int)((double)20 / ((double)random.nextFloat() * 0.8D + 0.2D));
+
+ this.particleScale *= 0.75F;
+ this.noClip = true;
+ }
+
+ @Override
+ public void onUpdate() {
+ this.prevPosX = this.posX;
+ this.prevPosY = this.posY;
+ this.prevPosZ = this.posZ;
+
+ if (this.particleAge++ >= this.particleMaxAge) {
+ this.setDead();
+ } else {
+ this.motionY += -5.0E-4D;
+ this.moveEntity(this.motionX, this.motionY, this.motionZ);
+ if (this.posY == this.prevPosY) {
+ this.motionX *= 1.1D;
+ this.motionZ *= 1.1D;
+ }
+ this.motionX *= 0.96D;
+ this.motionY *= 0.96D;
+ this.motionZ *= 0.96D;
+ if (this.onGround) {
+ this.motionX *= 0.7D;
+ this.motionZ *= 0.7D;
+ }
+ }
+ }
+}
diff --git a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java
index 016d0889f7..d465134d5e 100644
--- a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java
+++ b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java
@@ -67,7 +67,7 @@ public class GT_Container_ChestBuffer
if (aSlotIndex == 30) {
((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode = (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode);
if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots."));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."));
} else {
GT_Utility.sendChatToPlayer(aPlayer, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."));
}
diff --git a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java
index 5a59cb5aa9..530e64aa68 100644
--- a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java
+++ b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java
@@ -62,7 +62,7 @@ public class GT_Container_SuperBuffer
if (aSlotIndex == 3) {
((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode = (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode);
if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots."));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."));
} else {
GT_Utility.sendChatToPlayer(aPlayer, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."));
}
diff --git a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java
index 92eb3af4d2..710dc0bf8f 100644
--- a/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java
+++ b/src/main/java/gregtech/common/items/GT_IntegratedCircuit_Item.java
@@ -7,6 +7,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.items.GT_Generic_Item;
+import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
@@ -15,13 +16,16 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
import java.util.List;
import static gregtech.GT_Mod.GT_FML_LOGGER;
+import static gregtech.api.enums.GT_Values.RES_PATH_ITEM;
public class GT_IntegratedCircuit_Item extends GT_Generic_Item {
private final static String aTextEmptyRow = " ";
+ protected IIcon[] mIconDamage = new IIcon[25];
public GT_IntegratedCircuit_Item() {
super("integrated_circuit", "Programmed Circuit", "");
setHasSubtypes(true);
@@ -93,9 +97,13 @@ public class GT_IntegratedCircuit_Item extends GT_Generic_Item {
aList.add(new ItemStack(this, 1, 0));
}
+ @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister aIconRegister) {
super.registerIcons(aIconRegister);
+ for (int i=0; i < mIconDamage.length; i++) {
+ mIconDamage[i] = aIconRegister.registerIcon(RES_PATH_ITEM + (GT_Config.troll ? "troll" : getUnlocalizedName() + "/" + i));
+ }
if (GregTech_API.sPostloadFinished) {
GT_Log.out.println("GT_Mod: Starting Item Icon Load Phase");
GT_FML_LOGGER.info("GT_Mod: Starting Item Icon Load Phase");
@@ -109,4 +117,10 @@ public class GT_IntegratedCircuit_Item extends GT_Generic_Item {
GT_FML_LOGGER.info("GT_Mod: Finished Item Icon Load Phase");
}
}
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ byte circuitMode = ((byte) (damage & 0xFF)); // Mask out the MSB Comparison Mode Bits. See: getModeString
+ return mIconDamage[circuitMode < mIconDamage.length ? circuitMode : 0];
+ }
}
diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java
index 20dbccf2cb..ad2457b721 100644
--- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java
+++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java
@@ -382,12 +382,12 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 {
ItemList.Ingot_Heavy2.set(addItem(tLastID = 463, "Heavy Duty Alloy Ingot T2", "Used to make Heavy Duty Plates T2", new Object[0]));
ItemList.Ingot_Heavy3.set(addItem(tLastID = 464, "Heavy Duty Alloy Ingot T3", "Used to make Heavy Duty Plates T3", new Object[0]));
- GT_ModHandler.addCraftingRecipe(ItemList.Ingot_Heavy1.get(1L, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"BhB", "CAS", "B B", 'B', OrePrefixes.bolt.get(Materials.StainlessSteel), 'C', OrePrefixes.compressed.get(Materials.Bronze), 'A', OrePrefixes.compressed.get(Materials.Aluminium), 'S', OrePrefixes.compressed.get(Materials.Steel)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.Ingot_Heavy1.get(1L, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"BhB", "CAS", "B B", 'B', OrePrefixes.bolt.get(Materials.StainlessSteel), 'C', OrePrefixes.compressed.get(Materials.Bronze), 'A', OrePrefixes.compressed.get(Materials.Aluminium), 'S', OrePrefixes.compressed.get(Materials.Steel)});
}
ItemList.Ingot_IridiumAlloy.set(addItem(tLastID = 480, "Iridium Alloy Ingot", "Used to make Iridium Plates", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 4L)}));
- GT_ModHandler.addRollingMachineRecipe(ItemList.Ingot_IridiumAlloy.get(1L, new Object[0]), new Object[]{"IAI", "ADA", "IAI", 'D', GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "iridiumplate", true) ? OreDictNames.craftingIndustrialDiamond : OrePrefixes.dust.get(Materials.Diamond), 'A', OrePrefixes.plateAlloy.get("Advanced"), 'I', OrePrefixes.plate.get(Materials.Iridium)});
- GT_ModHandler.addCraftingRecipe(ItemList.Ingot_IridiumAlloy.get(1L, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"IAI", "ADA", "IAI", 'D', GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "iridiumplate", true) ? OreDictNames.craftingIndustrialDiamond : OrePrefixes.dust.get(Materials.Diamond), 'A', OrePrefixes.plateAlloy.get("Advanced"), 'I', OrePrefixes.plate.get(Materials.Iridium)});
+ //GT_ModHandler.addRollingMachineRecipe(ItemList.Ingot_IridiumAlloy.get(1L, new Object[0]), new Object[]{"IAI", "ADA", "IAI", 'D', GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "iridiumplate", true) ? OreDictNames.craftingIndustrialDiamond : OrePrefixes.dust.get(Materials.Diamond), 'A', OrePrefixes.plateAlloy.get("Advanced"), 'I', OrePrefixes.plate.get(Materials.Iridium)});
+ //GT_ModHandler.addCraftingRecipe(ItemList.Ingot_IridiumAlloy.get(1L, new Object[0]), GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{"IAI", "ADA", "IAI", 'D', GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.harderrecipes, "iridiumplate", true) ? OreDictNames.craftingIndustrialDiamond : OrePrefixes.dust.get(Materials.Diamond), 'A', OrePrefixes.plateAlloy.get("Advanced"), 'I', OrePrefixes.plate.get(Materials.Iridium)});
ItemList.Paper_Printed_Pages.set(addItem(tLastID = 481, "Printed Pages", "Used to make written Books", new Object[]{new ItemData(Materials.Paper, 10886400L, new MaterialStack[0]), new Behaviour_PrintedPages(), new TC_Aspects.TC_AspectStack(TC_Aspects.COGNITIO, 2L)}));
ItemList.Paper_Magic_Empty.set(addItem(tLastID = 482, "Magic Paper", "", new Object[]{SubTag.INVISIBLE, new ItemData(Materials.Paper, 3628800L, new MaterialStack[0]), new TC_Aspects.TC_AspectStack(TC_Aspects.COGNITIO, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.PRAECANTATIO, 1L)}));
@@ -663,16 +663,16 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 {
ItemList.QuantumStar.set(addItem(tLastID = 725, "Quantum Star", "Improved Nether Star", new Object[0]));
ItemList.Gravistar.set(addItem(tLastID = 726, "Gravi Star", "Ultimate Nether Star", new Object[0]));
- ItemList.Field_Generator_LV.set(addItem(670, "Field Generator (Tier I)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 1L)}));
- ItemList.Field_Generator_MV.set(addItem(671, "Field Generator (Tier II)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 2L)}));
- ItemList.Field_Generator_HV.set(addItem(672, "Field Generator (Tier III)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 4L)}));
- ItemList.Field_Generator_EV.set(addItem(673, "Field Generator (Tier IV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 8L)}));
- ItemList.Field_Generator_IV.set(addItem(674, "Field Generator (Tier V)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 16L)}));
- ItemList.Field_Generator_LuV.set(addItem(675, "Field Generator (Tier VI)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 32L)}));
- ItemList.Field_Generator_ZPM.set(addItem(676, "Field Generator (Tier VII)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 64L)}));
- ItemList.Field_Generator_UV.set(addItem(677, "Field Generator (Tier VIII)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 128L)}));
- ItemList.Field_Generator_UHV.set(addItem(678, "Field Generator (Tier IX)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 256L)}));
- ItemList.Field_Generator_UEV.set(addItem(679, "Field Generator (Tier X)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1024L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 512L)}));
+ ItemList.Field_Generator_LV.set(addItem(670, "Field Generator (LV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 1L)}));
+ ItemList.Field_Generator_MV.set(addItem(671, "Field Generator (MV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 2L)}));
+ ItemList.Field_Generator_HV.set(addItem(672, "Field Generator (HV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 4L)}));
+ ItemList.Field_Generator_EV.set(addItem(673, "Field Generator (EV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 8L)}));
+ ItemList.Field_Generator_IV.set(addItem(674, "Field Generator (IV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 16L)}));
+ ItemList.Field_Generator_LuV.set(addItem(675, "Field Generator (LuV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 32L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 32L)}));
+ ItemList.Field_Generator_ZPM.set(addItem(676, "Field Generator (ZPM)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 64L)}));
+ ItemList.Field_Generator_UV.set(addItem(677, "Field Generator (UV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 128L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 128L)}));
+ ItemList.Field_Generator_UHV.set(addItem(678, "Field Generator (UHV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 256L)}));
+ ItemList.Field_Generator_UEV.set(addItem(679, "Field Generator (UEV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1024L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.TUTAMEN, 512L)}));
ItemList.Emitter_LV.set(addItem(680, "Emitter (LV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUX, 1L)}));
ItemList.Emitter_MV.set(addItem(681, "Emitter (MV)", "", new Object[]{new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUX, 2L)}));
diff --git a/src/main/java/gregtech/common/items/GT_VolumetricFlask.java b/src/main/java/gregtech/common/items/GT_VolumetricFlask.java
index a247b09df9..5ab6b3395e 100644
--- a/src/main/java/gregtech/common/items/GT_VolumetricFlask.java
+++ b/src/main/java/gregtech/common/items/GT_VolumetricFlask.java
@@ -1,7 +1,6 @@
package gregtech.common.items;
-import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.GT_Values;
@@ -32,24 +31,16 @@ import static ic2.core.util.LiquidUtil.*;
public class GT_VolumetricFlask extends GT_Generic_Item implements IFluidContainerItem {
private final int maxCapacity;
+ private final String unlocalFlaskName;
@SideOnly(Side.CLIENT)
public IIcon iconWindow;
public GT_VolumetricFlask(String unlocalized, String english, int maxCapacity) {
super(unlocalized, english, null);
this.maxCapacity = maxCapacity;
+ unlocalFlaskName = unlocalized;
setMaxStackSize(16);
setNoRepair();
- if (Loader.isModLoaded("NotEnoughItems")) {
- for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
- if (fluid != null) {
- ItemStack stack = new ItemStack(this);
- setCapacity(stack, getMaxCapacity());
- fill(stack, new FluidStack(fluid, Integer.MAX_VALUE), true);
- codechicken.nei.api.API.hideItem(stack);
- }
- }
- }
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
@@ -120,9 +111,10 @@ public class GT_VolumetricFlask extends GT_Generic_Item implements IFluidContain
}
@Override
+ @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister aIconRegister) {
super.registerIcons(aIconRegister);
- iconWindow = aIconRegister.registerIcon(RES_PATH_ITEM + "gt.Volumetric_Flask.window");
+ iconWindow = aIconRegister.registerIcon(RES_PATH_ITEM + "gt."+unlocalFlaskName+".window");
}
public void setCapacity(ItemStack stack, int capacity) {
@@ -287,4 +279,4 @@ public class GT_VolumetricFlask extends GT_Generic_Item implements IFluidContain
}
return false;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/common/misc/GT_ClientPollutionMap.java b/src/main/java/gregtech/common/misc/GT_ClientPollutionMap.java
new file mode 100644
index 0000000000..7ba470e412
--- /dev/null
+++ b/src/main/java/gregtech/common/misc/GT_ClientPollutionMap.java
@@ -0,0 +1,156 @@
+package gregtech.common.misc;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityClientPlayerMP;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.MathHelper;
+import org.lwjgl.opengl.GL11;
+
+public class GT_ClientPollutionMap {
+ private static final byte RADIUS = 24;
+ private static final byte DISTANCE_RELOAD_MAP = 5; //When player moved x chunks, shift the map to new center.
+ private static final byte SIZE = RADIUS*2+1; //Area to keep stored.
+
+ private int x0, z0;
+ private int dim;
+
+ private boolean initialized = false;
+
+ private static short[][] chunkMatrix; //short because reasons.
+
+
+ public GT_ClientPollutionMap(){ }
+
+ public void reset() {
+ initialized = false;
+ }
+
+ private void initialize(int playerChunkX, int playerChunkZ, int dimension) {
+ initialized = true;
+ chunkMatrix = new short[SIZE][SIZE];
+ x0 = playerChunkX;
+ z0 = playerChunkZ;
+ dim = dimension;
+ }
+
+ public void addChunkPollution(int chunkX, int chunkZ, int pollution) {
+ EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
+ if (player == null || player.worldObj == null)
+ return;
+
+ int playerXChunk = MathHelper.floor_double(player.posX) >> 4;
+ int playerZChunk = MathHelper.floor_double(player.posZ) >> 4; //posX/Z seems to be always loaded,
+
+ if (!initialized) {
+ initialize(playerXChunk, playerZChunk, player.dimension);
+ }
+
+ if (dim != player.dimension) {
+ initialize(playerXChunk, playerZChunk, player.dimension);
+ }
+
+ if (Math.abs(x0 - playerXChunk) > DISTANCE_RELOAD_MAP || Math.abs(z0 - playerZChunk) > DISTANCE_RELOAD_MAP)
+ shiftCenter(playerXChunk, playerZChunk);
+
+ int relX = chunkX - x0 + RADIUS;
+ if (relX >= SIZE || relX < 0) //out of bounds
+ return;
+ int relZ = chunkZ - z0 + RADIUS;
+ if (relZ >= SIZE || relZ < 0) //out of bounds
+ return;
+
+ pollution = pollution/225;
+ if (pollution > Short.MAX_VALUE) //Sanity
+ chunkMatrix[relX][relZ] = Short.MAX_VALUE; //Max pollution = 7,3mill
+ else if (pollution < 0)
+ chunkMatrix[relX][relZ] = 0;
+ else
+ chunkMatrix[relX][relZ] = (short) (pollution);
+ }
+
+ //xy interpolation, between 4 chunks as corners, unknown treated as 0.
+ public int getPollution(double fx, double fz) {
+ if (!initialized)
+ return 0;
+ int x = MathHelper.floor_double(fx);
+ int z = MathHelper.floor_double(fz);
+ int xDiff = ((x-8) >> 4) - x0;
+ int zDiff = ((z-8) >> 4) - z0;
+
+ if (xDiff < -RADIUS || zDiff < -RADIUS || xDiff >= RADIUS || zDiff >= RADIUS )
+ return 0;
+
+ //coordinates in shifted chunk.
+ x = (x-8) % 16;
+ z = (z-8) % 16;
+ if (x < 0)
+ x = 16+x;
+ if (z < 0)
+ z = 16+z;
+
+ int xi = 15 - x;
+ int zi = 15 - z;
+
+ //read pollution in 4 corner chunks
+ int offsetX = RADIUS+xDiff;
+ int offsetZ = RADIUS+zDiff;
+
+ int c00 = chunkMatrix[offsetX][offsetZ];
+ int c10 = chunkMatrix[offsetX+1][offsetZ];
+ int c01 = chunkMatrix[offsetX][offsetZ+1];
+ int c11 = chunkMatrix[offsetX+1][offsetZ+1];
+
+ //Is divided by 15*15 but is handled when storing chunk data.
+ return c00*xi*zi + c10*x*zi + c01*xi*z + c11*x*z;
+ }
+
+ //shift the matrix to fit new center
+ private void shiftCenter(int chunkX, int chunkZ) {
+ int xDiff = chunkX - x0;
+ int zDiff = chunkZ - z0;
+ boolean[] allEmpty = new boolean[SIZE]; //skip check z row if its empty.
+ if (xDiff > 0)
+ for (byte x = 0; x < SIZE; x++) {
+ int xOff = x + xDiff;
+ if (xOff < SIZE) {
+ chunkMatrix[x] = chunkMatrix[xOff].clone();
+ } else {
+ chunkMatrix[x] = new short[SIZE];
+ allEmpty[x] = true;
+ }
+ }
+ else if (xDiff < 0)
+ for (byte x = SIZE-1; x >= 0; x--) {
+ int xOff = x + xDiff;
+ if (xOff > 0) {
+ chunkMatrix[x] = chunkMatrix[xOff].clone();
+ } else {
+ chunkMatrix[x] = new short[SIZE];
+ allEmpty[x] = true;
+ }
+ }
+
+ if (zDiff > 0)
+ for (byte x = 0; x < SIZE; x++) {
+ if (allEmpty[x])
+ continue;
+ for (int z = 0; z < SIZE ; z++) {
+ int zOff = z + zDiff;
+ chunkMatrix[x][z] = (zOff < SIZE) ? chunkMatrix[x][zOff] : 0;
+ }
+ }
+ else if (zDiff < 0)
+ for (byte x = 0; x < SIZE; x++) {
+ if (allEmpty[x])
+ continue;
+ for (int z = SIZE-1; z >= 0 ; z--) {
+ int zOff = z+zDiff;
+ chunkMatrix[x][z] = (zOff > 0) ? chunkMatrix[x][zOff] : 0;
+ }
+ }
+
+ x0 = chunkX;
+ z0 = chunkZ;
+ }
+}
diff --git a/src/main/java/gregtech/common/misc/GT_Command.java b/src/main/java/gregtech/common/misc/GT_Command.java
index 66ae7058bc..f3272ee341 100644
--- a/src/main/java/gregtech/common/misc/GT_Command.java
+++ b/src/main/java/gregtech/common/misc/GT_Command.java
@@ -1,11 +1,15 @@
package gregtech.common.misc;
+import gregtech.GT_Mod;
import gregtech.api.enums.GT_Values;
import gregtech.api.objects.GT_ChunkManager;
+import gregtech.common.GT_Pollution;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChunkCoordinates;
+
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
@@ -21,10 +25,10 @@ public final class GT_Command extends CommandBase {
@Override
public String getCommandUsage(ICommandSender sender) {
- return "Usage: gt <subcommand>. Valid subcommands are: toggle, chunks.";
+ return "Usage: gt <subcommand>. Valid subcommands are: toggle, chunks, pollution.";
}
private void printHelp(ICommandSender sender) {
- sender.addChatMessage(new ChatComponentText("Usage: gt <toggle|chunks>"));
+ sender.addChatMessage(new ChatComponentText("Usage: gt <toggle|chunks|pollution>"));
sender.addChatMessage(new ChatComponentText("\"toggle D1\" - toggles general.Debug (D1)"));
sender.addChatMessage(new ChatComponentText("\"toggle D2\" - toggles general.Debug2 (D2)"));
sender.addChatMessage(new ChatComponentText("\"toggle debugCleanroom\" - toggles cleanroom debug log"));
@@ -38,6 +42,10 @@ public final class GT_Command extends CommandBase {
sender.addChatMessage(new ChatComponentText("\"toggle debugStones\" - toggles worldgen stones debug"));
sender.addChatMessage(new ChatComponentText("\"toggle debugChunkloaders\" - toggles chunkloaders debug"));
sender.addChatMessage(new ChatComponentText("\"chunks\" - print a list of the force loaded chunks"));
+ sender.addChatMessage(new ChatComponentText(
+ "\"pollution <amount>\" - adds the <amount> of the pollution to the current chunk, " +
+ "\n if <amount> isnt specified, will add" + GT_Mod.gregtechproxy.mPollutionSmogLimit + "gibbl."
+ ));
}
@Override
@@ -45,25 +53,24 @@ public final class GT_Command extends CommandBase {
List<String> l = new ArrayList<>();
Stream<String> keywords = Arrays.stream(new String[]{"toggle", "chunks"});
String test = ss.length == 0 ? "" : ss[0].trim();
- if (ss.length == 0 || ss.length == 1 && (test.isEmpty() || keywords.anyMatch(s -> s.startsWith(test)))) {
- keywords.forEach(s -> {
- if (test.isEmpty() || s.startsWith(test))
- l.add(s);
- });
+ if (ss.length == 0 || ss.length == 1 && (test.isEmpty() || Stream.of("toggle", "chunks", "pollution").anyMatch(s -> s.startsWith(test)))) {
+ Stream.of("toggle", "chunks", "pollution")
+ .filter(s -> test.isEmpty() || s.startsWith(test))
+ .forEach(l::add);
} else if (test.equals("toggle")) {
- String test1 = ss.length == 1 ? "" : ss[1].trim();
- Arrays.stream(new String[]{"D1", "D2", "debugCleanroom", "debugDriller", "debugBlockPump", "debugBlockMiner", "debugWorldGen", "debugEntityCramming",
- "debugOrevein", "debugSmallOres", "debugStones", "debugChunkloaders"}).forEach(s -> {
- if (test1.isEmpty() || s.startsWith(test1))
- l.add(s);
- });
+ String test1 = ss[1].trim();
+ Stream.of("D1", "D2", "debugCleanroom", "debugDriller", "debugBlockPump", "debugBlockMiner", "debugWorldGen", "debugEntityCramming",
+ "debugOrevein", "debugSmallOres", "debugStones", "debugChunkloaders")
+ .filter(s -> test1.isEmpty() || s.startsWith(test1))
+ .forEach(l::add);
+
}
return l;
}
@Override
public void processCommand(ICommandSender sender, String[] strings) {
- if (strings.length < 1 || (!strings[0].equals("toggle") && !strings[0].equals("chunks"))) {
+ if (strings.length < 1) {
printHelp(sender);
return;
}
@@ -90,6 +97,21 @@ public final class GT_Command extends CommandBase {
GT_ChunkManager.printTickets();
sender.addChatMessage(new ChatComponentText("Forced chunks logged to GregTech.log"));
break;
+ case "pollution": {
+ ChunkCoordinates coordinates = sender.getPlayerCoordinates();
+ int amount = (strings.length < 2) ? GT_Mod.gregtechproxy.mPollutionSmogLimit : Integer.parseInt(strings[1]);
+ GT_Pollution.addPollution(sender
+ .getEntityWorld()
+ .getChunkFromBlockCoords(
+ coordinates.posX,
+ coordinates.posZ
+ ),
+ amount
+ );
+ break;
+ }
+ default:
+ printHelp(sender);
}
}
}
diff --git a/src/main/java/gregtech/common/render/GT_PollutionRenderer.java b/src/main/java/gregtech/common/render/GT_PollutionRenderer.java
new file mode 100644
index 0000000000..4353786a7b
--- /dev/null
+++ b/src/main/java/gregtech/common/render/GT_PollutionRenderer.java
@@ -0,0 +1,242 @@
+package gregtech.common.render;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.eventhandler.EventPriority;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.gameevent.TickEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.common.entities.GT_EntityFXPollution;
+import gregtech.common.misc.GT_ClientPollutionMap;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityClientPlayerMP;
+import net.minecraft.client.particle.EntityFX;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.potion.Potion;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.World;
+import net.minecraftforge.client.event.EntityViewRenderEvent;
+import net.minecraftforge.event.world.WorldEvent;
+import org.lwjgl.opengl.GL11;
+
+@SideOnly(Side.CLIENT)
+public class GT_PollutionRenderer {
+ private static GT_ClientPollutionMap pollutionMap;
+ private static int playerPollution = 0;
+
+ private static boolean DEBUG = false;
+
+ // PARTICLES_POLLUTION_START + PARTICLES_POLLUTION_END -> Max Particles
+ private static final int PARTICLES_MAX_NUM = 100;
+ private static final int PARTICLES_POLLUTION_START = 400000;
+ private static final int PARTICLES_POLLUTION_END = 3500000;
+
+ private static final int FOG_START_AT_POLLUTION = 400000;
+ private static final int FOG_MAX_AT_POLLUTION = 7000000;
+ //jump from linear to exponential fog. x*FOG_MAX_AT_POLLUTION+FOG_START_AT_POLLUTION
+ private static final double FOG_START_EXP_RATIO = 0.02D;
+
+ private static final float[] fogColor = {0.3f, 0.25f, 0.1f};
+ private static final short[] grassColor = {230, 180, 40};
+ private static final short[] leavesColor = {160, 80, 15};
+ private static final short[] liquidColor = {160, 200, 10};
+ private static final short[] foliageColor = {160, 80, 15};
+
+ //TODO need to soft update some blocks, grass and leaves does more often than liquid it looks like.
+
+ public GT_PollutionRenderer() {
+ pollutionMap = new GT_ClientPollutionMap();
+ }
+
+ public void preLoad() {
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.register(this);
+ FMLCommonHandler.instance().bus().register(this);
+ }
+
+ public void processPacket(ChunkCoordIntPair chunk, int pollution) {
+ pollutionMap.addChunkPollution(chunk.chunkXPos, chunk.chunkZPos, pollution);
+ }
+
+ @SubscribeEvent(priority = EventPriority.HIGH)
+ public void enteredWorld(WorldEvent.Load event) {
+ EntityClientPlayerMP p = Minecraft.getMinecraft().thePlayer;
+ if (!event.world.isRemote || p == null)
+ return;
+ pollutionMap.reset();
+ }
+
+ private static int color(int color, int pollution, int low, float high, short[] colors) {
+ if ( pollution < low)
+ return color;
+
+ int r = (color >> 16) & 0xFF;
+ int g = (color >> 8) & 0xFF;
+ int b = color & 0xFF;
+ float p = (pollution - low) / high;
+ if (p > 1) p = 1;
+ float pi = 1 - p;
+
+ r = ((int) (r * pi + p * colors[0])) & 0xFF;
+ g = ((int) (g * pi + p * colors[1])) & 0xFF;
+ b = ((int) (b * pi + p * colors[2])) & 0xFF;
+
+ return (r & 0xFF) << 16 | (g & 0xFF) << 8 | b & 0xFF;
+ }
+
+ // Methods for hodgepodge to color grass / foliage blocks etc.
+ public static int colorGrass(int oColor, int x, int z) {
+ return color(oColor, pollutionMap.getPollution(x, z)/1000, 350, 600, grassColor);
+ }
+ public static int colorLeaves(int oColor, int x, int z) {
+ return color(oColor, pollutionMap.getPollution(x, z)/1000, 300, 500, leavesColor);
+ }
+ public static int colorLiquid(int oColor, int x, int z) {
+ return color(oColor, pollutionMap.getPollution(x, z)/1000, 300, 500, liquidColor);
+ }
+ public static int colorFoliage(int oColor, int x, int z) {
+ return color(oColor, pollutionMap.getPollution(x, z)/1000, 300, 500, foliageColor);
+ }
+
+ @SubscribeEvent(priority = EventPriority.LOW)
+ public void manipulateColor(EntityViewRenderEvent.FogColors event) {
+ if (!DEBUG && Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode)
+ return;
+
+ if (event.block.getMaterial() == Material.water ||
+ event.block.getMaterial() == Material.lava)
+ return;
+
+ float x = fogIntensityLastTick > 1 ? 1F : (float) fogIntensityLastTick;
+ float xi = 1 - x;
+
+ event.red = xi*event.red + x*fogColor[0];
+ event.green = xi*event.green + x*fogColor[1];
+ event.blue = xi*event.blue + x*fogColor[2];
+ }
+
+ private static final int END_MAX_DISTANCE = 192 - 1;
+ private static double fogIntensityLastTick = 0;
+
+ @SubscribeEvent(priority = EventPriority.LOWEST)
+ public void renderGTPollutionFog(EntityViewRenderEvent.RenderFogEvent event) {
+ if ((!DEBUG && Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) ||
+ (fogIntensityLastTick <= 0 && fogIntensityLastTick >= FOG_START_EXP_RATIO))
+ return;
+
+ if (event.fogMode == 0) {
+ double v = 1 - fogIntensityLastTick/FOG_START_EXP_RATIO;
+ //trying to smooth out jump from linear to exponential
+ GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
+ GL11.glFogf(GL11.GL_FOG_START, (float) ((END_MAX_DISTANCE-20) * 0.75F * v + 20));
+ GL11.glFogf(GL11.GL_FOG_END, (float) (END_MAX_DISTANCE * (0.75F + v * 0.25F)));
+ }
+ //else if ( event.fogMode < 0) { }
+ }
+
+ @SubscribeEvent(priority = EventPriority.LOWEST)
+ public void renderGTPollutionFog(EntityViewRenderEvent.FogDensity event) {
+ if (!DEBUG && Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode)
+ return;
+
+ if (event.entity.isPotionActive(Potion.blindness) ||
+ (fogIntensityLastTick < FOG_START_EXP_RATIO) ||
+ event.block.getMaterial() == Material.water ||
+ event.block.getMaterial() == Material.lava
+ )
+ return;
+
+ GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP2);
+ event.density = (float) Math.pow(fogIntensityLastTick - FOG_START_EXP_RATIO, .75F)/5 + 0.01F;
+ event.setCanceled(true);
+ }
+
+ private double lastUpdate = 0;
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onRenderTick(TickEvent.RenderTickEvent event) {
+ Minecraft mc = Minecraft.getMinecraft();
+ if (mc == null)
+ return;
+ EntityClientPlayerMP player = mc.thePlayer;
+ if (player == null)
+ return;
+
+ if (event.phase == TickEvent.Phase.START) {
+ if (event.renderTickTime < lastUpdate)
+ lastUpdate = lastUpdate - 1;
+ float step = (float) ((event.renderTickTime - lastUpdate) / 50);
+ lastUpdate = event.renderTickTime;
+
+ float fogIntensity = (playerPollution-FOG_START_AT_POLLUTION)/ (float) FOG_MAX_AT_POLLUTION;
+ if (fogIntensity > 1) fogIntensity = 1;
+ else if (fogIntensity < 0) fogIntensity = 0;
+
+ double e = fogIntensity-fogIntensityLastTick;
+ if (e != 0) {
+ if (e > 0.2) e = 0.2D;
+ else if (e < -0.5) e = - 0.5D;
+
+ if (e > 0.001D || e < -0.001D)
+ fogIntensityLastTick += step *e;
+ else
+ fogIntensityLastTick = fogIntensity;
+ }
+ }
+ else if (DEBUG) {
+ drawPollution("Intensity: " + (fogIntensityLastTick * 10000), 0);
+ drawPollution("Pollution: " + pollutionMap.getPollution(Minecraft.getMinecraft().thePlayer.lastTickPosX, Minecraft.getMinecraft().thePlayer.lastTickPosZ), 20);
+ drawPollution("Density: " + ((float)(Math.pow(fogIntensityLastTick - FOG_START_EXP_RATIO, .75F)/5 + 0.01F)* 10000), 40);
+ }
+ }
+
+ // Adding dirt particles in the air
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
+ public void onClientTick(TickEvent.ClientTickEvent event) {
+ Minecraft mc = Minecraft.getMinecraft();
+ if (mc == null)
+ return;
+ EntityClientPlayerMP player = mc.thePlayer;
+ if (player == null || (player.capabilities.isCreativeMode && !DEBUG))
+ return;
+
+ World w = player.worldObj;
+ playerPollution = pollutionMap.getPollution(player.lastTickPosX, player.lastTickPosZ);
+
+ float intensity = ((float) playerPollution - PARTICLES_POLLUTION_START) / PARTICLES_POLLUTION_END;
+ if (intensity < 0)
+ return;
+ else if (intensity > 1)
+ intensity = 1;
+ else
+ intensity *= intensity;
+
+ int x = MathHelper.floor_double(player.posX);
+ int y = MathHelper.floor_double(player.posY);
+ int z = MathHelper.floor_double(player.posZ);
+
+ int numParticles = Math.round(intensity * PARTICLES_MAX_NUM);
+
+ for (int l = 0; l < numParticles; ++l) {
+ int i1 = x + w.rand.nextInt(16) - w.rand.nextInt(16);
+ int j1 = y + w.rand.nextInt(16) - w.rand.nextInt(16);
+ int k1 = z + w.rand.nextInt(16) - w.rand.nextInt(16);
+ Block block = w.getBlock(i1, j1, k1);
+
+ if (block.getMaterial() == Material.air) {
+ EntityFX fx = new GT_EntityFXPollution(w, (float) i1 + w.rand.nextFloat(), (float) j1 + w.rand.nextFloat(), (float) k1 + w.rand.nextFloat());
+ mc.effectRenderer.addEffect(fx);
+ }
+ }
+ }
+
+ private void drawPollution(String text, int off){
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_BLEND);
+ OpenGlHelper.glBlendFunc(770, 771, 1, 0);
+ Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(text, 0, off, 0xFFFFFFFF);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java
index 795e93f582..5ee32f8dc6 100644
--- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java
+++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java
@@ -154,7 +154,7 @@ public class GT_Renderer_Block
}
boolean[] tIsCovered = new boolean[6];
for (byte i = 0; i < 6; i = (byte) (i + 1)) {
- tIsCovered[i] = (aTileEntity.getCoverIDAtSide(i) != 0 ? true : false);
+ tIsCovered[i] = (aTileEntity.getCoverIDAtSide(i) != 0);
}
if ((tIsCovered[0]) && (tIsCovered[1]) && (tIsCovered[2]) && (tIsCovered[3]) && (tIsCovered[4]) && (tIsCovered[5])) {
return renderStandardBlock(aWorld, aX, aY, aZ, aBlock, aRenderer);
@@ -420,20 +420,17 @@ public class GT_Renderer_Block
}
public static void renderNegativeYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
- if (aWorld != null) {
- if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) {
- return;
- }
- Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ));
- }
+ if (aWorld == null) return;
+ if ((aFullBlock) && (!aBlock.shouldSideBeRendered(aWorld, aX, aY - 1, aZ, 0))) return;
+ Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY - 1 : aY, aZ));
+
if (aIcon != null) {
- for (int i = 0; i < aIcon.length; i++) {
- if (aIcon[i] != null) {
- aIcon[i].renderYNeg(aRenderer, aBlock, aX, aY, aZ);
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ);
}
}
}
- aRenderer.flipTexture = false;
}
public static void renderPositiveYFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
@@ -444,13 +441,12 @@ public class GT_Renderer_Block
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aFullBlock ? aY + 1 : aY, aZ));
}
if (aIcon != null) {
- for (int i = 0; i < aIcon.length; i++) {
- if (aIcon[i] != null) {
- aIcon[i].renderYPos(aRenderer, aBlock, aX, aY, aZ);
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ);
}
}
}
- aRenderer.flipTexture = false;
}
public static void renderNegativeZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
@@ -460,15 +456,13 @@ public class GT_Renderer_Block
}
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ - 1 : aZ));
}
- aRenderer.flipTexture = (!aFullBlock);
if (aIcon != null) {
- for (int i = 0; i < aIcon.length; i++) {
- if (aIcon[i] != null) {
- aIcon[i].renderZNeg(aRenderer, aBlock, aX, aY, aZ);
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ);
}
}
}
- aRenderer.flipTexture = false;
}
public static void renderPositiveZFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
@@ -479,13 +473,12 @@ public class GT_Renderer_Block
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aX, aY, aFullBlock ? aZ + 1 : aZ));
}
if (aIcon != null) {
- for (int i = 0; i < aIcon.length; i++) {
- if (aIcon[i] != null) {
- aIcon[i].renderZPos(aRenderer, aBlock, aX, aY, aZ);
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ);
}
}
}
- aRenderer.flipTexture = false;
}
public static void renderNegativeXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
@@ -496,13 +489,12 @@ public class GT_Renderer_Block
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX - 1 : aX, aY, aZ));
}
if (aIcon != null) {
- for (int i = 0; i < aIcon.length; i++) {
- if (aIcon[i] != null) {
- aIcon[i].renderXNeg(aRenderer, aBlock, aX, aY, aZ);
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ);
}
}
}
- aRenderer.flipTexture = false;
}
public static void renderPositiveXFacing(IBlockAccess aWorld, RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ, ITexture[] aIcon, boolean aFullBlock) {
@@ -512,15 +504,13 @@ public class GT_Renderer_Block
}
Tessellator.instance.setBrightness(aBlock.getMixedBrightnessForBlock(aWorld, aFullBlock ? aX + 1 : aX, aY, aZ));
}
- aRenderer.flipTexture = (!aFullBlock);
if (aIcon != null) {
- for (int i = 0; i < aIcon.length; i++) {
- if (aIcon[i] != null) {
- aIcon[i].renderXPos(aRenderer, aBlock, aX, aY, aZ);
+ for (ITexture iTexture : aIcon) {
+ if (iTexture != null) {
+ iTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ);
}
}
}
- aRenderer.flipTexture = false;
}
public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) {
@@ -579,7 +569,7 @@ public class GT_Renderer_Block
if (aTileEntity == null) {
return false;
}
- if (((aTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null) && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer))) {
+ if (aTileEntity instanceof IGregTechTileEntity && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity() != null) && (((IGregTechTileEntity) aTileEntity).getMetaTileEntity().renderInWorld(aWorld, aX, aY, aZ, aBlock, aRenderer))) {
return true;
}
if ((aTileEntity instanceof IPipeRenderedTileEntity)) {
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
index d11b1f2f81..6605d4fc35 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java
@@ -19,11 +19,15 @@ import java.util.Comparator;
public class GT_MetaTileEntity_ChestBuffer
extends GT_MetaTileEntity_Buffer {
+ private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1,1,1};
+
+
public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 28, new String[]{
"Buffers up to 27 Item Stacks",
"Use Screwdriver to regulate output stack size",
- "Consumes 3EU per moved Item"});
+ "Consumes 3EU per moved Item",
+ getTickRateDesc(aTier)});
}
public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) {
@@ -55,6 +59,8 @@ public class GT_MetaTileEntity_ChestBuffer
}
protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (aTimer % tickRate[mTier] > 0) return;
+
if(aBaseMetaTileEntity.hasInventoryBeenModified()) {
fillStacksIntoFirstSlots();
}
@@ -64,9 +70,9 @@ public class GT_MetaTileEntity_ChestBuffer
super.moveItems(aBaseMetaTileEntity, aTimer);
}
// mSuccesss is set to 50 on a successful move
- if(mSuccess == 50) {
- fillStacksIntoFirstSlots();
- }
+ //if(mSuccess == 50) {
+ // fillStacksIntoFirstSlots();
+ //}
if(mSuccess < 0) {
mSuccess = 0;
}
@@ -85,47 +91,32 @@ public class GT_MetaTileEntity_ChestBuffer
return 1;
Item item1 = o1.getItem();
Item item2 = o2.getItem();
-
- // If item1 is a block and item2 isn't, sort item1 before item2
- if (((item1 instanceof ItemBlock)) && (!(item2 instanceof ItemBlock))) {
+
+ if(item1 instanceof ItemBlock) {
+ if (!(item2 instanceof ItemBlock))
+ return -1; // If item1 is a block and item2 isn't, sort item1 before item2
+ } else if (item2 instanceof ItemBlock)
+ return 1; // If item2 is a block and item1 isn't, sort item1 after item2
+
+ int id1 = Item.getIdFromItem( item1 );
+ int id2 = Item.getIdFromItem( item2 );
+ if ( id1 < id2 ) {
return -1;
}
-
- // If item2 is a block and item1 isn't, sort item1 after item2
- if (((item2 instanceof ItemBlock)) && (!(item1 instanceof ItemBlock))) {
+ if ( id1 > id2 ) {
return 1;
}
- // If the items are blocks, use the string comparison
- if ((item1 instanceof ItemBlock)) { // only need to check one since we did the check above
- String displayName1 = o1.getDisplayName();
- String displayName2 = o2.getDisplayName();
- int result = displayName1.compareToIgnoreCase(displayName2);
- //GT_FML_LOGGER.info("sorter: " + displayName1 + " " + displayName2 + " " + result);
- return result;
- } else
- {
- // Not a block. Use the ID and damage to compare them.
- int id1 = Item.getIdFromItem( item1 );
- int id2 = Item.getIdFromItem( item2 );
- if ( id1 < id2 ) {
- return -1;
- }
- if ( id1 > id2 ) {
- return 1;
- }
- // id1 must equal id2, get their damage and compare
- id1 = o1.getItemDamage();
- id2 = o2.getItemDamage();
-
- if ( id1 < id2 ) {
- return -1;
- }
- if ( id1 > id2 ) {
- return 1;
- }
- return 0;
+ id1 = o1.getItemDamage();
+ id2 = o2.getItemDamage();
+
+ if ( id1 < id2 ) {
+ return -1;
+ }
+ if ( id1 > id2 ) {
+ return 1;
}
+ return 0;
}
});
}
@@ -155,4 +146,21 @@ public class GT_MetaTileEntity_ChestBuffer
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity);
}
+
+ protected static String getTickRateDesc(int tier){
+ int tickRate = getTickRate(tier);
+ String s = "";
+ if (tickRate < 20)
+ s = "1/" + 20/tickRate + " ";
+ else if (tickRate > 20) {
+ s = (tickRate / 20) + "th ";
+ }
+ return "Moves items every " + s + "second";
+ }
+
+ protected static int getTickRate(int tier) {
+ if (tier > 9)
+ return 1;
+ return tickRate[tier];
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java
index 10fcb47d12..da35f17518 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java
@@ -15,7 +15,8 @@ public class GT_MetaTileEntity_SuperBuffer
super(aID, aName, aNameRegional, aTier, 257, new String[]{
"Buffers up to 256 Item Stacks",
"Use Screwdriver to regulate output stack size",
- "Consumes 1EU per moved Item"});
+ "Consumes 1EU per moved Item",
+ getTickRateDesc(aTier)});
}
public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java
index 9b9f782601..6292a769a2 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java
@@ -83,17 +83,17 @@ public class GT_MetaTileEntity_TypeFilter
}
}
}
- this.mRotationIndex = 0;
+ this.mRotationIndex = -1;
}
}
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
- if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) {
+ if ((getBaseMetaTileEntity().isServerSide()) && ((aTick % 8L == 0L) || mRotationIndex == -1)) {
if (this.mPrefix.mPrefixedItems.isEmpty()) {
this.mInventory[9] = null;
} else {
- this.mInventory[9] = GT_Utility.copyAmount(1L, new Object[]{this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())});
+ this.mInventory[9] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size()));
if (this.mInventory[9].getItemDamage() == 32767) {
this.mInventory[9].setItemDamage(0);
}
diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
index 6db4013a60..eeb8ec252f 100644
--- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
+++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java
@@ -137,7 +137,11 @@ public class GT_MetaTileEntity_Boiler_Bronze
(GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Charcoal) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
(GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Lignite) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
(GT_Utility.isPartOfMaterials(this.mInventory[2],Materials.Diamond) && !GT_Utility.isPartOfOrePrefix(this.mInventory[2],OrePrefixes.block)) ||
- GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke")
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCoke") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCharcoal") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelCactusCoke") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCharcoal") ||
+ GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], "fuelSugarCoke")
) {
if ((TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10) > 0) {
this.mProcessingEnergy += (TileEntityFurnace.getItemBurnTime(this.mInventory[2])/10);
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
index 46ea555ad0..28f661c339 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java
@@ -216,12 +216,13 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba
}
} else {
int tMetaID = getBaseMetaTileEntity().getWorld().getBlockMetadata(x, y, z);
- ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID));
-
- if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore")))
- return tAssotiation.mMaterial.mMaterial.mDefaultLocalName;
+ ItemStack is = new ItemStack(tBlock, 1, tMetaID);
+ ItemData association = GT_OreDictUnificator.getAssociation(is);
+ if ((association != null) && (association.mPrefix.toString().startsWith("ore")))
+ return association.mMaterial.mMaterial.mDefaultLocalName;
+ else if (GT_Utility.isOre(is))
+ return tBlock.getLocalizedName();
}
-
return null;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
index 938c2d6900..6895310b46 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
@@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.objects.GT_ItemStack;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
@@ -14,6 +15,10 @@ import net.minecraft.item.ItemStack;
public class GT_MetaTileEntity_Boxinator
extends GT_MetaTileEntity_BasicMachine {
+ ItemStack aInputCache;
+ ItemStack aOutputCache;
+ int aTypeCache = 0;
+
public GT_MetaTileEntity_Boxinator(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR)});
}
@@ -34,28 +39,56 @@ public class GT_MetaTileEntity_Boxinator
return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes;
}
+ private boolean hasValidCache(ItemStack mItem,int mType,boolean mClearOnFailure) {
+ if (aInputCache != null
+ && aOutputCache != null
+ && aTypeCache == mType
+ && aInputCache.isItemEqual(mItem)
+ && ItemStack.areItemStackTagsEqual(mItem,aInputCache))
+ return true;
+ // clear cache if it was invalid
+ if (mClearOnFailure) {
+ aInputCache = null;
+ aOutputCache = null;
+ aTypeCache = 0;
+ }
+ return false;
+ }
+
+ private void cacheItem(ItemStack mInputItem,ItemStack mOutputItem,int mType) {
+ aTypeCache = mType;
+ aOutputCache = mOutputItem.copy();
+ aInputCache = mInputItem.copy();
+ }
+
public int checkRecipe() {
int tCheck = super.checkRecipe();
if (tCheck != DID_NOT_FIND_RECIPE) {
return tCheck;
}
- if ((GT_Utility.isStackValid(getInputAt(0))) && (GT_Utility.isStackValid(getInputAt(1))) && (GT_Utility.getContainerItem(getInputAt(0), true) == null)) {
- if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 1)) {
- this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[]{getInputAt(0)});
+ ItemStack tSlot0 = getInputAt(0);
+ ItemStack tSlot1 = getInputAt(1);
+ if ((GT_Utility.isStackValid(tSlot0)) && (GT_Utility.isStackValid(tSlot1)) && (GT_Utility.getContainerItem(tSlot0, true) == null)) {
+ if ((ItemList.Schematic_1by1.isStackEqual(tSlot1)) && (tSlot0.stackSize >= 1)) {
+ boolean tIsCached = hasValidCache(tSlot0,1,true);
+ this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0});
if (this.mOutputItems[0] != null) {
if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
- getInputAt(0).stackSize -= 1;
+ tSlot0.stackSize -= 1;
calculateOverclockedNess(32,16);
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ if (!tIsCached)
+ cacheItem(tSlot0,this.mOutputItems[0],1);
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
}
return DID_NOT_FIND_RECIPE;
}
- if ((ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 4)) {
- this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[]{getInputAt(0), getInputAt(0), null, getInputAt(0), getInputAt(0)});
+ if ((ItemList.Schematic_2by2.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 4)) {
+ boolean tIsCached = hasValidCache(tSlot0,2,true);
+ this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0, tSlot0, null, tSlot0, tSlot0});
if (this.mOutputItems[0] != null) {
if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
getInputAt(0).stackSize -= 4;
@@ -63,13 +96,16 @@ public class GT_MetaTileEntity_Boxinator
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ if (!tIsCached)
+ cacheItem(tSlot0,this.mOutputItems[0],2);
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
}
return DID_NOT_FIND_RECIPE;
}
- if ((ItemList.Schematic_3by3.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 9)) {
- this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[]{getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0)});
+ if ((ItemList.Schematic_3by3.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 9)) {
+ boolean tIsCached = hasValidCache(tSlot0,3,true);
+ this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0});
if (this.mOutputItems[0] != null) {
if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
getInputAt(0).stackSize -= 9;
@@ -77,6 +113,8 @@ public class GT_MetaTileEntity_Boxinator
//In case recipe is too OP for that machine
if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ if (!tIsCached)
+ cacheItem(tSlot0,this.mOutputItems[0],3);
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
}
@@ -88,8 +126,11 @@ public class GT_MetaTileEntity_Boxinator
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) || (ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) || (ItemList.Schematic_3by3.isStackEqual(getInputAt(1)))) {
- if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), getInputAt(1)}) != null) {
+ ItemStack tInput1 = getInputAt(1);
+ if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) {
+ if (hasValidCache(aStack,aTypeCache,false))
+ return true;
+ if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), tInput1}) != null) {
return true;
}
if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack}) != null)
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
index 44db32e6b9..69543a7196 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java
@@ -6,13 +6,12 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.objects.ItemData;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
+
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -21,6 +20,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
+import net.minecraft.world.ChunkPosition;
import net.minecraftforge.common.util.FakePlayer;
import java.util.ArrayList;
@@ -33,7 +33,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
private static final Block MINING_PIPE_BLOCK = GT_Utility.getBlockFromStack(MINING_PIPE);
private static final Block MINING_PIPE_TIP_BLOCK = GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 0));
- int drillX, drillY, drillZ;
+ int drillY = 0;
boolean isPickingPipes;
boolean waitMiningPipe;
final static int[] RADIUS = new int[]{8, 8, 16, 24, 32}; //Miner radius per tier
@@ -41,6 +41,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
final static int[] ENERGY = new int[]{8, 8, 32, 128, 512}; //Miner energy consumption per tier
private int radiusConfig; //Miner configured radius
+ private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>();
public GT_MetaTileEntity_Miner(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 1,
@@ -90,7 +91,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
return true;
}
-
+
@Override
public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
@@ -109,8 +110,14 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
radiusConfig = 0;
}
GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.workareaset") + " " + (radiusConfig * 2 + 1) + "x" + (radiusConfig * 2 + 1));//TODO Add translation support
+ oreBlockPositions.clear();
+ fillOreList(getBaseMetaTileEntity());
}
}
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ fillOreList(aBaseMetaTileEntity);
+ }
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
@@ -165,50 +172,34 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
return;
}
- if (drillY == 0) {
+ if (drillY == 0 || oreBlockPositions.isEmpty()) {
moveOneDown(aBaseMetaTileEntity);
- return;
- }
- if (drillZ > radiusConfig) {
- moveOneDown(aBaseMetaTileEntity);
- return;
- }
- while (drillZ <= radiusConfig) {
- while (drillX <= radiusConfig) {
- Block block = aBaseMetaTileEntity.getBlockOffset(drillX, drillY, drillZ);
- int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(drillX, drillY, drillZ);
- if (block instanceof GT_Block_Ores_Abstract) {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(drillX, drillY, drillZ);
- if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural) {
- mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ);
- if (debugBlockMiner) {
- GT_Log.out.println("MINER: Mining GT ore block at " + drillX + " " + drillY + " " + drillZ);
- }
- return;
- } else {
- if (debugBlockMiner) {
- GT_Log.out.println("MINER: Not natural ore, will not mine");
- }
- }
- } else {
- ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta));
- if (association != null && association.mPrefix.toString().startsWith("ore")) {
- mineBlock(aBaseMetaTileEntity, drillX, drillY, drillZ);
- if (debugBlockMiner) {
- GT_Log.out.println("MINER: Mining oredict ore block at " + drillX + " " + drillY + " " + drillZ);
- }
- return;
- }
- }
- drillX++;
+ } else {
+ ChunkPosition oreBlockPos = oreBlockPositions.remove(0);
+ mineBlock(aBaseMetaTileEntity, oreBlockPos.chunkPosX, oreBlockPos.chunkPosY, oreBlockPos.chunkPosZ);
+ if (debugBlockMiner) {
+ GT_Log.out.println("MINER: Mining GT ore block at " + oreBlockPos.chunkPosX + " " + drillY + " " + oreBlockPos.chunkPosZ);
}
- drillX = -radiusConfig;
- drillZ++;
}
}
}
}
-
+ private void fillOreList(IGregTechTileEntity aBaseMetaTileEntity) {
+ if (drillY == 0)
+ return;
+ for (int z = -radiusConfig; z <= radiusConfig; ++z) {
+ for (int x = -radiusConfig; x <= radiusConfig; ++x) {
+ Block block = aBaseMetaTileEntity.getBlockOffset(x, drillY, z);
+ int blockMeta = aBaseMetaTileEntity.getMetaIDOffset(x, drillY, z);
+ if (block instanceof GT_Block_Ores_Abstract) {
+ TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntityOffset(x, drillY, z);
+ if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural)
+ oreBlockPositions.add(new ChunkPosition(x, drillY, z));
+ } else if (GT_Utility.isOre(new ItemStack(block, 1, blockMeta)))
+ oreBlockPositions.add(new ChunkPosition(x, drillY, z));
+ }
+ }
+ }
@Override
public long maxEUStore() {
return mTier == 1 ? 4096 : V[mTier] * 64;
@@ -253,13 +244,16 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
}
aBaseMetaTileEntity.getWorld().setBlock(xCoord, yCoord + drillY - 1, zCoord, MINING_PIPE_TIP_BLOCK);
drillY--;
- drillZ = -RADIUS[mTier];
- drillX = -RADIUS[mTier];
+ fillOreList(aBaseMetaTileEntity);
return true;
}
public void mineBlock(IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z) {
- if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(aBaseMetaTileEntity), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z, true));
+ if (!GT_Utility.eraseBlockByFakePlayer(getFakePlayer(aBaseMetaTileEntity), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z, true)) {
+ if (debugBlockMiner)
+ GT_Log.out.println("MINER: FakePlayer cannot mine block at " + (aBaseMetaTileEntity.getXCoord() + x) + ", " + (aBaseMetaTileEntity.getYCoord() + y) + ", " + (aBaseMetaTileEntity.getZCoord() + z));
+ return;
+ }
ArrayList<ItemStack> drops = getBlockDrops(aBaseMetaTileEntity.getBlockOffset(x, y, z), aBaseMetaTileEntity.getXCoord() + x, aBaseMetaTileEntity.getYCoord() + y, aBaseMetaTileEntity.getZCoord() + z);
if (drops.size() > 0)
mOutputItems[0] = drops.get(0);
@@ -284,9 +278,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
public void saveNBTData(NBTTagCompound aNBT) {
super.saveNBTData(aNBT);
aNBT.setBoolean("isPickingPipe", isPickingPipes);
- aNBT.setInteger("drillX", drillX);
aNBT.setInteger("drillY", drillY);
- aNBT.setInteger("drillZ", drillZ);
aNBT.setInteger("radiusConfig", radiusConfig);
}
@@ -294,9 +286,7 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine {
public void loadNBTData(NBTTagCompound aNBT) {
super.loadNBTData(aNBT);
isPickingPipes = aNBT.getBoolean("isPickingPipe");
- drillX = aNBT.getInteger("drillX");
drillY = aNBT.getInteger("drillY");
- drillZ = aNBT.getInteger("drillZ");
if (aNBT.hasKey("radiusConfig"))
radiusConfig = aNBT.getInteger("radiusConfig");
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
index 67ce33f104..c90df2a7a7 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java
@@ -2,6 +2,8 @@ package gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
@@ -14,6 +16,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
@@ -42,17 +45,34 @@ public class GT_MetaTileEntity_AssemblyLine
}
public String[] getDescription() {
- return new String[]{"Assembling Line",
- "Size: 3x(5-16)x4, variable length",
- "From Bottom to Top, Left to Right",
- "Layer 1 - Solid Steel Machine Casing, Input Bus (last is Output Bus), Solid Steel Machine Casing",
- " - Casings can be replaced by Maint or Input Hatch",
- "Layer 2 - Reinforced Glass, Assembling Line Casing, Reinforced Glass",
- "Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing",
- "Layer 4 - Empty, Solid Steel Machine Casing, Empty - Casing can be replaced by Energy Hatch",
- "Up to 16 repeating slices, First replaces 1 Grate with Assembly Line,",
- "Last has Output Bus instead of Input Bus",
- "Optional - Replace 1x Grate with Data Access Hatch next to the Controller"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Assembling Line")
+ .addInfo("Controller block for the Assembling Line")
+ .addInfo("Used to make complex machine parts (LuV+)")
+ .addInfo("Does not make Assembler items")
+ .addSeparator()
+ .beginVariableStructureBlock(5, 15, 4, 4, 3, 3, false)//?
+ .addStructureInfo("From Bottom to Top, Left to Right")
+ .addStructureInfo("Layer 1 - Solid Steel Machine Casing, Input Bus (last is Output Bus), Solid Steel Machine Casing")
+ .addStructureInfo("Layer 2 - Reinforced Glass, Assembling Line Casing, Reinforced Glass")
+ .addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing")
+ .addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty")
+ .addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes, aside from the last")
+ .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller")
+ .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller")//TT
+
+ .addController("Either Grate on layer 3 of the first slice")
+ .addEnergyHatch("Any layer 4 casing")
+ .addMaintenanceHatch("Any layer 1 casing")
+ .addInputBus("As specified on layer 1")
+ .addInputHatch("Any layer 1 casing")
+ .addOutputBus("Replaces Input Bus on final slice")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java
index 95b45e2cc4..eb1ce1348f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java
@@ -1,11 +1,14 @@
package gregtech.common.tileentities.machines.multi;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import net.minecraft.block.Block;
public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_PrimitiveBlastFurnace{
@@ -26,13 +29,25 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Bricked Blast Furnace",
- "Controller has to be placed in the (front) center of the second layer",
- "Useable for Steel and general Pyrometallurgy",
- "Size(WxHxD): 3x4x3 (Hollow, with opening on top)",
- "Built from 32 Firebricks",
- "Causes 200 Pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Blast Furnace")
+ .addInfo("Controller Block for the Bricked Blast Furnace")
+ .addInfo("Usable for Steel and general Pyrometallurgy")
+ .addInfo("Has a useful interface, unlike other gregtech multis")
+ .addPollutionAmount(200)
+ .addSeparator()
+ .beginStructureBlock(3, 4, 3, true)
+ .addController("Front center")
+ .addOtherStructurePart("Firebricks", "Everything except the controller")
+ .addStructureInfo("The top block is also empty")
+ .addStructureInfo("You can share the walls of GT multis, so")
+ .addStructureInfo("each additional one costs less, up to 4")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
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 0ca5b79d68..af388a790d 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
@@ -27,12 +27,13 @@ public class GT_MetaTileEntity_BronzeBlastFurnace
}
public String[] getDescription() {
- return new String[]{
+ return new String[]{"Disabled"};
+ /*return new String[]{
"Controller Block for the Bronze Blast Furnace",
"Useable for Steel and general Pyrometallurgy",
"Size(WxHxD): 3x4x3 (Hollow, with opening on top)",
"Built from 32 Bronze Plated Bricks",
- "Causes 200 Pollution per second"};
+ "Causes 200 Pollution per second"};*/
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java
index 8be3b10f54..8459f5e84b 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java
@@ -2,6 +2,8 @@ package gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
@@ -10,6 +12,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.common.GT_Pollution;
import net.minecraft.block.Block;
@@ -38,15 +41,25 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock
}
public String[] getDescription() {
- return new String[]{
- "Controller for the Charcoal Pit",
- "Converts Logs into Brittle Charcoal blocks",
- "Max Size(WxHxD): 11x6x11, Controller (Top layer, centered)",
- "11x1x11 of Bricks (Bottom layer only)",
- "11x5x11 of Logs (Above bottom Brick layer)",
- "Only grass/dirt can touch Log blocks",
- "No air between logs allowed",
- "Causes 100 Pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Charcoal Pile Igniter")
+ .addInfo("Controller for the Charcoal Pit")
+ .addInfo("Converts Logs into Brittle Charcoal blocks")
+ .addInfo("Will automatically start when valid")
+ .addPollutionAmount(100)
+ .addSeparator()
+ .beginVariableStructureBlock(3, 11, 3, 6, 3, 11, false)
+ .addStructureInfo("Can be up to 11x6x11 in size, shape doesn't matter")
+ .addOtherStructurePart("Bricks", "Bottom layer, under all wood logs")
+ .addOtherStructurePart("Dirt/Grass", "All logs must be covered by these, the controller, or bricks")
+ .addOtherStructurePart("Wood Logs", "Inside the previously mentioned blocks")
+ .addStructureInfo("No air between logs allowed")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
index 673c2cabaf..606c63110f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java
@@ -5,21 +5,26 @@ import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMachineCallback;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
import static gregtech.api.enums.GT_Values.debugCleanroom;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase {
+ private int mHeight = -1;
public GT_MetaTileEntity_Cleanroom(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -36,27 +41,40 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
@Override
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Cleanroom",
- "Min(WxHxD): 3x4x3 (Hollow), Max(WxHxD): 15x15x15 (Hollow)",
- "Controller (Top center)",
- "Top besides contoller and edges: Filter Machine Casing",
- "1 Reinforced Door (keep closed for 100% efficency)",
- "1x LV or 1x MV Energy Hatch, 1x Maintainance Hatch",
- "Up to 10 Machine Hull Item & Energy transfer through walls",
- "Remaining Blocks: Plascrete, 20 min",
- GT_Values.cleanroomGlass+"% of the Plascrete can be Reinforced Glass (min 20 Plascrete still apply)",
- "Consumes 40 EU/t when first turned on and 4 EU/t once at 100% efficiency",
- "An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV",
- "2 LV batteries + 1 LV generator or 1 MV generator",
- "Make sure your Energy Hatch matches!"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Cleanroom")
+ .addInfo("Controller block for the Cleanroom")
+ .addInfo("Consumes 40 EU/t when first turned on and 4 EU/t once at 100% efficiency when not overclocked")//?
+ .addInfo("An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV")
+ .addInfo("2 LV batteries + 1 LV generator or 1 MV generator")//?
+ .addInfo("Time required to reach full efficiency is propotional to the height of empty space within")
+ .addInfo("Make sure your Energy Hatch matches! ?")
+ .addSeparator()
+ .beginVariableStructureBlock(3, 15, 4, 15, 3, 15, true)
+ .addController("Top center")
+ .addCasingInfo("Plascrete", 20)
+ .addStructureInfo(GT_Values.cleanroomGlass+"% of the Plascrete can be replaced with Reinforced Glass")//check
+ .addOtherStructurePart("Filter Machine Casing", "Top besides controller and edges")
+ .addEnergyHatch("LV or MV, any casing")//check
+ .addMaintenanceHatch("Any casing")
+ .addStructureInfo("1x Reinforced Door (keep closed or efficiency will reduce)")
+ .addStructureInfo("Up to 10 Machine Hulls for Item & Energy transfer through walls")
+ .addStructureInfo("You can also use Diodes for more power")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
public boolean checkRecipe(ItemStack aStack) {
mEfficiencyIncrease = 100;
- mMaxProgresstime = 100;
- mEUt = -4;
+ // use the standard overclock mechanism to determine duration and estimate a maximum consumption
+ calculateOverclockedNessMulti(40, 45 * Math.min(1, mHeight - 1), 1, getMaxInputVoltage());
+ // negate it to trigger the special energy consumption function. divide by 10 to get the actual final consumption.
+ mEUt /= -10;
return true;
}
@@ -202,24 +220,8 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1 || mDoorCount != 2 || mHullCount > 10) {
return false;
}
- for (int dX = -x + 1; dX <= x - 1; dX++) {
- for (int dZ = -z + 1; dZ <= z - 1; dZ++) {
- for (int dY = -1; dY >= y + 1; dY--) {
- IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ);
- if (tTileEntity != null) {
- IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity();
- if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicMachine) {
- if (debugCleanroom) {
- GT_Log.out.println(
- "Cleanroom: Machine detected, adding pointer back to cleanroom"
- );
- }
- ((GT_MetaTileEntity_BasicMachine) aMetaTileEntity).mCleanroom = this;
- }
- }
- }
- }
- }
+
+ setCallbacks(x, y, z, aBaseMetaTileEntity);
if (doorState) {
this.mEfficiency = Math.max(0, this.mEfficiency - 200);
@@ -231,9 +233,38 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas
float ratio = (((float)mPlascreteCount)/100f)* GT_Values.cleanroomGlass;
+ this.mHeight = -y;
+
return mPlascreteCount>=20 && mGlassCount < (int) Math.floor(ratio);
}
-
+
+ private void setCallbacks(int x, int y, int z, IGregTechTileEntity aBaseMetaTileEntity){
+ for (int dX = -x + 1; dX <= x - 1; dX++)
+ for (int dZ = -z + 1; dZ <= z - 1; dZ++)
+ for (int dY = -1; dY >= y + 1; dY--) {
+ TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityOffset(dX, dY, dZ);
+
+ if (tTileEntity instanceof IGregTechTileEntity) {
+ IMetaTileEntity iMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity();
+
+ if (iMetaTileEntity instanceof IMachineCallback<?>)
+ checkAndSetCallback((IMachineCallback<?>) iMetaTileEntity);
+
+ } else if (tTileEntity instanceof IMachineCallback<?>)
+ checkAndSetCallback((IMachineCallback<?>) tTileEntity);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private void checkAndSetCallback(IMachineCallback<?> iMachineCallback) {
+ if (debugCleanroom)
+ GT_Log.out.println(
+ "Cleanroom: IMachineCallback detected, checking for cleanroom: " + (iMachineCallback.getType() == this.getClass())
+ );
+ if (iMachineCallback.getType() == this.getClass())
+ ((IMachineCallback<GT_MetaTileEntity_Cleanroom>) iMachineCallback).setCallbackBase(this);
+ }
+
@Override
public boolean allowGeneralRedstoneOutput(){
return true;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
index 0a68bd7b03..ed6c028243 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfiller2.java
@@ -4,9 +4,12 @@ import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import static gregtech.api.enums.GT_Values.VN;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_ConcreteBackfiller2 extends GT_MetaTileEntity_ConcreteBackfillerBase {
public GT_MetaTileEntity_ConcreteBackfiller2(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
@@ -19,18 +22,33 @@ public class GT_MetaTileEntity_ConcreteBackfiller2 extends GT_MetaTileEntity_Con
@Override
public String[] getDescription() {
String casings = getCasingBlockItem().get(0).getDisplayName();
- return new String[]{
- "Controller Block for the Advanced Concrete Backfiller",
- "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
- "3x1x3 Base of " + casings,
- "1x3x1 " + casings + " pillar (Center of base)",
- "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
- "1x Input Hatch (One of base casings)",
- "1x Maintenance Hatch (One of base casings)",
- "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
- "Put Programmed Circuits into Data Access to config radius",
- "Radius = (total config value)x2 blocks",
- "Default 64, Maximum 128",};
+
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Concrete Backfiller")
+ .addInfo("Controller Block for the Advanced Concrete Backfiller")
+ .addInfo("Will fill in areas below it with light concrete. This goes through walls")
+ .addInfo("Use it to remove any spawning locations beneath your base to reduce lag")
+ .addInfo("Will pull back the pipes after it finishes that layer")
+ .addInfo("Put Programmed Circuits into a Data Access Hatch to config radius. Buggy")
+ .addInfo("Radius = (total config value)x2 blocks. Default 64, Maximum 128")//broken
+ .addSeparator()
+ .beginStructureBlock(3, 7, 3, false)
+ .addController("Front bottom")
+ .addStructureInfo(casings + " form the 3x1x3 Base")
+ .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)")
+ .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing")
+ .addMaintenanceHatch("Any base casing")
+ .addStructureInfo("Data Access Hatch: Any base casing")
+ .addInputBus("Mining Pipes, optional, any base casing")
+ .addInputHatch("GT Concrete, any base casing")
+ .addOutputBus("Mining Pipes, optional, any base casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
index a70b5d76b8..a65f4d0e86 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ConcreteBackfillerBase.java
@@ -4,12 +4,15 @@ import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import static gregtech.api.enums.GT_Values.VN;
+import org.lwjgl.input.Keyboard;
+
public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTileEntity_DrillerBase {
private int mLastXOff = 0, mLastZOff = 0;
@@ -24,16 +27,31 @@ public abstract class GT_MetaTileEntity_ConcreteBackfillerBase extends GT_MetaTi
protected String[] getDescriptionInternal(String tierSuffix) {
String casings = getCasingBlockItem().get(0).getDisplayName();
- return new String[]{
- "Controller Block for the Concrete Backfiller " + (tierSuffix != null ? tierSuffix : ""),
- "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
- "3x1x3 Base of " + casings,
- "1x3x1 " + casings + " pillar (Center of base)",
- "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
- "1x Input Hatch (One of base casings)",
- "1x Maintenance Hatch (One of base casings)",
- "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
- "Radius is " + getRadius() + " blocks"};
+
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Concrete Backfiller")
+ .addInfo("Controller Block for the Concrete Backfiller " + (tierSuffix != null ? tierSuffix : ""))//Unused?
+ .addInfo("Will fill in areas below it with light concrete. This goes through walls")
+ .addInfo("Use it to remove any spawning locations beneath your base to reduce lag")
+ .addInfo("Will pull back the pipes after it finishes that layer")
+ .addInfo("Radius is " + getRadius() + " blocks")
+ .addSeparator()
+ .beginStructureBlock(3, 7, 3, false)
+ .addController("Front bottom")
+ .addStructureInfo(casings + " form the 3x1x3 Base")
+ .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)")
+ .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing")
+ .addMaintenanceHatch("Any base casing")
+ .addInputBus("Mining Pipes, optional, any base casing")
+ .addInputHatch("GT Concrete, any base casing")
+ .addOutputBus("Mining Pipes, optional, any base casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
index c37a5a9976..f16c9d2d4f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java
@@ -3,6 +3,8 @@ package gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
import java.util.Collection;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
@@ -15,6 +17,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynam
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
@@ -40,22 +43,34 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Large Combustion Engine",
- "Size(WxHxD): 3x3x4, Controller (front centered)",
- "3x3x4 of Stable Titanium Machine Casing (hollow, Min 16!)",
- "2x Titanium Gear Box Machine Casing inside the Hollow Casing",
- "8x Engine Intake Machine Casing (around controller)",
- "2x Input Hatch (Fuel/Lubricant) (one of the Casings next to a Gear Box)",
- "1x Maintenance Hatch (one of the Casings next to a Gear Box)",
- "1x Muffler Hatch (top middle back, next to the rear Gear Box)",
- "1x Dynamo Hatch (back centered)",
- "Engine Intake Casings must not be obstructed in front (only air blocks)",
- "Supply Flammable Fuels and 1000L of Lubricant per hour to run.",
- "Supply 40L of Oxygen per second to boost output (optional).",
- "Default: Produces 2048EU/t at 100% efficiency",
- "Boosted: Produces 6144EU/t at 150% efficiency",
- "Causes " + 20 * getPollutionPerTick(null) + " Pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Combustion Generator")
+ .addInfo("Controller block for the Large Combustion Engine")
+ .addInfo("Supply Diesel Fuels and 1000L of Lubricant per hour to run")
+ .addInfo("Supply 40L/s of Oxygen to boost output (optional)")
+ .addInfo("Default: Produces 2048EU/t at 100% fuel efficiency")
+ .addInfo("Boosted: Produces 6144EU/t at 150% fuel efficiency")
+ .addInfo("You need to wait for it to reach 300% to output full power")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 4, false)
+ .addController("Front center")
+ .addCasingInfo("Stable Titanium Machine Casing", 16)
+ .addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks")
+ .addOtherStructurePart("Engine Intake Machine Casing", "8x, ring around controller")
+ .addStructureInfo("Engine Intake Casings must not be obstructed in front (only air blocks)")
+ .addDynamoHatch("Back center")
+ .addMaintenanceHatch("One of the casings next to a Gear Box")
+ .addMufflerHatch("Top middle back, above the rear Gear Box")
+ .addInputHatch("Diesel Fuel, next to a Gear Box")
+ .addInputHatch("Lubricant, next to a Gear Box")
+ .addInputHatch("Oxygen, optional, next to a Gear Box")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
@@ -74,10 +89,50 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png");
}
+ // can't use getRecipeMap() or else the fluid hatch will reject oxygen
+ protected GT_Recipe.GT_Recipe_Map_Fuel getFuelMap() {
+ return GT_Recipe.GT_Recipe_Map.sDieselFuels;
+ }
+
+ /**
+ * The nominal energy output
+ * This can be further multiplied by {@link #getMaxEfficiency(ItemStack)} when boosted
+ */
+ protected int getNominalOutput() {
+ return 2048;
+ }
+
+ protected Materials getBooster() {
+ return Materials.Oxygen;
+ }
+
+ /**
+ * x times fuel will be consumed when boosted
+ * This will however NOT increase power output
+ * Go tweak {@link #getMaxEfficiency(ItemStack)} and {@link #getNominalOutput()} instead
+ */
+ protected int getBoostFactor() {
+ return 2;
+ }
+
+ /**
+ * x times of additive will be consumed when boosted
+ */
+ protected int getAdditiveFactor() {
+ return 1;
+ }
+
+ /**
+ * Efficiency will increase by this amount every tick
+ */
+ protected int getEfficiencyIncrease() {
+ return 15;
+ }
+
@Override
public boolean checkRecipe(ItemStack aStack) {
ArrayList<FluidStack> tFluids = getStoredFluids();
- Collection<GT_Recipe> tRecipeList = GT_Recipe.GT_Recipe_Map.sDieselFuels.mRecipeList;
+ Collection<GT_Recipe> tRecipeList = getFuelMap().mRecipeList;
if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel?
for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches
@@ -85,21 +140,21 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
FluidStack tLiquid;
if ((tLiquid = GT_Utility.getFluidForFilledItem(aFuel.getRepresentativeInput(0), true)) != null) { //Create fluidstack from current recipe
if (hatchFluid1.isFluidEqual(tLiquid)) { //Has a diesel fluid
- fuelConsumption = tLiquid.amount = boostEu ? (4096 / aFuel.mSpecialValue) : (2048 / aFuel.mSpecialValue); //Calc fuel consumption
+ fuelConsumption = tLiquid.amount = boostEu ? (getBoostFactor() * getNominalOutput() / aFuel.mSpecialValue) : (getNominalOutput() / aFuel.mSpecialValue); //Calc fuel consumption
if(depleteInput(tLiquid)) { //Deplete that amount
- boostEu = depleteInput(Materials.Oxygen.getGas(2L));
+ boostEu = depleteInput(getBooster().getGas(2L * getAdditiveFactor()));
if(tFluids.contains(Materials.Lubricant.getFluid(1L))) { //Has lubricant?
//Deplete Lubricant. 1000L should = 1 hour of runtime (if baseEU = 2048)
- if(mRuntime % 72 == 0 || mRuntime == 0) depleteInput(Materials.Lubricant.getFluid(boostEu ? 2 : 1));
+ if(mRuntime % 72 == 0 || mRuntime == 0) depleteInput(Materials.Lubricant.getFluid((boostEu ? 2L : 1L) * getAdditiveFactor()));
} else return false;
fuelValue = aFuel.mSpecialValue;
fuelRemaining = hatchFluid1.amount; //Record available fuel
- this.mEUt = mEfficiency < 2000 ? 0 : 2048; //Output 0 if startup is less than 20%
+ this.mEUt = mEfficiency < 2000 ? 0 : getNominalOutput(); //Output 0 if startup is less than 20%
this.mProgresstime = 1;
this.mMaxProgresstime = 1;
- this.mEfficiencyIncrease = 15;
+ this.mEfficiencyIncrease = getEfficiencyIncrease();
return true;
}
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
index 45ba3c97f5..12ab91d876 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java
@@ -10,6 +10,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
@@ -20,6 +21,8 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_DistillationTower
extends GT_MetaTileEntity_MultiBlockBase {
private static final int CASING_INDEX = 49;
@@ -38,18 +41,26 @@ public class GT_MetaTileEntity_DistillationTower
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Distillation Tower",
- "Size(WxHxD): 3xhx3 (Hollow), with h ranging from 3 to 12",
- "Controller (Front bottom)",
- "1x Input Hatch (Any bottom layer casing)",
- "2-11x Output Hatch (One per layer except bottom layer)",
- "1x Output Bus (Any bottom layer casing)",
- "1x Maintenance Hatch (Any casing)",
- "1x Energy Hatch (Any casing)",
- "Fluids are only put out at the correct height",
- "The correct height equals the slot number in the NEI recipe",
- "Clean Stainless Steel Machine Casings for the rest (7 x h - 5 at least!)"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Distillery")
+ .addInfo("Controller block for the Distillation Tower")
+ .addInfo("Fluids are only put out at the correct height")
+ .addInfo("The correct height equals the slot number in the NEI recipe")
+ .addSeparator()
+ .beginVariableStructureBlock(3, 3, 3, 12, 3, 3, true)
+ .addController("Front bottom")
+ .addOtherStructurePart("Clean Stainless Steel Machine Casing", "7 x h - 5 (minimum)")
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addInputHatch("Any bottom layer casing")
+ .addOutputBus("Any bottom layer casing")
+ .addOutputHatch("2-11x Output Hatches (One per layer except bottom layer)")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
index df3dea34fa..061db80ece 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java
@@ -5,6 +5,8 @@ import static gregtech.api.enums.GT_Values.VN;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
@@ -18,6 +20,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Outpu
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
@@ -47,22 +50,35 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Blast Furnace",
- "Size(WxHxD): 3x4x3 (Hollow), Controller (Front middle bottom)",
- "16x Heating Coils (Two middle Layers, hollow)",
- "1x Input Hatch/Bus (Any bottom layer casing)",
- "1x Output Hatch/Bus (Any bottom layer casing)",
- "1x Energy Hatch (Any bottom layer casing)",
- "1x Maintenance Hatch (Any bottom layer casing)",
- "1x Muffler Hatch (Top middle)",
- "1x Output Hatch to recover CO2/CO/SO2 (optional, any top layer casing),",
- " Recovery scales with Muffler Hatch tier",
- "Heat Proof Machine Casings for the rest",
- "Each 900K over the min. Heat Capacity multiplies eu/t by 0.95",
- "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 " + 20 * getPollutionPerTick(null) + " Pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Blast Furnace")
+ .addInfo("Controller block for the Electric Blast Furnace")
+ .addInfo("You can use some fluids to reduce recipe time. Place the circuit in the Input Bus")
+ .addInfo("Each 900K over the min. Heat required multiplies EU/t by 0.95")
+ .addInfo("Each 1800K over the min. Heat required allows for one upgraded overclock instead of normal")
+ .addInfo("Upgraded overclocks reduce recipe time to 25% (instead of 50%) and increase EU/t to 400%")
+ .addInfo("Additionally gives +100K for every tier past MV")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 4, 3, true)
+ .addController("Front bottom")
+ .addCasingInfo("Heat Proof Machine Casing", 0)
+ .addOtherStructurePart("Heating Coils (any tier)", "Two middle Layers")
+ .addEnergyHatch("Any bottom layer casing")
+ .addMaintenanceHatch("Any bottom layer casing")
+ .addMufflerHatch("Top middle")
+ .addInputBus("Any bottom layer casing")
+ .addInputHatch("Any bottom layer casing")
+ .addOutputBus("Any bottom layer casing")
+ .addOutputHatch("Gasses, Any top layer casing")
+ .addStructureInfo("Recovery amount scales with Muffler Hatch tier")
+ .addOutputHatch("Platline fluids, Any bottom layer casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
new file mode 100644
index 0000000000..363d689c84
--- /dev/null
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java
@@ -0,0 +1,192 @@
+package gregtech.common.tileentities.machines.multi;
+
+import org.lwjgl.input.Keyboard;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_GUIContainer_MultiMachine;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
+import gregtech.api.util.GT_Recipe;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+
+public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_DieselEngine {
+
+ public GT_MetaTileEntity_ExtremeDieselEngine(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional);
+ }
+
+ public GT_MetaTileEntity_ExtremeDieselEngine(String aName) {
+ super(aName);
+ }
+
+ @Override
+ public String[] getDescription() {
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Combustion Generator")
+ .addInfo("Controller block for the Extreme Combustion Engine")
+ .addInfo("Supply High Octane Gasoline and 8000L of Lubricant per hour to run")
+ .addInfo("Supply 320L/s of Liquid Oxygen to boost output (optional)")
+ .addInfo("Default: Produces 8192EU/t at 100% fuel efficiency")
+ .addInfo("Boosted: Produces 32768EU/t at 400% fuel efficiency")
+ .addInfo("You need to wait for it to reach 400% to output full power")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 4, false)
+ .addController("Front center")
+ .addCasingInfo("Robust Tungstensteel Machine Casing", 16)
+ .addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks")
+ .addOtherStructurePart("Extreme Engine Intake Machine Casing", "8x, ring around controller")
+ .addStructureInfo("Extreme Engine Intake Casings must not be obstructed in front (only air blocks)")
+ .addDynamoHatch("Back center")
+ .addMaintenanceHatch("One of the casings next to a Gear Box")
+ .addMufflerHatch("Top middle back, above the rear Gear Box")
+ .addInputHatch("HOG, next to a Gear Box")
+ .addInputHatch("Lubricant, next to a Gear Box")
+ .addInputHatch("Liquid Oxygen, optional, next to a Gear Box")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
+ }
+
+ @Override
+ protected GT_Recipe.GT_Recipe_Map_Fuel getFuelMap() {
+ return GT_Recipe.GT_Recipe_Map.sExtremeDieselFuels;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][60], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE)};
+ }
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][60]};
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeExtremeDieselEngine.png");
+ }
+
+ @Override
+ public Block getCasingBlock() {
+ return GregTech_API.sBlockCasings4;
+ }
+
+ @Override
+ public byte getCasingMeta() {
+ return 0;
+ }
+
+ @Override
+ public Block getIntakeBlock() {
+ return GregTech_API.sBlockCasings8;
+ }
+
+ @Override
+ public byte getIntakeMeta() {
+ return 4;
+ }
+
+ @Override
+ public Block getGearboxBlock() {
+ return GregTech_API.sBlockCasings2;
+ }
+
+ @Override
+ public byte getGearboxMeta() {
+ return 4;
+ }
+
+ @Override
+ public byte getCasingTextureIndex() {
+ return 60;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ExtremeDieselEngine(this.mName);
+ }
+
+ @Override
+ protected int getNominalOutput() {
+ return 8192;
+ }
+
+ @Override
+ protected int getBoostFactor() {
+ return 4;
+ }
+
+ @Override
+ protected Materials getBooster() {
+ return Materials.LiquidOxygen;
+ }
+
+ @Override
+ protected int getAdditiveFactor() {
+ return 8;
+ }
+
+ @Override
+ protected int getEfficiencyIncrease() {
+ return 20;
+ }
+
+ @Override
+ public int getMaxEfficiency(ItemStack aStack) {
+ return boostEu ? 40000 : 10000;
+ }
+
+ @Override
+ public int getPollutionPerTick(ItemStack aStack) {
+ return super.getPollutionPerTick(aStack) * 8;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ int mPollutionReduction=0;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
+ }
+ }
+
+ long storedEnergy=0;
+ long maxEnergy=0;
+ for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
+ }
+
+ return new String[]{
+ EnumChatFormatting.BLUE+"Extreme Diesel Engine"+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.multiblock.energy")+": " +
+ EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
+ getIdealStatus() == getRepairStatus() ?
+ EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET :
+ EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET,
+ StatCollector.translateToLocal("GT5U.engine.output")+": " +EnumChatFormatting.RED+(-mEUt*mEfficiency/10000)+EnumChatFormatting.RESET+" EU/t",
+ StatCollector.translateToLocal("GT5U.engine.consumption")+": " +EnumChatFormatting.YELLOW+fuelConsumption+EnumChatFormatting.RESET+" L/t",
+ StatCollector.translateToLocal("GT5U.engine.value")+": " +EnumChatFormatting.YELLOW+fuelValue+EnumChatFormatting.RESET+" EU/L",
+ StatCollector.translateToLocal("GT5U.turbine.fuel")+": " +EnumChatFormatting.GOLD+fuelRemaining+EnumChatFormatting.RESET+" L",
+ StatCollector.translateToLocal("GT5U.engine.efficiency")+": " +EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.YELLOW+" %",
+ StatCollector.translateToLocal("GT5U.multiblock.pollution")+": " + EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
+ };
+ }
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
index 77290441cd..9da832c81a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java
@@ -1,10 +1,13 @@
package gregtech.common.tileentities.machines.multi;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import net.minecraft.block.Block;
public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionComputer {
@@ -48,13 +51,29 @@ public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionC
}
public String[] getDescription() {
- return new String[]{
- "It's over 9000!!!",
- "LuV Machine Casings around Superconducting Coil Blocks",
- "2-16 Input Hatches", "1-16 Output Hatches",
- "1-16 Energy Hatches",
- "All Hatches must be LuV or better",
- "2048EU/t and 10mio EU Cap per Energy Hatch"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Fusion Reactor")
+ .addInfo("It's over 9000!!!")
+ .addInfo("Controller block for the Fusion Reactor Mk I")
+ .addInfo("2048EU/t and 10M EU capacity per Energy Hatch")
+ .addInfo("If the recipe has a startup cost greater than the")
+ .addInfo("number of energy hatches * cap, you can't do it")
+ .addSeparator()
+ .beginStructureBlock(15, 3, 15, false)
+ .addController("See diagram when placed")
+ .addCasingInfo("LuV Machine Casing", 79)
+ .addStructureInfo("Cover the coils with casing")
+ .addOtherStructurePart("Superconducting Coil Block", "Center part of the ring")
+ .addEnergyHatch("1-16, Specified casings")
+ .addInputHatch("2-16, Specified casings")
+ .addOutputHatch("1-16, Specified casings")
+ .addStructureInfo("ALL Hatches must be LuV or better")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
index c091d637bc..7a363f8f6f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java
@@ -1,10 +1,13 @@
package gregtech.common.tileentities.machines.multi;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import net.minecraft.block.Block;
public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionComputer {
@@ -48,14 +51,29 @@ public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionC
}
public String[] getDescription() {
- return new String[]{
- "It's over 9000!!!",
- "Fusion Machine Casings around Fusion Coil Blocks",
- "2-16 Input Hatches",
- "1-16 Output Hatches",
- "1-16 Energy Hatches",
- "All Hatches must be ZPMV or better",
- "4096EU/t and 20mio EU Cap per Energy Hatch"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Fusion Reactor")
+ .addInfo("It's over 9000!!!")
+ .addInfo("Controller block for the Fusion Reactor Mk II")
+ .addInfo("4096EU/t and 20M EU capacity per Energy Hatch")
+ .addInfo("If the recipe has a startup cost greater than the")
+ .addInfo("number of energy hatches * cap, you can't do it")
+ .addSeparator()
+ .beginStructureBlock(15, 3, 15, false)
+ .addController("See diagram when placed")
+ .addCasingInfo("Fusion Machine Casing", 79)
+ .addStructureInfo("Cover the coils with casing")
+ .addOtherStructurePart("Fusion Coil Block", "Center part of the ring")
+ .addEnergyHatch("1-16, Specified casings")
+ .addInputHatch("2-16, Specified casings")
+ .addOutputHatch("1-16, Specified casings")
+ .addStructureInfo("ALL Hatches must be ZPM or better")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
index bc50b5ee5f..a575427791 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java
@@ -1,10 +1,13 @@
package gregtech.common.tileentities.machines.multi;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import net.minecraft.block.Block;
public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionComputer {
@@ -48,14 +51,29 @@ public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionC
}
public String[] getDescription() {
- return new String[]{
- "A SUN DOWN ON EARTH",
- "Fusion Machine Casings MK II around Fusion Coil Blocks",
- "2-16 Input Hatches",
- "1-16 Output Hatches",
- "1-16 Energy Hatches",
- "All Hatches must be UV or better",
- "8192EU/t and 40mio EU Cap per Energy Hatch"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Fusion Reactor")
+ .addInfo("A SUN DOWN ON EARTH")
+ .addInfo("Controller block for the Fusion Reactor Mk III")
+ .addInfo("8192EU/t and 40M EU capacity per Energy Hatch")
+ .addInfo("If the recipe has a startup cost greater than the")
+ .addInfo("number of energy hatches * cap, you can't do it")
+ .addSeparator()
+ .beginStructureBlock(15, 3, 15, false)
+ .addController("See diagram when placed")
+ .addCasingInfo("Fusion Machine Casing Mk II", 79)
+ .addStructureInfo("Cover the coils with casing")
+ .addOtherStructurePart("Fusion Coil Block", "Center part of the ring")
+ .addEnergyHatch("1-16, Specified casings")
+ .addInputHatch("2-16, Specified casings")
+ .addOutputHatch("1-16, Specified casings")
+ .addStructureInfo("ALL Hatches must be UV or better")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
index 4dcd9121a8..dfa58c6407 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java
@@ -1,5 +1,7 @@
package gregtech.common.tileentities.machines.multi;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
@@ -13,6 +15,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockB
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -41,16 +44,30 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Heat Exchanger",
- "Size(WxHxD): 3x4x3, Controller (Front middle at bottom)",
- "3x3x4 of Stable Titanium Machine Casings (hollow, Min 20!)",
- "2x Titanium Pipe Casing (Inside the Hollow Machine Casings)",
- "1x Distillated Water Input (Any casing)",
- "1x Steam Output (Any casing)",
- "1x Hot Fluid Input (Bottom center)",
- "1x Cold Fluid Output (Top Center)",
- "1x Maintenance Hatch (Any casing)"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Heat Exchanger")
+ .addInfo("Controller Block for the Large Heat Exchanger")
+ .addInfo("More complicated than a Fusion Reactor. Seriously")
+ .addInfo("Inputs are Hot Coolant or Lava")
+ .addInfo("Outputs Coolant or Pahoehoe Lava and SH Steam/Steam")
+ .addInfo("Read the wiki article to understand how it works")
+ .addInfo("Then go to the Discord to understand the wiki")
+ .addSeparator()
+ .beginStructureBlock(3, 4, 3, false)
+ .addController("Front bottom")
+ .addCasingInfo("Stable Titanium Machine Casing", 20)
+ .addOtherStructurePart("Titanium Pipe Casing", "Center 2 blocks")
+ .addMaintenanceHatch("Any casing")
+ .addInputHatch("Hot fluid, bottom center")
+ .addInputHatch("Distilled water, any casing")
+ .addOutputHatch("Cold fluid, top center")
+ .addOutputHatch("Steam/SH Steam, any casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
index edce80fdf4..9e002badbf 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java
@@ -8,6 +8,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
@@ -17,6 +18,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_ImplosionCompressor
extends GT_MetaTileEntity_MultiBlockBase {
public GT_MetaTileEntity_ImplosionCompressor(int aID, String aName, String aNameRegional) {
@@ -32,17 +35,27 @@ public class GT_MetaTileEntity_ImplosionCompressor
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Implosion Compressor",
- "Size(WxHxD): 3x3x3 (Hollow), Controller (Front centered)",
- "1x Input Bus (Any casing)",
- "1x Output Bus (Any casing)",
- "1x Maintenance Hatch (Any casing)",
- "1x Muffler Hatch (Any casing)",
- "1x Energy Hatch (Any casing)",
- "Solid Steel Machine Casings for the rest (16 at least!)",
- "Casings can be replaced with Explosion Warning Signs",
- "Causes " + 20 * getPollutionPerTick(null) + " Pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Implosion Compressor")
+ .addInfo("Explosions are fun")
+ .addInfo("Controller block for the Implosion Compressor")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Solid Steel Machine Casing", 16)
+ .addStructureInfo("Casings can be replaced with Explosion Warning Signs")
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addMufflerHatch("Any casing")
+ .addInputBus("Any casing")
+ .addOutputBus("Any casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
index 0781397ecc..551abdf38a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java
@@ -18,6 +18,8 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
public abstract class GT_MetaTileEntity_LargeBoiler
extends GT_MetaTileEntity_MultiBlockBase {
private boolean firstRun = true;
@@ -35,22 +37,32 @@ public abstract class GT_MetaTileEntity_LargeBoiler
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Large Boiler",
- "Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s",
- "A programmed circuit in the main block throttles the boiler (-1000L/s per config)",
- "Size(WxHxD): 3x5x3, Controller (Front middle in Fireboxes)",
- "3x1x3 of "+getCasingMaterial()+" Fire Boxes (Bottom layer, Min 3)",
- "3x4x3 of "+getCasingMaterial()+" " +getCasingBlockType()+ " Casings (Above Fireboxes, hollow, Min 24!)",
- "3 "+getCasingMaterial()+" Pipe Casing Blocks (Inside the Hollow Casing)",
- "1x Input Fuel Hatch/Bus (Any Firebox)",
- "1x Input Water Hatch (Any Firebox)",
- "1x Output Hatch (Any Casing)",
- "1x Maintenance Hatch (Any Firebox)",
- "1x Muffler Hatch (Any Firebox)",
- String.format("Diesel fuels have 1/4 efficiency - Takes %.2f seconds to heat up", 500.0 / getEfficiencyIncrease()),
- "Causes up to " + 20 * getPollutionPerTick(null) + " Pollution per second"
-};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Boiler")
+ .addInfo("Controller block for the Large " + getCasingMaterial() + " Boiler")
+ .addInfo("Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s")//?
+ .addInfo("A programmed circuit in the main block throttles the boiler (-1000L/s per config)")
+ .addInfo(String.format("Diesel fuels have 1/4 efficiency - Takes %.2f seconds to heat up", 500.0 / getEfficiencyIncrease()))//? check semifluid again
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 5, 3, false)
+ .addController("Front bottom")
+ .addCasingInfo(getCasingMaterial() + " " + getCasingBlockType() + " Casing", 24)//?
+ .addOtherStructurePart(getCasingMaterial() + " Fire Boxes", "Bottom layer, 3 minimum")
+ .addOtherStructurePart(getCasingMaterial() + " Pipe Casing Blocks", "Inner 3 blocks")
+ .addMaintenanceHatch("Any firebox")
+ .addMufflerHatch("Any firebox")
+ .addInputBus("Solid fuel, Any firebox")
+ .addInputHatch("Liquid fuel, Any firebox")
+ .addStructureInfo("You can use either, or both")
+ .addInputHatch("Water, Any firebox")
+ .addOutputHatch("Steam, any casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public abstract String getCasingMaterial();
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
index 42b8a51153..d462b9a36d 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java
@@ -8,6 +8,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
@@ -18,6 +19,8 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase {
private final int CASING_INDEX = 176;
@@ -37,20 +40,30 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
@Override
public String[] getDescription() {
- return new String[] {
- "Controller block for the Large Chemical Reactor",
- "Has the same recipes as the Chemical Reactor",
- "Does not lose efficiency when overclocked",
- "Accepts fluids instead of fluid cells",
- "Size(WxHxD): 3x3x3",
- "3x3x3 of Chemically Inert Machine Casings (hollow, min 8!)",
- "Controller (Front centered)",
- "1x PTFE Pipe Machine Casing (inside the hollow casings)",
- "1x Cupronickel Coil Block (next to PTFE Pipe Machine Casing)",
- "1x Input Bus/Hatch (Any inert casing)",
- "1x Output Bus/Hatch (Any inert casing)",
- "1x Maintenance Hatch (Any inert casing)",
- "1x Energy Hatch (Any inert casing)"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Chemical Reactor")
+ .addInfo("Controller block for the Large Chemical Reactor")
+ .addInfo("Does not lose efficiency when overclocked")
+ .addInfo("Accepts fluids instead of fluid cells")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, false)
+ .addController("Front center")
+ .addCasingInfo("Chemically Inert Machine Casing", 8)
+ .addOtherStructurePart("PTFE Pipe Machine Casing", "Center")
+ .addOtherStructurePart("Cupronickel Coil Block", "Adjacent to the PTFE Pipe Machine Casing")
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addInputBus("Any casing")
+ .addInputHatch("Any casing")
+ .addOutputBus("Any casing")
+ .addOutputHatch("Any casing")
+ .addStructureInfo("You can have multiple hatches/busses")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
@@ -115,30 +128,24 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
FluidStack[] fluids = tFluidList.toArray(new FluidStack[tFluidList.size()]);
if (inputs.length > 0 || fluids.length > 0) {
- long voltage = getMaxInputVoltage();
- byte tier = (byte) Math.max(1, GT_Utility.getTier(voltage));
- GT_Recipe recipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false,
+ long tVoltage = getMaxInputVoltage();
+ byte tier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false,
false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs);
- if (recipe != null && recipe.isRecipeInputEqual(true, fluids, inputs)) {
+ if (tRecipe != null && tRecipe.isRecipeInputEqual(true, fluids, inputs)) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
- int EUt = recipe.mEUt;
- int maxProgresstime = recipe.mDuration;
-
- while (EUt <= gregtech.api.enums.GT_Values.V[tier - 1] && maxProgresstime > 2) {
- EUt *= 4;
- maxProgresstime /= 4;
+ calculatePerfectOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return false;
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
}
- if (maxProgresstime < 2) {
- maxProgresstime = 2;
- EUt = recipe.mEUt * recipe.mDuration / 2;
- }
-
- this.mEUt = -EUt;
- this.mMaxProgresstime = maxProgresstime;
- this.mOutputItems = recipe.mOutputs;
- this.mOutputFluids = recipe.mFluidOutputs;
+
+ this.mOutputItems = tRecipe.mOutputs;
+ this.mOutputFluids = tRecipe.mFluidOutputs;
this.updateSlots();
return true;
}
@@ -196,7 +203,7 @@ public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_Mu
}
}
- return casingAmount >= 8 && hasHeatingCoil;
+ return casingAmount >= 8 && hasHeatingCoil && !mEnergyHatches.isEmpty() && !mMaintenanceHatches.isEmpty();
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
index 8e29d620c3..6c482db6e7 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java
@@ -3,12 +3,15 @@ package gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
import java.util.Collection;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
@@ -31,18 +34,26 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_SS5) : Textures.BlockIcons.casingTexturePages[0][58]};
}
-
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Large Gas Turbine",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Gas Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Muffler Hatch (Side centered)",
- "1x Dynamo Hatch (Back centered)",
- "Stainless Steel Turbine Casings for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)",
- "Produces " + getPollutionPerTick(null)*20 + " pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Gas Turbine")
+ .addInfo("Controller block for the Large Gas Turbine")
+ .addInfo("Needs a Turbine, place inside controller")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 4, true)
+ .addController("Front center")
+ .addCasingInfo("Stainless Steel Turbine Casing", 24)
+ .addDynamoHatch("Back center")
+ .addMaintenanceHatch("Side centered")
+ .addMufflerHatch("Side centered")
+ .addInputHatch("Gas Fuel, Side centered")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public int getFuelValue(FluidStack aLiquid) {
@@ -88,6 +99,17 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT
FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest!
int fuelValue = getFuelValue(firstFuelType);
+
+ if (aOptFlow < fuelValue) {
+ // turbine too weak and/or fuel too powerful
+ // at least consume 1L
+ this.realOptFlow = 1;
+ // wastes the extra fuel and generate aOptFlow directly
+ depleteInput(new FluidStack(firstFuelType, 1));
+ this.storedFluid += 1;
+ return GT_Utility.safeInt((long)aOptFlow * (long)aBaseEff / 10000L);
+ }
+
actualOptimalFlow = GT_Utility.safeInt((long)aOptFlow / fuelValue);
this.realOptFlow = actualOptimalFlow;
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
index c6f6e36c44..2355b89fa8 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java
@@ -4,6 +4,8 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
@@ -12,6 +14,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -38,17 +41,27 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Large High Pressure Steam Turbine",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Superheated Steam Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Dynamo Hatch (Back centered)",
- "1x Output Hatch for Steam (Side centered)",
- "Titanium Turbine Casings for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)",
- "Output depending on Rotor and fitting",
- "Use screwdriver to adjust fitting of turbine"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Steam Turbine")
+ .addInfo("Controller block for the Large High Pressure Steam Turbine")
+ .addInfo("Needs a Turbine, place inside controller")
+ .addInfo("Outputs Steam as well as producing power")
+ .addInfo("Power output depends on turbine and fitting")
+ .addInfo("Use screwdriver to adjust fitting of turbine")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 4, true)
+ .addController("Front center")
+ .addCasingInfo("Titanium Turbine Casing", 24)
+ .addDynamoHatch("Back center")
+ .addMaintenanceHatch("Side centered")
+ .addInputHatch("Superheated Steam, Side centered")
+ .addOutputHatch("Steam, Side centered")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
index be62ff2d97..bb5134097a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java
@@ -3,6 +3,8 @@ package gregtech.common.tileentities.machines.multi;
import java.util.ArrayList;
import java.util.Collection;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
@@ -10,6 +12,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
@@ -33,17 +36,26 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar
return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TU5) : Textures.BlockIcons.casingTexturePages[0][60]};
}
-
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Large Plasma Generator",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Plasma Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Output Hatch (Side centered, optional)",
- "1x Dynamo Hatch (Back centered)",
- "Tungstensteel Turbine Casings for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Plasma Turbine")
+ .addInfo("Controller block for the Large Plasma Generator")
+ .addInfo("Needs a Turbine, place inside controller")
+ .addInfo("Use your Fusion Reactor to produce the Plasma")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 4, true)
+ .addController("Front center")
+ .addCasingInfo("Tungstensteel Turbine Casing", 24)
+ .addDynamoHatch("Back center")
+ .addMaintenanceHatch("Side centered")
+ .addInputHatch("Plasma Fluid, Side centered")
+ .addOutputHatch("Molten Fluid, optional, Side centered")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public int getFuelValue(FluidStack aLiquid) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
index 2943f6f946..20bcbf10d0 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java
@@ -4,6 +4,8 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
@@ -12,6 +14,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
@@ -40,17 +43,27 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Large Steam Turbine",
- "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)",
- "1x Steam Input Hatch (Side centered)",
- "1x Maintenance Hatch (Side centered)",
- "1x Dynamo Hatch (Back centered)",
- "1x Output Hatch for Distilled Water (Side centered)",
- "Turbine Casings for the rest (24 at least!)",
- "Needs a Turbine Item (Inside controller GUI)",
- "Output depending on Rotor and fitting",
- "Use screwdriver to adjust fitting of turbine"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Steam Turbine")
+ .addInfo("Controller block for the Large Steam Turbine")
+ .addInfo("Needs a Turbine, place inside controller")
+ .addInfo("Outputs Distilled Water as well as producing power")
+ .addInfo("Power output depends on turbine and fitting")
+ .addInfo("Use screwdriver to adjust fitting of turbine")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 4, true)
+ .addController("Front center")
+ .addCasingInfo("Turbine Casing", 24)
+ .addDynamoHatch("Back center")
+ .addMaintenanceHatch("Side centered")
+ .addInputHatch("Steam, Side centered")
+ .addOutputHatch("Distilled Water, Side centered")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
index b21d8fe73c..5eca30def1 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java
@@ -4,6 +4,8 @@ import static gregtech.api.enums.GT_Values.VN;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
@@ -15,6 +17,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffl
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
@@ -41,18 +44,28 @@ public class GT_MetaTileEntity_MultiFurnace
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Multi Smelter",
- "Smelts up to 8-128 Items at once",
- "Size(WxHxD): 3x3x3 (Hollow), Controller (Front middle at bottom)",
- "8x Heating Coils (Middle layer, hollow)",
- "1x Input Bus (One of bottom)",
- "1x Output Bus (One of bottom)",
- "1x Maintenance Hatch (One of bottom)",
- "1x Muffler Hatch (Top middle)",
- "1x Energy Hatch (One of bottom)",
- "Heat Proof Machine Casings for the rest",
- "Causes " + 20 * getPollutionPerTick(null) + " Pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Furnace")
+ .addInfo("Controller Block for the Multi Smelter")
+ .addInfo("Smelts up to 8-128 items at once")
+ .addInfo("Items smelted increases with coil tier")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front bottom")
+ .addCasingInfo("Heat Proof Machine Casing", 8)
+ .addOtherStructurePart("Heating Coils (any tier)", "Middle layer")
+ .addEnergyHatch("Any bottom casing")
+ .addMaintenanceHatch("Any bottom casing")
+ .addMufflerHatch("Top Middle")
+ .addInputBus("Any bottom casing")
+ .addOutputBus("Any bottom casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
@@ -82,15 +95,49 @@ public class GT_MetaTileEntity_MultiFurnace
ArrayList<ItemStack> tInputList = getStoredInputs();
if (!tInputList.isEmpty()) {
int mVolatage=GT_Utility.safeInt(getMaxInputVoltage());
-
- int j = 0;
- this.mOutputItems = new ItemStack[8 * this.mLevel];
- for (int i = 0; (i < 256) && (j < this.mOutputItems.length); i++) {
- if (null != (this.mOutputItems[j] = GT_ModHandler.getSmeltingOutput((ItemStack) tInputList.get(i % tInputList.size()), true, null))) {
- j++;
+ int tMaxParrallel = 8 * this.mLevel;
+ int tCurrenParrallel = 0;
+ ItemStack tSmeltStack = tInputList.get(0);
+ ItemStack tOutputStack = GT_ModHandler.getSmeltingOutput(tSmeltStack,false,null);
+ if (tOutputStack == null)
+ return false;
+ for (int i = 0;i<tInputList.size();i++)
+ {
+ ItemStack item = tInputList.get(i);
+ if (tSmeltStack.isItemEqual(item))
+ {
+ if (item.stackSize<(tMaxParrallel-tCurrenParrallel))
+ {
+ tCurrenParrallel += item.stackSize;
+ item.stackSize = 0;
+ }
+ else
+ {
+ item.stackSize = (tCurrenParrallel + item.stackSize) - tMaxParrallel;
+ tCurrenParrallel = tMaxParrallel;
+ break;
+ }
}
}
- if (j > 0) {
+// this.mOutputItems = new ItemStack[8 * this.mLevel];
+// for (int i = 0; (i < 256) && (j < this.mOutputItems.length); i++) {
+// if (null != (this.mOutputItems[j] = GT_ModHandler.getSmeltingOutput((ItemStack) tInputList.get(i % tInputList.size()), true, null))) {
+// j++;
+// }
+// }
+ tCurrenParrallel *= tOutputStack.stackSize;
+ this.mOutputItems = new ItemStack[(tCurrenParrallel/64)+1];
+ for (int i = 0; i<this.mOutputItems.length;i++)
+ {
+ ItemStack tNewStack = tOutputStack.copy();
+ int size = tCurrenParrallel>64 ? 64 : tCurrenParrallel;
+ tNewStack.stackSize = size;
+ tCurrenParrallel -= size;
+ this.mOutputItems[i] = tNewStack;
+ }
+
+
+ if (this.mOutputItems != null && this.mOutputItems.length > 0) {
this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
this.mEfficiencyIncrease = 10000;
calculateOverclockedNessMulti(4, 512, 1, mVolatage);
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
index 9519d901d7..e4ad65e4a4 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java
@@ -11,6 +11,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
@@ -20,6 +21,8 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBase {
private ForgeDirection orientation;
private int controllerX, controllerZ;
@@ -33,18 +36,29 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Oil Cracking Unit",
- "Thermally cracks heavy hydrocarbons into lighter fractions",
- "Size(WxHxD): 5x3x3 (Hollow), Controller (Front center)",
- "Ring of 8 Cupronickel Coils (Each side of Controller)",
- "1x Hydrocarbon Input Bus/Hatch (Any left/right side casing)",
- "1x Steam/Hydrogen Input Hatch (Any middle ring casing)",
- "1x Cracked Hydrocarbon Output Hatch (Any left/right side casing)",
- "1x Maintenance Hatch (Any casing)",
- "1x Energy Hatch (Any casing)",
- "Clean Stainless Steel Machine Casings for the rest (18 at least!)",
- "Input/Output Hatches must be on opposite sides"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Cracker")
+ .addInfo("Controller block for the Oil Cracking Unit")
+ .addInfo("Thermally cracks heavy hydrocarbons into lighter fractions")
+ .addInfo("More efficient than the Chemical Reactor")
+ .addInfo("Place the appropriate circuit in the controller")
+ .addSeparator()
+ .beginStructureBlock(5, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Clean Stainless Steel Machine Casing", 18)
+ .addOtherStructurePart("2 Rings of 8 Cupronickel Coils", "Each side of the controller")
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addInputHatch("Steam/Hydrogen, Any middle ring casing")
+ .addInputHatch("Any left/right side casing")
+ .addOutputHatch("Any left/right side casing")
+ .addStructureInfo("Input/Output Hatches must be on opposite sides!")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
index 76f8e7f87f..a7a7023d34 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java
@@ -3,6 +3,7 @@ package gregtech.common.tileentities.machines.multi;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -16,6 +17,8 @@ import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
import static gregtech.api.enums.GT_Values.VN;
import static gregtech.api.enums.GT_Values.debugDriller;
import static gregtech.common.GT_UndergroundOil.undergroundOil;
@@ -55,18 +58,30 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D
protected String[] getDescriptionInternal(String tierSuffix) {
String casings = getCasingBlockItem().get(0).getDisplayName();
- return new String[]{
- "Controller Block for the Oil/Gas/Fluid Drilling Rig " + (tierSuffix != null ? tierSuffix : ""),
- "Size(WxHxD): 3x7x3", "Controller (Front middle at bottom)",
- "3x1x3 Base of " + casings,
- "1x3x1 " + casings + " pillar (Center of base)",
- "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
- "1x Output Hatch (One of base casings)",
- "1x Maintenance Hatch (One of base casings)",
- "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
- "Working on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks",
- "Use Screwdriver to configure range",
- "Use Programmed Circuits to ignore near exhausted oil field"};
+
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Pump")
+ .addInfo("Controller Block for the Oil/Gas/Fluid Drilling Rig " + (tierSuffix != null ? tierSuffix : ""))
+ .addInfo("Works on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks")
+ .addInfo("Use a Screwdriver to configure range")
+ .addInfo("Use Programmed Circuits to ignore near exhausted oil field")
+ .addInfo("If total circuit # is greater than output amount it will halt. If it worked right.")//doesn't work
+ .addSeparator()
+ .beginStructureBlock(3, 7, 3, false)
+ .addController("Front bottom")
+ .addStructureInfo(casings + " form the 3x1x3 Base")
+ .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)")
+ .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing")
+ .addMaintenanceHatch("Any base casing")
+ .addInputBus("Mining Pipes or Circuits, optional, any base casing")
+ .addOutputHatch("Any base casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
index 3c59bee520..e34ed7466f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
@@ -8,11 +8,13 @@ import gregtech.api.interfaces.IChunkLoader;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.GT_ChunkManager;
import gregtech.api.objects.ItemData;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
+
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -31,6 +33,8 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
+import org.lwjgl.input.Keyboard;
+
import static gregtech.api.enums.GT_Values.VN;
public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase implements IChunkLoader {
@@ -318,15 +322,12 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
Block block = getBaseMetaTileEntity().getBlock(x, y, z);
int blockMeta = getBaseMetaTileEntity().getMetaID(x, y, z);
ChunkPosition blockPos = new ChunkPosition(x, y, z);
- if (oreBlockPositions.contains(blockPos))
- return;
- if (block instanceof GT_Block_Ores_Abstract) {
- TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z);
- if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural)
- oreBlockPositions.add(blockPos);
- } else {
- ItemData association = GT_OreDictUnificator.getAssociation(new ItemStack(block, 1, blockMeta));
- if (association != null && association.mPrefix.toString().startsWith("ore"))
+ if (!oreBlockPositions.contains(blockPos)) {
+ if (block instanceof GT_Block_Ores_Abstract) {
+ TileEntity tTileEntity = getBaseMetaTileEntity().getTileEntity(x, y, z);
+ if (tTileEntity instanceof GT_TileEntity_Ores && ((GT_TileEntity_Ores) tTileEntity).mNatural)
+ oreBlockPositions.add(blockPos);
+ } else if (GT_Utility.isOre(new ItemStack(block, 1, blockMeta)))
oreBlockPositions.add(blockPos);
}
}
@@ -337,23 +338,33 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
protected String[] getDescriptionInternal(String tierSuffix) {
String casings = getCasingBlockItem().get(0).getDisplayName();
- int d = getRadiusInChunks() * 2;
- return new String[]{
- "Controller Block for the Ore Drilling Plant " + (tierSuffix != null ? tierSuffix : ""),
- "Size(WxHxD): 3x7x3, Controller (Front middle bottom)",
- "3x1x3 Base of " + casings,
- "1x3x1 " + casings + " pillar (Center of base)",
- "1x3x1 " + getFrameMaterial().mName + " Frame Boxes (Each pillar side and on top)",
- "1x Input Hatch for drilling fluid (Any bottom layer casing)",
- "1x Input Bus for mining pipes (Any bottom layer casing; not necessary)",
- "1x Output Bus (Any bottom layer casing)",
- "1x Maintenance Hatch (Any bottom layer casing)",
- "1x " + VN[getMinTier()] + "+ Energy Hatch (Any bottom layer casing)",
- "Use Screwdriver to configure block radius",
- "Use Soldering iron to turn off chunk mode",
- "Maximum radius is " + (getRadiusInChunks() << 4) + " blocks",
- "In chunk mode working area center is the chunk corner nearest to the drill",
- "Fortune bonus of " + (mTier + 3)};
+
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Miner")
+ .addInfo("Controller Block for the Ore Drilling Plant " + (tierSuffix != null ? tierSuffix : ""))
+ .addInfo("Use a Screwdriver to configure block radius")
+ .addInfo("Maximum radius is " + (getRadiusInChunks() << 4) + " blocks")
+ .addInfo("Use Soldering iron to turn off chunk mode")
+ .addInfo("In chunk mode, working area center is the chunk corner nearest to the drill")
+ .addInfo("Gives ~3x as much crushed ore vs normal processing")
+ .addInfo("Fortune bonus of " + (mTier + 3) + ". Only works on small ores")
+ .addSeparator()
+ .beginStructureBlock(3, 7, 3, false)
+ .addController("Front bottom")
+ .addStructureInfo(casings + " form the 3x1x3 Base")
+ .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)")
+ .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top")
+ .addEnergyHatch(VN[getMinTier()] + "+, Any base casing")
+ .addMaintenanceHatch("Any base casing")
+ .addInputBus("Mining Pipes, optional, any base casing")
+ .addInputHatch("Drilling Fluid, any base casing")
+ .addOutputBus("Any base casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
@Override
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
index 850908104b..2496d02a42 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java
@@ -12,6 +12,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_ProcessingArray_Manager;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
@@ -25,6 +26,7 @@ import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import org.apache.commons.lang3.ArrayUtils;
+import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Arrays;
@@ -54,18 +56,31 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Processing Array",
- "Runs supplied machines as if placed in the world",
- "Size(WxHxD): 3x3x3 (Hollow), Controller (Front centered)",
- "1x Input Hatch/Bus (Any casing)",
- "1x Output Hatch/Bus (Any casing)",
- "1x Maintenance Hatch (Any casing)",
- "1x Energy Hatch (Any casing)",
- "Robust Tungstensteel Machine Casings for the rest (14 at least!)",
- "Place up to 64 Single Block GT Machines into the Controller Inventory",
- "Use screwdriver to enable separate input busses",
- "Maximal overclockedness of machines inside: Tier 9"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Processing Array")
+ .addInfo("Runs supplied machines as if placed in the world")
+ .addInfo("Place up to 64 singleblock GT machines into the controller")
+ .addInfo("Note that tou still need to supply power to them all")
+ .addInfo("Use a screwdriver to enable separate input busses")
+ .addInfo("Maximal overclockedness of machines inside: Tier 9")
+ .addInfo("Doesn't work on certain machines, deal with it")
+ .addInfo("Use it if you hate GT++, or want even more speed later on")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Robust Tungstensteel Machine Casing", 14)
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addInputBus("Any casing")
+ .addInputHatch("Any casing")
+ .addOutputBus("Any casing")
+ .addOutputHatch("Any casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
index eee88dfb21..c2e13a815f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java
@@ -10,6 +10,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.loaders.oreprocessing.ProcessingLog;
@@ -23,6 +24,8 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.Arrays;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase {
private int coilMetaID;
@@ -38,21 +41,32 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Pyrolyse Oven",
- "Industrial Charcoal producer and Oil from Plants",
- "Size(WxHxD): 5x4x5, Controller (Bottom center)",
- "3x1x3 of Heating Coils (At the center of the bottom layer)",
- "1x Input Hatch/Bus (Centered 3x1x3 area in Top layer)",
- "1x Output Hatch/Bus (Any bottom layer casing)",
- "1x Maintenance Hatch (Any bottom layer casing)",
- "1x Muffler Hatch (Centered 3x1x3 area in Top layer)",
- "1x Energy Hatch (Any bottom layer casing)",
- "Pyrolyse Oven Casings for the rest (60 at least!)",
- "Processing speed scales linearly with Coil tier:",
- "CuNi: 50%, FeAlCr: 100%, Ni4Cr: 150%, Fe50CW: 200%, etc.",
- "EU/t is not affected by Coil tier",
- "Causes " + 20 * getPollutionPerTick(null) + " Pollution per second"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Coke Oven")
+ .addInfo("Controller block for the Pyrolyse Oven")
+ .addInfo("Industrial Charcoal producer")
+ .addInfo("Processing speed scales linearly with Coil tier:")
+ .addInfo("CuNi: 50%, FeAlCr: 100%, Ni4Cr: 150%, Fe50CW: 200%, etc.")
+ .addInfo("EU/t is not affected by Coil tier")
+ .addPollutionAmount(20 * getPollutionPerTick(null))
+ .addSeparator()
+ .beginStructureBlock(5, 4, 5, true)
+ .addController("Front center")
+ .addCasingInfo("Pyrolyse Oven Casing", 60)
+ .addOtherStructurePart("Heating Coils (any tier)", "Center 3x1x3 of the bottom layer")
+ .addEnergyHatch("Any bottom layer casing")
+ .addMaintenanceHatch("Any bottom layer casing")
+ .addMufflerHatch("Center 3x1x3 area in top layer")
+ .addInputBus("Center 3x1x3 area in top layer")
+ .addInputHatch("Center 3x1x3 area in top layer")
+ .addOutputBus("Any bottom layer casing")
+ .addOutputHatch("Any bottom layer casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
@@ -151,8 +165,8 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
for (int j = -2; j < 3; j++) {
for (int h = 0; h < 4; h++) {
IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, h, zDir + j);
- if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// innerer 3x3 ohne h�he
- if (h == 0) {// innen boden (Cupronickel oder Kanthal coils)
+ if ((i != -2 && i != 2) && (j != -2 && j != 2)) {// inner 3x3 without height
+ if (h == 0) {// inner floor (Cupronickel or Kanthal coils)
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != GregTech_API.sBlockCasings5) {
return false;
}
@@ -167,7 +181,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
return false;
}
}
- } else if (h == 3) {// innen decke (ulv casings + input + muffler)
+ } else if (h == 3) {// inner ceiling (ulv casings + input + muffler)
if ((!addInputToMachineList(tTileEntity, CASING_INDEX)) && (!addMufflerToMachineList(tTileEntity, CASING_INDEX))) {
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
return false;
@@ -176,13 +190,13 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
return false;
}
}
- } else {// innen air
+ } else {// inside air
if (!aBaseMetaTileEntity.getAirOffset(xDir + i, h, zDir + j)) {
return false;
}
}
- } else {// Aeusserer 5x5 ohne hoehe
- if (h == 0) {// aussen boden (controller, output, energy, maintainance, rest ulv casings)
+ } else {// outer 5x5 without height
+ if (h == 0) {// outer floor (controller, output, energy, maintainance, rest ulv casings)
if ((!addMaintenanceToMachineList(tTileEntity, CASING_INDEX)) && (!addOutputToMachineList(tTileEntity, CASING_INDEX)) && (!addEnergyInputToMachineList(tTileEntity, CASING_INDEX))) {
if ((xDir + i != 0) || (zDir + j != 0)) {//no controller
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
@@ -193,7 +207,7 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
}
}
}
- } else {// au�en �ber boden (ulv casings)
+ } else {// outer above floor (ulv casings)
if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != CasingBlock) {
return false;
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
index 834b97aa9d..bf4b1e9db7 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java
@@ -8,6 +8,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.InventoryPlayer;
@@ -16,6 +17,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList;
+import org.lwjgl.input.Keyboard;
+
public class GT_MetaTileEntity_VacuumFreezer
extends GT_MetaTileEntity_MultiBlockBase {
public GT_MetaTileEntity_VacuumFreezer(int aID, String aName, String aNameRegional) {
@@ -31,15 +34,24 @@ public class GT_MetaTileEntity_VacuumFreezer
}
public String[] getDescription() {
- return new String[]{
- "Controller Block for the Vacuum Freezer",
- "Super cools hot ingots and cells",
- "Size(WxHxD): 3x3x3 (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 (16 at least!)"};
+ final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
+ tt.addMachineType("Vacuum Freezer")
+ .addInfo("Controller Block for the Vacuum Freezer")
+ .addInfo("Cools hot ingots and cells")
+ .addSeparator()
+ .beginStructureBlock(3, 3, 3, true)
+ .addController("Front center")
+ .addCasingInfo("Frost Proof Machine Casing", 16)
+ .addEnergyHatch("Any casing")
+ .addMaintenanceHatch("Any casing")
+ .addInputBus("Any casing")
+ .addOutputBus("Any casing")
+ .toolTipFinisher("Gregtech");
+ if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) {
+ return tt.getInformation();
+ } else {
+ return tt.getStructureInformation();
+ }
}
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
index 43c1778d8f..606733658b 100644
--- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
+++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java
@@ -15,11 +15,12 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
@Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2")
public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEInventory<appeng.api.storage.data.IAEItemStack> {
public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks");
+ super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks Use a screwdriver to enable voiding items on overflow");
}
public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -56,6 +57,14 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
aBaseMetaTileEntity.openGUI(aPlayer);
return true;
}
+
+ protected boolean mVoidOverflow = false;
+
+ @Override
+ public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ mVoidOverflow = !mVoidOverflow;
+ GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled"));
+ }
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -80,13 +89,18 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
}
int count = getItemCount();
ItemStack stack = getItemStack();
- if ((mInventory[0] != null) && (count < getMaxItemCount()) && GT_Utility.areStacksEqual(mInventory[0], stack)) {
+ if ((mInventory[0] != null) && ((count < getMaxItemCount())|| mVoidOverflow ) && GT_Utility.areStacksEqual(mInventory[0], stack)) {
count += mInventory[0].stackSize;
- if (count > getMaxItemCount()) {
- mInventory[0].stackSize = (count - getMaxItemCount());
- count = getMaxItemCount();
- } else {
+
+ if (count <= getMaxItemCount()) {
mInventory[0] = null;
+ } else {
+ if (mVoidOverflow) {
+ mInventory[0] = null;
+ } else {
+ mInventory[0].stackSize = (count - getMaxItemCount());
+ }
+ count = getMaxItemCount();
}
}
if (mInventory[1] == null && stack != null) {
@@ -182,6 +196,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
aNBT.setInteger("mItemCount", getItemCount());
if (getItemStack() != null)
aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound()));
+ aNBT.setBoolean("mVoidOverflow", mVoidOverflow);
}
@Override
@@ -190,6 +205,8 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
setItemCount(aNBT.getInteger("mItemCount"));
if (aNBT.hasKey("mItemStack"))
setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack")));
+ mVoidOverflow = aNBT.getBoolean("mVoidOverflow");
+
}
@Override
@@ -235,7 +252,18 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti
if (storedStack != null) {
if (GT_Utility.areStacksEqual(storedStack, inputStack)) {
if (input.getStackSize() + getItemCount() > getMaxItemCount())
- return createOverflowStack(input.getStackSize() + getItemCount(), mode);
+ {
+ if (mVoidOverflow)
+ {
+ if (mode != appeng.api.config.Actionable.SIMULATE)
+ setItemCount(getMaxItemCount());
+ return null;
+ }
+ else
+ {
+ return createOverflowStack(input.getStackSize() + getItemCount(), mode);
+ }
+ }
else {
if (mode != appeng.api.config.Actionable.SIMULATE)
setItemCount(getItemCount() + (int) input.getStackSize());