Jump to content

[1.12.2]Calling ItemStack array in casted tileentity crashes world


Recommended Posts

Posted (edited)

So hello everybody, i was trying to make a tile entity for a machine that would onky accept items in special slots, but when it calls the update statement, i instantly get a exeption, i tried to debug but i didn't found anything. Do i send packets in the wrong way?

 

code for TE:

package btf.objects.blocks.tiles;

import btf.init.BlockInit;
import btf.init.ItemInit;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

public class TileAssembler extends TileEntity{
	public ItemStack[] inv = new ItemStack[3];

	public ItemStack getInv(int meta) {
		return this.inv[meta];
	}

	public void setInv(ItemStack inv, int meta) {
		this.inv[meta] = inv;
	}

	public void refresh() {
		if(inv[0].getItem()==Items.DIAMOND_HOE&&inv[1].getItem()==ItemInit.copperGear) {
			if(world.getBlockState(pos.add(0, 1, 0)).getBlock()==BlockInit.casingWooden) {
				world.setBlockState(pos.add(0, 1, 0), BlockInit.harvester.getDefaultState());
				inv[0]=null;inv[1]=null;
			}
		} else if (inv[2].getItem()==Items.DIAMOND_PICKAXE&&inv[3].getItem()==ItemInit.ironGear) {
			if(world.getBlockState(pos.add(0, 1, 0)).getBlock()==BlockInit.casingWooden) {
				world.setBlockState(pos.add(0, 1, 0), BlockInit.blockbreaker.getDefaultState());
				inv[2]=null;inv[3]=null;
			}
		}
		
	}
	
	@Override
	public NBTTagCompound writeToNBT(NBTTagCompound compound) {
		// TODO Auto-generated method stub
		return super.writeToNBT(compound);
	}
	
	@Override
	public void readFromNBT(NBTTagCompound compound) {
		// TODO Auto-generated method stub
		super.readFromNBT(compound);
	}
	
	
}

 

Block code:

package btf.objects.blocks;

import btf.main.Main;
import btf.objects.blocks.tiles.TileAssembler;
import btf.objects.blocks.tiles.TileBlockBreaker;
import btf.objects.blocks.tiles.TileCrafterMachine;
import btf.objects.blocks.tiles.TileHarvesterTicker;
import btf.util.handlers.MachineHandler;
import btf.util.handlers.MachineHandler.MachineTypes;
import net.minecraft.block.BlockRedstoneWire;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class Machine extends BlockBase implements ITileEntityProvider{
	public static final PropertyDirection FACING = PropertyDirection.create("facing");
	MachineTypes typeIn;

	public Machine(String name, Material materialIn, CreativeTabs tab, MachineTypes machinetype) {
		super(name, materialIn, tab);
		typeIn=machinetype;
		this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
	}
	@Deprecated
	public Machine(String name, Material materialIn, CreativeTabs tab) {
		//EXTREMELY DEPRECATED use (String name, Material materialIn, CreativeTabs tab, MachineTypes machinetype) instead
		super(name, materialIn, tab);
		Main.LOGGER.warn("Registering Machines Without a MACHINETYPE!! this is ABSOLUTELY Deprecated");
	}
	
	@Override
	public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
		 switch (typeIn) {
		 case FACTORYTABLE: 
		 {
		 if(side == side.EAST || side == side.WEST || side == side.NORTH || side == side.SOUTH)
			 return true;
		 return false;
		 }
		case BLOCKBREAKER:
		{
			if (side == side.DOWN)
				return true;
			return false;
		}
		case HARVESTER:
		{
			if (side == side.DOWN)
				return true;
			return false;
		}
		case TELEPORTER:
		{
			return false;
		}
		case WOODENCASING:
		{
			return false;
		}
		case ASSEMBLER:
		{
			return false;
		}
			
		}
		return false;
	}
	
	@Override
	public TileEntity createTileEntity(World world, IBlockState state) {
		switch (typeIn) {
		case WOODENCASING: 
		{
			//TODO Add TileEntity
			break;
		}
		case BLOCKBREAKER:
		{
			return new TileBlockBreaker();
		}
		case FACTORYTABLE:
		{
			return new TileCrafterMachine();
		}
		case HARVESTER:
		{
			return new TileHarvesterTicker();
		}
		case TELEPORTER:
		{
		//TODO Add TileEntity
			break;
		}
		case ASSEMBLER:
		{
			return new TileAssembler();
		}
		}
		return super.createTileEntity(world, state);
	}
	
	@Override
	public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
		if (this.typeIn == MachineTypes.HARVESTER||this.typeIn == MachineTypes.BLOCKBREAKER) {
		worldIn.setBlockState(pos, this.getBlockState().getBaseState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()));
		}
		super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
		}
	
	@Override
	protected BlockStateContainer createBlockState() {
		return new BlockStateContainer(this, FACING);
		}

	@Override
    public int getMetaFromState(IBlockState state) {
        return state.getValue(FACING).getIndex();
    }

    @Override
    public IBlockState getStateFromMeta(int meta) {
        return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta & 7));
    }
    
    @Override
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
    		EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    	MachineHandler.OnBlockActivated(worldIn, pos, state, playerIn, hand, typeIn);
    	return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
    }
	@Override
	public TileEntity createNewTileEntity(World worldIn, int meta) {
		if (typeIn == MachineTypes.BLOCKBREAKER)
			return new TileBlockBreaker();
		if (typeIn == MachineTypes.HARVESTER)
		return new TileHarvesterTicker();
		if (typeIn == MachineTypes.ASSEMBLER)
			return new TileAssembler();
		return null;
	}
	
}

 

