aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/tileentities
diff options
context:
space:
mode:
authormiozune <miozune@gmail.com>2023-10-17 13:37:11 +0900
committermiozune <miozune@gmail.com>2023-10-17 17:39:55 +0900
commit325a5f154e8d8d7dac6c03deb632a0041b3d69ca (patch)
tree323c840a7478f6550ce6fac4606589a24f440f89 /src/main/java/gtPlusPlus/core/tileentities
parent6f27cb977e0ff601a540e9dbfd3d7565d0b05273 (diff)
downloadGT5-Unofficial-325a5f154e8d8d7dac6c03deb632a0041b3d69ca.tar.gz
GT5-Unofficial-325a5f154e8d8d7dac6c03deb632a0041b3d69ca.tar.bz2
GT5-Unofficial-325a5f154e8d8d7dac6c03deb632a0041b3d69ca.zip
Remove unused classes
Diffstat (limited to 'src/main/java/gtPlusPlus/core/tileentities')
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java157
-rw-r--r--src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java441
2 files changed, 0 insertions, 598 deletions
diff --git a/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java b/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java
deleted file mode 100644
index 563249672d..0000000000
--- a/src/main/java/gtPlusPlus/core/tileentities/base/TileBasicTank.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package gtPlusPlus.core.tileentities.base;
-
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-import net.minecraftforge.fluids.IFluidHandler;
-import net.minecraftforge.fluids.IFluidTank;
-
-import gregtech.common.covers.CoverInfo;
-import gtPlusPlus.api.objects.minecraft.BTF_FluidTank;
-
-public class TileBasicTank extends TileEntityBase implements IFluidHandler, IFluidTank {
-
- public final BTF_FluidTank mTank;
-
- public TileBasicTank(int aMaxSlots, int aFluidCapacity) {
- super(aMaxSlots);
- mTank = new BTF_FluidTank(aFluidCapacity);
- }
-
- @Override
- public boolean onPreTick(long aTick) {
-
- if (this.isServerSide()) {
- if (mTank.isFluidChangingAllowed() && mTank.getFillableStack() != null
- && mTank.getFillableStack().amount <= 0) {
- mTank.setFillableStack((FluidStack) null);
- }
- }
-
- return super.onPreTick(aTick);
- }
-
- private final boolean canFillEx(ForgeDirection aSide, Fluid aFluid) {
- return this.fill(aSide, new FluidStack(aFluid, 1), false) == 1;
- }
-
- private final boolean canDrainEx(ForgeDirection aSide, Fluid aFluid) {
- return this.drain(aSide, new FluidStack(aFluid, 1), false) != null;
- }
-
- private final FluidTankInfo[] getTankInfoEx(ForgeDirection aSide) {
- return mTank.getCapacity() <= 0 ? new FluidTankInfo[0] : new FluidTankInfo[] { mTank.getInfo() };
- }
-
- private final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- return mTank.fill(aFluid, doFill);
- }
-
- private final int fillEx(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- return this.fill_default(aSide, aFluid, doFill);
- }
-
- private final FluidStack drainEx(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
- return mTank.getFluid() != null && aFluid != null && mTank.getFluid().isFluidEqual(aFluid)
- ? mTank.drain(aFluid.amount, doDrain)
- : null;
- }
-
- private final FluidStack drainEx(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- return mTank.drain(maxDrain, doDrain);
- }
-
- public boolean isLiquidInput(ForgeDirection side) {
- return true;
- }
-
- public boolean isLiquidOutput(ForgeDirection side) {
- return true;
- }
-
- @Override
- public int fill(ForgeDirection side, FluidStack aFluid, boolean doFill) {
- if (mTickTimer > 5 && canAccessData()
- && (mRunningThroughTick || !mInputDisabled)
- && (side == ForgeDirection.UNKNOWN || (this.isLiquidInput(side)
- && getCoverInfoAtSide(side).letsFluidIn(aFluid == null ? null : aFluid.getFluid()))))
- return this.fillEx(side, aFluid, doFill);
- return 0;
- }
-
- @Override
- public FluidStack drain(ForgeDirection side, int maxDrain, boolean doDrain) {
- if (mTickTimer > 5 && canAccessData()
- && (mRunningThroughTick || !mOutputDisabled)
- && (side == ForgeDirection.UNKNOWN || (this.isLiquidOutput(side) && getCoverInfoAtSide(side)
- .letsFluidOut(this.getFluid() == null ? null : this.getFluid().getFluid()))))
- return this.drainEx(side, maxDrain, doDrain);
- return null;
- }
-
- @Override
- public FluidStack drain(ForgeDirection side, FluidStack aFluid, boolean doDrain) {
- if (mTickTimer > 5 && canAccessData()
- && (mRunningThroughTick || !mOutputDisabled)
- && (side == ForgeDirection.UNKNOWN || (this.isLiquidOutput(side)
- && getCoverInfoAtSide(side).letsFluidOut(aFluid == null ? null : aFluid.getFluid()))))
- return this.drainEx(side, aFluid, doDrain);
- return null;
- }
-
- @Override
- public boolean canFill(ForgeDirection side, Fluid aFluid) {
- if (mTickTimer > 5 && canAccessData()
- && (mRunningThroughTick || !mInputDisabled)
- && (side == ForgeDirection.UNKNOWN
- || (this.isLiquidInput(side) && getCoverInfoAtSide(side).letsFluidIn(aFluid))))
- return this.canFillEx(side, aFluid);
- return false;
- }
-
- @Override
- public boolean canDrain(ForgeDirection side, Fluid aFluid) {
- if (mTickTimer > 5 && canAccessData()
- && (mRunningThroughTick || !mOutputDisabled)
- && (side == ForgeDirection.UNKNOWN
- || (this.isLiquidOutput(side) && getCoverInfoAtSide(side).letsFluidOut(aFluid))))
- return this.canDrainEx(side, aFluid);
- return false;
- }
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection side) {
- CoverInfo coverInfo = getCoverInfoAtSide(side);
- if (canAccessData()
- && (side == ForgeDirection.UNKNOWN || (this.isLiquidInput(side) && coverInfo.letsFluidIn(null))
- || (this.isLiquidOutput(side) && coverInfo.letsFluidOut(null))))
- return this.getTankInfoEx(side);
- return new FluidTankInfo[] {};
- }
-
- @Override
- public FluidStack getFluid() {
- return mTank.getFluid();
- }
-
- @Override
- public int getFluidAmount() {
- return mTank.getFluidAmount();
- }
-
- @Override
- public FluidTankInfo getInfo() {
- return mTank.getInfo();
- }
-
- @Override
- public int fill(FluidStack resource, boolean doFill) {
- return mTank.fill(resource, doFill);
- }
-
- @Override
- public FluidStack drain(int maxDrain, boolean doDrain) {
- return mTank.drain(maxDrain, doDrain);
- }
-}
diff --git a/src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java b/src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java
deleted file mode 100644
index 62b1e365aa..0000000000
--- a/src/main/java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java
+++ /dev/null
@@ -1,441 +0,0 @@
-package gtPlusPlus.core.tileentities.general.redstone;
-
-import net.minecraft.block.Block;
-import net.minecraft.init.Blocks;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.EnumSkyBlock;
-import net.minecraft.world.IBlockAccess;
-
-import cpw.mods.fml.common.registry.GameRegistry;
-import gtPlusPlus.api.interfaces.IToolable;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.minecraft.EntityUtils;
-
-public abstract class TileEntityRedstoneHandler extends TileEntity implements IToolable {
-
- private final int mTileType;
- private BlockPos mTilePos;
- private boolean mRequiresUpdate = false;
- private Long mStartTime;
- private Byte mRedstoneLevel;
-
- public boolean mLightMode = false;
- public float mLightValue = 0;
-
- /**
- * Sets the Redstone Handler Type.
- *
- * @param aTileType - A type of the handler designated by an int. 0 = receiver, 1 = emitter, 2 = both, anything else
- * = nothing.
- */
- public TileEntityRedstoneHandler(int aTileType) {
- mTileType = aTileType;
- registerTileEntity();
- }
-
- private void registerTileEntity() {
- if (!EntityUtils.isTileEntityRegistered(getTileEntityClass(), getTileEntityNameForRegistration())) {
- GameRegistry.registerTileEntity(getTileEntityClass(), getTileEntityNameForRegistration());
- }
- }
-
- protected abstract Class<? extends TileEntity> getTileEntityClass();
-
- protected abstract String getTileEntityNameForRegistration();
-
- public Block getBlock() {
- return mTilePos != null ? mTilePos.getBlockAtPos() : Blocks.redstone_block;
- }
-
- public final boolean isLight() {
- return mLightMode;
- }
-
- public final float getLightBrightness() {
- if (!isLight()) {
- return 0;
- } else {
- return mLightValue;
- }
- }
-
- @Override
- public void readFromNBT(NBTTagCompound aNBT) {
- mStartTime = aNBT.getLong("mStartTime");
- mInvName = aNBT.getString("mInvName");
- mLightValue = aNBT.getFloat("mLightValue");
- mLightMode = aNBT.getBoolean("mLightMode");
- mRedstoneLevel = aNBT.getByte("mRedstoneLevel");
- super.readFromNBT(aNBT);
- }
-
- @Override
- public void writeToNBT(NBTTagCompound aNBT) {
- aNBT.setInteger("mTileType", mTileType);
- aNBT.setLong("mStartTime", mStartTime);
- aNBT.setString("mInvName", mInvName);
- aNBT.setFloat("mLightValue", getLightBrightness());
- aNBT.setBoolean("mLightMode", isLight());
- aNBT.setByte("mRedstoneLevel", mRedstoneLevel);
- super.writeToNBT(aNBT);
- }
-
- private boolean mHasUpdatedRecently = false;
-
- private final boolean init() {
- if (mTilePos == null) {
- try {
- mTilePos = new BlockPos(this);
- } catch (Throwable t) {
- return false;
- }
- }
- if (mStartTime == null) {
- try {
- mStartTime = System.currentTimeMillis();
- } catch (Throwable t) {
- return false;
- }
- }
- return true;
- }
-
- private Long mLastUpdate;
- private String mInvName = "";
-
- @Override
- public void updateEntity() {
- // Handle init
- if (!init()) {
- return;
- }
- if (mRequiresUpdate || mLastUpdate == null) {
- mRequiresUpdate = false;
- mHasUpdatedRecently = true;
- mLastUpdate = System.currentTimeMillis();
- if (mTilePos.world.getBlockLightValue(xCoord, yCoord, zCoord) != getLightBrightness() / 0.0625f) {
- mTilePos.getBlockAtPos().setLightLevel(getLightBrightness() / 0.0625f);
- mTilePos.world.setLightValue(
- EnumSkyBlock.Block,
- xCoord,
- yCoord,
- zCoord,
- (int) (getLightBrightness() / 0.0625f));
- mTilePos.world.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
- Logger.INFO("Updating Light");
- }
- mTilePos.world.scheduleBlockUpdate(xCoord, yCoord, zCoord, mTilePos.getBlockAtPos(), 1);
- markDirty();
- }
- if (Utils.getMillisSince(mLastUpdate, System.currentTimeMillis()) >= 5000) {
- if (mHasUpdatedRecently) {
- mHasUpdatedRecently = false;
- this.markForUpdate();
- }
- }
-
- if (Utils.getMillisSince(mStartTime, System.currentTimeMillis()) % 50 == 0) {}
-
- super.updateEntity();
- }
-
- public final void markForUpdate() {
- mRequiresUpdate = true;
- }
-
- public final boolean hasUpdatedRecently() {
- return mHasUpdatedRecently;
- }
-
- @Override
- public int getBlockMetadata() {
- return super.getBlockMetadata();
- }
-
- @Override
- public void markDirty() {
- super.markDirty();
- }
-
- @Override
- public boolean canUpdate() {
- return true;
- }
-
- public void setRedstoneState(boolean aRedstoneActive) {}
-
- public void setCurrentTextureArray(IIcon[] aTextures) {}
-
- /**
- * Used to see if one of the blocks next to you or your block is getting power from a neighboring block. Used by
- * items like TNT or Doors so they don't have redstone going straight into them. Args: x, y, z
- */
- public boolean isGettingIndirectlyPowered() {
- if (mTilePos == null) {
- return false;
- }
- return mTilePos.world.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord);
- }
-
- public int getStrongestIndirectPower() {
- if (mTilePos == null) {
- return 0;
- }
- return mTilePos.world.getStrongestIndirectPower(xCoord, yCoord, zCoord);
- }
-
- /**
- * Gets the power level from a certain block face. Args: x, y, z, direction
- */
- public int getIndirectPowerForSide(int aSide) {
- if (mTilePos == null || aSide < 0 || aSide > 5) {
- return 0;
- }
- return mTilePos.world.getIndirectPowerLevelTo(xCoord, yCoord, zCoord, aSide);
- }
-
- /**
- * Returns the highest redstone signal strength powering the given block. Args: X, Y, Z.
- */
- public int getBlockPowerInput() {
- if (mTilePos == null) {
- return 0;
- }
- return mTilePos.world.getBlockPowerInput(xCoord, yCoord, zCoord);
- }
-
- /**
- * Determine if this block can make a redstone connection on the side provided, Useful to control which sides are
- * inputs and outputs for redstone wires.
- *
- * Side: -1: UP 0: NORTH 1: EAST 2: SOUTH 3: WEST
- *
- * @param world The current world
- * @param x X Position
- * @param y Y Position
- * @param z Z Position
- * @param side The side that is trying to make the connection
- * @return True to make the connection
- */
- public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) {
- if (mTilePos == null) {
- return false;
- }
- return canAcceptRedstoneSignal() || canSupplyRedstoneSignal();
- }
-
- /**
- * Called to determine whether to allow the a block to handle its own indirect power rather than using the default
- * rules.
- *
- * @param world The world
- * @param x The x position of this block instance
- * @param y The y position of this block instance
- * @param z The z position of this block instance
- * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side
- * @return Whether Block#isProvidingWeakPower should be called when determining indirect power
- */
- public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) {
- if (mTilePos == null) {
- return false;
- }
- return getBlock().isNormalCube();
- }
-
- /**
- * If this block should be notified of weak changes. Weak changes are changes 1 block away through a solid block.
- * Similar to comparators.
- *
- * @param world The current world
- * @param x X Position
- * @param y Y position
- * @param z Z position
- * @param side The side to check
- * @return true To be notified of changes
- */
- public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) {
- if (mTilePos == null) {
- return false;
- }
- return false;
- }
-
- /**
- * Override this to change the level of redstone output.
- *
- * @return
- */
- public int getRedstoneLevel() {
- if (mTilePos == null || mRedstoneLevel == null) {
- return 0;
- } else {
- if (canSupplyRedstoneSignal()) {
- if (this.hasUpdatedRecently()) {
- int aInputPower = getInputPowerLevel();
- mRedstoneLevel = (byte) ((aInputPower >= 0 && aInputPower <= 127) ? aInputPower : 0);
- }
- return mRedstoneLevel;
- }
- }
- return 0;
- }
-
- public boolean providesWeakPower() {
- return isProvidingPower();
- }
-
- public boolean providesStrongPower() {
- return isProvidingPower();
- }
-
- /**
- * Returns the amount of week power this block is providing to a side.
- *
- * @param world
- * @param x
- * @param y
- * @param z
- * @param side
- * @return
- */
- public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
- if (!providesWeakPower()) {
- return 0;
- }
- return getOutputPowerLevel();
- }
-
- /**
- * Returns the amount of strong power this block is providing to a side.
- *
- * @param world
- * @param x
- * @param y
- * @param z
- * @param side
- * @return
- */
- public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) {
- if (!providesStrongPower()) {
- return 0;
- }
- return getOutputPowerLevel();
- }
-
- /*
- * GT++ Simplified Redstone Handling functions.
- */
-
- /**
- *
- * @return - Does this Block supply redstone signal at all?
- */
- public final boolean isPowered() {
- return canAcceptRedstoneSignal() && getInputPowerLevel() > 0;
- }
-
- /**
- *
- * @return - Can this Block provide redstone signal at all?
- */
- public final boolean isProvidingPower() {
- return canSupplyRedstoneSignal() && getOutputPowerLevel() > 0;
- }
-
- /**
- *
- * @return - (0-15) Redstone Output signal level
- */
- public final int getOutputPowerLevel() {
- return getRedstoneLevel();
- }
-
- /**
- *
- * @return (0-15) Redstone Input Signal level
- */
- public final int getInputPowerLevel() {
- return getBlockPowerInput();
- }
-
- /**
- *
- * @return - Does this Tile Entity support outputting redstone?
- */
- public final boolean canSupplyRedstoneSignal() {
- return mTileType == 1 || mTileType == 2;
- }
-
- /**
- *
- * @return - Does this Tile Entity support inputting redstone?
- */
- public final boolean canAcceptRedstoneSignal() {
- return mTileType == 0 || mTileType == 2;
- }
-
- @Override
- public boolean isScrewdriverable() {
- return false;
- }
-
- @Override
- public boolean onScrewdriverLMB() {
- return false;
- }
-
- @Override
- public boolean onScrewdriverRMB() {
- return false;
- }
-
- @Override
- public boolean isWrenchable() {
- return false;
- }
-
- @Override
- public boolean onWrenchLMB() {
- return false;
- }
-
- @Override
- public boolean onWrenchRMB() {
- return false;
- }
-
- @Override
- public boolean isMalletable() {
- return false;
- }
-
- @Override
- public boolean onMalletLMB() {
- return false;
- }
-
- @Override
- public boolean onMalletRMB() {
- return false;
- }
-
- public void setCustomName(String displayName) {
- this.mInvName = displayName;
- }
-
- public String getCustomName() {
- return this.mInvName;
- }
-
- public String getInventoryName() {
- return this.hasCustomInventoryName() ? this.mInvName : "container.redstone.generic";
- }
-
- public boolean hasCustomInventoryName() {
- return (this.mInvName != null) && !this.mInvName.equals("");
- }
-}