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