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
This commit is contained in:
Collin Smith 2020-06-03 17:35:59 -07:00
parent 907688a1d2
commit faf8743a75
2 changed files with 5 additions and 0 deletions

View File

@ -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) {

View File

@ -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;
}