Skip to content

Commit 93f13a5

Browse files
committed
fix: small single fake block fix
1 parent 6aefa82 commit 93f13a5

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "com.luminiadev.fakeinventories"
7-
version = "1.2.1"
7+
version = "1.2.2"
88

99
java {
1010
toolchain {

src/main/java/me/iwareq/fakeinventories/block/SingleFakeBlock.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class SingleFakeBlock implements FakeBlock {
2929
@Override
3030
public void create(Player player, String title) {
3131
this.createAndGetLastPositions(player).addAll(this.getPlacePositions(player));
32-
this.getPlacePositions(player).forEach(position -> {
32+
this.getLastPositions(player).forEach(position -> {
3333
UpdateBlockPacket updateBlockPacket = new UpdateBlockPacket();
3434
updateBlockPacket.blockRuntimeId = GlobalBlockPalette.getOrCreateRuntimeId(player.protocol, this.blockId, 0);
3535
updateBlockPacket.flags = UpdateBlockPacket.FLAG_NETWORK;
@@ -66,21 +66,22 @@ public void remove(Player player) {
6666
this.lastPositions.remove(player);
6767
}
6868

69-
protected CompoundTag getBlockEntityDataAt(Vector3 position, String title) {
70-
return BlockEntity.getDefaultCompound(position, title)
71-
.putString("id", tileId)
72-
.putBoolean("isMovable", true)
73-
.putString("CustomName", title);
69+
@Override
70+
public Set<Vector3> getLastPositions(Player player) {
71+
return lastPositions.getOrDefault(player, new HashSet<>());
7472
}
7573

76-
public Set<Vector3> createAndGetLastPositions(Player player) {
74+
protected Set<Vector3> createAndGetLastPositions(Player player) {
7775
if (!lastPositions.containsKey(player)) {
7876
lastPositions.put(player, new HashSet<>());
7977
}
8078
return lastPositions.get(player);
8179
}
8280

83-
public Set<Vector3> getLastPositions(Player player) {
84-
return lastPositions.getOrDefault(player, new HashSet<>());
81+
protected CompoundTag getBlockEntityDataAt(Vector3 position, String title) {
82+
return BlockEntity.getDefaultCompound(position, title)
83+
.putString("id", tileId)
84+
.putBoolean("isMovable", true)
85+
.putString("CustomName", title);
8586
}
8687
}

0 commit comments

Comments
 (0)