Jump to content

Recommended Posts

Posted

I'm trying to make a furnace for my mod, however, the var1 and var2 variables appear not defined for some reason. If anyone could help, that'd be great.

 

 

package me.ryancp.zeldamod;

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

public class ZeldaForgeTileEntity extends TileEntity implements IInventory{
private ItemStack[] inventory;

public ZeldaForgeTileEntity() {
	inventory = new ItemStack[1];
}

@Override
public int getSizeInventory() {

	return inventory.length;
}

@Override
public ItemStack getStackInSlot(int p_70301_1_) {

	return inventory[1];
}

@Override
public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) {
	ItemStack itemstack = getStackInSlot(var1);
	if(itemstack != null) {
		if(itemstack.stackSize <= var2) {
			setInventorySlotContents(var1, null);
		}
		else {
			itemstack = itemstack.splitStack(var2);
			onInventoryChanged();
		}
	}
	return itemstack;
}

private void onInventoryChanged() {

}

@Override
public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
	ItemStack itemstack = getStackInSlot(var1);
	setInventorySlotContents(var1, null);
	return itemstack;
}

@Override
public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {
	inventory[var1] = var2;
	if(var2 != null && var.stackSize > getInventoryStackLimit()) {
		var2.stackSize = getInventoryStackLimit();

	}

}

@Override
public String getInventoryName() {

	return "Forge";
}

@Override
public boolean hasCustomInventoryName() {

	return true;
}

@Override
public int getInventoryStackLimit() {

	return 64;
}

@Override
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
	if(var1.getDistanceSq(xCoord = (int) 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64) {
		return true;
	}else {
		return false;
	}
}

@Override
public void openInventory() {

}

@Override
public void closeInventory() {


}

@Override
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {

	return true;
}

}

 

 

There's 10 types of people in this world; Those that understand binary and those that don't.

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • @TileEntity it seemed to work, but do you know of a way i could get the two mods to play nicely with each other? Im just trying to add supplementary to a modpack (and most of the mods dont play nicely with neoforge) so i cant exactly remake the whole pack.
    • I did that and it says Error: Unable to access jarfile server.jar im assuming this is why you said make to sure they match? so I checked and following that same path then viewing the server folder, there is no .far file only a .dll file checking the modded server folder obviously has a server-1.20.1.jar file though completely different pathing so I don't think this is what you mean but let me know if im missing something. ALSO, was probably not what was needed but I reinstalled Java 17 in case it didnt fully download for some reason? still no such file.
    • Yes - Update 6 makes larger changes which is breaking these addons Most addons already have the update - some are still in the update process and will be released in the next days
    • So, as I understand it, at the moment it's not possible to update the modpack because too few addons are compatible with version 6 of Create?
    • Check the PC for the Java 17 installation The Oracle Java default path is C:\Program Files\Java\jdk-17\bin\javaw.exe   Open the bat file and replace the world java with the path and put it into quotation marks "C:\Program Files\Java\jdk-17\bin\javaw.exe" -Xmx4G -jar server.jar pause Make sure the java path is correct - the server jar file name also have to match
×
×
  • Create New...

Important Information

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