the machinehandler handling the onclick event:

package btf.util.handlers;

import java.util.Map;
import java.util.Random;

import btf.init.ItemInit;
import btf.main.Main;
import btf.objects.blocks.Machine;
import btf.objects.blocks.tiles.TileAssembler;
import btf.objects.blocks.tiles.TileCrafterMachine;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

public class MachineHandler {
	public static enum MachineTypes {
	     BLOCKBREAKER, FACTORYTABLE, HARVESTER, TELEPORTER, WOODENCASING, ASSEMBLER
	}
	private boolean initialized = false;
	private BlockPos breaking;
	private int dropx;
	private int dropy;
	private int dropz;
	
	public static void OnBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
    		EnumHand hand, MachineTypes typeIn) {
		switch (typeIn) {
		case WOODENCASING: 
		{
			
			break;
		}
		case BLOCKBREAKER:
		{
			break;
		}
		case FACTORYTABLE:
		{
			if (playerIn.getActiveItemStack().getItem() == Items.DIAMOND_HOE) {
				//null
			}
			break;
		}
		case HARVESTER:
		{
			break;
		}
		case TELEPORTER:
		{
			if (!playerIn.isSneaking()) {
				BlockPos posNew = new BlockPos(pos.getX(), pos.getY()+1, pos.getZ());
				if(worldIn.getBlockState(posNew) == Blocks.AIR.getDefaultState()) {
					BlockPos playerPos = playerIn.getPosition().add(0, -1, 0);
					if (worldIn.getBlockState(playerPos) == state)
						playerIn.move(MoverType.SELF, 0, 1.0, 0);
					worldIn.setBlockToAir(pos);
					worldIn.setBlockState(posNew, state);
				
				}
				
			}else {
					BlockPos posNew = new BlockPos(pos.getX(), pos.getY()-1, pos.getZ());
					if(worldIn.getBlockState(posNew) == Blocks.AIR.getDefaultState()) {
					worldIn.setBlockToAir(pos);
					worldIn.setBlockState(posNew, state);
					}
			}
			}
		case ASSEMBLER:
		{
			ItemStack inv;
			inv = playerIn.getActiveItemStack().copy();
			inv.setCount(1);
			int meta=0;
			ItemStack[] acceptedItems = new ItemStack[] {
					new ItemStack(Items.DIAMOND_HOE),
					new ItemStack(ItemInit.copperGear),
					new ItemStack(Items.DIAMOND_PICKAXE),
					new ItemStack(ItemInit.ironGear)
			};
			for ( ItemStack invcheck:acceptedItems) {
				meta++;
				if(invcheck.getItem() == inv.getItem()) {
					TileEntity TileentityIn = worldIn.getTileEntity(pos);
					if(TileentityIn instanceof TileAssembler) {
						TileAssembler tileIn = (TileAssembler)TileentityIn;
						tileIn.setInv(inv, meta);
						playerIn.getActiveItemStack().shrink(1);
					}
				}
			}
			TileEntity TileentityIn = worldIn.getTileEntity(pos);
			if(TileentityIn instanceof TileAssembler) {
			TileAssembler tileIn = (TileAssembler)worldIn.getTileEntity(pos);
			tileIn.refresh();
			}
		}
			break;
		}	
	}
	

}

 

Edited by tebreca
forgot version
Posted
Just now, diesieben07 said:

The word "update" does not occur anywhere in your post or code except here. What is this "update statement" you speak of?

And "an exception" is not helpful, post the stacktrace.

im sorry i meant update method, (morning brain)

Posted (edited)

stacktrace:

