Merge remote-tracking branch 'origin/main' into 1.18.2
# Conflicts: # gradle.properties
This commit is contained in:
commit
69a4583d57
7 changed files with 67 additions and 29 deletions
|
@ -55,10 +55,6 @@ public class PostInitAPI {
|
||||||
* @param isClient {@code boolean}, {@code true} for client, {@code false} for server.
|
* @param isClient {@code boolean}, {@code true} for client, {@code false} for server.
|
||||||
*/
|
*/
|
||||||
public static void postInit(boolean isClient) {
|
public static void postInit(boolean isClient) {
|
||||||
if (postInitFunctions == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
postInitFunctions.forEach(function -> function.accept(isClient));
|
|
||||||
Registry.BLOCK.forEach(block -> {
|
Registry.BLOCK.forEach(block -> {
|
||||||
processBlockCommon(block);
|
processBlockCommon(block);
|
||||||
if (isClient) {
|
if (isClient) {
|
||||||
|
@ -66,11 +62,15 @@ public class PostInitAPI {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Registry.ITEM.forEach(item -> {
|
Registry.ITEM.forEach(item -> {
|
||||||
processItemCommon(item);
|
processItemCommon(item);
|
||||||
});
|
});
|
||||||
postInitFunctions = null;
|
|
||||||
|
if (postInitFunctions != null) {
|
||||||
|
postInitFunctions.forEach(function -> function.accept(isClient));
|
||||||
|
postInitFunctions = null;
|
||||||
|
}
|
||||||
|
|
||||||
blockTags = null;
|
blockTags = null;
|
||||||
itemTags = null;
|
itemTags = null;
|
||||||
BiomeAPI.loadFabricAPIBiomes();
|
BiomeAPI.loadFabricAPIBiomes();
|
||||||
|
|
|
@ -430,19 +430,28 @@ public class BiomeAPI {
|
||||||
public static void loadFabricAPIBiomes() {
|
public static void loadFabricAPIBiomes() {
|
||||||
FabricBiomesData.NETHER_BIOMES.forEach((key) -> {
|
FabricBiomesData.NETHER_BIOMES.forEach((key) -> {
|
||||||
if (!hasBiome(key.location())) {
|
if (!hasBiome(key.location())) {
|
||||||
registerNetherBiome(BuiltinRegistries.BIOME.get(key));
|
Optional<Holder<Biome>> optional = BuiltinRegistries.BIOME.getHolder(key);
|
||||||
|
if (optional.isPresent()) {
|
||||||
|
registerNetherBiome(optional.get().value());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FabricBiomesData.END_LAND_BIOMES.forEach((key, weight) -> {
|
FabricBiomesData.END_LAND_BIOMES.forEach((key, weight) -> {
|
||||||
if (!hasBiome(key.location())) {
|
if (!hasBiome(key.location())) {
|
||||||
registerEndLandBiome(BuiltinRegistries.BIOME.getHolder(key).orElseThrow(), weight);
|
Optional<Holder<Biome>> optional = BuiltinRegistries.BIOME.getHolder(key);
|
||||||
|
if (optional.isPresent()) {
|
||||||
|
registerEndLandBiome(optional.get(), weight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> {
|
FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> {
|
||||||
if (!hasBiome(key.location())) {
|
if (!hasBiome(key.location())) {
|
||||||
registerEndVoidBiome(BuiltinRegistries.BIOME.getOrCreateHolder(key), weight);
|
Optional<Holder<Biome>> optional = BuiltinRegistries.BIOME.getHolder(key);
|
||||||
|
if (optional.isPresent()) {
|
||||||
|
registerEndVoidBiome(optional.get(), weight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
6
src/main/java/ru/bclib/interfaces/FrozableRegistry.java
Normal file
6
src/main/java/ru/bclib/interfaces/FrozableRegistry.java
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package ru.bclib.interfaces;
|
||||||
|
|
||||||
|
public interface FrozableRegistry {
|
||||||
|
void setFrozeState(boolean frozen);
|
||||||
|
boolean getFrozeState();
|
||||||
|
}
|
22
src/main/java/ru/bclib/mixin/common/MappedRegistryMixin.java
Normal file
22
src/main/java/ru/bclib/mixin/common/MappedRegistryMixin.java
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package ru.bclib.mixin.common;
|
||||||
|
|
||||||
|
import net.minecraft.core.MappedRegistry;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import ru.bclib.interfaces.FrozableRegistry;
|
||||||
|
|
||||||
|
@Mixin(MappedRegistry.class)
|
||||||
|
public class MappedRegistryMixin<T> implements FrozableRegistry {
|
||||||
|
@Shadow
|
||||||
|
private boolean frozen;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFrozeState(boolean frozen) {
|
||||||
|
this.frozen = frozen;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFrozeState() {
|
||||||
|
return this.frozen;
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,7 +33,7 @@ public class BCLRecipeManager {
|
||||||
list.sort((v1, v2) -> {
|
list.sort((v1, v2) -> {
|
||||||
boolean b1 = v1.getId().getNamespace().equals(MINECRAFT);
|
boolean b1 = v1.getId().getNamespace().equals(MINECRAFT);
|
||||||
boolean b2 = v2.getId().getNamespace().equals(MINECRAFT);
|
boolean b2 = v2.getId().getNamespace().equals(MINECRAFT);
|
||||||
return b1 ^ b2 ? (b1 ? 1 : -1) : 0;
|
return b1 ^ b2 ? (b1 ? 1 : -1) : v1.getId().compareTo(v2.getId());
|
||||||
});
|
});
|
||||||
return ImmutableList.copyOf(list);
|
return ImmutableList.copyOf(list);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,23 @@ import net.minecraft.world.level.biome.Biome;
|
||||||
import ru.bclib.config.Configs;
|
import ru.bclib.config.Configs;
|
||||||
|
|
||||||
public class BCLBiomeSettings {
|
public class BCLBiomeSettings {
|
||||||
public static Builder createBCL(){
|
float terrainHeight;
|
||||||
|
float fogDensity;
|
||||||
|
float genChance;
|
||||||
|
int edgeSize;
|
||||||
|
boolean vertical;
|
||||||
|
BCLBiome edge;
|
||||||
|
|
||||||
|
protected BCLBiomeSettings() {
|
||||||
|
this.terrainHeight = 0.1F;
|
||||||
|
this.fogDensity = 1.0F;
|
||||||
|
this.genChance = 1.0F;
|
||||||
|
this.edgeSize = 0;
|
||||||
|
this.vertical = false;
|
||||||
|
this.edge = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder createBCL() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +29,10 @@ public class BCLBiomeSettings {
|
||||||
super(new BCLBiomeSettings());
|
super(new BCLBiomeSettings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class CommonBuilder<T extends BCLBiomeSettings, R extends CommonBuilder>{
|
public static class CommonBuilder<T extends BCLBiomeSettings, R extends CommonBuilder>{
|
||||||
private final T storage;
|
private final T storage;
|
||||||
CommonBuilder(T storage){
|
CommonBuilder(T storage) {
|
||||||
this.storage = storage;
|
this.storage = storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,23 +109,6 @@ public class BCLBiomeSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BCLBiomeSettings(){
|
|
||||||
this.terrainHeight = 0.1F;
|
|
||||||
this.fogDensity = 1.0F;
|
|
||||||
this.genChance = 1.0F;
|
|
||||||
this.edgeSize = 0;
|
|
||||||
this.vertical = false;
|
|
||||||
this.edge = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
float terrainHeight;
|
|
||||||
float fogDensity;
|
|
||||||
float genChance;
|
|
||||||
int edgeSize;
|
|
||||||
boolean vertical;
|
|
||||||
BCLBiome edge;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Getter for biome generation chance, used in {@link ru.bclib.world.generator.BiomePicker} and in custom generators.
|
* Getter for biome generation chance, used in {@link ru.bclib.world.generator.BiomePicker} and in custom generators.
|
||||||
* @return biome generation chance as float.
|
* @return biome generation chance as float.
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
"BlockBehaviourMixin",
|
"BlockBehaviourMixin",
|
||||||
"BlockStateBaseMixin",
|
"BlockStateBaseMixin",
|
||||||
"ChunkGeneratorMixin",
|
"ChunkGeneratorMixin",
|
||||||
|
"MappedRegistryMixin",
|
||||||
"WorldGenRegionMixin",
|
"WorldGenRegionMixin",
|
||||||
"DiggerItemAccessor",
|
"DiggerItemAccessor",
|
||||||
"DimensionTypeMixin",
|
"DimensionTypeMixin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue