Jump to content

Setting value in tileentitity in onBlockPlacedBy not working[1.8]


Recommended Posts

Im trying to set my custom rotation value of a TileEntity in the onBlockPlacedBy method of the block. But somehow the rotation keeps all the same.

What i do atm is this:

    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
    	super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
    	 TileEntity tileentity = worldIn.getTileEntity(pos);
         if (tileentity instanceof TileEntity_Electric){
        	 TileEntity_Electric tile = (TileEntity_Electric)tileentity;
        	 tile.rotation = MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
             System.out.println("Succesfully rotated "+tile.getClass().getName());

Link to comment
Share on other sites

what do you mean "keeps all the same"?

Is the syso with "sucesfully rotated" not printing what u expect? or are u calling the value elsewhere and getting only 0 as value?

if u are getting only 0 as value, u should think of the fact that u need to sync the values between client and server.

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.

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.