Thread: Client thread
Stacktrace:
	at btf.objects.blocks.tiles.TileAssembler.refresh(TileAssembler.java:22)
	at btf.util.handlers.MachineHandler.OnBlockActivated(MachineHandler.java:106)
	at btf.objects.blocks.Machine.onBlockActivated(Machine.java:142)
	at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:454)
	at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1674)
	at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2361)
	at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2127)

-- Affected level --
Details:
	Level name: MpServer
	All players: 1 total; [EntityPlayerSP['Player525'/331, l='MpServer', x=-175.22, y=75.00, z=260.58]]
	Chunk stats: MultiplayerChunkCache: 539, 539
	Level seed: 0
	Level generator: ID 00 - default, ver 1. Features enabled: false
	Level generator options: 
	Level spawn location: World: (-172,64,256), Chunk: (at 4,4,0 in -11,16; contains blocks -176,0,256 to -161,255,271), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
	Level time: 36358 game time, 36358 day time
	Level dimension: 0
	Level storage version: 0x00000 - Unknown?
	Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
	Forced entities: 107 total; [EntitySkeleton['Skeleton'/65, l='MpServer', x=-244.50, y=29.00, z=192.50], EntityCow['Cow'/66, l='MpServer', x=-241.22, y=69.00, z=195.41], EntityCow['Cow'/67, l='MpServer', x=-251.03, y=66.00, z=213.58], EntityCow['Cow'/68, l='MpServer', x=-246.50, y=68.00, z=238.50], EntityWolf['Wolf'/69, l='MpServer', x=-239.70, y=68.00, z=239.38], EntityCow['Cow'/70, l='MpServer', x=-238.55, y=69.00, z=246.27], EntityCow['Cow'/71, l='MpServer', x=-253.79, y=72.00, z=330.56], EntityCow['Cow'/72, l='MpServer', x=-244.64, y=72.00, z=319.62], EntityPlayerSP['Player525'/331, l='MpServer', x=-175.22, y=75.00, z=260.58], EntityCow['Cow'/88, l='MpServer', x=-234.45, y=70.00, z=202.68], EntityCow['Cow'/89, l='MpServer', x=-237.16, y=67.00, z=220.17], EntityCow['Cow'/90, l='MpServer', x=-232.83, y=70.00, z=249.86], EntityCow['Cow'/91, l='MpServer', x=-239.82, y=69.00, z=267.63], EntityCow['Cow'/92, l='MpServer', x=-232.93, y=69.00, z=270.55], EntityCow['Cow'/93, l='MpServer', x=-229.60, y=70.00, z=284.50], EntityCow['Cow'/94, l='MpServer', x=-236.58, y=68.00, z=280.78], EntityCow['Cow'/95, l='MpServer', x=-227.20, y=70.00, z=298.14], EntityCow['Cow'/96, l='MpServer', x=-228.55, y=70.00, z=298.22], EntityWolf['Wolf'/97, l='MpServer', x=-234.00, y=68.00, z=295.77], EntityWolf['Wolf'/98, l='MpServer', x=-233.43, y=68.00, z=295.09], EntityZombie['Zombie'/106, l='MpServer', x=-215.50, y=21.00, z=236.50], EntityBat['Bat'/107, l='MpServer', x=-212.56, y=55.58, z=264.43], EntityCow['Cow'/108, l='MpServer', x=-221.20, y=70.00, z=263.83], EntitySkeleton['Skeleton'/109, l='MpServer', x=-210.50, y=53.00, z=274.50], EntityCow['Cow'/110, l='MpServer', x=-216.21, y=70.00, z=285.40], EntityCow['Cow'/111, l='MpServer', x=-212.44, y=70.00, z=283.26], EntityCow['Cow'/112, l='MpServer', x=-209.45, y=69.00, z=294.32], EntitySkeleton['Skeleton'/113, l='MpServer', x=-218.50, y=22.00, z=325.01], EntityZombie['Zombie'/114, l='MpServer', x=-215.50, y=39.00, z=339.50], EntityWolf['Wolf'/119, l='MpServer', x=-193.26, y=73.00, z=210.61], EntityCow['Cow'/120, l='MpServer', x=-196.50, y=74.00, z=202.72], EntityCow['Cow'/121, l='MpServer', x=-200.34, y=74.25, z=229.41], EntityWolf['Wolf'/122, l='MpServer', x=-197.60, y=71.00, z=237.27], EntitySkeleton['Skeleton'/123, l='MpServer', x=-192.50, y=28.00, z=260.50], EntitySpider['Spider'/124, l='MpServer', x=-204.03, y=31.00, z=260.65], EntityZombie['Zombie'/125, l='MpServer', x=-192.39, y=59.00, z=266.13], EntitySkeleton['Skeleton'/126, l='MpServer', x=-197.50, y=20.00, z=280.50], EntityZombie['Zombie'/127, l='MpServer', x=-197.31, y=18.00, z=275.74], EntityZombie['Zombie'/128, l='MpServer', x=-201.35, y=19.00, z=278.48], EntityBat['Bat'/129, l='MpServer', x=-195.03, y=21.48, z=275.17], EntityCow['Cow'/130, l='MpServer', x=-199.78, y=70.00, z=291.82], EntityCow['Cow'/131, l='MpServer', x=-199.61, y=70.00, z=301.21], EntityCow['Cow'/132, l='MpServer', x=-202.30, y=70.00, z=297.57], EntityCow['Cow'/133, l='MpServer', x=-198.87, y=70.00, z=298.87], EntitySkeleton['Skeleton'/134, l='MpServer', x=-195.50, y=16.00, z=305.50], EntitySkeleton['Skeleton'/135, l='MpServer', x=-193.49, y=16.00, z=305.78], EntityZombie['Zombie'/136, l='MpServer', x=-195.50, y=16.00, z=305.50], EntityCow['Cow'/139, l='MpServer', x=-180.22, y=72.00, z=204.85], EntityCow['Cow'/140, l='MpServer', x=-176.44, y=71.00, z=206.21], EntitySkeleton['Skeleton'/141, l='MpServer', x=-184.50, y=35.00, z=253.50], EntityCreeper['Creeper'/142, l='MpServer', x=-179.46, y=60.00, z=255.55], EntitySkeleton['Skeleton'/143, l='MpServer', x=-187.35, y=58.00, z=266.22], EntityBat['Bat'/144, l='MpServer', x=-182.75, y=64.10, z=258.25], EntityBat['Bat'/145, l='MpServer', x=-185.27, y=55.10, z=281.59], EntityCreeper['Creeper'/146, l='MpServer', x=-184.52, y=52.00, z=282.97], EntityBat['Bat'/147, l='MpServer', x=-184.30, y=54.10, z=281.66], EntityZombie['Zombie'/148, l='MpServer', x=-177.77, y=56.00, z=278.50], EntityItem['item.item.dyePowder.black'/149, l='MpServer', x=-186.82, y=47.00, z=292.89], EntityBat['Bat'/150, l='MpServer', x=-190.36, y=19.27, z=311.34], EntityCow['Cow'/153, l='MpServer', x=-174.50, y=67.00, z=195.21], EntityBat['Bat'/154, l='MpServer', x=-167.30, y=58.10, z=243.57], EntityCreeper['Creeper'/155, l='MpServer', x=-172.45, y=62.00, z=251.85], EntitySpider['Spider'/156, l='MpServer', x=-168.21, y=62.00, z=246.74], EntityZombie['Zombie'/157, l='MpServer', x=-163.50, y=26.00, z=270.50], EntitySkeleton['Skeleton'/158, l='MpServer', x=-163.50, y=35.00, z=265.50], EntityCreeper['Creeper'/159, l='MpServer', x=-164.50, y=35.00, z=267.50], EntityBat['Bat'/160, l='MpServer', x=-171.25, y=59.10, z=269.75], EntityWitch['Witch'/161, l='MpServer', x=-173.73, y=61.00, z=256.46], EntityItem['item.item.carrots'/162, l='MpServer', x=-175.50, y=74.00, z=256.50], EntitySkeleton['Skeleton'/163, l='MpServer', x=-166.50, y=19.00, z=285.50], EntityZombie['Zombie'/164, l='MpServer', x=-163.70, y=33.00, z=278.50], EntityBat['Bat'/165, l='MpServer', x=-174.25, y=61.10, z=282.25], EntityBat['Bat'/166, l='MpServer', x=-167.23, y=56.10, z=280.99], EntitySpider['Spider'/167, l='MpServer', x=-174.70, y=59.00, z=281.60], EntitySkeleton['Skeleton'/168, l='MpServer', x=-160.50, y=54.00, z=287.50], EntitySkeleton['Skeleton'/169, l='MpServer', x=-170.70, y=58.00, z=277.70], EntityBat['Bat'/170, l='MpServer', x=-165.14, y=53.09, z=285.49], EntitySkeleton['Skeleton'/171, l='MpServer', x=-175.50, y=18.00, z=313.50], EntitySpider['Spider'/179, l='MpServer', x=-155.50, y=32.00, z=203.50], EntityBat['Bat'/181, l='MpServer', x=-144.25, y=33.10, z=231.75], EntitySkeleton['Skeleton'/182, l='MpServer', x=-156.50, y=45.00, z=241.50], EntityZombie['Zombie'/183, l='MpServer', x=-149.57, y=15.00, z=259.25], EntityWitch['Witch'/184, l='MpServer', x=-165.93, y=39.00, z=287.50], EntityZombie['Zombie'/185, l='MpServer', x=-158.50, y=34.00, z=285.19], EntitySkeleton['Skeleton'/186, l='MpServer', x=-159.50, y=54.00, z=285.50], EntityCreeper['Creeper'/187, l='MpServer', x=-148.18, y=16.00, z=288.51], EntitySkeleton['Skeleton'/188, l='MpServer', x=-155.50, y=47.00, z=334.50], EntityZombie['Zombie'/189, l='MpServer', x=-157.07, y=47.00, z=330.22], EntityZombie['Zombie'/190, l='MpServer', x=-153.50, y=46.00, z=327.50], EntitySkeleton['Skeleton'/191, l='MpServer', x=-157.31, y=29.00, z=340.56], EntityChicken['Chicken'/200, l='MpServer', x=-133.12, y=82.00, z=183.49], EntityMinecartChest['Minecart with Chest'/201, l='MpServer', x=-138.50, y=31.06, z=236.50], EntityBat['Bat'/202, l='MpServer', x=-140.57, y=33.10, z=229.25], EntitySkeleton['Skeleton'/203, l='MpServer', x=-142.49, y=35.00, z=246.33], EntityCreeper['Creeper'/204, l='MpServer', x=-130.60, y=24.00, z=266.85], EntityBat['Bat'/205, l='MpServer', x=-134.10, y=18.16, z=261.58], EntityWolf['Wolf'/206, l='MpServer', x=-138.50, y=74.00, z=256.17], EntitySkeleton['Skeleton'/207, l='MpServer', x=-137.74, y=25.00, z=285.56], EntityChicken['Chicken'/222, l='MpServer', x=-122.59, y=88.00, z=188.53], EntityChicken['Chicken'/225, l='MpServer', x=-114.61, y=90.00, z=192.14], EntitySkeleton['Skeleton'/226, l='MpServer', x=-116.50, y=22.00, z=227.50], EntitySkeleton['Skeleton'/227, l='MpServer', x=-122.49, y=24.00, z=233.18], EntityBat['Bat'/228, l='MpServer', x=-119.44, y=13.10, z=253.81], EntityZombie['Zombie'/240, l='MpServer', x=-110.24, y=41.00, z=198.50], EntitySkeleton['Skeleton'/241, l='MpServer', x=-97.58, y=49.00, z=219.07], EntityZombie['Zombie'/242, l='MpServer', x=-102.73, y=32.00, z=238.52], EntityZombieVillager['Zombie Villager'/243, l='MpServer', x=-100.22, y=51.00, z=310.52]]
	Retry entities: 0 total; []
	Server brand: fml,forge
	Server type: Integrated singleplayer server
