Everything posted by jordan30001
- 
	
		
		[1.4.7][updated OP] special effects on items
		
		Ok I tried to read it but I get the following error: error:
 - 
	
		
		make block change on right click?(with a certain item in player hand)[solved]
		
		you could either check from the block the player is right clicking on or you could use the following from your Item override class public boolean onItemUse(ItemStack tool, EntityPlayer player, World world, int x, int y, int z, int par7, float xFloat, float yFloat, float zFloat) { if (!player.canPlayerEdit(x, y, z, par7, tool))//can the player edit this block? if he cant then dont do anything { return false; } world.setBlockAndMetadataWithNotify(x, y, z, 0, Block.blockDiamond.blockID); // sets the block to diamond block with the meta data 0 (used for setting metadata if the block needs it world.setBlockWithNotify(x, y, z, Block.blockDiamond.blockID); // sets the block to diamond block with no meta data }
 - 
	
		
		[1.4.7][updated OP] special effects on items
		
		Ok I figured out how to write nbt to the item but not how to read public ItemStack writeEffectsToNBT(ItemStack item) { NBTTagCompound tag = item.getTagCompound(); if (tag == null) { tag = new NBTTagCompound(); item.setTagCompound(tag); } tag.setBoolean("isOn", isOn); tag.setBoolean("isInUse", isInUse); tag.setInteger("EffectIconIndex", textureIconIndex); tag.setInteger("selectEffect", selectEffect); item.writeToNBT(tag); return item; } public void readEffectsFromNBT(ItemStack item) { this.isInUse = tag.getBoolean("isInUse"); this.isOn = tag.getBoolean("isOn"); this.selectEffect = tag.getInteger("selectEffect"); this.textureIconIndex = tag.getInteger("effectIconIndex"); }
 - 
	
		
		[1.4.7][updated OP] special effects on items
		
		updated OP
 - 
	
		
		[1.4.7][updated OP] special effects on items
		
		How would I accomplish this?
 - 
	
		
		[1.4.7][updated OP] special effects on items
		
		Hi I am trying to save data to a ItemStack with ItemStack.getTagCompound as suggested below and I cape up with the code below but it causes the client and server to crash. What went wrong and how could I fix it? updated code: error log: client error log: server old code:
 - 
	
		
		get EntityLiving world?
		
		Huh, Thanks I missed that one.
 - 
	
		
		get EntityLiving world?
		
		What I wish to do is get the current EntityLiving and find out which World it is from. I have looked trough the available functions for enemy and player but have not found anything that can give me the World object it is in. I am stumped. Item.class public boolean hitEntity(ItemStack item, EntityLiving enemy, EntityLiving player) { item.damageItem(1, player); return true; }
 - 
	
		
		finding other mods block/item ids?
		
		If I wanted to lets say get the block ID and meta of ic2's machine block or rp2's screwdriver. How could I achieve this? Also how would I detect if its installed?
 - 
	
		
		[solved]iterating over all connected blocks
		
		Thanks it worked perfectly not to self: dont set depth to 10000 and go on a flatworld thats made of the material bad things happen
 - 
	
		
		[solved]iterating over all connected blocks
		
		Edit: That was much simpler when you explained it in pseudo code Here is my current code: (how would I expand this to the 3D(y coordinate) plane? public static void floodFill(World w, int x, int y, int z, EntityPlayer p, int depth)//depth starts at 0 { if(depth > 50) return; if(w.getBlockMaterial(x + 1, y, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x + 1, y, z); w.setBlock(x + 1, y, z, 0); floodFill(w,x + 1,y,z,p,depth + 1); } if(w.getBlockMaterial(x - 1, y, z) == Material.wood) //south - 1 { doEntityDropAndDestroyBlock(p, w, x - 1, y, z); w.setBlock(x - 1, y, z, 0); floodFill(w,x-1,y,z,p,depth + 1); } if(w.getBlockMaterial(x, y, z + 1) == Material.wood)//North + 1 { doEntityDropAndDestroyBlock(p, w, x, y, z + 1); w.setBlock(x, y, z + 1, 0); floodFill(w,x,y,z+1,p,depth + 1); } if(w.getBlockMaterial(x, y, z - 1) == Material.wood) //north - 1 { doEntityDropAndDestroyBlock(p, w, x, y, z - 1); w.setBlock(x, y, z - 1, 0); floodFill(w,x,y,z-1,p,depth + 1); } } Edit: I tried the following code but it didn't full work public static void floodFill(World w, int x, int y, int z, EntityPlayer p, int depth)//depth starts at 0 { if(depth > 900) return; if(w.getBlockMaterial(x + 1, y, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x + 1, y, z); w.setBlock(x + 1, y, z, 0); if(w.getBlockMaterial(x + 1, y + 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x, y + 1, z); w.setBlock(x + 1, y + 1, z, 0); floodFill(w, x + 1, y + 1, z, p,depth + 1); } if(w.getBlockMaterial(x + 1, y - 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x, y - 1, z); w.setBlock(x + 1, y - 1, z, 0); floodFill(w, x + 1, y - 1, z, p,depth + 1); } floodFill(w,x + 1,y,z,p,depth + 1); } if(w.getBlockMaterial(x - 1, y, z) == Material.wood) //south - 1 { doEntityDropAndDestroyBlock(p, w, x - 1, y, z); w.setBlock(x - 1, y, z, 0); if(w.getBlockMaterial(x - 1, y + 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x - 1, y + 1, z); w.setBlock(x - 1, y + 1, z, 0); floodFill(w, x - 1, y + 1, z, p,depth + 1); } if(w.getBlockMaterial(x - 1, y - 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x, y - 1, z); w.setBlock(x, y - 1, z, 0); floodFill(w, x, y - 1, z, p,depth + 1); } floodFill(w,x-1,y,z,p,depth + 1); } if(w.getBlockMaterial(x, y, z + 1) == Material.wood)//North + 1 { doEntityDropAndDestroyBlock(p, w, x, y, z + 1); w.setBlock(x, y, z + 1, 0); if(w.getBlockMaterial(x, y + 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x, y + 1, z + 1); w.setBlock(x, y + 1, z + 1, 0); floodFill(w, x, y + 1, z + 1, p,depth + 1); } if(w.getBlockMaterial(x, y - 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x, y - 1, z + 1); w.setBlock(x, y - 1, z + 1, 0); floodFill(w, x, y - 1, z + 1, p,depth + 1); } floodFill(w,x,y,z+1,p,depth + 1); } if(w.getBlockMaterial(x, y, z - 1) == Material.wood) //north - 1 { doEntityDropAndDestroyBlock(p, w, x, y, z - 1); w.setBlock(x, y, z - 1, 0); if(w.getBlockMaterial(x, y + 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x, y + 1, z - 1); w.setBlock(x, y + 1, z - 1, 0); floodFill(w, x, y + 1, z - 1, p,depth + 1); } if(w.getBlockMaterial(x, y - 1, z) == Material.wood)//east + 1 { doEntityDropAndDestroyBlock(p, w, x, y - 1, z - 1); w.setBlock(x, y - 1, z - 1, 0); floodFill(w, x, y - 1, z - 1, p,depth + 1); } floodFill(w,x,y,z-1,p,depth + 1); } }
 - 
	
		
		[solved]iterating over all connected blocks
		
		I took a look at that but I don't totally understand how I could implement that
 - 
	
		
		[solved]iterating over all connected blocks
		
		I am having trouble Iterating over all connected blocks of the same block/material How would I go about doing this? Here is my failed attempt at doing what I want (Only gets blocks from y - highest y block) harvests in +x, y, z only https://www.dropbox.com/s/u9b8i307ki4xccl/iteration.png http://paste.minecraftforge.net/view/f5083f46
 - 
	
		
		[Solved]Get Material from world
		
		Hi, I am trying to find out what material a block is for onItemUse() using the World param; Is there a function/class to do this (I could not find one) Just in case someone needs something similar the answer is World.getBlockMaterial();
 
IPS spam blocked by CleanTalk.