aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/handler
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/gtPlusPlus/core/handler
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/gtPlusPlus/core/handler')
-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
3 files changed, 4 insertions, 210 deletions
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