fix structure location

This commit is contained in:
dfsek
2022-04-17 20:41:55 -07:00
parent b93a6703cb
commit e2350650d0
4 changed files with 41 additions and 4 deletions
@@ -44,7 +44,7 @@ public class TerraBiomeSource extends BiomeSource {
.stream(pack.getBiomeProvider() .stream(pack.getBiomeProvider()
.getBiomes() .getBiomes()
.spliterator(), false) .spliterator(), false)
.map(b -> ((ProtoPlatformBiome) b.getPlatformBiome()).get(biomes))); .map(b -> ((ProtoPlatformBiome) b.getPlatformBiome()).getDelegate()));
this.biomeRegistry = biomes; this.biomeRegistry = biomes;
this.seed = seed; this.seed = seed;
this.pack = pack; this.pack = pack;
@@ -0,0 +1,36 @@
package com.dfsek.terra.fabric.mixin;
import com.dfsek.terra.api.world.biome.Biome;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.registry.RegistryEntryList;
import net.minecraft.world.StructureSpawns;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
@Mixin(ChunkGenerator.class)
public class Test<FC extends FeatureConfig, F extends StructureFeature<FC>> {
@Redirect(method = "Lnet/minecraft/world/gen/chunk/ChunkGenerator;locateStructure(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/registry/RegistryEntryList;Lnet/minecraft/util/math/BlockPos;IZ)Lcom/mojang/datafixers/util/Pair;", at = @At(value = "INVOKE", target = "Ljava/util/Set;isEmpty()Z"))
private boolean inject(Set<?> instance) {
System.out.println("Biome Set: " + instance);
return instance.isEmpty();
}
@Redirect(method = "Lnet/minecraft/world/gen/chunk/ChunkGenerator;locateStructure(Lnet/minecraft/server/world/ServerWorld;Lnet/minecraft/util/registry/RegistryEntryList;Lnet/minecraft/util/math/BlockPos;IZ)Lcom/mojang/datafixers/util/Pair;", at = @At(value = "INVOKE", target = "Ljava/util/Collections;disjoint(Ljava/util/Collection;Ljava/util/Collection;)Z"))
private boolean inject2(Collection<?> c, Collection<?> c2) {
System.out.println("Biome Source Set: " + c);
return Collections.disjoint(c, c2);
}
}
@@ -46,7 +46,7 @@ public class ProtoPlatformBiome implements PlatformBiome {
} }
public RegistryEntry<Biome> getDelegate() { public RegistryEntry<Biome> getDelegate() {
return Objects.requireNonNull(delegate); return delegate;
} }
public void setDelegate(RegistryEntry<Biome> delegate) { public void setDelegate(RegistryEntry<Biome> delegate) {
@@ -4,6 +4,7 @@
"package": "com.dfsek.terra.fabric.mixin", "package": "com.dfsek.terra.fabric.mixin",
"compatibilityLevel": "JAVA_16", "compatibilityLevel": "JAVA_16",
"mixins": [ "mixins": [
"Test",
"access.BiomeEffectsAccessor", "access.BiomeEffectsAccessor",
"access.MobSpawnerLogicAccessor", "access.MobSpawnerLogicAccessor",
"access.StateAccessor", "access.StateAccessor",
@@ -32,9 +33,9 @@
"implementations.inventory.meta.ItemStackMetaMixin", "implementations.inventory.meta.ItemStackMetaMixin",
"implementations.world.ChunkRegionMixin", "implementations.world.ChunkRegionMixin",
"implementations.world.ServerWorldMixin", "implementations.world.ServerWorldMixin",
"lifecycle.RegistryMixin",
"lifecycle.DataPackContentsMixin", "lifecycle.DataPackContentsMixin",
"lifecycle.MinecraftServerMixin" "lifecycle.MinecraftServerMixin",
"lifecycle.RegistryMixin"
], ],
"client": [ "client": [
"access.GeneratorTypeAccessor", "access.GeneratorTypeAccessor",