mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Cache map ids on item frames (#9584)
This commit is contained in:
parent
cf16a1eeb4
commit
b45d8b401b
39
patches/server/Cache-map-ids-on-item-frames.patch
Normal file
39
patches/server/Cache-map-ids-on-item-frames.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Warrior <50800980+Warriorrrr@users.noreply.github.com>
|
||||
Date: Mon, 7 Aug 2023 12:58:28 +0200
|
||||
Subject: [PATCH] Cache map ids on item frames
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -0,0 +0,0 @@ public class ServerEntity {
|
||||
ItemStack itemstack = entityitemframe.getItem();
|
||||
|
||||
if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
|
||||
- Integer integer = MapItem.getMapId(itemstack);
|
||||
+ Integer integer = entityitemframe.cachedMapId; // Paper
|
||||
MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level);
|
||||
|
||||
if (worldmap != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||
@@ -0,0 +0,0 @@ public class ItemFrame extends HangingEntity {
|
||||
public static final int NUM_ROTATIONS = 8;
|
||||
public float dropChance;
|
||||
public boolean fixed;
|
||||
+ public Integer cachedMapId; // Paper
|
||||
|
||||
public ItemFrame(EntityType<? extends ItemFrame> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -0,0 +0,0 @@ public class ItemFrame extends HangingEntity {
|
||||
}
|
||||
|
||||
private void onItemChanged(ItemStack stack) {
|
||||
+ this.cachedMapId = MapItem.getMapId(stack); // Paper
|
||||
if (!stack.isEmpty() && stack.getFrame() != this) {
|
||||
stack.setEntityRepresentation(this);
|
||||
}
|
Loading…
Reference in New Issue
Block a user