Cleanup and configs. Closes #1469
This commit is contained in:
parent
0648aa1a43
commit
d563ff748a
33 changed files with 782 additions and 948 deletions
src/main/java/techreborn/tiles
TileAssemblingMachine.javaTileAutoCraftingTable.javaTileChargeOMat.javaTileChemicalReactor.javaTileIndustrialCentrifuge.javaTileIndustrialElectrolyzer.javaTileIronAlloyFurnace.javaTileIronFurnace.javaTileMatterFabricator.javaTilePlayerDectector.javaTileRollingMachine.javaTileScrapboxinator.java
fusionReactor
generator
TileDieselGenerator.javaTileDragonEggSyphon.javaTileGasTurbine.javaTileLightningRod.javaTilePlasmaGenerator.javaTileSemiFluidGenerator.javaTileSolidFuelGenerator.javaTileThermalGenerator.javaTileWaterMill.javaTileWindMill.java
multiblock
TileDistillationTower.javaTileImplosionCompressor.javaTileIndustrialBlastFurnace.javaTileIndustrialGrinder.javaTileIndustrialSawmill.javaTileVacuumFreezer.java
teir1
|
@ -44,22 +44,19 @@ import techreborn.lib.ModInfo;
|
|||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileAssemblingMachine extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "assembling_machine", key = "AssemblingMachineMaxInput", comment = "Assembling Machine Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "assembling_machine", key = "AssemblingMachineMaxEnergy", comment = "Assembling Machine Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
// @ConfigRegistry(config = "machines", category = "assembling_machine", key = "AssemblingMachineWrenchDropRate", comment = "Assembling Machine Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileAssemblingMachine", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
public int tickTime;
|
||||
|
||||
public TileAssemblingMachine() {
|
||||
super();
|
||||
// Input slots
|
||||
final int[] inputs = new int[2];
|
||||
inputs[0] = 0;
|
||||
inputs[1] = 1;
|
||||
|
@ -67,32 +64,7 @@ public class TileAssemblingMachine extends TilePowerAcceptor
|
|||
outputs[0] = 2;
|
||||
this.crafter = new RecipeCrafter(Reference.ASSEMBLING_MACHINE_RECIPE, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ASSEMBLY_MACHINE, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void addWailaInfo(List<String> info)
|
||||
// {
|
||||
// super.addWailaInfo(info);
|
||||
// info.add("Power Stored " + energy.getEnergyStored() +" EU");
|
||||
// if(crafter.currentRecipe !=null){
|
||||
// info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
|
@ -100,6 +72,13 @@ public class TileAssemblingMachine extends TilePowerAcceptor
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -125,23 +104,30 @@ public class TileAssemblingMachine extends TilePowerAcceptor
|
|||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ASSEMBLY_MACHINE, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("assemblingmachine").player(player.inventory).inventory(8, 84).hotbar(8, 142)
|
||||
.addInventory().tile(this).slot(0, 47, 17).slot(1, 65, 17).outputSlot(2, 116, 35).energySlot(3, 56, 53)
|
||||
.upgradeSlot(4, 152, 8).upgradeSlot(5, 152, 26).upgradeSlot(6, 152, 44).upgradeSlot(7, 152, 62)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
|
@ -57,7 +58,12 @@ import java.util.List;
|
|||
* Created by modmuss50 on 20/06/2017.
|
||||
*/
|
||||
public class TileAutoCraftingTable extends TilePowerAcceptor
|
||||
implements IContainerProvider, IInventoryProvider, IToolDrop {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "autocrafter", key = "AutoCrafterInput", comment = "AutoCrafting Table Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "autocrafter", key = "AutoCrafterMaxEnergy", comment = "AutoCrafting Table Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
ResourceLocation currentRecipe;
|
||||
|
||||
|
@ -69,6 +75,10 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
public boolean customRecipe = false;
|
||||
InventoryCrafting inventoryCrafting = null;
|
||||
IRecipe lastCustomRecipe = null;
|
||||
|
||||
public TileAutoCraftingTable() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void setCurrentRecipe(IRecipe recipe, boolean customRecipe) {
|
||||
if (recipe != null) {
|
||||
|
@ -132,38 +142,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
return inventoryCrafting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
IRecipe recipe = getIRecipe();
|
||||
if (recipe != null || customRecipe) {
|
||||
if (progress >= maxProgress) {
|
||||
if (make(recipe)) {
|
||||
progress = 0;
|
||||
}
|
||||
} else {
|
||||
if (canMake(recipe)) {
|
||||
if (canUseEnergy(euTick)) {
|
||||
progress++;
|
||||
if(progress == 1){
|
||||
world.playSound(null, pos.getX(), pos.getY(),
|
||||
pos.getZ(), ModSounds.AUTO_CRAFTING,
|
||||
SoundCategory.BLOCKS, 0.3F, 0.8F);
|
||||
}
|
||||
useEnergy(euTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recipe == null) {
|
||||
progress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean canMake(IRecipe recipe) {
|
||||
if (customRecipe) {
|
||||
recipe = getIRecipe();
|
||||
|
@ -219,7 +198,6 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
return hasOutputSpace(stack, 10);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasOutputSpace(ItemStack output, int slot) {
|
||||
ItemStack stack = inventory.getStackInSlot(slot);
|
||||
if (stack.isEmpty()) {
|
||||
|
@ -290,7 +268,6 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean hasIngredient(Ingredient ingredient) {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
|
@ -300,100 +277,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public TileAutoCraftingTable() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return 10000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing enumFacing) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing enumFacing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
return new ContainerBuilder("autocraftingTable").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this)
|
||||
.slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25)
|
||||
.slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43)
|
||||
.slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61)
|
||||
.outputSlot(9, 145, 42).outputSlot(10, 145, 70).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
|
||||
.addInventory().create(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public int getMaxProgress() {
|
||||
if (maxProgress == 0) {
|
||||
maxProgress = 1;
|
||||
}
|
||||
return maxProgress;
|
||||
}
|
||||
|
||||
public void setMaxProgress(int maxProgress) {
|
||||
this.maxProgress = maxProgress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
if (currentRecipe != null) {
|
||||
tag.setString("currentRecipe", currentRecipe.toString());
|
||||
}
|
||||
// Disable due to performance issues
|
||||
// tag.setBoolean("customRecipe", customRecipe);
|
||||
tag.setBoolean("customRecipe", false);
|
||||
return super.writeToNBT(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
if (tag.hasKey("currentRecipe")) {
|
||||
currentRecipe = new ResourceLocation(tag.getString("currentRecipe"));
|
||||
}
|
||||
// Disabled due to performance issues
|
||||
//customRecipe = tag.getBoolean("customRecipe");
|
||||
customRecipe = false;
|
||||
super.readFromNBT(tag);
|
||||
}
|
||||
|
||||
|
||||
public boolean isItemValidForRecipeSlot(IRecipe recipe, ItemStack stack, int slotID) {
|
||||
if (recipe == null) {
|
||||
return true;
|
||||
|
@ -441,7 +325,111 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void setProgress(int progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public int getMaxProgress() {
|
||||
if (maxProgress == 0) {
|
||||
maxProgress = 1;
|
||||
}
|
||||
return maxProgress;
|
||||
}
|
||||
|
||||
public void setMaxProgress(int maxProgress) {
|
||||
this.maxProgress = maxProgress;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
IRecipe recipe = getIRecipe();
|
||||
if (recipe != null || customRecipe) {
|
||||
if (progress >= maxProgress) {
|
||||
if (make(recipe)) {
|
||||
progress = 0;
|
||||
}
|
||||
} else {
|
||||
if (canMake(recipe)) {
|
||||
if (canUseEnergy(euTick)) {
|
||||
progress++;
|
||||
if(progress == 1){
|
||||
world.playSound(null, pos.getX(), pos.getY(),
|
||||
pos.getZ(), ModSounds.AUTO_CRAFTING,
|
||||
SoundCategory.BLOCKS, 0.3F, 0.8F);
|
||||
}
|
||||
useEnergy(euTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recipe == null) {
|
||||
progress = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAcceptEnergy(EnumFacing enumFacing) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy(EnumFacing enumFacing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
if (currentRecipe != null) {
|
||||
tag.setString("currentRecipe", currentRecipe.toString());
|
||||
}
|
||||
// Disable due to performance issues
|
||||
// tag.setBoolean("customRecipe", customRecipe);
|
||||
tag.setBoolean("customRecipe", false);
|
||||
return super.writeToNBT(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
if (tag.hasKey("currentRecipe")) {
|
||||
currentRecipe = new ResourceLocation(tag.getString("currentRecipe"));
|
||||
}
|
||||
// Disabled due to performance issues
|
||||
//customRecipe = tag.getBoolean("customRecipe");
|
||||
customRecipe = false;
|
||||
super.readFromNBT(tag);
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
int bestSlot = findBestSlotForStack(getIRecipe(), stack);
|
||||
|
@ -456,9 +444,30 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
|
|||
public EnumFacing getFacingEnum() {
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer playerIn) {
|
||||
return new ItemStack(ModBlocks.AUTO_CRAFTING_TABLE, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public IInventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(EntityPlayer player) {
|
||||
return new ContainerBuilder("autocraftingTable").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this)
|
||||
.slot(0, 28, 25).slot(1, 46, 25).slot(2, 64, 25)
|
||||
.slot(3, 28, 43).slot(4, 46, 43).slot(5, 64, 43)
|
||||
.slot(6, 28, 61).slot(7, 46, 61).slot(8, 64, 61)
|
||||
.outputSlot(9, 145, 42).outputSlot(10, 145, 70).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress)
|
||||
.syncIntegerValue(this::getMaxProgress, this::setMaxProgress)
|
||||
.addInventory().create(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,6 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
public static int maxInput = 512;
|
||||
@ConfigRegistry(config = "machines", category = "charge_bench", key = "ChargeBenchMaxEnergy", comment = "Charge Bench Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 100000;
|
||||
// @ConfigRegistry(config = "machines", category = "charge_bench", key = "ChargeBenchWrenchDropRate", comment = "Charge Bench Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
|
||||
public Inventory inventory = new Inventory(6, "TileChargeOMat", 64, this);
|
||||
|
||||
|
@ -63,6 +61,7 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
super();
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
@ -95,17 +94,7 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHARGE_O_MAT, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -130,21 +119,30 @@ public class TileChargeOMat extends TilePowerAcceptor
|
|||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHARGE_O_MAT, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("chargebench").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).energySlot(0, 62, 25).energySlot(1, 98, 25).energySlot(2, 62, 45).energySlot(3, 98, 45)
|
||||
.energySlot(4, 62, 65).energySlot(5, 98, 65).syncEnergyValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
|
@ -42,16 +41,13 @@ import techreborn.client.container.builder.ContainerBuilder;
|
|||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileChemicalReactor extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "chemical_reactor", key = "ChemicalReactorMaxInput", comment = "Chemical Reactor Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "chemical_reactor", key = "ChemicalReactorMaxEnergy", comment = "Chemical Reactor Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
// @ConfigRegistry(config = "machines", category = "chemical_reactor", key = "ChemicalReactorWrenchDropRate", comment = "Chemical Reactor Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileChemicalReactor", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
|
@ -65,38 +61,7 @@ public class TileChemicalReactor extends TilePowerAcceptor
|
|||
outputs[0] = 2;
|
||||
this.crafter = new RecipeCrafter(Reference.CHEMICAL_REACTOR_RECIPE, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHEMICAL_REACTOR, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks > 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
|
@ -104,6 +69,15 @@ public class TileChemicalReactor extends TilePowerAcceptor
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -129,20 +103,30 @@ public class TileChemicalReactor extends TilePowerAcceptor
|
|||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.CHEMICAL_REACTOR, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("chemicalreactor").player(player.inventory).inventory().hotbar()
|
||||
.addInventory().tile(this).slot(0, 34, 47).slot(1, 126, 47).outputSlot(2, 80, 47).energySlot(3, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IListInfoProvider;
|
||||
import reborncore.api.IToolDrop;
|
||||
|
@ -50,14 +49,13 @@ import java.util.List;
|
|||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, IListInfoProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "centrifuge", key = "CentrifugeMaxInput", comment = "Centrifuge Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "centrifuge", key = "CentrifugeMaxEnergy", comment = "Centrifuge Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(11, "TileIndustrialCentrifuge", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
|
@ -73,7 +71,15 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
|||
|
||||
this.crafter = new RecipeCrafter(Reference.CENTRIFUGE_RECIPE, this, 2, 4, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (!this.world.isRemote) {
|
||||
|
@ -82,37 +88,6 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_CENTRIFUGE, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInfo(final List<String> info, final boolean isRealTile) {
|
||||
super.addInfo(info, isRealTile);
|
||||
info.add("Round and round it goes");
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -137,17 +112,20 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
|||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_CENTRIFUGE, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("centrifuge").player(player.inventory).inventory().hotbar()
|
||||
|
@ -158,5 +136,17 @@ public class TileIndustrialCentrifuge extends TilePowerAcceptor
|
|||
.outputSlot(4, 120, 44).outputSlot(5, 101, 63).energySlot(6, 8, 72).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IListInfoProvider
|
||||
@Override
|
||||
public void addInfo(final List<String> info, final boolean isRealTile) {
|
||||
super.addInfo(info, isRealTile);
|
||||
info.add("Round and round it goes");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
|
@ -47,16 +46,13 @@ import techreborn.lib.ModInfo;
|
|||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "industrial_electrolyzer", key = "IndustrialElectrolyzerMaxInput", comment = "Industrial Electrolyzer Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "industrial_electrolyzer", key = "IndustrialElectrolyzerMaxEnergy", comment = "Industrial Electrolyzer Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
// @ConfigRegistry(config = "machines", category = "industrial_electrolyzer", key = "IndustrialElectrolyzerWrenchDropRate", comment = "Industrial Electrolyzer Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileIndustrialElectrolyzer", 64, this);
|
||||
public RecipeCrafter crafter;
|
||||
|
||||
|
@ -74,46 +70,7 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
outputs[3] = 5;
|
||||
this.crafter = new RecipeCrafter(Reference.INDUSTRIAL_ELECTROLYZER_RECIPE, this, 2, 4, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (this.world.isRemote) { return; }
|
||||
super.update();
|
||||
this.charge(6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_ELECTROLYZER, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void addWailaInfo(List<String> info)
|
||||
// {
|
||||
// super.addWailaInfo(info);
|
||||
// info.add("Power Stored " + energy.getEnergyStored() +" EU");
|
||||
// if(crafter.currentRecipe !=null){
|
||||
// info.add("Power Usage " + crafter.currentRecipe.euPerTick() + " EU/t");
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
|
@ -121,6 +78,14 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (this.world.isRemote) { return; }
|
||||
super.update();
|
||||
this.charge(6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -145,17 +110,20 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_ELECTROLYZER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialelectrolyzer").player(player.inventory).inventory().hotbar()
|
||||
|
@ -165,4 +133,10 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor
|
|||
.outputSlot(2, 51, 24).outputSlot(3, 71, 24).outputSlot(4, 91, 24).outputSlot(5, 111, 24)
|
||||
.energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,9 +52,6 @@ import techreborn.lib.ModInfo;
|
|||
public class TileIronAlloyFurnace extends TileLegacyMachineBase
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
|
||||
// @ConfigRegistry(config = "machines", category = "alloy_furnace", key = "AlloyFurnaceWrenchDropRate", comment = "Alloy Furnace Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(4, "TileIronAlloyFurnace", 64, this);
|
||||
public int burnTime;
|
||||
|
|
|
@ -39,11 +39,7 @@ import techreborn.client.container.builder.BuiltContainer;
|
|||
import techreborn.client.container.builder.ContainerBuilder;
|
||||
|
||||
public class TileIronFurnace extends TileLegacyMachineBase
|
||||
implements IInventoryProvider, IContainerProvider {
|
||||
|
||||
private static final int[] SLOTS_TOP = new int[] { 0, 2 };
|
||||
private static final int[] SLOTS_BOTTOM = new int[] { 1 };
|
||||
private static final int[] SLOTS_SIDES = new int[] { 0, 1 };
|
||||
implements IInventoryProvider, IContainerProvider {
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(3, "TileIronFurnace", 64, this);
|
||||
|
|
|
@ -50,59 +50,20 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
@ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorMaxInput", comment = "Matter Fabricator Max Input (Value in EU)")
|
||||
public static int maxInput = 8192;
|
||||
@ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorMaxEnergy", comment = "Matter Fabricator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 100000000;
|
||||
public static int maxEnergy = 100_000_000;
|
||||
@ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorFabricationRate", comment = "Matter Fabricator Fabrication Rate, amount of amplifier units per UUM")
|
||||
public static int fabricationRate = 10000;
|
||||
public static int fabricationRate = 10_000;
|
||||
@ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorEnergyPerAmp", comment = "Matter Fabricator EU per amplifier unit, multiply this with the rate for total EU")
|
||||
public static int energyPerAmp = 1666;
|
||||
// @ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorWrenchDropRate", comment = "Matter Fabricator Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
|
||||
|
||||
public Inventory inventory = new Inventory(12, "TileMatterFabricator", 64, this);
|
||||
private int amplifier = 0;
|
||||
|
||||
public TileMatterFabricator() {
|
||||
super();
|
||||
// TODO configs
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.MATTER_FABRICATOR, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
|
||||
super.update();
|
||||
this.charge(11);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
final ItemStack stack = this.inventory.getStackInSlot(i);
|
||||
if (!stack.isEmpty() && spaceForOutput()) {
|
||||
final int amp = this.getValue(stack);
|
||||
final int euNeeded = amp * energyPerAmp;
|
||||
if (amp != 0 && this.canUseEnergy(euNeeded)) {
|
||||
this.useEnergy(euNeeded);
|
||||
this.amplifier += amp;
|
||||
this.inventory.decrStackSize(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (amplifier >= fabricationRate) {
|
||||
if (spaceForOutput()) {
|
||||
this.addOutputProducts();
|
||||
amplifier -= fabricationRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean spaceForOutput() {
|
||||
for (int i = 6; i < 11; i++) {
|
||||
if (spaceForOutput(i)) {
|
||||
|
@ -148,7 +109,6 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getValue(final ItemStack itemStack) {
|
||||
|
@ -164,6 +124,50 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return this.amplifier;
|
||||
}
|
||||
|
||||
public void setProgress(final int progress) {
|
||||
this.amplifier = progress;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.amplifier != 0) {
|
||||
return Math.min(this.amplifier * scale / fabricationRate, 100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
|
||||
super.update();
|
||||
this.charge(11);
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
final ItemStack stack = this.inventory.getStackInSlot(i);
|
||||
if (!stack.isEmpty() && spaceForOutput()) {
|
||||
final int amp = this.getValue(stack);
|
||||
final int euNeeded = amp * energyPerAmp;
|
||||
if (amp != 0 && this.canUseEnergy(euNeeded)) {
|
||||
this.useEnergy(euNeeded);
|
||||
this.amplifier += amp;
|
||||
this.inventory.decrStackSize(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (amplifier >= fabricationRate) {
|
||||
if (spaceForOutput()) {
|
||||
this.addOutputProducts();
|
||||
amplifier -= fabricationRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
|
@ -189,27 +193,26 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
//TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.MATTER_FABRICATOR, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return this.amplifier;
|
||||
}
|
||||
|
||||
public void setProgress(final int progress) {
|
||||
this.amplifier = progress;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.amplifier != 0) {
|
||||
return Math.min(this.amplifier * scale / fabricationRate, 100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("matterfabricator").player(player.inventory).inventory().hotbar().addInventory()
|
||||
|
@ -218,9 +221,4 @@ public class TileMatterFabricator extends TilePowerAcceptor
|
|||
.outputSlot(9, 100, 66).outputSlot(10, 120, 66).energySlot(11, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "player_detector", key = "PlayerDetectorMaxEnergy", comment = "Player Detector Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "player_detector", key = "PlayerDetectorEUPerSecond", comment = "Player Detector Energy Consumption per second (Value in EU)")
|
||||
public static int euPerTick = 10;
|
||||
|
||||
public String owenerUdid = "";
|
||||
boolean redstone = false;
|
||||
|
@ -53,7 +55,48 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
public TilePlayerDectector() {
|
||||
super();
|
||||
}
|
||||
|
||||
public boolean isProvidingPower() {
|
||||
return redstone;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (!world.isRemote && world.getWorldTime() % 20 == 0) {
|
||||
boolean lastRedstone = redstone;
|
||||
redstone = false;
|
||||
if (canUseEnergy(euPerTick)) {
|
||||
Iterator<EntityPlayer> tIterator = super.world.playerEntities.iterator();
|
||||
while (tIterator.hasNext()) {
|
||||
EntityPlayer player = (EntityPlayer) tIterator.next();
|
||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D,
|
||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) world.getBlockState(pos).getBlock();
|
||||
int meta = blockMachineBase.getMetaFromState(world.getBlockState(pos));
|
||||
if (meta == 0) {// ALL
|
||||
redstone = true;
|
||||
} else if (meta == 1) {// Others
|
||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
} else {// You
|
||||
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
useEnergy(euPerTick);
|
||||
}
|
||||
if (lastRedstone != redstone) {
|
||||
WorldUtils.updateBlock(world, getPos());
|
||||
world.notifyNeighborsOfStateChange(getPos(), world.getBlockState(getPos()).getBlock(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -79,46 +122,6 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
return maxInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (!world.isRemote && world.getWorldTime() % 20 == 0) {
|
||||
boolean lastRedstone = redstone;
|
||||
redstone = false;
|
||||
if (canUseEnergy(10)) {
|
||||
Iterator<EntityPlayer> tIterator = super.world.playerEntities.iterator();
|
||||
while (tIterator.hasNext()) {
|
||||
EntityPlayer player = (EntityPlayer) tIterator.next();
|
||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D,
|
||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||
BlockMachineBase blockMachineBase = (BlockMachineBase) world.getBlockState(pos).getBlock();
|
||||
int meta = blockMachineBase.getMetaFromState(world.getBlockState(pos));
|
||||
if (meta == 0) {// ALL
|
||||
redstone = true;
|
||||
} else if (meta == 1) {// Others
|
||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
} else {// You
|
||||
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUniqueID().toString())) {
|
||||
redstone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
useEnergy(10);
|
||||
}
|
||||
if (lastRedstone != redstone) {
|
||||
WorldUtils.updateBlock(world, getPos());
|
||||
world.notifyNeighborsOfStateChange(getPos(), world.getBlockState(getPos()).getBlock(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isProvidingPower() {
|
||||
return redstone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
@ -132,6 +135,7 @@ public class TilePlayerDectector extends TilePowerAcceptor implements IToolDrop
|
|||
return tag;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer p0) {
|
||||
return new ItemStack(ModBlocks.PLAYER_DETECTOR, 1, 0);
|
||||
|
|
|
@ -60,8 +60,6 @@ public class TileRollingMachine extends TilePowerAcceptor
|
|||
public static int runTime = 250;
|
||||
@ConfigRegistry(config = "machines", category = "rolling_machine", key = "RollingMachineMaxEnergy", comment = "Rolling Machine Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
// @ConfigRegistry(config = "machines", category = "rolling_machine", key = "RollingMachineWrenchDropRate", comment = "Rolling Machi Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
|
||||
public final InventoryCrafting craftMatrix = new InventoryCrafting(new RollingTileContainer(), 3, 3);
|
||||
public Inventory inventory = new Inventory(3, "TileRollingMachine", 64, this);
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
|
@ -79,19 +78,6 @@ public class TileScrapboxinator extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
|
|
@ -51,9 +51,9 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
@ConfigRegistry(config = "machines", category = "fusion_reactor", key = "FusionReactorMaxInput", comment = "Fusion Reactor Max Input (Value in EU)")
|
||||
public static int maxInput = 8192;
|
||||
@ConfigRegistry(config = "machines", category = "fusion_reactor", key = "FusionReactorMaxOutput", comment = "Fusion Reactor Max Output (Value in EU)")
|
||||
public static int maxOutput = 1000000;
|
||||
public static int maxOutput = 1_000_000;
|
||||
@ConfigRegistry(config = "machines", category = "fusion_reactor", key = "FusionReactorMaxEnergy", comment = "Fusion Reactor Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 100000000;
|
||||
public static int maxEnergy = 100_000_000;
|
||||
|
||||
public Inventory inventory;
|
||||
|
||||
|
@ -342,21 +342,6 @@ public class TileFusionControlComputer extends TilePowerAcceptor
|
|||
return false;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean hasCustomName() {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ITextComponent getDisplayName() {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer p0) {
|
||||
|
|
|
@ -38,13 +38,13 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileDieselGenerator extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorMaxOutput", comment = "Diesel Generator Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "diesel_generator", key = "DieselGeneratorMaxOutput", comment = "Diesel Generator Max Output (Value in EU)")
|
||||
public static int maxOutput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorMaxEnergy", comment = "Diesel Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000000;
|
||||
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorTankCapacity", comment = "Diesel Generator Tank Capacity")
|
||||
public static int tankCapacity = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "diesel_generator", key = "DieselGeneratorEnergyPerTick", comment = "Diesel Generator Energy Per Tick (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "diesel_generator", key = "DieselGeneratorMaxEnergy", comment = "Diesel Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1_000_000;
|
||||
@ConfigRegistry(config = "generators", category = "diesel_generator", key = "DieselGeneratorTankCapacity", comment = "Diesel Generator Tank Capacity")
|
||||
public static int tankCapacity = 10_000;
|
||||
@ConfigRegistry(config = "generators", category = "diesel_generator", key = "DieselGeneratorEnergyPerTick", comment = "Diesel Generator Energy Per Tick (Value in EU)")
|
||||
public static int energyPerTick = 20;
|
||||
|
||||
public TileDieselGenerator() {
|
||||
|
|
|
@ -42,11 +42,11 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileDragonEggSyphon extends TilePowerAcceptor implements IToolDrop, IInventoryProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "dragon_egg_siphoner", key = "DragonEggSiphonerMaxOutput", comment = "Dragon Egg Siphoner Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "dragon_egg_siphoner", key = "DragonEggSiphonerMaxOutput", comment = "Dragon Egg Siphoner Max Output (Value in EU)")
|
||||
public static int maxOutput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "dragon_egg_siphoner", key = "DragonEggSiphonerMaxEnergy", comment = "Dragon Egg Siphoner Max Energy (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "dragon_egg_siphoner", key = "DragonEggSiphonerMaxEnergy", comment = "Dragon Egg Siphoner Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
@ConfigRegistry(config = "machines", category = "dragon_egg_siphoner", key = "DragonEggSiphonerEnergyPerTick", comment = "Dragon Egg Siphoner Energy Per Tick (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "dragon_egg_siphoner", key = "DragonEggSiphonerEnergyPerTick", comment = "Dragon Egg Siphoner Energy Per Tick (Value in EU)")
|
||||
public static int energyPerTick = 4;
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileDragonEggSyphon", 64, this);
|
||||
|
|
|
@ -38,13 +38,13 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileGasTurbine extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorMaxOutput", comment = "Gas Generator Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "gas_generator", key = "GasGeneratorMaxOutput", comment = "Gas Generator Max Output (Value in EU)")
|
||||
public static int maxOutput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorMaxEnergy", comment = "Gas Generator Max Energy (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "gas_generator", key = "GasGeneratorMaxEnergy", comment = "Gas Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000000;
|
||||
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorTankCapacity", comment = "Gas Generator Tank Capacity")
|
||||
@ConfigRegistry(config = "generators", category = "gas_generator", key = "GasGeneratorTankCapacity", comment = "Gas Generator Tank Capacity")
|
||||
public static int tankCapacity = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "gas_generator", key = "GasGeneratorEnergyPerTick", comment = "Gas Generator Energy Per Tick (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "gas_generator", key = "GasGeneratorEnergyPerTick", comment = "Gas Generator Energy Per Tick (Value in EU)")
|
||||
public static int energyPerTick = 16;
|
||||
|
||||
public TileGasTurbine() {
|
||||
|
|
|
@ -42,13 +42,13 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileLightningRod extends TilePowerAcceptor implements IToolDrop {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodMaxOutput", comment = "Lightning Rod Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "lightning_rod", key = "LightningRodMaxOutput", comment = "Lightning Rod Max Output (Value in EU)")
|
||||
public static int maxOutput = 2048;
|
||||
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodMaxEnergy", comment = "Lightning Rod Max Energy (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "lightning_rod", key = "LightningRodMaxEnergy", comment = "Lightning Rod Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000000;
|
||||
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodChanceOfStrike", comment = "Chance of lightning striking a rod (Range: 0-70)")
|
||||
@ConfigRegistry(config = "generators", category = "lightning_rod", key = "LightningRodChanceOfStrike", comment = "Chance of lightning striking a rod (Range: 0-70)")
|
||||
public static int chanceOfStrike = 24;
|
||||
@ConfigRegistry(config = "machines", category = "lightning_rod", key = "LightningRodBaseStrikeEnergy", comment = "Base amount of energy per strike (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "lightning_rod", key = "LightningRodBaseStrikeEnergy", comment = "Base amount of energy per strike (Value in EU)")
|
||||
public static int baseEnergyStrike = 2048;
|
||||
|
||||
private int onStatusHoldTicks = -1;
|
||||
|
|
|
@ -35,13 +35,13 @@ import techreborn.init.ModBlocks;
|
|||
|
||||
public class TilePlasmaGenerator extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorMaxOutput", comment = "Plasma Generator Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "plasma_generator", key = "PlasmaGeneratorMaxOutput", comment = "Plasma Generator Max Output (Value in EU)")
|
||||
public static int maxOutput = 2048;
|
||||
@ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorMaxEnergy", comment = "Plasma Generator Max Energy (Value in EU)")
|
||||
public static double maxEnergy = 500000000;
|
||||
@ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorTankCapacity", comment = "Plasma Generator Tank Capacity")
|
||||
public static int tankCapacity = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "plasma_generator", key = "PlasmaGeneratorEnergyPerTick", comment = "Plasma Generator Energy Per Tick (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "plasma_generator", key = "PlasmaGeneratorMaxEnergy", comment = "Plasma Generator Max Energy (Value in EU)")
|
||||
public static double maxEnergy = 500_000_000;
|
||||
@ConfigRegistry(config = "generators", category = "plasma_generator", key = "PlasmaGeneratorTankCapacity", comment = "Plasma Generator Tank Capacity")
|
||||
public static int tankCapacity = 10_000;
|
||||
@ConfigRegistry(config = "generators", category = "plasma_generator", key = "PlasmaGeneratorEnergyPerTick", comment = "Plasma Generator Energy Per Tick (Value in EU)")
|
||||
public static int energyPerTick = 400;
|
||||
|
||||
public TilePlasmaGenerator() {
|
||||
|
|
|
@ -38,13 +38,13 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileSemiFluidGenerator extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorMaxOutput", comment = "Semifluid Generator Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "semifluid_generator", key = "SemifluidGeneratorMaxOutput", comment = "Semifluid Generator Max Output (Value in EU)")
|
||||
public static int maxOutput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorMaxEnergy", comment = "Semifluid Generator Max Energy (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "semifluid_generator", key = "SemifluidGeneratorMaxEnergy", comment = "Semifluid Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000000;
|
||||
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorTankCapacity", comment = "Semifluid Generator Tank Capacity")
|
||||
@ConfigRegistry(config = "generators", category = "semifluid_generator", key = "SemifluidGeneratorTankCapacity", comment = "Semifluid Generator Tank Capacity")
|
||||
public static int tankCapacity = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "semifluid_generator", key = "SemifluidGeneratorEnergyPerTick", comment = "Semifluid Generator Energy Per Tick (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "semifluid_generator", key = "SemifluidGeneratorEnergyPerTick", comment = "Semifluid Generator Energy Per Tick (Value in EU)")
|
||||
public static int energyPerTick = 8;
|
||||
|
||||
public TileSemiFluidGenerator() {
|
||||
|
|
|
@ -47,11 +47,11 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "generator", key = "GeneratorMaxOutput", comment = "Solid Fuel Generator Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "generator", key = "GeneratorMaxOutput", comment = "Solid Fuel Generator Max Output (Value in EU)")
|
||||
public static int maxOutput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "generator", key = "GeneratorMaxEnergy", comment = "Solid Fuel Generator Max Energy (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "generator", key = "GeneratorMaxEnergy", comment = "Solid Fuel Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "generator", key = "GeneratorEnergyOutput", comment = "Solid Fuel Generator Energy Output Amount (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "generator", key = "GeneratorEnergyOutput", comment = "Solid Fuel Generator Energy Output Amount (Value in EU)")
|
||||
public static int outputAmount = 10;
|
||||
|
||||
public Inventory inventory = new Inventory(2, "TileSolidFuelGenerator", 64, this);
|
||||
|
|
|
@ -38,13 +38,13 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileThermalGenerator extends TileBaseFluidGenerator implements IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorMaxOutput", comment = "Thermal Generator Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorMaxOutput", comment = "Thermal Generator Max Output (Value in EU)")
|
||||
public static int maxOutput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorMaxEnergy", comment = "Thermal Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000000;
|
||||
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorTankCapacity", comment = "Thermal Generator Tank Capacity")
|
||||
public static int tankCapacity = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "thermal_generator", key = "ThermalGeneratorEnergyPerTick", comment = "Thermal Generator Energy Per Tick (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorMaxEnergy", comment = "Thermal Generator Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1_000_000;
|
||||
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorTankCapacity", comment = "Thermal Generator Tank Capacity")
|
||||
public static int tankCapacity = 10_000;
|
||||
@ConfigRegistry(config = "generators", category = "thermal_generator", key = "ThermalGeneratorEnergyPerTick", comment = "Thermal Generator Energy Per Tick (Value in EU)")
|
||||
public static int energyPerTick = 10;
|
||||
|
||||
public TileThermalGenerator() {
|
||||
|
|
|
@ -42,11 +42,11 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileWaterMill extends TilePowerAcceptor implements IToolDrop {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "water_mill", key = "WaterMillMaxOutput", comment = "Water Mill Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "water_mill", key = "WaterMillMaxOutput", comment = "Water Mill Max Output (Value in EU)")
|
||||
public static int maxOutput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "water_mill", key = "WaterMillMaxEnergy", comment = "Water Mill Max Energy (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "water_mill", key = "WaterMillMaxEnergy", comment = "Water Mill Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
@ConfigRegistry(config = "machines", category = "water_mill", key = "WaterMillEnergyPerTick", comment = "Water Mill Energy Multiplier")
|
||||
@ConfigRegistry(config = "generators", category = "water_mill", key = "WaterMillEnergyPerTick", comment = "Water Mill Energy Multiplier")
|
||||
public static double energyMultiplier = 0.1;
|
||||
|
||||
int waterblocks = 0;
|
||||
|
|
|
@ -41,17 +41,15 @@ import techreborn.lib.ModInfo;
|
|||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillMaxOutput", comment = "Wind Mill Max Output (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "wind_mill", key = "WindMillMaxOutput", comment = "Wind Mill Max Output (Value in EU)")
|
||||
public static int maxOutput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillMaxEnergy", comment = "Wind Mill Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillEnergyPerTick", comment = "Wind Mill Energy Per Tick (Value in EU)")
|
||||
@ConfigRegistry(config = "generators", category = "wind_mill", key = "WindMillMaxEnergy", comment = "Wind Mill Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10_000;
|
||||
@ConfigRegistry(config = "generators", category = "wind_mill", key = "WindMillEnergyPerTick", comment = "Wind Mill Energy Per Tick (Value in EU)")
|
||||
public static int baseEnergy = 2;
|
||||
@ConfigRegistry(config = "machines", category = "wind_mill", key = "WindMillThunderMultiplier", comment = "Wind Mill Thunder Multiplier")
|
||||
@ConfigRegistry(config = "generators", category = "wind_mill", key = "WindMillThunderMultiplier", comment = "Wind Mill Thunder Multiplier")
|
||||
public static double thunderMultiplier = 1.25;
|
||||
|
||||
int basePower = 16;
|
||||
|
||||
public TileWindMill() {
|
||||
super();
|
||||
}
|
||||
|
@ -60,7 +58,7 @@ public class TileWindMill extends TilePowerAcceptor implements IToolDrop {
|
|||
public void update() {
|
||||
super.update();
|
||||
if (this.pos.getY() > 64) {
|
||||
int actualPower = this.basePower;
|
||||
int actualPower = baseEnergy;
|
||||
if (this.world.isThundering()) {
|
||||
actualPower *= thunderMultiplier;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.IToolDrop;
|
||||
|
@ -129,19 +128,6 @@ public class TileDistillationTower extends TilePowerAcceptor
|
|||
return maxInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(EntityPlayer p0) {
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles.multiblock;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import reborncore.api.IToolDrop;
|
||||
|
@ -46,16 +45,16 @@ import techreborn.lib.ModInfo;
|
|||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileImplosionCompressor extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "implosion_compressor", key = "ImplosionCompressorMaxInput", comment = "Implosion Compressor Max Input (Value in EU)")
|
||||
public static int maxInput = 64;
|
||||
@ConfigRegistry(config = "machines", category = "implosion_compressor", key = "ImplosionCompressorMaxEnergy", comment = "Implosion Compressor Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 64000;
|
||||
public static int maxEnergy = 64_000;
|
||||
|
||||
public Inventory inventory = new Inventory(5, "TileImplosionCompressor", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public RecipeCrafter crafter;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
||||
public TileImplosionCompressor() {
|
||||
super();
|
||||
|
@ -63,16 +62,12 @@ public class TileImplosionCompressor extends TilePowerAcceptor
|
|||
final int[] outputs = new int[] { 2, 3 };
|
||||
this.crafter = new RecipeCrafter(Reference.IMPLOSION_COMPRESSOR_RECIPE, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.IMPLOSION_COMPRESSOR, 1);
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
|
@ -82,6 +77,7 @@ public class TileImplosionCompressor extends TilePowerAcceptor
|
|||
return down && chamber && up;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (this.world.isRemote) { return; }
|
||||
|
@ -91,26 +87,6 @@ public class TileImplosionCompressor extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -135,22 +111,37 @@ public class TileImplosionCompressor extends TilePowerAcceptor
|
|||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// TileEntity
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down(3));
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.IMPLOSION_COMPRESSOR, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("implosioncompressor").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 92, 36).outputSlot(3, 110, 36)
|
||||
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -56,13 +55,13 @@ import techreborn.multiblocks.MultiBlockCasing;
|
|||
import techreborn.tiles.TileMachineCasing;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements IToolDrop, IInventoryProvider,
|
||||
ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider, IContainerProvider {
|
||||
public class TileIndustrialBlastFurnace extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, ITileRecipeHandler<BlastFurnaceRecipe> {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "industrial_furnace", key = "IndustrialFurnaceMaxInput", comment = "Industrial Blast Furnace Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "industrial_furnace", key = "IndustrialFurnaceMaxEnergy", comment = "Industrial Blast Furnace Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public Inventory inventory;
|
||||
public RecipeCrafter crafter;
|
||||
|
@ -77,38 +76,6 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
this.crafter = new RecipeCrafter(Reference.BLAST_FURNACE_RECIPE, this, 2, 2, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
final boolean layer0 = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean layer1 = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 1, 0));
|
||||
final boolean layer2 = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 2, 0));
|
||||
final boolean layer3 = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 3, 0));
|
||||
final Block centerBlock1 = this.multiblockChecker.getBlock(0, 1, 0).getBlock();
|
||||
final Block centerBlock2 = this.multiblockChecker.getBlock(0, 2, 0).getBlock();
|
||||
final boolean center1 = (centerBlock1 == Blocks.AIR || centerBlock1 == Blocks.LAVA);
|
||||
final boolean center2 = (centerBlock2 == Blocks.AIR || centerBlock2 == Blocks.LAVA);
|
||||
return layer0 && layer1 && layer2 && layer3 && center1 && center2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
|
||||
if (this.multiblockChecker == null) {
|
||||
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2);
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, pos);
|
||||
}
|
||||
|
||||
if (this.getMutliBlock()) {
|
||||
super.update();
|
||||
this.charge(4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE, 1);
|
||||
}
|
||||
|
||||
public int getHeat() {
|
||||
if (!this.getMutliBlock()){
|
||||
return 0;
|
||||
|
@ -150,27 +117,19 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
|
||||
this.world.markBlockRangeForRenderUpdate(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX(),
|
||||
this.getPos().getY(), this.getPos().getZ());
|
||||
this.readFromNBT(packet.getNbtCompound());
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
final boolean layer0 = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, MultiblockChecker.ZERO_OFFSET);
|
||||
final boolean layer1 = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 1, 0));
|
||||
final boolean layer2 = this.multiblockChecker.checkRingY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 2, 0));
|
||||
final boolean layer3 = this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.CASING_ANY, new BlockPos(0, 3, 0));
|
||||
final Block centerBlock1 = this.multiblockChecker.getBlock(0, 1, 0).getBlock();
|
||||
final Block centerBlock2 = this.multiblockChecker.getBlock(0, 2, 0).getBlock();
|
||||
final boolean center1 = (centerBlock1 == Blocks.AIR || centerBlock1 == Blocks.LAVA);
|
||||
final boolean center2 = (centerBlock2 == Blocks.AIR || centerBlock2 == Blocks.LAVA);
|
||||
return layer0 && layer1 && layer2 && layer3 && center1 && center2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
|
@ -178,6 +137,30 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void setHeat(final int heat) {
|
||||
this.cachedHeat = heat;
|
||||
}
|
||||
|
||||
public int getCachedHeat() {
|
||||
return this.cachedHeat;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
|
||||
if (this.multiblockChecker == null) {
|
||||
final BlockPos pos = this.getPos().offset(this.getFacing().getOpposite(), 2);
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, pos);
|
||||
}
|
||||
|
||||
if (this.getMutliBlock()) {
|
||||
super.update();
|
||||
this.charge(4);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -202,7 +185,43 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
public double getBaseMaxInput() {
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public void onDataPacket(final NetworkManager net, final SPacketUpdateTileEntity packet) {
|
||||
this.world.markBlockRangeForRenderUpdate(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), this.getPos().getX(),
|
||||
this.getPos().getY(), this.getPos().getZ());
|
||||
this.readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_BLAST_FURNACE, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 93, 37).outputSlot(3, 113, 37)
|
||||
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.syncIntegerValue(this::getHeat, this::setHeat).addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// ITileRecipeHandler
|
||||
@Override
|
||||
public boolean canCraft(final TileEntity tile, final BlastFurnaceRecipe recipe) {
|
||||
if (tile instanceof TileIndustrialBlastFurnace) {
|
||||
|
@ -216,30 +235,4 @@ public class TileIndustrialBlastFurnace extends TilePowerAcceptor implements ITo
|
|||
public boolean onCraft(final TileEntity tile, final BlastFurnaceRecipe recipe) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
public void setHeat(final int heat) {
|
||||
this.cachedHeat = heat;
|
||||
}
|
||||
|
||||
public int getCachedHeat() {
|
||||
return this.cachedHeat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("blastfurnace").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 50, 27).slot(1, 50, 47).outputSlot(2, 93, 37).outputSlot(3, 113, 37)
|
||||
.energySlot(4, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.syncIntegerValue(this::getHeat, this::setHeat).addInventory().create(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,13 +57,13 @@ import techreborn.init.ModBlocks;
|
|||
import techreborn.lib.ModInfo;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDrop, IInventoryProvider,
|
||||
ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider, IContainerProvider {
|
||||
public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, ITileRecipeHandler<IndustrialGrinderRecipe> {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "industrial_grinder", key = "IndustrialGrinderMaxInput", comment = "Industrial Grinder Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "industrial_grinder", key = "IndustrialGrinderMaxEnergy", comment = "Industrial Grinder Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
public Inventory inventory;
|
||||
|
@ -83,11 +83,6 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_GRINDER, 1);
|
||||
}
|
||||
|
||||
public boolean getMutliBlock() {
|
||||
if (multiblockChecker == null) {
|
||||
return false;
|
||||
|
@ -103,7 +98,15 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
|| centerBlock.getBlock() instanceof IFluidBlock) && centerBlock.getMaterial() == Material.WATER);
|
||||
return down && center && blade && up;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
@ -128,59 +131,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.tank.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.tank.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return (T) this.tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == 1) {
|
||||
if (itemStack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)){
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -206,6 +157,79 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
return maxInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.tank.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return (T) this.tank;
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == 1) {
|
||||
if (itemStack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)){
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_GRINDER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
// fluidSlot first to support automation and shift-click
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// ITileRecipeHandler
|
||||
@Override
|
||||
public boolean canCraft(final TileEntity tile, final IndustrialGrinderRecipe recipe) {
|
||||
if (!getMutliBlock()) {
|
||||
|
@ -251,24 +275,4 @@ public class TileIndustrialGrinder extends TilePowerAcceptor implements IToolDro
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
// fluidSlot first to support automation and shift-click
|
||||
return new ContainerBuilder("industrialgrinder").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 18).outputSlot(3, 126, 36)
|
||||
.outputSlot(4, 126, 54).outputSlot(5, 126, 72).outputSlot(6, 34, 55).energySlot(7, 8, 72)
|
||||
.syncEnergyValue().syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -57,13 +57,13 @@ import techreborn.init.ModBlocks;
|
|||
import techreborn.lib.ModInfo;
|
||||
|
||||
@RebornRegistry(modID = ModInfo.MOD_ID)
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDrop,
|
||||
ITileRecipeHandler<IndustrialSawmillRecipe>, IRecipeCrafterProvider, IInventoryProvider, IContainerProvider {
|
||||
public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider, ITileRecipeHandler<IndustrialSawmillRecipe> {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "industrial_sawmill", key = "IndustrialSawmillMaxInput", comment = "Industrial Sawmill Max Input (Value in EU)")
|
||||
public static int maxInput = 128;
|
||||
@ConfigRegistry(config = "machines", category = "industrial_sawmill", key = "IndustrialSawmillMaxEnergy", comment = "Industrial Sawmill Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 10000;
|
||||
public static int maxEnergy = 10_000;
|
||||
|
||||
public static final int TANK_CAPACITY = 16000;
|
||||
public Inventory inventory;
|
||||
|
@ -72,9 +72,6 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro
|
|||
public MultiblockChecker multiblockChecker;
|
||||
int ticksSinceLastChange;
|
||||
|
||||
//int tickTime;
|
||||
//IndustrialSawmillRecipe smRecipe;
|
||||
|
||||
public TileIndustrialSawmill() {
|
||||
super();
|
||||
this.tank = new Tank("TileSawmill", TileIndustrialSawmill.TANK_CAPACITY, this);
|
||||
|
@ -109,6 +106,7 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
@ -133,41 +131,7 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro
|
|||
|
||||
tank.compareAndUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.tank.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.tank.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
if (this.tank != null) {
|
||||
return (T) this.tank;
|
||||
}
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -193,6 +157,39 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro
|
|||
return maxInput;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.tank.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.tank.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability(final Capability<?> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
return true;
|
||||
}
|
||||
return super.hasCapability(capability, facing);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <T> T getCapability(final Capability<T> capability, final EnumFacing facing) {
|
||||
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
|
||||
if (this.tank != null) {
|
||||
return (T) this.tank;
|
||||
}
|
||||
}
|
||||
return super.getCapability(capability, facing);
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == 1) {
|
||||
|
@ -210,6 +207,27 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro
|
|||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.INDUSTRIAL_SAWMILL, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialsawmill").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 25).outputSlot(3, 126, 43)
|
||||
.outputSlot(4, 126, 61).outputSlot(5, 34, 55).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// ITileRecipeHandler
|
||||
@Override
|
||||
|
@ -256,25 +274,4 @@ public class TileIndustrialSawmill extends TilePowerAcceptor implements IToolDro
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("industrialsawmill").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).fluidSlot(1, 34, 35).slot(0, 84, 43).outputSlot(2, 126, 25).outputSlot(3, 126, 43)
|
||||
.outputSlot(4, 126, 61).outputSlot(5, 34, 55).energySlot(6, 8, 72).syncEnergyValue().syncCrafterValue()
|
||||
.addInventory().create(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,13 +26,13 @@ package techreborn.tiles.multiblock;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.recipes.RecipeCrafter;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.api.Reference;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
|
@ -41,11 +41,17 @@ import techreborn.client.container.builder.ContainerBuilder;
|
|||
import techreborn.init.ModBlocks;
|
||||
|
||||
public class TileVacuumFreezer extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider, IRecipeCrafterProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "vacuumfreezer", key = "VacuumFreezerInput", comment = "Vacuum Freezer Max Input (Value in EU)")
|
||||
public static int maxInput = 64;
|
||||
@ConfigRegistry(config = "machines", category = "vacuumfreezer", key = "VacuumFreezerMaxEnergy", comment = "Vacuum Freezer Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 64000;
|
||||
|
||||
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
|
||||
public MultiblockChecker multiblockChecker;
|
||||
public RecipeCrafter crafter;
|
||||
public MultiblockChecker multiblockChecker;
|
||||
|
||||
|
||||
public TileVacuumFreezer() {
|
||||
super();
|
||||
|
@ -53,13 +59,19 @@ public class TileVacuumFreezer extends TilePowerAcceptor
|
|||
final int[] outputs = new int[] { 1 };
|
||||
this.crafter = new RecipeCrafter(Reference.VACUUM_FREEZER_RECIPE, this, 2, 1, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down());
|
||||
|
||||
public boolean getMultiBlock() {
|
||||
return this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
if (world.isRemote){ return; }
|
||||
|
@ -69,13 +81,9 @@ public class TileVacuumFreezer extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
public boolean getMultiBlock() {
|
||||
return this.multiblockChecker.checkRectY(1, 1, MultiblockChecker.REINFORCED_CASING, MultiblockChecker.ZERO_OFFSET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return 64000;
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,49 +103,40 @@ public class TileVacuumFreezer extends TilePowerAcceptor
|
|||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return 64;
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// TileEntity
|
||||
@Override
|
||||
public void validate() {
|
||||
super.validate();
|
||||
this.multiblockChecker = new MultiblockChecker(this.world, this.getPos().down());
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.VACUUM_FREEZER, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("vacuumfreezer").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncCrafterValue().addInventory().create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles.teir1;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
|
@ -54,8 +53,6 @@ public class TileAlloySmelter extends TilePowerAcceptor
|
|||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "alloy_smelter", key = "AlloySmelterMaxEnergy", comment = "Alloy Smelter Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
// @ConfigRegistry(config = "machines", category = "alloy_smelter", key = "AlloySmelterWrenchDropRate", comment = "Alloy Smelter Wrench Drop Rate")
|
||||
public static float wrenchDropRate = 1.0F;
|
||||
|
||||
public int tickTime;
|
||||
public Inventory inventory = new Inventory(8, "TileAlloySmelter", 64, this);
|
||||
|
@ -72,35 +69,6 @@ public class TileAlloySmelter extends TilePowerAcceptor
|
|||
this.crafter = new RecipeCrafter(Reference.ALLOY_SMELTER_RECIPE, this, 2, 1, this.inventory, inputs, outputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ALLOY_SMELTER, 1);
|
||||
}
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.inventory.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
public int getProgressScaled(final int scale) {
|
||||
if (this.crafter.currentTickTime != 0 && this.crafter.currentNeededTicks != 0) {
|
||||
return this.crafter.currentTickTime * scale / this.crafter.currentNeededTicks;
|
||||
|
@ -108,6 +76,13 @@ public class TileAlloySmelter extends TilePowerAcceptor
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
this.charge(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
@ -133,16 +108,19 @@ public class TileAlloySmelter extends TilePowerAcceptor
|
|||
return maxInput;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.ALLOY_SMELTER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("alloysmelter").player(player.inventory).inventory().hotbar()
|
||||
|
@ -158,4 +136,10 @@ public class TileAlloySmelter extends TilePowerAcceptor
|
|||
.outputSlot(2, 80, 47).energySlot(3, 8, 72).syncEnergyValue().syncCrafterValue().addInventory()
|
||||
.create(this);
|
||||
}
|
||||
|
||||
// IRecipeCrafterProvider
|
||||
@Override
|
||||
public RecipeCrafter getRecipeCrafter() {
|
||||
return this.crafter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles.teir1;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
|
@ -76,19 +75,6 @@ public class TileExtractor extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
|
|
@ -26,7 +26,6 @@ package techreborn.tiles.teir1;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import reborncore.api.IToolDrop;
|
||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||
|
@ -77,20 +76,6 @@ public class TileGrinder extends TilePowerAcceptor
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound tagCompound) {
|
||||
super.readFromNBT(tagCompound);
|
||||
this.inventory.readFromNBT(tagCompound);
|
||||
this.crafter.readFromNBT(tagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound tagCompound) {
|
||||
super.writeToNBT(tagCompound);
|
||||
this.crafter.writeToNBT(tagCompound);
|
||||
return tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return maxEnergy;
|
||||
|
|
|
@ -32,6 +32,7 @@ import reborncore.api.IToolDrop;
|
|||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.blocks.BlockMachineBase;
|
||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||
import reborncore.common.registration.impl.ConfigRegistry;
|
||||
import reborncore.common.util.Inventory;
|
||||
import techreborn.client.container.IContainerProvider;
|
||||
import techreborn.client.container.builder.BuiltContainer;
|
||||
|
@ -39,10 +40,15 @@ import techreborn.client.container.builder.ContainerBuilder;
|
|||
import techreborn.init.ModBlocks;
|
||||
import techreborn.items.ItemParts;
|
||||
|
||||
public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
public class TileRecycler extends TilePowerAcceptor
|
||||
implements IToolDrop, IInventoryProvider, IContainerProvider {
|
||||
|
||||
@ConfigRegistry(config = "machines", category = "recycler", key = "RecyclerInput", comment = "Recycler Max Input (Value in EU)")
|
||||
public static int maxInput = 32;
|
||||
@ConfigRegistry(config = "machines", category = "recycler", key = "RecyclerMaxEnergy", comment = "Recycler Max Energy (Value in EU)")
|
||||
public static int maxEnergy = 1000;
|
||||
|
||||
private final Inventory inventory = new Inventory(3, "TileRecycler", 64, this);
|
||||
private final int capacity = 1000;
|
||||
private final int cost = 2;
|
||||
private final int time = 15;
|
||||
private final int chance = 6;
|
||||
|
@ -56,36 +62,15 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven
|
|||
public int gaugeProgressScaled(final int scale) {
|
||||
return this.progress * scale / this.time;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
if (this.world.isRemote)
|
||||
return;
|
||||
|
||||
boolean updateInventory = false;
|
||||
if (this.canRecycle() && !this.isBurning() && this.getEnergy() != 0)
|
||||
this.setBurning(true);
|
||||
else if (this.isBurning()) {
|
||||
if (this.useEnergy(this.cost) != this.cost)
|
||||
this.setBurning(false);
|
||||
this.progress++;
|
||||
if (this.progress >= this.time) {
|
||||
this.progress = 0;
|
||||
this.recycleItems();
|
||||
updateInventory = true;
|
||||
this.setBurning(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateState();
|
||||
this.charge(2);
|
||||
|
||||
if (updateInventory) {
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return this.progress;
|
||||
}
|
||||
|
||||
public void setProgress(final int progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public void recycleItems() {
|
||||
final ItemStack itemstack = ItemParts.getPartByName("scrap");
|
||||
final int randomchance = this.world.rand.nextInt(this.chance);
|
||||
|
@ -129,18 +114,39 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven
|
|||
}
|
||||
}
|
||||
|
||||
// TilePowerAcceptor
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.RECYCLER, 1);
|
||||
}
|
||||
public void update() {
|
||||
super.update();
|
||||
if (this.world.isRemote)
|
||||
return;
|
||||
|
||||
public boolean isComplete() {
|
||||
return false;
|
||||
boolean updateInventory = false;
|
||||
if (this.canRecycle() && !this.isBurning() && this.getEnergy() != 0)
|
||||
this.setBurning(true);
|
||||
else if (this.isBurning()) {
|
||||
if (this.useEnergy(this.cost) != this.cost)
|
||||
this.setBurning(false);
|
||||
this.progress++;
|
||||
if (this.progress >= this.time) {
|
||||
this.progress = 0;
|
||||
this.recycleItems();
|
||||
updateInventory = true;
|
||||
this.setBurning(false);
|
||||
}
|
||||
}
|
||||
|
||||
this.updateState();
|
||||
this.charge(2);
|
||||
|
||||
if (updateInventory) {
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBaseMaxPower() {
|
||||
return this.capacity;
|
||||
return maxEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,32 +166,32 @@ public class TileRecycler extends TilePowerAcceptor implements IToolDrop, IInven
|
|||
|
||||
@Override
|
||||
public double getBaseMaxInput() {
|
||||
return 32;
|
||||
return maxInput;
|
||||
}
|
||||
|
||||
// TileLegacyMachineBase
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// IToolDrop
|
||||
@Override
|
||||
public ItemStack getToolDrop(final EntityPlayer entityPlayer) {
|
||||
return new ItemStack(ModBlocks.RECYCLER, 1);
|
||||
}
|
||||
|
||||
// IInventoryProvider
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return this.progress;
|
||||
}
|
||||
|
||||
public void setProgress(final int progress) {
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
// IContainerProvider
|
||||
@Override
|
||||
public BuiltContainer createContainer(final EntityPlayer player) {
|
||||
return new ContainerBuilder("recycler").player(player.inventory).inventory().hotbar().addInventory()
|
||||
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).energySlot(2, 8, 72).syncEnergyValue()
|
||||
.syncIntegerValue(this::getProgress, this::setProgress).addInventory().create(this);
|
||||
}
|
||||
|
||||
//TODO make this so
|
||||
@Override
|
||||
public boolean canBeUpgraded() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue