Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.8] Invisible Item?


americanman
 Share

Recommended Posts

I've been working on a tile entity that makes various items in the game. I've managed to get the server to spawn the itemstacks but they are invisible in the slots until the user grabs them. I think maybe I'm only spawning on the server. Also, I've noticed that various itemstacks seem to be around that have a stack size of 0 if I try to grab from the slot after all of the items are gone. It basically shows a value of 0 in red where a number would be if the stack size is more than 1. What is it I'm doing wrong? Anything helps.

 

Block Class:

package com.littlepup.xcom.blocks.engineering_block;

import com.littlepup.xcom.XcomMain;
import com.littlepup.xcom.packets.PacketsMain;
import com.littlepup.xcom.packets.XcomGuiHandler;
import com.littlepup.xcom.packets.engineering.EngineerToServerMessage;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;

public class BlockEngineeringPanel extends BlockContainer
{
public BlockEngineeringPanel(Material materialIn) 
{
	super(materialIn);
	this.setBlockUnbreakable();
	this.setCreativeTab(XcomMain.xcomTab);
	this.setUnlocalizedName("engineering_block");
}

@Override
public TileEntity createNewTileEntity(World world, int meta) 
{
	return new TileEntityEngineerPanel();
}

@Override
public int getRenderType()
{
	return 3;
}

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
	if(!world.isRemote)
	{
		TileEntityEngineerPanel engineerPanel = (TileEntityEngineerPanel) world.getTileEntity(pos);
		engineerPanel.setAvailibleProjects();
		player.openGui(XcomMain.instance, XcomGuiHandler.engineerPanelGui, world, pos.getX(), pos.getY(), pos.getZ());
	}

	return true;
}

}

 

 

TileEntity Class:

package com.littlepup.xcom.blocks.engineering_block;

import java.util.List;

import com.google.common.collect.Lists;
import com.littlepup.xcom.blocks.research_block.TileEntityResearchPanel;
import com.littlepup.xcom.items.ItemAlienMaterials;
import com.littlepup.xcom.items.ItemAlienSpecies;
import com.littlepup.xcom.items.ItemAlienTrophy;
import com.littlepup.xcom.other.Utilities;
import com.littlepup.xcom.packets.PacketsMain;
import com.littlepup.xcom.packets.xcom_base.BaseInfoMessage;
import com.littlepup.xcom.packets.xcom_base.BaseRequestInfoMessage;
import com.littlepup.xcom.projects.XcomEngineeringProjects;
import com.littlepup.xcom.projects.engineering.EngineeringProject;
import com.littlepup.xcom.projects.research.ResearchProject;
import com.littlepup.xcom.xcom_base.XcomBase;
import com.littlepup.xcom.xcom_base.XcomBaseCollection;

import net.minecraft.client.renderer.texture.ITickable;
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.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;

