Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 ?

  • Author

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

  • Author

It works :)

 

Weird idea indeed :o

 

Anyways, thank you very much :)

Fortunately there are people like you who know the subtleties of the minecraft's code :)

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.