mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-23 00:21:26 +01:00
Rename #getBlockId to #getId
This commit is contained in:
parent
58df9a9ba8
commit
41f769b8b2
@ -42,7 +42,7 @@ public class FallingBlockMeta extends EntityMeta implements ObjectDataProvider {
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
public int getObjectData() {
|
||||
int id = this.block.getBlockId();
|
||||
int id = this.block.getId();
|
||||
int metadata = 0; // TODO ?
|
||||
return id | (metadata << 12);
|
||||
}
|
||||
|
@ -574,7 +574,7 @@ public abstract class Instance implements BlockModifier, Tickable, EventHandler,
|
||||
blockActionPacket.blockPosition = blockPosition;
|
||||
blockActionPacket.actionId = actionId;
|
||||
blockActionPacket.actionParam = actionParam;
|
||||
blockActionPacket.blockId = block.getBlockId();
|
||||
blockActionPacket.blockId = block.getId();
|
||||
|
||||
final Chunk chunk = getChunkAt(blockPosition);
|
||||
Check.notNull(chunk, "The chunk at " + blockPosition + " is not loaded!");
|
||||
|
@ -176,7 +176,7 @@ public class InstanceContainer extends Instance {
|
||||
final Block changedBlock = currentlyChangingBlocks.get(blockPosition);
|
||||
if (changedBlock == null)
|
||||
return false;
|
||||
return changedBlock.getBlockId() == block.getBlockId();
|
||||
return changedBlock.getId() == block.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ public interface Block extends Keyed, TagReadable, BlockConstants {
|
||||
|
||||
@NotNull Map<String, String> createPropertiesMap();
|
||||
|
||||
int getBlockId();
|
||||
int getId();
|
||||
|
||||
short getStateId();
|
||||
|
||||
@ -88,7 +88,7 @@ public interface Block extends Keyed, TagReadable, BlockConstants {
|
||||
interface Comparator extends BiPredicate<Block, Block> {
|
||||
Comparator IDENTITY = (b1, b2) -> b1 == b2;
|
||||
|
||||
Comparator ID = (b1, b2) -> b1.getBlockId() == b2.getBlockId();
|
||||
Comparator ID = (b1, b2) -> b1.getId() == b2.getId();
|
||||
|
||||
Comparator STATE = (b1, b2) -> b1.getStateId() == b2.getStateId();
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ class BlockImpl implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockId() {
|
||||
public int getId() {
|
||||
return blockId;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class BlockManager {
|
||||
* @throws IllegalArgumentException if <code>blockPlacementRule</code> block id is negative
|
||||
*/
|
||||
public synchronized void registerBlockPlacementRule(@NotNull BlockPlacementRule blockPlacementRule) {
|
||||
final int id = blockPlacementRule.getBlock().getBlockId();
|
||||
final int id = blockPlacementRule.getBlock().getId();
|
||||
Check.argCondition(id < 0, "Block ID must be >= 0, got: " + id);
|
||||
|
||||
this.placementRules[id] = blockPlacementRule;
|
||||
@ -31,6 +31,6 @@ public class BlockManager {
|
||||
*/
|
||||
@Nullable
|
||||
public BlockPlacementRule getBlockPlacementRule(@NotNull Block block) {
|
||||
return this.placementRules[block.getBlockId()];
|
||||
return this.placementRules[block.getId()];
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,6 @@ class BlockRegistry {
|
||||
@NotNull IntRange range, @NotNull Block.Supplier blockSupplier) {
|
||||
namespaceMap.put(namespaceID, block);
|
||||
IntStream.range(range.getMinimum(), range.getMaximum() + 1).forEach(value -> stateSet.put((short) value, blockSupplier));
|
||||
blockSet.put(block.getBlockId(), block);
|
||||
blockSet.put(block.getId(), block);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class BlockPlacementListener {
|
||||
//after rapid invalid block placements
|
||||
BlockChangePacket blockChangePacket = new BlockChangePacket();
|
||||
blockChangePacket.blockPosition = blockPosition;
|
||||
blockChangePacket.blockStateId = Block.AIR.getBlockId();
|
||||
blockChangePacket.blockStateId = Block.AIR.getId();
|
||||
player.getPlayerConnection().sendPacket(blockChangePacket);
|
||||
}
|
||||
return;
|
||||
|
@ -40,7 +40,7 @@ public class TagsPacket implements ServerPacket {
|
||||
|
||||
@Override
|
||||
public void write(@NotNull BinaryWriter writer) {
|
||||
writeTags(writer, blockTags, name -> Block.fromNamespaceId(name).getBlockId());
|
||||
writeTags(writer, blockTags, name -> Block.fromNamespaceId(name).getId());
|
||||
writeTags(writer, itemTags, name -> Registries.getMaterial(name).ordinal());
|
||||
writeTags(writer, fluidTags, name -> Registries.getFluid(name).ordinal());
|
||||
writeTags(writer, entityTags, name -> Registries.getEntityType(name).ordinal());
|
||||
|
@ -12,7 +12,7 @@ public class DynamicChunkMixin {
|
||||
@ModifyVariable(method = "UNSAFE_setBlock", at = @At("HEAD"), index = 4, require = 1, argsOnly = true, remap = false)
|
||||
public int oopsAllTnt(short blockStateId) {
|
||||
if(blockStateId != 0)
|
||||
return Block.TNT.getBlockId();
|
||||
return Block.TNT.getId();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user