Jump to content

Not setting tileentity variable.


robertcars

Recommended Posts

So I am trying to get an integer from my gui class when someone hits the save button to my tile entity class and save it with nbt however it always equals 0 or nothing.

 

Tile Entity

package com.robert.instaport.common.tileentity;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;

import com.robert.instaport.gui.GuiTeleporter;

public class TileEntityTeleporter extends TileEntity implements IInventory {

        private ItemStack[] inv;

        
    	public int id;

        public TileEntityTeleporter(){
                inv = new ItemStack[1];
        }
        
        @Override
        public int getSizeInventory() {
                return inv.length;
        }

        @Override
        public ItemStack getStackInSlot(int slot) {
                return inv[slot];
        }
        
        @Override
        public void setInventorySlotContents(int slot, ItemStack stack) {
                inv[slot] = stack;
                if (stack != null && stack.stackSize > getInventoryStackLimit()) {
                        stack.stackSize = getInventoryStackLimit();
                }
        }

        @Override
        public ItemStack decrStackSize(int slot, int amt) {
                ItemStack stack = getStackInSlot(slot);
                if (stack != null) {
                        if (stack.stackSize <= amt) {
                                setInventorySlotContents(slot, null);
                        } else {
                                stack = stack.splitStack(amt);
                                if (stack.stackSize == 0) {
                                        setInventorySlotContents(slot, null);
                                }
                        }
                }
                return stack;
        }

        @Override
        public ItemStack getStackInSlotOnClosing(int slot) {
                ItemStack stack = getStackInSlot(slot);
                if (stack != null) {
                        setInventorySlotContents(slot, null);
                }
                return stack;
        }
        
        @Override
        public int getInventoryStackLimit() {
                return 1;
        }

        @Override
        public boolean isUseableByPlayer(EntityPlayer player) {
                return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this &&
                player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64;
        }
        
        @Override
        public void readFromNBT(NBTTagCompound tagCompound) {
                super.readFromNBT(tagCompound);
                NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
                for (int i = 0; i < tagList.tagCount(); i++) {
                        NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
                        byte slot = tag.getByte("Slot");
                        if (slot >= 0 && slot < inv.length) {
                                inv[slot] = ItemStack.loadItemStackFromNBT(tag);
                        }
                }
                
                id = tagCompound.getInteger("ids");
        }
        
        GuiTeleporter gui;

        @Override
        public void writeToNBT(NBTTagCompound tagCompound) {
                super.writeToNBT(tagCompound);
                
                NBTTagList itemList = new NBTTagList();
                for (int i = 0; i < inv.length; i++) {
                        ItemStack stack = inv[i];
                        if (stack != null) {
                                NBTTagCompound tag = new NBTTagCompound();
                                tag.setByte("Slot", (byte) i);
                                stack.writeToNBT(tag);
                                itemList.appendTag(tag);
                        }
                }
                tagCompound.setTag("Inventory", itemList);

                tagCompound.setInteger("ids", id);
                System.out.println("ID: " + id);
        }

        
	@Override
	public String getInventoryName() {
		return null;
	}

	@Override
	public boolean hasCustomInventoryName() {
		return false;
	}

	@Override
	public void openInventory() {					
	}

	@Override
	public void closeInventory() {
	}

	@Override
	public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
		return false;
	}
}

 

Gui

package com.robert.instaport.gui;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

import com.robert.instaport.common.container.ContainerTeleporter;
import com.robert.instaport.common.tileentity.TileEntityTeleporter;
import com.robert.instaport.lib.Reference;

public class GuiTeleporter extends GuiContainer {

	public final int xSizeOfTexture = 176;
	public final int ySizeOfTexture = 228;

	private GuiTextField idField;

	public int id;

	@SuppressWarnings("unused")
	private TileEntityTeleporter tileEntityKeyPad;
	private TileEntityTeleporter tileEntityTeleporter = new TileEntityTeleporter();

        public GuiTeleporter (InventoryPlayer inventoryPlayer, TileEntityTeleporter tileEntity) {
                //the container is instanciated and passed to the superclass for handling
                super(new ContainerTeleporter(inventoryPlayer, tileEntity));
                tileEntityTeleporter = tileEntity;
                this.xSize = xSizeOfTexture;
                this.ySize = ySizeOfTexture;
                TileEntityTeleporter tile = (TileEntityTeleporter) tileEntityTeleporter.getWorldObj().getTileEntity(tileEntityTeleporter.xCoord, tileEntityTeleporter.yCoord, tileEntityTeleporter.zCoord);
                id = new TileEntityTeleporter().id;
        }

