Skip to content

Commit

Permalink
Some parts of the code depend on MC behavior and thus are volatile. D…
Browse files Browse the repository at this point in the history
…ocument it so we know what can break across updates.
  • Loading branch information
raoulvdberge committed Aug 27, 2018
1 parent c9288a0 commit 7f13a17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ItemCameraTransforms.TransformType, TRSRTransformation> DEFAULT_ITEM_TRANSFORM;
Expand Down Expand Up @@ -284,7 +284,7 @@ public static void addCombinedFluidsToTooltip(List<String> tooltip, boolean show
}
}

// Copied with some tweaks from GuiUtils#drawHoveringText(@Nonnull final ItemStack stack, List<String> 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<String> textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font)
public static void drawTooltipWithSmallText(List<String> textLines, List<String> 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);
Expand Down Expand Up @@ -414,10 +414,10 @@ public static void drawTooltipWithSmallText(List<String> textLines, List<String>
}
}

// @Volatile: From GuiScreen#getItemToolTip
public static List<String> getItemTooltip(ItemStack stack) {
List<String> 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));
Expand Down

0 comments on commit 7f13a17

Please sign in to comment.