public class TileEntityEngineerPanel extends TileEntity implements IInventory, ITickable
{
public TileEntityEngineerPanel()
{
	this.storedMaterials = new ItemStack[this.getSizeInventory()];
}

public int associatedBaseID;
public XcomBase associatedBase;
public static final int inventorySize = 12;
public ItemStack[] storedMaterials = new ItemStack[this.inventorySize];
private ItemStack[] usingMaterials = {null, null, null, null, null, null};
boolean isManufacturing = false;
EngineeringProject currentProject;
List allProjects = XcomEngineeringProjects.getEngineeringProjects();
public List availibleProjects = Lists.newArrayList();
public int currentProjectID = 0;
public long timeNeeded;
public int amount = 1;

public void updateBaseInfo(int baseID)
{
	this.associatedBaseID = baseID;
	if(worldObj.isRemote)
	{
		BaseRequestInfoMessage askInfoMessage = new BaseRequestInfoMessage(this.getPos(), baseID);
		PacketsMain.xcom.sendToServer(askInfoMessage);
	}
	else
	{
		XcomBase base = (XcomBase) XcomBaseCollection.getBaseCollection(worldObj).xcom_bases.get(this.associatedBaseID);
		this.associatedBase = base;
		BaseInfoMessage message = new BaseInfoMessage(base, this.getPos());
		PacketsMain.xcom.sendToAllAround(message, new TargetPoint(this.getWorld().provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 256.0D));
	}
	this.markDirty();
}

@Override
public void tick()
{
	if(this.isManufacturing())
	{
		EngineeringProject eProj = this.currentProject;
		if(eProj.timeCost == 0)
		{
			this.endManufacturing(eProj);
		}
		else if(this.timeNeeded <= 0)
		{
			this.endManufacturing(eProj);
		}
		else
		{
			this.timeNeeded--;
			this.markDirty();
		}
	}
}

public void startManufacturing(EngineeringProject project)
{
	ItemStack[] needed = project.getMaterialsNeeded();
	if(needed != null)
	{
		for(int l = 0; l < needed.length; l++)
		{
			int i1 = ((l + (needed.length * this.amount)) % (needed.length * this.amount));
			int used = needed[i1].stackSize * this.amount - this.getStackInSlot(l).stackSize;
			if(used > 1)
			{
				ItemStack stack = new ItemStack(needed[i1].getItem(), used, needed[i1].getMetadata());
				this.setInventorySlotContents(l, stack);
			}
			else
			{
				if(needed[i1].getItem() instanceof ItemAlienMaterials || needed[i1].getItem() instanceof ItemAlienTrophy)
				{
					used -= 64;
				}
				else
				{
					used--;
				}
				this.setInventorySlotContents(l, null);
			}
		}
	}
	if(project.timeCost == 0)
	{
		ItemStack[] output = project.getOutput();
		if(output != null)
		{
			for(int l = 0; l < output.length * this.amount; l++)
			{
				int i1 = (l + output.length) % output.length;
				ItemStack stack;
				if(output[i1].getHasSubtypes())
				{
					stack = new ItemStack(output[i1].getItem(), 1, output[i1].getMetadata());
				}
				else
				{
					stack = new ItemStack(output[i1].getItem(), 1, 0);
				}
				this.setInventorySlotContents(l + 6, stack);
			}
		}
	}
	else
	{
		this.currentProject = project;
		this.timeNeeded = project.timeCost;
		this.isManufacturing = true;
		this.markDirty();
	}
}

public void cancelManufacturing(EngineeringProject project)
{
	if(worldObj.isRemote){
		System.out.println("The cancelManufacturing method is being called clientSide.");
	}
	this.associatedBase.cash += project.getMoneyCost() * this.amount;
	for(int l = 0; l < 6; l++)
	{
		this.setInventorySlotContents(l, this.usingMaterials[l]);
	}
	this.isManufacturing = false;
	this.currentProject = null;
	this.markDirty();
}

public void endManufacturing(EngineeringProject project)
{
	if(worldObj.isRemote)
	{
		System.out.println("The endManufacturing method is being called clientside.");
	}
	int cashRefund = Utilities.roundDoubles(currentProject.getMoneyCost() * (this.associatedBase.numberWorkshops * 0.10 + this.associatedBase.engineeringAdjBonus));
	this.associatedBase.cash += cashRefund;
	EngineeringProject eProj = this.currentProject;
	for(int l = 0; l < eProj.getOutput().length * amount; l++)
	{
		this.setInventorySlotContents(l + 6, eProj.getOutput()[(eProj.getOutput().length + l) % eProj.getOutput().length]);
	}
	this.currentProject = null;
	this.isManufacturing = false;
	this.markDirty();
}

public int getRoomNeeded(EngineeringProject project)
{
	ItemStack[] stack = project.getOutput();
	int slotsNeeded = 0;
	for(int i2 = 0; i2 < stack.length; i2++)
	{
		int maxSize;
		if(stack[i2].getItem() instanceof ItemAlienMaterials || stack[i2].getItem() instanceof ItemAlienSpecies)
		{
			maxSize = 64;
		}
		else
		{
			maxSize = 1;
		}
		slotsNeeded += Math.ceil(amount/maxSize);
	}
	return slotsNeeded;
}

public void setAvailibleProjects()
{
	if(this.worldObj.isRemote || this.associatedBase == null)
	{
		this.updateBaseInfo(associatedBaseID);
	}
	TileEntityResearchPanel rPanel = (TileEntityResearchPanel) this.worldObj.getTileEntity(associatedBase.rPos);
	List researched = rPanel.researchedProjects;
	this.availibleProjects.clear();
	for(int i1 = 0; i1 < allProjects.size(); i1++)
	{
		ResearchProject needed = ((EngineeringProject) allProjects.get(i1)).getResearchNeeded();

		if(needed == null)
		{
			this.availibleProjects.add(allProjects.get(i1));
		}
		else
		{
			if(researched.contains(needed))
			{
				this.availibleProjects.add(allProjects.get(i1));
			}
		}
	}
}

public boolean isManufacturing()
{
	return this.isManufacturing;
}

@Override
public String getName() 
{
	return "";
}

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

@Override
public int getSizeInventory() 
{
	return this.inventorySize;
}

@Override
public ItemStack getStackInSlot(int index) 
{
	ItemStack[] stack = this.storedMaterials;

	if(index >= stack.length)
	{
		index -= 36;
	}

	return this.storedMaterials[index];
}

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

