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, bo