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

Change fuel to accept any "torch" #32

Merged
merged 2 commits into from
Oct 18, 2019
Merged

Conversation

Qwertygiy
Copy link
Contributor

In addition to accepting other modules' torches, this allows compatibility with CoreBlocks for MovingBlocks/Terasology#3737

@@ -55,7 +55,7 @@ public void update(float delta) {
ItemComponent itemComponent = fuelSlot.getComponent(ItemComponent.class);
BlockItemComponent biComponent = fuelSlot.getComponent(BlockItemComponent.class);
//add 5 energy units for 1 torch
if (biComponent.blockFamily.getURI().toString().equalsIgnoreCase("core:torch")) {
if (biComponent.blockFamily.getURI().toString().toLowerCase().endsWith("torch")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a helper method isTorch(BlockItemComponent blockItem) containing this check. I hope that will make it easier to find the check later on in case we find a better way to check for torches...

Suggested change
if (biComponent.blockFamily.getURI().toString().toLowerCase().endsWith("torch")) {
if (isTorch(biComponent)) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private boolean isTorch(BlockItemComponent blockItem) {
    return blockItem.blockFamily.getURI().toString().toLowerCase().endsWith("torch");
}

@skaldarnar skaldarnar merged commit 36e8134 into Terasology:master Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants