From 7f13a174e29b53a3a6d67b2a960fc0fcd2e9e49e Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Mon, 27 Aug 2018 19:23:21 +0200 Subject: [PATCH] Some parts of the code depend on MC behavior and thus are volatile. Document it so we know what can break across updates. --- .../recipe/RecipeUpgradeWithEnchantedBook.java | 1 + .../com/raoulvdberge/refinedstorage/util/RenderUtils.java | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/raoulvdberge/refinedstorage/recipe/RecipeUpgradeWithEnchantedBook.java b/src/main/java/com/raoulvdberge/refinedstorage/recipe/RecipeUpgradeWithEnchantedBook.java index d9a039bd54..cdbb366516 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/recipe/RecipeUpgradeWithEnchantedBook.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/recipe/RecipeUpgradeWithEnchantedBook.java @@ -44,6 +44,7 @@ public boolean matches(InventoryCrafting inv, World world) { for (int i = 0; i < enchantments.tagCount(); ++i) { NBTTagCompound enchantmentNbt = enchantments.getCompoundTagAt(i); + // @Volatile: NBT tags from ItemEnchantedBook if (Enchantment.getEnchantmentByID(enchantmentNbt.getShort("id")) == enchant.enchantment && enchantmentNbt.getShort("lvl") == enchant.enchantmentLevel) { return true; } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/util/RenderUtils.java b/src/main/java/com/raoulvdberge/refinedstorage/util/RenderUtils.java index 77d657099e..c2c99b029a 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/util/RenderUtils.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/util/RenderUtils.java @@ -45,7 +45,7 @@ public final class RenderUtils { public static final Matrix4f EMPTY_MATRIX_TRANSFORM = getTransform(0, 0, 0, 0, 0, 0, 1.0f).getMatrix(); - // From ForgeBlockStateV1 + // @Volatile: From ForgeBlockStateV1 private static final TRSRTransformation FLIP_X = new TRSRTransformation(null, null, new Vector3f(-1, 1, 1), null); private static ImmutableMap DEFAULT_ITEM_TRANSFORM; @@ -284,7 +284,7 @@ public static void addCombinedFluidsToTooltip(List tooltip, boolean show } } - // Copied with some tweaks from GuiUtils#drawHoveringText(@Nonnull final ItemStack stack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) + // @Volatile: Copied with some tweaks from GuiUtils#drawHoveringText(@Nonnull final ItemStack stack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) public static void drawTooltipWithSmallText(List textLines, List smallTextLines, boolean showSmallText, @Nonnull ItemStack stack, int mouseX, int mouseY, int screenWidth, int screenHeight, FontRenderer fontRenderer) { if (!textLines.isEmpty()) { RenderTooltipEvent.Pre event = new RenderTooltipEvent.Pre(stack, textLines, mouseX, mouseY, screenWidth, screenHeight, -1, fontRenderer); @@ -414,10 +414,10 @@ public static void drawTooltipWithSmallText(List textLines, List } } + // @Volatile: From GuiScreen#getItemToolTip public static List getItemTooltip(ItemStack stack) { List lines = stack.getTooltip(Minecraft.getMinecraft().player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); - // From GuiScreen#getItemToolTip for (int i = 0; i < lines.size(); ++i) { if (i == 0) { lines.set(i, stack.getRarity().rarityColor + lines.get(i));