From faf8743a75164f4b62bfc41fa8c654835c03797b Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Wed, 3 Jun 2020 17:35:59 -0700 Subject: [PATCH] Fixed an issue where picking up networked item wasn't loading assets ClientEntityFactory#createItem now calls Item#load() Cursor will run Item#checkLoaded on cursor item and attempt setting cursor when loaded --- core/src/com/riiablo/Cursor.java | 4 ++++ core/src/com/riiablo/engine/client/ClientEntityFactory.java | 1 + 2 files changed, 5 insertions(+) diff --git a/core/src/com/riiablo/Cursor.java b/core/src/com/riiablo/Cursor.java index 62256835..a57f3124 100644 --- a/core/src/com/riiablo/Cursor.java +++ b/core/src/com/riiablo/Cursor.java @@ -54,6 +54,7 @@ public class Cursor implements ItemData.LocationListener { } public void setCursor(DC dc, Index colormap, int id) { + Gdx.app.log(TAG, "setCursor " + dc); if (cursor == null) { Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888); cursor = Gdx.graphics.newCursor(pixmap, 0, 0); @@ -94,6 +95,9 @@ public class Cursor implements ItemData.LocationListener { } public void act(float delta) { + if (dc == null && item != null && item.checkLoaded()) { + setCursor(item.invFile, item.invColormap, item.invColorIndex); + } } public void render(PaletteIndexedBatch batch) { diff --git a/core/src/com/riiablo/engine/client/ClientEntityFactory.java b/core/src/com/riiablo/engine/client/ClientEntityFactory.java index e6c6e111..d5500050 100644 --- a/core/src/com/riiablo/engine/client/ClientEntityFactory.java +++ b/core/src/com/riiablo/engine/client/ClientEntityFactory.java @@ -193,6 +193,7 @@ public class ClientEntityFactory extends ServerEntityFactory { * animations finish -- is this expected? or some issue with offsets? It's happening with * runes -- but keys are placed correctly and other items I've tried look fine. */ + itemWrapper.item.load(); return id; }