Fixed recipes and System messages
I'm stupid rooDerp
This commit is contained in:
parent
f0d62b997a
commit
ab230b7af4
11 changed files with 720 additions and 20 deletions
|
@ -1,19 +1,26 @@
|
|||
package wayoftime.bloodmagic.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.Container;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.fluids.FluidActionResult;
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import wayoftime.bloodmagic.tile.contailer.ContainerAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.MultiSlotItemHandler;
|
||||
|
||||
public class TileAlchemicalReactionChamber extends TileInventory implements ITickableTileEntity, INamedContainerProvider
|
||||
{
|
||||
|
@ -27,10 +34,8 @@ public class TileAlchemicalReactionChamber extends TileInventory implements ITic
|
|||
public static final int INPUT_BUCKET_SLOT = 7;
|
||||
public static final int OUTPUT_BUCKET_SLOT = 8;
|
||||
|
||||
public FluidTank inputTank = new FluidTank(FluidAttributes.BUCKET_VOLUME * 2);
|
||||
public FluidTank outputTank = new FluidTank(FluidAttributes.BUCKET_VOLUME * 2);
|
||||
|
||||
// Input slots are from 0 to 3.
|
||||
public FluidTank inputTank = new FluidTank(FluidAttributes.BUCKET_VOLUME * 20);
|
||||
public FluidTank outputTank = new FluidTank(FluidAttributes.BUCKET_VOLUME * 20);
|
||||
|
||||
public int burnTime = 0;
|
||||
|
||||
|
@ -50,6 +55,12 @@ public class TileAlchemicalReactionChamber extends TileInventory implements ITic
|
|||
super.deserialize(tag);
|
||||
|
||||
burnTime = tag.getInt(Constants.NBT.SOUL_FORGE_BURN);
|
||||
|
||||
CompoundNBT inputTankTag = tag.getCompound("inputtank");
|
||||
inputTank.readFromNBT(inputTankTag);
|
||||
|
||||
CompoundNBT outputTankTag = tag.getCompound("outputtank");
|
||||
inputTank.readFromNBT(outputTankTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,13 +69,53 @@ public class TileAlchemicalReactionChamber extends TileInventory implements ITic
|
|||
super.serialize(tag);
|
||||
|
||||
tag.putInt(Constants.NBT.SOUL_FORGE_BURN, burnTime);
|
||||
|
||||
CompoundNBT inputTankTag = new CompoundNBT();
|
||||
inputTank.writeToNBT(inputTankTag);
|
||||
tag.put("inputtank", inputTankTag);
|
||||
|
||||
CompoundNBT outputTankTag = new CompoundNBT();
|
||||
inputTank.writeToNBT(outputTankTag);
|
||||
tag.put("outputtank", outputTankTag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack bucketStack = this.getStackInSlot(INPUT_BUCKET_SLOT);
|
||||
ItemStack[] outputInventory = new ItemStack[]
|
||||
{ getStackInSlot(1), getStackInSlot(2), getStackInSlot(3), getStackInSlot(4), getStackInSlot(5) };
|
||||
|
||||
MultiSlotItemHandler outputSlotHandler = new MultiSlotItemHandler(outputInventory, 64);
|
||||
// FluidActionResult res = FluidUtil.tryEmptyContainerAndStow(bucketStack, inputTank, outputSlotHandler, 1000, null, false);
|
||||
FluidActionResult res = FluidUtil.tryEmptyContainerAndStow(bucketStack, inputTank, outputSlotHandler, 1000, null, true);
|
||||
if (res.isSuccess())
|
||||
{
|
||||
// FluidUtil.tryEmptyContainerAndStow(bucketStack, inputTank, outputSlotHandler, 1000, null, true);
|
||||
this.setInventorySlotContents(INPUT_BUCKET_SLOT, ItemStack.EMPTY);
|
||||
|
||||
if (!res.getResult().isEmpty())
|
||||
{
|
||||
List<ItemStack> arrayList = new ArrayList<>();
|
||||
arrayList.add(res.getResult());
|
||||
|
||||
outputSlotHandler.canTransferAllItemsToSlots(arrayList, false);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < NUM_OUTPUTS; i++)
|
||||
{
|
||||
this.setInventorySlotContents(OUTPUT_SLOT + i, outputSlotHandler.getStackInSlot(i));
|
||||
}
|
||||
|
||||
// FluidUtil.tryEmptyContainer(container, fluidDestination, maxAmount, player, doDrain)
|
||||
}
|
||||
|
||||
// private boolean canCraft(RecipeTartaricForge recipe)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue