From 04cf5d731d1a39fe6a0152dc7695d584a54b311f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 15 Jul 2015 00:17:21 +0200 Subject: [PATCH] 0.0.7.4! (Also, changed some XP Solidifier Stuff.) --- build.gradle | 8 +- gradle/wrapper/gradle-wrapper.properties | 4 +- src/api/java/cofh/api/CoFHAPIProps.java | 11 -- .../java/cofh/api/energy/EnergyStorage.java | 158 ------------------ .../cofh/api/energy/IEnergyConnection.java | 21 --- .../cofh/api/energy/IEnergyContainerItem.java | 52 ------ .../java/cofh/api/energy/IEnergyHandler.java | 58 ------- .../java/cofh/api/energy/IEnergyProvider.java | 38 ----- .../java/cofh/api/energy/IEnergyReceiver.java | 38 ----- .../java/cofh/api/energy/IEnergyStorage.java | 46 ----- .../cofh/api/energy/ItemEnergyContainer.java | 110 ------------ .../cofh/api/energy/TileEnergyHandler.java | 65 ------- .../java/cofh/api/energy/package-info.java | 10 -- src/api/java/cofh/api/package-info.java | 9 - src/api/java/invtweaks/api/IItemTree.java | 68 -------- .../java/invtweaks/api/IItemTreeCategory.java | 46 ----- src/api/java/invtweaks/api/IItemTreeItem.java | 33 ---- .../java/invtweaks/api/IItemTreeListener.java | 29 ---- src/api/java/invtweaks/api/InvTweaksAPI.java | 84 ---------- src/api/java/invtweaks/api/SortingMethod.java | 51 ------ .../api/container/ChestContainer.java | 38 ----- .../api/container/ContainerSection.java | 88 ---------- .../container/ContainerSectionCallback.java | 16 -- .../api/container/IgnoreContainer.java | 15 -- .../api/container/InventoryContainer.java | 20 --- .../blocks/BlockXPSolidifier.java | 28 +++- .../actuallyadditions/blocks/InitBlocks.java | 6 +- .../inventory/ContainerXPSolidifier.java | 8 +- .../inventory/gui/GuiXPSolidifier.java | 5 +- .../tile/TileEntityXPSolidifier.java | 85 +++++++--- .../actuallyadditions/util/ModUtil.java | 2 +- .../assets/actuallyadditions/lang/en_US.lang | 5 + 32 files changed, 113 insertions(+), 1142 deletions(-) delete mode 100644 src/api/java/cofh/api/CoFHAPIProps.java delete mode 100644 src/api/java/cofh/api/energy/EnergyStorage.java delete mode 100644 src/api/java/cofh/api/energy/IEnergyConnection.java delete mode 100644 src/api/java/cofh/api/energy/IEnergyContainerItem.java delete mode 100644 src/api/java/cofh/api/energy/IEnergyHandler.java delete mode 100644 src/api/java/cofh/api/energy/IEnergyProvider.java delete mode 100644 src/api/java/cofh/api/energy/IEnergyReceiver.java delete mode 100644 src/api/java/cofh/api/energy/IEnergyStorage.java delete mode 100644 src/api/java/cofh/api/energy/ItemEnergyContainer.java delete mode 100644 src/api/java/cofh/api/energy/TileEnergyHandler.java delete mode 100644 src/api/java/cofh/api/energy/package-info.java delete mode 100644 src/api/java/cofh/api/package-info.java delete mode 100644 src/api/java/invtweaks/api/IItemTree.java delete mode 100644 src/api/java/invtweaks/api/IItemTreeCategory.java delete mode 100644 src/api/java/invtweaks/api/IItemTreeItem.java delete mode 100644 src/api/java/invtweaks/api/IItemTreeListener.java delete mode 100644 src/api/java/invtweaks/api/InvTweaksAPI.java delete mode 100644 src/api/java/invtweaks/api/SortingMethod.java delete mode 100644 src/api/java/invtweaks/api/container/ChestContainer.java delete mode 100644 src/api/java/invtweaks/api/container/ContainerSection.java delete mode 100644 src/api/java/invtweaks/api/container/ContainerSectionCallback.java delete mode 100644 src/api/java/invtweaks/api/container/IgnoreContainer.java delete mode 100644 src/api/java/invtweaks/api/container/InventoryContainer.java diff --git a/build.gradle b/build.gradle index a94c3ff48..03f73802e 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { apply plugin: 'forge' apply plugin: 'maven' -version = "1.7.10-0.0.7.3" +version = "1.7.10-0.0.7.4" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" @@ -40,9 +40,9 @@ repositories { dependencies { compile "mcp.mobius.waila:Waila:1.5.10_1.7.10" - compile "codechicken:CodeChickenLib:1.7.10-1.1.1.99:dev" - compile "codechicken:CodeChickenCore:1.7.10-1.0.4.29:dev" - compile "codechicken:NotEnoughItems:1.7.10-1.0.3.74:dev" + compile "codechicken:CodeChickenLib:1.7.10-1.1.3.138:dev" + compile "codechicken:CodeChickenCore:1.7.10-1.0.7.46:dev" + compile "codechicken:NotEnoughItems:1.7.10-1.0.5.110:dev" } processResources{ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 678d9d8de..2556dc8b1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jul 02 15:54:47 CDT 2014 +#Tue Jul 14 22:09:25 CEST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip diff --git a/src/api/java/cofh/api/CoFHAPIProps.java b/src/api/java/cofh/api/CoFHAPIProps.java deleted file mode 100644 index 9b528304a..000000000 --- a/src/api/java/cofh/api/CoFHAPIProps.java +++ /dev/null @@ -1,11 +0,0 @@ -package cofh.api; - -public class CoFHAPIProps { - - private CoFHAPIProps() { - - } - - public static final String VERSION = "1.7.10R1.0.2"; - -} diff --git a/src/api/java/cofh/api/energy/EnergyStorage.java b/src/api/java/cofh/api/energy/EnergyStorage.java deleted file mode 100644 index 1674c1894..000000000 --- a/src/api/java/cofh/api/energy/EnergyStorage.java +++ /dev/null @@ -1,158 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class EnergyStorage implements IEnergyStorage { - - protected int energy; - protected int capacity; - protected int maxReceive; - protected int maxExtract; - - public EnergyStorage(int capacity) { - - this(capacity, capacity, capacity); - } - - public EnergyStorage(int capacity, int maxTransfer) { - - this(capacity, maxTransfer, maxTransfer); - } - - public EnergyStorage(int capacity, int maxReceive, int maxExtract) { - - this.capacity = capacity; - this.maxReceive = maxReceive; - this.maxExtract = maxExtract; - } - - public EnergyStorage readFromNBT(NBTTagCompound nbt) { - - this.energy = nbt.getInteger("Energy"); - - if (energy > capacity) { - energy = capacity; - } - return this; - } - - public NBTTagCompound writeToNBT(NBTTagCompound nbt) { - - if (energy < 0) { - energy = 0; - } - nbt.setInteger("Energy", energy); - return nbt; - } - - public void setCapacity(int capacity) { - - this.capacity = capacity; - - if (energy > capacity) { - energy = capacity; - } - } - - public void setMaxTransfer(int maxTransfer) { - - setMaxReceive(maxTransfer); - setMaxExtract(maxTransfer); - } - - public void setMaxReceive(int maxReceive) { - - this.maxReceive = maxReceive; - } - - public void setMaxExtract(int maxExtract) { - - this.maxExtract = maxExtract; - } - - public int getMaxReceive() { - - return maxReceive; - } - - public int getMaxExtract() { - - return maxExtract; - } - - /** - * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers - * are guaranteed to have it. - * - * @param energy - */ - public void setEnergyStored(int energy) { - - this.energy = energy; - - if (this.energy > capacity) { - this.energy = capacity; - } else if (this.energy < 0) { - this.energy = 0; - } - } - - /** - * This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this - * externally, as not all IEnergyHandlers are guaranteed to have it. - * - * @param energy - */ - public void modifyEnergyStored(int energy) { - - this.energy += energy; - - if (this.energy > capacity) { - this.energy = capacity; - } else if (this.energy < 0) { - this.energy = 0; - } - } - - /* IEnergyStorage */ - @Override - public int receiveEnergy(int maxReceive, boolean simulate) { - - int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); - - if (!simulate) { - energy += energyReceived; - } - return energyReceived; - } - - @Override - public int extractEnergy(int maxExtract, boolean simulate) { - - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); - - if (!simulate) { - energy -= energyExtracted; - } - return energyExtracted; - } - - @Override - public int getEnergyStored() { - - return energy; - } - - @Override - public int getMaxEnergyStored() { - - return capacity; - } - -} diff --git a/src/api/java/cofh/api/energy/IEnergyConnection.java b/src/api/java/cofh/api/energy/IEnergyConnection.java deleted file mode 100644 index 79bdf77af..000000000 --- a/src/api/java/cofh/api/energy/IEnergyConnection.java +++ /dev/null @@ -1,21 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not - * accept it; otherwise just use IEnergyHandler. - *

- * Note that {@link IEnergyHandler} is an extension of this. - * - * @author King Lemming - * - */ -public interface IEnergyConnection { - - /** - * Returns TRUE if the TileEntity can connect on a given side. - */ - boolean canConnectEnergy(ForgeDirection from); - -} diff --git a/src/api/java/cofh/api/energy/IEnergyContainerItem.java b/src/api/java/cofh/api/energy/IEnergyContainerItem.java deleted file mode 100644 index c28455b1a..000000000 --- a/src/api/java/cofh/api/energy/IEnergyContainerItem.java +++ /dev/null @@ -1,52 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.item.ItemStack; - -/** - * Implement this interface on Item classes that support external manipulation of their internal energy storages. - *

- * A reference implementation is provided {@link ItemEnergyContainer}. - * - * @author King Lemming - * - */ -public interface IEnergyContainerItem { - - /** - * Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged. - * - * @param container - * ItemStack to be charged. - * @param maxReceive - * Maximum amount of energy to be sent into the item. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received by the item. - */ - int receiveEnergy(ItemStack container, int maxReceive, boolean simulate); - - /** - * Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally - * discharged. - * - * @param container - * ItemStack to be discharged. - * @param maxExtract - * Maximum amount of energy to be extracted from the item. - * @param simulate - * If TRUE, the discharge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted from the item. - */ - int extractEnergy(ItemStack container, int maxExtract, boolean simulate); - - /** - * Get the amount of energy currently stored in the container item. - */ - int getEnergyStored(ItemStack container); - - /** - * Get the max amount of energy that can be stored in the container item. - */ - int getMaxEnergyStored(ItemStack container); - -} diff --git a/src/api/java/cofh/api/energy/IEnergyHandler.java b/src/api/java/cofh/api/energy/IEnergyHandler.java deleted file mode 100644 index 22f2dbc62..000000000 --- a/src/api/java/cofh/api/energy/IEnergyHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects. - *

- * A reference implementation is provided {@link TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { - - // merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things) - - /** - * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. - * - * @param from - * Orientation the energy is received from. - * @param maxReceive - * Maximum amount of energy to receive. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received. - */ - @Override - int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); - - /** - * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. - * - * @param from - * Orientation the energy is extracted from. - * @param maxExtract - * Maximum amount of energy to extract. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted. - */ - @Override - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - - - /** - * Returns the amount of energy currently stored. - */ - @Override - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - @Override - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/api/java/cofh/api/energy/IEnergyProvider.java b/src/api/java/cofh/api/energy/IEnergyProvider.java deleted file mode 100644 index 05287b35e..000000000 --- a/src/api/java/cofh/api/energy/IEnergyProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects. - *

- * A reference implementation is provided {@link TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyProvider extends IEnergyConnection { - - /** - * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. - * - * @param from - * Orientation the energy is extracted from. - * @param maxExtract - * Maximum amount of energy to extract. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted. - */ - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/api/java/cofh/api/energy/IEnergyReceiver.java b/src/api/java/cofh/api/energy/IEnergyReceiver.java deleted file mode 100644 index c726e09e0..000000000 --- a/src/api/java/cofh/api/energy/IEnergyReceiver.java +++ /dev/null @@ -1,38 +0,0 @@ -package cofh.api.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects. - *

- * A reference implementation is provided {@link TileEnergyHandler}. - * - * @author King Lemming - * - */ -public interface IEnergyReceiver extends IEnergyConnection { - - /** - * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. - * - * @param from - * Orientation the energy is received from. - * @param maxReceive - * Maximum amount of energy to receive. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received. - */ - int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(ForgeDirection from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(ForgeDirection from); - -} diff --git a/src/api/java/cofh/api/energy/IEnergyStorage.java b/src/api/java/cofh/api/energy/IEnergyStorage.java deleted file mode 100644 index bc2065607..000000000 --- a/src/api/java/cofh/api/energy/IEnergyStorage.java +++ /dev/null @@ -1,46 +0,0 @@ -package cofh.api.energy; - -/** - * An energy storage is the unit of interaction with Energy inventories.
- * This is not to be implemented on TileEntities. This is for internal use only. - *

- * A reference implementation can be found at {@link EnergyStorage}. - * - * @author King Lemming - * - */ -public interface IEnergyStorage { - - /** - * Adds energy to the storage. Returns quantity of energy that was accepted. - * - * @param maxReceive - * Maximum amount of energy to be inserted. - * @param simulate - * If TRUE, the insertion will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) accepted by the storage. - */ - int receiveEnergy(int maxReceive, boolean simulate); - - /** - * Removes energy from the storage. Returns quantity of energy that was removed. - * - * @param maxExtract - * Maximum amount of energy to be extracted. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted from the storage. - */ - int extractEnergy(int maxExtract, boolean simulate); - - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(); - -} diff --git a/src/api/java/cofh/api/energy/ItemEnergyContainer.java b/src/api/java/cofh/api/energy/ItemEnergyContainer.java deleted file mode 100644 index 055ae45bc..000000000 --- a/src/api/java/cofh/api/energy/ItemEnergyContainer.java +++ /dev/null @@ -1,110 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -/** - * Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class ItemEnergyContainer extends Item implements IEnergyContainerItem { - - protected int capacity; - protected int maxReceive; - protected int maxExtract; - - public ItemEnergyContainer() { - - } - - public ItemEnergyContainer(int capacity) { - - this(capacity, capacity, capacity); - } - - public ItemEnergyContainer(int capacity, int maxTransfer) { - - this(capacity, maxTransfer, maxTransfer); - } - - public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) { - - this.capacity = capacity; - this.maxReceive = maxReceive; - this.maxExtract = maxExtract; - } - - public ItemEnergyContainer setCapacity(int capacity) { - - this.capacity = capacity; - return this; - } - - public void setMaxTransfer(int maxTransfer) { - - setMaxReceive(maxTransfer); - setMaxExtract(maxTransfer); - } - - public void setMaxReceive(int maxReceive) { - - this.maxReceive = maxReceive; - } - - public void setMaxExtract(int maxExtract) { - - this.maxExtract = maxExtract; - } - - /* IEnergyContainerItem */ - @Override - public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { - - if (container.stackTagCompound == null) { - container.stackTagCompound = new NBTTagCompound(); - } - int energy = container.stackTagCompound.getInteger("Energy"); - int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); - - if (!simulate) { - energy += energyReceived; - container.stackTagCompound.setInteger("Energy", energy); - } - return energyReceived; - } - - @Override - public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - return 0; - } - int energy = container.stackTagCompound.getInteger("Energy"); - int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); - - if (!simulate) { - energy -= energyExtracted; - container.stackTagCompound.setInteger("Energy", energy); - } - return energyExtracted; - } - - @Override - public int getEnergyStored(ItemStack container) { - - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { - return 0; - } - return container.stackTagCompound.getInteger("Energy"); - } - - @Override - public int getMaxEnergyStored(ItemStack container) { - - return capacity; - } - -} diff --git a/src/api/java/cofh/api/energy/TileEnergyHandler.java b/src/api/java/cofh/api/energy/TileEnergyHandler.java deleted file mode 100644 index 7cc655e92..000000000 --- a/src/api/java/cofh/api/energy/TileEnergyHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -package cofh.api.energy; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own. - * - * @author King Lemming - * - */ -public class TileEnergyHandler extends TileEntity implements IEnergyHandler { - - protected EnergyStorage storage = new EnergyStorage(32000); - - @Override - public void readFromNBT(NBTTagCompound nbt) { - - super.readFromNBT(nbt); - storage.readFromNBT(nbt); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) { - - super.writeToNBT(nbt); - storage.writeToNBT(nbt); - } - - /* IEnergyConnection */ - @Override - public boolean canConnectEnergy(ForgeDirection from) { - - return true; - } - - /* IEnergyReceiver */ - @Override - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { - - return storage.receiveEnergy(maxReceive, simulate); - } - - /* IEnergyProvider */ - @Override - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { - - return storage.extractEnergy(maxExtract, simulate); - } - - /* IEnergyReceiver and IEnergyProvider */ - @Override - public int getEnergyStored(ForgeDirection from) { - - return storage.getEnergyStored(); - } - - @Override - public int getMaxEnergyStored(ForgeDirection from) { - - return storage.getMaxEnergyStored(); - } - -} diff --git a/src/api/java/cofh/api/energy/package-info.java b/src/api/java/cofh/api/energy/package-info.java deleted file mode 100644 index 7379702b8..000000000 --- a/src/api/java/cofh/api/energy/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub - * http://www.teamcofh.com - */ -@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy") -package cofh.api.energy; - -import cofh.api.CoFHAPIProps; -import cpw.mods.fml.common.API; - diff --git a/src/api/java/cofh/api/package-info.java b/src/api/java/cofh/api/package-info.java deleted file mode 100644 index 08ff5fcb6..000000000 --- a/src/api/java/cofh/api/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub - * http://www.teamcofh.com - */ -@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI") -package cofh.api; - -import cpw.mods.fml.common.API; - diff --git a/src/api/java/invtweaks/api/IItemTree.java b/src/api/java/invtweaks/api/IItemTree.java deleted file mode 100644 index 143ba14a0..000000000 --- a/src/api/java/invtweaks/api/IItemTree.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.Collection; -import java.util.List; -import java.util.Random; - -public interface IItemTree { - void registerOre(String category, String name, String oreName, int order); - - boolean matches(List items, String keyword); - - boolean isKeywordValid(String keyword); - - Collection getAllCategories(); - - IItemTreeCategory getRootCategory(); - - void setRootCategory(IItemTreeCategory category); - - IItemTreeCategory getCategory(String keyword); - - boolean isItemUnknown(String id, int damage); - - List getItems(String id, int damage); - - List getItems(String name); - - IItemTreeItem getRandomItem(Random r); - - boolean containsItem(String name); - - boolean containsCategory(String name); - - IItemTreeCategory addCategory(String parentCategory, String newCategory) throws NullPointerException; - - void addCategory(String parentCategory, IItemTreeCategory newCategory) throws NullPointerException; - - IItemTreeItem addItem(String parentCategory, String name, String id, int damage, int order) - throws NullPointerException; - - void addItem(String parentCategory, IItemTreeItem newItem) throws NullPointerException; - - int getKeywordDepth(String keyword); - - int getKeywordOrder(String keyword); -} diff --git a/src/api/java/invtweaks/api/IItemTreeCategory.java b/src/api/java/invtweaks/api/IItemTreeCategory.java deleted file mode 100644 index f1b5e9554..000000000 --- a/src/api/java/invtweaks/api/IItemTreeCategory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.Collection; -import java.util.List; - -public interface IItemTreeCategory { - boolean contains(IItemTreeItem item); - - void addCategory(IItemTreeCategory category); - - void addItem(IItemTreeItem item); - - Collection getSubCategories(); - - Collection> getItems(); - - String getName(); - - int getCategoryOrder(); - - int findCategoryOrder(String keyword); - - int findKeywordDepth(String keyword); -} diff --git a/src/api/java/invtweaks/api/IItemTreeItem.java b/src/api/java/invtweaks/api/IItemTreeItem.java deleted file mode 100644 index 2b6ae2db5..000000000 --- a/src/api/java/invtweaks/api/IItemTreeItem.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -public interface IItemTreeItem extends Comparable { - String getName(); - - String getId(); - - int getDamage(); - - int getOrder(); -} diff --git a/src/api/java/invtweaks/api/IItemTreeListener.java b/src/api/java/invtweaks/api/IItemTreeListener.java deleted file mode 100644 index 73a5815d5..000000000 --- a/src/api/java/invtweaks/api/IItemTreeListener.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import java.util.EventListener; - -public interface IItemTreeListener extends EventListener { - void onTreeLoaded(IItemTree tree); -} diff --git a/src/api/java/invtweaks/api/InvTweaksAPI.java b/src/api/java/invtweaks/api/InvTweaksAPI.java deleted file mode 100644 index 6bdb84a93..000000000 --- a/src/api/java/invtweaks/api/InvTweaksAPI.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -import invtweaks.api.container.ContainerSection; -import net.minecraft.item.ItemStack; - -/** - * Interface to access functions exposed by Inventory Tweaks - *

- * The main @Mod instance of the mod implements this interface, so a refernce to it can - * be obtained via @Instance("inventorytweaks") or methods in net.minecraftforge.fml.common.Loader - *

- * All of these functions currently have no effect if called on a dedicated server. - */ -public interface InvTweaksAPI { - /** - * Add a listener for ItemTree load events - * - * @param listener - */ - void addOnLoadListener(IItemTreeListener listener); - - /** - * Remove a listener for ItemTree load events - * - * @param listener - * @return true if the listener was previously added - */ - boolean removeOnLoadListener(IItemTreeListener listener); - - /** - * Toggle sorting shortcut state. - * - * @param enabled - */ - void setSortKeyEnabled(boolean enabled); - - /** - * Toggle sorting shortcut supression. - * Unlike setSortKeyEnabled, this flag is automatically cleared when GUIs are closed. - * - * @param enabled - */ - void setTextboxMode(boolean enabled); - - /** - * Compare two items using the default (non-rule based) algorithm, - * sutable for an implementation of Comparator<ItemStack>. - * - * @param i - * @param j - * @return A value with a sign representing the relative order of the item stacks - */ - int compareItems(ItemStack i, ItemStack j); - - /** - * Initiate a sort as if the player had clicked on a sorting button or pressed the sort key. - * - * @param section - * @param method - */ - void sort(ContainerSection section, SortingMethod method); -} diff --git a/src/api/java/invtweaks/api/SortingMethod.java b/src/api/java/invtweaks/api/SortingMethod.java deleted file mode 100644 index b824143ef..000000000 --- a/src/api/java/invtweaks/api/SortingMethod.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api; - -public enum SortingMethod { - /** - * Standard 'r' sorting for generic inventories - */ - DEFAULT, - /** - * Sort method creating vertical columns of items. - * Used for chests only, requires container to have a valid row size for correct results. - */ - VERTICAL, - /** - * Sort method creating horizontal rows of items. - * Used for chests only, requires container to have a valid row size for correct results. - */ - HORIZONTAL, - /** - * Sort method for player inventory. - * Applies to extra player-specified sorting rules for the main inventory. - * Will always operate on main inventory. - */ - INVENTORY, - /** - * Attempts to even the number of items in each stack of the same type of item, without moving full stacks. - * Used in crafting grid sorting. - */ - EVEN_STACKS, -} diff --git a/src/api/java/invtweaks/api/container/ChestContainer.java b/src/api/java/invtweaks/api/container/ChestContainer.java deleted file mode 100644 index a85c412a1..000000000 --- a/src/api/java/invtweaks/api/container/ChestContainer.java +++ /dev/null @@ -1,38 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for containers that have a chest-like persistant storage component. Enables the Inventroy Tweaks sorting - * buttons for this container. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface ChestContainer { - // Set to true if the Inventory Tweaks sorting buttons should be shown for this container. - boolean showButtons() default true; - - // Size of a chest row - int rowSize() default 9; - - // Uses 'large chest' mode for sorting buttons - // (Renders buttons vertically down the right side of the GUI) - boolean isLargeChest() default false; - - // Annotation for method to get size of a chest row if it is not a fixed size for this container class - // Signature int func() - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - @interface RowSizeCallback { - } - - // Annotation for method to get size of a chest row if it is not a fixed size for this container class - // Signature int func() - @Retention(RetentionPolicy.RUNTIME) - @Target(ElementType.METHOD) - @interface IsLargeCallback { - } -} diff --git a/src/api/java/invtweaks/api/container/ContainerSection.java b/src/api/java/invtweaks/api/container/ContainerSection.java deleted file mode 100644 index 83c2e08a4..000000000 --- a/src/api/java/invtweaks/api/container/ContainerSection.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2013 Andrew Crocker - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -package invtweaks.api.container; - -/** - * Names for specific parts of containers. For unknown container types (such as mod containers), only INVENTORY and - * CHEST sections are available. - */ -public enum ContainerSection { - /** - * The player's inventory - */ - INVENTORY, - /** - * The player's inventory (only the hotbar) - */ - INVENTORY_HOTBAR, - /** - * The player's inventory (all except the hotbar) - */ - INVENTORY_NOT_HOTBAR, - /** - * The chest or dispenser contents. Also used for unknown container contents. - */ - CHEST, - /** - * The crafting input - */ - CRAFTING_IN, - /** - * The crafting input, for containters that store it internally - */ - CRAFTING_IN_PERSISTENT, - /** - * The crafting output - */ - CRAFTING_OUT, - /** - * The armor slots - */ - ARMOR, - /** - * The furnace input - */ - FURNACE_IN, - /** - * The furnace output - */ - FURNACE_OUT, - /** - * The furnace fuel - */ - FURNACE_FUEL, - /** - * The enchantment table slot - */ - ENCHANTMENT, - /** - * The three bottles slots in brewing tables - * NOTE: Do not use without also using BREWING_INGREDIENT. - */ - BREWING_BOTTLES, - /** - * The top slot in brewing tables - * NOTE: Do not use without also using BREWING_BOTTLES. - */ - BREWING_INGREDIENT -} diff --git a/src/api/java/invtweaks/api/container/ContainerSectionCallback.java b/src/api/java/invtweaks/api/container/ContainerSectionCallback.java deleted file mode 100644 index 379206b37..000000000 --- a/src/api/java/invtweaks/api/container/ContainerSectionCallback.java +++ /dev/null @@ -1,16 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for a method to call which returns the set of ContainerSections for this container. - *

- * Signature of the method should be Map> func() - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface ContainerSectionCallback { -} diff --git a/src/api/java/invtweaks/api/container/IgnoreContainer.java b/src/api/java/invtweaks/api/container/IgnoreContainer.java deleted file mode 100644 index 86e8aea12..000000000 --- a/src/api/java/invtweaks/api/container/IgnoreContainer.java +++ /dev/null @@ -1,15 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Use this annotation to override inherited annotation properties and mark a Container as unsortable. - * This effect is inherited as well. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface IgnoreContainer { -} diff --git a/src/api/java/invtweaks/api/container/InventoryContainer.java b/src/api/java/invtweaks/api/container/InventoryContainer.java deleted file mode 100644 index d5a45b912..000000000 --- a/src/api/java/invtweaks/api/container/InventoryContainer.java +++ /dev/null @@ -1,20 +0,0 @@ -package invtweaks.api.container; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A marker for containers that need special treatment, such as crafting inputs or alternate player inventory positions, - * but do not have a chest-like component. - *

- * Does not enable the Inventory Tweaks sorting buttons for this container. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface InventoryContainer { - // Set to true if the Inventory Tweaks options button should be shown for this container. - // (For instance, if you are replacing a vanilla container such as the player's inventory) - boolean showOptions() default true; -} diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java index 18e851cd2..8235e6c7d 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockXPSolidifier.java @@ -4,6 +4,8 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.inventory.GuiHandler; +import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.tile.TileEntityXPSolidifier; import ellpeck.actuallyadditions.util.BlockUtil; import ellpeck.actuallyadditions.util.INameableItem; @@ -12,6 +14,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemBlock; @@ -97,9 +100,32 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt @Override public void breakBlock(World world, int x, int y, int z, Block block, int par6){ this.dropInventory(world, x, y, z); + TileEntity tile = world.getTileEntity(x, y, z); + if(tile instanceof TileEntityXPSolidifier){ + TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)tile; + int stacks = solidifier.amount/64; + int rest = solidifier.amount % 64; + for(int i = 0; i < stacks; i++){ + this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSpecialDrop, 64, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal())); + } + this.spawnItem(world, x, y, z, new ItemStack(InitItems.itemSpecialDrop, rest, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal())); + solidifier.amount = 0; + } + super.breakBlock(world, x, y, z, block, par6); } + private void spawnItem(World world, int x, int y, int z, ItemStack stack){ + float dX = world.rand.nextFloat()*0.8F+0.1F; + float dY = world.rand.nextFloat()*0.8F+0.1F; + float dZ = world.rand.nextFloat()*0.8F+0.1F; + EntityItem entityItem = new EntityItem(world, x+dX, y+dY, z+dZ, stack); + float factor = 0.05F; + entityItem.motionX = world.rand.nextGaussian()*factor; + entityItem.motionY = world.rand.nextGaussian()*factor+0.2F; + entityItem.motionZ = world.rand.nextGaussian()*factor; + world.spawnEntityInWorld(entityItem); + } @Override public String getName(){ return "blockXPSolidifier"; @@ -130,7 +156,7 @@ public class BlockXPSolidifier extends BlockContainerBase implements INameableIt @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { - BlockUtil.addInformation(theBlock, list, 1, ""); + BlockUtil.addInformation(theBlock, list, 2, ""); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java index 241169fb6..a4fdac8cc 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/InitBlocks.java @@ -80,13 +80,13 @@ public class InitBlocks{ public static Block blockTreasureChest; - public static Block blockXPSolidifier; + //public static Block blockXPSolidifier; public static void init(){ ModUtil.LOGGER.info("Initializing Blocks..."); - blockXPSolidifier = new BlockXPSolidifier(); - BlockUtil.register(blockXPSolidifier, BlockXPSolidifier.TheItemBlock.class); + //blockXPSolidifier = new BlockXPSolidifier(); + //BlockUtil.register(blockXPSolidifier, BlockXPSolidifier.TheItemBlock.class); blockTestifiBucksGreenWall = new BlockGeneric("blockTestifiBucksGreenWall"); BlockUtil.register(blockTestifiBucksGreenWall, BlockGeneric.TheItemBlock.class); diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java index b4f43cb54..04f0bd240 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/ContainerXPSolidifier.java @@ -18,11 +18,7 @@ public class ContainerXPSolidifier extends Container{ public ContainerXPSolidifier(InventoryPlayer inventory, TileEntityBase tile){ this.solidifier = (TileEntityXPSolidifier)tile; - for(int i = 0; i < 2; i++){ - for(int j = 0; j < 3; j++){ - this.addSlotToContainer(new SlotOutput(solidifier, j+i*3, 62+j*18, 8+i*18)); - } - } + this.addSlotToContainer(new SlotOutput(solidifier, 0, 80, 8)); for(int i = 0; i < 3; i++){ for(int j = 0; j < 9; j++){ @@ -41,7 +37,7 @@ public class ContainerXPSolidifier extends Container{ @Override public ItemStack transferStackInSlot(EntityPlayer player, int slot){ - final int inventoryStart = 6; + final int inventoryStart = 1; final int inventoryEnd = inventoryStart+26; final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; diff --git a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java index ac6a27a58..bdc921ac1 100644 --- a/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/inventory/gui/GuiXPSolidifier.java @@ -8,6 +8,7 @@ import ellpeck.actuallyadditions.network.gui.PacketGuiButton; import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityXPSolidifier; import ellpeck.actuallyadditions.util.AssetUtil; +import ellpeck.actuallyadditions.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.inventory.GuiContainer; @@ -52,7 +53,7 @@ public class GuiXPSolidifier extends GuiContainer{ GuiButton buttonForty = new GuiInputter.SmallerButton(5, guiLeft+99, guiTop+61, "40"); GuiButton buttonFifty = new GuiInputter.SmallerButton(6, guiLeft+62, guiTop+78, "50"); GuiButton buttonSixtyFour = new GuiInputter.SmallerButton(7, guiLeft+80, guiTop+78, "64"); - GuiButton buttonThousandTwentyEight = new GuiInputter.SmallerButton(8, guiLeft+99, guiTop+78, "128"); + GuiButton buttonThousandTwentyEight = new GuiInputter.SmallerButton(8, guiLeft+99, guiTop+78, "All"); this.buttonList.add(buttonOne); this.buttonList.add(buttonFive); @@ -84,6 +85,8 @@ public class GuiXPSolidifier extends GuiContainer{ this.mc.getTextureManager().bindTexture(resLoc); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); + + this.drawCenteredString(this.fontRendererObj, Integer.toString(this.solidifier.amount), guiLeft+88, guiTop+30, StringUtil.DECIMAL_COLOR_WHITE); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java index ee7f0bd4b..c4a2f8eab 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java @@ -5,18 +5,55 @@ import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.ItemSpecialDrop; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.network.gui.IButtonReactor; +import ellpeck.actuallyadditions.network.sync.IPacketSyncerToClient; +import ellpeck.actuallyadditions.network.sync.PacketSyncerToClient; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; -public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor{ +public class TileEntityXPSolidifier extends TileEntityInventoryBase implements IButtonReactor, IPacketSyncerToClient{ + + public short amount; + private short lastAmount; public TileEntityXPSolidifier(){ - super(6, "xpSolidifier"); + super(1, "xpSolidifier"); } @Override - public boolean canUpdate(){ - return false; + public void updateEntity(){ + if(!worldObj.isRemote){ + if(this.amount > 0){ + if(this.slots[0] == null){ + int toSet = this.amount > 64 ? 64 : this.amount; + this.slots[0] = new ItemStack(InitItems.itemSpecialDrop, toSet, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()); + this.amount -= toSet; + } + else if(this.slots[0].stackSize < 64){ + int needed = 64-this.slots[0].stackSize; + int toAdd = this.amount > needed ? needed : this.amount; + this.slots[0].stackSize += toAdd; + this.amount -= toAdd; + } + } + + if(this.lastAmount != this.amount){ + this.lastAmount = this.amount; + this.sendUpdate(); + } + } + } + + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setShort("Amount", this.amount); + } + + @Override + public void readFromNBT(NBTTagCompound compound){ + super.readFromNBT(compound); + this.amount = compound.getShort("Amount"); } @Override @@ -34,27 +71,20 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I return true; } - private int getFirstAvailSlot(ItemStack stack){ - for(int i = 0; i < this.slots.length; i++){ - if(this.slots[i] == null || (this.slots[i].isItemEqual(stack) && this.slots[i].stackSize+stack.stackSize <= this.slots[i].getMaxStackSize())) return i; - } - return -1; - } - - private int[] buttonAmounts = new int[]{1, 5, 10, 20, 30, 40, 50, 64, 128}; + private int[] buttonAmounts = new int[]{1, 5, 10, 20, 30, 40, 50, 64, -999}; @Override public void onButtonPressed(int buttonID, EntityPlayer player){ - if(buttonID < buttonAmounts.length){ - for(int i = 0; i < buttonAmounts[buttonID]; i++){ - int slot = this.getFirstAvailSlot(new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal())); - if(slot >= 0 && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT){ - this.addPlayerXP(player, -ItemSpecialDrop.SOLID_XP_AMOUNT); - - if(this.slots[slot] == null) this.slots[slot] = new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()); - else this.slots[slot].stackSize++; + if(buttonID < this.buttonAmounts.length){ + if(buttonAmounts[buttonID] != -999){ + if(this.amount < Short.MAX_VALUE-this.buttonAmounts[buttonID] && this.getPlayerXP(player) >= ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID]){ + this.addPlayerXP(player, -(ItemSpecialDrop.SOLID_XP_AMOUNT*this.buttonAmounts[buttonID])); + this.amount += this.buttonAmounts[buttonID]; } } + else{ + + } } } @@ -84,4 +114,19 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } return 0; } + + @Override + public int[] getValues(){ + return new int[]{this.amount}; + } + + @Override + public void setValues(int[] values){ + this.amount = (short)values[0]; + } + + @Override + public void sendUpdate(){ + PacketSyncerToClient.sendPacket(this); + } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index b668ddbe1..4b161d58e 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java @@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger; public class ModUtil{ - public static final String VERSION = "1.7.10-0.0.7.3"; + public static final String VERSION = "1.7.10-0.0.7.4"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index f64653dd5..d9d74a6cb 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -384,6 +384,10 @@ tooltip.actuallyadditions.noEffects.desc=No Effects tooltip.actuallyadditions.oredictName.desc=OreDictionary Entries tooltip.actuallyadditions.noOredictNameAvail.desc=Has No OreDictionary Entries +tile.actuallyadditions.blockXPSolidifier.name=Experience Solidifier +tooltip.actuallyadditions.blockXPSolidifier.desc.1=Turns a Player's Experience into Solidified Experience! +tooltip.actuallyadditions.blockXPSolidifier.desc.2=Has a big internal Buffer! + tooltip.actuallyadditions.itemJam.desc.1=A delicious Jam consisting of tooltip.actuallyadditions.itemJam.desc.2=Also gives you some Effects! tooltip.actuallyadditions.itemJam.desc.3=Can be found in Villages and Treasure Chests! @@ -579,6 +583,7 @@ container.actuallyadditions.coffeeMachine.name=Coffee Machine container.actuallyadditions.drill.name=Drill container.actuallyadditions.energizer.name=Energizer container.actuallyadditions.enervator.name=Enervator +container.actuallyadditions.xpSolidifier.name=Experience Solidifier container.nei.actuallyadditions.crushing.name=Crusher container.nei.actuallyadditions.ballOfHair.name=Ball Of Hair Usage