        @Override
        protected void drawGuiContainerForegroundLayer(int param1, int param2) {
        		String title = "Teleporter";
                fontRendererObj.drawString(title, 7, ySize - 220, 4210752);
                fontRendererObj.drawString("Security Card:", 7, ySize - 118, 4210752);
        }
        
        @SuppressWarnings("unchecked")
	@Override
        public void initGui() {
                super.initGui();
                
                //make buttons
                buttonList.add(new GuiButton(1, width / 2 - 20 / 2 - 60, this.height / 2 - 65, 20, 20, "+"));
                buttonList.add(new GuiButton(2, width / 2 - 20 / 2 + 60, this.height / 2 - 65, 20, 20, "-"));
                buttonList.add(new GuiButton(3, width / 2 - 100 / 2, this.height / 2 - 35, 100, 20, "Save"));

                idField = new GuiTextField(fontRendererObj, this.width / 2 - 70 / 2, this.height / 2 - 65, 70, 20);
                idField.setFocused(false);
                idField.setMaxStringLength(10);
        }
        
        public void updateScreen() {
        	idField.setText(Integer.toString(id));
        }
        
        public void drawScreen(int i, int j, float f) {
        	super.drawScreen(i, j, f);
        	idField.drawTextBox();

        }

        protected void actionPerformed(GuiButton guibutton) {
            TileEntityTeleporter tile = (TileEntityTeleporter) tileEntityTeleporter.getWorldObj().getTileEntity(tileEntityTeleporter.xCoord, tileEntityTeleporter.yCoord, tileEntityTeleporter.zCoord);
                switch(guibutton.id) {
                case 1://add
                	id += 1;
                    break;
                case 2:// subtract
                	if(!(id <= 0)) id -= 1;
                	break;
                case 3://save
                	new TileEntityTeleporter().id = id;
                }
                //Packet code here
                //PacketDispatcher.sendPacketToServer(packet); //send packet
        }

        ResourceLocation texture = new ResourceLocation(Reference.MOD_ID.toLowerCase() + ":" + "textures/gui/Teleporter.png");
        @Override
        protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
        		
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                //this.mc.renderEngine.bindTexture(texture);
                this.mc.getTextureManager().bindTexture(texture);
                int x = (width - xSizeOfTexture) / 2;
                int y = (height - ySizeOfTexture) / 2;
                this.drawTexturedModalRect(x, y, 0, 0, xSizeOfTexture, ySizeOfTexture);
        }

}

Link to comment
Share on other sites

I had this issue too, You need to use packets. See the thing is is you are saving it but in the wrong place (clientSide) which is only a display (thus why GUIs are client side)

 

This should help you get started also I suggest the latest 1.7.2 and up versions for this https://gist.github.com/CatDany/4a3df7fcb3c8270cf70b also check out the tutorials sub forum about the simpleMessageWrapper for a better understanding how to use the packets.

 

TL;DR

You need your GUI to send a packet to the Server, inwhich the server will handle the rest (aka find the tileentity in question and make the changes)

Link to comment
Share on other sites

Well as far as I know (and don't take my word 100% and I hope someone will correct me if I'm wrong) single player is basically  a server, client already (I think once they updated minecraft to let single player worlds open to LAN they made this happen, once again hope someone corrects me)

 

I would say yes still works single player because my TileEntities save information this way. (just make sure the tileEntity is reading and writing to the NBT so it persists on server closing and loading)

Link to comment
Share on other sites

Well as far as I know (and don't take my word 100% and I hope someone will correct me if I'm wrong) single player is basically  a server, client already (I think once they updated minecraft to let single player worlds open to LAN they made this happen, once again hope someone corrects me)

 

I would say yes still works single player because my TileEntities save information this way. (just make sure the tileEntity is reading and writing to the NBT so it persists on server closing and loading)

How would I send it to the client I ended up using a slightly different tutorial because the one you gave me kept giving me errors but I never figured out how to set the variable in my tile entity from it. Do i do it from the onMessage method and set it like i did from the gui or do I have to have something in the tileentity setting it?

