aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java2
-rw-r--r--src/Java/gtPlusPlus/core/block/general/HellFire.java25
-rw-r--r--src/Java/gtPlusPlus/core/chunkloading/GTPP_ChunkManager.java217
-rw-r--r--src/Java/gtPlusPlus/core/chunkloading/StaticChunkFunctions.java63
-rw-r--r--src/Java/gtPlusPlus/core/common/CommonProxy.java5
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java4
-rw-r--r--src/Java/gtPlusPlus/core/handler/chunkloading/ChunkLoading.java57
-rw-r--r--src/Java/gtPlusPlus/core/handler/chunkloading/ChunkManager.java153
-rw-r--r--src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java23
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java2
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java174
-rw-r--r--src/Java/gtPlusPlus/core/recipe/common/CI.java22
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java13
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java2
14 files changed, 513 insertions, 249 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index a448e313ac..4bc5908f98 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -29,6 +29,7 @@ import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced;
import gtPlusPlus.core.block.machine.bedrock.Mining_Head_Fake;
import gtPlusPlus.core.block.machine.bedrock.Mining_Pipe_Fake;
import gtPlusPlus.core.fluids.FluidRegistryHandler;
+import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaTieredCasingBlocks1;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid;
@@ -96,6 +97,7 @@ public final class ModBlocks {
public static Block blockPooCollector;
public static Block blockPestKiller;
+ public static GregtechMetaTieredCasingBlocks1 BlockTieredCasings1;
public static void init() {
Logger.INFO("Initializing Blocks.");
diff --git a/src/Java/gtPlusPlus/core/block/general/HellFire.java b/src/Java/gtPlusPlus/core/block/general/HellFire.java
index 96738c492f..233f200815 100644
--- a/src/Java/gtPlusPlus/core/block/general/HellFire.java
+++ b/src/Java/gtPlusPlus/core/block/general/HellFire.java
@@ -32,9 +32,9 @@ import net.minecraftforge.common.util.ForgeDirection;
public class HellFire extends BlockFire {
@Deprecated
- private final int[] field_149849_a = new int[4096];
+ private final int[] field_149849_a = new int[Short.MAX_VALUE];
@Deprecated
- private final int[] field_149848_b = new int[4096];
+ private final int[] field_149848_b = new int[Short.MAX_VALUE];
@SideOnly(Side.CLIENT)
private IIcon[] IIconArray;
@@ -53,20 +53,23 @@ public class HellFire extends BlockFire {
private void enableBrutalFire() {
for (final Object o : Block.blockRegistry.getKeys())
{
+
+ try {
+
final String name = (String)o;
final Block b = Block.getBlockFromName(name);
-
- if ((b == Blocks.grass) || (b == Blocks.mycelium)){
- final int spread = 3;
- final int flamm = 3;
- this.setFireInfo(b, spread * 4, flamm * 4);
- }
-
if (b != Blocks.air)
{
final int spread = Blocks.fire.getEncouragement(b);
final int flamm = Blocks.fire.getFlammability(b);
- this.setFireInfo(b, spread * 4, flamm * 4);
+ if (flamm > 0 && spread > 0) {
+ this.setFireInfo(b, spread * 4, flamm * 4);
+ }
+ }
+
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
}
}
@@ -450,7 +453,7 @@ public class HellFire extends BlockFire {
throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
}
final int id = Block.getIdFromBlock(block);
- if (id >= 4096) {
+ if (id >= 4096 || id >= field_149849_a.length || id >= field_149848_b.length) {
return;
}
this.field_149849_a[id] = encouragement;
diff --git a/src/Java/gtPlusPlus/core/chunkloading/GTPP_ChunkManager.java b/src/Java/gtPlusPlus/core/chunkloading/GTPP_ChunkManager.java
new file mode 100644
index 0000000000..ddfe9b8227
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/chunkloading/GTPP_ChunkManager.java
@@ -0,0 +1,217 @@
+package gtPlusPlus.core.chunkloading;
+
+import com.google.common.collect.HashMultimap;
+import cpw.mods.fml.common.eventhandler.EventPriority;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gregtech.GT_Mod;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Log;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.api.interfaces.IChunkLoader;
+import gtPlusPlus.core.lib.CORE;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ListMultimap;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTUtil;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.ChunkCoordIntPair;
+import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeChunkManager;
+import net.minecraftforge.common.ForgeChunkManager.Ticket;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.world.WorldEvent;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * This class handles re-initializing chunks after a server restart
+ * Credits to Repo-Alt for the original implementation.
+ * @author Repo-Alt, Alkalus
+ *
+ */
+public class GTPP_ChunkManager implements ForgeChunkManager.OrderedLoadingCallback, ForgeChunkManager.PlayerOrderedLoadingCallback {
+
+
+ private Map<TileEntity, Ticket> registeredTickets = new HashMap<>();
+
+ private static GTPP_ChunkManager instance = new GTPP_ChunkManager();
+
+ public static boolean enableChunkloaders = true;
+ public static boolean alwaysReloadChunkloaders = false;
+ public static boolean debugChunkloaders = false;
+
+ public static void init() {
+ if (enableChunkloaders) {
+ ForgeChunkManager.setForcedChunkLoadingCallback(GTplusplus.instance, instance);
+ }
+ }
+
+ @Override
+ public void ticketsLoaded(List<Ticket> tickets, World world) {}
+
+ // Determine if tickets should be kept. Based on if the ticket is a machine or working chunk ticket.
+ // Working chunk tickets are tossed and re-created when the machine re-activates.
+ // Machine tickets are kept only if the config alwaysReloadChunkloaders is true. Otherwise
+ // machine chunks are tossed and re-created only when the machine re-activates, similar to a Passive Anchor.
+ @Override
+ public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
+ List<Ticket> validTickets = new ArrayList<>();
+ if (alwaysReloadChunkloaders) {
+ for (Ticket ticket : tickets) {
+ int x = ticket.getModData().getInteger("OwnerX");
+ int y = ticket.getModData().getInteger("OwnerY");
+ int z = ticket.getModData().getInteger("OwnerZ");
+ if (y > 0) {
+ TileEntity tile = world.getTileEntity(x, y, z);
+ if (tile != null && tile instanceof IGregTechTileEntity && ((IGregTechTileEntity)tile).isAllowedToWork()) {
+ ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(x >> 4, z >> 4));
+ if (!registeredTickets.containsKey(tile)) {
+ registeredTickets.put(tile, ticket);
+ if (((IGregTechTileEntity)tile).getMetaTileEntity() instanceof IChunkLoader) {
+ ForgeChunkManager.forceChunk(ticket, ((IChunkLoader)((IGregTechTileEntity)tile).getMetaTileEntity()).getResidingChunk());
+ }
+ validTickets.add(ticket);
+ }
+ }
+ }
+ }
+ }
+ return validTickets;
+ }
+
+ // Determine if player tickets should be kept. This is where a ticket list per player would be created and maintained. When
+ // a player join event occurs, their name/UUID/whatevs is compared against tickets on this list and those tickets reactivated.
+ // Since that info would be maintained/dealt with on a per-player startup, the list returned back to Forge is empty.
+ @Override
+ public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world) {
+ // Not currently used, so just return an empty list.
+ return ArrayListMultimap.create();
+ }
+
+ // Request a chunk to be loaded for this machine
+ // may pass null chunk to load just the machine itself, if "alwaysReloadChunkloaders" is enabled in config
+ static public boolean requestPlayerChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ, String player) {
+ if (!enableChunkloaders) {
+ return false;
+ }
+ if (!alwaysReloadChunkloaders && chunkXZ == null) {
+ return false;
+ }
+ if (debugChunkloaders && chunkXZ != null) {
+ GT_Log.out.println("GT_ChunkManager: Chunk request: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")");
+ }
+ if (instance.registeredTickets.containsKey(owner)) {
+ ForgeChunkManager.forceChunk(instance.registeredTickets.get(owner), chunkXZ);
+ }
+ else {
+ Ticket ticket = null;
+ if (player != "") {
+ ticket = ForgeChunkManager.requestPlayerTicket(GT_Mod.instance, player, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL);
+ }
+ else {
+ ticket = ForgeChunkManager.requestTicket(GT_Mod.instance, owner.getWorldObj(), ForgeChunkManager.Type.NORMAL);
+ }
+ if (ticket == null) {
+ if (debugChunkloaders) {
+ GT_Log.out.println("GT_ChunkManager: ForgeChunkManager.requestTicket failed");
+ }
+ return false;
+ }
+ if (debugChunkloaders) {
+ GT_Log.out.println("GT_ChunkManager: ticket issued for machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" );
+ }
+ NBTTagCompound tag = ticket.getModData();
+ tag.setInteger("OwnerX", owner.xCoord);
+ tag.setInteger("OwnerY", owner.yCoord);
+ tag.setInteger("OwnerZ", owner.zCoord);
+ ForgeChunkManager.forceChunk(ticket, chunkXZ);
+ if (alwaysReloadChunkloaders) {
+ ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(owner.xCoord << 4, owner.zCoord << 4));
+ }
+ instance.registeredTickets.put(owner, ticket);
+ }
+ return true;
+ }
+
+ static public boolean requestChunkLoad(TileEntity owner, ChunkCoordIntPair chunkXZ) {
+ return requestPlayerChunkLoad(owner, chunkXZ, "");
+ }
+
+ static public void releaseChunk(TileEntity owner, ChunkCoordIntPair chunkXZ) {
+ if (!enableChunkloaders) {
+ return;
+ }
+ Ticket ticket = instance.registeredTickets.get(owner);
+ if (ticket != null) {
+ if (debugChunkloaders) {
+ GT_Log.out.println("GT_ChunkManager: Chunk release: (" + chunkXZ.chunkXPos + ", " + chunkXZ.chunkZPos + ")");
+ }
+ ForgeChunkManager.unforceChunk(ticket, chunkXZ);
+ }
+ }
+
+ static public void releaseTicket(TileEntity owner) {
+ if (!enableChunkloaders) {
+ return;
+ }
+ Ticket ticket = instance.registeredTickets.get(owner);
+ if (ticket != null) {
+ if (debugChunkloaders) {
+ GT_Log.out.println("GT_ChunkManager: ticket released by machine at: (" + owner.xCoord + ", " + owner.yCoord + ", " + owner.zCoord + ")" );
+ for (ChunkCoordIntPair chunk : ticket.getChunkList()) {
+ GT_Log.out.println("GT_ChunkManager: Chunk release: (" + chunk.chunkXPos + ", " + chunk.chunkZPos + ")");
+ }
+ }
+ ForgeChunkManager.releaseTicket(ticket);
+ instance.registeredTickets.remove(owner);
+ }
+ }
+
+ public static void printTickets() {
+ if (!debugChunkloaders) {
+ return;
+ }
+ GT_Log.out.println("GT_ChunkManager: Start forced chunks dump:");
+ instance.registeredTickets.forEach((machine, ticket) -> {
+ GT_Log.out.print("GT_ChunkManager: Chunks forced by the machine at (" + machine.xCoord + ", " + machine.yCoord + ", " + machine.zCoord + ")");
+ if (ticket.isPlayerTicket()) {
+ GT_Log.out.print(" Owner: " + ticket.getPlayerName());
+ }
+ GT_Log.out.print(" :");
+ for (ChunkCoordIntPair c : ticket.getChunkList()) {
+ GT_Log.out.print("(");
+ GT_Log.out.print(c.chunkXPos);
+ GT_Log.out.print(", ");
+ GT_Log.out.print(c.chunkZPos);
+ GT_Log.out.print("), ");
+ }
+ });
+ GT_Log.out.println("GT_ChunkManager: End forced chunks dump:");
+ }
+ public static class DebugCommand extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "gtpp:dump_chunks";
+ }
+ @Override
+ public int getRequiredPermissionLevel() {
+ return 0;
+ }
+ @Override
+ public String getCommandUsage(ICommandSender sender) {
+ return "/" + getCommandName();
+ }
+ @Override
+ public void processCommand(ICommandSender sender, String[] args) {
+ printTickets();
+ }
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/chunkloading/StaticChunkFunctions.java b/src/Java/gtPlusPlus/core/chunkloading/StaticChunkFunctions.java
new file mode 100644
index 0000000000..36d9fa670c
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/chunkloading/StaticChunkFunctions.java
@@ -0,0 +1,63 @@
+package gtPlusPlus.core.chunkloading;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gtPlusPlus.api.interfaces.IChunkLoader;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntityChunkLoader;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.ChunkCoordIntPair;
+
+public class StaticChunkFunctions {
+
+ public static void saveNBTDataForTileEntity(IGregTechTileEntity aBaseMetaTileEntity, NBTTagCompound aNBT) {
+ IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity);
+ aNBT.setBoolean("chunkLoadingEnabled", aTileEntity.getChunkLoadingActive());
+ aNBT.setBoolean("isChunkloading", aTileEntity.getResidingChunk() != null);
+ if (aTileEntity.getResidingChunk() != null) {
+ aNBT.setInteger("loadedChunkXPos", aTileEntity.getResidingChunk().chunkXPos);
+ aNBT.setInteger("loadedChunkZPos", aTileEntity.getResidingChunk().chunkZPos);
+ }
+ }
+
+ public static void loadNBTDataForTileEntity(IGregTechTileEntity aBaseMetaTileEntity, NBTTagCompound aNBT) {
+ IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity);
+ if (aNBT.hasKey("chunkLoadingEnabled")) {
+ aTileEntity.setChunkLoadingActive(aNBT.getBoolean("chunkLoadingEnabled"));
+ }
+ if (aNBT.getBoolean("isChunkloading")) {
+ aTileEntity.setResidingChunk(new ChunkCoordIntPair(aNBT.getInteger("loadedChunkXPos"), aNBT.getInteger("loadedChunkZPos")));
+ }
+ }
+
+ public static void onRemoval(IGregTechTileEntity aBaseMetaTileEntity) {
+ IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity);
+ if (aTileEntity.getChunkLoadingActive()) {
+ GTPP_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity);
+ }
+ }
+
+ public static boolean onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity);
+ if (aBaseMetaTileEntity.isServerSide() && aTileEntity.getResidingChunk() != null && !aTileEntity.getDoesWorkChunkNeedReload() && !aBaseMetaTileEntity.isAllowedToWork()) {
+ // if machine has stopped, stop chunkloading
+ GTPP_ChunkManager.releaseTicket((TileEntity)aBaseMetaTileEntity);
+ aTileEntity.setDoesWorkChunkNeedReload(true);
+ return false;
+ }
+ return true;
+ }
+
+ public static void createInitialWorkingChunk(IGregTechTileEntity aBaseMetaTileEntity, int aChunkX, int aDrillZ) {
+ final int centerX = aChunkX >> 4;
+ final int centerZ = aDrillZ >> 4;
+ IChunkLoader aTileEntity = getChunkLoader(aBaseMetaTileEntity);
+ aTileEntity.addChunkToLoadedList(new ChunkCoordIntPair(centerX, centerZ));
+ GTPP_ChunkManager.requestChunkLoad((TileEntity)aBaseMetaTileEntity.getMetaTileEntity(), aTileEntity.getResidingChunk());
+ aTileEntity.setDoesWorkChunkNeedReload(false);
+ }
+
+ private static final IChunkLoader getChunkLoader(IGregTechTileEntity aTile) {
+ return (IChunkLoader) ((IGregTechTileEntity)aTile).getMetaTileEntity();
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java
index 1ce16bf4de..71a7b37cfc 100644
--- a/src/Java/gtPlusPlus/core/common/CommonProxy.java
+++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java
@@ -14,7 +14,6 @@ import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.Pair;
-import gtPlusPlus.api.objects.minecraft.ChunkManager;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.entity.InternalEntityRegistry;
@@ -61,7 +60,6 @@ import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
-import net.minecraftforge.common.ForgeChunkManager;
public class CommonProxy {
@@ -159,9 +157,6 @@ public class CommonProxy {
Utils.registerEvent(new StopAnnoyingFuckingAchievements());
}
- // Register Chunkloader
- ForgeChunkManager.setForcedChunkLoadingCallback(GTplusplus.instance, ChunkManager.getInstance());
- Utils.registerEvent(ChunkManager.getInstance());
Utils.registerEvent(new EnderDragonDeathHandler());
Utils.registerEvent(new EntityDeathHandler());
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
index b7efcf08ea..cd25fdb1c3 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java
@@ -12,6 +12,7 @@ import gtPlusPlus.xmod.galacticraft.HANDLER_GalactiCraft;
import gtPlusPlus.xmod.gregtech.HANDLER_GT;
import gtPlusPlus.xmod.growthcraft.HANDLER_GC;
import gtPlusPlus.xmod.ic2.HANDLER_IC2;
+import gtPlusPlus.xmod.ob.HANDLER_OpenBlocks;
import gtPlusPlus.xmod.railcraft.HANDLER_Railcraft;
import gtPlusPlus.xmod.reliquary.HANDLER_Reliquary;
import gtPlusPlus.xmod.sc2.HANDLER_SC2;
@@ -37,6 +38,7 @@ public class COMPAT_IntermodStaging {
HANDLER_CropsPlusPlus.preInit(preinit);
HANDLER_Railcraft.preInit();
HANDLER_Reliquary.preInit();
+ HANDLER_OpenBlocks.preInit();
}
public static void init(FMLInitializationEvent init){
@@ -55,6 +57,7 @@ public class COMPAT_IntermodStaging {
HANDLER_CropsPlusPlus.init(init);
HANDLER_Railcraft.init();
HANDLER_Reliquary.init();
+ HANDLER_OpenBlocks.init();
}
public static void postInit(FMLPostInitializationEvent postinit){
@@ -73,6 +76,7 @@ public class COMPAT_IntermodStaging {
HANDLER_CropsPlusPlus.postInit(postinit);
HANDLER_Railcraft.postInit();
HANDLER_Reliquary.postInit();
+ HANDLER_OpenBlocks.postInit();
}
public static void onLoadComplete(FMLLoadCompleteEvent event) {
diff --git a/src/Java/gtPlusPlus/core/handler/chunkloading/ChunkLoading.java b/src/Java/gtPlusPlus/core/handler/chunkloading/ChunkLoading.java
deleted file mode 100644
index bc690f250c..0000000000
--- a/src/Java/gtPlusPlus/core/handler/chunkloading/ChunkLoading.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package gtPlusPlus.core.handler.chunkloading;
-
-import cpw.mods.fml.common.event.FMLInitializationEvent;
-import cpw.mods.fml.common.event.FMLPostInitializationEvent;
-import cpw.mods.fml.common.event.FMLPreInitializationEvent;
-import cpw.mods.fml.common.event.FMLServerStartingEvent;
-import cpw.mods.fml.common.event.FMLServerStoppingEvent;
-import gtPlusPlus.GTplusplus;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.minecraft.ChunkManager;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.minecraft.network.PacketHandler;
-import net.minecraftforge.common.ForgeChunkManager;
-
-public class ChunkLoading {
-
- private final ChunkLoading instance;
-
- public ChunkLoading() {
- instance = this;
- }
-
- public ChunkLoading getInstance() {
- return this.instance;
- }
-
-
- public void preInit(final FMLPreInitializationEvent event) {
- PacketHandler.init();
- ForgeChunkManager.setForcedChunkLoadingCallback(GTplusplus.instance, ChunkManager.getInstance());
- Utils.registerEvent(ChunkManager.getInstance());
- }
-
-
- public void init(final FMLInitializationEvent event) {
-
- }
-
-
- public void postInit(final FMLPostInitializationEvent event) {
-
- }
-
-
- public synchronized void serverStarting(final FMLServerStartingEvent event) {
-
- }
-
- public void serverStopping(final FMLServerStoppingEvent event){
- //Chunkload Handler
- if (ChunkManager.mChunkLoaderManagerMap.size() > 0) {
- Logger.INFO("Clearing Chunk Loaders.");
- ChunkManager.clearInternalMaps();
- }
- }
-
-}
diff --git a/src/Java/gtPlusPlus/core/handler/chunkloading/ChunkManager.java b/src/Java/gtPlusPlus/core/handler/chunkloading/ChunkManager.java
deleted file mode 100644
index f95c4e7a78..0000000000
--- a/src/Java/gtPlusPlus/core/handler/chunkloading/ChunkManager.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package gtPlusPlus.core.handler.chunkloading;
-
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.ListMultimap;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntityChunkLoader;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import net.minecraft.entity.Entity;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraft.world.World;
-import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
-import net.minecraftforge.common.ForgeChunkManager.OrderedLoadingCallback;
-import net.minecraftforge.common.ForgeChunkManager.PlayerOrderedLoadingCallback;
-import net.minecraftforge.common.ForgeChunkManager.Ticket;
-import net.minecraftforge.event.entity.EntityEvent.EnteringChunk;
-
-public class ChunkManager implements LoadingCallback, OrderedLoadingCallback, PlayerOrderedLoadingCallback {
- private static ChunkManager instance;
-
- public static ChunkManager getInstance() {
- if (instance == null) {
- instance = new ChunkManager();
- }
-
- return instance;
- }
-
- @SubscribeEvent
- public void entityEnteredChunk(EnteringChunk event) {
-
- }
-
- public Set<ChunkCoordIntPair> getChunksBetween(int xChunkA, int zChunkA, int xChunkB, int zChunkB, int max) {
- Set<ChunkCoordIntPair> chunkList = new HashSet<ChunkCoordIntPair>();
- if (xChunkA != xChunkB && zChunkA != zChunkB) {
- return chunkList;
- } else {
- int xStart = Math.min(xChunkA, xChunkB);
- int xEnd = Math.max(xChunkA, xChunkB);
- int zStart = Math.min(zChunkA, zChunkB);
- int zEnd = Math.max(zChunkA, zChunkB);
-
- for (int xx = xStart; xx <= xEnd; ++xx) {
- for (int zz = zStart; zz <= zEnd; ++zz) {
- chunkList.add(new ChunkCoordIntPair(xx, zz));
- if (chunkList.size() >= max) {
- return chunkList;
- }
- }
- }
-
- return chunkList;
- }
- }
-
- public Set<ChunkCoordIntPair> getChunksAround(int xChunk, int zChunk, int radius) {
- Set<ChunkCoordIntPair> chunkList = new HashSet<ChunkCoordIntPair>();
-
- for (int xx = xChunk - radius; xx <= xChunk + radius; ++xx) {
- for (int zz = zChunk - radius; zz <= zChunk + radius; ++zz) {
- chunkList.add(new ChunkCoordIntPair(xx, zz));
- }
- }
-
- return chunkList;
- }
-
- public Set<ChunkCoordIntPair> getBufferAround(int xWorld, int zWorld, int radius) {
- int minX = xWorld - radius >> 4;
- int maxX = xWorld + radius >> 4;
- int minZ = zWorld - radius >> 4;
- int maxZ = zWorld + radius >> 4;
- Set<ChunkCoordIntPair> chunkList = new HashSet<ChunkCoordIntPair>();
-
- for (int xx = minX; xx <= maxX; ++xx) {
- for (int zz = minZ; zz <= maxZ; ++zz) {
- chunkList.add(new ChunkCoordIntPair(xx, zz));
- }
- }
-
- return chunkList;
- }
-
- public void ticketsLoaded(List<Ticket> tickets, World world) {
- Iterator<Ticket> var3 = tickets.iterator();
- while (var3.hasNext()) {
- Ticket ticket = (Ticket) var3.next();
- if (!ticket.isPlayerTicket()) {
- Entity entity = ticket.getEntity();
- if (entity == null) {
- int x = ticket.getModData().getInteger("xCoord");
- int y = ticket.getModData().getInteger("yCoord");
- int z = ticket.getModData().getInteger("zCoord");
- if (y >= 0) {
- TileEntity tile = world.getTileEntity(x, y, z);
- if (tile instanceof IGregTechTileEntity) {
- IGregTechTileEntity g = (IGregTechTileEntity) tile;
- if (g instanceof GregtechMetaTileEntityChunkLoader) {
- GregtechMetaTileEntityChunkLoader t = (GregtechMetaTileEntityChunkLoader) g;
- t.forceChunkLoading(t.getBaseMetaTileEntity(), ticket);
- // this.printChunkLoader(t.getName(), x, y, z);
- }
- }
- }
- }
- }
- }
- }
-
- public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
- Set<Ticket> adminTickets = new HashSet<Ticket>();
- Set<Ticket> worldTickets = new HashSet<Ticket>();
- Set<Ticket> cartTickets = new HashSet<Ticket>();
- Iterator<Ticket> var7 = tickets.iterator();
-
- while (var7.hasNext()) {
- Ticket ticket = (Ticket) var7.next();
- Entity entity = ticket.getEntity();
- if (entity == null) {
- int x = ticket.getModData().getInteger("xCoord");
- int y = ticket.getModData().getInteger("yCoord");
- int z = ticket.getModData().getInteger("zCoord");
- String type = ticket.getModData().getString("type");
- if (y >= 0) {
- if (type.equals("AdminChunkLoader")) {
- adminTickets.add(ticket);
- } else if (type.equals("StandardChunkLoader")) {
- worldTickets.add(ticket);
- } else if (type.isEmpty()) {
- worldTickets.add(ticket);
- }
- }
- }
- }
-
- List<Ticket> claimedTickets = new LinkedList<Ticket>();
- claimedTickets.addAll(cartTickets);
- claimedTickets.addAll(adminTickets);
- claimedTickets.addAll(worldTickets);
- return claimedTickets;
- }
-
- public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world) {
- return LinkedListMultimap.create();
- }
-} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java
index 35d2066793..6e5b47041f 100644
--- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java
+++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java
@@ -106,12 +106,12 @@ public class GenericChem extends ItemPackage {
private ItemStack mCatalystCarrier;
- public ItemStack mRedCatalyst;
- public ItemStack mYellowCatalyst;
- public ItemStack mBlueCatalyst;
- public ItemStack mOrangeCatalyst;
- public ItemStack mPurpleCatalyst;
- public ItemStack mBrownCatalyst;
+ public static ItemStack mRedCatalyst;
+ public static ItemStack mYellowCatalyst;
+ public static ItemStack mBlueCatalyst;
+ public static ItemStack mOrangeCatalyst;
+ public static ItemStack mPurpleCatalyst;
+ public static ItemStack mBrownCatalyst;
public void registerItemStacks() {
@@ -227,14 +227,13 @@ public class GenericChem extends ItemPackage {
CORE.RA.addFluidReactorRecipe(
new ItemStack[] {
getTierTwoChip(),
- ItemUtils.getSimpleStack(mBrownCatalyst, 1)
+ ItemUtils.getSimpleStack(mBrownCatalyst, 0)
},
new FluidStack[] {
FluidUtils.getFluidStack(Benzene, 2000),
FluidUtils.getFluidStack("hydrogen", 10000)
},
new ItemStack[] {
- ItemUtils.getSimpleStack(mCatalystCarrier, 1)
},
new FluidStack[] {
@@ -251,14 +250,13 @@ public class GenericChem extends ItemPackage {
CORE.RA.addFluidReactorRecipe(
new ItemStack[] {
getTierTwoChip(),
- ItemUtils.getSimpleStack(mBlueCatalyst, 1)
+ ItemUtils.getSimpleStack(mBlueCatalyst, 0)
},
new FluidStack[] {
FluidUtils.getFluidStack(Cyclohexane, 2000),
FluidUtils.getFluidStack("air", 10000)
},
new ItemStack[] {
- ItemUtils.getSimpleStack(mCatalystCarrier, 1)
},
new FluidStack[] {
@@ -431,14 +429,13 @@ public class GenericChem extends ItemPackage {
CORE.RA.addFluidReactorRecipe(
new ItemStack[] {
getTierThreeChip(),
- ItemUtils.getSimpleStack(mBlueCatalyst, 1)
+ ItemUtils.getSimpleStack(mBlueCatalyst, 0)
},
new FluidStack[] {
FluidUtils.getFluidStack(NitroBenzene, 2000),
FluidUtils.getFluidStack("hydrogen", 10000)
},
new ItemStack[] {
- ItemUtils.getSimpleStack(mCatalystCarrier, 1)
},
new FluidStack[] {
@@ -510,7 +507,7 @@ public class GenericChem extends ItemPackage {
CORE.RA.addFluidReactorRecipe(
new ItemStack[] {
CI.getNumberedCircuit(4),
- ItemUtils.getSimpleStack(mOrangeCatalyst, 1),
+ ItemUtils.getSimpleStack(mOrangeCatalyst, 0),
},
new FluidStack[] {
FluidUtils.getFluidStack(Ethylanthraquinone2, 4000),
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
index 14858b15aa..cf2242067f 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
@@ -645,7 +645,7 @@ public class RECIPES_GREGTECH {
},
new int[] {10000}, //Output Chance
20 * 120,
- 122880);
+ 30720);
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index 578ef8f89c..8225a40c29 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -8,6 +8,7 @@ import gregtech.api.util.GT_ModHandler;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.item.chemistry.AgriculturalChem;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.material.ALLOY;
@@ -15,6 +16,7 @@ import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.*;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
@@ -223,6 +225,7 @@ public class RECIPES_Machines {
}
initModItems();
+ tieredMachineHulls();
controlCores();
energyCores();
wirelessChargers();
@@ -230,8 +233,179 @@ public class RECIPES_Machines {
industrialVacuumFurnace();
fakeMachineCasingCovers();
ztonesCoverRecipes();
+ overflowValveCovers();
superBuses();
roundRobinators();
+ chunkloaders();
+ distillus();
+ algaeFarm();
+ chemPlant();
+
+ }
+
+ private static void chemPlant() {
+
+ CORE.RA.addSixSlotAssemblingRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(19),
+ CI.getTieredGTPPMachineCasing(1, 6),
+ CI.getTieredComponentOfMaterial(Materials.Steel, OrePrefixes.gearGt, 6),
+ CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plate, 32),
+ CI.getTieredComponentOfMaterial(Materials.CobaltBrass, OrePrefixes.dust, 16),
+ ALLOY.STAINLESS_STEEL.getFrameBox(4),
+ },
+ ALLOY.STEEL.getFluid(2 * (144 * 4)),
+ GregtechItemList.ChemicalPlant_Controller.get(1),
+ 120 * 20,
+ MaterialUtils.getVoltageForTier(2));
+
+ }
+
+ private static void algaeFarm() {
+
+ // Give the shitty algae a use :)
+ CORE.RA.addDistilleryRecipe(
+ ItemUtils.getSimpleStack(AgriculturalChem.mAlgaeBiosmass, 32),
+ null,
+ null,
+ ItemUtils.getSimpleStack(AgriculturalChem.mGreenAlgaeBiosmass, 4),
+ 20 * 15,
+ 16,
+ false);
+
+ CORE.RA.addSixSlotAssemblingRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(21),
+ CI.getTieredGTPPMachineCasing(0, 4),
+ CI.getTieredComponentOfMaterial(Materials.Iron, OrePrefixes.rod, 12),
+ CI.getTieredComponentOfMaterial(Materials.Wood, OrePrefixes.plate, 32),
+ CI.getTieredComponentOfMaterial(Materials.Bronze, OrePrefixes.bolt, 16),
+ CI.getTieredComponentOfMaterial(Materials.Redstone, OrePrefixes.dust, 32),
+ },
+ ALLOY.POTIN.getFluid(2 * (144 * 4)),
+ GregtechItemList.AlgaeFarm_Controller.get(1),
+ 60 * 20,
+ MaterialUtils.getVoltageForTier(1));
+
+
+ }
+
+ private static void distillus() {
+
+ CORE.RA.addFluidReactorRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(19),
+ ItemList.Distillation_Tower.get(2),
+ GregtechItemList.GTPP_Casing_IV.get(16),
+ CI.getTieredComponent(OrePrefixes.circuit, 6, 8)
+ },
+ new FluidStack[] {
+ ALLOY.AQUATIC_STEEL.getFluid(144 * 32),
+ ALLOY.BABBIT_ALLOY.getFluid(144 * 16),
+ ALLOY.BRONZE.getFluid(144 * 64),
+ ALLOY.KANTHAL.getFluid(144 * 16),
+ },
+ new ItemStack[] {
+ GregtechItemList.Machine_Adv_DistillationTower.get(1)
+ },
+ new FluidStack[] {
+
+ },
+ 20 * 600,
+ MaterialUtils.getVoltageForTier(6),
+ 3);
+
+ }
+
+ private static void chunkloaders() {
+
+ ItemStack aOutputs[] = new ItemStack[] {
+ GregtechItemList.GT_Chunkloader_HV.get(1L),
+ GregtechItemList.GT_Chunkloader_IV.get(1L),
+ GregtechItemList.GT_Chunkloader_ZPM.get(1L),
+ };
+
+ int aIndex = 0;
+
+ for (int i=3;i<8;i++) {
+ if (i == 4 || i == 6) {
+ continue;
+ }
+ CORE.RA.addSixSlotAssemblingRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(21),
+ CI.getElectricPiston(i, 10),
+ CI.getFieldGenerator(i + 1, 6),
+ CI.getPlate(i, 16),
+ CI.getEmitter(i - 1, 24),
+ CI.getTieredComponent(OrePrefixes.cableGt08, i, 16)
+ },
+ ALLOY.EGLIN_STEEL.getFluid(i * (144 * 4)),
+ aOutputs[aIndex++].copy(),
+ 300 * 20,
+ MaterialUtils.getVoltageForTier(i));
+ }
+
+
+ }
+
+ private static void overflowValveCovers() {
+ ItemStack aOutputs[] = new ItemStack[] {
+ GregtechItemList.Cover_Overflow_ULV.get(1L),
+ GregtechItemList.Cover_Overflow_LV.get(1L),
+ GregtechItemList.Cover_Overflow_MV.get(1L),
+ GregtechItemList.Cover_Overflow_HV.get(1L),
+ GregtechItemList.Cover_Overflow_EV.get(1L),
+ GregtechItemList.Cover_Overflow_IV.get(1L),
+ };
+
+ for (int i=0;i<6;i++) {
+ CORE.RA.addSixSlotAssemblingRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(19),
+ CI.getElectricPump(i, 2),
+ CI.getElectricMotor(i, 2),
+ CI.getPlate(i, 4)
+ },
+ FluidUtils.getWater(i * 1500),
+ aOutputs[i].copy(),
+ 20 * 20,
+ MaterialUtils.getVoltageForTier(i));
+ }
+
+ }
+
+ private static void tieredMachineHulls() {
+
+ GregtechItemList[] aHulls = new GregtechItemList[] {
+ GregtechItemList.GTPP_Casing_ULV,
+ GregtechItemList.GTPP_Casing_LV,
+ GregtechItemList.GTPP_Casing_MV,
+ GregtechItemList.GTPP_Casing_HV,
+ GregtechItemList.GTPP_Casing_EV,
+ GregtechItemList.GTPP_Casing_IV,
+ GregtechItemList.GTPP_Casing_LuV,
+ GregtechItemList.GTPP_Casing_ZPM,
+ GregtechItemList.GTPP_Casing_UV,
+ GregtechItemList.GTPP_Casing_MAX
+ };
+
+ for (int i=0;i<10;i++) {
+ CORE.RA.addSixSlotAssemblingRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(22),
+ CI.getTieredMachineCasing(i),
+ CI.getPlate(i, 8),
+ CI.getGear(i, 2),
+ CI.getTieredComponent(OrePrefixes.cableGt02, i, 4),
+ CI.getTieredComponent(OrePrefixes.circuit, i, 2)
+ },
+ CI.getTieredFluid(i, 144 * i * 2),
+ aHulls[i].get(1),
+ 20 * 20,
+ MaterialUtils.getVoltageForTier(i));
+ }
+
}
private static void initModItems(){
diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java
index be1089a72a..6b8f992266 100644
--- a/src/Java/gtPlusPlus/core/recipe/common/CI.java
+++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java
@@ -592,7 +592,7 @@ public class CI {
};
private static final Materials[] aMaterial_Cables = new Materials[] {
- (CORE.ConfigSwitches.enableCustom_Cables && LoadedMods.EnderIO) ? Materials.RedstoneAlloy : CORE.GTNH ? Materials.Lead : Materials.Tin,
+ !CORE.GTNH ? Materials.Lead : Materials.Tin,
Materials.Cobalt,
Materials.AnnealedCopper,
Materials.Gold,
@@ -1244,4 +1244,24 @@ public class CI {
return ItemUtils.simpleMetaStack(AgriculturalChem.mBioCircuit, i, 0);
}
+ public static ItemStack getTieredGTPPMachineCasing(int aTier, int aAmount) {
+ GregtechItemList[] aHulls = new GregtechItemList[] {
+ GregtechItemList.GTPP_Casing_ULV,
+ GregtechItemList.GTPP_Casing_LV,
+ GregtechItemList.GTPP_Casing_MV,
+ GregtechItemList.GTPP_Casing_HV,
+ GregtechItemList.GTPP_Casing_EV,
+ GregtechItemList.GTPP_Casing_IV,
+ GregtechItemList.GTPP_Casing_LuV,
+ GregtechItemList.GTPP_Casing_ZPM,
+ GregtechItemList.GTPP_Casing_UV,
+ GregtechItemList.GTPP_Casing_MAX
+ };
+ return aHulls[aTier].get(aAmount);
+ }
+
+ public static ItemStack getTieredComponentOfMaterial(Materials aMaterial, OrePrefixes aPrefix, int aAmount) {
+ return ItemUtils.getOrePrefixStack(aPrefix, aMaterial, aAmount);
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index c73f9ee7a4..234b54d2d2 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -497,14 +497,13 @@ public class Utils {
return true;
}
- public static File getMcDir() {
- if (Minecraft.getMinecraft() == null) {
- return new File("testdir");
- }
- if ((MinecraftServer.getServer() != null) && MinecraftServer.getServer().isDedicatedServer()) {
- return new File(".");
+ public static File getMcDir() {
+ if (Utils.isClient()) {
+ if (Minecraft.getMinecraft() != null) {
+ return Minecraft.getMinecraft().mcDataDir;
+ }
}
- return Minecraft.getMinecraft().mcDataDir;
+ return new File(".");
}
private static short cellID = 15;
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java
index ea161e4adb..01d0efac54 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java
@@ -50,7 +50,7 @@ public class LangUtils {
}
public static String trans(String aNr, String aEnglish) {
- return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_" + aNr, aEnglish, false);
+ return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_GTPP_" + aNr, aEnglish, false);
}
}