Jump to content

[1.8] spawn blocks, put blocks , change Blocks in the world ? <SOLVED>


perromercenary00

Recommended Posts

well this is akwarks

 

but is the same post named

[1.8] world.setBlock(x, y, z, block , meta, mode); method has disapear in 1.8 ?

i just change the name this morning loking for an answer to solve this

 

 

the method i used to use

to create blocks in the world is dissapear or maiby now has a diferent name

 

¿how do you create a especific block at especific coordinates  at especific world?

 

in the other hand  worldIn.destroyBlock(pos, true); is back and works like old times

searching for a suitable method to create blocks the more close to world.setBlock() is

worldIn.func_180497_b(pos0, blk ,int ,int ); but or is not or  idont know hot to se it work

 

 

i have this theory. they change te name of world.setBlock(xyz block) to something else

and i  need this method to create custom estructures

 

i do this in mi testBlock class

 

public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)

    {

Block blk = Blocks.furnace;

BlockPos pos0 = new BlockPos(pos.getX(), (pos.getY()+3) , pos.getZ());

   

    worldIn.func_180497_b(pos0, blk , 0 , 0);

    worldIn.destroyBlock(pos, true);

}

 

on rigth click the block must be destroy and it must create a furnace 3 blocks up but it destroy and drop the test block but no furnace has been created

 

again

¿ what is the method in 1.8 to create blocks in the world ? 

Link to comment
Share on other sites

damn your rigth

 

the just skip the step of defining the block adjunting it to blockState

 

 

 

public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)

    {

        Block blk = Blocks.furnace;

    BlockPos pos0 = new BlockPos(pos.getX(), (pos.getY()+1) , pos.getZ());

        IBlockState state0=blk.getDefaultState();

 

    System.out.println("BlockPos pos="+pos.toString());

    System.out.println("BlockPos pos0="+pos0.toString());

       

    worldIn.destroyBlock(pos, true);

    worldIn.setBlockState(pos0, state0);

   

    playerIn.addChatComponentMessage(new ChatComponentTranslation("destruyete Blockesitu", new Object[0]));

   

    return false;}

   

and it dont like me  this mean i must declare an object of eachtype of block and extract from it the Iblockstate

 

 

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.

Announcements



×
×
  • Create New...

Important Information

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