diff --git a/src/main/java/info/shylie/ashes/api/rune/Rune.java b/src/main/java/info/shylie/ashes/api/rune/Rune.java index b5e2c71..7047acd 100644 --- a/src/main/java/info/shylie/ashes/api/rune/Rune.java +++ b/src/main/java/info/shylie/ashes/api/rune/Rune.java @@ -21,7 +21,7 @@ public abstract class Rune { } public Component getTooltip() { - return Component.empty(); + return null; } public TooltipComponent getTooltipImage() { diff --git a/src/main/java/info/shylie/ashes/api/tooltip/SingleItemTooltip.java b/src/main/java/info/shylie/ashes/api/tooltip/SingleItemTooltip.java index 90a8faa..c4285c6 100644 --- a/src/main/java/info/shylie/ashes/api/tooltip/SingleItemTooltip.java +++ b/src/main/java/info/shylie/ashes/api/tooltip/SingleItemTooltip.java @@ -3,9 +3,11 @@ package info.shylie.ashes.api.tooltip; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; public class SingleItemTooltip implements TooltipComponent { private final Item item; @@ -15,6 +17,8 @@ public class SingleItemTooltip implements TooltipComponent { } public static class SingleItemClientTooltip implements ClientTooltipComponent { + private static final ResourceLocation TEXTURE_LOCATION = new ResourceLocation("textures/gui/container/bundle.png"); + SingleItemTooltip tooltip; public SingleItemClientTooltip(SingleItemTooltip tooltip) { @@ -23,17 +27,18 @@ public class SingleItemTooltip implements TooltipComponent { @Override public int getHeight() { - return 18; + return 20; } @Override public int getWidth(Font font) { - return 18; + return 20; } @Override public void renderImage(Font font, int x, int y, GuiGraphics graphics) { - graphics.renderFakeItem(new ItemStack(tooltip.item), x, y); + graphics.blit(TEXTURE_LOCATION, x, y, 0, 0, 0, 18, 18, 128, 128); + graphics.renderFakeItem(new ItemStack(tooltip.item), x + 1, y + 1); } } } diff --git a/src/main/java/info/shylie/ashes/rune/param/BlockPosRune.java b/src/main/java/info/shylie/ashes/rune/param/BlockPosRune.java index c59730e..d362f0f 100644 --- a/src/main/java/info/shylie/ashes/rune/param/BlockPosRune.java +++ b/src/main/java/info/shylie/ashes/rune/param/BlockPosRune.java @@ -37,7 +37,11 @@ public class BlockPosRune extends ParameterRune { @Override protected BlockPos loadImpl2(CompoundTag tag) { - return new BlockPos(tag.getInt(X_TAG), tag.getInt(Y_TAG), tag.getInt(Z_TAG)); + if (tag.contains(X_TAG) && tag.contains(Y_TAG) && tag.contains(Z_TAG)) { + return new BlockPos(tag.getInt(X_TAG), tag.getInt(Y_TAG), tag.getInt(Z_TAG)); + } + + return null; } @Override diff --git a/src/main/java/info/shylie/ashes/rune/param/ItemRune.java b/src/main/java/info/shylie/ashes/rune/param/ItemRune.java index bf90fdc..a642e65 100644 --- a/src/main/java/info/shylie/ashes/rune/param/ItemRune.java +++ b/src/main/java/info/shylie/ashes/rune/param/ItemRune.java @@ -36,6 +36,9 @@ public class ItemRune extends ParameterRune { @Override protected void saveImpl(CompoundTag tag) { - tag.putString(ITEM_TAG, ForgeRegistries.ITEMS.getKey(getValue()).toString()); + ResourceLocation rl = ForgeRegistries.ITEMS.getKey(getValue()); + if (rl != null) { + tag.putString(ITEM_TAG, rl.toString()); + } } } diff --git a/src/main/java/info/shylie/ashes/rune/task/MoveRune.java b/src/main/java/info/shylie/ashes/rune/task/MoveRune.java index 5f4580a..0351f35 100644 --- a/src/main/java/info/shylie/ashes/rune/task/MoveRune.java +++ b/src/main/java/info/shylie/ashes/rune/task/MoveRune.java @@ -35,14 +35,23 @@ public class MoveRune extends LeafTaskRune { ); e.move(MoverType.SELF, e.getDeltaMovement()); - return e.getNavigation().isDone() ? Status.SUCCESS : Status.ONGOING; + if (e.getNavigation().isDone()) { + BlockPos pos = getValue(0); + if (e.position().distanceToSqr(new Vec3(pos.getX(), pos.getY() + 1, pos.getZ())) < 1) { + return Status.SUCCESS; + } + + return Status.FAILURE; + } + + return Status.ONGOING; } private boolean path(IGolem golem) { BlockPos pos = getValue(0); return pos != null && golem.asEntity().getNavigation().moveTo( pos.getX(), - pos.getY() + 1, + pos.getY(), pos.getZ(), 1.0 );