Link to comment
Share on other sites

what kindof error? is it crashing complaining about not being able to find class Side? what forge source are you using? I remember someone telling me that, so I hope someone can learn from my mistakes here is my thread on this very issue http://www.minecraftforge.net/forum/index.php/topic,22347.msg113330.html#msg113330

 

If that is not the issue I can show you how I use mine but just want to make sure that it's just a forge version error because I don't want to taint your learning by feeding you copy paste ready code.

Link to comment
Share on other sites

what kindof error? is it crashing complaining about not being able to find class Side? what forge source are you using? I remember someone telling me that, so I hope someone can learn from my mistakes here is my thread on this very issue http://www.minecraftforge.net/forum/index.php/topic,22347.msg113330.html#msg113330

 

If that is not the issue I can show you how I use mine but just want to make sure that it's just a forge version error because I don't want to taint your learning by feeding you copy paste ready code.

 

Well it was more of syntax errors. Ill put the code im using now below.

 

main

package com.robert.instaport;

import net.minecraft.creativetab.CreativeTabs;

import com.robert.instaport.common.blocks.ModBlocks;
import com.robert.instaport.common.crafting.Crafting;
import com.robert.instaport.common.creativetabs.InstaportTab;
import com.robert.instaport.common.items.ModItems;
import com.robert.instaport.gui.GuiHandler;
import com.robert.instaport.lib.Reference;
import com.robert.instaport.packet.MyMessage;
import com.robert.instaport.proxy.CommonProxy;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;

@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.MOD_VER)
public class Instaport {

        @Instance(value = Reference.MOD_ID)
        public static Instaport instance;
        
        @SidedProxy(clientSide="com.robert.instaport.proxy.ClientProxy", serverSide="com.robert.instaport.proxy.CommonProxy")
        public static CommonProxy proxy;
        
        public static CreativeTabs tabInstaport = new InstaportTab("Instaport");
        public static SimpleNetworkWrapper network;
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
        	ModBlocks.init();
        	ModItems.init();
        	Crafting.init();
        	NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
            network = NetworkRegistry.INSTANCE.newSimpleChannel("MyChannel");
            network.registerMessage(MyMessage.Handler.class, MyMessage.class, 0, Side.SERVER);
        }
        
        @EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
        }
        
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
        }
}

 

packet

package com.robert.instaport.packet;

import com.robert.instaport.common.tileentity.TileEntityTeleporter;

import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;

public class MyMessage implements IMessage {
    
    private String text;

    public MyMessage() { }

    public MyMessage(String text) {
        this.text = text;
    }

    @Override
    public void fromBytes(ByteBuf buf) {
        text = ByteBufUtils.readUTF8String(buf); // this class is very useful in general for writing more complex objects
    }

    @Override
    public void toBytes(ByteBuf buf) {
        ByteBufUtils.writeUTF8String(buf, text);
    }

    public static class Handler implements IMessageHandler<MyMessage, IMessage> {
        
        @Override
        public IMessage onMessage(MyMessage message, MessageContext ctx) {
            System.out.println(String.format("Received %s from %s", message.text, ctx.getServerHandler().playerEntity.getDisplayName()));
            return null; // no response in this case
        }
    }
}

 

gui

package com.robert.instaport.gui;

import java.util.EnumMap;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

import com.robert.instaport.Instaport;
import com.robert.instaport.common.container.ContainerTeleporter;
import com.robert.instaport.common.tileentity.TileEntityTeleporter;
import com.robert.instaport.lib.Reference;
import com.robert.instaport.packet.MyMessage;

import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;

public class GuiTeleporter extends GuiContainer {

	public final int xSizeOfTexture = 176;
	public final int ySizeOfTexture = 228;

	private GuiTextField idField;

	public int id;

	@SuppressWarnings("unused")
	private TileEntityTeleporter tileEntityKeyPad;
	private TileEntityTeleporter tileEntityTeleporter = new TileEntityTeleporter();

        public GuiTeleporter (InventoryPlayer inventoryPlayer, TileEntityTeleporter tileEntity) {
                //the container is instanciated and passed to the superclass for handling
                super(new ContainerTeleporter(inventoryPlayer, tileEntity));
                tileEntityTeleporter = tileEntity;
                this.xSize = xSizeOfTexture;
                this.ySize = ySizeOfTexture;
                TileEntityTeleporter tile = (TileEntityTeleporter) tileEntityTeleporter.getWorldObj().getTileEntity(tileEntityTeleporter.xCoord, tileEntityTeleporter.yCoord, tileEntityTeleporter.zCoord);
                id = tile.getId();
        }