			this.markDirty();
			return stack;
		}
	}
	else
	{
		return null;
	}
}

@Override
public ItemStack getStackInSlotOnClosing(int index) 
{
	ItemStack stack = this.getStackInSlot(index);
	this.setInventorySlotContents(index, null);
	return stack;
}

@Override
public void setInventorySlotContents(int index, ItemStack stack) 
{
	if(index < 0 || index >= this.getSizeInventory())
	{
		return;
	}

    if (stack != null && stack.stackSize > this.getInventoryStackLimit())
        stack.stackSize = this.getInventoryStackLimit();
        
    if (stack != null && stack.stackSize == 0)
        stack = null;

    this.storedMaterials[index] = stack;
    this.markDirty();
}

@Override
public int getInventoryStackLimit() 
{
	return 64;
}

@Override
public boolean isUseableByPlayer(EntityPlayer player) 
{
	return Utilities.getDistance(player.getPosition(), this.getPos()) < 8.0D;
}

@Override
public void openInventory(EntityPlayer player) 
{

}

@Override
public void closeInventory(EntityPlayer player) {}

@Override
public boolean isItemValidForSlot(int index, ItemStack stack) 
{
	return true;
}

@Override
public int getField(int id) 
{
	return 0;
}

@Override
public void setField(int id, int value) {}

@Override
public int getFieldCount() 
{
	return 0;
}

@Override
public void clear() 
{
	for(int i = 0; i < this.getSizeInventory(); i++)
	{
		this.setInventorySlotContents(i, null);
	}
}

@Override
public void writeToNBT(NBTTagCompound nbtParent)
{
	super.writeToNBT(nbtParent);
	nbtParent.setInteger("baseID", this.associatedBaseID);
	NBTTagList tag_list = new NBTTagList();
	for(int l = 0; l < this.storedMaterials.length; ++l)
	{
		if(this.storedMaterials[l] != null)
		{
			NBTTagCompound item = new NBTTagCompound();
			item.setInteger("slot", l);
			this.storedMaterials[l].writeToNBT(item);
			tag_list.appendTag(item);
		}
	}
	nbtParent.setTag("stored", tag_list);
	for(int l = 0; l < nbtParent.getTagList("stored", 10).tagCount(); l++)
	{
		NBTTagList list = nbtParent.getTagList("stored", 10);
		NBTTagCompound nbt = list.getCompoundTagAt(l);
	}
}

@Override
public void readFromNBT(NBTTagCompound nbtParent)
{
	super.readFromNBT(nbtParent);
	this.associatedBaseID = nbtParent.getInteger("baseID");
	this.storedMaterials = new ItemStack[this.getSizeInventory()];
	NBTTagList nbtList = (NBTTagList) nbtParent.getTag("stored");
	if(nbtList != null)
	{
		for(int i1 = 0; i1 < nbtList.tagCount(); ++i1)
		{
			NBTTagCompound compound = nbtList.getCompoundTagAt(i1);
			int i2 = compound.getInteger("slot");
			if(i2 >= 0 && i2 < this.inventorySize)
			{
				this.storedMaterials[i2] = ItemStack.loadItemStackFromNBT(compound);
			}
		}
	}
}

@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet)
{
	this.readFromNBT(packet.getNbtCompound());
}

@Override
public Packet getDescriptionPacket()
{
	NBTTagCompound nbt = new NBTTagCompound();
	this.writeToNBT(nbt);
	int meta = this.getBlockMetadata();
	return new S35PacketUpdateTileEntity(this.getPos(), meta, nbt);
}

