From 148bd5b6ad91746c9090d7904d3897a9d5ac5f17 Mon Sep 17 00:00:00 2001 From: QuImUfu Date: Sun, 19 Apr 2020 23:38:30 +0200 Subject: [PATCH] fix multiplayer --- src/main/java/quimufu/structure_item/MyItem.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/quimufu/structure_item/MyItem.java b/src/main/java/quimufu/structure_item/MyItem.java index c3f3920..83fce34 100644 --- a/src/main/java/quimufu/structure_item/MyItem.java +++ b/src/main/java/quimufu/structure_item/MyItem.java @@ -110,10 +110,13 @@ public class MyItem extends Item { } } Block current = c.getWorld().getBlockState(c.getBlockPos()).getBlock(); + if (allowed != null && !current.equals(allowed)) { + Text currentName = new TranslatableText(current.getTranslationKey()); + Text allowedName = new TranslatableText(allowed.getTranslationKey()); TranslatableText message = new TranslatableText("items.structure.spawner.invalid.block.clicked", - current.getName(), allowed.getName()); + currentName, allowedName); sendPlayer(player, message); return ActionResult.FAIL; } @@ -239,7 +242,7 @@ public class MyItem extends Item { private Block getBlock(String loc) { Identifier location = Identifier.tryParse(loc); DefaultedRegistry blocks = Registry.BLOCK; - if (location == null || !blocks.containsId(location)) { + if (location == null) { return null; } return blocks.get(location);