mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-22 12:59:56 +00:00
Essentia gen rework (#6)
+Added GUI for Essentia Gens +Added Essentia Pipe Support for Essentia Gens +Added Tooltip for Essentia Gens +Added CFG for Essentia Gen EU Storage +Added Lucrum Gen with Infusion Recipe, Thaumonomicon Entry etc. +Updated ru_RU.lang (ty Cinobi) +Added WiP de_DE.lang +Removed unused .java +Added Essentia Storage for Essentia Gens +Rescaled Ticktime for Essentia Gens to 20Ticks(was 30Tick before) +Version number increase
This commit is contained in:
1 parent
a97a032210
commit
9a1a1bbf3f
27 files changed
+1071
-55
No files matched your search
@@ -21,10 +21,9 @@ public abstract class TileEntityEMT extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
|
||||
tagCompound.setInteger("facing", facing);
|
||||
tagCompound.setBoolean("isOn", isOn);
|
||||
super.writeToNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
package emt.tile.generator;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class TileEntityAerGenerator extends TileEntityBaseGenerator {
|
||||
|
||||
public TileEntityAerGenerator() {
|
||||
aspect = Aspect.AIR;
|
||||
output = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
generating = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return StatCollector.translateToLocal("tile.EMT.essentia.aer.name");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,18 @@
|
||||
package emt.tile.generator;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class TileEntityArborGenerator extends TileEntityBaseGenerator {
|
||||
|
||||
public TileEntityArborGenerator() {
|
||||
aspect = Aspect.TREE;
|
||||
output = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
generating = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return StatCollector.translateToLocal("tile.EMT.essentia.arbor.name");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,18 @@
|
||||
package emt.tile.generator;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class TileEntityAuramGenerator extends TileEntityBaseGenerator {
|
||||
|
||||
public TileEntityAuramGenerator() {
|
||||
aspect = Aspect.AURA;
|
||||
output = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
generating = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return StatCollector.translateToLocal("tile.EMT.essentia.auram.name");
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,67 @@
|
||||
package emt.tile.generator;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import emt.tile.TileEntityEMT;
|
||||
import emt.util.EMTConfigHandler;
|
||||
import ic2.api.energy.prefab.BasicSource;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.aspects.IAspectContainer;
|
||||
import thaumcraft.api.aspects.IAspectSource;
|
||||
import thaumcraft.api.aspects.IEssentiaTransport;
|
||||
import thaumcraft.common.lib.network.PacketHandler;
|
||||
import thaumcraft.common.lib.network.fx.PacketFXEssentiaSource;
|
||||
|
||||
public abstract class TileEntityBaseGenerator extends TileEntityEMT {
|
||||
public class TileEntityBaseGenerator extends TileEntityEMT implements IInventory, IAspectContainer, IEssentiaTransport {
|
||||
|
||||
public BasicSource energySource = new BasicSource(this, 1000000000, 3);
|
||||
public BasicSource energySource = new BasicSource(this, 100000, 2);
|
||||
public Aspect aspect;
|
||||
public double output;
|
||||
public double generating;
|
||||
public int tick = 0;
|
||||
public boolean isActive = false;
|
||||
Random rnd = new Random();
|
||||
public int tier;
|
||||
public int storage;
|
||||
public int maxstorage;
|
||||
public int maxfuel;
|
||||
public int fuel;
|
||||
public int refuel;
|
||||
|
||||
public TileEntityBaseGenerator() {
|
||||
output = 2000;
|
||||
energySource.setCapacity(EMTConfigHandler.EssentiaGeneratorStorage);
|
||||
maxstorage = (int) energySource.getCapacity();
|
||||
maxfuel = 64;
|
||||
fuel = 0;
|
||||
storage = 0;
|
||||
refuel = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (tick > 0)
|
||||
tick--;
|
||||
|
||||
if (tick == 0) {
|
||||
energySource.updateEntity();
|
||||
isActive = false;
|
||||
storeFuel();
|
||||
fillfrompipe();
|
||||
createEnergy();
|
||||
tick = 20;
|
||||
}
|
||||
energySource.updateEntity();
|
||||
}
|
||||
|
||||
public void createEnergy() {
|
||||
int count = 0;
|
||||
|
||||
public void storeFuel() {
|
||||
if (fuel<maxfuel) {
|
||||
for (int x = this.xCoord - 4; x < this.xCoord + 4; x++) {
|
||||
for (int y = this.yCoord - 4; y < this.yCoord + 4; y++) {
|
||||
for (int z = this.zCoord - 4; z < this.zCoord + 4; z++) {
|
||||
TileEntity tile = this.worldObj.getTileEntity(x, y, z);
|
||||
if (tile != null && tile instanceof IAspectSource) {
|
||||
IAspectSource as = (IAspectSource) tile;
|
||||
if (as.doesContainerContainAmount(aspect, 1)) {
|
||||
if (as.takeFromContainer(aspect, 1)) {
|
||||
isActive = true;
|
||||
if (as.doesContainerContainAmount(aspect, refuel)) {
|
||||
if (as.takeFromContainer(aspect, refuel)) {
|
||||
PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(xCoord, yCoord, zCoord, (byte) (xCoord - x), (byte) (yCoord - y), (byte) (zCoord - z), aspect.getColor()), new cpw.mods.fml.common.network.NetworkRegistry.TargetPoint(this.getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 32.0D));
|
||||
energySource.addEnergy(output / 30D);
|
||||
this.addToContainer(aspect, refuel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,6 +69,63 @@ public abstract class TileEntityBaseGenerator extends TileEntityEMT {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void fillfrompipe() {
|
||||
|
||||
TileEntity[] te = new TileEntity[ForgeDirection.VALID_DIRECTIONS.length];
|
||||
for (int i =0;i<ForgeDirection.VALID_DIRECTIONS.length;i++) {
|
||||
te[i]=ThaumcraftApiHelper.getConnectableTile(this.worldObj, this.xCoord, this.yCoord, this.zCoord, ForgeDirection.VALID_DIRECTIONS[i]);
|
||||
if (te[i] != null)
|
||||
{
|
||||
IEssentiaTransport pipe = (IEssentiaTransport)te[i];
|
||||
if (!pipe.canOutputTo(ForgeDirection.VALID_DIRECTIONS[i])) {
|
||||
return;
|
||||
}
|
||||
else
|
||||
if (pipe.getEssentiaType(ForgeDirection.VALID_DIRECTIONS[i])!=null && pipe.getEssentiaType(ForgeDirection.VALID_DIRECTIONS[i]).equals(aspect) && (pipe.getSuctionAmount(ForgeDirection.VALID_DIRECTIONS[i]) < getSuctionAmount(ForgeDirection.VALID_DIRECTIONS[i]))) {
|
||||
addToContainer(aspect, pipe.takeEssentia(aspect, 1, ForgeDirection.VALID_DIRECTIONS[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void createEnergy() {
|
||||
if (fuel>0) {
|
||||
if (storage+(generating/20/20) < maxstorage) {
|
||||
isActive = true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
energySource.addEnergy(generating/20/20);
|
||||
storage = (int) energySource.getEnergyStored();
|
||||
}
|
||||
tick = tick+1;
|
||||
if (tick == 20*20) {
|
||||
fuel=fuel-1;
|
||||
tick = 0;
|
||||
}
|
||||
}
|
||||
else if (storage == maxstorage)
|
||||
isActive = false;
|
||||
else if ((storage+(generating/20/20) > maxstorage) && storage != maxstorage) {
|
||||
isActive = true;
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
|
||||
energySource.setEnergyStored((double)maxstorage);
|
||||
storage = maxstorage;
|
||||
}
|
||||
tick = tick+1;
|
||||
if (tick == 20*20) {
|
||||
fuel=fuel-1;
|
||||
tick = 0;
|
||||
}
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload() {
|
||||
@@ -73,11 +142,213 @@ public abstract class TileEntityBaseGenerator extends TileEntityEMT {
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
energySource.readFromNBT(tag);
|
||||
if (tag.getInteger("storage")>storage)
|
||||
storage = tag.getInteger("storage");
|
||||
if (tag.getInteger("fuel")>fuel)
|
||||
fuel = tag.getInteger("fuel");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
tag.setInteger("storage", this.storage);
|
||||
tag.setInteger("fuel", this.fuel);
|
||||
super.writeToNBT(tag);
|
||||
energySource.writeToNBT(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "EMT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
}
|
||||
|
||||
public int gaugeEnergyScaled(int i)
|
||||
{
|
||||
return this.storage * i / this.maxstorage;
|
||||
}
|
||||
|
||||
public int gaugeFuelScaled(int i)
|
||||
{
|
||||
return fuel*i/maxfuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack Stack) {
|
||||
/*boolean ret= false;
|
||||
if (i<=4)
|
||||
ret = true;
|
||||
else if(IEssentiaContainerItem.class.isInstance(Stack))
|
||||
ret = true;
|
||||
return ret;*/
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AspectList getAspects() {
|
||||
return new AspectList().add(aspect, fuel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAspects(AspectList aspects) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerAccept(Aspect tag) {
|
||||
if(!tag.equals(aspect))
|
||||
return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addToContainer(Aspect tag, int amount) {
|
||||
if(!tag.equals(aspect)||amount<0)
|
||||
return amount;
|
||||
else if (amount+this.fuel<this.maxfuel) {
|
||||
this.fuel=this.fuel+amount;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
this.fuel=this.fuel+(amount-(amount-(this.maxfuel-this.fuel)));
|
||||
return amount-(this.maxfuel-this.fuel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(Aspect tag, int amount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean takeFromContainer(AspectList ot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContainAmount(Aspect tag, int amount) {
|
||||
return (tag.equals(aspect)&&amount <= fuel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerContain(AspectList ot) {
|
||||
return ot.aspects.containsKey(aspect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int containerContains(Aspect tag) {
|
||||
return tag == aspect ? fuel : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConnectable(ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInputFrom(ForgeDirection face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOutputTo(ForgeDirection face) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSuction(Aspect aspect, int amount) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect getSuctionType(ForgeDirection face) {
|
||||
return aspect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSuctionAmount(ForgeDirection face) {
|
||||
return 128;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int takeEssentia(Aspect aspect, int amount, ForgeDirection face) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addEssentia(Aspect aspect, int amount, ForgeDirection face) {
|
||||
if(amount<(maxfuel-fuel))
|
||||
return amount;
|
||||
else
|
||||
return maxfuel - addToContainer(aspect,amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aspect getEssentiaType(ForgeDirection face) {
|
||||
return aspect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEssentiaAmount(ForgeDirection face) {
|
||||
return fuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinimumSuction() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderExtendedTube() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +1,18 @@
|
||||
package emt.tile.generator;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class TileEntityIgnisGenerator extends TileEntityBaseGenerator {
|
||||
|
||||
public TileEntityIgnisGenerator() {
|
||||
aspect = Aspect.FIRE;
|
||||
output = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
generating = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return StatCollector.translateToLocal("tile.EMT.essentia.ignis.name");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package emt.tile.generator;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class TileEntityLucrumGenerator extends TileEntityBaseGenerator {
|
||||
|
||||
public TileEntityLucrumGenerator() {
|
||||
aspect = Aspect.GREED;
|
||||
generating = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return StatCollector.translateToLocal("tile.EMT.essentia.lucrum.name");
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,18 @@
|
||||
package emt.tile.generator;
|
||||
|
||||
import emt.util.EMTEssentiasOutputs;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public class TileEntityPotentiaGenerator extends TileEntityBaseGenerator {
|
||||
|
||||
public TileEntityPotentiaGenerator() {
|
||||
aspect = Aspect.ENERGY;
|
||||
output = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
generating = EMTEssentiasOutputs.outputs.get(aspect.getTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return StatCollector.translateToLocal("tile.EMT.essentia.potentia.name");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user