From 04514282c08ebefdb3e68a46db34092f72be2316 Mon Sep 17 00:00:00 2001 From: miozune Date: Wed, 17 May 2023 00:01:01 +0900 Subject: Remove a lot of unused classes (#629) --- .../api/objects/minecraft/DimChunkPos.java | 50 --------- .../api/objects/minecraft/GenericStack.java | 41 ------- .../objects/minecraft/NoConflictGTRecipeMap.java | 122 --------------------- .../api/objects/minecraft/TexturePackage.java | 54 --------- .../api/objects/minecraft/ThreadPooCollector.java | 108 ------------------ 5 files changed, 375 deletions(-) delete mode 100644 src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java delete mode 100644 src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java delete mode 100644 src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java delete mode 100644 src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java delete mode 100644 src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java (limited to 'src/main/java/gtPlusPlus/api/objects/minecraft') diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java b/src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java deleted file mode 100644 index 6748b58537..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/DimChunkPos.java +++ /dev/null @@ -1,50 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import net.minecraft.client.Minecraft; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; - -public class DimChunkPos { - - public final int dimension; - public final int xPos; - public final int zPos; - public final Chunk mainChunk; - - public DimChunkPos(World world, BlockPos block) { - this.dimension = world.provider.dimensionId; - this.mainChunk = world.getChunkFromBlockCoords(block.xPos, block.zPos); - this.xPos = this.mainChunk.xPosition; - this.zPos = this.mainChunk.zPosition; - } - - public DimChunkPos(TileEntity tile) { - this.dimension = tile.getWorldObj().provider.dimensionId; - this.mainChunk = tile.getWorldObj().getChunkFromBlockCoords(tile.xCoord, tile.zCoord); - this.xPos = this.mainChunk.xPosition; - this.zPos = this.mainChunk.zPosition; - } - - public DimChunkPos(int dim, int x, int z) { - this.dimension = dim; - this.xPos = x; - this.zPos = z; - Chunk h = Minecraft.getMinecraft().getIntegratedServer().worldServerForDimension(dim) - .getChunkFromChunkCoords(xPos, zPos); - if (h == null) { - this.mainChunk = null; - } else { - this.mainChunk = h; - } - } - - public Chunk getChunk() { - if (this.mainChunk != null) { - return this.mainChunk; - } - Chunk h = Minecraft.getMinecraft().getIntegratedServer().worldServerForDimension(this.dimension) - .getChunkFromChunkCoords(xPos, zPos); - return h; - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java b/src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java deleted file mode 100644 index b49114e610..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/GenericStack.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; - -public class GenericStack { - - private ItemStack mItemStack; - private FluidStack mFluidStack; - - public GenericStack(ItemStack s) { - this.mItemStack = s; - this.mFluidStack = null; - } - - public GenericStack(FluidStack f) { - this.mItemStack = null; - this.mFluidStack = f; - } - - public GenericStack() { - this.mItemStack = null; - this.mFluidStack = null; - } - - public final synchronized FluidStack getFluidStack() { - return mFluidStack; - } - - public final synchronized ItemStack getItemStack() { - return mItemStack; - } - - public final synchronized void setItemStack(ItemStack mItemStack) { - this.mItemStack = mItemStack; - } - - public final synchronized void setFluidStack(FluidStack mFluidStack) { - this.mFluidStack = mFluidStack; - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java b/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java deleted file mode 100644 index df48c24c06..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/NoConflictGTRecipeMap.java +++ /dev/null @@ -1,122 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import java.util.Collection; -import java.util.Iterator; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.objects.data.AutoMap; - -public class NoConflictGTRecipeMap implements Collection { - - private AutoMap mRecipeCache = new AutoMap(); - private final IGregTechTileEntity mMachineType; - - public NoConflictGTRecipeMap() { - this(null); - } - - public NoConflictGTRecipeMap(IGregTechTileEntity tile0) { - this.mMachineType = tile0; - } - - public boolean put(GT_Recipe recipe) { - return add(recipe); - } - - @Override - public boolean add(GT_Recipe recipe) { - return mRecipeCache.setValue(recipe); - } - - public Collection getRecipeMap() { - return mRecipeCache.values(); - } - - public boolean isMapValidForMachine(IGregTechTileEntity tile) { - return tile == mMachineType; - } - - @Override - public boolean addAll(Collection arg0) { - int a = 0; - for (Object v : arg0) { - if (!this.mRecipeCache.containsValue((GT_Recipe) v)) { - this.mRecipeCache.put((GT_Recipe) v); - a++; - } - } - return a > 0; - } - - @Override - public void clear() { - mRecipeCache.clear(); - } - - @Override - public boolean contains(Object arg0) { - return mRecipeCache.containsValue((GT_Recipe) arg0); - } - - @Override - public boolean containsAll(Collection arg0) { - int a = 0; - for (Object v : arg0) { - if (this.mRecipeCache.containsValue((GT_Recipe) v)) { - a++; - } - } - return a == arg0.size(); - } - - @Override - public boolean isEmpty() { - return mRecipeCache.isEmpty(); - } - - @Override - public Iterator iterator() { - return mRecipeCache.iterator(); - } - - @Override - public boolean remove(Object arg0) { - return mRecipeCache.remove((GT_Recipe) arg0); - } - - @Override - public boolean removeAll(Collection arg0) { - int a = 0; - for (Object v : arg0) { - if (this.mRecipeCache.containsValue((GT_Recipe) v)) { - this.mRecipeCache.remove((GT_Recipe) v); - a++; - } - } - return a > 0; - } - - @Override - public boolean retainAll(Collection arg0) { - int mStartSize = this.mRecipeCache.size(); - this.mRecipeCache = (AutoMap) arg0; - int mEndsize = this.mRecipeCache.size(); - return mStartSize != mEndsize; - } - - @Override - public int size() { - return this.mRecipeCache.size(); - } - - @Override - public Object[] toArray() { - return this.mRecipeCache.toArray(); - } - - @Override - public T[] toArray(T[] arg0) { - return (T[]) this.mRecipeCache.toArray(); - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java b/src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java deleted file mode 100644 index 4e4e0e9780..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/TexturePackage.java +++ /dev/null @@ -1,54 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import java.util.LinkedHashMap; -import java.util.Set; - -import net.minecraft.util.IIcon; - -import gtPlusPlus.api.objects.data.AutoMap; - -public class TexturePackage { - - private AutoMap mAnimationArray = new AutoMap(); - - public IIcon getFrame(int aFrame) { - if (aFrame < 0 || aFrame >= mAnimationArray.size()) { - return mAnimationArray.get(0); - } - return mAnimationArray.get(aFrame); - } - - public boolean addFrame(IIcon aFrame) { - if (aFrame != null) { - return mAnimationArray.add(aFrame); - } - return false; - } - - public boolean addFrames(AutoMap aFrames) { - for (IIcon h : aFrames) { - if (!addFrame(h)) { - return false; - } - } - return true; - } - - public boolean addFrames(LinkedHashMap aFrames) { - for (IIcon h : aFrames.values()) { - if (!addFrame(h)) { - return false; - } - } - return true; - } - - public boolean addFrames(Set aFrames) { - for (IIcon h : aFrames) { - if (!addFrame(h)) { - return false; - } - } - return true; - } -} diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java b/src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java deleted file mode 100644 index f38a960044..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/ThreadPooCollector.java +++ /dev/null @@ -1,108 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; - -import net.minecraft.entity.passive.EntityAnimal; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.GTplusplus.INIT_PHASE; -import gtPlusPlus.api.objects.data.Pair; -import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; -import gtPlusPlus.core.util.Utils; - -public class ThreadPooCollector extends Thread { - - public boolean canRun = true; - public boolean isRunning = false; - - private static final long INIT_TIME; - private static long internalTickCounter = 0; - - private static final ThreadPooCollector mThread; - private static final HashMap> mPooCollectors = new LinkedHashMap>(); - - static { - mThread = new ThreadPooCollector(); - INIT_TIME = (System.currentTimeMillis()); - } - - public ThreadPooCollector() { - setName("gtpp.handler.poop"); - start(); - } - - public static ThreadPooCollector getInstance() { - return mThread; - } - - public static void addTask(TileEntityPooCollector aTile) { - BlockPos aTempPos = new BlockPos(aTile); - mPooCollectors.put(aTempPos.getUniqueIdentifier(), new Pair(aTempPos, aTile)); - } - - public static void stopThread() { - mThread.canRun = false; - } - - @Override - public void run() { - - if (!isRunning) { - isRunning = true; - } else { - return; - } - - while (canRun) { - if (mPooCollectors.isEmpty() || GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED) { - continue; - } else { - internalTickCounter = Utils.getTicksFromSeconds( - Utils.getSecondsFromMillis(Utils.getMillisSince(INIT_TIME, System.currentTimeMillis()))); - if (internalTickCounter % 100 == 0) { - for (Pair pair : mPooCollectors.values()) { - if (pair != null) { - BlockPos p = pair.getKey(); - if (p != null) { - if (p.world != null) { - World w = p.world; - if (w == null) { - continue; - } - Chunk c = w.getChunkFromBlockCoords(p.xPos, p.zPos); - if (c != null) { - if (c.isChunkLoaded) { - int startX = p.xPos - 2; - int startY = p.yPos; - int startZ = p.zPos - 2; - int endX = p.xPos + 3; - int endY = p.yPos + 5; - int endZ = p.zPos + 3; - AxisAlignedBB box = AxisAlignedBB - .getBoundingBox(startX, startY, startZ, endX, endY, endZ); - if (box != null) { - @SuppressWarnings("unchecked") - List animals = w - .getEntitiesWithinAABB(EntityAnimal.class, box); - if (animals != null && !animals.isEmpty()) { - pair.getValue().onPostTick(animals); - } - } else { - continue; - } - } - } - } - } - } - } - } - } - } - } -} -- cgit