Skip to content

Commit

Permalink
chore: move get CharacterComponent into binding
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrueckert committed Aug 6, 2021
1 parent 990824b commit 1d9b057
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,16 @@ public EntityRef get() {
containerInventory = find("container", InventoryGrid.class);

EntityRef characterEntity = localPlayer.getCharacterEntity();
CharacterComponent characterComponent = characterEntity.getComponent(CharacterComponent.class);
containerInventory.bindTargetEntity(new ReadOnlyBinding<EntityRef>() {
@Override
public EntityRef get() {
return characterComponent.predictedInteractionTarget;
return characterEntity.getComponent(CharacterComponent.class).predictedInteractionTarget;
}
});
containerTitle.bindText(new ReadOnlyBinding<String>() {
@Override
public String get() {
Prefab parentPrefab = characterComponent.predictedInteractionTarget.getParentPrefab();
Prefab parentPrefab = characterEntity.getComponent(CharacterComponent.class).predictedInteractionTarget.getParentPrefab();
DisplayNameComponent displayName = parentPrefab.getComponent(DisplayNameComponent.class);
if (displayName != null) {
return displayName.name;
Expand Down

0 comments on commit 1d9b057

Please sign in to comment.