diff options
author | Alexdoru <57050655+Alexdoru@users.noreply.github.com> | 2024-10-31 03:33:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 02:33:51 +0000 |
commit | 5ac1df7018ec085d1894a5b4e3e46c20e20e118f (patch) | |
tree | f5f9eabff05c31c325581ab9361b9168e20a7d6e | |
parent | 5b9c78cad1d62687c9429c8a6a6d4b29d4db9368 (diff) | |
download | GT5-Unofficial-5ac1df7018ec085d1894a5b4e3e46c20e20e118f.tar.gz GT5-Unofficial-5ac1df7018ec085d1894a5b4e3e46c20e20e118f.tar.bz2 GT5-Unofficial-5ac1df7018ec085d1894a5b4e3e46c20e20e118f.zip |
Delete 4 unused GT++ classes (#3426)
4 files changed, 0 insertions, 499 deletions
diff --git a/src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java b/src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java deleted file mode 100644 index e516f12ddd..0000000000 --- a/src/main/java/gtPlusPlus/api/objects/minecraft/AABB.java +++ /dev/null @@ -1,67 +0,0 @@ -package gtPlusPlus.api.objects.minecraft; - -import net.minecraft.entity.Entity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; - -import gtPlusPlus.core.util.minecraft.EntityUtils; - -/** - * Generates an AABB around an entity. - * - * @author Alkalus - * - */ -public class AABB { - - private final AxisAlignedBB mAabb; - private final World mWorld; - - /** - * Creates a AxisAlignedBB based around an Entity. - * - * @param aEntity - The Entity to work with. - * @param x - Maximum X from origin. - * @param y - Maximum Y from origin. - * @param z - Maximum Z from origin. - */ - public AABB(Entity aEntity, int x, int y, int z) { - if (aEntity == null) { - mAabb = null; - mWorld = null; - } else { - mWorld = aEntity.worldObj; - BlockPos aEntityLocation = EntityUtils.findBlockPosUnderEntity(aEntity); - int xMin, xMax, yMin, yMax, zMin, zMax; - xMin = aEntityLocation.xPos; - yMin = aEntityLocation.yPos; - zMin = aEntityLocation.zPos; - xMax = aEntityLocation.xPos + x; - yMax = aEntityLocation.yPos + y; - zMax = aEntityLocation.zPos + z; - mAabb = AxisAlignedBB.getBoundingBox(xMin, yMin, zMin, xMax, yMax, zMax); - } - } - - /** - * Used to get the AxisAlignedBB from this class. - * - * @return - */ - public AxisAlignedBB get() { - return mAabb; - } - - /** - * Used to determine if this object is valid or not. - * - * @return - */ - public boolean valid() { - return mAabb != null && mWorld != null; - } - - public World world() { - return mWorld; - } -} diff --git a/src/main/java/gtPlusPlus/core/handler/events/CustomMovementHandler.java b/src/main/java/gtPlusPlus/core/handler/events/CustomMovementHandler.java deleted file mode 100644 index 390efe0b35..0000000000 --- a/src/main/java/gtPlusPlus/core/handler/events/CustomMovementHandler.java +++ /dev/null @@ -1,144 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.util.MovementInputFromOptions; - -/* - * Replacement for MovementInputFromOptions - Built from the source of ToggleSneak 3.0.3 - */ - -public class CustomMovementHandler { - - public boolean isDisabled; - public boolean canDoubleTap; - - public boolean sprint = false; - public boolean sprintHeldAndReleased = false; - public boolean sprintDoubleTapped = false; - - private long lastPressed; - private long lastSprintPressed; - private boolean handledSneakPress; - private boolean handledSprintPress; - private boolean wasRiding; - - /* - * MovementInputFromOptions.updatePlayerMoveState() - */ - public void update(final Minecraft mc, final MovementInputFromOptions options, final EntityPlayerSP thisPlayer) { - options.moveStrafe = 0.0F; - options.moveForward = 0.0F; - - final GameSettings settings = mc.gameSettings; - - if (settings.keyBindForward.getIsKeyPressed()) { - ++options.moveForward; - } - - if (settings.keyBindBack.getIsKeyPressed()) { - --options.moveForward; - } - - if (settings.keyBindLeft.getIsKeyPressed()) { - ++options.moveStrafe; - } - - if (settings.keyBindRight.getIsKeyPressed()) { - --options.moveStrafe; - } - - options.jump = settings.keyBindJump.getIsKeyPressed(); - - // - // Sneak Toggle - Essentially the same as old ToggleSneak - // - - // Check to see if Enabled - Added 6/17/14 to provide option to disable Sneak Toggle - final boolean isSneaking = SneakManager.get(thisPlayer) - .Sneaking(); - if (isSneaking) { - // Key Pressed - if (settings.keyBindSneak.getIsKeyPressed() && !this.handledSneakPress) { - // Descend if we are flying, note if we were riding (so we can unsneak once dismounted) - if (thisPlayer.isRiding() || thisPlayer.capabilities.isFlying) { - options.sneak = true; - this.wasRiding = thisPlayer.isRiding(); - } else { - options.sneak = !options.sneak; - } - - this.lastPressed = System.currentTimeMillis(); - this.handledSneakPress = true; - } - - // Key Released - if (!settings.keyBindSneak.getIsKeyPressed() && this.handledSneakPress) { - // If we are flying or riding, stop sneaking after descent/dismount. - if (thisPlayer.capabilities.isFlying || this.wasRiding) { - options.sneak = false; - this.wasRiding = false; - } - // If the key was held down for more than 300ms, stop sneaking upon release. - else if ((System.currentTimeMillis() - this.lastPressed) > 300L) { - options.sneak = false; - } - - this.handledSneakPress = false; - } - } else { - options.sneak = settings.keyBindSneak.getIsKeyPressed(); - } - - if (options.sneak || SneakManager.get(thisPlayer) - .Sneaking()) { - options.moveStrafe = (float) (options.moveStrafe * 0.3D); - options.moveForward = (float) (options.moveForward * 0.3D); - } - - // - // Sprint Toggle - Updated 6/18/2014 - // - - // Establish conditions where we don't want to start a sprint - sneaking, riding, flying, hungry - final boolean enoughHunger = (thisPlayer.getFoodStats() - .getFoodLevel() > 6.0F) || thisPlayer.capabilities.isFlying; - final boolean canSprint = !options.sneak && !thisPlayer.isRiding() - && !thisPlayer.capabilities.isFlying - && enoughHunger; - - this.isDisabled = !SneakManager.get(thisPlayer) - .Sprinting(); - this.canDoubleTap = SneakManager.get(thisPlayer).optionDoubleTap; - - // Key Pressed - if ((canSprint || this.isDisabled) && settings.keyBindSprint.getIsKeyPressed() && !this.handledSprintPress) { - if (!this.isDisabled) { - this.sprint = !this.sprint; - this.lastSprintPressed = System.currentTimeMillis(); - this.handledSprintPress = true; - this.sprintHeldAndReleased = false; - } - } - - // Key Released - if ((canSprint || this.isDisabled) && !settings.keyBindSprint.getIsKeyPressed() && this.handledSprintPress) { - // Was key held for longer than 300ms? If so, mark it so we can resume vanilla behavior - if ((System.currentTimeMillis() - this.lastSprintPressed) > 300L) { - this.sprintHeldAndReleased = true; - } - this.handledSprintPress = false; - } - } - - public void UpdateSprint(final boolean newValue, final boolean doubleTapped, SneakManager aSneak) { - if (!aSneak.Sprinting()) { - this.sprint = false; - this.sprintDoubleTapped = doubleTapped; - } else { - this.sprint = newValue; - this.sprintDoubleTapped = doubleTapped; - } - } -} diff --git a/src/main/java/gtPlusPlus/core/handler/events/SneakManager.java b/src/main/java/gtPlusPlus/core/handler/events/SneakManager.java deleted file mode 100644 index 258bca3bff..0000000000 --- a/src/main/java/gtPlusPlus/core/handler/events/SneakManager.java +++ /dev/null @@ -1,131 +0,0 @@ -package gtPlusPlus.core.handler.events; - -import java.util.concurrent.ConcurrentHashMap; - -import net.minecraft.entity.player.EntityPlayer; - -import gtPlusPlus.api.objects.Logger; - -public class SneakManager { - - // We make this a singleton for clientside data storage. - - public static ConcurrentHashMap<String, SneakManager> mPlayerCache = new ConcurrentHashMap<>(); - - private static void addPlayer(EntityPlayer aPlayer) { - String aKey = getKey(aPlayer); - if (!mPlayerCache.containsKey(aKey)) { - mPlayerCache.put(aKey, new SneakManager(aPlayer)); - } - } - - public static SneakManager get(EntityPlayer aPlayer) { - - String aKey = getKey(aPlayer); - if (!mPlayerCache.containsKey(aKey)) { - addPlayer(aPlayer); - } - return mPlayerCache.get(aKey); - } - - private static String getKey(EntityPlayer aPlayer) { - return aPlayer.getGameProfile() - .getId() - .toString(); - } - - public SneakManager instance; - public EntityPlayer owner; - public boolean canSprint = true; - public boolean isSneaking = true; - public boolean optionDoubleTap = true; - public boolean wasSprintDisabled = false; - public boolean mIsWearingRing = false; - - private State Sprinting = State.ON; - private State Crouching = State.OFF; - - public SneakManager(EntityPlayer aPlayer) { - owner = aPlayer; - } - - public boolean Sneaking() { - return Crouching.getState(); - } - - public boolean Sprinting() { - return Sprinting.getState(); - } - - public State getSneakingState() { - return Crouching; - } - - public State getSprintingDisabledState() { - return Sprinting; - } - - public void toggleSneaking() { - toggleState(Crouching); - } - - public void toggleSprinting() { - toggleState(Sprinting); - } - - private State toggleState(final State state) { - Logger.INFO("State Toggle"); - if (state == State.ON) { - return State.OFF; - } - return State.ON; - } - - private State setCrouchingStateON() { - return Crouching = State.ON; - } - - private State setCrouchingStateOFF() { - return Crouching = State.OFF; - } - - private State setSprintingStateON() { - return Sprinting = State.ON; - } - - private State setSprintingStateOFF() { - return Sprinting = State.OFF; - } - - public void putRingOn() { - mIsWearingRing = true; - setSprintingStateOFF(); - setCrouchingStateON(); - } - - public void takeRingOff() { - mIsWearingRing = false; - setSprintingStateON(); - setCrouchingStateOFF(); - } - - public boolean isWearingRing() { - return mIsWearingRing; - } - - public enum State { - - ON(true), - OFF(false); - - private final boolean STATE; - - State(final boolean State) { - this.STATE = State; - } - - public boolean getState() { - return this.STATE; - } - } -} diff --git a/src/main/java/gtPlusPlus/core/inventories/InventoryEggBox.java b/src/main/java/gtPlusPlus/core/inventories/InventoryEggBox.java deleted file mode 100644 index 7407115614..0000000000 --- a/src/main/java/gtPlusPlus/core/inventories/InventoryEggBox.java +++ /dev/null @@ -1,157 +0,0 @@ -package gtPlusPlus.core.inventories; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -public class InventoryEggBox implements IInventory { - - private final String name = "EggBox"; - - /** Defining your inventory size this way is handy */ - public static final int INV_SIZE = 15; - - /** Inventory's size must be same as number of slots you add to the Container class */ - private ItemStack[] inventory = new ItemStack[INV_SIZE]; - - public void readFromNBT(final NBTTagCompound nbt) { - final NBTTagList list = nbt.getTagList("Items", 10); - this.inventory = new ItemStack[INV_SIZE]; - for (int i = 0; i < list.tagCount(); i++) { - final NBTTagCompound data = list.getCompoundTagAt(i); - final int slot = data.getInteger("Slot"); - if ((slot >= 0) && (slot < INV_SIZE)) { - // Utils.LOG_INFO("Trying to read NBT data from inventory."); - this.inventory[slot] = ItemStack.loadItemStackFromNBT(data); - } - } - } - - public void writeToNBT(final NBTTagCompound nbt) { - final NBTTagList list = new NBTTagList(); - for (int i = 0; i < INV_SIZE; i++) { - final ItemStack stack = this.inventory[i]; - if (stack != null) { - // Utils.LOG_INFO("Trying to write NBT data to inventory."); - final NBTTagCompound data = new NBTTagCompound(); - stack.writeToNBT(data); - data.setInteger("Slot", i); - list.appendTag(data); - } - } - nbt.setTag("Items", list); - } - - @Override - public int getSizeInventory() { - return this.inventory.length; - } - - public ItemStack[] getInventory() { - return this.inventory; - } - - @Override - public ItemStack getStackInSlot(final int slot) { - return this.inventory[slot]; - } - - @Override - public ItemStack decrStackSize(final int slot, final int amount) { - ItemStack stack = this.getStackInSlot(slot); - if (stack != null) { - if (stack.stackSize > amount) { - stack = stack.splitStack(amount); - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } else { - // this method also calls markDirty, so we don't need to call it again - this.setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(final int slot) { - final ItemStack stack = this.getStackInSlot(slot); - this.setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack stack) { - this.inventory[slot] = stack; - - if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit())) { - stack.stackSize = this.getInventoryStackLimit(); - } - - // Don't forget this line or your inventory will not be saved! - this.markDirty(); - } - - // 1.7.2+ renamed to getInventoryName - @Override - public String getInventoryName() { - return this.name; - } - - // 1.7.2+ renamed to hasCustomInventoryName - @Override - public boolean hasCustomInventoryName() { - return !this.name.isEmpty(); - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - /** - * This is the method that will handle saving the inventory contents, as it is called (or should be called!) anytime - * the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also let you change - * things in your inventory without ever opening a Gui, if you want. - */ - // 1.7.2+ renamed to markDirty - @Override - public void markDirty() { - for (int i = 0; i < this.getSizeInventory(); ++i) { - final ItemStack temp = this.getStackInSlot(i); - if (temp != null) { - // Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); - } - - if ((temp != null) && (temp.stackSize == 0)) { - this.inventory[i] = null; - } - } - } - - @Override - public boolean isUseableByPlayer(final EntityPlayer entityplayer) { - return true; - } - - // 1.7.2+ renamed to openInventory(EntityPlayer player) - @Override - public void openInventory() {} - - // 1.7.2+ renamed to closeInventory(EntityPlayer player) - @Override - public void closeInventory() {} - - /** - * This method doesn't seem to do what it claims to do, as items can still be left-clicked and placed in the - * inventory even when this returns false - */ - @Override - public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) { - // Don't want to be able to store the inventory item within itself - // Bad things will happen, like losing your inventory - // Actually, this needs a custom Slot to work - return true; - } -} |