aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorbotn365 <42187820+botn365@users.noreply.github.com>2020-01-08 16:48:18 +0100
committerGitHub <noreply@github.com>2020-01-08 16:48:18 +0100
commita3a9d4a5c2e466db33879176626670f2f07b635a (patch)
tree8176e79d6be425dc28cc3a612416b832a5bed3c5 /src/Java
parentd7c83c3cd1036668c1f520f144c08de444f675a4 (diff)
parent6bb3c6872c97b36c84f32bf730eee31206728c74 (diff)
downloadGT5-Unofficial-a3a9d4a5c2e466db33879176626670f2f07b635a.tar.gz
GT5-Unofficial-a3a9d4a5c2e466db33879176626670f2f07b635a.tar.bz2
GT5-Unofficial-a3a9d4a5c2e466db33879176626670f2f07b635a.zip
Merge pull request #7 from alkcorp/master
sync
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/GTplusplus.java19
-rw-r--r--src/Java/gtPlusPlus/api/interfaces/IChunkLoader.java33
-rw-r--r--src/Java/gtPlusPlus/api/interfaces/IChunkLoaderTile.java10
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/ChunkManager.java459
-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
-rw-r--r--src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java2
-rw-r--r--src/Java/gtPlusPlus/plugin/agrichem/BioRecipes.java12
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java11
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java8
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java111
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java22
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/covers/GTPP_Cover_Overflow2.java131
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechItems.java205
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaAtmosphericReconditioner.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntityChunkLoader.java529
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialDehydrator.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java375
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_LargeRocketEngine.java224
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/algae/GregtechMTE_AlgaePondBase.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/chemplant/GregtechMTE_ChemicalPlant.java372
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java9
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_AlgaeFarm.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java25
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredChunkloaders.java9
-rw-r--r--src/Java/gtPlusPlus/xmod/ob/GliderHandler.java135
-rw-r--r--src/Java/gtPlusPlus/xmod/ob/HANDLER_OpenBlocks.java38
43 files changed, 2294 insertions, 1231 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java
index 9cf395a9bf..7f22ac179e 100644
--- a/src/Java/gtPlusPlus/GTplusplus.java
+++ b/src/Java/gtPlusPlus/GTplusplus.java
@@ -29,6 +29,7 @@ import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.Recipe_GT;
import gregtech.api.util.SemiFluidFuelHandler;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.chunkloading.GTPP_ChunkManager;
import gtPlusPlus.core.commands.CommandDebugChunks;
import gtPlusPlus.core.commands.CommandEnableDebugWhileRunning;
import gtPlusPlus.core.commands.CommandMath;
@@ -36,7 +37,6 @@ import gtPlusPlus.core.common.CommonProxy;
import gtPlusPlus.core.config.ConfigHandler;
import gtPlusPlus.core.handler.BookHandler;
import gtPlusPlus.core.handler.Recipes.RegistrationHandler;
-import gtPlusPlus.core.handler.chunkloading.ChunkLoading;
import gtPlusPlus.core.handler.events.BlockEventHandler;
import gtPlusPlus.core.handler.events.LoginEventHandler;
import gtPlusPlus.core.handler.events.MissingMappingsEvent;
@@ -46,7 +46,6 @@ import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.nuclear.FLUORIDES;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.data.LocaleUtils;
-import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.HazmatUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.RecipeUtils;
@@ -65,7 +64,6 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechMiniRaFusion;
import gtPlusPlus.xmod.thaumcraft.commands.CommandDumpAspects;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.util.IIcon;
-import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
@MCVersion(value = "1.7.10")
@@ -115,9 +113,6 @@ public class GTplusplus implements ActionListener {
//GT++ Proxy Instances
@SidedProxy(clientSide = "gtPlusPlus.core.proxy.ClientProxy", serverSide = "gtPlusPlus.core.proxy.ServerProxy")
public static CommonProxy proxy;
-
- //Chunk handler
- public static ChunkLoading mChunkLoading;
// Loads Textures
@SideOnly(value = Side.CLIENT)
@@ -137,7 +132,6 @@ public class GTplusplus implements ActionListener {
public GTplusplus() {
super();
INIT_PHASE.SUPER.setPhaseActive(true);
- mChunkLoading = new ChunkLoading();
}
// Pre-Init
@@ -175,20 +169,17 @@ public class GTplusplus implements ActionListener {
Utils.registerEvent(new MissingMappingsEvent());
Logger.INFO("Login Handler Initialized");
-
-
- mChunkLoading.preInit(event);
proxy.preInit(event);
Logger.INFO("Setting up our own GT_Proxy.");
Meta_GT_Proxy.preInit();
Core_Manager.preInit();
+ GTPP_ChunkManager.init();
}
// Init
@Mod.EventHandler
public void init(final FMLInitializationEvent event) {
INIT_PHASE.INIT.setPhaseActive(true);
- mChunkLoading.init(event);
proxy.init(event);
HazmatUtils.init();
proxy.registerNetworkStuff();
@@ -206,7 +197,6 @@ public class GTplusplus implements ActionListener {
@Mod.EventHandler
public void postInit(final FMLPostInitializationEvent event) {
INIT_PHASE.POST_INIT.setPhaseActive(true);
- mChunkLoading.postInit(event);
proxy.postInit(event);
BookHandler.runLater();
Meta_GT_Proxy.postInit();
@@ -229,20 +219,21 @@ public class GTplusplus implements ActionListener {
@EventHandler
public synchronized void serverStarting(final FMLServerStartingEvent event) {
INIT_PHASE.SERVER_START.setPhaseActive(true);
- mChunkLoading.serverStarting(event);
event.registerServerCommand(new CommandMath());
event.registerServerCommand(new CommandEnableDebugWhileRunning());
event.registerServerCommand(new CommandDebugChunks());
if (LoadedMods.Thaumcraft) {
event.registerServerCommand(new CommandDumpAspects());
}
+ if (GTPP_ChunkManager.debugChunkloaders) {
+ event.registerServerCommand(new GTPP_ChunkManager.DebugCommand());
+ }
Core_Manager.serverStart();
INIT_PHASE.STARTED.setPhaseActive(true);
}
@Mod.EventHandler
public synchronized void serverStopping(final FMLServerStoppingEvent event) {
- mChunkLoading.serverStopping(event);
Core_Manager.serverStop();
if (GregtechBufferThread.mBufferThreadAllocation.size() > 0) {
for (GregtechBufferThread i : GregtechBufferThread.mBufferThreadAllocation.values()) {
diff --git a/src/Java/gtPlusPlus/api/interfaces/IChunkLoader.java b/src/Java/gtPlusPlus/api/interfaces/IChunkLoader.java
new file mode 100644
index 0000000000..c04e25f570
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/interfaces/IChunkLoader.java
@@ -0,0 +1,33 @@
+package gtPlusPlus.api.interfaces;
+
+import java.util.Set;
+
+import net.minecraft.world.ChunkCoordIntPair;
+
+public interface IChunkLoader {
+
+ public long getTicksRemaining();
+
+ public void setTicksRemaining(long aTicks);
+
+ public ChunkCoordIntPair getResidingChunk();
+
+ public void setResidingChunk(ChunkCoordIntPair aCurrentChunk);
+
+ public boolean getChunkLoadingActive();
+
+ public void setChunkLoadingActive(boolean aActive);
+
+ public boolean getDoesWorkChunkNeedReload();
+
+ public void setDoesWorkChunkNeedReload(boolean aActive);
+
+ public boolean addChunkToLoadedList(ChunkCoordIntPair aActiveChunk);
+
+ public boolean removeChunkFromLoadedList(ChunkCoordIntPair aActiveChunk);
+
+ public Set<ChunkCoordIntPair> getManagedChunks();
+
+ public int getChunkloaderTier();
+
+}
diff --git a/src/Java/gtPlusPlus/api/interfaces/IChunkLoaderTile.java b/src/Java/gtPlusPlus/api/interfaces/IChunkLoaderTile.java
deleted file mode 100644
index 16152668fc..0000000000
--- a/src/Java/gtPlusPlus/api/interfaces/IChunkLoaderTile.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package gtPlusPlus.api.interfaces;
-
-import net.minecraft.inventory.IInventory;
-import net.minecraft.world.chunk.storage.IChunkLoader;
-
-public interface IChunkLoaderTile extends IInventory, IChunkLoader{
-
- long getTicksRemaining();
-
-}
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/ChunkManager.java b/src/Java/gtPlusPlus/api/objects/minecraft/ChunkManager.java
deleted file mode 100644
index 826f0c5106..0000000000
--- a/src/Java/gtPlusPlus/api/objects/minecraft/ChunkManager.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * Copyright (c) CovertJaguar, 2014 http://railcraft.info
- *
- * This code is the property of CovertJaguar
- * and may only be used with explicit written
- * permission unless otherwise specified on the
- * license page at http://railcraft.info/wiki/info:license.
- */
-package gtPlusPlus.api.objects.minecraft;
-
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.google.common.collect.LinkedListMultimap;
-import com.google.common.collect.ListMultimap;
-
-import cpw.mods.fml.common.Mod.EventHandler;
-import cpw.mods.fml.common.event.FMLServerStartingEvent;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.gameevent.TickEvent;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.Entity;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.world.ChunkCoordIntPair;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-
-import gtPlusPlus.GTplusplus;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.data.ReverseAutoMap;
-import gtPlusPlus.api.objects.data.Triplet;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaTileEntityChunkLoader;
-import net.minecraftforge.common.ForgeChunkManager;
-import net.minecraftforge.common.ForgeChunkManager.*;
-import net.minecraftforge.event.entity.EntityEvent;
-
-/**
- * @author CovertJaguar <http://www.railcraft.info>
- */
-public class ChunkManager implements LoadingCallback, OrderedLoadingCallback, ForgeChunkManager.PlayerOrderedLoadingCallback {
-
- private static final ChunkManager instance;
- private static ReverseAutoMap<String> mIdToUUIDMap = new ReverseAutoMap<String>();
-
- public Timer mChunkQueue;
- public static ConcurrentHashMap<String, Triplet<Integer, GregtechMetaTileEntityChunkLoader, DimChunkPos>> mChunkLoaderManagerMap = new ConcurrentHashMap<String, Triplet<Integer, GregtechMetaTileEntityChunkLoader, DimChunkPos>>();
- private static long mInternalTickCounter = 0;
-
- static {
- instance = new ChunkManager();
- Logger.REFLECTION("Created ChunkManager object.");
- }
-
- private ChunkManager() {
- Utils.registerEvent(this);
- }
-
- public static void clearInternalMaps() {
- mIdToUUIDMap.clear();
- mChunkLoaderManagerMap.clear();
- }
-
- public static boolean setIdAndUniqueString(int id, String blockposString) {
- if (mIdToUUIDMap.injectCleanDataToAutoMap(id, blockposString)) {
- Logger.INFO("Found Cached ID from NBT, cleanly injected into ChunkManager.");
- return true;
- }
- else {
- Logger.INFO("ID in use, best try a few times to get a free ID.");
- for (int u=0;u<mIdToUUIDMap.size()+1;u++) {
- if (mIdToUUIDMap.injectCleanDataToAutoMap(u, blockposString)) {
- Logger.INFO("Success! Cleanly injected into ChunkManager.");
- return true;
- }
- }
- for (int u=0;u<50;u++) {
- if (mIdToUUIDMap.injectCleanDataToAutoMap(MathUtils.randInt(0, 250000), blockposString)) {
- Logger.INFO("Success! Cleanly injected into ChunkManager.");
- return true;
- }
- }
- return false;
-
- }
- }
-
- public static int getIdFromUniqueString(String blockposString) {
- if (mIdToUUIDMap.containsValue(blockposString)) {
- return mIdToUUIDMap.get(blockposString);
- }
- else {
- return mIdToUUIDMap.putToInternalMap(blockposString);
- }
- }
-
- public static String getUniqueStringFromID(int id) {
- if (mIdToUUIDMap.containsKey(id)) {
- return mIdToUUIDMap.get(id);
- }
- else {
- return "0@0@0@0";
- }
- }
-
- @EventHandler
- public void serverStarting(final FMLServerStartingEvent event) {
- //Chunk Loading
- ChunkManager.getInstance().mChunkQueue = ChunkManager.createChunkQueue();
- }
-
- @SubscribeEvent
- public void serverTick(final TickEvent.ServerTickEvent e){
- mInternalTickCounter++;
- try {
- if (mInternalTickCounter % (20*15) == 0) {
- for (String g : mChunkLoaderManagerMap.keySet()) {
- BlockPos i = BlockPos.generateBlockPos(g);
- if (i == null) {
- mChunkLoaderManagerMap.remove(g);
- Logger.MACHINE_INFO("Bad Mapping: "+g);
- continue;
- }
- else {
- Logger.MACHINE_INFO("Good Mapping: "+i.getLocationString());
- }
- Block mBlock = i.world.getBlock(i.xPos, i.yPos, i.zPos);
- TileEntity mTile = i.world.getTileEntity(i.xPos, i.yPos, i.zPos);
- IGregTechTileEntity mGTile = null;
- boolean remove = false;
- if (((mTile = i.world.getTileEntity(i.xPos, i.yPos, i.zPos)) != null) && (mTile instanceof IGregTechTileEntity)){
- mGTile = (IGregTechTileEntity) mTile; //943-945
- if (mGTile instanceof GregtechMetaTileEntityChunkLoader || mGTile.getMetaTileID() == 943 || mGTile.getMetaTileID() == 944 || mGTile.getMetaTileID() == 945) {
- Logger.MACHINE_INFO("Found Valid Chunk Loader Entity.");
- continue;
- }
- else {
- Logger.MACHINE_INFO("Found Valid GT Tile which was not a Chunk Loader Entity.");
- remove = true;
- }
- }
- else if ((mTile = i.world.getTileEntity(i.xPos, i.yPos, i.zPos)) != null){
- Logger.MACHINE_INFO("Found Valid Tile Entity.");
- remove = true;
- }
- else {
- mTile = null;
- remove = true;
- }
- if (mBlock == null || mGTile == null || mBlock != GregTech_API.sBlockMachines) {
- remove = true;
- }
-
- if (remove) {
- //1
- if (mBlock != null) {
- Logger.MACHINE_INFO("Found Block.");
- //2
- if (mBlock == GregTech_API.sBlockMachines) {
- Logger.MACHINE_INFO("Found GT Machine.");
- //3
- if (mTile != null) {
- //4
- if (GregtechMetaTileEntityChunkLoader.class.isInstance(mTile.getClass())) {
- Logger.MACHINE_INFO("Found Valid Chunk Loader.");
- }
- else {
- Logger.MACHINE_INFO("Tile Entity was not a Chunk Loader.");
- }//4
- }
- else {
- Logger.MACHINE_INFO("Tile Entity was Null though.");
- }//3
- }
- else {
- Logger.MACHINE_INFO("Found Block that was not a GT Machine.");
- }//2
- }
- else {
- Logger.MACHINE_INFO("Found Null Block.");
- }//1
- }
- mChunkLoaderManagerMap.remove(i.getUniqueIdentifier());
- Logger.INFO("Removing invalid Chunk Loader. Mapping: "+i.getUniqueIdentifier());
- continue;
- }
- }
- }
- catch (Throwable t) {
- t.printStackTrace();
- }
-
- }
-
- public static ChunkManager getInstance() {
- return instance;
- }
-
- @SubscribeEvent
- public void entityEnteredChunk(EntityEvent.EnteringChunk event) {
-
- }
-
- /**
- * Returns a Set of ChunkCoordIntPair containing the chunks between the
- * start and end chunks.
- * <p/>
- * One of the pairs of start/end coords need to be equal.
- * <p/>
- * Coordinates are in chunk coordinates, not world coordinates.
- *
- * @param xChunkA Start Chunk x-Coord
- * @param zChunkA Start Chunk z-Coord
- * @param xChunkB End Chunk x-Coord
- * @param zChunkB End Chunk z-Coord
- * @param max Max number of chunks to return
- * @return A set of chunks.
- */
- 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;
- }
-
- 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;
- }
-
- /**
- * Returns a Set of ChunkCoordIntPair containing the chunks around point [x,
- * z]. Coordinates are in chunk coordinates, not world coordinates.
- *
- * @param xChunk Chunk x-Coord
- * @param zChunk Chunk z-Coord
- * @param radius Distance from [x, z] to include, in number of chunks.
- * @return A set of chunks.
- */
- 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;
- }
-
- /**
- * Returns a Set of ChunkCoordIntPair containing the chunks around point [x,
- * z]. Coordinates are in world coordinates, not chunk coordinates.
- *
- * @param xWorld World x-Coord
- * @param zWorld World z-Coord
- * @param radius Distance from [x, z] to include, in blocks.
- * @return A set of chunks.
- */
- 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;
- }
-
- private void printAnchor(String type, int x, int y, int z) {
- Logger.INFO("[Chunk Loader] "+type+" @ [x: "+x+"][y: "+y+"][z: "+z+"]");
- }
-
- @Override
- public void ticketsLoaded(List<Ticket> tickets, World world) {
-
- if (world.isRemote) return;
-
- System.out.println("Callback 2");
- for (Ticket ticket : tickets) {
- if (ticket.isPlayerTicket())
- continue;
- 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) {
- BlockPos tile = new BlockPos(x, y, z, world);
- Ticket H = tryForceLoadChunk(new DimChunkPos(world, tile).getChunk());
-
- int jhg = 0;
- while (jhg < 50) {
- jhg++;
- }
-
- if (!mChunkLoaderManagerMap.isEmpty()) {
- GregtechMetaTileEntityChunkLoader f = mChunkLoaderManagerMap.get(tile.getUniqueIdentifier()).getValue_2();
- int timeout = 0;
- while (f == null) {
- if (timeout > 5000) {
- Logger.INFO("[Chunk Loader] Timed out");
- break;
- }
- else {
- GregtechMetaTileEntityChunkLoader g;
- if (!mChunkLoaderManagerMap.isEmpty()) {
- g = mChunkLoaderManagerMap.get(tile.getUniqueIdentifier()).getValue_2();
- if (g == null) {
- timeout++;
- }
- else {
- Logger.INFO("[Chunk Loader]Tile became Valid");
- f = g;
- break;
- }
- }
- }
- }
- try {
- if (f != null) {
- if (H != null) {
- ForgeChunkManager.releaseTicket(H);
- }
- f.forceChunkLoading(f.getBaseMetaTileEntity(), ticket);
- printAnchor("Force Chunk Loading. Chunk Loader has ID of "+f.getUUID().toString()+". ",x,y,z);
- }
- else {
- Logger.INFO("Tile Entity is null.");
- }
- }
- catch (Throwable t) {
- t.printStackTrace();
- Logger.INFO("Mild problem with chunk loading, nothing to worry about.");
- }
-
-
- if (H != null) {
- ForgeChunkManager.releaseTicket(H);
- }
-
- }
-
- /*if (tile instanceof IGregTechTileEntity) {
- final IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tile;
- IGregTechTileEntity anchor = (IGregTechTileEntity) tile;
- GregtechMetaTileEntityChunkLoader jun = (GregtechMetaTileEntityChunkLoader) anchor;
- jun.forceChunkLoading(ticket);
- //printAnchor(anchor.getName(), x, y, z);
- }*/
- }
- }
- }
- }
-
- @Override
- public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
- // System.out.println("Callback 1");
- Set<Ticket> adminTickets = new HashSet<Ticket>();
- Set<Ticket> worldTickets = new HashSet<Ticket>();
- Set<Ticket> cartTickets = new HashSet<Ticket>();
- for (Ticket ticket : tickets) {
- 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) {
- worldTickets.add(ticket);
- }
- }
- }
-
- List<Ticket> claimedTickets = new LinkedList<Ticket>();
- claimedTickets.addAll(cartTickets);
- claimedTickets.addAll(adminTickets);
- claimedTickets.addAll(worldTickets);
- return claimedTickets;
- }
-
- @Override
- public ListMultimap<String, Ticket> playerTicketsLoaded(ListMultimap<String, Ticket> tickets, World world) {
- return LinkedListMultimap.create();
- }
-
-
- public static Timer createChunkQueue() {
- return ChunkTimerLoader();
- }
-
- public static Ticket tryForceLoadChunk(Chunk c) {
- Ticket T = getTicketFromForge(c.worldObj);
- if (T == null) {
- Logger.INFO("[Chunk Loader] Trying to force load a chunk that holds a chunkloader, however the Chunk Loading Ticket was null.");
- return null;
- }
- ForgeChunkManager.forceChunk(T, c.getChunkCoordIntPair());
- Logger.INFO("[Chunk Loader] Trying to force load a chunk that holds a chunkloader.");
- return T;
- }
-
- public static Ticket getTicketFromForge(World world) {
- return ForgeChunkManager.requestTicket(GTplusplus.instance, world, Type.NORMAL);
- }
-
- static Timer ChunkTimerLoader() {
- Timer timer;
- timer = new Timer();
- timer.schedule(new ChunkCache(), 20 * 500);
- timer.scheduleAtFixedRate(new ChunkCache(), 15000, 60000);
- return timer;
- }
-
- //Timer Task for notifying the player.
- static class ChunkCache extends TimerTask {
- public ChunkCache() {
-
- }
-
- @Override
- public void run() {
- if (mChunkLoaderManagerMap.size() > 0) {
- for (Triplet<Integer, GregtechMetaTileEntityChunkLoader, DimChunkPos> j : mChunkLoaderManagerMap.values()) {
- Ticket T;
- Chunk C;
- T = j.getValue_2().getTicketFromForge(j.getValue_2().getBaseMetaTileEntity());
- C = j.getValue_3().getChunk();
- ForgeChunkManager.forceChunk(T, C.getChunkCoordIntPair());
- Logger.INFO("[Chunk Loader] Trying to force load a chunk that holds a chunkloader. [Timer]");
- }
- }
- else {
- Logger.INFO("[Chunk Loader] No chunks to try to force load chunks that hold chunkloaders.");
- }
- }
- }
-} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index a448e313ac..4bc5