@Override
public IChatComponent getDisplayName() 
{
	return new ChatComponentText("Engineering");
}
}

 

 

Gui Class:

package com.littlepup.xcom.blocks.engineering_block;

import java.util.List;

import com.littlepup.xcom.packets.PacketsMain;
import com.littlepup.xcom.packets.engineering.EngineerToServerMessage;
import com.littlepup.xcom.projects.engineering.EngineeringProject;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class GuiEngineerPanel extends GuiContainer
{
public GuiEngineerPanel(World world, EntityPlayer player, TileEntity tileEntity) 
{
	super(new ContainerEngineerPanel(world, player, tileEntity));
	this.ePanel = (TileEntityEngineerPanel) tileEntity;
	EngineerToServerMessage updateProjectsMessage = new EngineerToServerMessage((TileEntityEngineerPanel) world.getTileEntity(ePanel.getPos()), -1, true);
	PacketsMain.xcom.sendToServer(updateProjectsMessage);
	this.availibleProjects = this.ePanel.availibleProjects;
}

private final ResourceLocation engineeringGui = new ResourceLocation("xcom:textures/gui/engineer_panel.png");

TileEntityEngineerPanel ePanel;
List availibleProjects;

@Override
public void actionPerformed(GuiButton button)
{
	EngineerToServerMessage message = null;
	switch(button.id)
	{
		case 0:
			message = new EngineerToServerMessage(this.ePanel, 0, false);
			break;
		case 1:
			message = new EngineerToServerMessage(this.ePanel, 1, false);
			break;
		case 2:
			this.ePanel.amount--;
			message = new EngineerToServerMessage(this.ePanel, 2, false);
			break;
		case 3:
			this.ePanel.amount++;
			message = new EngineerToServerMessage(this.ePanel, 3, false);
			break;
		case 4:
			this.ePanel.currentProjectID--;
			message = new EngineerToServerMessage(this.ePanel, 4, false);
			break;
		case 5:
			this.ePanel.currentProjectID++;
			message = new EngineerToServerMessage(this.ePanel, 5, false);
			break;
		default:
			message = new EngineerToServerMessage();
			break;
	}
	PacketsMain.xcom.sendToServer(message);
	this.inventorySlots.detectAndSendChanges();
}

@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) 
{
	GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
	this.mc.getTextureManager().bindTexture(engineeringGui);
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
}

private void drawTimeRemaining(long ticks) 
{
	if(ticks != 0)
	{
		int days = MathHelper.floor_double(ticks / 24000);
		int min = MathHelper.floor_double((ticks - days * 24000)/1200);
		int sec = MathHelper.floor_double((ticks - (days * 24000 + min * 1200))/20);

		this.fontRendererObj.drawString("D: " + days, 130, 20, 80000);
		this.fontRendererObj.drawString("M: " + min, 130, 30, 80000);
		this.fontRendererObj.drawString("S: " + sec, 130, 40, 80000);
	}
}

@Override
public void initGui()
{
	super.initGui();
	this.buttonList.add(new GuiButton(0, this.guiLeft + 45, this.guiTop + 15, 36, 12, "BEGIN"));
	this.buttonList.add(new GuiButton(1, this.guiLeft + 45, this.guiTop + 27, 36, 12, "CANCEL"));
	this.buttonList.add(new GuiButton(2, this.guiLeft + 45, this.guiTop + 39, 12, 12, "-"));
	this.buttonList.add(new GuiButton(3, this.guiLeft + 69, this.guiTop + 39, 12, 12, "+"));
	this.buttonList.add(new GuiButton(4, this.guiLeft + 85, this.guiTop + 58, 9, 12, "<"));
	this.buttonList.add(new GuiButton(5, this.guiLeft + 118, this.guiTop + 58, 9, 12, ">"));
}

