Jump to content

[1.7.10][Forge 7.10.18.1180]lit_redstone_ore give null on right click


Recommended Posts

Posted

lit_redstone_ore give null on right click with tool

 

 

package com.lukeplechaty.ores.items;
import java.util.List;
import com.lukeplechaty.ores.Ores;
import com.lukeplechaty.ores.control.ChislHandler;
import com.lukeplechaty.ores.control.OresControl;
import net.minecraft.block.Block;
import net.minecraft.entity.item.*;
import net.minecraft.entity.player.*;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.*;
import net.minecraft.world.*;
public class ItemChisl extends Item
{
public ItemChisl(String name,int damage,int level)
{
	super();
	if(Ores.debug)System.out.println("adding chisel "+name);
	setCreativeTab(Ores.tabOres);
	setTextureName("ores:chisel_"+name);
	setUnlocalizedName("chisel_"+name);
	maxStackSize=1;
	setMaxDamage(damage);
	this.level=level;
}
private int level;
private static List<Object> worklist0;
private static List<Object> worklist1;
private static List<Object> worklist2;
private static List<Object> worklist3;
public static void loadlist()
{
	if(Ores.debug)System.out.println("loading chisl list");
	worklist0=ChislHandler.getlist0();
	worklist1=ChislHandler.getlist1();
	worklist2=ChislHandler.getlist2();
	worklist3=ChislHandler.getlist3();
}
public boolean get(ItemStack itemstack,EntityPlayer entityplayer,World world,int x,int y,int z,int side,ItemStack returnitem,ItemStack block,int level)
{
	double X=x+0.5;
	double Y=y+0.5;
	double Z=z+0.5;
	if(side==0)Y-=0.7D;
	if(side==1)Y+=0.7D;
	if(side==2)Z-=0.7D;
	if(side==3)Z+=0.7D;
	if(side==4)X-=0.7D;
	if(side==5)X+=0.7D;
	if(this.level<level)return false;
	if(returnitem.getItem()!=null)
	{
		ItemStack returncopy = returnitem.copy();
		EntityItem item=new EntityItem(world,X,Y,Z,returncopy);
		item.motionX=0;
		item.motionY=0;
		item.motionZ=0;
		if(side==0)item.motionY=-0.25D;
		if(side==1)item.motionY=+0.25D;
		if(side==2)item.motionZ=-0.25D;
		if(side==3)item.motionZ=+0.25D;
		if(side==4)item.motionX=-0.25D;
		if(side==5)item.motionX=+0.25D;
		item.delayBeforeCanPickup=10;
		world.spawnEntityInWorld(item);
	}
	itemstack.damageItem(1,entityplayer);
	if(Block.getBlockFromItem(block.getItem())==Blocks.air) world.setBlockToAir(x,y,z);
	else world.setBlock(x,y,z,Block.getBlockFromItem(block.getItem()),block.getItemDamage(),3);
	return true;
}
public boolean list(ItemStack itemstack,EntityPlayer entityplayer,World world,int x,int y,int z,int side)
{
	try
	{
		if(OresControl.getOre(new ItemStack(Blocks.lit_redstone_ore)),x,y,z,world))
		{
			return get(itemstack,entityplayer,world,x,y,z,side,new ItemStack(Items.redstone,5,0),new ItemStack(Blocks.cobblestone),3);
		}
	}
	catch(Exception e){System.out.println("Chisl not working: "+e);}
	return false;
}
public boolean onItemUse(ItemStack itemstack,EntityPlayer EntityPlayer,World world,int x,int y,int z,int side,float i,float j,float k)
{
	if(world.isRemote)return true;
	return list(itemstack,EntityPlayer,world,x,y,z,side);
}
}

 

 

Chisel not working: java.lang.NullPointerException

Posted

1 crash log for you

 

 

---- Minecraft Crash Report ----

// Surprise! Haha. Well, this is awkward.

 

Time: 31/07/14 18:06

Description: Ticking memory connection

 

java.lang.NullPointerException: Ticking memory connection

at net.minecraft.item.ItemStack.toString(ItemStack.java:464)

at java.lang.String.valueOf(Unknown Source)

at java.lang.StringBuilder.append(Unknown Source)

at com.lukeplechaty.ores.control.OresControl.getOre(OresControl.java:104)

at com.lukeplechaty.ores.items.ItemChisel.list(ItemChisel.java:118)

at com.lukeplechaty.ores.items.ItemChisel.onItemUse(ItemChisel.java:128)

at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:145)

at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:422)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:591)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.item.ItemStack.toString(ItemStack.java:464)

at java.lang.String.valueOf(Unknown Source)

at java.lang.StringBuilder.append(Unknown Source)

at com.lukeplechaty.ores.control.OresControl.getOre(OresControl.java:104)

