diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
15 files changed, 578 insertions, 704 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 5828cc9ac2..7f22ac179e 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -37,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; @@ -47,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; @@ -66,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") @@ -116,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) @@ -138,7 +132,6 @@ public class GTplusplus implements ActionListener { public GTplusplus() { super(); INIT_PHASE.SUPER.setPhaseActive(true); - mChunkLoading = new ChunkLoading(); } // Pre-Init @@ -176,9 +169,6 @@ 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(); @@ -190,7 +180,6 @@ public class GTplusplus implements ActionListener { @Mod.EventHandler public void init(final FMLInitializationEvent event) { INIT_PHASE.INIT.setPhaseActive(true); - mChunkLoading.init(event); proxy.init(event); HazmatUtils.init(); proxy.registerNetworkStuff(); @@ -208,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(); @@ -231,7 +219,6 @@ 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()); @@ -247,7 +234,6 @@ public class GTplusplus implements ActionListener { @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/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..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/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/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/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 578ef8f89c..4feebce648 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -223,6 +223,7 @@ public class RECIPES_Machines { } initModItems(); + tieredMachineHulls(); controlCores(); energyCores(); wirelessChargers(); @@ -234,6 +235,39 @@ public class RECIPES_Machines { roundRobinators(); } + 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(){ if (LoadedMods.IndustrialCraft2){ IC2MFE = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:blockElectric", "IC2_MFE", 1, 1); diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index be1089a72a..cf4edcae99 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, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 573937aeee..28692e25cb 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -132,6 +132,14 @@ public enum GregtechItemList implements GregtechItemContainer { * MultiBlocks */ + + // Tier GT++ Casings + GTPP_Casing_ULV, GTPP_Casing_LV, + GTPP_Casing_MV, GTPP_Casing_HV, + GTPP_Casing_EV, GTPP_Casing_IV, + GTPP_Casing_LuV, GTPP_Casing_ZPM, + GTPP_Casing_UV, GTPP_Casing_MAX, + //IronBlastFurnace Machine_Bronze_BlastFurnace Machine_Iron_BlastFurnace, Casing_IronPlatedBricks, @@ -288,6 +296,7 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_Adv_BlastFurnace, Casing_Adv_BlastFurnace, Machine_Adv_ImplosionCompressor, + Machine_Adv_DistillationTower, //Advanced Vacuum Freezer diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java new file mode 100644 index 0000000000..94f97d8662 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaTieredCasingBlocks1.java @@ -0,0 +1,111 @@ +package gtPlusPlus.xmod.gregtech.common.blocks; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; +import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; +import gregtech.common.blocks.GT_Material_Casings; + +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.CasingTextureHandler; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.storage.GregtechMetaTileEntity_PowerSubStationController; + + +public class GregtechMetaTieredCasingBlocks1 extends GregtechMetaCasingBlocksAbstract { + + + private static class TieredCasingItemBlock extends GregtechMetaCasingItems { + + public TieredCasingItemBlock(Block par1) { + super(par1); + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + int aMeta = aStack.getItemDamage(); + if (aMeta < 10) { + aList.add("Tier: "+GT_Values.VN[aMeta]); + } + super.addInformation(aStack, aPlayer, aList, aF3_H); + } + } + + public GregtechMetaTieredCasingBlocks1() { + super(TieredCasingItemBlock.class, "gtplusplus.blocktieredcasings.1", GT_Material_Casings.INSTANCE); + for (byte i = 0; i < 16; i = (byte) (i + 1)) { + //TAE.registerTextures(new GT_CopiedBlockTexture(this, 6, i)); + // Don't register these Textures, Hatches should never need to use their Textures. + } + int aIndex = 0; + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".0.name", "Integral Encasement I"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".1.name", "Integral Encasement II"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".2.name", "Integral Encasement III"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".3.name", "Integral Encasement IV"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Integral Encasement V"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Integral Framework I"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Integral Framework II"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Integral Framework III"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Integral Framework IV"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "Integral Framework V"); + //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", "Vacuum Casing"); + //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", "Turbodyne Casing"); + //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); + //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".13.name", ""); + //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".14.name", ""); + //GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".15.name", " "); + + GregtechItemList.GTPP_Casing_ULV.set(new ItemStack(this, 1, 0)); + GregtechItemList.GTPP_Casing_LV.set(new ItemStack(this, 1, 1)); + GregtechItemList.GTPP_Casing_MV.set(new ItemStack(this, 1, 2)); + GregtechItemList.GTPP_Casing_HV.set(new ItemStack(this, 1, 3)); + GregtechItemList.GTPP_Casing_EV.set(new ItemStack(this, 1, 4)); + GregtechItemList.GTPP_Casing_IV.set(new ItemStack(this, 1, 5)); + GregtechItemList.GTPP_Casing_LuV.set(new ItemStack(this, 1, 6)); + GregtechItemList.GTPP_Casing_ZPM.set(new ItemStack(this, 1, 7)); + GregtechItemList.GTPP_Casing_UV.set(new ItemStack(this, 1, 8)); + GregtechItemList.GTPP_Casing_MAX.set(new ItemStack(this, 1, 9)); + + //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 10)); + //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 11)); + //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 12)); + //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 13)); + //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 14)); + //GregtechItemList.Casing_LV.set(new ItemStack(this, 1, 15)); + } + + public IIcon getIcon(int aSide, int aMeta) { + if (aMeta < 10) { + return TexturesGtBlock.TIERED_MACHINE_HULLS[aMeta].getIcon(); + } + switch (aMeta) { + case 10: + return Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS.getIcon(); + case 11: + return Textures.BlockIcons.MACHINE_HEATPROOFCASING.getIcon(); + case 12: + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + case 13: + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + case 14: + return Textures.BlockIcons.RENDERING_ERROR.getIcon(); + case 15: + return Textures.BlockIcons.MACHINE_COIL_SUPERCONDUCTOR.getIcon(); + } + return TexturesGtBlock.TEXTURE_CASING_TIERED_ULV.getIcon(); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 6cac1fddea..0e25057d35 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -408,6 +408,17 @@ public class TexturesGtBlock { private static final CustomIcon Internal_OVERLAY_AUTOMATION_SUPERBUFFER = new CustomIcon("iconsets/AUTOMATION_SUPERBUFFER"); public static final CustomIcon OVERLAY_AUTOMATION_SUPERBUFFER = Internal_OVERLAY_AUTOMATION_SUPERBUFFER; + // GT++ Tiered Hulls + public static final CustomIcon TEXTURE_CASING_TIERED_ULV = new CustomIcon("iconsets/TieredHulls/CASING_ULV"); + public static final CustomIcon TEXTURE_CASING_TIERED_LV = new CustomIcon("iconsets/TieredHulls/CASING_LV"); + public static final CustomIcon TEXTURE_CASING_TIERED_MV = new CustomIcon("iconsets/TieredHulls/CASING_MV"); + public static final CustomIcon TEXTURE_CASING_TIERED_HV = new CustomIcon("iconsets/TieredHulls/CASING_HV"); + public static final CustomIcon TEXTURE_CASING_TIERED_EV = new CustomIcon("iconsets/TieredHulls/CASING_EV"); + public static final CustomIcon TEXTURE_CASING_TIERED_IV = new CustomIcon("iconsets/TieredHulls/CASING_IV"); + public static final CustomIcon TEXTURE_CASING_TIERED_LuV = new CustomIcon("iconsets/TieredHulls/CASING_LuV"); + public static final CustomIcon TEXTURE_CASING_TIERED_ZPM = new CustomIcon("iconsets/TieredHulls/CASING_ZPM"); + public static final CustomIcon TEXTURE_CASING_TIERED_UV = new CustomIcon("iconsets/TieredHulls/CASING_UV"); + public static final CustomIcon TEXTURE_CASING_TIERED_MAX = new CustomIcon("iconsets/TieredHulls/CASING_MAX"); //Metroid related public static final CustomIcon TEXTURE_METAL_PANEL_A = new CustomIcon("metro/TEXTURE_METAL_PANEL_A"); @@ -566,6 +577,17 @@ public class TexturesGtBlock { TEXTURE_CASING_FUSION_COIL_II_7, TEXTURE_CASING_FUSION_COIL_II_8, TEXTURE_CASING_FUSION_COIL_II_9, TEXTURE_CASING_FUSION_COIL_II_10, TEXTURE_CASING_FUSION_COIL_II_11, TEXTURE_CASING_FUSION_COIL_II_12}; + public static IIconContainer[] TIERED_MACHINE_HULLS = new IIconContainer[]{ + TEXTURE_CASING_TIERED_ULV, + TEXTURE_CASING_TIERED_LV, + TEXTURE_CASING_TIERED_MV, + TEXTURE_CASING_TIERED_HV, + TEXTURE_CASING_TIERED_EV, + TEXTURE_CASING_TIERED_IV, + TEXTURE_CASING_TIERED_LuV, + TEXTURE_CASING_TIERED_ZPM, + TEXTURE_CASING_TIERED_UV, + TEXTURE_CASING_TIERED_MAX}; public static Object Casing_Material_Turbine; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java new file mode 100644 index 0000000000..9bed1846b7 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_DistillationTower.java @@ -0,0 +1,374 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced; + +import gregtech.api.GregTech_API; +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_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +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_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import org.apache.commons.lang3.ArrayUtils; + +import java.util.ArrayList; + +public class GregtechMetaTileEntity_Adv_DistillationTower extends GregtechMeta_MultiBlockBase { + + private static final int CASING_INDEX = 49; + + private short mControllerY = 0; + + private byte mMode = 0; + + public GregtechMetaTileEntity_Adv_DistillationTower(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GregtechMetaTileEntity_Adv_DistillationTower(String aName) { + super(aName); + } + + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntity_Adv_DistillationTower(this.mName); + } + + public String[] getTooltip() { + String s = "Max parallel dictated by tower tier and mode"; + String s1 = "DTower Mode: T1=4, T2=12"; + String s2 = "Distilery Mode: Tower Tier * (4*InputTier)"; + return new String[]{ + "Controller Block for the Advanced Distillation Tower", + "T1 constructed identical to standard DT", + "T2 is not variable height", + "Size(WxHxD): 3x26x3", + "Controller (Front bottom)", + "1x Input Hatch (Any bottom layer casing)", + "24x Output Hatch (One per layer except bottom/top layer)", + "1x Output Bus (Any bottom layer casing)", + "1x Maintenance Hatch (Any casing)", + "1x Energy Hatch (Any casing)", + "Clean Stainless Steel Machine Casings for the rest ((7 x 25) - 5 at least!)", + s, + s1, + s2}; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)}; + } + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[CASING_INDEX]}; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "DistillationTower.png"); + } + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return mMode == 0 ? GT_Recipe.GT_Recipe_Map.sDistillationRecipes : GT_Recipe.GT_Recipe_Map.sDistilleryRecipes; + } + + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + public int getPollutionPerTick(ItemStack aStack) { + return this.mMode == 1 ? 12 : 24; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setByte("mMode", mMode); + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mMode = aNBT.getByte("mMode"); + super.loadNBTData(aNBT); + } + + @Override + public String getSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(203)); + } + + @Override + public void startProcess() { + this.sendLoopStart((byte) 1); + } + + @Override + public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mMode++; + if (mMode > 1){ + mMode = 0; + PlayerUtils.messagePlayer(aPlayer, "Now running in Distillation Tower Mode."); + } + else { + PlayerUtils.messagePlayer(aPlayer, "Now running in Distillery Mode."); + } + } + + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public boolean addOutput(FluidStack aLiquid) { + if (aLiquid == null) return false; + FluidStack tLiquid = aLiquid.copy(); + for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) { + if (isValidMetaTileEntity(tHatch) && GT_ModHandler.isSteam(aLiquid) ? tHatch.outputsSteam() : tHatch.outputsLiquids()) { + if (tHatch.getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1) { + int tAmount = tHatch.fill(tLiquid, false); + if (tAmount >= tLiquid.amount) { + return tHatch.fill(tLiquid, true) >= tLiquid.amount; + } else if (tAmount > 0) { + tLiquid.amount = tLiquid.amount - tHatch.fill(tLiquid, true); + } + } + } + } + return false; + } + + @Override + protected void addFluidOutputs(FluidStack[] mOutputFluids2) { + for (int i = 0; i < mOutputFluids2.length; i++) { + if (mOutputHatches.size() > i && mOutputHatches.get(i) != null && mOutputFluids2[i] != null && isValidMetaTileEntity(mOutputHatches.get(i))) { + if (mOutputHatches.get(i).getBaseMetaTileEntity().getYCoord() == this.mControllerY + 1 + i) { + mOutputHatches.get(i).fill(mOutputFluids2[i], true); + } + } + } + + } + + @Override + public boolean hasSlotInGUI() { + return true; + } + + @Override + public boolean requiresVanillaGtGUI() { + return true; + } + + @Override + public String getCustomGUIResourceName() { + return "DistillationTower"; + } + + @Override + public String getMachineType() { + return "Distillery, Distillation Tower"; + } + + @Override + public boolean checkRecipe(final ItemStack aStack) { + for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { + ArrayList<ItemStack> tBusItems = new ArrayList<ItemStack>(); + tBus.mRecipeMap = getRecipeMap(); + if (isValidMetaTileEntity(tBus)) { + for (int i = tBus.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) { + if (tBus.getBaseMetaTileEntity().getStackInSlot(i) != null) + tBusItems.add(tBus.getBaseMetaTileEntity().getStackInSlot(i)); + } + } + ItemStack[] inputs = new ItemStack[tBusItems.size()]; + int slot = 0; + for (ItemStack g : tBusItems) { + inputs[slot++] = g; + } + if (inputs.length > 0) { + int para = (4* GT_Utility.getTier(this.getMaxInputVoltage())); + log("Recipe. ["+inputs.length+"]["+para+"]"); + if (checkRecipeGeneric(inputs, new FluidStack[]{}, para, 100, 250, 10000)) { + log("Recipe 2."); + return true; + } + } + + } + return false; + } + + @Override + public int getMaxParallelRecipes() { + if (this.mMode == 0) { + return getTierOfTower() == 1 ? 4 : getTierOfTower() == 2 ? 12 : 0; + } + else if (this.mMode == 1) { + return getTierOfTower() * (4 * GT_Utility.getTier(this.getMaxInputVoltage())); + } + return 0; + } + + @Override + public int getEuDiscountForParallelism() { + return 15; + } + + @Override + public boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int aTier = getTierOfTower(); + if (aTier > 0) { + if (aTier == 1) { + return checkTierOneTower(aBaseMetaTileEntity, aStack); + } + else if (aTier == 2) { + return checkTierTwoTower(aBaseMetaTileEntity, aStack); + } + } + return false; + } + + private int getTierOfTower() { + return 1; + } + + private boolean checkTierOneTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mControllerY = aBaseMetaTileEntity.getYCoord(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int y = 0; //height + int casingAmount = 0; + boolean reachedTop = false; + + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + if (x != 0 || z != 0) { + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (!addInputToMachineList(tileEntity, CASING_INDEX) + && !addOutputToMachineList(tileEntity, CASING_INDEX) + && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) + && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + + while (y < 12 && !reachedTop) { + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { + if (x != xDir || z != zDir) { + return false; + } + } else { + if (x == xDir && z == zDir) { + reachedTop = true; + } + if (!addOutputToMachineList(tileEntity, CASING_INDEX) + && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) + && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + } + return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; + } + + private boolean checkTierTwoTower(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mControllerY = aBaseMetaTileEntity.getYCoord(); + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int y = 0; //height + int casingAmount = 0; + boolean reachedTop = false; + + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + if (x != 0 || z != 0) { + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (!addInputToMachineList(tileEntity, CASING_INDEX) + && !addOutputToMachineList(tileEntity, CASING_INDEX) + && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) + && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + + while (y < 12 && !reachedTop) { + for (int x = xDir - 1; x <= xDir + 1; x++) { //x=width + for (int z = zDir - 1; z <= zDir + 1; z++) { //z=depth + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + if (aBaseMetaTileEntity.getAirOffset(x, y, z)) { + if (x != xDir || z != zDir) { + return false; + } + } else { + if (x == xDir && z == zDir) { + reachedTop = true; + } + if (!addOutputToMachineList(tileEntity, CASING_INDEX) + && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) + && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block == GregTech_API.sBlockCasings4 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + casingAmount++; + } else { + return false; + } + } + } + } + } + y++; + } + return casingAmount >= 7 * y - 5 && y >= 3 && y <= 12 && reachedTop; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java index 375b63e584..361fadcb5a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java @@ -9,21 +9,24 @@ import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks2; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks3; import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks4; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaTieredCasingBlocks1; public class Gregtech_Blocks { public static void run(){ - Logger.INFO("Expanding Gregtech Texture Array from 128 -> 1024."); + //Logger.INFO("Expanding Gregtech Texture Array from 128 -> 1024."); boolean didExpand = TAE.hookGtTextures(); - Logger.INFO("Did Texture Array expand correctly? "+didExpand); - Logger.INFO("|======| Texture Array New Length: "+Textures.BlockIcons.CASING_BLOCKS.length+" |======|"); + //Logger.INFO("Did Texture Array expand correctly? "+didExpand); + Logger.INFO("|======| Texture Array Length: "+Textures.BlockIcons.CASING_BLOCKS.length+" |======|"); //Casing Blocks ModBlocks.blockCasingsMisc = new GregtechMetaCasingBlocks(); ModBlocks.blockCasings2Misc = new GregtechMetaCasingBlocks2(); ModBlocks.blockCasings3Misc = new GregtechMetaCasingBlocks3(); ModBlocks.blockCasings4Misc = new GregtechMetaCasingBlocks4(); + + ModBlocks.BlockTieredCasings1 = new GregtechMetaTieredCasingBlocks1(); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java index 2b683dd888..86cbdb75fa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFactoryGradeReplacementMultis.java @@ -3,6 +3,7 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialVacuumFreezer; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_DistillationTower; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_EBF; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Fusion_MK4; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.advanced.GregtechMetaTileEntity_Adv_Implosion; @@ -19,6 +20,11 @@ public class GregtechFactoryGradeReplacementMultis { GregtechItemList.Machine_Adv_ImplosionCompressor.set(new GregtechMetaTileEntity_Adv_Implosion(964, "multimachine.adv.implosioncompressor", "Density^2").getStackForm(1L)); GregtechItemList.Industrial_Cryogenic_Freezer.set(new GregtechMetaTileEntity_IndustrialVacuumFreezer(910, "multimachine.adv.industrialfreezer", "Cryogenic Freezer").getStackForm(1L)); GregtechItemList.FusionComputer_UV2.set(new GregtechMetaTileEntity_Adv_Fusion_MK4(965, "fusioncomputer.tier.09", "FusionTech MK IV").getStackForm(1L)); + + + //31021 + GregtechItemList.Machine_Adv_DistillationTower.set(new GregtechMetaTileEntity_Adv_DistillationTower(31021, "multimachine.adv.distillationtower", "Dangote Distillus").getStackForm(1L)); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java index bd0edd9002..86146640fd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechFluidReactor.java @@ -7,18 +7,19 @@ public class GregtechFluidReactor { public static void run() { - GregtechItemList.FluidReactor_LV - .set(new GregtechMetaTileEntity_ChemicalReactor(31021, "chemicalplant.01.tier.01", "Chemical Plant I", 1) - .getStackForm(1L)); - GregtechItemList.FluidReactor_HV - .set(new GregtechMetaTileEntity_ChemicalReactor(31022, "chemicalplant.01.tier.02", "Chemical Plant II", 3) - .getStackForm(1L)); - GregtechItemList.FluidReactor_IV - .set(new GregtechMetaTileEntity_ChemicalReactor(31023, "chemicalplant.01.tier.03", "Chemical Plant III", 5) - .getStackForm(1L)); - GregtechItemList.FluidReactor_ZPM - .set(new GregtechMetaTileEntity_ChemicalReactor(31024, "chemicalplant.01.tier.04", "Chemical Plant IV", 7) - .getStackForm(1L)); + /* + * GregtechItemList.FluidReactor_LV .set(new + * GregtechMetaTileEntity_ChemicalReactor(31021, "chemicalplant.01.tier.01", + * "Chemical Plant I", 1) .getStackForm(1L)); GregtechItemList.FluidReactor_HV + * .set(new GregtechMetaTileEntity_ChemicalReactor(31022, + * "chemicalplant.01.tier.02", "Chemical Plant II", 3) .getStackForm(1L)); + * GregtechItemList.FluidReactor_IV .set(new + * GregtechMetaTileEntity_ChemicalReactor(31023, "chemicalplant.01.tier.03", + * "Chemical Plant III", 5) .getStackForm(1L)); + * GregtechItemList.FluidReactor_ZPM .set(new + * GregtechMetaTileEntity_ChemicalReactor(31024, "chemicalplant.01.tier.04", + * "Chemical Plant IV", 7) .getStackForm(1L)); + */ } } |