@Override
public void updateScreen()
{
	super.updateScreen();
	if(this.ePanel.isManufacturing())
	{
		((GuiButton)this.buttonList.get(0)).enabled = false;
		((GuiButton)this.buttonList.get(1)).enabled = true;
		this.drawTimeRemaining(this.ePanel.currentProject.timeCost);
	}
	else
	{
		((GuiButton)this.buttonList.get(0)).enabled = true;
		((GuiButton)this.buttonList.get(1)).enabled = false;
		if(this.ePanel.currentProjectID == 0)
		{
			((GuiButton)(this.buttonList.get(4))).enabled = false;
		}
		if(this.ePanel.currentProjectID == this.availibleProjects.size() - 1)
		{
			((GuiButton)(this.buttonList.get(5))).enabled = false;
		}
		if(this.ePanel.currentProjectID != 0 && this.ePanel.currentProjectID != this.availibleProjects.size() - 1)
		{
			((GuiButton)(this.buttonList.get(4))).enabled = true;
			((GuiButton)(this.buttonList.get(5))).enabled = true;
		}

		if(this.ePanel.amount == 1)
		{
			((GuiButton)(this.buttonList.get(2))).enabled = false;
		}
		else if(this.ePanel.getRoomNeeded((EngineeringProject) this.availibleProjects.get(ePanel.currentProjectID)) > 6)
		{
			((GuiButton)(this.buttonList.get(3))).enabled = false;
		}
		else
		{
			((GuiButton)(this.buttonList.get(2))).enabled = true;
			((GuiButton)(this.buttonList.get(3))).enabled = true;
		}
	}
}
}

 

Container Class:

 

package com.littlepup.xcom.blocks.engineering_block;

import com.littlepup.xcom.other.Utilities;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class ContainerEngineerPanel extends Container
{
public ContainerEngineerPanel(World world, EntityPlayer player, TileEntity tileEntity) 
{
	this.ePanel = (TileEntityEngineerPanel) tileEntity;
	worldObj = world;
	usingPlayer = player;
	playerInv = player.inventory;
	panelInv = (IInventory) tileEntity;
	ePanel = (TileEntityEngineerPanel) tileEntity;
	this.addSlots();
}

World worldObj;
IInventory playerInv;
IInventory panelInv;
EntityPlayer usingPlayer;
TileEntityEngineerPanel ePanel;

@Override
public void addCraftingToCrafters(ICrafting crafting)
{
	super.addCraftingToCrafters(crafting);
	crafting.func_175173_a(this, this.panelInv);
}

private void addSlots()
{
	/*Slots 0-35 are the player's inventory
	 * Note: since the engineer panel and player's inventory are
	 * seperate, the slots can have the same ID if needed.
	 * Slots 36-41 are the engineer panel's input
	 * Slots 42-49 are the engineer panel's output
	 */

	//Player's non-hotbar inventory
	for(int x = 0; x < 9; ++x)
	{
		for(int y = 0; y < 3; ++y)
		{
			this.addSlotToContainer(new Slot(playerInv, x * 3 + y, 8 + x * 18, 84 + y * 18));
		}
	}
	//Player's hotbar inventory
	for(int x = 0; x < 9; ++x)
	{
		this.addSlotToContainer(new Slot(playerInv, x + 27, 8 + x * 18, 142));
	}

	//Engineer panel block's input inventory
	for(int x = 0; x < 2; ++x)
	{
		for(int y = 0; y < 3; ++y)
		{
			this.addSlotToContainer(new Slot(panelInv, x * 3 + y + 36, 9 + x * 18, 16 + y * 18));
		}
	}
	//Engineer panel block's output inventory
	for(int x = 0; x < 2; ++x)
	{
		for(int y = 0; y < 3; ++y)
		{
			this.addSlotToContainer(new Slot(panelInv, x * 3 + y + 42, 133 + x * 18, 16 + y * 18));
		}
	}
}

@Override
public boolean canInteractWith(EntityPlayer player) 
{
	return Utilities.getDistance(player.getPosition(), ePanel.getPos()) < 8.0D;
}

@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
	ItemStack stack1 = null;
	Slot slot = this.getSlot(slotID);
	IInventory inventory = slot.inventory;
	if(slot != null && slot.getHasStack())
	{
		ItemStack stack2 = slot.getStack();
		stack1 = stack2.copy();
		//The slot is in the tile entity
		if(slotID >= 36)
		{
			if(!this.mergeItemStack(stack1, 36, 50, false))
			{
				return null;
			}
		}
		else if(!this.mergeItemStack(stack1, 36, 50, false))
		{
			return null;
		}

		if(stack1.stackSize == 0)
		{
			this.putStackInSlot(slotID, null);
		}
		else
		{
			slot.onSlotChanged();
		}
	}
	return stack1;
}

}

