mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Added tons of stuff!
This commit is contained in:
parent
263c0eea1e
commit
5863b0a0a4
155 changed files with 4573 additions and 628 deletions
|
@ -18,7 +18,7 @@ buildscript {
|
|||
apply plugin: 'forge'
|
||||
apply plugin: 'maven'
|
||||
|
||||
version = "1.7.10-0.0.4.4"
|
||||
version = "1.7.10-0.0.5.0"
|
||||
group = "ellpeck.actuallyadditions"
|
||||
archivesBaseName = "ActuallyAdditions"
|
||||
|
||||
|
|
11
src/main/java/cofh/api/CoFHAPIProps.java
Normal file
11
src/main/java/cofh/api/CoFHAPIProps.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package cofh.api;
|
||||
|
||||
public class CoFHAPIProps {
|
||||
|
||||
private CoFHAPIProps() {
|
||||
|
||||
}
|
||||
|
||||
public static final String VERSION = "1.7.10R1.0.2";
|
||||
|
||||
}
|
158
src/main/java/cofh/api/energy/EnergyStorage.java
Normal file
158
src/main/java/cofh/api/energy/EnergyStorage.java
Normal file
|
@ -0,0 +1,158 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
21
src/main/java/cofh/api/energy/IEnergyConnection.java
Normal file
21
src/main/java/cofh/api/energy/IEnergyConnection.java
Normal file
|
@ -0,0 +1,21 @@
|
|||
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);
|
||||
|
||||
}
|
52
src/main/java/cofh/api/energy/IEnergyContainerItem.java
Normal file
52
src/main/java/cofh/api/energy/IEnergyContainerItem.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
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);
|
||||
|
||||
}
|
58
src/main/java/cofh/api/energy/IEnergyHandler.java
Normal file
58
src/main/java/cofh/api/energy/IEnergyHandler.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
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);
|
||||
|
||||
}
|
38
src/main/java/cofh/api/energy/IEnergyProvider.java
Normal file
38
src/main/java/cofh/api/energy/IEnergyProvider.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
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);
|
||||
|
||||
}
|
38
src/main/java/cofh/api/energy/IEnergyReceiver.java
Normal file
38
src/main/java/cofh/api/energy/IEnergyReceiver.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
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);
|
||||
|
||||
}
|
46
src/main/java/cofh/api/energy/IEnergyStorage.java
Normal file
46
src/main/java/cofh/api/energy/IEnergyStorage.java
Normal file
|
@ -0,0 +1,46 @@
|
|||
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();
|
||||
|
||||
}
|
110
src/main/java/cofh/api/energy/ItemEnergyContainer.java
Normal file
110
src/main/java/cofh/api/energy/ItemEnergyContainer.java
Normal file
|
@ -0,0 +1,110 @@
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
65
src/main/java/cofh/api/energy/TileEnergyHandler.java
Normal file
65
src/main/java/cofh/api/energy/TileEnergyHandler.java
Normal file
|
@ -0,0 +1,65 @@
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
10
src/main/java/cofh/api/energy/package-info.java
Normal file
10
src/main/java/cofh/api/energy/package-info.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
/**
|
||||
* (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;
|
||||
|
9
src/main/java/cofh/api/package-info.java
Normal file
9
src/main/java/cofh/api/package-info.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* (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;
|
||||
|
|
@ -21,6 +21,7 @@ import ellpeck.actuallyadditions.items.InitItems;
|
|||
import ellpeck.actuallyadditions.material.InitItemMaterials;
|
||||
import ellpeck.actuallyadditions.network.PacketHandler;
|
||||
import ellpeck.actuallyadditions.proxy.IProxy;
|
||||
import ellpeck.actuallyadditions.recipe.FuelHandler;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.Util;
|
||||
|
@ -44,6 +45,7 @@ public class ActuallyAdditions{
|
|||
InitBlocks.init();
|
||||
InitItems.init();
|
||||
InitVillager.init();
|
||||
FuelHandler.init();
|
||||
proxy.preInit();
|
||||
|
||||
Util.logInfo("PreInitialization Finished.");
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
-Doesn't use Levels
|
||||
-Needs Quartz and Diamond Blocks instead of Bookcases around
|
||||
|
||||
-Chestie
|
||||
-Follows you around
|
||||
-Has an Inventory, a Crafting Table and a Furnace
|
||||
|
||||
-Instant Teleport Device
|
||||
-Teleports Players to where they look (Much like the Bukkit Compass)
|
||||
|
||||
|
@ -17,10 +21,6 @@
|
|||
-Destroys excess Items (also determined by a Filter)
|
||||
-Gets emptied into Chest on Right-Click
|
||||
|
||||
-Rice
|
||||
-Gets planted in the Water
|
||||
-Used to make Rice Flour and Rice Bread
|
||||
|
||||
-Auto-Crafting Item
|
||||
-Has a Recipe saved
|
||||
-Crafts Recipe on Shift-Right-Click if all Items are in Inventory
|
||||
|
@ -57,7 +57,30 @@
|
|||
-File Jukebox
|
||||
-Plays Sound Files put into your Minecraft Folder
|
||||
|
||||
-RF Implementation
|
||||
-Power Acceptor Block that powers Machines
|
||||
-Machines still don't accept RF themselves!
|
||||
-Solar Panel & Heat Collector produce RF
|
||||
-Oil Plant
|
||||
-Used to make Oil (For use with other mods' machines)
|
||||
|
||||
-Pharmacy Plants
|
||||
-Give you different effects
|
||||
|
||||
-Multi-Block Ore Factory
|
||||
-Fluids and things higher Multiplying Chance (x2, x3..)
|
||||
-Speed Upgrades etc.
|
||||
|
||||
-Advanced Redstone Transmitter
|
||||
-You can mark an area
|
||||
-On Activation, all blocks in the area get a Signal
|
||||
|
||||
-Lava Factory
|
||||
-2x3 Multi Block
|
||||
-Requires Energy
|
||||
-Produces Lava from Cobblestone
|
||||
-Has Upgrade Slots
|
||||
|
||||
-Phantom Chest
|
||||
-Is bound to Inventory on Right-Click
|
||||
-Allows you to open the bound Inventory when placed down
|
||||
-Only accessible with Pipes etc.
|
||||
-ISided like the bound Block
|
||||
-Range of 10, Range Upgrade adds 15 Range
|
||||
-Nether Star allows direct GUI Access and adds 50 Range
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityCanolaPress;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCanolaPress extends BlockContainerBase implements INameableItem{
|
||||
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockCanolaPress(){
|
||||
super(Material.rock);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setHardness(1.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityCanolaPress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side == 1 || side == 0 ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(x, y, z);
|
||||
if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.CANOLA_PRESS_ID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "blockCanolaPress";
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
super(block);
|
||||
this.theBlock = block;
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
BlockUtil.addPowerUsageInfo(list, TileEntityCanolaPress.energyUsedPerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityCoalGenerator;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCoalGenerator extends BlockContainerBase implements INameableItem{
|
||||
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockCoalGenerator(){
|
||||
super(Material.rock);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setHardness(1.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityCoalGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(x, y, z);
|
||||
if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.COAL_GENERATOR_ID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "blockCoalGenerator";
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
super(block);
|
||||
this.theBlock = block;
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
BlockUtil.addPowerProductionInfo(list, TileEntityCoalGenerator.energyProducedPerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,8 @@ public class BlockCompost extends BlockContainerBase implements INameableItem{
|
|||
this.setHarvestLevel("axe", 0);
|
||||
this.setHardness(1.0F);
|
||||
this.setStepSound(soundTypeWood);
|
||||
|
||||
this.setBlockBoundsForItemRender();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -46,6 +48,7 @@ public class BlockCompost extends BlockContainerBase implements INameableItem{
|
|||
else tile.slots[0].stackSize++;
|
||||
if(!player.capabilities.isCreativeMode) player.inventory.getCurrentItem().stackSize--;
|
||||
}
|
||||
|
||||
//Add Fertilizer to player's inventory
|
||||
else if(tile.slots[0] != null && (stackPlayer == null || (stackPlayer.getItem() instanceof ItemFertilizer && stackPlayer.stackSize <= stackPlayer.getMaxStackSize() - tile.slots[0].stackSize)) && tile.slots[0].getItem() instanceof ItemFertilizer){
|
||||
if(stackPlayer == null) player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy());
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -19,9 +21,11 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCoffeeMachine extends BlockContainerBase implements INameableItem{
|
||||
public class BlockFermentingBarrel extends BlockContainerBase implements INameableItem{
|
||||
|
||||
public BlockCoffeeMachine(){
|
||||
private IIcon iconTop;
|
||||
|
||||
public BlockFermentingBarrel(){
|
||||
super(Material.wood);
|
||||
this.setHarvestLevel("axe", 0);
|
||||
this.setHardness(1.0F);
|
||||
|
@ -29,44 +33,25 @@ public class BlockCoffeeMachine extends BlockContainerBase implements INameableI
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
|
||||
if(!world.isRemote){
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityFermentingBarrel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(x, y, z);
|
||||
if (press != null) player.openGui(ActuallyAdditions.instance, GuiHandler.FERMENTING_BARREL_ID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = Blocks.hopper.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return RenderingRegistry.getNextAvailableRenderId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
|
@ -74,13 +59,20 @@ public class BlockCoffeeMachine extends BlockContainerBase implements INameableI
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "blockCoffeeMachine";
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return side <= 1 ? this.iconTop : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
this.iconTop = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "blockFermentingBarrel";
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
@ -112,8 +104,8 @@ public class BlockCoffeeMachine extends BlockContainerBase implements INameableI
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
public int getMetadata(int meta){
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockFluidFlowing extends BlockFluidClassic implements INameableItem{
|
||||
|
||||
private String name;
|
||||
|
||||
public IIcon stillIcon;
|
||||
public IIcon flowingIcon;
|
||||
|
||||
public BlockFluidFlowing(Fluid fluid, Material material, String unlocalizedName){
|
||||
super(fluid, material);
|
||||
this.name = unlocalizedName;
|
||||
this.setRenderPass(1);
|
||||
displacements.put(this, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDisplace(IBlockAccess world, int x, int y, int z){
|
||||
return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.canDisplace(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displaceIfPossible(World world, int x, int y, int z){
|
||||
return !world.getBlock(x, y, z).getMaterial().isLiquid() && super.displaceIfPossible(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? this.stillIcon : this.flowingIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.stillIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Still");
|
||||
this.flowingIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Flowing");
|
||||
this.definedFluid.setIcons(this.stillIcon, this.flowingIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
super(block);
|
||||
this.theBlock = block;
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -171,6 +171,7 @@ public class BlockFurnaceDouble extends BlockContainerBase implements INameableI
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
BlockUtil.addPowerUsageInfo(list, TileEntityFurnaceDouble.energyUsePerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -97,6 +97,7 @@ public class BlockFurnaceSolar extends BlockContainerBase implements INameableIt
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
BlockUtil.addPowerProductionInfo(list, TileEntityFurnaceSolar.energyProducedPerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.blocks;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityGrinder;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
|
@ -134,6 +135,7 @@ public class BlockGrinder extends BlockContainerBase implements INameableItem{
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, ((BlockGrinder)theBlock).isDouble ? 3 : 4, "");
|
||||
BlockUtil.addPowerUsageInfo(list, ((BlockGrinder)theBlock).isDouble ? ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue() : ConfigIntValues.GRINDER_ENERGY_USED.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -85,6 +85,7 @@ public class BlockHeatCollector extends BlockContainerBase implements INameableI
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 3, "");
|
||||
BlockUtil.addPowerProductionInfo(list, TileEntityHeatCollector.energyProducedPerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -122,6 +122,7 @@ public class BlockItemRepairer extends BlockContainerBase implements INameableIt
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
BlockUtil.addPowerUsageInfo(list, TileEntityItemRepairer.energyUsePerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.ActuallyAdditions;
|
||||
import ellpeck.actuallyadditions.inventory.GuiHandler;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityOilGenerator;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockOilGenerator extends BlockContainerBase implements INameableItem{
|
||||
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockOilGenerator(){
|
||||
super(Material.rock);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setHardness(1.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityOilGenerator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta){
|
||||
return side <= 1 ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(!world.isRemote){
|
||||
TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(x, y, z);
|
||||
if (generator != null) player.openGui(ActuallyAdditions.instance, GuiHandler.OIL_GENERATOR_ID, world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
|
||||
this.dropInventory(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, block, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "blockOilGenerator";
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
super(block);
|
||||
this.theBlock = block;
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
BlockUtil.addPowerProductionInfo(list, TileEntityOilGenerator.energyProducedPerTick);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomface;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockPhantomface extends BlockContainerBase implements INameableItem{
|
||||
|
||||
public BlockPhantomface(){
|
||||
super(Material.rock);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
this.setHardness(1.0F);
|
||||
this.setStepSound(soundTypeStone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int hitSide, float hitX, float hitY, float hitZ){
|
||||
if(!world.isRemote){
|
||||
TileEntityPhantomface tile = (TileEntityPhantomface)world.getTileEntity(x, y, z);
|
||||
if(tile != null){
|
||||
if(tile.hasBoundTile()){
|
||||
if(tile.isBoundTileInRage()){
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedBlock.desc", tile.boundTile.xCoord, tile.boundTile.yCoord, tile.boundTile.zCoord)));
|
||||
return true;
|
||||
}
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc", tile.boundTile.xCoord, tile.boundTile.yCoord, tile.boundTile.zCoord)));
|
||||
return true;
|
||||
}
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int par2){
|
||||
return new TileEntityPhantomface();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata){
|
||||
return this.blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "blockPhantomface";
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
super(block);
|
||||
this.theBlock = block;
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 2, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
138
src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java
Normal file
138
src/main/java/ellpeck/actuallyadditions/blocks/BlockPlant.java
Normal file
|
@ -0,0 +1,138 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.items.ItemSeed;
|
||||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockCrops;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockPlant extends BlockCrops implements INameableItem{
|
||||
|
||||
private IIcon[] textures;
|
||||
private String name;
|
||||
public Item seedItem;
|
||||
public ItemStack returnItem;
|
||||
|
||||
public BlockPlant(String name, int stages){
|
||||
this.name = name;
|
||||
this.textures = new IIcon[stages];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockStay(World world, int x, int y, int z){
|
||||
return y > 0 && y < 256 && world.getBlock(x, y-1, z).getMaterial() == ((ItemSeed)this.seedItem).soilBlock.getMaterial();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
|
||||
ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
|
||||
if (metadata >= 7){
|
||||
for (int i = 0; i < 3 + fortune; ++i){
|
||||
if (world.rand.nextInt(15) <= metadata){
|
||||
ret.add(new ItemStack(this.seedItem));
|
||||
}
|
||||
}
|
||||
ret.add(this.returnItem.copy());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random rand, int i){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOn(Block block){
|
||||
return block == ((ItemSeed)this.seedItem).soilBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta){
|
||||
if(meta < 7){
|
||||
if (meta == 6) meta = 5;
|
||||
return this.textures[meta >> 1];
|
||||
}
|
||||
else return this.textures[this.textures.length-1];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item func_149866_i(){
|
||||
return this.seedItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item func_149865_P(){
|
||||
return this.returnItem.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconReg){
|
||||
for (int i = 0; i < this.textures.length; i++){
|
||||
textures[i] = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Stage" + (i+1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public static class TheItemBlock extends ItemBlock{
|
||||
|
||||
private Block theBlock;
|
||||
|
||||
public TheItemBlock(Block block){
|
||||
super(block);
|
||||
this.theBlock = block;
|
||||
this.setHasSubtypes(false);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack){
|
||||
return this.getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
BlockUtil.addInformation(theBlock, list, 1, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage){
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
10
src/main/java/ellpeck/actuallyadditions/blocks/FluidAA.java
Normal file
10
src/main/java/ellpeck/actuallyadditions/blocks/FluidAA.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package ellpeck.actuallyadditions.blocks;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class FluidAA extends Fluid{
|
||||
|
||||
public FluidAA(String fluidName){
|
||||
super(fluidName);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,10 @@ package ellpeck.actuallyadditions.blocks;
|
|||
import ellpeck.actuallyadditions.util.BlockUtil;
|
||||
import ellpeck.actuallyadditions.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
public class InitBlocks{
|
||||
|
||||
|
@ -26,9 +30,56 @@ public class InitBlocks{
|
|||
public static Block blockPlacer;
|
||||
public static Block blockDropper;
|
||||
|
||||
public static Block blockRice;
|
||||
public static Block blockCanola;
|
||||
|
||||
public static Fluid fluidCanolaOil;
|
||||
public static Block blockCanolaOil;
|
||||
public static Fluid fluidOil;
|
||||
public static Block blockOil;
|
||||
|
||||
public static Block blockCanolaPress;
|
||||
public static Block blockFermentingBarrel;
|
||||
|
||||
public static Block blockCoalGenerator;
|
||||
public static Block blockOilGenerator;
|
||||
|
||||
public static Block blockPhantomface;
|
||||
|
||||
public static void init(){
|
||||
Util.logInfo("Initializing Blocks...");
|
||||
|
||||
fluidCanolaOil = new FluidAA("canolaOil").setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon);
|
||||
FluidRegistry.registerFluid(fluidCanolaOil);
|
||||
blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.water, "blockCanolaOil");
|
||||
BlockUtil.register(blockCanolaOil, BlockFluidFlowing.TheItemBlock.class, false);
|
||||
|
||||
fluidOil = new FluidAA("oil").setDensity(1200).setViscosity(1500).setTemperature(300).setRarity(EnumRarity.uncommon);
|
||||
FluidRegistry.registerFluid(fluidOil);
|
||||
blockOil = new BlockFluidFlowing(fluidOil, Material.water, "blockOil");
|
||||
BlockUtil.register(blockOil, BlockFluidFlowing.TheItemBlock.class, false);
|
||||
|
||||
blockCanolaPress = new BlockCanolaPress();
|
||||
BlockUtil.register(blockCanolaPress, BlockCanolaPress.TheItemBlock.class);
|
||||
|
||||
blockPhantomface = new BlockPhantomface();
|
||||
BlockUtil.register(blockPhantomface, BlockPhantomface.TheItemBlock.class);
|
||||
|
||||
blockCoalGenerator = new BlockCoalGenerator();
|
||||
BlockUtil.register(blockCoalGenerator, BlockCoalGenerator.TheItemBlock.class);
|
||||
|
||||
blockOilGenerator = new BlockOilGenerator();
|
||||
BlockUtil.register(blockOilGenerator, BlockOilGenerator.TheItemBlock.class);
|
||||
|
||||
blockFermentingBarrel = new BlockFermentingBarrel();
|
||||
BlockUtil.register(blockFermentingBarrel, BlockFermentingBarrel.TheItemBlock.class);
|
||||
|
||||
blockRice = new BlockPlant("blockRice", 6);
|
||||
BlockUtil.register(blockRice, BlockPlant.TheItemBlock.class, false);
|
||||
|
||||
blockCanola = new BlockPlant("blockCanola", 4);
|
||||
BlockUtil.register(blockCanola, BlockPlant.TheItemBlock.class, false);
|
||||
|
||||
blockCompost = new BlockCompost();
|
||||
BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class);
|
||||
|
||||
|
|
|
@ -10,7 +10,9 @@ public enum TheMiscBlocks implements INameableItem{
|
|||
QUARTZ("BlackQuartz", EnumRarity.rare, "blockQuartzBlack"),
|
||||
ORE_QUARTZ("OreBlackQuartz", EnumRarity.epic, "oreQuartzBlack"),
|
||||
WOOD_CASING("WoodCasing", EnumRarity.common, "blockCasingWood"),
|
||||
STONE_CASING("StoneCasing", EnumRarity.uncommon, "blockCasingStone");
|
||||
STONE_CASING("StoneCasing", EnumRarity.uncommon, "blockCasingStone"),
|
||||
CHARCOAL_BLOCK("Charcoal", EnumRarity.common, "blockCharcoal"),
|
||||
ENDERPEARL_BLOCK("Enderpearl", EnumRarity.rare, "blockEnderpearl");
|
||||
|
||||
public final String name;
|
||||
public final String oredictName;
|
||||
|
|
|
@ -21,10 +21,12 @@ public enum ConfigBoolValues{
|
|||
EMERALD_SHARD_CROP("Emerald Shard", ConfigCategories.MOB_DROPS, true, "If the Emerald Shard drops from Mobs"),
|
||||
|
||||
DO_UPDATE_CHECK("Do Update Check", ConfigCategories.OTHER, true, "If Actually Additions should check for an Update on joining a World"),
|
||||
|
||||
DO_CRUSHER_SPAM("Crusher Debug", ConfigCategories.OTHER, false, "Print out Crusher Recipe Initializing Debug"),
|
||||
DO_CAT_DROPS("Do Cat Drops", ConfigCategories.OTHER, true, "If Cats drop Hairy Balls on Occasion"),
|
||||
DO_WAILA_INFO("Waila Display Info", ConfigCategories.OTHER, true, "If the Shift Description should display in Waila too"),
|
||||
|
||||
DO_CAT_DROPS("Do Cat Drops", ConfigCategories.OTHER, true, "If Cats drop Hairy Balls on Occasion");
|
||||
DO_RICE_GEN("Rice Gen", ConfigCategories.WORLD_GEN, true, "If Rice should generate in the World"),
|
||||
DO_CANOLA_GEN("Canola Gen", ConfigCategories.WORLD_GEN, true, "If Canola should generate in the World");
|
||||
|
||||
public final String name;
|
||||
public final String category;
|
||||
|
|
|
@ -68,7 +68,19 @@ public enum ConfigCrafting{
|
|||
KNIFE_BLADE("Knife Blade", ConfigCategories.ITEMS_CRAFTING),
|
||||
|
||||
TOOL_EMERALD("Emerald Tools", ConfigCategories.ITEMS_CRAFTING),
|
||||
TOOL_OBSIDIAN("Obsidian Tools", ConfigCategories.ITEMS_CRAFTING);
|
||||
TOOL_OBSIDIAN("Obsidian Tools", ConfigCategories.ITEMS_CRAFTING),
|
||||
RICE_BREAD("Rice Bread", ConfigCategories.FOOD_CRAFTING),
|
||||
RICE_DOUGH("Rice Dough", ConfigCategories.FOOD_CRAFTING),
|
||||
|
||||
RICE_GADGETS("Rice Gadgets", ConfigCategories.ITEMS_CRAFTING),
|
||||
RESONANT_RICE("Resonant Rice", ConfigCategories.ITEMS_CRAFTING),
|
||||
|
||||
CANOLA_PRESS("Canola Press", ConfigCategories.BLOCKS_CRAFTING),
|
||||
FERMENTING_BARREL("Fermenting Barrel", ConfigCategories.BLOCKS_CRAFTING),
|
||||
COAL_GENERATOR("Coal Generator", ConfigCategories.BLOCKS_CRAFTING),
|
||||
OIL_GENERATOR("Oil Generator", ConfigCategories.BLOCKS_CRAFTING),
|
||||
PHANTOMFACE("Phantomface", ConfigCategories.BLOCKS_CRAFTING),
|
||||
PHANTOM_CONNECTOR("Phantom Connector", ConfigCategories.ITEMS_CRAFTING);
|
||||
|
||||
public final String name;
|
||||
public final String category;
|
||||
|
@ -87,5 +99,4 @@ public enum ConfigCrafting{
|
|||
public boolean isEnabled(){
|
||||
return ConfigValues.craftingValues[this.ordinal()];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,14 +12,14 @@ public enum ConfigIntValues{
|
|||
|
||||
BLACK_QUARTZ_BASE_AMOUNT("Black Quartz Amount", ConfigCategories.WORLD_GEN, 3, 1, 50, "How big a Black Quartz Vein is at least"),
|
||||
BLACK_QUARTZ_ADD_CHANCE("Black Quartz Additional Chance", ConfigCategories.WORLD_GEN, 3, 0, 50, "How much bigger than the Base Amount a Black Quartz Vein can get"),
|
||||
BLACK_QUARTZ_CHANCE("Black Quartz Chance", ConfigCategories.WORLD_GEN, 25, 1, 150, "How often the Black Quartz tries to generate"),
|
||||
BLACK_QUARTZ_CHANCE("Black Quartz Chance", ConfigCategories.WORLD_GEN, 5, 1, 150, "How often the Black Quartz tries to generate"),
|
||||
BLACK_QUARTZ_MIN_HEIGHT("Black Quartz Min Height", ConfigCategories.WORLD_GEN, 0, 0, 256, "How high the Black Quartz starts to generate"),
|
||||
BLACK_QUARTZ_MAX_HEIGHT("Black Quartz Max Height", ConfigCategories.WORLD_GEN, 25, 0, 256, "How high the Black Quartz stops to generate at"),
|
||||
|
||||
COMPOST_AMOUNT("Compost: Amount Needed To Convert", ConfigCategories.MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer"),
|
||||
COMPOST_TIME("Compost: Conversion Time Needed", ConfigCategories.MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer"),
|
||||
|
||||
FISHER_TIME("Fishing Net: Time Needed", ConfigCategories.MACHINE_VALUES, 10000, 50, 500000, "How long it takes on Average until the Fishing Net catches a Fish"),
|
||||
FISHER_TIME("Fishing Net: Time Needed", ConfigCategories.MACHINE_VALUES, 15000, 50, 500000, "How long it takes on Average until the Fishing Net catches a Fish"),
|
||||
|
||||
FEEDER_REACH("Feeder: Reach", ConfigCategories.MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder"),
|
||||
FEEDER_TIME("Feeder: Time Needed", ConfigCategories.MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder"),
|
||||
|
@ -35,20 +35,41 @@ public enum ConfigIntValues{
|
|||
OBSIDIAN_USES("Obsidian: Max Uses", ConfigCategories.TOOL_VALUES, 8000, 50, 20000, "How often Obsidian Tools can be used"),
|
||||
OBSIDIAN_ENCHANTABILITY("Obsidian: Enchantability", ConfigCategories.TOOL_VALUES, 15, 1, 30, "How enchantable an Obsidian Tool is"),
|
||||
|
||||
GRINDER_CRUSH_TIME("Crusher: Crush Time", ConfigCategories.MACHINE_VALUES, 200, 10, 1000, "How long the Crusher takes to crush an item"),
|
||||
GRINDER_DOUBLE_CRUSH_TIME("Double Crusher: Crush Time", ConfigCategories.MACHINE_VALUES, 300, 10, 1000, "How long the Double Crusher takes to crush an item"),
|
||||
FURNACE_DOUBLE_SMELT_TIME("Double Furnace: Smelt Time", ConfigCategories.MACHINE_VALUES, 300, 10, 1000, "How long the Double Furnace takes to crush an item"),
|
||||
GRINDER_CRUSH_TIME("Crusher: Time", ConfigCategories.MACHINE_VALUES, 100, 10, 1000, "How long the Crusher takes to crush an item"),
|
||||
GRINDER_DOUBLE_CRUSH_TIME("Double Crusher: Time", ConfigCategories.MACHINE_VALUES, 150, 10, 1000, "How long the Double Crusher takes to crush an item"),
|
||||
FURNACE_DOUBLE_SMELT_TIME("Double Furnace: Time", ConfigCategories.MACHINE_VALUES, 80, 10, 1000, "How long the Double Furnace takes to crush an item"),
|
||||
|
||||
REPAIRER_SPEED_SLOWDOWN("Item Repairer: Speed Slowdown", ConfigCategories.MACHINE_VALUES, 3, 1, 100, "How much slower the Item Repairer repairs"),
|
||||
REPAIRER_SPEED_SLOWDOWN("Repairer: Speed Slowdown", ConfigCategories.MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs"),
|
||||
HEAT_COLLECTOR_BLOCKS("Heat Collector: Blocks Needed", ConfigCategories.MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it"),
|
||||
HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"),
|
||||
|
||||
GLASS_TIME_NEEDED("Greenhouse Glass: Time Needed", ConfigCategories.MACHINE_VALUES, 1000, 10, 1000000, "The Time Needed for the Greenhouse Glass to grow a Plant below it"),
|
||||
GLASS_TIME_NEEDED("Greenhouse Glass: Time Needed", ConfigCategories.MACHINE_VALUES, 4000, 10, 1000000, "The Time Needed for the Greenhouse Glass to grow a Plant below it"),
|
||||
|
||||
BREAKER_TIME_NEEDED("Breaker and Placer: Time Needed", ConfigCategories.MACHINE_VALUES, 15, 1, 10000, "The Time Needed for the Breaker and the Placer to place or break a Block"),
|
||||
DROPPER_TIME_NEEDED("Dropper: Time Needed", ConfigCategories.MACHINE_VALUES, 10, 1, 10000, "The Time Needed for the Dropper to drop an Item"),
|
||||
|
||||
CAT_DROP_CHANCE("Cat Drops: Chance", ConfigCategories.OTHER, 5000, 5, 10000000, "The 1 in X chance for a Hairy Ball to Drop from a Cat with X being this value");
|
||||
CAT_DROP_CHANCE("Cat Drops: Chance", ConfigCategories.OTHER, 5000, 5, 10000000, "The 1 in X chance for a Hairy Ball to Drop from a Cat with X being this value"),
|
||||
|
||||
RICE_AMOUNT("Rice Amount", ConfigCategories.WORLD_GEN, 15, 1, 100, "The Chance of Rice generating"),
|
||||
CANOLA_AMOUNT("Canola Amount", ConfigCategories.WORLD_GEN, 2, 1, 50, "The Chance of Canola generating"),
|
||||
|
||||
GRINDER_ENERGY_USED("Energy Use: Crusher", ConfigCategories.MACHINE_VALUES, 40, 1, 500, "The Amount of Energy used by the Crusher per Tick"),
|
||||
GRINDER_DOUBLE_ENERGY_USED("Energy Use: Double Crusher", ConfigCategories.MACHINE_VALUES, 60, 1, 500, "The Amount of Energy used by the Double Crusher per Tick"),
|
||||
FURNACE_SOLAR_ENERGY_PRODUCED("Energy Production: Furnace Solar", ConfigCategories.MACHINE_VALUES, 15, 1, 500, "The Amount of Energy produced by the Solar per Tick"),
|
||||
HEAT_COLLECTOR_ENERGY_PRODUCED("Energy Production: Heat Collector", ConfigCategories.MACHINE_VALUES, 30, 1, 500, "The Amount of Energy produced by the Heat Collector per Tick"),
|
||||
REPAIRER_ENERGY_USED("Energy Use: Repairer", ConfigCategories.MACHINE_VALUES, 1250, 1, 5000, "The Amount of Energy used by the Repairer per Tick"),
|
||||
FURNACE_ENERGY_USED("Energy Use: Double Furnace", ConfigCategories.MACHINE_VALUES, 25, 1, 500, "The Amount of Energy used by the Double Furnace per Tick"),
|
||||
|
||||
PRESS_PROCESSING_TIME("Canola Press: Processing Time", ConfigCategories.MACHINE_VALUES, 30, 1, 1000, "The Amount of time it takes to process one Canola"),
|
||||
PRESS_MB_PRODUCED("Canola Press: mB Produced", ConfigCategories.MACHINE_VALUES, 50, 1, 5000, "The Amount of Canola Oil produced from one Canola"),
|
||||
PRESS_ENERGY_USED("Energy Use: Canola Press", ConfigCategories.MACHINE_VALUES, 35, 10, 500, "The Amount of Energy used by the Canola Press per Tick"),
|
||||
|
||||
BARREL_MB_PRODUCED("Fermenting Barrel: mB Produced", ConfigCategories.MACHINE_VALUES, 50, 1, 3000, "The Amount of mB produced by the Barrel per cycle"),
|
||||
BARREL_PROCESSING_TIME("Fermenting Barrel: Processing Time", ConfigCategories.MACHINE_VALUES, 100, 1, 5000, "The Amount of time it takes to process one Canola Oil to Oil"),
|
||||
|
||||
COAL_GEN_ENERGY_PRODUCED("Coal Generator: Energy Produced", ConfigCategories.MACHINE_VALUES, 30, 1, 500, "The Amount of Energy generated by the Coal Generator"),
|
||||
|
||||
PHANTOMFACE_RANGE("Phantomface: Default Range", ConfigCategories.MACHINE_VALUES, 16, 3, 100, "The Default Range of the Phantomface");
|
||||
|
||||
public final String name;
|
||||
public final String category;
|
||||
|
@ -69,5 +90,4 @@ public enum ConfigIntValues{
|
|||
public int getValue(){
|
||||
return ConfigValues.intValues[this.ordinal()];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -23,6 +24,13 @@ public class BlockCrafting{
|
|||
'W', "plankWood",
|
||||
'C', TheMiscBlocks.WOOD_CASING.getOredictName()));
|
||||
|
||||
//Charcoal Block
|
||||
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.CHARCOAL_BLOCK.ordinal()),
|
||||
"CCC", "CCC", "CCC",
|
||||
'C', new ItemStack(Items.coal, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Items.coal, 9, 1),
|
||||
new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.CHARCOAL_BLOCK.ordinal()));
|
||||
|
||||
//Wood Casing
|
||||
if(ConfigCrafting.WOOD_CASING.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()),
|
||||
|
@ -31,6 +39,56 @@ public class BlockCrafting{
|
|||
'R', "dustRedstone",
|
||||
'S', "stickWood"));
|
||||
|
||||
//Canola Press
|
||||
if(ConfigCrafting.CANOLA_PRESS.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCanolaPress),
|
||||
"CHC", "CDC", "CRC",
|
||||
'C', "cobblestone",
|
||||
'H', Blocks.hopper,
|
||||
'R', TheMiscItems.COIL_ADVANCED.getOredictName(),
|
||||
'D', TheMiscItems.CANOLA.getOredictName()));
|
||||
|
||||
//Fermenting Barrel
|
||||
if(ConfigCrafting.FERMENTING_BARREL.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFermentingBarrel),
|
||||
"CHC", "CDC", "CRC",
|
||||
'C', "logWood",
|
||||
'H', Blocks.hopper,
|
||||
'R', TheMiscBlocks.WOOD_CASING.getOredictName(),
|
||||
'D', TheMiscItems.CANOLA.getOredictName()));
|
||||
|
||||
//Phantomface
|
||||
if(ConfigCrafting.PHANTOMFACE.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPhantomface),
|
||||
"ECE", "EBE", "ESE",
|
||||
'E', Items.ender_eye,
|
||||
'C', Blocks.chest,
|
||||
'S', TheMiscItems.COIL_ADVANCED.getOredictName(),
|
||||
'B', TheMiscBlocks.ENDERPEARL_BLOCK.getOredictName()));
|
||||
|
||||
//Oil Generator
|
||||
if(ConfigCrafting.OIL_GENERATOR.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockOilGenerator),
|
||||
"CRC", "CBC", "CRC",
|
||||
'C', "cobblestone",
|
||||
'R', TheMiscBlocks.STONE_CASING.getOredictName(),
|
||||
'B', InitItems.itemBucketOil));
|
||||
|
||||
//Coal Generator
|
||||
if(ConfigCrafting.COAL_GENERATOR.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCoalGenerator),
|
||||
"CRC", "CBC", "CRC",
|
||||
'C', "cobblestone",
|
||||
'R', TheMiscBlocks.STONE_CASING.getOredictName(),
|
||||
'B', "coal"));
|
||||
|
||||
//Enderpearl Block
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()),
|
||||
"EE", "EE",
|
||||
'E', Items.ender_pearl));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Items.ender_pearl, 4),
|
||||
TheMiscBlocks.ENDERPEARL_BLOCK.getOredictName()));
|
||||
|
||||
//Stone Casing
|
||||
if(ConfigCrafting.STONE_CASING.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()),
|
||||
|
@ -58,28 +116,28 @@ public class BlockCrafting{
|
|||
'D', "gemDiamond",
|
||||
'I', "ingotIron",
|
||||
'O', TheMiscItems.COIL.getOredictName(),
|
||||
'C', Items.nether_star));
|
||||
'C', TheMiscBlocks.STONE_CASING.getOredictName()));
|
||||
|
||||
//Solar Panel
|
||||
/*if(ConfigCrafting.SOLAR_PANEL.isEnabled())
|
||||
if(ConfigCrafting.SOLAR_PANEL.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFurnaceSolar),
|
||||
"IQI", "CDC", "IBI",
|
||||
'D', "blockDiamond",
|
||||
'I', "ingotIron",
|
||||
'Q', TheMiscBlocks.STONE_CASING.getOredictName(),
|
||||
'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
|
||||
'B', new ItemStack(Blocks.iron_bars)));*/
|
||||
'B', new ItemStack(Blocks.iron_bars)));
|
||||
|
||||
//Heat Collector
|
||||
/*if(ConfigCrafting.HEAT_COLLECTOR.isEnabled())
|
||||
if(ConfigCrafting.HEAT_COLLECTOR.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockHeatCollector),
|
||||
"BRB", "CDC", "BQB",
|
||||
'D', "blockDiamond",
|
||||
'D', "gemDiamond",
|
||||
'R', new ItemStack(Items.repeater),
|
||||
'Q', TheMiscBlocks.STONE_CASING.getOredictName(),
|
||||
'L', new ItemStack(Items.lava_bucket),
|
||||
'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
|
||||
'B', new ItemStack(Blocks.iron_bars)));*/
|
||||
'B', new ItemStack(Blocks.iron_bars)));
|
||||
|
||||
//Quartz Pillar
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()),
|
||||
|
@ -158,7 +216,7 @@ public class BlockCrafting{
|
|||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGreenhouseGlass),
|
||||
"GSG", "SDS", "GSG",
|
||||
'G', "blockGlass",
|
||||
'D', "gemDiamond",
|
||||
'D', "blockDiamond",
|
||||
'S', "treeSapling"));
|
||||
|
||||
//Placer
|
||||
|
|
|
@ -19,6 +19,11 @@ public class FoodCrafting{
|
|||
|
||||
String knifeStack = ((INameableItem)InitItems.itemKnife).getOredictName();
|
||||
|
||||
//Rice Bread
|
||||
if(ConfigCrafting.RICE_BREAD.isEnabled())
|
||||
GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RICE_DOUGH.ordinal()),
|
||||
new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE_BREAD.ordinal()), 1F);
|
||||
|
||||
//Baguette
|
||||
if(ConfigCrafting.BAGUETTE.isEnabled())
|
||||
GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1,
|
||||
|
|
|
@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.crafting;
|
|||
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheDusts;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler.SearchCase;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipes;
|
||||
|
@ -18,21 +19,24 @@ public class GrinderCrafting{
|
|||
public static void init(){
|
||||
Util.logInfo("Initializing Crusher Recipes...");
|
||||
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10), null, 0);
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()), null, 0);
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10));
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()));
|
||||
grindRec.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()));
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal()));
|
||||
|
||||
grindRec.registerRecipe("cobblestone", "sand");
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand));
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint));
|
||||
grindRec.registerRecipe("stone", "cobblestone");
|
||||
grindRec.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
|
||||
grindRec.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
|
||||
|
||||
grindRec.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2);
|
||||
grindRec.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2);
|
||||
|
||||
grindRecHan.searchCases.add(new SearchCase("ore", 2));
|
||||
grindRecHan.searchCases.add(new SearchCase("oreNether", 6));
|
||||
grindRecHan.searchCases.add(new SearchCase("denseore", 8));
|
||||
grindRecHan.searchCases.add(new SearchCase("gem", 1));
|
||||
grindRecHan.searchCases.add(new SearchCase("ingot", 1));
|
||||
grindRecHan.searchCases.add(new SearchCase("gem", 1));
|
||||
grindRecHan.searchCases.add(new SearchCase("ore", 2));
|
||||
grindRecHan.exceptions.add("ingotBrick");
|
||||
grindRecHan.exceptions.add("ingotBrickNether");
|
||||
|
||||
|
|
|
@ -5,10 +5,7 @@ import ellpeck.actuallyadditions.blocks.InitBlocks;
|
|||
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheDusts;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.ThePotionRings;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
|
||||
import ellpeck.actuallyadditions.items.metalists.*;
|
||||
import ellpeck.actuallyadditions.util.Util;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -22,6 +19,21 @@ public class ItemCrafting{
|
|||
|
||||
public static void init(){
|
||||
|
||||
//Rice Stuff
|
||||
if(ConfigCrafting.RICE_GADGETS.isEnabled()){
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.paper, 3),
|
||||
"RRR",
|
||||
'R', TheFoods.RICE.getOredictName()));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 4, TheMiscItems.RICE_SLIME.ordinal()),
|
||||
" R ", "RBR", " R ",
|
||||
'R', TheMiscItems.RICE_DOUGH.getOredictName(),
|
||||
'B', Items.water_bucket));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 4, TheMiscItems.RICE_SLIME.ordinal()),
|
||||
" R ", "RBR", " R ",
|
||||
'R', TheMiscItems.RICE_DOUGH.getOredictName(),
|
||||
'B', new ItemStack(Items.potionitem)));
|
||||
}
|
||||
|
||||
//Leaf Blower
|
||||
if(ConfigCrafting.LEAF_BLOWER.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlower),
|
||||
|
@ -38,6 +50,11 @@ public class ItemCrafting{
|
|||
'I', "ingotIron",
|
||||
'R', "dustRedstone"));
|
||||
|
||||
//Resonant Rice
|
||||
if(ConfigCrafting.RESONANT_RICE.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemResonantRice),
|
||||
TheFoods.RICE.getOredictName(), "nuggetEnderium", Items.gunpowder));
|
||||
|
||||
//Advanced Coil
|
||||
if(ConfigCrafting.ADV_COIL.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
|
||||
|
@ -64,6 +81,14 @@ public class ItemCrafting{
|
|||
'P', new ItemStack(Blocks.piston),
|
||||
'C', TheMiscItems.COIL_ADVANCED.getOredictName()));
|
||||
|
||||
//Phantom Connector
|
||||
if(ConfigCrafting.PHANTOM_CONNECTOR.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemPhantomConnector),
|
||||
"YE", "EY", "S ",
|
||||
'Y', Items.ender_eye,
|
||||
'E', Items.ender_pearl,
|
||||
'S', "stickWood"));
|
||||
|
||||
//Quartz
|
||||
GameRegistry.addSmelting(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()),
|
||||
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 1F);
|
||||
|
@ -81,13 +106,19 @@ public class ItemCrafting{
|
|||
new ItemStack(Items.sign),
|
||||
new ItemStack(Items.slime_ball));
|
||||
|
||||
//SpeedUpgrade
|
||||
if(ConfigCrafting.SPEED_UPGRADE.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemSpeedUpgrade, 2),
|
||||
"RGR", "GUG", "RGR",
|
||||
'U', TheMiscItems.COIL.getOredictName(),
|
||||
'R', "dustRedstone",
|
||||
'G', "ingotGold"));
|
||||
//Tiny Coal
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_COAL.ordinal()),
|
||||
new ItemStack(Items.coal));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.TINY_CHAR.ordinal()),
|
||||
new ItemStack(Items.coal, 1, 1));
|
||||
|
||||
//Rice Seeds
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemRiceSeed),
|
||||
new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()));
|
||||
|
||||
//Canola Seeds
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCanolaSeed),
|
||||
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal()));
|
||||
|
||||
//Mashed Food
|
||||
if(ConfigCrafting.MASHED_FOOD.isEnabled())
|
||||
|
@ -139,14 +170,14 @@ public class ItemCrafting{
|
|||
|
||||
public static void addRingRecipeWithStack(ItemStack mainStack, int meta){
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, meta), mainStack, mainStack, mainStack, mainStack, new ItemStack(Blocks.diamond_block), new ItemStack(Items.nether_wart), new ItemStack(Items.potionitem), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, meta), new ItemStack(InitItems.itemPotionRing, 1, meta), new ItemStack(Items.nether_star));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, meta), new ItemStack(InitItems.itemPotionRing, 1, meta), new ItemStack(Items.nether_star), new ItemStack(Items.nether_star));
|
||||
}
|
||||
|
||||
public static void initMashedFoodRecipes(){
|
||||
for(Object nextIterator : Item.itemRegistry){
|
||||
if(nextIterator instanceof ItemFood){
|
||||
ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD);
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 12, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.crafting;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigCrafting;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -18,6 +19,11 @@ public class MiscCrafting{
|
|||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()),
|
||||
"cropWheat", "cropWheat"));
|
||||
|
||||
//Rice Dough
|
||||
if(ConfigCrafting.RICE_DOUGH.isEnabled())
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.RICE_DOUGH.ordinal()),
|
||||
TheFoods.RICE.getOredictName(), TheFoods.RICE.getOredictName()));
|
||||
|
||||
//Paper Cone
|
||||
if(ConfigCrafting.PAPER_CONE.isEnabled())
|
||||
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
|
||||
|
|
|
@ -28,14 +28,16 @@ public class CreativeTab extends CreativeTabs{
|
|||
|
||||
this.addBlock(InitBlocks.blockInputter);
|
||||
this.addBlock(InitBlocks.blockInputterAdvanced);
|
||||
this.addBlock(InitBlocks.blockPhantomface);
|
||||
this.addBlock(InitBlocks.blockGreenhouseGlass);
|
||||
this.addBlock(InitBlocks.blockGrinder);
|
||||
this.addBlock(InitBlocks.blockGrinderDouble);
|
||||
this.addBlock(InitBlocks.blockFurnaceDouble);
|
||||
|
||||
//TODO Re-add
|
||||
//this.addBlock(InitBlocks.blockFurnaceSolar);
|
||||
//this.addBlock(InitBlocks.blockHeatCollector);
|
||||
this.addBlock(InitBlocks.blockFurnaceSolar);
|
||||
this.addBlock(InitBlocks.blockHeatCollector);
|
||||
this.addBlock(InitBlocks.blockCoalGenerator);
|
||||
this.addBlock(InitBlocks.blockOilGenerator);
|
||||
this.addBlock(InitBlocks.blockItemRepairer);
|
||||
this.addBlock(InitBlocks.blockFishingNet);
|
||||
this.addBlock(InitBlocks.blockBreaker);
|
||||
|
@ -46,10 +48,18 @@ public class CreativeTab extends CreativeTabs{
|
|||
this.addBlock(InitBlocks.blockFeeder);
|
||||
this.addBlock(InitBlocks.blockCompost);
|
||||
this.addBlock(InitBlocks.blockGiantChest);
|
||||
this.addBlock(InitBlocks.blockCanolaPress);
|
||||
this.addBlock(InitBlocks.blockFermentingBarrel);
|
||||
|
||||
this.addItem(InitItems.itemPhantomConnector);
|
||||
this.addItem(InitItems.itemBucketCanolaOil);
|
||||
this.addItem(InitItems.itemBucketOil);
|
||||
|
||||
this.addItem(InitItems.itemRiceSeed);
|
||||
this.addItem(InitItems.itemCanolaSeed);
|
||||
this.addItem(InitItems.itemHairyBall);
|
||||
this.addItem(InitItems.itemSpeedUpgrade);
|
||||
this.addItem(InitItems.itemMisc);
|
||||
this.addItem(InitItems.itemResonantRice);
|
||||
this.addItem(InitItems.itemFertilizer);
|
||||
this.addItem(InitItems.itemFoods);
|
||||
this.addItem(InitItems.itemKnife);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package ellpeck.actuallyadditions.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import ellpeck.actuallyadditions.blocks.BlockFluidFlowing;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
|
||||
public class BucketFillEvent{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBucketFilled(FillBucketEvent event){
|
||||
Block block = event.world.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ);
|
||||
|
||||
if(block instanceof BlockFluidFlowing){
|
||||
if(block == InitBlocks.blockCanolaOil){
|
||||
event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
|
||||
event.result = new ItemStack(InitItems.itemBucketCanolaOil);
|
||||
}
|
||||
if(block == InitBlocks.blockOil){
|
||||
event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ);
|
||||
event.result = new ItemStack(InitItems.itemBucketOil);
|
||||
}
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,8 @@ public class InitEvents{
|
|||
Util.registerEvent(new PickupEvent());
|
||||
Util.registerEvent(new TooltipEvent());
|
||||
Util.registerEvent(new EntityLivingEvent());
|
||||
Util.registerEvent(new WorldDecorationEvent());
|
||||
Util.registerEvent(new BucketFillEvent());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package ellpeck.actuallyadditions.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class WorldDecorationEvent{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onWorldDecoration(DecorateBiomeEvent event){
|
||||
if(ConfigBoolValues.DO_RICE_GEN.isEnabled()){
|
||||
for(int i = 0; i < ConfigIntValues.RICE_AMOUNT.getValue(); i++){
|
||||
if(new Random().nextInt(10) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ);
|
||||
|
||||
if(event.world.getBlock(genX, genY, genZ).getMaterial() == Material.water){
|
||||
ArrayList<Material> blocksAroundBottom = this.getMaterialsAround(event.world, genX, genY, genZ);
|
||||
ArrayList<Material> blocksAroundTop = this.getMaterialsAround(event.world, genX, genY+1, genZ);
|
||||
if(blocksAroundBottom.contains(Material.grass) || blocksAroundBottom.contains(Material.ground) || blocksAroundBottom.contains(Material.rock) || blocksAroundBottom.contains(Material.sand)){
|
||||
if(!blocksAroundTop.contains(Material.water) && !blocksAroundTop.contains(Material.water) && !blocksAroundTop.contains(Material.water) && event.world.getBlock(genX, genY+1, genZ).getMaterial() == Material.air){
|
||||
event.world.setBlock(genX, genY+1, genZ, InitBlocks.blockRice, event.rand.nextInt(8), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ConfigBoolValues.DO_CANOLA_GEN.isEnabled()){
|
||||
for(int i = 0; i < ConfigIntValues.CANOLA_AMOUNT.getValue(); i++){
|
||||
if(new Random().nextInt(50) == 0){
|
||||
int genX = event.chunkX+event.rand.nextInt(16)+8;
|
||||
int genZ = event.chunkZ+event.rand.nextInt(16)+8;
|
||||
int genY = event.world.getTopSolidOrLiquidBlock(genX, genZ)-1;
|
||||
|
||||
if(event.world.getBlock(genX, genY, genZ).getMaterial() == Material.grass){
|
||||
event.world.setBlock(genX, genY+1, genZ, InitBlocks.blockCanola, event.rand.nextInt(8), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<Material> getMaterialsAround(World world, int x, int y, int z){
|
||||
ArrayList<Material> blocks = new ArrayList<Material>();
|
||||
blocks.add(world.getBlock(x+1, y, z).getMaterial());
|
||||
blocks.add(world.getBlock(x-1, y, z).getMaterial());
|
||||
blocks.add(world.getBlock(x, y, z+1).getMaterial());
|
||||
blocks.add(world.getBlock(x, y, z-1).getMaterial());
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,15 +18,15 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
|
|||
private ArrayList<Trade> trades = new ArrayList<Trade>();
|
||||
|
||||
public JamVillagerTradeHandler(){
|
||||
this.addWants("ingotGold", 3, 2);
|
||||
this.addWants("cropWheat", 10, 10);
|
||||
this.addWants("dustRedstone", 15, 15);
|
||||
this.addWants(new ItemStack(Items.bucket), 1, 4);
|
||||
this.addWants(new ItemStack(Items.glass_bottle), 5, 5);
|
||||
this.addWants("ingotGold", 5, 2);
|
||||
this.addWants("cropWheat", 15, 10);
|
||||
this.addWants("dustRedstone", 25, 15);
|
||||
this.addWants(new ItemStack(Items.bucket), 5, 4);
|
||||
this.addWants(new ItemStack(Items.glass_bottle), 12, 5);
|
||||
this.addWants(new ItemStack(Items.potionitem), 1, 0);
|
||||
this.addWants("ingotIron", 5, 5);
|
||||
this.addWants("gemDiamond", 1, 1);
|
||||
this.addWants("dustGlowstone", 5, 10);
|
||||
this.addWants("ingotIron", 10, 5);
|
||||
this.addWants("gemDiamond", 1, 2);
|
||||
this.addWants("dustGlowstone", 12, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,7 +48,7 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
|
|||
if(wantsOne == wantsTwo) wantsTwo = null;
|
||||
|
||||
for(int k = 0; k < TheJams.values().length; k++){
|
||||
recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(5)+1, k)));
|
||||
recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(3)+1, k)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityCanolaPress;
|
||||
import invtweaks.api.container.InventoryContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerCanolaPress extends Container{
|
||||
|
||||
private TileEntityCanolaPress press;
|
||||
|
||||
private int lastEnergyStored;
|
||||
private int lastTankAmount;
|
||||
private int lastProcessTime;
|
||||
|
||||
public ContainerCanolaPress(InventoryPlayer inventory, TileEntityBase tile){
|
||||
this.press = (TileEntityCanolaPress)tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.press, 0, 81, 10));
|
||||
this.addSlotToContainer(new Slot(this.press, 1, 136, 73));
|
||||
this.addSlotToContainer(new SlotOutput(this.press, 2, 136, 42));
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 9; j++){
|
||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++){
|
||||
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player){
|
||||
return this.press.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCraft){
|
||||
super.addCraftingToCrafters(iCraft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.press.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.press.tank.getFluidAmount());
|
||||
iCraft.sendProgressBarUpdate(this, 2, this.press.currentProcessTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges(){
|
||||
super.detectAndSendChanges();
|
||||
for(Object crafter : this.crafters){
|
||||
ICrafting iCraft = (ICrafting)crafter;
|
||||
|
||||
if(this.lastEnergyStored != this.press.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.press.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
if(this.lastTankAmount != this.press.tank.getFluidAmount()) iCraft.sendProgressBarUpdate(this, 1, this.press.tank.getFluidAmount());
|
||||
if(this.lastProcessTime != this.press.currentProcessTime) iCraft.sendProgressBarUpdate(this, 2, this.press.currentProcessTime);
|
||||
}
|
||||
|
||||
this.lastEnergyStored = this.press.getEnergyStored(ForgeDirection.UNKNOWN);
|
||||
this.lastTankAmount = this.press.tank.getFluidAmount();
|
||||
this.lastProcessTime = this.press.currentProcessTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2){
|
||||
if(par1 == 0) this.press.storage.setEnergyStored(par2);
|
||||
if(par1 == 1) this.press.tank.setFluid(new FluidStack(InitBlocks.fluidCanolaOil, par2));
|
||||
if(par1 == 2) this.press.currentProcessTime = par2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
final int inventoryStart = 3;
|
||||
final int inventoryEnd = inventoryStart+26;
|
||||
final int hotbarStart = inventoryEnd+1;
|
||||
final int hotbarEnd = hotbarStart+8;
|
||||
|
||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||
if(theSlot.getHasStack()){
|
||||
ItemStack currentStack = theSlot.getStack();
|
||||
ItemStack newStack = currentStack.copy();
|
||||
|
||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||
if(currentStack.getItem() == InitItems.itemMisc && currentStack.getItemDamage() == TheMiscItems.CANOLA.ordinal()){
|
||||
this.mergeItemStack(newStack, 0, 1, false);
|
||||
}
|
||||
if(currentStack.getItem() == Items.bucket){
|
||||
this.mergeItemStack(newStack, 1, 2, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot < inventoryStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
||||
else theSlot.onSlotChanged();
|
||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
||||
theSlot.onPickupFromSlot(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityCoalGenerator;
|
||||
import invtweaks.api.container.InventoryContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerCoalGenerator extends Container{
|
||||
|
||||
private TileEntityCoalGenerator generator;
|
||||
|
||||
private int lastEnergyStored;
|
||||
private int lastBurnTime;
|
||||
private int lastMaxBurnTime;
|
||||
|
||||
public ContainerCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){
|
||||
this.generator = (TileEntityCoalGenerator)tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.generator, 0, 87, 43));
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 9; j++){
|
||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++){
|
||||
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player){
|
||||
return this.generator.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCraft){
|
||||
super.addCraftingToCrafters(iCraft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.generator.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.generator.currentBurnTime);
|
||||
iCraft.sendProgressBarUpdate(this, 2, this.generator.maxBurnTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges(){
|
||||
super.detectAndSendChanges();
|
||||
for(Object crafter : this.crafters){
|
||||
ICrafting iCraft = (ICrafting)crafter;
|
||||
|
||||
if(this.lastEnergyStored != this.generator.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.generator.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
if(this.lastBurnTime != this.generator.currentBurnTime) iCraft.sendProgressBarUpdate(this, 1, this.generator.currentBurnTime);
|
||||
if(this.lastMaxBurnTime != this.generator.maxBurnTime) iCraft.sendProgressBarUpdate(this, 2, this.generator.maxBurnTime);
|
||||
}
|
||||
|
||||
this.lastEnergyStored = this.generator.getEnergyStored(ForgeDirection.UNKNOWN);
|
||||
this.lastBurnTime = this.generator.currentBurnTime;
|
||||
this.lastMaxBurnTime = this.generator.maxBurnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2){
|
||||
if(par1 == 0) this.generator.storage.setEnergyStored(par2);
|
||||
if(par1 == 1) this.generator.currentBurnTime = par2;
|
||||
if(par1 == 2) this.generator.maxBurnTime = par2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
final int inventoryStart = 1;
|
||||
final int inventoryEnd = inventoryStart+26;
|
||||
final int hotbarStart = inventoryEnd+1;
|
||||
final int hotbarEnd = hotbarStart+8;
|
||||
|
||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||
if(theSlot.getHasStack()){
|
||||
ItemStack currentStack = theSlot.getStack();
|
||||
ItemStack newStack = currentStack.copy();
|
||||
|
||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||
if(TileEntityFurnace.getItemBurnTime(currentStack) > 0){
|
||||
this.mergeItemStack(newStack, 0, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot < inventoryStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
||||
else theSlot.onSlotChanged();
|
||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
||||
theSlot.onPickupFromSlot(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel;
|
||||
import invtweaks.api.container.InventoryContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerFermentingBarrel extends Container{
|
||||
|
||||
private TileEntityFermentingBarrel barrel;
|
||||
|
||||
private int lastProcessTime;
|
||||
private int lastCanolaTank;
|
||||
private int lastOilTank;
|
||||
|
||||
public ContainerFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){
|
||||
this.barrel = (TileEntityFermentingBarrel)tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.barrel, 0, 42, 74));
|
||||
this.addSlotToContainer(new SlotOutput(this.barrel, 1, 42, 43));
|
||||
this.addSlotToContainer(new Slot(this.barrel, 2, 118, 74));
|
||||
this.addSlotToContainer(new SlotOutput(this.barrel, 3, 118, 43));
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 9; j++){
|
||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++){
|
||||
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player){
|
||||
return this.barrel.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCraft){
|
||||
super.addCraftingToCrafters(iCraft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.barrel.oilTank.getFluidAmount());
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.barrel.canolaTank.getFluidAmount());
|
||||
iCraft.sendProgressBarUpdate(this, 2, this.barrel.currentProcessTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges(){
|
||||
super.detectAndSendChanges();
|
||||
for(Object crafter : this.crafters){
|
||||
ICrafting iCraft = (ICrafting)crafter;
|
||||
|
||||
if(this.lastOilTank != this.barrel.oilTank.getFluidAmount()) iCraft.sendProgressBarUpdate(this, 0, this.barrel.oilTank.getFluidAmount());
|
||||
if(this.lastCanolaTank != this.barrel.canolaTank.getFluidAmount()) iCraft.sendProgressBarUpdate(this, 1, this.barrel.canolaTank.getFluidAmount());
|
||||
if(this.lastProcessTime != this.barrel.currentProcessTime) iCraft.sendProgressBarUpdate(this, 2, this.barrel.currentProcessTime);
|
||||
}
|
||||
|
||||
this.lastOilTank = this.barrel.oilTank.getFluidAmount();
|
||||
this.lastCanolaTank = this.barrel.canolaTank.getFluidAmount();
|
||||
this.lastProcessTime = this.barrel.currentProcessTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2){
|
||||
if(par1 == 0) this.barrel.oilTank.setFluid(new FluidStack(InitBlocks.fluidOil, par2));
|
||||
if(par1 == 1) this.barrel.canolaTank.setFluid(new FluidStack(InitBlocks.fluidCanolaOil, par2));
|
||||
if(par1 == 2) this.barrel.currentProcessTime = par2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
final int inventoryStart = 4;
|
||||
final int inventoryEnd = inventoryStart+26;
|
||||
final int hotbarStart = inventoryEnd+1;
|
||||
final int hotbarEnd = hotbarStart+8;
|
||||
|
||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||
if(theSlot.getHasStack()){
|
||||
ItemStack currentStack = theSlot.getStack();
|
||||
ItemStack newStack = currentStack.copy();
|
||||
|
||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||
if(currentStack.getItem() == InitItems.itemBucketCanolaOil){
|
||||
this.mergeItemStack(newStack, 0, 1, false);
|
||||
}
|
||||
if(currentStack.getItem() == Items.bucket){
|
||||
this.mergeItemStack(newStack, 2, 3, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot < inventoryStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
||||
else theSlot.onSlotChanged();
|
||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
||||
theSlot.onPickupFromSlot(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -13,15 +13,14 @@ import net.minecraft.inventory.ICrafting;
|
|||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerFurnaceDouble extends Container{
|
||||
|
||||
private TileEntityFurnaceDouble tileFurnace;
|
||||
|
||||
private int lastCoalTime;
|
||||
private int lastCoalTimeLeft;
|
||||
private int lastEnergy;
|
||||
private int lastFirstCrushTime;
|
||||
private int lastSecondCrushTime;
|
||||
private int lastBurnTime;
|
||||
|
@ -29,15 +28,11 @@ public class ContainerFurnaceDouble extends Container{
|
|||
public ContainerFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){
|
||||
this.tileFurnace = (TileEntityFurnaceDouble)tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_COAL, 80, 21));
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_1, 51, 21));
|
||||
this.addSlotToContainer(new SlotOutput(this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_1, 51, 69));
|
||||
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21));
|
||||
this.addSlotToContainer(new SlotOutput(this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69));
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileFurnace, this.tileFurnace.speedUpgradeSlot, 155, 21));
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 9; j++){
|
||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
||||
|
@ -51,11 +46,10 @@ public class ContainerFurnaceDouble extends Container{
|
|||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCraft){
|
||||
super.addCraftingToCrafters(iCraft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.tileFurnace.coalTime);
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft);
|
||||
iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime);
|
||||
iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime);
|
||||
iCraft.sendProgressBarUpdate(this, 4, this.tileFurnace.maxBurnTime);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.tileFurnace.firstSmeltTime);
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.secondSmeltTime);
|
||||
iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.maxBurnTime);
|
||||
iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -64,28 +58,25 @@ public class ContainerFurnaceDouble extends Container{
|
|||
for(Object crafter : this.crafters){
|
||||
ICrafting iCraft = (ICrafting)crafter;
|
||||
|
||||
if(this.lastCoalTime != this.tileFurnace.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileFurnace.coalTime);
|
||||
if(this.lastCoalTimeLeft != this.tileFurnace.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft);
|
||||
if(this.lastFirstCrushTime != this.tileFurnace.firstSmeltTime) iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime);
|
||||
if(this.lastSecondCrushTime != this.tileFurnace.secondSmeltTime) iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime);
|
||||
if(this.lastBurnTime != this.tileFurnace.maxBurnTime) iCraft.sendProgressBarUpdate(this, 4, this.tileFurnace.maxBurnTime);
|
||||
if(this.lastFirstCrushTime != this.tileFurnace.firstSmeltTime) iCraft.sendProgressBarUpdate(this, 0, this.tileFurnace.firstSmeltTime);
|
||||
if(this.lastSecondCrushTime != this.tileFurnace.secondSmeltTime) iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.secondSmeltTime);
|
||||
if(this.lastBurnTime != this.tileFurnace.maxBurnTime) iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.maxBurnTime);
|
||||
if(this.lastEnergy != this.tileFurnace.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
}
|
||||
|
||||
this.lastCoalTime = this.tileFurnace.coalTime;
|
||||
this.lastCoalTimeLeft = this.tileFurnace.coalTimeLeft;
|
||||
this.lastFirstCrushTime = this.tileFurnace.firstSmeltTime;
|
||||
this.lastSecondCrushTime = this.tileFurnace.secondSmeltTime;
|
||||
this.lastBurnTime = this.tileFurnace.maxBurnTime;
|
||||
this.lastEnergy = this.tileFurnace.getEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2){
|
||||
if(par1 == 0) this.tileFurnace.coalTime = par2;
|
||||
if(par1 == 1) this.tileFurnace.coalTimeLeft = par2;
|
||||
if(par1 == 2) this.tileFurnace.firstSmeltTime = par2;
|
||||
if(par1 == 3) this.tileFurnace.secondSmeltTime = par2;
|
||||
if(par1 == 4) this.tileFurnace.maxBurnTime = par2;
|
||||
if(par1 == 0) this.tileFurnace.firstSmeltTime = par2;
|
||||
if(par1 == 1) this.tileFurnace.secondSmeltTime = par2;
|
||||
if(par1 == 2) this.tileFurnace.maxBurnTime = par2;
|
||||
if(par1 == 3) this.tileFurnace.storage.setEnergyStored(par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,7 +86,7 @@ public class ContainerFurnaceDouble extends Container{
|
|||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
final int inventoryStart = 6;
|
||||
final int inventoryStart = 4;
|
||||
final int inventoryEnd = inventoryStart+26;
|
||||
final int hotbarStart = inventoryEnd+1;
|
||||
final int hotbarEnd = hotbarStart+8;
|
||||
|
@ -110,10 +101,6 @@ public class ContainerFurnaceDouble extends Container{
|
|||
this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1+1, false);
|
||||
this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_2, TileEntityFurnaceDouble.SLOT_INPUT_2+2, false);
|
||||
}
|
||||
|
||||
if(TileEntityFurnace.getItemBurnTime(currentStack) > 0){
|
||||
this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_COAL, TileEntityFurnaceDouble.SLOT_COAL+1, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||
|
|
|
@ -13,7 +13,7 @@ import net.minecraft.inventory.Container;
|
|||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerGrinder extends Container{
|
||||
|
@ -21,18 +21,15 @@ public class ContainerGrinder extends Container{
|
|||
private TileEntityGrinder tileGrinder;
|
||||
private boolean isDouble;
|
||||
|
||||
private int lastCoalTime;
|
||||
private int lastCoalTimeLeft;
|
||||
private int lastFirstCrushTime;
|
||||
private int lastSecondCrushTime;
|
||||
private int lastMaxCrushTime;
|
||||
private int lastEnergyStored;
|
||||
|
||||
public ContainerGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){
|
||||
this.tileGrinder = (TileEntityGrinder)tile;
|
||||
this.isDouble = isDouble;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileGrinder, TileEntityGrinder.SLOT_COAL, this.isDouble ? 80 : 51, 21));
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileGrinder, TileEntityGrinder.SLOT_INPUT_1, this.isDouble ? 51 : 80, 21));
|
||||
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_1_1, this.isDouble ? 37 : 66, 69));
|
||||
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_1_2, this.isDouble ? 64 : 92, 69));
|
||||
|
@ -42,8 +39,6 @@ public class ContainerGrinder extends Container{
|
|||
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69));
|
||||
}
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileGrinder, this.tileGrinder.speedUpgradeSlot, this.isDouble ? 155 : 146, 21));
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 9; j++){
|
||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
||||
|
@ -57,11 +52,10 @@ public class ContainerGrinder extends Container{
|
|||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCraft){
|
||||
super.addCraftingToCrafters(iCraft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime);
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft);
|
||||
iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime);
|
||||
iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.maxCrushTime);
|
||||
if(this.isDouble) iCraft.sendProgressBarUpdate(this, 4, this.tileGrinder.secondCrushTime);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.firstCrushTime);
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.maxCrushTime);
|
||||
if(this.isDouble) iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.secondCrushTime);
|
||||
iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,28 +64,25 @@ public class ContainerGrinder extends Container{
|
|||
for(Object crafter : this.crafters){
|
||||
ICrafting iCraft = (ICrafting)crafter;
|
||||
|
||||
if(this.lastCoalTime != this.tileGrinder.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime);
|
||||
if(this.lastCoalTimeLeft != this.tileGrinder.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft);
|
||||
if(this.lastFirstCrushTime != this.tileGrinder.firstCrushTime) iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime);
|
||||
if(this.lastMaxCrushTime != this.tileGrinder.maxCrushTime) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.maxCrushTime);
|
||||
if(this.isDouble) if(this.lastSecondCrushTime != this.tileGrinder.secondCrushTime) iCraft.sendProgressBarUpdate(this, 4, this.tileGrinder.secondCrushTime);
|
||||
if(this.lastFirstCrushTime != this.tileGrinder.firstCrushTime) iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.firstCrushTime);
|
||||
if(this.lastMaxCrushTime != this.tileGrinder.maxCrushTime) iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.maxCrushTime);
|
||||
if(this.isDouble) if(this.lastSecondCrushTime != this.tileGrinder.secondCrushTime) iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.secondCrushTime);
|
||||
if(this.lastEnergyStored != this.tileGrinder.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
}
|
||||
|
||||
this.lastCoalTime = this.tileGrinder.coalTime;
|
||||
this.lastCoalTimeLeft = this.tileGrinder.coalTimeLeft;
|
||||
this.lastFirstCrushTime = this.tileGrinder.firstCrushTime;
|
||||
this.lastMaxCrushTime = this.tileGrinder.maxCrushTime;
|
||||
if(this.isDouble) this.lastSecondCrushTime = this.tileGrinder.secondCrushTime;
|
||||
this.lastEnergyStored = this.tileGrinder.getEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2){
|
||||
if(par1 == 0) this.tileGrinder.coalTime = par2;
|
||||
if(par1 == 1) this.tileGrinder.coalTimeLeft = par2;
|
||||
if(par1 == 2) this.tileGrinder.firstCrushTime = par2;
|
||||
if(par1 == 3) this.tileGrinder.maxCrushTime = par2;
|
||||
if(this.isDouble && par1 == 4) this.tileGrinder.secondCrushTime = par2;
|
||||
if(par1 == 0) this.tileGrinder.firstCrushTime = par2;
|
||||
if(par1 == 1) this.tileGrinder.maxCrushTime = par2;
|
||||
if(this.isDouble && par1 == 2) this.tileGrinder.secondCrushTime = par2;
|
||||
if(par1 == 3) this.tileGrinder.storage.setEnergyStored(par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,7 +92,7 @@ public class ContainerGrinder extends Container{
|
|||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
final int inventoryStart = this.isDouble ? 8 : 5;
|
||||
final int inventoryStart = this.isDouble ? 6 : 3;
|
||||
final int inventoryEnd = inventoryStart+26;
|
||||
final int hotbarStart = inventoryEnd+1;
|
||||
final int hotbarEnd = hotbarStart+8;
|
||||
|
@ -116,10 +107,6 @@ public class ContainerGrinder extends Container{
|
|||
this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false);
|
||||
if(this.isDouble) this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false);
|
||||
}
|
||||
|
||||
if(TileEntityFurnace.getItemBurnTime(currentStack) > 0){
|
||||
this.mergeItemStack(newStack, TileEntityGrinder.SLOT_COAL, TileEntityGrinder.SLOT_COAL+1, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityOilGenerator;
|
||||
import invtweaks.api.container.InventoryContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerOilGenerator extends Container{
|
||||
|
||||
private TileEntityOilGenerator generator;
|
||||
|
||||
private int lastEnergyStored;
|
||||
private int lastBurnTime;
|
||||
private int lastTankAmount;
|
||||
|
||||
public ContainerOilGenerator(InventoryPlayer inventory, TileEntityBase tile){
|
||||
this.generator = (TileEntityOilGenerator)tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.generator, 0, 98, 74));
|
||||
this.addSlotToContainer(new Slot(this.generator, 1, 98, 43));
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 9; j++){
|
||||
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++){
|
||||
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player){
|
||||
return this.generator.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCraft){
|
||||
super.addCraftingToCrafters(iCraft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.generator.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.generator.currentBurnTime);
|
||||
iCraft.sendProgressBarUpdate(this, 2, this.generator.tank.getFluidAmount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges(){
|
||||
super.detectAndSendChanges();
|
||||
for(Object crafter : this.crafters){
|
||||
ICrafting iCraft = (ICrafting)crafter;
|
||||
|
||||
if(this.lastEnergyStored != this.generator.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.generator.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
if(this.lastBurnTime != this.generator.currentBurnTime) iCraft.sendProgressBarUpdate(this, 1, this.generator.currentBurnTime);
|
||||
if(this.lastTankAmount != this.generator.tank.getFluidAmount()) iCraft.sendProgressBarUpdate(this, 2, this.generator.tank.getFluidAmount());
|
||||
}
|
||||
|
||||
this.lastEnergyStored = this.generator.getEnergyStored(ForgeDirection.UNKNOWN);
|
||||
this.lastBurnTime = this.generator.currentBurnTime;
|
||||
this.lastTankAmount = this.generator.tank.getFluidAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2){
|
||||
if(par1 == 0) this.generator.storage.setEnergyStored(par2);
|
||||
if(par1 == 1) this.generator.currentBurnTime = par2;
|
||||
if(par1 == 2) this.generator.tank.setFluid(new FluidStack(InitBlocks.fluidOil, par2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
final int inventoryStart = 2;
|
||||
final int inventoryEnd = inventoryStart+26;
|
||||
final int hotbarStart = inventoryEnd+1;
|
||||
final int hotbarEnd = hotbarStart+8;
|
||||
|
||||
Slot theSlot = (Slot)this.inventorySlots.get(slot);
|
||||
if(theSlot.getHasStack()){
|
||||
ItemStack currentStack = theSlot.getStack();
|
||||
ItemStack newStack = currentStack.copy();
|
||||
|
||||
if(slot <= hotbarEnd && slot >= inventoryStart){
|
||||
if(currentStack.getItem() == InitItems.itemBucketOil){
|
||||
this.mergeItemStack(newStack, 0, 1, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot <= inventoryEnd && slot >= inventoryStart){
|
||||
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
else if(slot < inventoryStart){
|
||||
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
|
||||
}
|
||||
|
||||
if(newStack.stackSize == 0) theSlot.putStack(null);
|
||||
else theSlot.onSlotChanged();
|
||||
if(newStack.stackSize == currentStack.stackSize) return null;
|
||||
theSlot.onPickupFromSlot(player, newStack);
|
||||
|
||||
return currentStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -12,21 +12,18 @@ import net.minecraft.inventory.Container;
|
|||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@InventoryContainer
|
||||
public class ContainerRepairer extends Container{
|
||||
|
||||
private TileEntityItemRepairer tileRepairer;
|
||||
|
||||
private int lastCoalTime;
|
||||
private int lastCoalTimeLeft;
|
||||
private int lastEnergy;
|
||||
|
||||
public ContainerRepairer(InventoryPlayer inventory, TileEntityBase tile){
|
||||
this.tileRepairer = (TileEntityItemRepairer)tile;
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileRepairer, TileEntityItemRepairer.SLOT_COAL, 80, 21));
|
||||
|
||||
this.addSlotToContainer(new Slot(this.tileRepairer, TileEntityItemRepairer.SLOT_INPUT, 47, 53));
|
||||
this.addSlotToContainer(new SlotOutput(this.tileRepairer, TileEntityItemRepairer.SLOT_OUTPUT, 109, 53));
|
||||
|
||||
|
@ -43,8 +40,7 @@ public class ContainerRepairer extends Container{
|
|||
@Override
|
||||
public void addCraftingToCrafters(ICrafting iCraft){
|
||||
super.addCraftingToCrafters(iCraft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.coalTime);
|
||||
iCraft.sendProgressBarUpdate(this, 1, this.tileRepairer.coalTimeLeft);
|
||||
iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,19 +49,16 @@ public class ContainerRepairer extends Container{
|
|||
for(Object crafter : this.crafters){
|
||||
ICrafting iCraft = (ICrafting)crafter;
|
||||
|
||||
if(this.lastCoalTime != this.tileRepairer.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.coalTime);
|
||||
if(this.lastCoalTimeLeft != this.tileRepairer.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileRepairer.coalTimeLeft);
|
||||
if(this.lastEnergy != this.tileRepairer.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.tileRepairer.getEnergyStored(ForgeDirection.UNKNOWN));
|
||||
}
|
||||
|
||||
this.lastCoalTime = this.tileRepairer.coalTime;
|
||||
this.lastCoalTimeLeft = this.tileRepairer.coalTimeLeft;
|
||||
this.lastEnergy = this.tileRepairer.getEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateProgressBar(int par1, int par2){
|
||||
if(par1 == 0) this.tileRepairer.coalTime = par2;
|
||||
if(par1 == 1) this.tileRepairer.coalTimeLeft = par2;
|
||||
if(par1 == 0) this.tileRepairer.storage.setEnergyStored(par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +68,7 @@ public class ContainerRepairer extends Container{
|
|||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
|
||||
final int inventoryStart = 3;
|
||||
final int inventoryStart = 2;
|
||||
final int inventoryEnd = inventoryStart+26;
|
||||
final int hotbarStart = inventoryEnd+1;
|
||||
final int hotbarEnd = hotbarStart+8;
|
||||
|
@ -89,10 +82,6 @@ public class ContainerRepairer extends Container{
|
|||
if(TileEntityItemRepairer.canBeRepaired(currentStack)){
|
||||
this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false);
|
||||
}
|
||||
|
||||
if(TileEntityFurnace.getItemBurnTime(currentStack) > 0){
|
||||
this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_COAL, TileEntityItemRepairer.SLOT_COAL+1, false);
|
||||
}
|
||||
}
|
||||
|
||||
if(slot <= hotbarEnd && slot >= hotbarStart){
|
||||
|
|
|
@ -26,7 +26,7 @@ public class GuiBreaker extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.breaker.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.breaker.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityCanolaPress;
|
||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiCanolaPress extends GuiContainer{
|
||||
|
||||
private TileEntityCanolaPress press;
|
||||
|
||||
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCanolaPress");
|
||||
|
||||
public GuiCanolaPress(InventoryPlayer inventory, TileEntityBase tile){
|
||||
super(new ContainerCanolaPress(inventory, tile));
|
||||
this.press = (TileEntityCanolaPress)tile;
|
||||
this.xSize = 176;
|
||||
this.ySize = 93+86;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
|
||||
|
||||
if(this.press.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
int i = this.press.getEnergyScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft + 43, this.guiTop+89-i, 176, 29, 16, i);
|
||||
}
|
||||
|
||||
if(this.press.tank.getFluidAmount() > 0){
|
||||
int i = this.press.getTankScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft + 117, this.guiTop+89-i, 192, 29, 16, i);
|
||||
}
|
||||
|
||||
if(this.press.currentProcessTime > 0){
|
||||
int i = this.press.getProcessScaled(29);
|
||||
drawTexturedModalRect(this.guiLeft + 83, this.guiTop+32, 176, 0, 12, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
String text1 = this.press.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.press.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
|
||||
if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
|
||||
String text2 = this.press.tank.getFluidAmount() + "/" + this.press.tank.getCapacity() + " mB " +StatCollector.translateToLocal("fluid.canolaOil");
|
||||
if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text2), x, y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityCoalGenerator;
|
||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiCoalGenerator extends GuiContainer{
|
||||
|
||||
private TileEntityCoalGenerator generator;
|
||||
|
||||
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiCoalGenerator");
|
||||
|
||||
public GuiCoalGenerator(InventoryPlayer inventory, TileEntityBase tile){
|
||||
super(new ContainerCoalGenerator(inventory, tile));
|
||||
this.generator = (TileEntityCoalGenerator)tile;
|
||||
this.xSize = 176;
|
||||
this.ySize = 93+86;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
|
||||
|
||||
if(this.generator.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
int i = this.generator.getEnergyScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
|
||||
}
|
||||
|
||||
if(this.generator.currentBurnTime > 0){
|
||||
int i = this.generator.getBurningScaled(13);
|
||||
this.drawTexturedModalRect(guiLeft+87, guiTop+27+12-i, 176, 96-i, 14, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
String text1 = this.generator.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.generator.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
|
||||
if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@ public class GuiCrafter extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 74, -10, "container." + ModUtil.MOD_ID_LOWER + ".crafting");
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, "container."+ModUtil.MOD_ID_LOWER+".crafting");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,7 @@ public class GuiDropper extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.dropper.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.dropper.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,7 @@ public class GuiFeeder extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 70-5, -10, this.tileFeeder.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileFeeder.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityFermentingBarrel;
|
||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiFermentingBarrel extends GuiContainer{
|
||||
|
||||
private TileEntityFermentingBarrel press;
|
||||
|
||||
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiFermentingBarrel");
|
||||
|
||||
public GuiFermentingBarrel(InventoryPlayer inventory, TileEntityBase tile){
|
||||
super(new ContainerFermentingBarrel(inventory, tile));
|
||||
this.press = (TileEntityFermentingBarrel)tile;
|
||||
this.xSize = 176;
|
||||
this.ySize = 93+86;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.press.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
|
||||
|
||||
if(this.press.canolaTank.getFluidAmount() > 0){
|
||||
int i = this.press.getCanolaTankScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft + 61, this.guiTop+89-i, 192, 29, 16, i);
|
||||
}
|
||||
|
||||
if(this.press.oilTank.getFluidAmount() > 0){
|
||||
int i = this.press.getOilTankScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft + 99, this.guiTop+89-i, 176, 29, 16, i);
|
||||
}
|
||||
|
||||
if(this.press.currentProcessTime > 0){
|
||||
int i = this.press.getProcessScaled(29);
|
||||
drawTexturedModalRect(this.guiLeft+82, this.guiTop+34, 176, 0, 12, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
|
||||
String text1 = this.press.canolaTank.getFluidAmount() + "/" + this.press.canolaTank.getCapacity() + " mB " +StatCollector.translateToLocal("fluid.canolaOil");
|
||||
if(x >= guiLeft+61 && y >= guiTop+6 && x <= guiLeft+76 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
|
||||
String text2 = this.press.oilTank.getFluidAmount() + "/" + this.press.oilTank.getCapacity() + " mB " +StatCollector.translateToLocal("fluid.oil");
|
||||
if(x >= guiLeft+99 && y >= guiTop+6 && x <= guiLeft+114 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text2), x, y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,8 +8,11 @@ import ellpeck.actuallyadditions.util.AssetUtil;
|
|||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiFurnaceDouble extends GuiContainer{
|
||||
|
||||
|
@ -25,7 +28,7 @@ public class GuiFurnaceDouble extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileFurnace.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileFurnace.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,9 +41,9 @@ public class GuiFurnaceDouble extends GuiContainer{
|
|||
this.mc.getTextureManager().bindTexture(resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
|
||||
|
||||
if(this.tileFurnace.coalTime > 0){
|
||||
int i = this.tileFurnace.getCoalTimeToScale(15);
|
||||
this.drawTexturedModalRect(this.guiLeft+80, this.guiTop+5+14-i, 176, 44+14-i, 14, i);
|
||||
if(this.tileFurnace.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
int i = this.tileFurnace.getEnergyScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
|
||||
}
|
||||
if(this.tileFurnace.firstSmeltTime > 0){
|
||||
int i = this.tileFurnace.getFirstTimeToScale(23);
|
||||
|
@ -55,5 +58,9 @@ public class GuiFurnaceDouble extends GuiContainer{
|
|||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
String text = this.tileFurnace.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.tileFurnace.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
|
||||
if(x >= guiLeft+28 && y >= guiTop+6 && x <= guiLeft+43 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text), x, y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ public class GuiGiantChest extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 172-5, -10, this.chest.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.chest.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,8 +8,11 @@ import ellpeck.actuallyadditions.util.AssetUtil;
|
|||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiGrinder extends GuiContainer{
|
||||
|
||||
|
@ -28,7 +31,7 @@ public class GuiGrinder extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileGrinder.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileGrinder.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,9 +44,9 @@ public class GuiGrinder extends GuiContainer{
|
|||
this.mc.getTextureManager().bindTexture(this.isDouble ? resLocDouble : resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
|
||||
|
||||
if(this.tileGrinder.coalTime > 0){
|
||||
int i = this.tileGrinder.getCoalTimeToScale(15);
|
||||
this.drawTexturedModalRect(this.guiLeft+(isDouble ? 80 : 51), this.guiTop+5+14-i, 176, 44+14-i, 14, i);
|
||||
if(this.tileGrinder.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
int i = this.tileGrinder.getEnergyScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft + (isDouble ? 14 : 43), this.guiTop+89-i, 176, (isDouble ? 44 : 23), 16, i);
|
||||
}
|
||||
if(this.tileGrinder.firstCrushTime > 0){
|
||||
int i = this.tileGrinder.getFirstTimeToScale(23);
|
||||
|
@ -60,5 +63,9 @@ public class GuiGrinder extends GuiContainer{
|
|||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
String text = this.tileGrinder.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.tileGrinder.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
|
||||
if((this.isDouble && x >= guiLeft+14 && y >= guiTop+6 && x <= guiLeft+29 && y <= guiTop+88) || (!this.isDouble && x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88)){
|
||||
this.func_146283_a(Collections.singletonList(text), x, y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ public class GuiHandler implements IGuiHandler{
|
|||
|
||||
@Override
|
||||
public Object getServerGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
||||
switch (id){
|
||||
switch(id){
|
||||
case FEEDER_ID:
|
||||
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new ContainerFeeder(entityPlayer.inventory, tileFeeder);
|
||||
|
@ -46,6 +46,18 @@ public class GuiHandler implements IGuiHandler{
|
|||
case DROPPER_ID:
|
||||
TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new ContainerDropper(entityPlayer.inventory, tileDropper);
|
||||
case CANOLA_PRESS_ID:
|
||||
TileEntityBase tilePress = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new ContainerCanolaPress(entityPlayer.inventory, tilePress);
|
||||
case FERMENTING_BARREL_ID:
|
||||
TileEntityBase tileBarrel = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new ContainerFermentingBarrel(entityPlayer.inventory, tileBarrel);
|
||||
case COAL_GENERATOR_ID:
|
||||
TileEntityBase tileGenerator = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new ContainerCoalGenerator(entityPlayer.inventory, tileGenerator);
|
||||
case OIL_GENERATOR_ID:
|
||||
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new ContainerOilGenerator(entityPlayer.inventory, tileOilGen);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -53,7 +65,7 @@ public class GuiHandler implements IGuiHandler{
|
|||
|
||||
@Override
|
||||
public Object getClientGuiElement(int id, EntityPlayer entityPlayer, World world, int x, int y, int z){
|
||||
switch (id){
|
||||
switch(id){
|
||||
case FEEDER_ID:
|
||||
TileEntityBase tileFeeder = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new GuiFeeder(entityPlayer.inventory, tileFeeder);
|
||||
|
@ -86,6 +98,18 @@ public class GuiHandler implements IGuiHandler{
|
|||
case DROPPER_ID:
|
||||
TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new GuiDropper(entityPlayer.inventory, tileDropper);
|
||||
case CANOLA_PRESS_ID:
|
||||
TileEntityBase tilePress = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new GuiCanolaPress(entityPlayer.inventory, tilePress);
|
||||
case FERMENTING_BARREL_ID:
|
||||
TileEntityBase tileBarrel = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new GuiFermentingBarrel(entityPlayer.inventory, tileBarrel);
|
||||
case COAL_GENERATOR_ID:
|
||||
TileEntityBase tileGenerator = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new GuiCoalGenerator(entityPlayer.inventory, tileGenerator);
|
||||
case OIL_GENERATOR_ID:
|
||||
TileEntityBase tileOilGen = (TileEntityBase)world.getTileEntity(x, y, z);
|
||||
return new GuiOilGenerator(entityPlayer.inventory, tileOilGen);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -102,6 +126,10 @@ public class GuiHandler implements IGuiHandler{
|
|||
public static final int INPUTTER_ADVANCED_ID = 8;
|
||||
public static final int BREAKER_ID = 9;
|
||||
public static final int DROPPER_ID = 10;
|
||||
public static final int CANOLA_PRESS_ID = 11;
|
||||
public static final int FERMENTING_BARREL_ID = 12;
|
||||
public static final int COAL_GENERATOR_ID = 13;
|
||||
public static final int OIL_GENERATOR_ID = 14;
|
||||
|
||||
public static void init(){
|
||||
Util.logInfo("Initializing GuiHandler...");
|
||||
|
|
|
@ -62,7 +62,7 @@ public class GuiInputter extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, this.isAdvanced ? 105-5 : 93-5, -10, this.tileInputter.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileInputter.getInventoryName());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package ellpeck.actuallyadditions.inventory;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityBase;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityOilGenerator;
|
||||
import ellpeck.actuallyadditions.util.AssetUtil;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiOilGenerator extends GuiContainer{
|
||||
|
||||
private TileEntityOilGenerator generator;
|
||||
|
||||
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiOilGenerator");
|
||||
|
||||
public GuiOilGenerator(InventoryPlayer inventory, TileEntityBase tile){
|
||||
super(new ContainerOilGenerator(inventory, tile));
|
||||
this.generator = (TileEntityOilGenerator)tile;
|
||||
this.xSize = 176;
|
||||
this.ySize = 93+86;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.generator.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
|
||||
|
||||
if(this.generator.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
int i = this.generator.getEnergyScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft+43, this.guiTop+89-i, 176, 0, 16, i);
|
||||
}
|
||||
|
||||
if(this.generator.tank.getFluidAmount() > 0){
|
||||
int i = this.generator.getTankScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft+117, this.guiTop+89-i, 192, 0, 16, i);
|
||||
}
|
||||
|
||||
if(this.generator.currentBurnTime > 0){
|
||||
int i = this.generator.getBurningScaled(13);
|
||||
this.drawTexturedModalRect(guiLeft+72, guiTop+44+12-i, 176, 96-i, 14, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
String text1 = this.generator.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.generator.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
|
||||
if(x >= guiLeft+43 && y >= guiTop+6 && x <= guiLeft+58 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text1), x, y);
|
||||
}
|
||||
String text2 = this.generator.tank.getFluidAmount() + "/" + this.generator.tank.getCapacity() + " mB " +StatCollector.translateToLocal("fluid.oil");
|
||||
if(x >= guiLeft+117 && y >= guiTop+6 && x <= guiLeft+132 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text2), x, y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,8 +8,11 @@ import ellpeck.actuallyadditions.util.AssetUtil;
|
|||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiRepairer extends GuiContainer{
|
||||
|
||||
|
@ -25,7 +28,7 @@ public class GuiRepairer extends GuiContainer{
|
|||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int x, int y){
|
||||
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileRepairer.getInventoryName());
|
||||
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.tileRepairer.getInventoryName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -38,9 +41,9 @@ public class GuiRepairer extends GuiContainer{
|
|||
this.mc.getTextureManager().bindTexture(resLoc);
|
||||
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
|
||||
|
||||
if(this.tileRepairer.coalTime > 0){
|
||||
int i = this.tileRepairer.getCoalTimeToScale(15);
|
||||
this.drawTexturedModalRect(this.guiLeft+80, this.guiTop+5+14-i, 176, 44+14-i, 14, i);
|
||||
if(this.tileRepairer.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
int i = this.tileRepairer.getEnergyScaled(83);
|
||||
drawTexturedModalRect(this.guiLeft+28, this.guiTop+89-i, 176, 44, 16, i);
|
||||
}
|
||||
if(TileEntityItemRepairer.canBeRepaired(this.tileRepairer.slots[TileEntityItemRepairer.SLOT_INPUT])){
|
||||
int i = this.tileRepairer.getItemDamageToScale(22);
|
||||
|
@ -51,5 +54,9 @@ public class GuiRepairer extends GuiContainer{
|
|||
@Override
|
||||
public void drawScreen(int x, int y, float f){
|
||||
super.drawScreen(x, y, f);
|
||||
String text = this.tileRepairer.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.tileRepairer.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
|
||||
if(x >= guiLeft+28 && y >= guiTop+6 && x <= guiLeft+43 && y <= guiTop+88){
|
||||
this.func_146283_a(Collections.singletonList(text), x, y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package ellpeck.actuallyadditions.items;
|
||||
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.items.tools.*;
|
||||
import ellpeck.actuallyadditions.material.InitItemMaterials;
|
||||
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
|
||||
|
@ -10,6 +13,8 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
public class InitItems{
|
||||
|
||||
|
@ -39,16 +44,35 @@ public class InitItems{
|
|||
public static Item itemSwordObsidian;
|
||||
public static Item itemHoeObsidian;
|
||||
|
||||
public static Item itemSpeedUpgrade;
|
||||
|
||||
public static Item itemHairyBall;
|
||||
public static Item itemRiceSeed;
|
||||
public static Item itemCanolaSeed;
|
||||
public static Item itemResonantRice;
|
||||
public static Item itemBucketOil;
|
||||
public static Item itemBucketCanolaOil;
|
||||
|
||||
public static Item itemPhantomConnector;
|
||||
|
||||
public static void init(){
|
||||
Util.logInfo("Initializing Items...");
|
||||
|
||||
itemBucketOil = new ItemBucketAA(InitBlocks.blockOil, "itemBucketOil");
|
||||
ItemUtil.register(itemBucketOil);
|
||||
FluidContainerRegistry.registerFluidContainer(InitBlocks.fluidOil, new ItemStack(itemBucketOil), FluidContainerRegistry.EMPTY_BUCKET);
|
||||
|
||||
itemBucketCanolaOil = new ItemBucketAA(InitBlocks.blockCanolaOil, "itemBucketCanolaOil");
|
||||
ItemUtil.register(itemBucketCanolaOil);
|
||||
FluidContainerRegistry.registerFluidContainer(InitBlocks.fluidCanolaOil, new ItemStack(itemBucketCanolaOil), FluidContainerRegistry.EMPTY_BUCKET);
|
||||
|
||||
itemFertilizer = new ItemFertilizer();
|
||||
ItemUtil.register(itemFertilizer);
|
||||
|
||||
itemPhantomConnector = new ItemPhantomConnector();
|
||||
ItemUtil.register(itemPhantomConnector);
|
||||
|
||||
itemResonantRice = new ItemResonantRice();
|
||||
ItemUtil.register(itemResonantRice);
|
||||
|
||||
itemMisc = new ItemMisc();
|
||||
ItemUtil.register(itemMisc, ItemMisc.allMiscItems);
|
||||
|
||||
|
@ -82,13 +106,16 @@ public class InitItems{
|
|||
itemPotionRingAdvanced = new ItemPotionRing(true);
|
||||
ItemUtil.register(itemPotionRingAdvanced);
|
||||
|
||||
itemSpeedUpgrade = new ItemUpgrade(ItemUpgrade.UpgradeType.SPEED, "itemUpgradeSpeed", 2+3);
|
||||
ItemUtil.register(itemSpeedUpgrade);
|
||||
|
||||
itemHairyBall = new ItemHairyBall();
|
||||
ItemUtil.register(itemHairyBall);
|
||||
HairyBallHandler.init();
|
||||
|
||||
itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, new ItemStack(itemFoods, 1, TheFoods.RICE.ordinal()));
|
||||
ItemUtil.register(itemRiceSeed);
|
||||
|
||||
itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Crop, new ItemStack(itemMisc, 1, TheMiscItems.CANOLA.ordinal()));
|
||||
ItemUtil.register(itemCanolaSeed);
|
||||
|
||||
itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare);
|
||||
itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare);
|
||||
itemShovelEmerald = new ItemShovelAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemShovelEmerald", EnumRarity.rare);
|
||||
|
|
|
@ -5,37 +5,41 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemUpgrade extends Item implements INameableItem{
|
||||
public class ItemBucketAA extends ItemBucket implements INameableItem{
|
||||
|
||||
private final String name;
|
||||
public UpgradeType type;
|
||||
private int textAmount;
|
||||
private String name;
|
||||
|
||||
public ItemUpgrade(UpgradeType type, String name, int textAmount){
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.textAmount = textAmount;
|
||||
public ItemBucketAA(Block block, String unlocName){
|
||||
super(block);
|
||||
this.name = unlocName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
return EnumRarity.uncommon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getContainerItem(){
|
||||
return Items.bucket;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
ItemUtil.addInformation(this, list, this.textAmount, "");
|
||||
ItemUtil.addInformation(this, list, 1, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,8 +62,4 @@ public class ItemUpgrade extends Item implements INameableItem{
|
|||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
public enum UpgradeType{
|
||||
SPEED
|
||||
}
|
||||
}
|
|
@ -31,6 +31,7 @@ public class ItemHairyBall extends Item implements INameableItem{
|
|||
player.worldObj.spawnEntityInWorld(entityItem);
|
||||
}
|
||||
stack.stackSize--;
|
||||
world.playSoundAtEntity(player, "random.pop", 0.2F, new Random().nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
package ellpeck.actuallyadditions.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.tile.TileEntityPhantomface;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||
import ellpeck.actuallyadditions.util.KeyUtil;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPhantomConnector extends Item implements INameableItem{
|
||||
|
||||
public ItemPhantomConnector(){
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){
|
||||
if(!world.isRemote){
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if(tile != null && tile instanceof TileEntityPhantomface && this.getStoredConnection(stack) != null){
|
||||
TileEntity stored = this.getStoredConnection(stack);
|
||||
if(stored != null && stored.getWorldObj().getTileEntity(stored.xCoord, stored.yCoord, stored.zCoord) == stored){
|
||||
((TileEntityPhantomface)tile).boundTile = stored.getWorldObj().getTileEntity(stored.xCoord, stored.yCoord, stored.zCoord);
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.connected.desc")));
|
||||
this.clearStorage(stack);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(tile != null && !(tile instanceof TileEntityPhantomface) && tile instanceof IInventory){
|
||||
this.storeConnection(stack, tile);
|
||||
player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.stored.desc")));
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
if(tile instanceof TileEntityPhantomface) player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.noBound.desc")));
|
||||
else player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.notInventory.desc")));
|
||||
}
|
||||
}
|
||||
return super.onItemUse(stack, player, world, x, y, z, par7, par8, par9, par10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
|
||||
if(this.getStoredConnection(stack) == null) this.clearStorage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
||||
if(KeyUtil.isControlPressed()) this.clearStorage(stack);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public TileEntity getStoredConnection(ItemStack stack){
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag != null){
|
||||
int x = tag.getInteger("XCoordOfTileStored");
|
||||
int y = tag.getInteger("YCoordOfTileStored");
|
||||
int z = tag.getInteger("ZCoordOfTileStored");
|
||||
World world = DimensionManager.getWorld(tag.getInteger("WorldOfTileStored"));
|
||||
|
||||
return world.getTileEntity(x, y, z);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void storeConnection(ItemStack stack, TileEntity tile){
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if(tag == null) tag = new NBTTagCompound();
|
||||
|
||||
tag.setInteger("XCoordOfTileStored", tile.xCoord);
|
||||
tag.setInteger("YCoordOfTileStored", tile.yCoord);
|
||||
tag.setInteger("ZCoordOfTileStored", tile.zCoord);
|
||||
tag.setInteger("WorldOfTileStored", tile.getWorldObj().provider.dimensionId);
|
||||
|
||||
stack.setTagCompound(tag);
|
||||
}
|
||||
|
||||
public void clearStorage(ItemStack stack){
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
ItemUtil.addInformation(this, list, 2, "");
|
||||
TileEntity tile = this.getStoredConnection(stack);
|
||||
if(tile != null){
|
||||
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.boundTo.desc") + ":");
|
||||
list.add("X: " + tile.xCoord);
|
||||
list.add("Y: " + tile.yCoord);
|
||||
list.add("Z: " + tile.zCoord);
|
||||
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".phantom.inWorld.desc") + " " + tile.getWorldObj().provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "itemPhantomConnector";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getShareTag(){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package ellpeck.actuallyadditions.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.util.*;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemResonantRice extends Item implements INameableItem{
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
||||
if(!world.isRemote){
|
||||
stack.stackSize--;
|
||||
world.createExplosion(null, player.posX, player.posY, player.posZ, 0.5F, true);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
ItemUtil.addInformation(this, list, 1, "");
|
||||
if(KeyUtil.isShiftPressed() && OreDictionary.getOres("nuggetEnderium").size() == 0) list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemResonantRice.uncraftable.desc"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return "itemResonantRice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
}
|
130
src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java
Normal file
130
src/main/java/ellpeck/actuallyadditions/items/ItemSeed.java
Normal file
|
@ -0,0 +1,130 @@
|
|||
package ellpeck.actuallyadditions.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.BlockPlant;
|
||||
import ellpeck.actuallyadditions.util.INameableItem;
|
||||
import ellpeck.actuallyadditions.util.ItemUtil;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemSeed extends Item implements IPlantable, INameableItem{
|
||||
|
||||
public Block plant;
|
||||
public Block soilBlock;
|
||||
public EnumPlantType type;
|
||||
public String name;
|
||||
|
||||
public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, ItemStack returnItem){
|
||||
this.name = name;
|
||||
this.plant = plant;
|
||||
this.soilBlock = soilBlock;
|
||||
this.type = type;
|
||||
((BlockPlant)this.plant).seedItem = this;
|
||||
((BlockPlant)this.plant).returnItem = returnItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){
|
||||
if(this.type == EnumPlantType.Water || hitSide != 1) return false;
|
||||
else if(player.canPlayerEdit(x, y, z, hitSide, stack) && player.canPlayerEdit(x, y + 1, z, hitSide, stack)){
|
||||
if(((BlockPlant)this.plant).canPlaceBlockOn(world.getBlock(x, y, z)) && world.isAirBlock(x, y + 1, z)){
|
||||
world.setBlock(x, y + 1, z, this.plant);
|
||||
stack.stackSize--;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
||||
if(this.type == EnumPlantType.Water){
|
||||
MovingObjectPosition pos = this.getMovingObjectPositionFromPlayer(world, player, true);
|
||||
if(pos != null){
|
||||
if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK){
|
||||
int i = pos.blockX;
|
||||
int j = pos.blockY;
|
||||
int k = pos.blockZ;
|
||||
|
||||
if(world.canMineBlock(player, i, j, k) && player.canPlayerEdit(i, j, k, pos.sideHit, stack)){
|
||||
if(world.getBlock(i, j, k).getMaterial() == Material.water && world.getBlockMetadata(i, j, k) == 0 && world.isAirBlock(i, j + 1, k)){
|
||||
BlockSnapshot snap = BlockSnapshot.getBlockSnapshot(world, i, j+1, k);
|
||||
world.setBlock(i, j + 1, k, this.plant);
|
||||
if(ForgeEventFactory.onPlayerBlockPlace(player, snap, ForgeDirection.UP).isCanceled()){
|
||||
snap.restore(true, false);
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
stack.stackSize--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.rare;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
|
||||
ItemUtil.addInformation(this, list, 1, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(ItemStack stack, int pass){
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconReg){
|
||||
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z){
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getPlant(IBlockAccess world, int x, int y, int z){
|
||||
return this.plant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlantMetadata(IBlockAccess world, int x, int y, int z){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOredictName(){
|
||||
return this.getName();
|
||||
}
|
||||
}
|
|
@ -23,7 +23,9 @@ public enum TheFoods implements INameableItem{
|
|||
BIG_COOKIE("BigCookie", 6, 1F, false, 20, EnumRarity.uncommon, "foodBigCookie"),
|
||||
HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.common, "foodHamburger"),
|
||||
PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.uncommon, "foodPizza"),
|
||||
BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common, "foodBaguette");
|
||||
BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common, "foodBaguette"),
|
||||
RICE("Rice", 2, 1F, false, 10, EnumRarity.uncommon, "foodRice"),
|
||||
RICE_BREAD("RiceBread", 8, 3F, false, 25, EnumRarity.uncommon, "foodRiceBread");
|
||||
|
||||
public static void setReturnItems(){
|
||||
SPAGHETTI.returnItem = new ItemStack(Items.bowl);
|
||||
|
|
|
@ -5,12 +5,12 @@ import net.minecraft.item.EnumRarity;
|
|||
|
||||
public enum TheJams implements INameableItem{
|
||||
|
||||
CU_BA_RA("CuBaRa", 20, 5F, EnumRarity.rare, "jamCuBaRa", 5, 12, 12595273),
|
||||
GRA_KI_BA("GraKiBa", 20, 5F, EnumRarity.rare, "jamGraKiBa", 16, 13, 5492820),
|
||||
PL_AP_LE("PlApLe", 20, 5F, EnumRarity.rare, "jamPlApLe", 15, 3, 13226009),
|
||||
CH_AP_CI("ChApCi", 20, 5F, EnumRarity.rare, "jamChApCi", 10, 1, 13189222),
|
||||
HO_ME_KI("HoMeKi", 20, 5F, EnumRarity.rare, "jamHoMeKi", 10, 14, 2031360),
|
||||
PI_CO("PiCo", 20, 5F, EnumRarity.rare, "jamPiCo", 9, 1, 16056203);
|
||||
CU_BA_RA("CuBaRa", 4, 5F, EnumRarity.rare, "jamCuBaRa", 5, 12, 12595273),
|
||||
GRA_KI_BA("GraKiBa", 4, 5F, EnumRarity.rare, "jamGraKiBa", 16, 13, 5492820),
|
||||
PL_AP_LE("PlApLe", 4, 5F, EnumRarity.rare, "jamPlApLe", 15, 3, 13226009),
|
||||
CH_AP_CI("ChApCi", 4, 5F, EnumRarity.rare, "jamChApCi", 10, 1, 13189222),
|
||||
HO_ME_KI("HoMeKi", 4, 5F, EnumRarity.rare, "jamHoMeKi", 10, 14, 2031360),
|
||||
PI_CO("PiCo", 4, 5F, EnumRarity.rare, "jamPiCo", 9, 1, 16056203);
|
||||
|
||||
public final String name;
|
||||
public final String oredictName;
|
||||
|
|
|
@ -13,7 +13,12 @@ public enum TheMiscItems implements INameableItem{
|
|||
QUARTZ("BlackQuartz", EnumRarity.epic, "gemQuartzBlack"),
|
||||
RING("Ring", EnumRarity.uncommon, "itemRing"),
|
||||
COIL("Coil", EnumRarity.common, "itemCoilBasic"),
|
||||
COIL_ADVANCED("CoilAdvanced", EnumRarity.uncommon, "itemCoilAdvanced");
|
||||
COIL_ADVANCED("CoilAdvanced", EnumRarity.uncommon, "itemCoilAdvanced"),
|
||||
RICE_DOUGH("RiceDough", EnumRarity.uncommon, "itemRiceDough"),
|
||||
TINY_COAL("TinyCoal", EnumRarity.common, "itemTinyCoal"),
|
||||
TINY_CHAR("TinyCharcoal", EnumRarity.common, "itemTinyChar"),
|
||||
RICE_SLIME("RiceSlime", EnumRarity.uncommon, "slimeball"),
|
||||
CANOLA("Canola", EnumRarity.uncommon, "itemCanola");
|
||||
|
||||
public final String name;
|
||||
public final String oredictName;
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
package ellpeck.actuallyadditions.nei;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
|
||||
public class CompostRecipeHandler extends TemplateRecipeHandler{
|
||||
|
||||
public static final String NAME = "compost";
|
||||
|
||||
public CompostRecipeHandler(){
|
||||
super();
|
||||
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
|
||||
}
|
||||
|
||||
public class CachedCompostRecipe extends CachedRecipe{
|
||||
|
||||
public PositionedStack result;
|
||||
public PositionedStack input;
|
||||
public int chance;
|
||||
|
||||
public CachedCompostRecipe(ItemStack input, ItemStack result){
|
||||
this.result = new PositionedStack(result, 67+32, 19);
|
||||
this.input = new PositionedStack(input, 5+32, 19);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient(){
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult(){
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage(){
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName(){
|
||||
return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects(){
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(31+32, 18, 22, 16), NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results){
|
||||
if(outputId.equals(NAME) && getClass() == CompostRecipeHandler.class){
|
||||
arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue())));
|
||||
}
|
||||
else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result){
|
||||
if(NEIServerUtils.areStacksSameType(new ItemStack(InitItems.itemFertilizer), result)) arecipes.add(new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient){
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), ingredient)){
|
||||
CachedCompostRecipe theRecipe = new CachedCompostRecipe(new ItemStack(InitItems.itemMisc, ConfigIntValues.COMPOST_AMOUNT.getValue(), TheMiscItems.MASHED_FOOD.ordinal()), new ItemStack(InitItems.itemFertilizer, ConfigIntValues.COMPOST_AMOUNT.getValue()));
|
||||
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
|
||||
arecipes.add(theRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture(){
|
||||
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEICompost.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(32, 0, 0, 0, 96, 60);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier(){
|
||||
return NAME;
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package ellpeck.actuallyadditions.nei;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
|
@ -11,23 +10,18 @@ import ellpeck.actuallyadditions.recipe.GrinderRecipes;
|
|||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class CrusherRecipeHandler extends TemplateRecipeHandler{
|
||||
|
||||
public static final String NAME = "crushing";
|
||||
public static final String FUEL = "fuel";
|
||||
|
||||
public static ArrayList<Fuel> fuels;
|
||||
|
||||
public CrusherRecipeHandler(){
|
||||
super();
|
||||
|
@ -59,15 +53,9 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
|
|||
return resultOne;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getOtherStack(){
|
||||
return fuels.get((cycleticks / 48) % fuels.size()).stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks(){
|
||||
ArrayList<PositionedStack> list = new ArrayList<PositionedStack>();
|
||||
list.add(this.getOtherStack());
|
||||
if(this.resultTwo != null) list.add(this.resultTwo);
|
||||
return list;
|
||||
}
|
||||
|
@ -78,20 +66,8 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
|
|||
return 1;
|
||||
}
|
||||
|
||||
public static class Fuel{
|
||||
|
||||
public Fuel(ItemStack in, int burnTime){
|
||||
this.stack = new PositionedStack(in, 51, 21, false);
|
||||
this.burnTime = burnTime;
|
||||
}
|
||||
|
||||
public PositionedStack stack;
|
||||
public int burnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects(){
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(51, 5, 14, 14), FUEL));
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), NAME));
|
||||
}
|
||||
|
||||
|
@ -105,12 +81,6 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
|
|||
return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TemplateRecipeHandler newInstance(){
|
||||
if (fuels == null || fuels.isEmpty()) findFuels();
|
||||
return super.newInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results){
|
||||
if(outputId.equals(NAME) && getClass() == CrusherRecipeHandler.class){
|
||||
|
@ -130,12 +100,6 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients){
|
||||
if (inputId.equals(FUEL) && getClass() == CrusherRecipeHandler.class) loadCraftingRecipes(NAME);
|
||||
else super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient){
|
||||
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.instance().recipes;
|
||||
|
@ -157,12 +121,11 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
|
|||
public void drawBackground(int recipeIndex){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(49, 5, 49, 5, 66, 86);
|
||||
GuiDraw.drawTexturedModalRect(60, 13, 60, 13, 56, 79);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe){
|
||||
drawProgressBar(51, 5, 176, 44, 14, 14, 48, 7);
|
||||
drawProgressBar(80, 40, 176, 0, 24, 23, 48, 1);
|
||||
|
||||
CachedCrush crush = (CachedCrush)this.arecipes.get(recipe);
|
||||
|
@ -173,28 +136,6 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
|
|||
}
|
||||
}
|
||||
|
||||
private static Set<Item> excludedFuels(){
|
||||
Set<Item> theFuels = new HashSet<Item>();
|
||||
theFuels.add(Item.getItemFromBlock(Blocks.brown_mushroom));
|
||||
theFuels.add(Item.getItemFromBlock(Blocks.red_mushroom));
|
||||
theFuels.add(Item.getItemFromBlock(Blocks.standing_sign));
|
||||
theFuels.add(Item.getItemFromBlock(Blocks.wall_sign));
|
||||
theFuels.add(Item.getItemFromBlock(Blocks.wooden_door));
|
||||
theFuels.add(Item.getItemFromBlock(Blocks.trapped_chest));
|
||||
return theFuels;
|
||||
}
|
||||
|
||||
private static void findFuels(){
|
||||
fuels = new ArrayList<Fuel>();
|
||||
Set<Item> theFuels = excludedFuels();
|
||||
for(ItemStack item : ItemList.items){
|
||||
if(!theFuels.contains(item.getItem())){
|
||||
int burnTime = TileEntityFurnace.getItemBurnTime(item);
|
||||
if(burnTime > 0) fuels.add(new Fuel(item.copy(), burnTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier(){
|
||||
return NAME;
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
package ellpeck.actuallyadditions.nei;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.StringUtil;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
public class HairyBallRecipeHandler extends TemplateRecipeHandler{
|
||||
|
||||
public static final String NAME = "ballOfHair";
|
||||
|
||||
public HairyBallRecipeHandler(){
|
||||
super();
|
||||
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
|
||||
}
|
||||
|
||||
public class CachedBallRecipe extends CachedRecipe{
|
||||
|
||||
public PositionedStack result;
|
||||
public PositionedStack input;
|
||||
public int chance;
|
||||
|
||||
public CachedBallRecipe(ItemStack input, ItemStack result, int chance){
|
||||
this.result = new PositionedStack(result, 67+32, 19);
|
||||
this.chance = chance;
|
||||
this.input = new PositionedStack(input, 5+32, 19);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getIngredient(){
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult(){
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage(){
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiContainer> getGuiClass(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName(){
|
||||
return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects(){
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(31+32, 18, 22, 16), NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results){
|
||||
if(outputId.equals(NAME) && getClass() == HairyBallRecipeHandler.class){
|
||||
ArrayList<HairyBallHandler.Return> recipes = HairyBallHandler.returns;
|
||||
for(HairyBallHandler.Return recipe : recipes){
|
||||
arecipes.add(new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight));
|
||||
}
|
||||
}
|
||||
else super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result){
|
||||
ArrayList<HairyBallHandler.Return> recipes = HairyBallHandler.returns;
|
||||
for(HairyBallHandler.Return recipe : recipes){
|
||||
if(NEIServerUtils.areStacksSameType(recipe.returnItem, result)) arecipes.add(new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient){
|
||||
ArrayList<HairyBallHandler.Return> recipes = HairyBallHandler.returns;
|
||||
for(HairyBallHandler.Return recipe : recipes){
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.inputItem, ingredient)){
|
||||
CachedBallRecipe theRecipe = new CachedBallRecipe(recipe.inputItem, recipe.returnItem, recipe.itemWeight);
|
||||
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.input), ingredient);
|
||||
arecipes.add(theRecipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture(){
|
||||
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiNEIHairyBall.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipeIndex){
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GuiDraw.changeTexture(getGuiTexture());
|
||||
GuiDraw.drawTexturedModalRect(32, 0, 0, 0, 96, 60);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int rec){
|
||||
CachedBallRecipe recipe = (CachedBallRecipe)this.arecipes.get(rec);
|
||||
if(recipe.result != null){
|
||||
int secondChance = recipe.chance;
|
||||
String secondString = secondChance + "%";
|
||||
GuiDraw.drawString(secondString, 65+32, 48, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverlayIdentifier(){
|
||||
return NAME;
|
||||
}
|
||||
}
|
|
@ -17,9 +17,16 @@ public class NEIActuallyAdditionsConfig implements IConfigureNEI{
|
|||
API.registerRecipeHandler(crusherRecipeHandler);
|
||||
API.registerUsageHandler(crusherRecipeHandler);
|
||||
|
||||
//TODO Re-add
|
||||
API.hideItem(new ItemStack(InitBlocks.blockHeatCollector));
|
||||
API.hideItem(new ItemStack(InitBlocks.blockFurnaceSolar));
|
||||
HairyBallRecipeHandler ballRecipeHandler = new HairyBallRecipeHandler();
|
||||
API.registerRecipeHandler(ballRecipeHandler);
|
||||
API.registerUsageHandler(ballRecipeHandler);
|
||||
|
||||
CompostRecipeHandler compostRecipeHandler = new CompostRecipeHandler();
|
||||
API.registerRecipeHandler(compostRecipeHandler);
|
||||
API.registerUsageHandler(compostRecipeHandler);
|
||||
|
||||
API.hideItem(new ItemStack(InitBlocks.blockRice));
|
||||
API.hideItem(new ItemStack(InitBlocks.blockCanola));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
package ellpeck.actuallyadditions.recipe;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.util.Util;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class FuelHandler implements IFuelHandler{
|
||||
|
||||
private static HashMap<Pair<Item, Integer>, Integer> fuelList = new HashMap<Pair<Item, Integer>, Integer>();
|
||||
|
||||
public static void init(){
|
||||
Util.logInfo("Initializing Fuelstuffs...");
|
||||
|
||||
GameRegistry.registerFuelHandler(new FuelHandler());
|
||||
setFuelValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBurnTime(ItemStack fuel){
|
||||
return getFuelValue(fuel);
|
||||
}
|
||||
|
||||
public static void setFuelValues(){
|
||||
addFuel(InitItems.itemMisc, TheMiscItems.TINY_CHAR.ordinal(), 200);
|
||||
addFuel(InitItems.itemMisc, TheMiscItems.TINY_COAL.ordinal(), 200);
|
||||
addFuel(InitBlocks.blockMisc, TheMiscBlocks.CHARCOAL_BLOCK.ordinal(), 16000);
|
||||
}
|
||||
|
||||
private static void addFuel(Item item, int metadata, int value){
|
||||
fuelList.put(Pair.of(item, metadata), value);
|
||||
}
|
||||
|
||||
private static void addFuel(Item item, int value){
|
||||
addFuel(item, 0, value);
|
||||
}
|
||||
|
||||
private static void addFuel(Block block, int metadata, int value){
|
||||
addFuel(Item.getItemFromBlock(block), metadata, value);
|
||||
}
|
||||
|
||||
private static void addFuel(Block block, int value){
|
||||
addFuel(Item.getItemFromBlock(block), 0, value);
|
||||
}
|
||||
|
||||
private static int getFuelValue(ItemStack stack){
|
||||
if(stack != null && stack.getItem() != null){
|
||||
Pair<Item, Integer> pair = Pair.of(stack.getItem(), stack.getItemDamage());
|
||||
|
||||
if(fuelList.containsKey(pair)){
|
||||
return fuelList.get(pair);
|
||||
}
|
||||
else{
|
||||
pair = Pair.of(stack.getItem(), 0);
|
||||
if(fuelList.containsKey(pair)){
|
||||
return fuelList.get(pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -41,10 +41,6 @@ public class GrinderRecipes{
|
|||
}
|
||||
}
|
||||
|
||||
public void registerRecipe(String input, String outputOne){
|
||||
this.registerRecipe(input, outputOne, "", 0, 1);
|
||||
}
|
||||
|
||||
public void registerRecipe(ItemStack input, ItemStack outputOne){
|
||||
this.registerRecipe(input, outputOne, null, 0);
|
||||
}
|
||||
|
@ -78,6 +74,8 @@ public class GrinderRecipes{
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(containsInput && containsOutput) break;
|
||||
}
|
||||
return containsInput && containsOutput;
|
||||
}
|
||||
|
|
|
@ -46,10 +46,12 @@ public class HairyBallHandler{
|
|||
public static class Return extends WeightedRandom.Item{
|
||||
|
||||
public ItemStack returnItem;
|
||||
public ItemStack inputItem;
|
||||
|
||||
public Return(ItemStack returnItem, int chance){
|
||||
super(chance);
|
||||
this.returnItem = returnItem;
|
||||
this.inputItem = new ItemStack(InitItems.itemHairyBall);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
public interface IPowerAcceptor{
|
||||
|
||||
void setBlockMetadataToOn();
|
||||
|
||||
void setPower(int power);
|
||||
|
||||
void setItemPower(int power);
|
||||
|
||||
int getItemPower();
|
||||
}
|
|
@ -27,6 +27,11 @@ public class TileEntityBase extends TileEntity{
|
|||
GameRegistry.registerTileEntity(TileEntityInputter.TileEntityInputterAdvanced.class, ModUtil.MOD_ID_LOWER + ":tileEntityInputterAdvanced");
|
||||
GameRegistry.registerTileEntity(TileEntityBreaker.TileEntityPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityPlacer");
|
||||
GameRegistry.registerTileEntity(TileEntityGrinder.TileEntityGrinderDouble.class, ModUtil.MOD_ID_LOWER + ":tileEntityGrinderDouble");
|
||||
GameRegistry.registerTileEntity(TileEntityCanolaPress.class, ModUtil.MOD_ID_LOWER + ":tileEntityCanolaPress");
|
||||
GameRegistry.registerTileEntity(TileEntityFermentingBarrel.class, ModUtil.MOD_ID_LOWER + ":tileEntityFermentingBarrel");
|
||||
GameRegistry.registerTileEntity(TileEntityOilGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityOilGenerator");
|
||||
GameRegistry.registerTileEntity(TileEntityCoalGenerator.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoalGenerator");
|
||||
GameRegistry.registerTileEntity(TileEntityPhantomface.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomface");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityCanolaPress extends TileEntityInventoryBase implements IEnergyReceiver, IFluidHandler{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(40000, energyUsedPerTick+50);
|
||||
|
||||
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
||||
public static int energyUsedPerTick = ConfigIntValues.PRESS_ENERGY_USED.getValue();
|
||||
public int mbProducedPerCanola = ConfigIntValues.PRESS_MB_PRODUCED.getValue();
|
||||
|
||||
public int maxTimeProcessing = ConfigIntValues.PRESS_PROCESSING_TIME.getValue();
|
||||
public int currentProcessTime;
|
||||
|
||||
public TileEntityCanolaPress(){
|
||||
super(3, "canolaPress");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
if(this.isCanola(0) && this.storage.getEnergyStored() >= energyUsedPerTick && this.mbProducedPerCanola <= this.tank.getCapacity()-this.tank.getFluidAmount()){
|
||||
this.currentProcessTime++;
|
||||
if(this.currentProcessTime >= this.maxTimeProcessing){
|
||||
this.currentProcessTime = 0;
|
||||
|
||||
this.slots[0].stackSize--;
|
||||
if(this.slots[0].stackSize == 0) this.slots[0] = null;
|
||||
|
||||
this.tank.fill(new FluidStack(InitBlocks.fluidCanolaOil, mbProducedPerCanola), true);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
else this.currentProcessTime = 0;
|
||||
|
||||
if(this.slots[1] != null && this.slots[1].getItem() == Items.bucket && this.slots[2] == null){
|
||||
if(this.tank.getFluidAmount() > 0 && this.tank.getFluid().getFluid() == InitBlocks.fluidCanolaOil && this.tank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){
|
||||
this.slots[2] = new ItemStack(InitItems.itemBucketCanolaOil);
|
||||
this.slots[1].stackSize--;
|
||||
if(this.slots[1].stackSize == 0) this.slots[1] = null;
|
||||
this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.currentProcessTime > 0) this.storage.extractEnergy(energyUsedPerTick, false);
|
||||
|
||||
if(this.tank.getFluidAmount() > 0){
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, this.tank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, this.tank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCanola(int slot){
|
||||
return this.slots[slot] != null && this.slots[slot].getItem() == InitItems.itemMisc && this.slots[slot].getItemDamage() == TheMiscItems.CANOLA.ordinal();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getTankScaled(int i){
|
||||
return this.tank.getFluidAmount() * i / this.tank.getCapacity();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProcessScaled(int i){
|
||||
return this.currentProcessTime * i / this.maxTimeProcessing;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getEnergyScaled(int i){
|
||||
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 2 && stack.getItem() == InitItems.itemBucketCanolaOil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
if(resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidCanolaOil.getName())) return this.tank.drain(resource.amount, doDrain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
return this.tank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityCoalGenerator extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(30000, energyProducedPerTick+50);
|
||||
|
||||
public static int energyProducedPerTick = ConfigIntValues.COAL_GEN_ENERGY_PRODUCED.getValue();
|
||||
|
||||
public int maxBurnTime;
|
||||
public int currentBurnTime;
|
||||
|
||||
public TileEntityCoalGenerator(){
|
||||
super(1, "coalGenerator");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
|
||||
if(this.currentBurnTime > 0){
|
||||
this.currentBurnTime--;
|
||||
this.storage.receiveEnergy(energyProducedPerTick, false);
|
||||
}
|
||||
|
||||
if(energyProducedPerTick <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
|
||||
if(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0){
|
||||
this.maxBurnTime = TileEntityFurnace.getItemBurnTime(this.slots[0]);
|
||||
this.currentBurnTime = this.maxBurnTime;
|
||||
this.slots[0].stackSize--;
|
||||
if(this.slots[0].stackSize == 0) this.slots[0] = this.slots[0].getItem().getContainerItem(this.slots[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getEnergyScaled(int i){
|
||||
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurningScaled(int i){
|
||||
return this.currentBurnTime * i / this.maxBurnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityFermentingBarrel extends TileEntityInventoryBase implements IFluidHandler{
|
||||
|
||||
public FluidTank canolaTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
public FluidTank oilTank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
||||
public int currentProcessTime;
|
||||
public int maxTimeProcessing = ConfigIntValues.BARREL_PROCESSING_TIME.getValue();
|
||||
|
||||
public int mBProducedPerCycle = ConfigIntValues.BARREL_MB_PRODUCED.getValue();
|
||||
|
||||
public TileEntityFermentingBarrel(){
|
||||
super(4, "fermentingBarrel");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
if(this.canolaTank.getFluidAmount() >= this.mBProducedPerCycle && this.mBProducedPerCycle <= this.oilTank.getCapacity()-this.oilTank.getFluidAmount()){
|
||||
this.currentProcessTime++;
|
||||
if(this.currentProcessTime >= this.maxTimeProcessing){
|
||||
this.currentProcessTime = 0;
|
||||
|
||||
this.oilTank.fill(new FluidStack(InitBlocks.fluidOil, mBProducedPerCycle), true);
|
||||
this.canolaTank.drain(mBProducedPerCycle, true);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
else this.currentProcessTime = 0;
|
||||
|
||||
if(this.slots[0] != null && this.slots[0].getItem() == InitItems.itemBucketCanolaOil && (this.slots[1] == null || (this.slots[1].stackSize < this.slots[1].getMaxStackSize()))){
|
||||
if(FluidContainerRegistry.BUCKET_VOLUME <= this.canolaTank.getCapacity()-this.canolaTank.getFluidAmount()){
|
||||
if(this.slots[1] == null) this.slots[1] = new ItemStack(Items.bucket);
|
||||
else this.slots[1].stackSize++;
|
||||
this.slots[0] = null;
|
||||
this.canolaTank.fill(new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME), true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.slots[2] != null && this.slots[2].getItem() == Items.bucket && this.slots[3] == null){
|
||||
if(this.oilTank.getFluidAmount() > 0 && this.oilTank.getFluid().getFluid() == InitBlocks.fluidOil && this.oilTank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME){
|
||||
this.slots[3] = new ItemStack(InitItems.itemBucketOil);
|
||||
this.slots[2].stackSize--;
|
||||
if(this.slots[2].stackSize == 0) this.slots[2] = null;
|
||||
this.oilTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.oilTank.getFluidAmount() > 0){
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, this.oilTank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, this.oilTank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, this.oilTank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, this.oilTank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, this.oilTank);
|
||||
WorldUtil.pushFluid(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, this.oilTank);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||
this.canolaTank.writeToNBT(compound);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.oilTank.writeToNBT(tag);
|
||||
compound.setTag("OilTank", tag);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getProcessScaled(int i){
|
||||
return this.currentProcessTime * i / this.maxTimeProcessing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
this.canolaTank.readFromNBT(compound);
|
||||
this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank"));
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getOilTankScaled(int i){
|
||||
return this.oilTank.getFluidAmount() * i / this.oilTank.getCapacity();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getCanolaTankScaled(int i){
|
||||
return this.canolaTank.getFluidAmount() * i / this.canolaTank.getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return (i == 0 && stack.getItem() == InitItems.itemBucketCanolaOil) || (i == 2 && stack.getItem() == Items.bucket);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return (slot == 1 && stack.getItem() == Items.bucket) || (slot == 3 && stack.getItem() == InitItems.itemBucketOil);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
if(resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidCanolaOil.getName())) return this.canolaTank.fill(resource, doFill);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
if(resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidOil.getName())) return this.oilTank.drain(resource.amount, doDrain);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
return this.oilTank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
return fluid == FluidRegistry.getFluid(InitBlocks.fluidCanolaOil.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return fluid == FluidRegistry.getFluid(InitBlocks.fluidOil.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.canolaTank.getInfo(), this.oilTank.getInfo()};
|
||||
}
|
||||
}
|
|
@ -1,24 +1,25 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFurnaceDouble extends TileEntityUpgradable implements IPowerAcceptor{
|
||||
public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_COAL = 0;
|
||||
public static final int SLOT_INPUT_1 = 1;
|
||||
public static final int SLOT_OUTPUT_1 = 2;
|
||||
public static final int SLOT_INPUT_2 = 3;
|
||||
public static final int SLOT_OUTPUT_2 = 4;
|
||||
public static final int SLOT_INPUT_1 = 0;
|
||||
public static final int SLOT_OUTPUT_1 = 1;
|
||||
public static final int SLOT_INPUT_2 = 2;
|
||||
public static final int SLOT_OUTPUT_2 = 3;
|
||||
|
||||
public int coalTime;
|
||||
public int coalTimeLeft;
|
||||
public EnergyStorage storage = new EnergyStorage(30000, energyUsePerTick+30);
|
||||
|
||||
public static int energyUsePerTick = ConfigIntValues.FURNACE_ENERGY_USED.getValue();
|
||||
|
||||
public int maxBurnTime = this.getStandardSpeed();
|
||||
|
||||
|
@ -26,33 +27,18 @@ public class TileEntityFurnaceDouble extends TileEntityUpgradable implements IPo
|
|||
public int secondSmeltTime;
|
||||
|
||||
public TileEntityFurnaceDouble(){
|
||||
super(6, "furnaceDouble");
|
||||
this.speedUpgradeSlot = 5;
|
||||
super(4, "furnaceDouble");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
this.speedUp();
|
||||
|
||||
boolean theFlag = this.coalTimeLeft > 0;
|
||||
|
||||
if(this.coalTimeLeft > 0) this.coalTimeLeft -= 1+this.burnTimeAmplifier;
|
||||
|
||||
boolean canSmeltOnFirst = this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1);
|
||||
boolean canSmeltOnSecond = this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2);
|
||||
|
||||
if((canSmeltOnFirst || canSmeltOnSecond) && this.coalTimeLeft <= 0 && this.slots[SLOT_COAL] != null){
|
||||
this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]);
|
||||
this.coalTimeLeft = this.coalTime;
|
||||
if(this.coalTime > 0){
|
||||
this.slots[SLOT_COAL].stackSize--;
|
||||
if(this.slots[SLOT_COAL].stackSize <= 0) this.slots[SLOT_COAL] = this.slots[SLOT_COAL].getItem().getContainerItem(this.slots[SLOT_COAL]);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.coalTimeLeft > 0){
|
||||
if(this.storage.getEnergyStored() >= energyUsePerTick){
|
||||
if(canSmeltOnFirst){
|
||||
this.firstSmeltTime++;
|
||||
if(this.firstSmeltTime >= maxBurnTime){
|
||||
|
@ -74,14 +60,9 @@ public class TileEntityFurnaceDouble extends TileEntityUpgradable implements IPo
|
|||
else{
|
||||
this.firstSmeltTime = 0;
|
||||
this.secondSmeltTime = 0;
|
||||
this.coalTime = 0;
|
||||
}
|
||||
|
||||
if(theFlag != this.coalTimeLeft > 0){
|
||||
int metaBefore = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? metaBefore+4 : metaBefore-4), 2);
|
||||
this.markDirty();
|
||||
}
|
||||
if(this.firstSmeltTime > 0 || this.secondSmeltTime > 0) this.storage.extractEnergy(energyUsePerTick, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -112,24 +93,22 @@ public class TileEntityFurnaceDouble extends TileEntityUpgradable implements IPo
|
|||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("CoalTime", this.coalTime);
|
||||
compound.setInteger("CoalTimeLeft", this.coalTimeLeft);
|
||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.coalTime = compound.getInteger("CoalTime");
|
||||
this.coalTimeLeft = compound.getInteger("CoalTimeLeft");
|
||||
this.firstSmeltTime = compound.getInteger("FirstSmeltTime");
|
||||
this.secondSmeltTime = compound.getInteger("SecondSmeltTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getCoalTimeToScale(int i){
|
||||
return this.coalTimeLeft * i / this.coalTime;
|
||||
public int getEnergyScaled(int i){
|
||||
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -144,7 +123,7 @@ public class TileEntityFurnaceDouble extends TileEntityUpgradable implements IPo
|
|||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == SLOT_COAL && TileEntityFurnace.getItemBurnTime(stack) > 0 || (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,37 +133,30 @@ public class TileEntityFurnaceDouble extends TileEntityUpgradable implements IPo
|
|||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
|
||||
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockMetadataToOn(){
|
||||
int metaBefore = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, metaBefore+4, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(int power){
|
||||
this.coalTimeLeft = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemPower(int power){
|
||||
this.coalTime = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemPower(){
|
||||
return this.coalTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStandardSpeed(){
|
||||
return ConfigIntValues.FURNACE_DOUBLE_SMELT_TIME.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeed(int newSpeed){
|
||||
this.maxBurnTime = newSpeed;
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +1,67 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
public class TileEntityFurnaceSolar extends TileEntityBase{
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyProvider{
|
||||
|
||||
@Override
|
||||
public boolean canUpdate(){
|
||||
return false;
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||
return this.storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
//TODO Reimplement
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
/*@Override
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return from != ForgeDirection.UP;
|
||||
}
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(30000, energyProducedPerTick+50);
|
||||
|
||||
public static int energyProducedPerTick = ConfigIntValues.FURNACE_SOLAR_ENERGY_PRODUCED.getValue();
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
if(worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) && worldObj.isDaytime()){
|
||||
TileEntity tileBelow = WorldUtil.getTileEntityFromSide(1, worldObj, xCoord, yCoord, zCoord);
|
||||
if(energyProducedPerTick <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
|
||||
this.storage.receiveEnergy(energyProducedPerTick, false);
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
givePowerTo(tileBelow);
|
||||
if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void givePowerTo(TileEntity tile){
|
||||
if(tile instanceof IPowerAcceptor){
|
||||
IPowerAcceptor acceptor = (IPowerAcceptor)tile;
|
||||
int coalTimeBefore = acceptor.getItemPower();
|
||||
acceptor.setItemPower(42);
|
||||
acceptor.setPower(42);
|
||||
if(coalTimeBefore == 0){
|
||||
acceptor.setBlockMetadataToOn();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(tile instanceof TileEntityFurnace){
|
||||
TileEntityFurnace furnaceBelow = (TileEntityFurnace)tile;
|
||||
int burnTimeBefore = furnaceBelow.furnaceBurnTime;
|
||||
furnaceBelow.furnaceBurnTime = 42;
|
||||
furnaceBelow.currentItemBurnTime = 42;
|
||||
if(burnTimeBefore == 0){
|
||||
BlockFurnace.updateFurnaceBlockState(true, tile.getWorldObj(), furnaceBelow.xCoord, furnaceBelow.yCoord, furnaceBelow.zCoord);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +1,60 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.recipe.GrinderRecipes;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcceptor{
|
||||
public class TileEntityGrinder extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(60000, energyUsePerTick+20);
|
||||
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class TileEntityGrinderDouble extends TileEntityGrinder{
|
||||
|
||||
public TileEntityGrinderDouble(){
|
||||
super(8, "grinderDouble");
|
||||
super(6, "grinderDouble");
|
||||
this.isDouble = true;
|
||||
this.maxCrushTime = this.getStandardSpeed();
|
||||
this.speedUpgradeSlot = 7;
|
||||
energyUsePerTick = ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final int SLOT_COAL = 0;
|
||||
public static final int SLOT_INPUT_1 = 1;
|
||||
public static final int SLOT_OUTPUT_1_1 = 2;
|
||||
public static final int SLOT_OUTPUT_1_2 = 3;
|
||||
public static final int SLOT_INPUT_2 = 4;
|
||||
public static final int SLOT_OUTPUT_2_1 = 5;
|
||||
public static final int SLOT_OUTPUT_2_2 = 6;
|
||||
public static final int SLOT_INPUT_1 = 0;
|
||||
public static final int SLOT_OUTPUT_1_1 = 1;
|
||||
public static final int SLOT_OUTPUT_1_2 = 2;
|
||||
public static final int SLOT_INPUT_2 = 3;
|
||||
public static final int SLOT_OUTPUT_2_1 = 4;
|
||||
public static final int SLOT_OUTPUT_2_2 = 5;
|
||||
|
||||
public int coalTime;
|
||||
public int coalTimeLeft;
|
||||
public static int energyUsePerTick;
|
||||
|
||||
public int maxCrushTime;
|
||||
|
||||
|
@ -47,10 +68,10 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
|
|||
}
|
||||
|
||||
public TileEntityGrinder(){
|
||||
super(5, "grinder");
|
||||
super(3, "grinder");
|
||||
this.isDouble = false;
|
||||
this.maxCrushTime = this.getStandardSpeed();
|
||||
this.speedUpgradeSlot = 4;
|
||||
energyUsePerTick = ConfigIntValues.GRINDER_ENERGY_USED.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -66,26 +87,11 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
|
|||
((TileEntityGrinderDouble)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone();
|
||||
}
|
||||
|
||||
this.speedUp();
|
||||
|
||||
boolean theFlag = this.coalTimeLeft > 0;
|
||||
|
||||
if(this.coalTimeLeft > 0) this.coalTimeLeft -= 1+this.burnTimeAmplifier;
|
||||
|
||||
boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2);
|
||||
boolean canCrushOnSecond = false;
|
||||
if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2);
|
||||
|
||||
if((canCrushOnFirst || canCrushOnSecond) && this.coalTimeLeft <= 0 && this.slots[SLOT_COAL] != null){
|
||||
this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]);
|
||||
this.coalTimeLeft = this.coalTime;
|
||||
if(this.coalTime > 0){
|
||||
this.slots[SLOT_COAL].stackSize--;
|
||||
if(this.slots[SLOT_COAL].stackSize <= 0) this.slots[SLOT_COAL] = this.slots[SLOT_COAL].getItem().getContainerItem(this.slots[SLOT_COAL]);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.coalTimeLeft > 0){
|
||||
if(this.storage.getEnergyStored() >= energyUsePerTick){
|
||||
if(canCrushOnFirst){
|
||||
this.firstCrushTime++;
|
||||
if(this.firstCrushTime >= maxCrushTime){
|
||||
|
@ -109,13 +115,9 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
|
|||
else{
|
||||
this.firstCrushTime = 0;
|
||||
this.secondCrushTime = 0;
|
||||
this.coalTime = 0;
|
||||
}
|
||||
|
||||
if(theFlag != this.coalTimeLeft > 0){
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? 1 : 0), 2);
|
||||
this.markDirty();
|
||||
}
|
||||
if(this.firstCrushTime > 0 || this.secondCrushTime > 0) this.storage.extractEnergy(energyUsePerTick, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,25 +157,23 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
|
|||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("CoalTime", this.coalTime);
|
||||
compound.setInteger("CoalTimeLeft", this.coalTimeLeft);
|
||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.coalTime = compound.getInteger("CoalTime");
|
||||
this.coalTimeLeft = compound.getInteger("CoalTimeLeft");
|
||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||
this.secondCrushTime = compound.getInteger("SecondCrushTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getCoalTimeToScale(int i){
|
||||
return this.coalTimeLeft * i / this.coalTime;
|
||||
public int getEnergyScaled(int i){
|
||||
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -188,7 +188,7 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
|
|||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == SLOT_COAL && TileEntityFurnace.getItemBurnTime(stack) > 0 || (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.instance().getOutput(stack, false) != null;
|
||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.instance().getOutput(stack, false) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -198,36 +198,10 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
|
|||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2 || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
|
||||
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockMetadataToOn(){
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(int power){
|
||||
this.coalTimeLeft = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemPower(int power){
|
||||
this.coalTime = power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemPower(){
|
||||
return this.coalTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStandardSpeed(){
|
||||
return this.isDouble ? ConfigIntValues.GRINDER_DOUBLE_CRUSH_TIME.getValue() : ConfigIntValues.GRINDER_CRUSH_TIME.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeed(int newSpeed){
|
||||
this.maxCrushTime = newSpeed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,45 +1,75 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityHeatCollector extends TileEntityBase{
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
public class TileEntityHeatCollector extends TileEntityBase implements IEnergyProvider{
|
||||
|
||||
private int randomChance = ConfigIntValues.HEAT_COLLECTOR_LAVA_CHANCE.getValue();
|
||||
private int blocksNeeded = ConfigIntValues.HEAT_COLLECTOR_BLOCKS.getValue();
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(30000, energyProducedPerTick+50);
|
||||
|
||||
public static int energyProducedPerTick = ConfigIntValues.HEAT_COLLECTOR_ENERGY_PRODUCED.getValue();
|
||||
|
||||
@Override
|
||||
public boolean canUpdate(){
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO Reimplement
|
||||
|
||||
/*@Override
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
ArrayList<Integer> blocksAround = new ArrayList<Integer>();
|
||||
|
||||
for(int i = 1; i <= 5; i++){
|
||||
ChunkCoordinates coords = WorldUtil.getCoordsFromSide(i, xCoord, yCoord, zCoord);
|
||||
if(coords != null){
|
||||
Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);
|
||||
if(block != null && block.getMaterial() == Material.lava && worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ) == 0){
|
||||
blocksAround.add(i);
|
||||
if(energyProducedPerTick <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
|
||||
for(int i = 1; i <= 5; i++){
|
||||
ChunkCoordinates coords = WorldUtil.getCoordsFromSide(WorldUtil.getDirectionByRotatingSide(i), xCoord, yCoord, zCoord);
|
||||
if(coords != null){
|
||||
Block block = worldObj.getBlock(coords.posX, coords.posY, coords.posZ);
|
||||
if(block != null && block.getMaterial() == Material.lava && worldObj.getBlockMetadata(coords.posX, coords.posY, coords.posZ) == 0){
|
||||
blocksAround.add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(blocksAround.size() >= blocksNeeded){
|
||||
TileEntity tileAbove = WorldUtil.getTileEntityFromSide(0, worldObj, xCoord, yCoord, zCoord);
|
||||
if(blocksAround.size() >= blocksNeeded){
|
||||
this.storage.receiveEnergy(energyProducedPerTick, false);
|
||||
this.markDirty();
|
||||
|
||||
TileEntityFurnaceSolar.givePowerTo(tileAbove);
|
||||
|
||||
Random rand = new Random();
|
||||
if(rand.nextInt(randomChance) == 0){
|
||||
int randomSide = blocksAround.get(rand.nextInt(blocksAround.size()));
|
||||
WorldUtil.breakBlockAtSide(randomSide, worldObj, xCoord, yCoord, zCoord);
|
||||
Random rand = new Random();
|
||||
if(rand.nextInt(randomChance) == 0){
|
||||
int randomSide = blocksAround.get(rand.nextInt(blocksAround.size()));
|
||||
WorldUtil.breakBlockAtSide(WorldUtil.getDirectionByRotatingSide(randomSide), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, this.storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||
return this.storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return from == ForgeDirection.UP;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,27 +20,31 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
|
||||
if (slots[currentIndex] != null){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setByte("Slot", (byte)currentIndex);
|
||||
slots[currentIndex].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
if(this.slots.length > 0){
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
for(int currentIndex = 0; currentIndex < slots.length; currentIndex++){
|
||||
if(slots[currentIndex] != null){
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
tagCompound.setByte("Slot", (byte)currentIndex);
|
||||
slots[currentIndex].writeToNBT(tagCompound);
|
||||
tagList.appendTag(tagCompound);
|
||||
}
|
||||
}
|
||||
compound.setTag("Items", tagList);
|
||||
}
|
||||
compound.setTag("Items", tagList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
NBTTagList tagList = compound.getTagList("Items", 10);
|
||||
for (int i = 0; i < tagList.tagCount(); i++){
|
||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
||||
byte slotIndex = tagCompound.getByte("Slot");
|
||||
if (slotIndex >= 0 && slotIndex < slots.length){
|
||||
slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
if(this.slots.length > 0){
|
||||
NBTTagList tagList = compound.getTagList("Items", 10);
|
||||
for(int i = 0; i < tagList.tagCount(); i++){
|
||||
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
|
||||
byte slotIndex = tagCompound.getByte("Slot");
|
||||
if(slotIndex >= 0 && slotIndex < slots.length){
|
||||
slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,68 +1,53 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityItemRepairer extends TileEntityInventoryBase implements IPowerAcceptor{
|
||||
public class TileEntityItemRepairer extends TileEntityInventoryBase implements IEnergyReceiver{
|
||||
|
||||
public static final int SLOT_COAL = 0;
|
||||
public static final int SLOT_INPUT = 1;
|
||||
public static final int SLOT_OUTPUT = 2;
|
||||
public static final int SLOT_INPUT = 0;
|
||||
public static final int SLOT_OUTPUT = 1;
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(300000, energyUsePerTick+100);
|
||||
|
||||
private final int speedSlowdown = ConfigIntValues.REPAIRER_SPEED_SLOWDOWN.getValue();
|
||||
|
||||
public int coalTime;
|
||||
public int coalTimeLeft;
|
||||
public static int energyUsePerTick = ConfigIntValues.REPAIRER_ENERGY_USED.getValue();
|
||||
|
||||
public int nextRepairTick;
|
||||
|
||||
public TileEntityItemRepairer(){
|
||||
super(3, "repairer");
|
||||
super(2, "repairer");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
boolean theFlag = this.coalTimeLeft > 0;
|
||||
|
||||
if(this.coalTimeLeft > 0) this.coalTimeLeft--;
|
||||
|
||||
if(this.slots[SLOT_OUTPUT] == null){
|
||||
if(canBeRepaired(this.slots[SLOT_INPUT])){
|
||||
if(this.slots[SLOT_INPUT].getItemDamage() <= 0){
|
||||
this.slots[SLOT_OUTPUT] = this.slots[SLOT_INPUT].copy();
|
||||
this.slots[SLOT_INPUT] = null;
|
||||
}
|
||||
else{
|
||||
if(this.coalTimeLeft <= 0){
|
||||
this.coalTime = TileEntityFurnace.getItemBurnTime(this.slots[SLOT_COAL]);
|
||||
this.coalTimeLeft = this.coalTime;
|
||||
if(this.coalTime > 0){
|
||||
this.slots[SLOT_COAL].stackSize--;
|
||||
if(this.slots[SLOT_COAL].stackSize <= 0) this.slots[SLOT_COAL] = this.slots[SLOT_COAL].getItem().getContainerItem(this.slots[SLOT_COAL]);
|
||||
}
|
||||
}
|
||||
if(this.coalTimeLeft > 0){
|
||||
this.nextRepairTick++;
|
||||
if(this.nextRepairTick >= this.speedSlowdown){
|
||||
this.nextRepairTick = 0;
|
||||
this.slots[SLOT_INPUT].setItemDamage(this.slots[SLOT_INPUT].getItemDamage() - 1);
|
||||
}
|
||||
if(this.slots[SLOT_OUTPUT] == null && canBeRepaired(this.slots[SLOT_INPUT])){
|
||||
if(this.slots[SLOT_INPUT].getItemDamage() <= 0){
|
||||
this.slots[SLOT_OUTPUT] = this.slots[SLOT_INPUT].copy();
|
||||
this.slots[SLOT_INPUT] = null;
|
||||
this.nextRepairTick = 0;
|
||||
}
|
||||
else{
|
||||
if(this.storage.getEnergyStored() >= energyUsePerTick){
|
||||
this.nextRepairTick++;
|
||||
this.storage.extractEnergy(energyUsePerTick, false);
|
||||
if(this.nextRepairTick >= this.speedSlowdown){
|
||||
this.nextRepairTick = 0;
|
||||
this.slots[SLOT_INPUT].setItemDamage(this.slots[SLOT_INPUT].getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(theFlag != this.coalTimeLeft > 0){
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, (this.coalTimeLeft > 0 ? 1 : 0), 2);
|
||||
this.markDirty();
|
||||
}
|
||||
else this.nextRepairTick = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,23 +57,21 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("CoalTime", this.coalTime);
|
||||
compound.setInteger("CoalTimeLeft", this.coalTimeLeft);
|
||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||
super.writeToNBT(compound);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.coalTime = compound.getInteger("CoalTime");
|
||||
this.coalTimeLeft = compound.getInteger("CoalTimeLeft");
|
||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||
super.readFromNBT(compound);
|
||||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getCoalTimeToScale(int i){
|
||||
return this.coalTimeLeft * i / this.coalTime;
|
||||
public int getEnergyScaled(int i){
|
||||
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -101,7 +84,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == SLOT_COAL && TileEntityFurnace.getItemBurnTime(stack) > 0 || i == SLOT_INPUT;
|
||||
return i == SLOT_INPUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,26 +94,26 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == SLOT_OUTPUT || (slot == SLOT_COAL && stack.getItem() == Items.bucket);
|
||||
return slot == SLOT_OUTPUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockMetadataToOn(){
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
return this.storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(int power){
|
||||
this.coalTimeLeft = power;
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItemPower(int power){
|
||||
this.coalTime = power;
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemPower(){
|
||||
return this.coalTime;
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ellpeck.actuallyadditions.blocks.InitBlocks;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.util.WorldUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
public class TileEntityOilGenerator extends TileEntityInventoryBase implements IEnergyProvider, IFluidHandler{
|
||||
|
||||
public EnergyStorage storage = new EnergyStorage(30000, energyProducedPerTick+50);
|
||||
|
||||
public FluidTank tank = new FluidTank(2*FluidContainerRegistry.BUCKET_VOLUME);
|
||||
|
||||
public static int energyProducedPerTick = 76;
|
||||
|
||||
public int fuelUsedPerBurnup = 50;
|
||||
public int maxBurnTime = 100;
|
||||
|
||||
public int currentBurnTime;
|
||||
|
||||
public TileEntityOilGenerator(){
|
||||
super(2, "oilGenerator");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void updateEntity(){
|
||||
if(!worldObj.isRemote){
|
||||
|
||||
if(this.currentBurnTime > 0){
|
||||
this.currentBurnTime--;
|
||||
this.storage.receiveEnergy(energyProducedPerTick, false);
|
||||
}
|
||||
|
||||
if(energyProducedPerTick <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)){
|
||||
if(this.currentBurnTime <= 0 && this.tank.getFluidAmount() >= this.fuelUsedPerBurnup){
|
||||
this.currentBurnTime = this.maxBurnTime;
|
||||
this.tank.drain(this.fuelUsedPerBurnup, true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.slots[0] != null && this.slots[0].getItem() == InitItems.itemBucketOil && (this.slots[1] == null || (this.slots[1].stackSize < this.slots[1].getMaxStackSize()))){
|
||||
if(FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount()){
|
||||
if(this.slots[1] == null) this.slots[1] = new ItemStack(Items.bucket);
|
||||
else this.slots[1].stackSize++;
|
||||
this.slots[0] = null;
|
||||
this.tank.fill(new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME), true);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage);
|
||||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getEnergyScaled(int i){
|
||||
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getTankScaled(int i){
|
||||
return this.tank.getFluidAmount() * i / this.tank.getCapacity();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBurningScaled(int i){
|
||||
return this.currentBurnTime * i / this.maxBurnTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
this.maxBurnTime = compound.getInteger("MaxBurnTime");
|
||||
this.storage.readFromNBT(compound);
|
||||
this.tank.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return stack.getItem() == InitItems.itemBucketOil && i == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isItemValidForSlot(slot, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||
return this.storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from){
|
||||
return this.storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from){
|
||||
return this.storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from){
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill){
|
||||
if(resource.getFluid() == FluidRegistry.getFluid(InitBlocks.fluidOil.getName())) return this.tank.fill(resource, doFill);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid){
|
||||
return fluid == FluidRegistry.getFluid(InitBlocks.fluidOil.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from){
|
||||
return new FluidTankInfo[]{this.tank.getInfo()};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public class TileEntityPhantomface extends TileEntityInventoryBase{
|
||||
|
||||
public TileEntity boundTile;
|
||||
|
||||
public final int range = ConfigIntValues.PHANTOMFACE_RANGE.getValue();
|
||||
|
||||
public TileEntityPhantomface(){
|
||||
super(0, "phantomface");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity(){
|
||||
if(!this.hasBoundTile()) this.boundTile = null;
|
||||
|
||||
if(this.tempX > 0 || this.tempY > 0 || this.tempZ > 0){
|
||||
this.boundTile = tempWorld.getTileEntity(tempX, tempY, tempZ);
|
||||
this.tempX = 0;
|
||||
this.tempY = 0;
|
||||
this.tempZ = 0;
|
||||
this.tempWorld = null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBoundTileInRage(){
|
||||
if(this.hasBoundTile() && this.boundTile.getWorldObj().loadedTileEntityList.contains(this.boundTile)){
|
||||
int xDif = this.boundTile.xCoord-this.xCoord;
|
||||
int yDif = this.boundTile.yCoord-this.yCoord;
|
||||
int zDif = this.boundTile.zCoord-this.zCoord;
|
||||
|
||||
if(xDif >= -this.range && xDif <= this.range){
|
||||
if(yDif >= -this.range && yDif <= this.range){
|
||||
if(zDif >= -this.range && zDif <= this.range) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBoundTile(){
|
||||
return this.boundTile != null && boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord) != null && boundTile.getWorldObj() == this.getWorldObj() && boundTile instanceof IInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
if(this.hasBoundTile()){
|
||||
compound.setInteger("XCoordOfTileStored", boundTile.xCoord);
|
||||
compound.setInteger("YCoordOfTileStored", boundTile.yCoord);
|
||||
compound.setInteger("ZCoordOfTileStored", boundTile.zCoord);
|
||||
compound.setInteger("WorldOfTileStored", boundTile.getWorldObj().provider.dimensionId);
|
||||
}
|
||||
}
|
||||
|
||||
private int tempX;
|
||||
private int tempY;
|
||||
private int tempZ;
|
||||
private World tempWorld;
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.tempX = compound.getInteger("XCoordOfTileStored");
|
||||
this.tempY = compound.getInteger("YCoordOfTileStored");
|
||||
this.tempZ = compound.getInteger("ZCoordOfTileStored");
|
||||
this.tempWorld = DimensionManager.getWorld(compound.getInteger("WorldOfTileStored"));
|
||||
}
|
||||
|
||||
public IInventory getInventory(){
|
||||
TileEntity tile = boundTile.getWorldObj().getTileEntity(boundTile.xCoord, boundTile.yCoord, boundTile.zCoord);
|
||||
if(tile != null && tile instanceof IInventory){
|
||||
this.markDirty();
|
||||
return (IInventory)tile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ISidedInventory getSided(){
|
||||
return this.getInventory() instanceof ISidedInventory ? (ISidedInventory)this.getInventory() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit(){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getInventoryStackLimit() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return this.isBoundTileInRage() && this.getInventory().isItemValidForSlot(i, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getStackInSlotOnClosing(i) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack stack){
|
||||
if(this.isBoundTileInRage()) this.getInventory().setInventorySlotContents(i, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory(){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getSizeInventory() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i){
|
||||
return this.isBoundTileInRage() ? this.getInventory().getStackInSlot(i) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j){
|
||||
return this.isBoundTileInRage() ? this.getInventory().decrStackSize(i, j) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side){
|
||||
if(this.isBoundTileInRage()){
|
||||
if(this.getSided() != null){
|
||||
return this.getSided().getAccessibleSlotsFromSide(side);
|
||||
}
|
||||
else{
|
||||
int[] theInt = new int[this.getSizeInventory()];
|
||||
for(int i = 0; i < theInt.length; i++){
|
||||
theInt[i] = i;
|
||||
}
|
||||
return theInt;
|
||||
}
|
||||
}
|
||||
return new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canInsertItem(slot, stack, side));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slot, ItemStack stack, int side){
|
||||
return this.isBoundTileInRage() && (this.getSided() == null || this.getSided().canExtractItem(slot, stack, side));
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package ellpeck.actuallyadditions.tile;
|
||||
|
||||
import ellpeck.actuallyadditions.items.ItemUpgrade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public abstract class TileEntityUpgradable extends TileEntityInventoryBase{
|
||||
|
||||
public int speedUpgradeSlot;
|
||||
public int burnTimeAmplifier;
|
||||
|
||||
public TileEntityUpgradable(int slots, String name){
|
||||
super(slots, name);
|
||||
}
|
||||
|
||||
public void speedUp(){
|
||||
ItemStack stack = this.slots[speedUpgradeSlot];
|
||||
if(stack != null && stack.getItem() instanceof ItemUpgrade && ((ItemUpgrade)stack.getItem()).type == ItemUpgrade.UpgradeType.SPEED){
|
||||
int newSpeed = this.getStandardSpeed() - 10*stack.stackSize;
|
||||
this.speedUpBurnTimeBySpeed(stack.stackSize);
|
||||
if(newSpeed < 5) newSpeed = 5;
|
||||
this.setSpeed(newSpeed);
|
||||
}
|
||||
else{
|
||||
this.speedUpBurnTimeBySpeed(0);
|
||||
this.setSpeed(this.getStandardSpeed());
|
||||
}
|
||||
}
|
||||
|
||||
public void speedUpBurnTimeBySpeed(int upgradeAmount){
|
||||
this.burnTimeAmplifier = upgradeAmount*2;
|
||||
}
|
||||
|
||||
public int getStandardSpeed(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setSpeed(int newSpeed){
|
||||
|
||||
}
|
||||
}
|
|
@ -12,10 +12,8 @@ public class AssetUtil{
|
|||
return new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/gui/" + file + ".png");
|
||||
}
|
||||
|
||||
public static void displayNameAndInventoryString(FontRenderer font, int xSize, int yPositionOfInventoryText, int yPositionOfMachineText, String machineName){
|
||||
public static void displayNameString(FontRenderer font, int xSize, int yPositionOfMachineText, String machineName){
|
||||
String localMachineName = StatCollector.translateToLocal(machineName + ".name");
|
||||
String inventoryName = StatCollector.translateToLocal("container.inventory");
|
||||
font.drawString(localMachineName, xSize/2 - font.getStringWidth(localMachineName)/2, yPositionOfMachineText, StringUtil.DECIMAL_COLOR_WHITE);
|
||||
font.drawString(inventoryName, xSize/2 - font.getStringWidth(inventoryName)/2, yPositionOfInventoryText-1, StringUtil.DECIMAL_COLOR_GRAY_TEXT);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.util;
|
|||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import ellpeck.actuallyadditions.creative.CreativeTab;
|
||||
import ellpeck.actuallyadditions.waila.WailaDataProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -26,6 +27,20 @@ public class BlockUtil{
|
|||
else list.add(ItemUtil.shiftForInfo());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addPowerUsageInfo(List list, int usage){
|
||||
if(KeyUtil.isShiftPressed()){
|
||||
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".uses.desc") + " " + usage + " RF/t");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void addPowerProductionInfo(List list, int produce){
|
||||
if(KeyUtil.isShiftPressed()){
|
||||
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".produces.desc") + " " + produce + " RF/t");
|
||||
}
|
||||
}
|
||||
|
||||
public static void register(Block block, Class<? extends ItemBlock> itemBlock, Enum[] list){
|
||||
block.setCreativeTab(CreativeTab.instance);
|
||||
block.setBlockName(createUnlocalizedName(block));
|
||||
|
@ -33,13 +48,21 @@ public class BlockUtil{
|
|||
for(Enum current : list){
|
||||
if(!((INameableItem)current).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)current).getOredictName(), new ItemStack(block, 1, current.ordinal()));
|
||||
}
|
||||
|
||||
WailaDataProvider.registerList.add(block);
|
||||
}
|
||||
|
||||
public static void register(Block block, Class<? extends ItemBlock> itemBlock){
|
||||
block.setCreativeTab(CreativeTab.instance);
|
||||
register(block, itemBlock, true);
|
||||
}
|
||||
|
||||
public static void register(Block block, Class<? extends ItemBlock> itemBlock, boolean addTab){
|
||||
if(addTab) block.setCreativeTab(CreativeTab.instance);
|
||||
block.setBlockName(createUnlocalizedName(block));
|
||||
GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName());
|
||||
if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), new ItemStack(block, 1, Util.WILDCARD));
|
||||
|
||||
WailaDataProvider.registerList.add(block);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,11 @@ public class ItemUtil{
|
|||
}
|
||||
|
||||
public static void register(Item item){
|
||||
item.setCreativeTab(CreativeTab.instance);
|
||||
register(item, true);
|
||||
}
|
||||
|
||||
public static void register(Item item, boolean addTab){
|
||||
if(addTab) item.setCreativeTab(CreativeTab.instance);
|
||||
item.setUnlocalizedName(createUnlocalizedName(item));
|
||||
GameRegistry.registerItem(item, ((INameableItem)item).getName());
|
||||
if(!((INameableItem)item).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)item).getOredictName(), new ItemStack(item, 1, Util.WILDCARD));
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
|
|||
|
||||
public class ModUtil{
|
||||
|
||||
public static final String VERSION = "1.7.10-0.0.4.4";
|
||||
public static final String VERSION = "1.7.10-0.0.5.0";
|
||||
|
||||
public static final String MOD_ID = "ActuallyAdditions";
|
||||
public static final String NAME = "Actually Additions";
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ellpeck.actuallyadditions.util;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -7,6 +9,8 @@ import net.minecraft.util.ChunkCoordinates;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class WorldUtil{
|
||||
|
||||
|
@ -22,6 +26,28 @@ public class WorldUtil{
|
|||
}
|
||||
}
|
||||
|
||||
public static void pushEnergy(World world, int x, int y, int z, ForgeDirection side, EnergyStorage storage){
|
||||
TileEntity tile = getTileEntityFromSide(side, world, x, y, z);
|
||||
if(tile != null && tile instanceof IEnergyReceiver){
|
||||
if(((IEnergyReceiver)tile).canConnectEnergy(side.getOpposite())){
|
||||
int receive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), Math.min(storage.getMaxExtract(), storage.getEnergyStored()), false);
|
||||
storage.extractEnergy(receive, false);
|
||||
world.markBlockForUpdate(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void pushFluid(World world, int x, int y, int z, ForgeDirection side, FluidTank tank){
|
||||
TileEntity tile = getTileEntityFromSide(side, world, x, y, z);
|
||||
if(tile != null && tank.getFluid() != null && tile instanceof IFluidHandler){
|
||||
if(((IFluidHandler)tile).canFill(side.getOpposite(), tank.getFluid().getFluid())){
|
||||
int receive = ((IFluidHandler)tile).fill(side.getOpposite(), tank.getFluid(), true);
|
||||
tank.drain(receive, true);
|
||||
world.markBlockForUpdate(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
|
||||
if(world instanceof WorldServer){
|
||||
if(side != ForgeDirection.UNKNOWN){
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue