Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: delete constant #101

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.terasology.engine.logic.characters.CharacterHeldItemComponent;
import org.terasology.engine.world.block.BlockUri;
import org.terasology.engine.world.block.items.BlockItemComponent;
import org.terasology.module.behaviors.components.LuringComponent;

Check warning on line 16 in src/main/java/org/terasology/wildAnimals/actions/CheckLuringItemInUseAction.java

View check run for this annotation

Terasology Jenkins.io / Java Compiler

ERROR: cannot find symbol

/**
* Behavior node that checks if the current held item can be used to lure
Expand All @@ -21,22 +22,17 @@
@BehaviorAction(name = "check_luring_item_in_use")
public class CheckLuringItemInUseAction extends BaseAction {

static final String[] LURING_ITEMS = {
"CoreAssets:TallGrass1",
"CoreAssets:TallGrass2",
"CoreAssets:TallGrass3",
"CoreAssets:Lavender",
"CoreAssets:Dandelion"
};

@Override
public BehaviorState modify(Actor actor, BehaviorState behaviorState) {
FindNearbyPlayersComponent component = actor.getComponent(FindNearbyPlayersComponent.class);
LuringComponent lure = actor.getComponent(LuringComponent.class);

Check warning on line 28 in src/main/java/org/terasology/wildAnimals/actions/CheckLuringItemInUseAction.java

View check run for this annotation

Terasology Jenkins.io / Java Compiler

ERROR: cannot find symbol

EntityRef player = component.closestCharacter;

CharacterHeldItemComponent characterHeldItemComponent = player.getComponent(CharacterHeldItemComponent.class);
EntityRef heldItem = characterHeldItemComponent.selectedItem;
BlockItemComponent blockItemComponent = heldItem.getComponent(BlockItemComponent.class);
for (String item : LURING_ITEMS) {
for (String item : lure.luringItems) {
if (blockItemComponent != null && blockItemComponent.blockFamily.getURI().equals(new BlockUri(item))) {
return BehaviorState.SUCCESS;
}
Expand Down