Link to comment
Share on other sites

I think maybe I'm only spawning on the server.

 

Mhm.  You should do it on both.

 

Also, I've noticed that various itemstacks seem to be around that have a stack size of 0 if I try to grab from the slot after all of the items are gone. It basically shows a value of 0 in red where a number would be if the stack size is more than 1. What is it I'm doing wrong? Anything helps.

 

Item stacks don't automagically delete themselves when their stack size is zero.  Check for it and set them to null.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Okay, I'll try to get it to spawn client side. Where should I check to see if the stored itemstacks are null?

When you are done calculating the results of the itemstack, check to see if the size < 0. If it is, set the slot contents  to null else just set it to the itemstack.

Link to comment
Share on other sites

When you are done calculating the results of the itemstack, check to see if the size < 0. If it is, set the slot contents  to null else just set it to the itemstack.

 

*Cough*

 

size <= 0

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

When you are done calculating the results of the itemstack, check to see if the size < 0. If it is, set the slot contents  to null else just set it to the itemstack.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • quiero dormir uwu
    • Hi, mod called "charging gadgets" is crushing forge minecraft 1.18.1 when i place block from this mod, im temporary playing On 1.18 cuz its not happening on 1.18 but c'mon, pls fix it, 1.18.1 is better and I Wonder i could use this version
    • I am trying to add an entity into minecraft using forge. i had gotten the game to run without errors until i tried to /summon him ingame.  I dont understand what im missing but i assume it has to do with the attributes not registering.  Entity class:https://pastebin.com/WVBGZWBZ Player Events class:https://pastebin.com/NpuTE53S Error log:  https://pastebin.com/Dj59TPSf I will be forever in debt if you decide to help with this
    • Server console errors are shown below:   [main/FATAL]: Crash report saved to ./crash-reports/crash-2022-01-28_20.38.08-fml.txt [main/FATAL]: Preparing crash report with UUID 4b95805c-d1ad-46d0-8f4b-3246b497f79c ---- Minecraft Crash Report ---- // This doesn't make any sense! Time: 1/28/22, 8:38 PM Description: Mod loading error has occurred java.lang.Exception: Mod Loading has failed at net.minecraftforge.logging.CrashReportExtender.dumpModLoadingCrashReport(CrashReportExtender.java:69) ~[forge-1.18.1-39.0.63-universal.jar%2366!/:?] {re:classloading} at net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:53) ~[forge-1.18.1-39.0.63-universal.jar%2366!/:?] {re:classloading} at net.minecraft.server.Main.main(Main.java:104) ~[server-1.18.1-20211210.034407-srg.jar%2362!/:?] {re:classloading} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:46) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: main Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:1.0] {} -- MOD notenoughanimations -- Details: Mod File: notenoughanimations-forge-1.4.0-mc1.18.jar Failure message: NotEnoughAnimations Mod (notenoughanimations) has failed to load correctly java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER Mod Version: 1.4.0 Mod Issue URL: https://github.com/tr7zw/NotEnoughAnimations/issues Exception message: java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER Stacktrace: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:1.0] {} at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:88) ~[modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) ~[modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.modlauncher.TransformingClassLoader.maybeTransformClassBytes(TransformingClassLoader.java:50) ~[modlauncher-9.1.0.jar%235!/:?] {} at cpw.mods.cl.ModuleClassLoader.readerToClass(ModuleClassLoader.java:110) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.lambda$findClass$16(ModuleClassLoader.java:213) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.loadFromModule(ModuleClassLoader.java:223) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.findClass(ModuleClassLoader.java:213) ~[securejarhandler-1.0.1.jar:?] {} at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:130) ~[securejarhandler-1.0.1.jar:?] {} at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {} at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] {} at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] {} at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?] {} at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.63.jar%2364!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} -- MOD death_compass -- Details: Caused by 0: java.lang.NoClassDefFoundError: net/minecraft/client/renderer/item/ItemPropertyFunction at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] {} at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] {} at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?] {} at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.63.jar%2364!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} Mod File: DeathCompass-0.1.1.jar Failure message: DeathCompass (death_compass) has failed to load correctly java.lang.NoClassDefFoundError: net/minecraft/client/renderer/item/ItemPropertyFunction Mod Version: 0.1.1 Mod Issue URL: Exception message: java.lang.ClassNotFoundException: net.minecraft.client.renderer.item.ItemPropertyFunction Stacktrace: at cpw.mods.cl.ModuleClassLoader.loadClass(ModuleClassLoader.java:135) ~[securejarhandler-1.0.1.jar:?] {} at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?] {} at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?] {} at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?] {} at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?] {} at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?] {} at net.minecraftforge.fml.javafmlmod.FMLModContainer.constructMod(FMLModContainer.java:81) ~[javafmllanguage-1.18.1-39.0.63.jar%2364!/:?] {} at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$4(ModContainer.java:120) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804) ~[?:?] {} at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796) ~[?:?] {} at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?] {} at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?] {} at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?] {} at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?] {} at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?] {} -- System Details -- Details: Minecraft Version: 1.18.1 Minecraft Version ID: 1.18.1 Operating System: Linux (amd64) version 4.15.0-159-generic Java Version: 17.0.1, Eclipse Adoptium Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium Memory: 800094208 bytes (763 MiB) / 1073741824 bytes (1024 MiB) up to 3221225472 bytes (3072 MiB) CPUs: 3 Processor Vendor: AuthenticAMD Processor Name: AMD EPYC 7351P 16-Core Processor Identifier: AuthenticAMD Family 23 Model 1 Stepping 2 Microarchitecture: Zen Frequency (GHz): -0.00 Number of physical packages: 1 Number of physical CPUs: 16 Number of logical CPUs: 32 Graphics card #0 name: unknown Graphics card #0 vendor: unknown Graphics card #0 VRAM (MB): 0.00 Graphics card #0 deviceId: unknown Graphics card #0 versionInfo: unknown Virtual memory max (MB): 98199.23 Virtual memory used (MB): 96554.03 Swap memory total (MB): 33789.99 Swap memory used (MB): 705.40 JVM Flags: 3 total; -Xms1024M -Xmx3072M -XX:-UsePerfData ModLauncher: 9.1.0+9.1.0+main.6690ee51 ModLauncher launch target: forgeserver ModLauncher naming: srg ModLauncher services: mixin PLUGINSERVICE eventbus PLUGINSERVICE object_holder_definalize PLUGINSERVICE runtime_enum_extender PLUGINSERVICE capability_token_subclass PLUGINSERVICE accesstransformer PLUGINSERVICE runtimedistcleaner PLUGINSERVICE mixin TRANSFORMATIONSERVICE fml TRANSFORMATIONSERVICE FML Language Providers: minecraft@1.0 javafml@null Mod List: server-1.18.1-20211210.034407-srg.jar |Minecraft |minecraft |1.18.1 |COMMON_SET|Manifest: NOSIGNATURE maessentials-1.18.1-5.0.0.jar |Ma Enchants |maenchants |1.18.1-5.0.0 |COMMON_SET|Manifest: NOSIGNATURE cleancut-mc1.18-3.0-forge.jar |Clean Cut |cleancut |3.0 |COMMON_SET|Manifest: NOSIGNATURE voicechat-forge-1.18.1-2.2.15.jar |Simple Voice Chat |voicechat |1.18.1-2.2.15 |COMMON_SET|Manifest: NOSIGNATURE torchslabmod-1.18.1_v1.7.5.jar |Torch Slab Mod |torchslabmod |1.7.5 |COMMON_SET|Manifest: NOSIGNATURE endrem_forge-5.0.1-R-1.18.1.jar |End Remastered |endrem |5.0-R-1.18.1 |COMMON_SET|Manifest: NOSIGNATURE [ERROR] notenoughanimations-forge-1.4.0-mc1.18.jar |NotEnoughAnimations Mod |notenoughanimations |1.4.0 |ERROR |Manifest: NOSIGNATURE curios-forge-1.18.1-5.0.6.0.jar |Curios API |curios |1.18.1-5.0.6.0 |COMMON_SET|Manifest: NOSIGNATURE sodium_reloaded-mc1.18.1-1.0.jar |Sodium Reloaded |sodium_reloaded |1.0 |COMMON_SET|Manifest: NOSIGNATURE Neat 1.8-30.jar |Neat |neat |1.8-30 |COMMON_SET|Manifest: NOSIGNATURE waystones-forge-1.18.1-9.0.3.jar |Waystones |waystones |9.0.3 |COMMON_SET|Manifest: NOSIGNATURE advancednetherite-1.10.0-1.18.1.jar |Advanced Netherite |advancednetherite |1.10.0 |COMMON_SET|Manifest: NOSIGNATURE journeymap-1.18.1-5.8.0beta11.jar |Journeymap |journeymap |5.8.0beta11 |COMMON_SET|Manifest: NOSIGNATURE TravelersBackpack-1.18.1-7.0.1.jar |Traveler's Backpack |travelersbackpack |7.0.1 |COMMON_SET|Manifest: NOSIGNATURE artifacts-1.18.1-4.0.2.jar |Artifacts |artifacts |1.18.1-4.0.2 |COMMON_SET|Manifest: NOSIGNATURE InventoryHud_[1.18].forge-3.4.4.jar |Inventory HUD+(Forge edition) |inventoryhud |3.4.4 |COMMON_SET|Manifest: NOSIGNATURE copper-mod-1.9.jar |Copper Armor & Tools |copperarmorandtools |1.9 |COMMON_SET|Manifest: NOSIGNATURE balm-2.4.1+0.jar |Balm |balm |2.4.1+0 |COMMON_SET|Manifest: NOSIGNATURE [ERROR] DeathCompass-0.1.1.jar |DeathCompass |death_compass |0.1.1 |ERROR |Manifest: NOSIGNATURE justzoom_forge_1.0.1_MC_1.18-1.18.1.jar |Just Zoom |justzoom |1.0.1 |COMMON_SET|Manifest: NOSIGNATURE forge-1.18.1-39.0.63-universal.jar |Forge |forge |39.0.63 |COMMON_SET|Manifest: 84:ce:76:e8:45:35:e4:0e:63:86:df::0f:67:6c:c1:5f:6e:5f:4d:b3:54:47:1a:9f:7f:ed:5e:f2:90 expandability-5.0.0-forge.jar |ExpandAbility |expandability |5.0.0 |COMMON_SET|Manifest: NOSIGNATURE konkrete_forge_1.3.3_MC_1.18-1.18.1.jar |Konkrete |konkrete |1.3.3 |COMMON_SET|Manifest: NOSIGNATURE corpse-1.18.1-1.0.4.jar |Corpse |corpse |1.18.1-1.0.4 |COMMON_SET|Manifest: NOSIGNATURE responsiveshields-1.1-mc1.18.x.jar |Responsive Shields |responsiveshields |1.1 |COMMON_SET|Manifest: NOSIGNATURE DungeonsArise-1.18.1-2.1.49c-beta.jar |When Dungeons Arise |dungeons_arise |2.1.49c-1.18.1 |COMMON_SET|Manifest: NOSIGNATURE Crash Report UUID: 4b95805c-d1ad-46d0-8f4b-3246b497f79c FML: 39.0 Forge: net.minecraftforge:39.0.63 [main/FATAL]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [ NotEnoughAnimations Mod (notenoughanimations) has failed to load correctly §7java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER, DeathCompass (death_compass) has failed to load correctly §7java.lang.NoClassDefFoundError: net/minecraft/client/renderer/item/ItemPropertyFunction ] at net.minecraftforge.fml.ModLoader.waitForTransition(ModLoader.java:235) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$21(ModLoader.java:200) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] at net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:200) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$11(ModLoader.java:177) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] at net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:177) ~[fmlcore-1.18.1-39.0.63.jar%2363!/:?] at net.minecraftforge.server.loading.ServerModLoader.load(ServerModLoader.java:46) ~[forge-1.18.1-39.0.63-universal.jar%2366!/:?] at net.minecraft.server.Main.main(Main.java:104) ~[server-1.18.1-20211210.034407-srg.jar%2362!/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at net.minecraftforge.fml.loading.targets.CommonServerLaunchHandler.lambda$launchService$0(CommonServerLaunchHandler.java:46) ~[fmlloader-1.18.1-39.0.63.jar%2323!/:?] at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.0.jar%235!/:?] at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?]
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.