Refactor out inv wrapper

This commit is contained in:
modmuss50 2019-07-01 00:39:13 +01:00
parent 18950e0b29
commit 7dc6dddc51
38 changed files with 120 additions and 127 deletions

View file

@ -27,7 +27,7 @@ package techreborn.api.fluidreplicator;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import reborncore.fluid.Fluid; import reborncore.fluid.Fluid;
import reborncore.fluid.FluidStack; import reborncore.fluid.FluidStack;
@ -52,7 +52,7 @@ public class FluidReplicatorRecipeCrafter extends RecipeCrafter {
* @param inputSlots This is the list of the slots that the crafting logic should look for the input UU-Matter. * @param inputSlots This is the list of the slots that the crafting logic should look for the input UU-Matter.
* @param outputSlots This is the list of slots that the crafting logic should look for output fluid * @param outputSlots This is the list of slots that the crafting logic should look for output fluid
*/ */
public FluidReplicatorRecipeCrafter(BlockEntity parentTile, Inventory<?> inventory, int[] inputSlots, int[] outputSlots) { public FluidReplicatorRecipeCrafter(BlockEntity parentTile, RebornInventory<?> inventory, int[] inputSlots, int[] outputSlots) {
super(ModRecipes.FLUID_REPLICATOR, parentTile, 1, 1, inventory, inputSlots, outputSlots); super(ModRecipes.FLUID_REPLICATOR, parentTile, 1, 1, inventory, inputSlots, outputSlots);
} }

View file

@ -27,7 +27,7 @@ package techreborn.api.recipe;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import java.util.List; import java.util.List;
@ -44,7 +44,7 @@ public class ScrapboxRecipeCrafter extends RecipeCrafter {
* @param inputSlots Slot IDs for input * @param inputSlots Slot IDs for input
* @param outputSlots Slot IDs for output * @param outputSlots Slot IDs for output
*/ */
public ScrapboxRecipeCrafter(BlockEntity parentTile, Inventory<?> inventory, int[] inputSlots, int[] outputSlots) { public ScrapboxRecipeCrafter(BlockEntity parentTile, RebornInventory<?> inventory, int[] inputSlots, int[] outputSlots) {
super(ModRecipes.SCRAPBOX, parentTile, 1, 1, inventory, inputSlots, outputSlots); super(ModRecipes.SCRAPBOX, parentTile, 1, 1, inventory, inputSlots, outputSlots);
} }

View file

@ -30,18 +30,18 @@ import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import reborncore.client.gui.slots.SlotFilteredVoid; import reborncore.client.gui.slots.SlotFilteredVoid;
import reborncore.common.container.RebornContainer; import reborncore.common.container.RebornContainer;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.init.TRContent; import techreborn.init.TRContent;
public class ContainerDestructoPack extends RebornContainer { public class ContainerDestructoPack extends RebornContainer {
private PlayerEntity player; private PlayerEntity player;
private Inventory<?> inv; private RebornInventory<?> inv;
public ContainerDestructoPack(PlayerEntity player) { public ContainerDestructoPack(PlayerEntity player) {
super(null, new LiteralText("destructopack")); super(null, new LiteralText("destructopack"));
this.player = player; this.player = player;
inv = new Inventory<>(1, "destructopack", 64, null); inv = new RebornInventory<>(1, "destructopack", 64, null);
buildContainer(); buildContainer();
} }

View file

@ -36,7 +36,7 @@ import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
@ -52,7 +52,7 @@ public class TileChargeOMat extends TilePowerAcceptor
@ConfigRegistry(config = "machines", category = "charge_bench", key = "ChargeBenchMaxEnergy", comment = "Charge Bench Max Energy (Value in EU)") @ConfigRegistry(config = "machines", category = "charge_bench", key = "ChargeBenchMaxEnergy", comment = "Charge Bench Max Energy (Value in EU)")
public static int maxEnergy = 100_000_000; public static int maxEnergy = 100_000_000;
public Inventory<TileChargeOMat> inventory = new Inventory<>(6, "TileChargeOMat", 64, this).withConfiguredAccess(); public RebornInventory<TileChargeOMat> inventory = new RebornInventory<>(6, "TileChargeOMat", 64, this).withConfiguredAccess();
public TileChargeOMat() { public TileChargeOMat() {
super(TRTileEntities.CHARGE_O_MAT); super(TRTileEntities.CHARGE_O_MAT);
@ -114,7 +114,7 @@ public class TileChargeOMat extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileChargeOMat> getInventory() { public RebornInventory<TileChargeOMat> getInventory() {
return inventory; return inventory;
} }

View file

@ -34,7 +34,7 @@ import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.ItemHandlerProvider; import reborncore.api.tile.ItemHandlerProvider;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
/** /**
* @author drcrazy * @author drcrazy
@ -48,7 +48,7 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
public int maxEnergy; public int maxEnergy;
public Block toolDrop; public Block toolDrop;
public int energySlot; public int energySlot;
public Inventory<?> inventory; public RebornInventory<?> inventory;
public RecipeCrafter crafter; public RecipeCrafter crafter;
/** /**
@ -117,7 +117,7 @@ public abstract class TileGenericMachine extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<?> getInventory() { public RebornInventory<?> getInventory() {
return inventory; return inventory;
} }

View file

@ -34,7 +34,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
@ -56,7 +56,7 @@ public class TileIndustrialCentrifuge extends TileGenericMachine implements ICon
super(TRTileEntities.INDUSTRIAL_CENTRIFUGE, "IndustrialCentrifuge", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block, 6); super(TRTileEntities.INDUSTRIAL_CENTRIFUGE, "IndustrialCentrifuge", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_CENTRIFUGE.block, 6);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4, 5 }; final int[] outputs = new int[] { 2, 3, 4, 5 };
this.inventory = new Inventory<>(7, "TileIndustrialCentrifuge", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(7, "TileIndustrialCentrifuge", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.CENTRIFUGE, this, 2, 4, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.CENTRIFUGE, this, 2, 4, this.inventory, inputs, outputs);
} }

View file

@ -25,7 +25,6 @@
package techreborn.tiles; package techreborn.tiles;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@ -35,7 +34,7 @@ import reborncore.api.IListInfoProvider;
import reborncore.api.IToolDrop; import reborncore.api.IToolDrop;
import reborncore.api.tile.ItemHandlerProvider; import reborncore.api.tile.ItemHandlerProvider;
import reborncore.common.tile.TileMachineBase; import reborncore.common.tile.TileMachineBase;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -45,14 +44,14 @@ public class TileTechStorageBase extends TileMachineBase
implements ItemHandlerProvider, IToolDrop, IListInfoProvider { implements ItemHandlerProvider, IToolDrop, IListInfoProvider {
public final int maxCapacity; public final int maxCapacity;
public final Inventory<TileTechStorageBase> inventory; public final RebornInventory<TileTechStorageBase> inventory;
public ItemStack storedItem; public ItemStack storedItem;
public TileTechStorageBase(BlockEntityType<?> tileEntityTypeIn, String name, int maxCapacity) { public TileTechStorageBase(BlockEntityType<?> tileEntityTypeIn, String name, int maxCapacity) {
super(tileEntityTypeIn); super(tileEntityTypeIn);
this.maxCapacity = maxCapacity; this.maxCapacity = maxCapacity;
storedItem = ItemStack.EMPTY; storedItem = ItemStack.EMPTY;
inventory = new Inventory<>(3, name, maxCapacity, this).withConfiguredAccess(); inventory = new RebornInventory<>(3, name, maxCapacity, this).withConfiguredAccess();
} }
public void readWithoutCoords(CompoundTag tagCompound) { public void readWithoutCoords(CompoundTag tagCompound) {
@ -92,7 +91,7 @@ public class TileTechStorageBase extends TileMachineBase
dropStack.setTag(new CompoundTag()); dropStack.setTag(new CompoundTag());
dropStack.getTag().put("tileEntity", tileEntity); dropStack.getTag().put("tileEntity", tileEntity);
storedItem.setCount(0); storedItem.setCount(0);
inventory.setStackInSlot(1, ItemStack.EMPTY); inventory.setInvStack(1, ItemStack.EMPTY);
syncWithAll(); syncWithAll();
return dropStack; return dropStack;
@ -141,12 +140,12 @@ public class TileTechStorageBase extends TileMachineBase
|| (storedItem.isEmpty() && ItemUtils.isItemEqual(inputStack, outputStack, true, true))) { || (storedItem.isEmpty() && ItemUtils.isItemEqual(inputStack, outputStack, true, true))) {
storedItem = inputStack; storedItem = inputStack;
inventory.setStackInSlot(0, ItemStack.EMPTY); inventory.setInvStack(0, ItemStack.EMPTY);
} else if (ItemUtils.isItemEqual(getStoredItemType(), inputStack, true, true)) { } else if (ItemUtils.isItemEqual(getStoredItemType(), inputStack, true, true)) {
int reminder = maxCapacity - storedItem.getCount() - outputStack.getCount(); int reminder = maxCapacity - storedItem.getCount() - outputStack.getCount();
if (inputStack.getCount() <= reminder) { if (inputStack.getCount() <= reminder) {
setStoredItemCount(inputStack.getCount()); setStoredItemCount(inputStack.getCount());
inventory.setStackInSlot(0, ItemStack.EMPTY); inventory.setInvStack(0, ItemStack.EMPTY);
} else { } else {
setStoredItemCount(maxCapacity - outputStack.getCount()); setStoredItemCount(maxCapacity - outputStack.getCount());
inventory.getInvStack(0).decrement(reminder); inventory.getInvStack(0).decrement(reminder);
@ -167,7 +166,7 @@ public class TileTechStorageBase extends TileMachineBase
storedItem = ItemStack.EMPTY; storedItem = ItemStack.EMPTY;
} }
inventory.setStackInSlot(1, delivered); inventory.setInvStack(1, delivered);
markDirty(); markDirty();
syncWithAll(); syncWithAll();
} else if (ItemUtils.isItemEqual(storedItem, outputStack, true, true) } else if (ItemUtils.isItemEqual(storedItem, outputStack, true, true)
@ -208,7 +207,7 @@ public class TileTechStorageBase extends TileMachineBase
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileTechStorageBase> getInventory() { public RebornInventory<TileTechStorageBase> getInventory() {
return inventory; return inventory;
} }

View file

@ -38,7 +38,7 @@ import reborncore.common.RebornCoreConfig;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import reborncore.common.util.Torus; import reborncore.common.util.Torus;
import techreborn.TechReborn; import techreborn.TechReborn;
@ -62,7 +62,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
@ConfigRegistry(config = "machines", category = "fusion_reactor", key = "FusionReactorMaxCoilSize", comment = "Fusion Reactor Max Coil size (Radius)") @ConfigRegistry(config = "machines", category = "fusion_reactor", key = "FusionReactorMaxCoilSize", comment = "Fusion Reactor Max Coil size (Radius)")
public static int maxCoilSize = 50; public static int maxCoilSize = 50;
public Inventory<TileFusionControlComputer> inventory; public RebornInventory<TileFusionControlComputer> inventory;
public int coilCount = 0; public int coilCount = 0;
public int crafingTickTime = 0; public int crafingTickTime = 0;
@ -80,7 +80,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
public TileFusionControlComputer() { public TileFusionControlComputer() {
super(TRTileEntities.FUSION_CONTROL_COMPUTER); super(TRTileEntities.FUSION_CONTROL_COMPUTER);
checkOverfill = false; checkOverfill = false;
this.inventory = new Inventory<>(3, "TileFusionControlComputer", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(3, "TileFusionControlComputer", 64, this).withConfiguredAccess();
} }
/** /**
@ -262,7 +262,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
} else if (crafingTickTime >= finalTickTime) { } else if (crafingTickTime >= finalTickTime) {
if (canFitStack(currentRecipe.getOutput(), outputStackSlot, true)) { if (canFitStack(currentRecipe.getOutput(), outputStackSlot, true)) {
if (inventory.getInvStack(outputStackSlot).isEmpty()) { if (inventory.getInvStack(outputStackSlot).isEmpty()) {
inventory.setStackInSlot(outputStackSlot, currentRecipe.getOutput().copy()); inventory.setInvStack(outputStackSlot, currentRecipe.getOutput().copy());
} else { } else {
inventory.shrinkSlot(outputStackSlot, -currentRecipe.getOutput().getCount()); inventory.shrinkSlot(outputStackSlot, -currentRecipe.getOutput().getCount());
} }
@ -373,7 +373,7 @@ public class TileFusionControlComputer extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileFusionControlComputer> getInventory() { public RebornInventory<TileFusionControlComputer> getInventory() {
return inventory; return inventory;
} }

View file

@ -31,7 +31,7 @@ import reborncore.api.IToolDrop;
import reborncore.api.tile.ItemHandlerProvider; import reborncore.api.tile.ItemHandlerProvider;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import reborncore.fluid.FluidStack; import reborncore.fluid.FluidStack;
import techreborn.api.generator.EFluidGenerator; import techreborn.api.generator.EFluidGenerator;
@ -49,7 +49,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
private FluidGeneratorRecipe currentRecipe; private FluidGeneratorRecipe currentRecipe;
private int ticksSinceLastChange; private int ticksSinceLastChange;
public final Tank tank; public final Tank tank;
public final Inventory<?> inventory; public final RebornInventory<?> inventory;
protected long lastOutput = 0; protected long lastOutput = 0;
/* /*
@ -63,7 +63,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
super(tileEntityType); super(tileEntityType);
recipes = GeneratorRecipeHelper.getFluidRecipesForGenerator(type); recipes = GeneratorRecipeHelper.getFluidRecipesForGenerator(type);
tank = new Tank(tileName, tankCapacity, this); tank = new Tank(tileName, tankCapacity, this);
inventory = new Inventory<>(3, tileName, 64, this).withConfiguredAccess(); inventory = new RebornInventory<>(3, tileName, 64, this).withConfiguredAccess();
this.euTick = euTick; this.euTick = euTick;
this.ticksSinceLastChange = 0; this.ticksSinceLastChange = 0;
} }
@ -169,7 +169,7 @@ public abstract class TileBaseFluidGenerator extends TilePowerAcceptor implement
} }
@Override @Override
public Inventory<?> getInventory() { public RebornInventory<?> getInventory() {
return inventory; return inventory;
} }

View file

@ -35,7 +35,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
@ -51,7 +51,7 @@ public class TileDragonEggSyphon extends TilePowerAcceptor
@ConfigRegistry(config = "generators", 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 static int energyPerTick = 4;
public Inventory<TileDragonEggSyphon> inventory = new Inventory<>(3, "TileDragonEggSyphon", 64, this).withConfiguredAccess(); public RebornInventory<TileDragonEggSyphon> inventory = new RebornInventory<>(3, "TileDragonEggSyphon", 64, this).withConfiguredAccess();
private long lastOutput = 0; private long lastOutput = 0;
public TileDragonEggSyphon() { public TileDragonEggSyphon() {
@ -122,7 +122,7 @@ public class TileDragonEggSyphon extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileDragonEggSyphon> getInventory() { public RebornInventory<TileDragonEggSyphon> getInventory() {
return inventory; return inventory;
} }
} }

View file

@ -40,7 +40,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
@ -55,7 +55,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
@ConfigRegistry(config = "generators", 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 static int outputAmount = 10;
public Inventory<TileSolidFuelGenerator> inventory = new Inventory<>(2, "TileSolidFuelGenerator", 64, this).withConfiguredAccess(); public RebornInventory<TileSolidFuelGenerator> inventory = new RebornInventory<>(2, "TileSolidFuelGenerator", 64, this).withConfiguredAccess();
public int fuelSlot = 0; public int fuelSlot = 0;
public int burnTime; public int burnTime;
public int totalBurnTime = 0; public int totalBurnTime = 0;
@ -97,9 +97,9 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
burnItem = inventory.getInvStack(fuelSlot); burnItem = inventory.getInvStack(fuelSlot);
if (inventory.getInvStack(fuelSlot).getCount() == 1) { if (inventory.getInvStack(fuelSlot).getCount() == 1) {
if (inventory.getInvStack(fuelSlot).getItem() == Items.LAVA_BUCKET || inventory.getInvStack(fuelSlot).getItem() instanceof BucketItem) { if (inventory.getInvStack(fuelSlot).getItem() == Items.LAVA_BUCKET || inventory.getInvStack(fuelSlot).getItem() instanceof BucketItem) {
inventory.setStackInSlot(fuelSlot, new ItemStack(Items.BUCKET)); inventory.setInvStack(fuelSlot, new ItemStack(Items.BUCKET));
} else { } else {
inventory.setStackInSlot(fuelSlot, ItemStack.EMPTY); inventory.setInvStack(fuelSlot, ItemStack.EMPTY);
} }
} else { } else {
@ -152,7 +152,7 @@ public class TileSolidFuelGenerator extends TilePowerAcceptor implements IToolDr
} }
@Override @Override
public Inventory<TileSolidFuelGenerator> getInventory() { public RebornInventory<TileSolidFuelGenerator> getInventory() {
return inventory; return inventory;
} }

View file

@ -37,7 +37,7 @@ import reborncore.common.crafting.RebornIngredient;
import reborncore.common.crafting.RebornRecipe; import reborncore.common.crafting.RebornRecipe;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.tile.TileMachineBase; import reborncore.common.tile.TileMachineBase;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -48,7 +48,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
implements IToolDrop, ItemHandlerProvider, IContainerProvider { implements IToolDrop, ItemHandlerProvider, IContainerProvider {
public int tickTime; public int tickTime;
public Inventory<TileIronAlloyFurnace> inventory = new Inventory<>(4, "TileIronAlloyFurnace", 64, this).withConfiguredAccess(); public RebornInventory<TileIronAlloyFurnace> inventory = new RebornInventory<>(4, "TileIronAlloyFurnace", 64, this).withConfiguredAccess();
public int burnTime; public int burnTime;
public int currentItemBurnTime; public int currentItemBurnTime;
public int cookTime; public int cookTime;
@ -180,7 +180,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
} }
if (inventory.getInvStack(this.output).isEmpty()) { if (inventory.getInvStack(this.output).isEmpty()) {
inventory.setStackInSlot(this.output, itemstack.copy()); inventory.setInvStack(this.output, itemstack.copy());
} else if (inventory.getInvStack(this.output).getItem() == itemstack.getItem()) { } else if (inventory.getInvStack(this.output).getItem() == itemstack.getItem()) {
inventory.shrinkSlot(this.output, -itemstack.getCount()); inventory.shrinkSlot(this.output, -itemstack.getCount());
} }
@ -242,7 +242,7 @@ public class TileIronAlloyFurnace extends TileMachineBase
} }
@Override @Override
public Inventory<TileIronAlloyFurnace> getInventory() { public RebornInventory<TileIronAlloyFurnace> getInventory() {
return this.inventory; return this.inventory;
} }

View file

@ -36,7 +36,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.blocks.BlockMachineBase; import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.tile.TileMachineBase; import reborncore.common.tile.TileMachineBase;
import reborncore.common.util.IInventoryAccess; import reborncore.common.util.IInventoryAccess;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.events.TRRecipeHandler; import techreborn.events.TRRecipeHandler;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
@ -45,7 +45,7 @@ public class TileIronFurnace extends TileMachineBase
implements ItemHandlerProvider, IContainerProvider { implements ItemHandlerProvider, IContainerProvider {
public int tickTime; public int tickTime;
public Inventory<TileIronFurnace> inventory = new Inventory<>(3, "TileIronFurnace", 64, this, getInvetoryAccess()); public RebornInventory<TileIronFurnace> inventory = new RebornInventory<>(3, "TileIronFurnace", 64, this, getInvetoryAccess());
public int fuel; public int fuel;
public int fuelGague; public int fuelGague;
public int progress; public int progress;
@ -91,11 +91,11 @@ public class TileIronFurnace extends TileMachineBase
// Fuel slot // Fuel slot
ItemStack fuelStack = inventory.getInvStack(this.fuelslot); ItemStack fuelStack = inventory.getInvStack(this.fuelslot);
if (fuelStack.getItem().hasRecipeRemainder()) { if (fuelStack.getItem().hasRecipeRemainder()) {
inventory.setStackInSlot(this.fuelslot, new ItemStack(fuelStack.getItem().getRecipeRemainder())); inventory.setInvStack(this.fuelslot, new ItemStack(fuelStack.getItem().getRecipeRemainder()));
} else if (fuelStack.getCount() > 1) { } else if (fuelStack.getCount() > 1) {
inventory.shrinkSlot(this.fuelslot, 1); inventory.shrinkSlot(this.fuelslot, 1);
} else if (fuelStack.getCount() == 1) { } else if (fuelStack.getCount() == 1) {
inventory.setStackInSlot(this.fuelslot, ItemStack.EMPTY); inventory.setInvStack(this.fuelslot, ItemStack.EMPTY);
} }
updateInventory = true; updateInventory = true;
} }
@ -123,14 +123,14 @@ public class TileIronFurnace extends TileMachineBase
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(this.input1)); final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(this.input1));
if (inventory.getInvStack(this.output).isEmpty()) { if (inventory.getInvStack(this.output).isEmpty()) {
inventory.setStackInSlot(this.output, itemstack.copy()); inventory.setInvStack(this.output, itemstack.copy());
} else if (inventory.getInvStack(this.output).isItemEqualIgnoreDamage(itemstack)) { } else if (inventory.getInvStack(this.output).isItemEqualIgnoreDamage(itemstack)) {
inventory.getInvStack(this.output).increment(itemstack.getCount()); inventory.getInvStack(this.output).increment(itemstack.getCount());
} }
if (inventory.getInvStack(this.input1).getCount() > 1) { if (inventory.getInvStack(this.input1).getCount() > 1) {
inventory.shrinkSlot(this.input1, 1); inventory.shrinkSlot(this.input1, 1);
} else { } else {
inventory.setStackInSlot(this.input1, ItemStack.EMPTY); inventory.setInvStack(this.input1, ItemStack.EMPTY);
} }
} }
} }
@ -171,7 +171,7 @@ public class TileIronFurnace extends TileMachineBase
} }
@Override @Override
public Inventory<TileIronFurnace> getInventory() { public RebornInventory<TileIronFurnace> getInventory() {
return this.inventory; return this.inventory;
} }

View file

@ -33,7 +33,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -54,7 +54,7 @@ public class TileDistillationTower extends TileGenericMachine implements IContai
super(TRTileEntities.DISTILLATION_TOWER,"DistillationTower", maxInput, maxEnergy, TRContent.Machine.DISTILLATION_TOWER.block, 6); super(TRTileEntities.DISTILLATION_TOWER,"DistillationTower", maxInput, maxEnergy, TRContent.Machine.DISTILLATION_TOWER.block, 6);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4, 5 }; final int[] outputs = new int[] { 2, 3, 4, 5 };
this.inventory = new Inventory<>(7, "TileDistillationTower", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(7, "TileDistillationTower", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.DISTILLATION_TOWER, this, 2, 4, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.DISTILLATION_TOWER, this, 2, 4, this.inventory, inputs, outputs);
} }

View file

@ -34,7 +34,7 @@ import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.IInventoryAccess; import reborncore.common.util.IInventoryAccess;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.api.fluidreplicator.FluidReplicatorRecipeCrafter; import techreborn.api.fluidreplicator.FluidReplicatorRecipeCrafter;
@ -66,7 +66,7 @@ public class TileFluidReplicator extends TileGenericMachine implements IContaine
public TileFluidReplicator() { public TileFluidReplicator() {
super(TRTileEntities.FLUID_REPLICATOR, "FluidReplicator", maxInput, maxEnergy, TRContent.Machine.FLUID_REPLICATOR.block, 3); super(TRTileEntities.FLUID_REPLICATOR, "FluidReplicator", maxInput, maxEnergy, TRContent.Machine.FLUID_REPLICATOR.block, 3);
final int[] inputs = new int[] { 0 }; final int[] inputs = new int[] { 0 };
this.inventory = new Inventory<>(4, "TileFluidReplicator", 64, this, getInventoryAccess()); this.inventory = new RebornInventory<>(4, "TileFluidReplicator", 64, this, getInventoryAccess());
this.crafter = new FluidReplicatorRecipeCrafter(this, this.inventory, inputs, null); this.crafter = new FluidReplicatorRecipeCrafter(this, this.inventory, inputs, null);
this.tank = new Tank("TileFluidReplicator", TileFluidReplicator.TANK_CAPACITY, this); this.tank = new Tank("TileFluidReplicator", TileFluidReplicator.TANK_CAPACITY, this);
} }

View file

@ -32,7 +32,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -53,7 +53,7 @@ public class TileImplosionCompressor extends TileGenericMachine implements ICont
super(TRTileEntities.IMPLOSION_COMPRESSOR, "ImplosionCompressor", maxInput, maxEnergy, TRContent.Machine.IMPLOSION_COMPRESSOR.block, 4); super(TRTileEntities.IMPLOSION_COMPRESSOR, "ImplosionCompressor", maxInput, maxEnergy, TRContent.Machine.IMPLOSION_COMPRESSOR.block, 4);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3 }; final int[] outputs = new int[] { 2, 3 };
this.inventory = new Inventory<>(5, "TileImplosionCompressor", 64, this); this.inventory = new RebornInventory<>(5, "TileImplosionCompressor", 64, this);
this.crafter = new RecipeCrafter(ModRecipes.IMPLOSION_COMPRESSOR, this, 2, 2, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.IMPLOSION_COMPRESSOR, this, 2, 2, this.inventory, inputs, outputs);
} }

View file

@ -26,9 +26,7 @@ package techreborn.tiles.machine.multiblock;
import net.minecraft.block.Material; import net.minecraft.block.Material;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.ClientConnection;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import reborncore.client.containerBuilder.IContainerProvider; import reborncore.client.containerBuilder.IContainerProvider;
@ -38,7 +36,7 @@ import reborncore.common.multiblock.IMultiblockPart;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.blocks.BlockMachineCasing; import techreborn.blocks.BlockMachineCasing;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
@ -63,7 +61,7 @@ public class TileIndustrialBlastFurnace extends TileGenericMachine implements IC
super(TRTileEntities.INDUSTRIAL_BLAST_FURNACE, "IndustrialBlastFurnace", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_BLAST_FURNACE.block, 4); super(TRTileEntities.INDUSTRIAL_BLAST_FURNACE, "IndustrialBlastFurnace", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_BLAST_FURNACE.block, 4);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3 }; final int[] outputs = new int[] { 2, 3 };
this.inventory = new Inventory<>(5, "TileIndustrialBlastFurnace", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(5, "TileIndustrialBlastFurnace", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.BLAST_FURNACE, this, 2, 2, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.BLAST_FURNACE, this, 2, 2, this.inventory, inputs, outputs);
} }

View file

@ -37,7 +37,7 @@ import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.IInventoryAccess; import reborncore.common.util.IInventoryAccess;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
@ -65,7 +65,7 @@ public class TileIndustrialGrinder extends TileGenericMachine implements IContai
super(TRTileEntities.INDUSTRIAL_GRINDER, "IndustrialGrinder", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_GRINDER.block, 7); super(TRTileEntities.INDUSTRIAL_GRINDER, "IndustrialGrinder", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_GRINDER.block, 7);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] {2, 3, 4, 5}; final int[] outputs = new int[] {2, 3, 4, 5};
this.inventory = new Inventory<>(8, "TileIndustrialGrinder", 64, this, getInventoryAccess()); this.inventory = new RebornInventory<>(8, "TileIndustrialGrinder", 64, this, getInventoryAccess());
this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_GRINDER, this, 1, 4, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_GRINDER, this, 1, 4, this.inventory, inputs, outputs);
this.tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this); this.tank = new Tank("TileIndustrialGrinder", TileIndustrialGrinder.TANK_CAPACITY, this);
this.ticksSinceLastChange = 0; this.ticksSinceLastChange = 0;

View file

@ -37,7 +37,7 @@ import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.IInventoryAccess; import reborncore.common.util.IInventoryAccess;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
@ -65,7 +65,7 @@ public class TileIndustrialSawmill extends TileGenericMachine implements IContai
super(TRTileEntities.INDUSTRIAL_SAWMILL, "IndustrialSawmill", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_SAWMILL.block, 6); super(TRTileEntities.INDUSTRIAL_SAWMILL, "IndustrialSawmill", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_SAWMILL.block, 6);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4 }; final int[] outputs = new int[] { 2, 3, 4 };
this.inventory = new Inventory<>(7, "TileSawmill", 64, this, getInventoryAccess()); this.inventory = new RebornInventory<>(7, "TileSawmill", 64, this, getInventoryAccess());
this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_SAWMILL, this, 1, 3, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_SAWMILL, this, 1, 3, this.inventory, inputs, outputs);
this.tank = new Tank("TileSawmill", TileIndustrialSawmill.TANK_CAPACITY, this); this.tank = new Tank("TileSawmill", TileIndustrialSawmill.TANK_CAPACITY, this);
this.ticksSinceLastChange = 0; this.ticksSinceLastChange = 0;

View file

@ -32,7 +32,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -53,7 +53,7 @@ public class TileVacuumFreezer extends TileGenericMachine implements IContainerP
super(TRTileEntities.VACUUM_FREEZER, "VacuumFreezer", maxInput, maxEnergy, TRContent.Machine.VACUUM_FREEZER.block, 2); super(TRTileEntities.VACUUM_FREEZER, "VacuumFreezer", maxInput, maxEnergy, TRContent.Machine.VACUUM_FREEZER.block, 2);
final int[] inputs = new int[] { 0 }; final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 }; final int[] outputs = new int[] { 1 };
this.inventory = new Inventory<>(3, "TileVacuumFreezer", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(3, "TileVacuumFreezer", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.VACUUM_FREEZER, this, 2, 1, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.VACUUM_FREEZER, this, 2, 1, this.inventory, inputs, outputs);
} }

View file

@ -31,7 +31,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -50,7 +50,7 @@ public class TileAlloySmelter extends TileGenericMachine implements IContainerPr
super(TRTileEntities.ALLOY_SMELTER, "AlloySmelter", maxInput, maxEnergy, TRContent.Machine.ALLOY_SMELTER.block, 3); super(TRTileEntities.ALLOY_SMELTER, "AlloySmelter", maxInput, maxEnergy, TRContent.Machine.ALLOY_SMELTER.block, 3);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2 }; final int[] outputs = new int[] { 2 };
this.inventory = new Inventory<>(4, "TileAlloySmelter", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(4, "TileAlloySmelter", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.ALLOY_SMELTER, this, 2, 1, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.ALLOY_SMELTER, this, 2, 1, this.inventory, inputs, outputs);
} }

View file

@ -31,7 +31,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -50,7 +50,7 @@ public class TileAssemblingMachine extends TileGenericMachine implements IContai
super(TRTileEntities.ASSEMBLY_MACHINE, "AssemblingMachine", maxInput, maxEnergy, TRContent.Machine.ASSEMBLY_MACHINE.block, 3); super(TRTileEntities.ASSEMBLY_MACHINE, "AssemblingMachine", maxInput, maxEnergy, TRContent.Machine.ASSEMBLY_MACHINE.block, 3);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2 }; final int[] outputs = new int[] { 2 };
this.inventory = new Inventory<>(4, "TileAssemblingMachine", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(4, "TileAssemblingMachine", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.ASSEMBLING_MACHINE, this, 2, 2, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.ASSEMBLING_MACHINE, this, 2, 2, this.inventory, inputs, outputs);
} }

View file

@ -45,7 +45,7 @@ import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.IInventoryAccess; import reborncore.common.util.IInventoryAccess;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.events.TRRecipeHandler; import techreborn.events.TRRecipeHandler;
@ -69,7 +69,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
@ConfigRegistry(config = "machines", category = "autocrafter", key = "AutoCrafterMaxEnergy", comment = "AutoCrafting Table Max Energy (Value in EU)") @ConfigRegistry(config = "machines", category = "autocrafter", key = "AutoCrafterMaxEnergy", comment = "AutoCrafting Table Max Energy (Value in EU)")
public static int maxEnergy = 10_000; public static int maxEnergy = 10_000;
public Inventory<TileAutoCraftingTable> inventory = new Inventory<>(11, "TileAutoCraftingTable", 64, this, getInventoryAccess()); public RebornInventory<TileAutoCraftingTable> inventory = new RebornInventory<>(11, "TileAutoCraftingTable", 64, this, getInventoryAccess());
public int progress; public int progress;
public int maxProgress = 120; public int maxProgress = 120;
public int euTick = 10; public int euTick = 10;
@ -214,7 +214,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
// TODO fire forge recipe event // TODO fire forge recipe event
ItemStack ouputStack = recipe.craft(getCraftingInventory()); ItemStack ouputStack = recipe.craft(getCraftingInventory());
if (output.isEmpty()) { if (output.isEmpty()) {
inventory.setStackInSlot(9, ouputStack.copy()); inventory.setInvStack(9, ouputStack.copy());
} else { } else {
// TODO use ouputStack in someway? // TODO use ouputStack in someway?
output.increment(recipe.getOutput().getCount()); output.increment(recipe.getOutput().getCount());
@ -228,7 +228,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
ItemStack extraOutputSlot = inventory.getInvStack(10); ItemStack extraOutputSlot = inventory.getInvStack(10);
if (hasOutputSpace(containerItem, 10)) { if (hasOutputSpace(containerItem, 10)) {
if (extraOutputSlot.isEmpty()) { if (extraOutputSlot.isEmpty()) {
inventory.setStackInSlot(10, containerItem.copy()); inventory.setInvStack(10, containerItem.copy());
} else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true) } else if (ItemUtils.isItemEqual(extraOutputSlot, containerItem, true, true)
&& extraOutputSlot.getMaxCount() < extraOutputSlot.getCount() + containerItem.getCount()) { && extraOutputSlot.getMaxCount() < extraOutputSlot.getCount() + containerItem.getCount()) {
extraOutputSlot.increment(1); extraOutputSlot.increment(1);
@ -435,7 +435,7 @@ public class TileAutoCraftingTable extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory getInventory() { public RebornInventory getInventory() {
return inventory; return inventory;
} }

View file

@ -31,7 +31,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -50,7 +50,7 @@ public class TileChemicalReactor extends TileGenericMachine implements IContaine
super(TRTileEntities.CHEMICAL_REACTOR, "ChemicalReactor", maxInput, maxEnergy, TRContent.Machine.CHEMICAL_REACTOR.block, 3); super(TRTileEntities.CHEMICAL_REACTOR, "ChemicalReactor", maxInput, maxEnergy, TRContent.Machine.CHEMICAL_REACTOR.block, 3);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2 }; final int[] outputs = new int[] { 2 };
this.inventory = new Inventory<>(4, "TileChemicalReactor", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(4, "TileChemicalReactor", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.CHEMICAL_REACTOR, this, 2, 2, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.CHEMICAL_REACTOR, this, 2, 2, this.inventory, inputs, outputs);
} }

View file

@ -31,7 +31,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -50,7 +50,7 @@ public class TileCompressor extends TileGenericMachine implements IContainerProv
super(TRTileEntities.COMPRESSOR, "Compressor", maxInput, maxEnergy, TRContent.Machine.COMPRESSOR.block, 2); super(TRTileEntities.COMPRESSOR, "Compressor", maxInput, maxEnergy, TRContent.Machine.COMPRESSOR.block, 2);
final int[] inputs = new int[] { 0 }; final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 }; final int[] outputs = new int[] { 1 };
this.inventory = new Inventory<>(3, "TileCompressor", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(3, "TileCompressor", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.COMPRESSOR, this, 2, 1, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.COMPRESSOR, this, 2, 1, this.inventory, inputs, outputs);
} }

View file

@ -38,7 +38,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.events.TRRecipeHandler; import techreborn.events.TRRecipeHandler;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -53,7 +53,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
@ConfigRegistry(config = "machines", category = "electric_furnace", key = "ElectricFurnaceMaxEnergy", comment = "Electric Furnace Max Energy (Value in EU)") @ConfigRegistry(config = "machines", category = "electric_furnace", key = "ElectricFurnaceMaxEnergy", comment = "Electric Furnace Max Energy (Value in EU)")
public static int maxEnergy = 1000; public static int maxEnergy = 1000;
public Inventory<TileElectricFurnace> inventory = new Inventory<>(3, "TileElectricFurnace", 64, this).withConfiguredAccess(); public RebornInventory<TileElectricFurnace> inventory = new RebornInventory<>(3, "TileElectricFurnace", 64, this).withConfiguredAccess();
public int progress; public int progress;
public int fuelScale = 100; public int fuelScale = 100;
public int cost = 6; public int cost = 6;
@ -74,14 +74,14 @@ public class TileElectricFurnace extends TilePowerAcceptor
final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(input1)); final ItemStack itemstack = TRRecipeHandler.getMatchingRecipes(world, RecipeType.SMELTING, inventory.getInvStack(input1));
if (inventory.getInvStack(output).isEmpty()) { if (inventory.getInvStack(output).isEmpty()) {
inventory.setStackInSlot(output, itemstack.copy()); inventory.setInvStack(output, itemstack.copy());
} else if (inventory.getInvStack(output).isItemEqualIgnoreDamage(itemstack)) { } else if (inventory.getInvStack(output).isItemEqualIgnoreDamage(itemstack)) {
inventory.getInvStack(output).increment(itemstack.getCount()); inventory.getInvStack(output).increment(itemstack.getCount());
} }
if (inventory.getInvStack(input1).getCount() > 1) { if (inventory.getInvStack(input1).getCount() > 1) {
inventory.shrinkSlot(input1, 1); inventory.shrinkSlot(input1, 1);
} else { } else {
inventory.setStackInSlot(input1, ItemStack.EMPTY); inventory.setInvStack(input1, ItemStack.EMPTY);
} }
} }
} }
@ -210,7 +210,7 @@ public class TileElectricFurnace extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileElectricFurnace> getInventory() { public RebornInventory<TileElectricFurnace> getInventory() {
return inventory; return inventory;
} }

View file

@ -31,7 +31,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -50,7 +50,7 @@ public class TileExtractor extends TileGenericMachine implements IContainerProvi
super(TRTileEntities.EXTRACTOR, "Extractor", maxInput, maxEnergy, TRContent.Machine.EXTRACTOR.block, 2); super(TRTileEntities.EXTRACTOR, "Extractor", maxInput, maxEnergy, TRContent.Machine.EXTRACTOR.block, 2);
final int[] inputs = new int[] { 0 }; final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 }; final int[] outputs = new int[] { 1 };
this.inventory = new Inventory<>(3, "TileExtractor", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(3, "TileExtractor", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.EXTRACTOR, this, 2, 1, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.EXTRACTOR, this, 2, 1, this.inventory, inputs, outputs);
} }

View file

@ -31,7 +31,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -50,7 +50,7 @@ public class TileGrinder extends TileGenericMachine implements IContainerProvide
super(TRTileEntities.GRINDER, "Grinder", maxInput, maxEnergy, TRContent.Machine.GRINDER.block, 2); super(TRTileEntities.GRINDER, "Grinder", maxInput, maxEnergy, TRContent.Machine.GRINDER.block, 2);
final int[] inputs = new int[] { 0 }; final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 }; final int[] outputs = new int[] { 1 };
this.inventory = new Inventory<>(3, "TileGrinder", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(3, "TileGrinder", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.GRINDER, this, 2, 1, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.GRINDER, this, 2, 1, this.inventory, inputs, outputs);
} }

View file

@ -31,7 +31,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.recipes.RecipeCrafter; import reborncore.common.recipes.RecipeCrafter;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.ModRecipes; import techreborn.init.ModRecipes;
@ -52,7 +52,7 @@ public class TileIndustrialElectrolyzer extends TileGenericMachine implements IC
super(TRTileEntities.INDUSTRIAL_ELECTROLYZER, "IndustrialElectrolyzer", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_ELECTROLYZER.block, 6); super(TRTileEntities.INDUSTRIAL_ELECTROLYZER, "IndustrialElectrolyzer", maxInput, maxEnergy, TRContent.Machine.INDUSTRIAL_ELECTROLYZER.block, 6);
final int[] inputs = new int[] { 0, 1 }; final int[] inputs = new int[] { 0, 1 };
final int[] outputs = new int[] { 2, 3, 4, 5 }; final int[] outputs = new int[] { 2, 3, 4, 5 };
this.inventory = new Inventory<>(7, "TileIndustrialElectrolyzer", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(7, "TileIndustrialElectrolyzer", 64, this).withConfiguredAccess();
this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_ELECTROLYZER, this, 2, 4, this.inventory, inputs, outputs); this.crafter = new RecipeCrafter(ModRecipes.INDUSTRIAL_ELECTROLYZER, this, 2, 4, this.inventory, inputs, outputs);
} }

View file

@ -38,7 +38,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
@ -54,7 +54,7 @@ public class TileRecycler extends TilePowerAcceptor
@ConfigRegistry(config = "machines", category = "recycler", key = "produceIC2Scrap", comment = "When enabled and when ic2 is installed the recycler will make ic2 scrap") @ConfigRegistry(config = "machines", category = "recycler", key = "produceIC2Scrap", comment = "When enabled and when ic2 is installed the recycler will make ic2 scrap")
public static boolean produceIC2Scrap = false; public static boolean produceIC2Scrap = false;
private final Inventory<TileRecycler> inventory = new Inventory<>(3, "TileRecycler", 64, this).withConfiguredAccess(); private final RebornInventory<TileRecycler> inventory = new RebornInventory<>(3, "TileRecycler", 64, this).withConfiguredAccess();
private final int cost = 2; private final int cost = 2;
private final int time = 15; private final int time = 15;
private final int chance = 6; private final int chance = 6;
@ -83,7 +83,7 @@ public class TileRecycler extends TilePowerAcceptor
if (randomchance == 1) { if (randomchance == 1) {
if (inventory.getInvStack(1).isEmpty()) { if (inventory.getInvStack(1).isEmpty()) {
inventory.setStackInSlot(1, itemstack.copy()); inventory.setInvStack(1, itemstack.copy());
} }
else { else {
inventory.getInvStack(1).increment(itemstack.getCount()); inventory.getInvStack(1).increment(itemstack.getCount());
@ -196,7 +196,7 @@ public class TileRecycler extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileRecycler> getInventory() { public RebornInventory<TileRecycler> getInventory() {
return this.inventory; return this.inventory;
} }

View file

@ -25,7 +25,6 @@
package techreborn.tiles.machine.tier1; package techreborn.tiles.machine.tier1;
import net.minecraft.container.Container; import net.minecraft.container.Container;
import net.minecraft.container.ContainerType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.CraftingInventory; import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -43,7 +42,7 @@ import reborncore.common.blocks.BlockMachineBase;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.api.RollingMachineRecipe; import techreborn.api.RollingMachineRecipe;
@ -51,7 +50,6 @@ import techreborn.init.TRContent;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -75,7 +73,7 @@ public class TileRollingMachine extends TilePowerAcceptor
public int[] craftingSlots = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; public int[] craftingSlots = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
private CraftingInventory craftCache; private CraftingInventory craftCache;
public Inventory<TileRollingMachine> inventory = new Inventory<>(12, "TileRollingMachine", 64, this).withConfiguredAccess(); public RebornInventory<TileRollingMachine> inventory = new RebornInventory<>(12, "TileRollingMachine", 64, this).withConfiguredAccess();
public boolean isRunning; public boolean isRunning;
public int tickTime; public int tickTime;
@Nonnull @Nonnull
@ -144,7 +142,7 @@ public class TileRollingMachine extends TilePowerAcceptor
if (!currentRecipeOutput.isEmpty()) { if (!currentRecipeOutput.isEmpty()) {
boolean hasCrafted = false; boolean hasCrafted = false;
if (inventory.getInvStack(outputSlot).isEmpty()) { if (inventory.getInvStack(outputSlot).isEmpty()) {
inventory.setStackInSlot(outputSlot, currentRecipeOutput); inventory.setInvStack(outputSlot, currentRecipeOutput);
tickTime = 0; tickTime = 0;
hasCrafted = true; hasCrafted = true;
} else { } else {
@ -152,7 +150,7 @@ public class TileRollingMachine extends TilePowerAcceptor
+ currentRecipeOutput.getCount() <= currentRecipeOutput.getMaxCount()) { + currentRecipeOutput.getCount() <= currentRecipeOutput.getMaxCount()) {
final ItemStack stack = inventory.getInvStack(outputSlot); final ItemStack stack = inventory.getInvStack(outputSlot);
stack.setCount(stack.getCount() + currentRecipeOutput.getCount()); stack.setCount(stack.getCount() + currentRecipeOutput.getCount());
inventory.setStackInSlot(outputSlot, stack); inventory.setInvStack(outputSlot, stack);
tickTime = 0; tickTime = 0;
hasCrafted = true; hasCrafted = true;
} else { } else {
@ -357,7 +355,7 @@ public class TileRollingMachine extends TilePowerAcceptor
} }
@Override @Override
public Inventory<TileRollingMachine> getInventory() { public RebornInventory<TileRollingMachine> getInventory() {
return inventory; return inventory;
} }
@ -384,7 +382,7 @@ public class TileRollingMachine extends TilePowerAcceptor
.slot(0, 30, 22).slot(1, 48, 22).slot(2, 66, 22) .slot(0, 30, 22).slot(1, 48, 22).slot(2, 66, 22)
.slot(3, 30, 40).slot(4, 48, 40).slot(5, 66, 40) .slot(3, 30, 40).slot(4, 48, 40).slot(5, 66, 40)
.slot(6, 30, 58).slot(7, 48, 58).slot(8, 66, 58) .slot(6, 30, 58).slot(7, 48, 58).slot(8, 66, 58)
.onCraft(inv -> this.inventory.setStackInSlot(1, RollingMachineRecipe.instance.findMatchingRecipeOutput(getCraftingMatrix(), this.world))) .onCraft(inv -> this.inventory.setInvStack(1, RollingMachineRecipe.instance.findMatchingRecipeOutput(getCraftingMatrix(), this.world)))
.outputSlot(9, 124, 40) .outputSlot(9, 124, 40)
.energySlot(10, 8, 70) .energySlot(10, 8, 70)
.syncEnergyValue().syncIntegerValue(this::getBurnTime, this::setBurnTime).syncIntegerValue(this::getLockedInt, this::setLockedInt).addInventory().create(this); .syncEnergyValue().syncIntegerValue(this::getBurnTime, this::setBurnTime).syncIntegerValue(this::getLockedInt, this::setLockedInt).addInventory().create(this);

View file

@ -30,7 +30,7 @@ import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder; import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.api.recipe.ScrapboxRecipeCrafter; import techreborn.api.recipe.ScrapboxRecipeCrafter;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -49,7 +49,7 @@ public class TileScrapboxinator extends TileGenericMachine implements IContainer
super(TRTileEntities.SCRAPBOXINATOR, "Scrapboxinator", maxInput, maxEnergy, TRContent.Machine.SCRAPBOXINATOR.block, 2); super(TRTileEntities.SCRAPBOXINATOR, "Scrapboxinator", maxInput, maxEnergy, TRContent.Machine.SCRAPBOXINATOR.block, 2);
final int[] inputs = new int[] { 0 }; final int[] inputs = new int[] { 0 };
final int[] outputs = new int[] { 1 }; final int[] outputs = new int[] { 1 };
this.inventory = new Inventory<>(3, "TileScrapboxinator", 64, this).withConfiguredAccess(); this.inventory = new RebornInventory<>(3, "TileScrapboxinator", 64, this).withConfiguredAccess();
this.crafter = new ScrapboxRecipeCrafter(this, this.inventory, inputs, outputs); this.crafter = new ScrapboxRecipeCrafter(this, this.inventory, inputs, outputs);
} }

View file

@ -35,7 +35,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
@ -50,7 +50,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, Ite
// @ConfigRegistry(config = "machines", category = "chunk_loader", key = "ChunkLoaderWrenchDropRate", comment = "Chunk Loader Wrench Drop Rate") // @ConfigRegistry(config = "machines", category = "chunk_loader", key = "ChunkLoaderWrenchDropRate", comment = "Chunk Loader Wrench Drop Rate")
public static float wrenchDropRate = 1.0F; public static float wrenchDropRate = 1.0F;
public Inventory<TileChunkLoader> inventory = new Inventory<>(1, "TileChunkLoader", 64, this).withConfiguredAccess(); public RebornInventory<TileChunkLoader> inventory = new RebornInventory<>(1, "TileChunkLoader", 64, this).withConfiguredAccess();
public boolean isRunning; public boolean isRunning;
public int tickTime; public int tickTime;
@ -94,7 +94,7 @@ public class TileChunkLoader extends TilePowerAcceptor implements IToolDrop, Ite
} }
@Override @Override
public Inventory<TileChunkLoader> getInventory() { public RebornInventory<TileChunkLoader> getInventory() {
return this.inventory; return this.inventory;
} }

View file

@ -35,7 +35,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.ItemUtils; import reborncore.common.util.ItemUtils;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -54,7 +54,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
@ConfigRegistry(config = "machines", category = "matter_fabricator", key = "MatterFabricatorEnergyPerAmp", comment = "Matter Fabricator EU per amplifier unit, multiply this with the rate for total EU") @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 = 5; public static int energyPerAmp = 5;
public Inventory<TileMatterFabricator> inventory = new Inventory<>(12, "TileMatterFabricator", 64, this).withConfiguredAccess(); public RebornInventory<TileMatterFabricator> inventory = new RebornInventory<>(12, "TileMatterFabricator", 64, this).withConfiguredAccess();
private int amplifier = 0; private int amplifier = 0;
public TileMatterFabricator() { public TileMatterFabricator() {
@ -87,7 +87,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
private void addOutputProducts(int slot) { private void addOutputProducts(int slot) {
if (inventory.getInvStack(slot).isEmpty()) { if (inventory.getInvStack(slot).isEmpty()) {
inventory.setStackInSlot(slot, TRContent.Parts.UU_MATTER.getStack()); inventory.setInvStack(slot, TRContent.Parts.UU_MATTER.getStack());
} }
else if (ItemUtils.isItemEqual(this.inventory.getInvStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)) { else if (ItemUtils.isItemEqual(this.inventory.getInvStack(slot), TRContent.Parts.UU_MATTER.getStack(), true, true)) {
inventory.getInvStack(slot).setCount((Math.min(64, 1 + inventory.getInvStack(slot).getCount()))); inventory.getInvStack(slot).setCount((Math.min(64, 1 + inventory.getInvStack(slot).getCount())));
@ -202,7 +202,7 @@ public class TileMatterFabricator extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileMatterFabricator> getInventory() { public RebornInventory<TileMatterFabricator> getInventory() {
return inventory; return inventory;
} }

View file

@ -25,11 +25,9 @@
package techreborn.tiles.machine.tier3; package techreborn.tiles.machine.tier3;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.client.network.packet.BlockEntityUpdateS2CPacket;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.ClientConnection;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import reborncore.api.IListInfoProvider; import reborncore.api.IListInfoProvider;
@ -41,7 +39,7 @@ import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.tile.TileMachineBase; import reborncore.common.tile.TileMachineBase;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
@ -58,7 +56,7 @@ public class TileQuantumTank extends TileMachineBase
public static int maxStorage = Integer.MAX_VALUE; public static int maxStorage = Integer.MAX_VALUE;
public Tank tank = new Tank("TileQuantumTank", maxStorage, this); public Tank tank = new Tank("TileQuantumTank", maxStorage, this);
public Inventory<TileQuantumTank> inventory = new Inventory<>(3, "TileQuantumTank", 64, this).withConfiguredAccess(); public RebornInventory<TileQuantumTank> inventory = new RebornInventory<>(3, "TileQuantumTank", 64, this).withConfiguredAccess();
public TileQuantumTank(){ public TileQuantumTank(){
this(TRTileEntities.QUANTUM_TANK); this(TRTileEntities.QUANTUM_TANK);
@ -121,7 +119,7 @@ public class TileQuantumTank extends TileMachineBase
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileQuantumTank> getInventory() { public RebornInventory<TileQuantumTank> getInventory() {
return this.inventory; return this.inventory;
} }

View file

@ -34,7 +34,7 @@ import reborncore.client.containerBuilder.builder.BuiltContainer;
import reborncore.client.containerBuilder.builder.ContainerBuilder; import reborncore.client.containerBuilder.builder.ContainerBuilder;
import reborncore.common.registration.RebornRegister; import reborncore.common.registration.RebornRegister;
import reborncore.common.registration.config.ConfigRegistry; import reborncore.common.registration.config.ConfigRegistry;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.TechReborn; import techreborn.TechReborn;
import techreborn.init.TRContent; import techreborn.init.TRContent;
import techreborn.init.TRTileEntities; import techreborn.init.TRTileEntities;
@ -49,7 +49,7 @@ public class TileAdjustableSU extends TileEnergyStorage implements IContainerPro
@ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxEnergy", comment = "AESU Max Energy (Value in EU)") @ConfigRegistry(config = "machines", category = "aesu", key = "AesuMaxEnergy", comment = "AESU Max Energy (Value in EU)")
public static int maxEnergy = 100_000_000; public static int maxEnergy = 100_000_000;
public Inventory<TileAdjustableSU> inventory = new Inventory<>(4, "TileAdjustableSU", 64, this).withConfiguredAccess(); public RebornInventory<TileAdjustableSU> inventory = new RebornInventory<>(4, "TileAdjustableSU", 64, this).withConfiguredAccess();
private int OUTPUT = 64; // The current output private int OUTPUT = 64; // The current output
public TileAdjustableSU() { public TileAdjustableSU() {

View file

@ -34,7 +34,7 @@ import reborncore.api.power.EnumPowerTier;
import reborncore.api.tile.ItemHandlerProvider; import reborncore.api.tile.ItemHandlerProvider;
import reborncore.common.powerSystem.ExternalPowerSystems; import reborncore.common.powerSystem.ExternalPowerSystems;
import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.powerSystem.TilePowerAcceptor;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import techreborn.blocks.storage.BlockEnergyStorage; import techreborn.blocks.storage.BlockEnergyStorage;
/** /**
@ -43,7 +43,7 @@ import techreborn.blocks.storage.BlockEnergyStorage;
public class TileEnergyStorage extends TilePowerAcceptor public class TileEnergyStorage extends TilePowerAcceptor
implements IToolDrop, ItemHandlerProvider { implements IToolDrop, ItemHandlerProvider {
public Inventory<TileEnergyStorage> inventory; public RebornInventory<TileEnergyStorage> inventory;
public String name; public String name;
public Block wrenchDrop; public Block wrenchDrop;
public EnumPowerTier tier; public EnumPowerTier tier;
@ -53,7 +53,7 @@ public class TileEnergyStorage extends TilePowerAcceptor
public TileEnergyStorage(BlockEntityType<?> tileEntityType, String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) { public TileEnergyStorage(BlockEntityType<?> tileEntityType, String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
super(tileEntityType); super(tileEntityType);
inventory = new Inventory<>(invSize, "Tile" + name, 64, this).withConfiguredAccess(); inventory = new RebornInventory<>(invSize, "Tile" + name, 64, this).withConfiguredAccess();
this.wrenchDrop = wrenchDrop; this.wrenchDrop = wrenchDrop;
this.tier = tier; this.tier = tier;
this.name = name; this.name = name;
@ -136,7 +136,7 @@ public class TileEnergyStorage extends TilePowerAcceptor
// ItemHandlerProvider // ItemHandlerProvider
@Override @Override
public Inventory<TileEnergyStorage> getInventory() { public RebornInventory<TileEnergyStorage> getInventory() {
return inventory; return inventory;
} }
} }

View file

@ -26,7 +26,7 @@ package techreborn.utils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import reborncore.common.util.Inventory; import reborncore.common.util.RebornInventory;
import reborncore.common.util.Tank; import reborncore.common.util.Tank;
import reborncore.fluid.Fluid; import reborncore.fluid.Fluid;
import reborncore.fluid.FluidStack; import reborncore.fluid.FluidStack;
@ -48,11 +48,11 @@ public class FluidUtils {
return null; return null;
} }
public static void drainContainers(Tank tank, Inventory<?> inventory, int i, int i1) { public static void drainContainers(Tank tank, RebornInventory<?> inventory, int i, int i1) {
} }
public static void fillContainers(Tank tank, Inventory<?> inventory, int i, int i1, Fluid fluidType) { public static void fillContainers(Tank tank, RebornInventory<?> inventory, int i, int i1, Fluid fluidType) {
} }