Jump to content

BlockMetadata unexpected result


Blackout

Recommended Posts

Hello

 

I want to destroy a chest to replace it later.

All about TileEntity is normally fixed, but I'm still stuck with metadata.

 

When I use this configuration :

150720084158219970.png

it works, but when I use this one :

150720084158971754.png

So without a solid block beetween, I got this :

150720084159298782.png

All chest are to the south direction BUT metadata are good.

 

It looks like metadata is ignored

 

How can I solve it ?

Link to comment
Share on other sites

@SubscribeEvent
public void onWorldTick(TickEvent.WorldTickEvent event) {
	...
	... world.setBlock(blockData.getChunkPosition().chunkPosX, blockData.getChunkPosition().chunkPosY, blockData.getChunkPosition().chunkPosZ, blockData.getBlock(), blockData.getMetadata(), 7);
	...
}

@SubscribeEvent
public void onDetonate(ExplosionEvent.Detonate event) {
	...
	worldHealer.add(new BlockData(world,c), ticks);
	...
}

public class BlockData {
private Block block;
private int metadata;
private NBTTagCompound tileEntityTag;
private ChunkPosition chunkPosition;

public BlockData(World world, ChunkPosition chunkPosition) {
	this(world.getBlock(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ));
	this.chunkPosition = chunkPosition;
	this.metadata = world.getBlockMetadata(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ);
	TileEntity te = world.getTileEntity(chunkPosition.chunkPosX, chunkPosition.chunkPosY, chunkPosition.chunkPosZ);
	if(te != null) {
		this.tileEntityTag = new NBTTagCompound();
		te.writeToNBT(tileEntityTag);
	}
}

 

I have a lot of code, so I can't put all here else it will be unundestandable. I've tried to focus on important parts. I hope it's enought, but I can put more code if you want.

 

I'm sure block metadata is correct before calling

world.setBlock(blockData.getChunkPosition().chunkPosX, blockData.getChunkPosition().chunkPosY, blockData.getChunkPosition().chunkPosZ, blockData.getBlock(), blockData.getMetadata(), 7);

Because I've done a System.out.println() of blockData.getMetadata() just before and I have correct values.

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.