Changed BlockPosition arg to CustomBlock#createData

This commit is contained in:
Felix Cravic 2020-04-28 15:25:56 +02:00
parent f8f649852b
commit 8050708ecf
3 changed files with 6 additions and 7 deletions

View File

@ -74,7 +74,7 @@ public class InstanceContainer extends Instance {
// Set the block
if (isCustomBlock) {
data = BLOCK_MANAGER.getCustomBlock(customBlockId).createData(x, y, z, data);
data = BLOCK_MANAGER.getCustomBlock(customBlockId).createData(blockPosition, data);
chunk.UNSAFE_setCustomBlock(x, y, z, customBlockId, data);
} else {
chunk.UNSAFE_setBlock(x, y, z, blockId, data);

View File

@ -68,13 +68,12 @@ public abstract class CustomBlock {
/**
* Initialises data for this block
* @param x X position of the block
* @param y Y position of the block
* @param z Z position of the block
* @param data data given to 'setBlock', can be null
*
* @param blockPosition the position of the targeted block
* @param data data given to 'setBlock', can be null
* @return Data for this block. Can be null, 'data', or a new object
*/
public Data createData(int x, int y, int z, Data data) {
public Data createData(BlockPosition blockPosition, Data data) {
return data;
}
}

View File

@ -78,7 +78,7 @@ public class BlockPlacementListener {
}
if (!intersect) {
PlayerBlockPlaceEvent playerBlockPlaceEvent = new PlayerBlockPlaceEvent(material.getBlock().getBlockId(), (short)0, blockPosition, packet.hand);
PlayerBlockPlaceEvent playerBlockPlaceEvent = new PlayerBlockPlaceEvent(block.getBlockId(), (short) 0, blockPosition, packet.hand);
playerBlockPlaceEvent.consumeBlock(player.getGameMode() != GameMode.CREATIVE);
// BlockPlacementRule check