mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-09 09:16:34 +00:00
Fixes
This commit is contained in:
@@ -3,6 +3,9 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -14,7 +17,7 @@ import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||
public class FertilizableConfig implements ObjectTemplate<FertilizableConfig> {
|
||||
@Value("strucutres")
|
||||
@Default
|
||||
private ProbabilityCollection<ConfiguredStructure> structures = null;
|
||||
private ProbabilityCollection<Structure> structures = null;
|
||||
|
||||
@Value("cooldowns")
|
||||
@Default
|
||||
@@ -28,7 +31,7 @@ public class FertilizableConfig implements ObjectTemplate<FertilizableConfig> {
|
||||
@Default
|
||||
private Boolean villagerFertilizable = null;
|
||||
|
||||
public ProbabilityCollection<ConfiguredStructure> getStructures() {
|
||||
public ProbabilityCollection<Structure> getStructures() {
|
||||
return structures;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.dfsek.terra.mod.config;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -14,7 +17,7 @@ import com.dfsek.terra.api.util.collection.ProbabilityCollection;
|
||||
public class FertilizableConfig implements ObjectTemplate<FertilizableConfig> {
|
||||
@Value("strucutres")
|
||||
@Default
|
||||
private ProbabilityCollection<ConfiguredStructure> structures = null;
|
||||
private ProbabilityCollection<Structure> structures = null;
|
||||
|
||||
@Value("cooldowns")
|
||||
@Default
|
||||
@@ -22,13 +25,13 @@ public class FertilizableConfig implements ObjectTemplate<FertilizableConfig> {
|
||||
|
||||
@Value("can-grow")
|
||||
@Default
|
||||
private ConfiguredStructure canGrow = null;
|
||||
private Structure canGrow = null;
|
||||
|
||||
@Value("villager-fertilizable")
|
||||
@Default
|
||||
private Boolean villagerFertilizable = null;
|
||||
|
||||
public ProbabilityCollection<ConfiguredStructure> getStructures() {
|
||||
public ProbabilityCollection<Structure> getStructures() {
|
||||
return structures;
|
||||
}
|
||||
|
||||
@@ -36,7 +39,7 @@ public class FertilizableConfig implements ObjectTemplate<FertilizableConfig> {
|
||||
return cooldowns;
|
||||
}
|
||||
|
||||
public ConfiguredStructure getCanGrow() {
|
||||
public Structure getCanGrow() {
|
||||
return canGrow;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.dfsek.terra.mod.mixin.gameplay;
|
||||
|
||||
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.ai.brain.task.BoneMealTask;
|
||||
@@ -38,10 +40,10 @@ public class BoneMealTaskMixin {
|
||||
Boolean villagerFertilizable = config.isVillagerFertilizable();
|
||||
if(villagerFertilizable != null) {
|
||||
if(villagerFertilizable) {
|
||||
ConfiguredStructure canGrow = config.getCanGrow();
|
||||
Structure canGrow = config.getCanGrow();
|
||||
if(canGrow != null) {
|
||||
Random random = (Random) world.getRandom();
|
||||
cir.setReturnValue(canGrow.getStructure().get(random).generate(
|
||||
cir.setReturnValue(canGrow.generate(
|
||||
Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,13 @@ public class BiomeUtil {
|
||||
*/
|
||||
protected static void registerBiome(Biome biome, ConfigPack pack,
|
||||
com.dfsek.terra.api.registry.key.RegistryKey id) {
|
||||
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
|
||||
VanillaBiomeProperties vanillaBiomeProperties;
|
||||
if (biome.getContext().has(VanillaBiomeProperties.class)) {
|
||||
vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
|
||||
} else {
|
||||
vanillaBiomeProperties = new VanillaBiomeProperties();
|
||||
}
|
||||
|
||||
|
||||
net.minecraft.world.biome.Biome minecraftBiome = MinecraftUtil.createBiome(vanillaBiomeProperties);
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.dfsek.terra.mod.util;
|
||||
|
||||
import com.dfsek.terra.api.structure.Structure;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
@@ -31,9 +33,9 @@ public class FertilizableUtil {
|
||||
Block block = state.getBlock();
|
||||
FertilizableConfig config = map.get(Registry.BLOCK.getId(block));
|
||||
if(config != null) {
|
||||
ConfiguredStructure canGrow = config.getCanGrow();
|
||||
Structure canGrow = config.getCanGrow();
|
||||
if(canGrow != null) {
|
||||
if(!canGrow.getStructure().get(random).generate(
|
||||
if(!canGrow.generate(
|
||||
Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE)) {
|
||||
return false;
|
||||
}
|
||||
@@ -44,7 +46,7 @@ public class FertilizableUtil {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
config.getStructures().get(random).getStructure().get(random).generate(
|
||||
config.getStructures().get(random).generate(
|
||||
Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user