Skip to content

Commit 397b96c

Browse files
committed
Fix disk rendering.
1 parent 89305f0 commit 397b96c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

loader/src/main/java/com/fox2code/foxloader/registry/GameRegistry.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import net.minecraft.common.item.ItemStack;
4545
import net.minecraft.common.item.Items;
4646
import net.minecraft.common.item.block.ItemBlock;
47+
import net.minecraft.common.item.children.ItemRecord;
4748
import net.minecraft.common.networking.NetworkManager;
4849
import net.minecraft.common.networking.Packet250PluginMessage;
4950

@@ -367,7 +368,8 @@ public static int convertItemIdToBlockId(int itemId) {
367368

368369
public static boolean isItemBlock(int itemId) {
369370
return itemId <= MAXIMUM_TRANSLATED_BLOCK_ID &&
370-
(itemId >= INITIAL_TRANSLATED_BLOCK_ID || (itemId <= 255 || (itemId >= 1000)));
371+
(itemId >= INITIAL_TRANSLATED_BLOCK_ID || (itemId <= 255 ||
372+
(itemId >= 1000 && !(Items.ITEMS_LIST[itemId] instanceof ItemRecord))));
371373
}
372374

373375
public static boolean isMissingItemStack(ItemStack itemStack) {

patching/src/main/java/com/fox2code/foxloader/patching/game/RegistryPatch.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,13 @@ private static void patchRenderItem(ClassNode classNode) {
561561
AbstractInsnNode nextFixID = jump.label;
562562
TransformerUtils.removeInstructionsInRange(renderItemEntity.instructions, prevFixID, nextFixID);
563563
InsnList toBlockId = new InsnList();
564+
toBlockId.add(new VarInsnNode(ILOAD, iStore.var));
565+
LabelNode notABlock = new LabelNode();
566+
toBlockId.add(new JumpInsnNode(IFEQ, notABlock));
564567
toBlockId.add(new VarInsnNode(ILOAD, 7));
565568
toBlockId.add(new MethodInsnNode(INVOKESTATIC, GameRegistry, "convertItemIdToBlockId", "(I)I"));
566569
toBlockId.add(new VarInsnNode(ISTORE, 7));
570+
toBlockId.add(notABlock);
567571
renderItemEntity.instructions.insert(prevFixID, toBlockId);
568572
}
569573

0 commit comments

Comments
 (0)