Skip to content

Commit

Permalink
chore: adjust for Terasology/GrowingFlora#38 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
skaldarnar committed Aug 19, 2021
1 parent e7f63cc commit 692b8c6
Showing 1 changed file with 4 additions and 17 deletions.
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

0 comments on commit 692b8c6

Please sign in to comment.