Stacktrace:
	at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
	at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2879)
	at net.minecraft.client.Minecraft.run(Minecraft.java:465)
	at net.minecraft.client.main.Main.main(Main.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:26)

 

exeption:

java.lang.NullPointerException: null
	at btf.objects.blocks.tiles.TileAssembler.refresh(TileAssembler.java:22) ~[TileAssembler.class:?]
	at btf.util.handlers.MachineHandler.OnBlockActivated(MachineHandler.java:106) ~[MachineHandler.class:?]
	at btf.objects.blocks.Machine.onBlockActivated(Machine.java:142) ~[Machine.class:?]
	at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:454) ~[PlayerControllerMP.class:?]
	at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1674) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2361) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2127) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1915) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1171) ~[Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_151]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_151]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_151]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_151]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]

 

Edited by tebreca
Posted
3 minutes ago, diesieben07 said:

There is no "update method" anywhere in the code you posted.

And you still did not provide the stacktrace.

i mean the refresh method, its the method which updates the block when clicked

Posted
4 minutes ago, diesieben07 said:
  • Don't implement ITileEntityProvider. To add a TileEntity to your block, override hasTileEntity and createTileEntity.
  • In your OnBlockActivated the meta variable starts counting at 0 and then gets incremented 4 times. You use it after every increment, so you end up using values 1 through 4. Then you call setInv on your tile entity with that, but setInv can only accept values 0 through 3, because it accesses an array of length 4. Even if that does not crash because out of sheer luck you don't have the right things in your inventory, the inv array in your TileEntity will end up containing null values, which your refresh method does not handle (it just calls methods on the values in inv).
  • Your formatting is all over the place and you don't follow Java naming conventions. Please don't do this...

ok, thx

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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