        @Override
        protected void drawGuiContainerForegroundLayer(int param1, int param2) {
        		String title = "Teleporter";
                fontRendererObj.drawString(title, 7, ySize - 220, 4210752);
                fontRendererObj.drawString("Security Card:", 7, ySize - 118, 4210752);
        }
        
        @SuppressWarnings("unchecked")
	@Override
        public void initGui() {
                super.initGui();
                
                //make buttons
                buttonList.add(new GuiButton(1, width / 2 - 20 / 2 - 60, this.height / 2 - 65, 20, 20, "+"));
                buttonList.add(new GuiButton(2, width / 2 - 20 / 2 + 60, this.height / 2 - 65, 20, 20, "-"));
                buttonList.add(new GuiButton(3, width / 2 - 100 / 2, this.height / 2 - 35, 100, 20, "Save"));

                idField = new GuiTextField(fontRendererObj, this.width / 2 - 70 / 2, this.height / 2 - 65, 70, 20);
                idField.setFocused(false);
                idField.setMaxStringLength(10);
        }
        
        public void updateScreen() {
        	idField.setText(Integer.toString(id));
        }
        
        public void drawScreen(int i, int j, float f) {
        	super.drawScreen(i, j, f);
        	idField.drawTextBox();

        }

        protected void actionPerformed(GuiButton guibutton) {
            TileEntityTeleporter tile = (TileEntityTeleporter) tileEntityTeleporter.getWorldObj().getTileEntity(tileEntityTeleporter.xCoord, tileEntityTeleporter.yCoord, tileEntityTeleporter.zCoord);
            switch(guibutton.id) {
                case 1://add
                	id += 1;
                    break;
                case 2:// subtract
                	if(!(id <= 0)) id -= 1;
                	break;
                case 3://save
                	Instaport.network.sendToServer(new MyMessage(Integer.toString(id)));
                }
                //Packet code here
                //PacketDispatcher.sendPacketToServer(packet); //send packet
        }

        ResourceLocation texture = new ResourceLocation(Reference.MOD_ID.toLowerCase() + ":" + "textures/gui/Teleporter.png");
        @Override
        protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
        		
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                //this.mc.renderEngine.bindTexture(texture);
                this.mc.getTextureManager().bindTexture(texture);
                int x = (width - xSizeOfTexture) / 2;
                int y = (height - ySizeOfTexture) / 2;
                this.drawTexturedModalRect(x, y, 0, 0, xSizeOfTexture, ySizeOfTexture);
        }

}

Link to comment
Share on other sites

what kindof error? is it crashing complaining about not being able to find class Side? what forge source are you using? I remember someone telling me that, so I hope someone can learn from my mistakes here is my thread on this very issue http://www.minecraftforge.net/forum/index.php/topic,22347.msg113330.html#msg113330

 

If that is not the issue I can show you how I use mine but just want to make sure that it's just a forge version error because I don't want to taint your learning by feeding you copy paste ready code.

 

