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

chore: adjust for Terasology/GrowingFlora#38 #22

Merged
merged 1 commit into from
Aug 19, 2021
Merged
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 @@ -2,10 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package org.terasology.herbalism.generator;

import com.google.common.base.Function;
import com.google.common.base.Predicate;
import org.joml.Vector3i;
import org.terasology.anotherWorld.LocalParameters;
import org.joml.Vector3ic;
import org.terasology.engine.entitySystem.entity.EntityRef;
import org.terasology.engine.registry.CoreRegistry;
import org.terasology.engine.world.BlockEntityRegistry;
Expand All @@ -32,18 +29,8 @@ public HerbAGrowthDefinition() {
super(ID, Arrays.asList(
new BlockUri("Alchemy:HerbGrowA"), new BlockUri("Alchemy:HerbGrownA"), new BlockUri("CoreAssets:DeadBush")),
50 * 1000, 200 * 1000,
new Predicate<LocalParameters>() {
@Override
public boolean apply(LocalParameters input) {
return input.getHumidity() > 0.2f && input.getTemperature() > 15f;
}
},
new Function<LocalParameters, Float>() {
@Override
public Float apply(LocalParameters input) {
return 0.2f * input.getHumidity();
}
}
input -> input.getHumidity() > 0.2f && input.getTemperature() > 15f,
input -> 0.2f * input.getHumidity()
);
}

Expand All @@ -58,7 +45,7 @@ public Float apply(LocalParameters input) {
* @param isLast Whether this is the last stage of herb plant growth.
*/
@Override
protected void replaceBlock(WorldProvider worldProvider, BlockManager blockManager, EntityRef plant, Vector3i position, BlockUri nextStage, boolean isLast) {
protected void replaceBlock(WorldProvider worldProvider, BlockManager blockManager, EntityRef plant, Vector3ic position, BlockUri nextStage, boolean isLast) {
// If this is not the last stage of herb plant growth, continue as normal. Otherwise, just call the parent method.
if (!isLast) {
// We need to copy the genome between growth stages. Otherwise it will be lost upon replacing this block.
Expand Down