Skip to content

Commit

Permalink
Merge branch 'server-renderer' into 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Jan 15, 2024
2 parents 2cf3f14 + c699c3a commit 670fb8a
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package xiamomc.morph.backends.server.renderer.network.datawatcher.watchers.types;

import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.core.BlockPos;
Expand Down Expand Up @@ -36,11 +37,18 @@ protected void initRegistry()
register(ValueIndex.BASE_LIVING);
}

private final Map<Player, EquipmentSlot> handMap = new Object2ObjectOpenHashMap<>();
private Map<Player, EquipmentSlot> handMap;

private void ensureHandMapPresent()
{
if (handMap == null)
handMap = new Object2ObjectArrayMap<>();
}

@EventHandler
public void onPlayerStartUsingItem(PlayerInteractEvent e)
{
ensureHandMapPresent();
handMap.put(e.getPlayer(), e.getHand());
}

Expand All @@ -59,6 +67,8 @@ protected void doSync()
{
flagBit |= 0x01;

ensureHandMapPresent();

var handInUse = handMap.remove(player);

if (handInUse == null)
Expand Down

0 comments on commit 670fb8a

Please sign in to comment.