at com.lukeplechaty.ores.items.ItemChisel.list(ItemChisel.java:118)

at com.lukeplechaty.ores.items.ItemChisel.onItemUse(ItemChisel.java:128)

at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:145)

at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:422)

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:591)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247)

 

-- Ticking connection --

Details:

Connection: net.minecraft.network.NetworkManager@7ca45a07

Stacktrace:

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.7.0_60, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 859150680 bytes (819 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94

FML: MCP v9.05 FML v7.10.18.1180 Minecraft Forge 10.13.0.1180 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

ores{1.7.10-0.2.0} [Ores] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 1 / 8; [EntityPlayerMP['ForgeDevName'/80, l='New World', x=-577.84, y=69.00, z=-122.48]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

 

and the extra code it looks at

 

 

package com.lukeplechaty.ores.control;
import java.util.ArrayList;
import com.lukeplechaty.ores.Ores;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
public class OresControl
{
public static void name()
{
	if(Ores.debug)
	{
		System.out.println("ores names");
		String[] run=OreDictionary.getOreNames();
		for(int number=0;number<run.length;number++)System.out.println(run[number]);
	}
	if(Ores.debug)System.out.println("that all the ores names");
}
/*public static int list(String s,int x,int y,int z,World w)
{
	ArrayList<ItemStack> c=OreDictionary.getOres(s);
	for(int d=0;d<c.size()++)
	{
		if(c.get(d).itemID==w.getBlockId(x,y,z))
		return d;
	}
	return -1;
}
public static int ID(String s,int x,int y,int z,World w)
{
	String[] run=OreDictionary.getOreNames();
	for(int b=0;b<run.length;b++)
	{
		if(s==run[b])
		{
			ArrayList<ItemStack> c=OreDictionary.getOres(s);
			int a=list(s,x,y,z,w);
			return c.get(a).itemID;
		}
	}
	return -1;
}
public static int Meta(String s,int x,int y,int z,World w)
{
	String[] run=OreDictionary.getOreNames();
	for(int b=0;b<run.length;b++)
	{
		if(s==run[b])
		{
			ArrayList<ItemStack> c=OreDictionary.getOres(s);
			int a=list(s,x,y,z,w);
			return c.get(a).getItemDamage();
		}
	}
	return -1;
}*/
public static Block ID(String string)
{
	if(Ores.debug)System.out.println("ID string: "+string);
	String[] run=OreDictionary.getOreNames();
	for(int number=0;number<run.length;number++)
	{
		if(string==run[number])
		{
			ArrayList<ItemStack> ID=OreDictionary.getOres(string);
			return Block.getBlockFromItem(ID.get(0).getItem());
		}
	}
	return null;
}
public static int Meta(String string)
{
	if(Ores.debug)System.out.println("Meta string: "+string);
	String[] run=OreDictionary.getOreNames();
	for(int number=0;number<run.length;number++)
	{
		if(string==run[number])
		{
			ArrayList<ItemStack> Meta=OreDictionary.getOres(string);
			return Meta.get(0).getItemDamage();
		}
	}
	return -1;
}
public static void addOre(String string, ItemStack itemstack)
{
	if(Ores.debug)System.out.println("addOre string,itemstack: "+string+" "+itemstack);
	OreDictionary.registerOre(string,itemstack);
}
public static boolean getOre(String string,int x,int y,int z,World world)
{
	if(Ores.debug)System.out.println("getOre string,x,y,z,world: "+string+" "+x+" "+y+" "+z+" "+world);
	ArrayList<ItemStack> list=OreDictionary.getOres(string);
	for(int num=0;num<list.size();num++)
	{
		ItemStack ore=list.get(num);
		if(world.getBlock(x,y,z)==Block.getBlockFromItem(ore.getItem())&&world.getBlockMetadata(x,y,z)==ore.getItemDamage())return true;
	}
	return false;
}


public static boolean getOre(ItemStack item,int x,int y,int z,World world)
{
	if(Ores.debug)System.out.println("getOre itemstack,x,y,z,world: "+item+" "+x+" "+y+" "+z+" "+world);
	if(world.getBlock(x,y,z)==Block.getBlockFromItem(item.getItem())&&world.getBlockMetadata(x,y,z)==item.getItemDamage())return true;
	return false;
}


public static ItemStack getOre(String string)
{
	return new ItemStack(ID(string),1,Meta(string));
}
}

 

Posted

tests show that minecraft or forge has a bug

by runing this code

 

try{ItemStack test=new ItemStack(Blocks.lit_redstone_ore);
System.out.println("test work: "+test);}
catch(Exception e){System.out.println("test not: "+e);}

 

i get

test not: java.lang.NullPointerException

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



×
×
  • Create New...

Important Information

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