Jump to content

[1.8] Get the cauldrun water level ?? <SOLVED>


perromercenary00

Recommended Posts

goods

 

i been doing somethings whith blocks but alredy dont get how properties work

 

i make some hot item and want to cool them rigth clickin and filled cauldrun

in this case a wanna get if the cauldrun has water but has not realize how to get the value of a properti from a block here

im doing

 

// ########################################################################3
@Override
public ItemStack onItemUseFinish(ItemStack lingote, World worldIn, EntityPlayer playerIn) {

	if (!worldIn.isRemote) {

		MovingObjectPosition mov = Minecraft.getMinecraft().objectMouseOver;
		BlockPos pos = mov.getBlockPos();
		EnumFacing sid=	mov.sideHit;

		IBlockState blkst = worldIn.getBlockState(pos);
		Block blk = blkst.getBlock();

		chat.chatm(playerIn, "Block="+blk.getUnlocalizedName());
		chat.chatm(playerIn, "BlockState="+blkst.getPropertyNames() );

		//level = blkst.getValue(property);
		//Block caldero = Blocks.cauldron;
                        //if (blk == caldero)


	}// is ! remote
	return lingote;
}


// ########################################################################3

this return

 

[11:09:58] [Client thread/INFO]: [CHAT] Block=tile.cauldron

[11:09:58] [Client thread/INFO]: [CHAT] BlockState=[PropertyInteger{name=level, clazz=class java.lang.Integer, values=[0, 1, 2, 3]}]

 

i need to now the value of "name=level"

how i do thath

 

Link to comment
Share on other sites

this blocks in 1.8 has become a little anfractuous (complicadito) to get it work 
but its done 

// ######################################################################################3

@Override

public ItemStack onItemRightClick(ItemStack lingote, World worldIn,EntityPlayer playerIn) {

 

 

if (!worldIn.isRemote) {

 

MovingObjectPosition mov = Minecraft.getMinecraft().objectMouseOver;

BlockPos pos = mov.getBlockPos();

EnumFacing sid= mov.sideHit;

 

IBlockState blkst = worldIn.getBlockState(pos);

Block blk = blkst.getBlock();

 

Block caldero = Blocks.cauldron;

IBlockState calderost=caldero.getDefaultState();

 

if (blk == caldero )

{

 

PropertyInteger LEVEL = PropertyInteger.create("level", 0, 3);

 

int levelInt = (Integer) blkst.getValue(BlockCauldron.LEVEL) ;

 

if ( levelInt > 0 )

{

 

worldIn.spawnEntityInWorld(new EntityItem(worldIn, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(MercenaryModItems.aceroMercenario, 1, 0)));

 

worldIn.playSoundAtEntity(playerIn, "modmercenario:extingir", 1.0F, 1.0F );

 

playerIn.inventory.consumeInventoryItem(MercenaryModItems.hierroAlrojo);

 

}

 

 

levelInt--;

 

if (levelInt < 0)

{

levelInt=0;

}

 

worldIn.setBlockState(pos, calderost.withProperty(LEVEL, Integer.valueOf(levelInt)) );

 

 

}

 

}// is ! remote

 

playerIn.setItemInUse(lingote, this.getMaxItemUseDuration(lingote));

return lingote;

}

 

// ####################################################################################3

[/code]

 

 

 

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



×
×
  • Create New...

Important Information

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