Well I think I got the packet tutorial that you sent working but I had to change a couple things. Im also pretty sure im sending my id from the gui to it but how do I get it to the tile entity?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I made a block entity in forge 1.20.1, I want to prevent hopper from taking input slot item, i tried to override the extractItem method, it prevented hopper from taking input slot item, but the player also unable to take/change the item in input slot unless the slot is empty. public class FluidSeparatorBlockEntity extends BlockEntity implements MenuProvider { private static final int INPUT_SLOT = 0; private final CustomItemHandler itemHandler = new CustomItemHandler(3){ @Override protected void onContentsChanged(int slot) { setChanged(); } @Override public boolean isItemValid(int slot, @NotNull ItemStack stack) { return slot == INPUT_SLOT; } @Override public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate) { if (slot == INPUT_SLOT) { return ItemStack.EMPTY; } return super.extractItem(slot, amount, simulate); } }; private LazyOptional<IItemHandler> lazyItemHandler = LazyOptional.empty(); protected final ContainerData data; private int progress = 0; private int maxProgress = 78; public FluidSeparatorBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.FLUID_SEPARATOR_BE.get(), pPos, pBlockState); this.data = new ContainerData() { @Override public int get(int pIndex) { return switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress; default -> 0; }; } @Override public void set(int pIndex, int pValue) { switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress = pValue; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress = pValue; } } @Override public int getCount() { return 3; } }; } @Override public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) { if(cap == ForgeCapabilities.ITEM_HANDLER) { return lazyItemHandler.cast(); } return super.getCapability(cap, side); } @Override public void onLoad() { super.onLoad(); lazyItemHandler = LazyOptional.of(() -> itemHandler); } @Override public void invalidateCaps() { super.invalidateCaps(); lazyItemHandler.invalidate(); } public void drops() { SimpleContainer inventory = new SimpleContainer(itemHandler.getSlots()); for(int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, itemHandler.getStackInSlot(i)); } Containers.dropContents(this.level, this.worldPosition, inventory); } @Override public Component getDisplayName() { return Component.translatable("block.chemmaster.fluid_separator"); } @Nullable @Override public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) { return new FluidSeparatorMenu(pContainerId, pPlayerInventory, this, this.data); } @Override protected void saveAdditional(CompoundTag pTag) { pTag.put("inventory", itemHandler.serializeNBT()); pTag.putInt("fluid_separator.progress", progress); super.saveAdditional(pTag); } @Override public void load(CompoundTag pTag) { super.load(pTag); itemHandler.deserializeNBT(pTag.getCompound("inventory")); progress = pTag.getInt("fluid_separator.progress"); } public void tick(Level pLevel, BlockPos pPos, BlockState pState) { ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { resetProgress(); return; } if(hasRecipe()) { increaseCraftingProgress(); setChanged(pLevel, pPos, pState); if(hasProgressFinished()) { craftItem(); resetProgress(); } } else { resetProgress(); } } private void resetProgress() { progress = 0; } private void craftItem() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isPresent()) { List<ItemStack> results = recipe.get().getOutputs(); ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { // If there are not enough items, do not proceed with crafting return; } // Extract the input item from the input slot this.itemHandler.internalExtractItem(INPUT_SLOT, 2, false); // Loop through each result item and find suitable output slots for (ItemStack result : results) { int outputSlot = findSuitableOutputSlot(result); if (outputSlot != -1) { this.itemHandler.setStackInSlot(outputSlot, new ItemStack(result.getItem(), this.itemHandler.getStackInSlot(outputSlot).getCount() + result.getCount())); } else { // Handle the case where no suitable output slot is found // This can be logging an error, throwing an exception, or any other handling logic System.err.println("No suitable output slot found for item: " + result); } } } } private int findSuitableOutputSlot(ItemStack result) { // Implement logic to find a suitable output slot for the given result // Return the slot index or -1 if no suitable slot is found for (int i = 0; i < this.itemHandler.getSlots(); i++) { // Ensure we do not place the output item in the input slot if (i == INPUT_SLOT) { continue; } ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return i; } } return -1; } private boolean hasRecipe() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isEmpty()) { return false; } List<ItemStack> results = recipe.get().getOutputs(); for (ItemStack result : results) { if (!canInsertAmountIntoOutputSlot(result) || !canInsertItemIntoOutputSlot(result.getItem())) { return false; } } return true; } private Optional<FluidSeparatingRecipe> getCurrentRecipe(){ SimpleContainer inventory = new SimpleContainer(this.itemHandler.getSlots()); for (int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, this.itemHandler.getStackInSlot(i)); } return this.level.getRecipeManager().getRecipeFor(FluidSeparatingRecipe.Type.INSTANCE, inventory, level); } private boolean canInsertAmountIntoOutputSlot(ItemStack result) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return true; } } return false; } private boolean canInsertItemIntoOutputSlot(Item item) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || stackInSlot.getItem() == item) { return true; } } return false; } private boolean hasProgressFinished() { return progress >= maxProgress; } private void increaseCraftingProgress() { progress++; } }  
    • No dice. Unfortunately this fix didn't work, thank you though.
    • Maybe you need a rayon mod. https://www.curseforge.com/minecraft/mc-mods/rayon
    • Not sure what's going on the logs are making even less sense than usual to me. Any help would be much appreciated.   https://paste.ee/p/KBHyP#s=0
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.