mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
0.0.7.4!
(Also, changed some XP Solidifier Stuff.)
This commit is contained in:
parent
51c25af85c
commit
04cf5d731d
32 changed files with 113 additions and 1142 deletions
|
@ -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{
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
package cofh.api;
|
||||
|
||||
public class CoFHAPIProps {
|
||||
|
||||
private CoFHAPIProps() {
|
||||
|
||||
}
|
||||
|
||||
public static final String VERSION = "1.7.10R1.0.2";
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.
|
||||
* <p>
|
||||
* 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);
|
||||
|
||||
}
|
|
@ -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.
|
||||
* <p>
|
||||
* 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);
|
||||
|
||||
}
|
|
@ -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.
|
||||
* <p>
|
||||
* 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);
|
||||
|
||||
}
|
|
@ -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.
|
||||
* <p>
|
||||
* 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);
|
||||
|
||||
}
|
|
@ -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.
|
||||
* <p>
|
||||
* 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);
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package cofh.api.energy;
|
||||
|
||||
/**
|
||||
* An energy storage is the unit of interaction with Energy inventories.<br>
|
||||
* This is not to be implemented on TileEntities. This is for internal use only.
|
||||
* <p>
|
||||
* 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();
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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<IItemTreeItem> items, String keyword);
|
||||
|
||||
boolean isKeywordValid(String keyword);
|
||||
|
||||
Collection<IItemTreeCategory> getAllCategories();
|
||||
|
||||
IItemTreeCategory getRootCategory();
|
||||
|
||||
void setRootCategory(IItemTreeCategory category);
|
||||
|
||||
IItemTreeCategory getCategory(String keyword);
|
||||
|
||||
boolean isItemUnknown(String id, int damage);
|
||||
|
||||
List<IItemTreeItem> getItems(String id, int damage);
|
||||
|
||||
List<IItemTreeItem> 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);
|
||||
}
|
|
@ -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<IItemTreeCategory> getSubCategories();
|
||||
|
||||
Collection<List<IItemTreeItem>> getItems();
|
||||
|
||||
String getName();
|
||||
|
||||
int getCategoryOrder();
|
||||
|
||||
int findCategoryOrder(String keyword);
|
||||
|
||||
int findKeywordDepth(String keyword);
|
||||
}
|
|
@ -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<IItemTreeItem> {
|
||||
String getName();
|
||||
|
||||
String getId();
|
||||
|
||||
int getDamage();
|
||||
|
||||
int getOrder();
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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
|
||||
* <p/>
|
||||
* 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
|
||||
* <p/>
|
||||
* 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);
|
||||
}
|
|
@ -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,
|
||||
}
|
|
@ -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 {
|
||||
}
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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.
|
||||
* <p/>
|
||||
* Signature of the method should be Map<ContainerSection, List<Slot>> func()
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface ContainerSectionCallback {
|
||||
}
|
|
@ -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 {
|
||||
}
|
|
@ -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.
|
||||
* <p/>
|
||||
* 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;
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue