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

View File

@@ -44,7 +44,7 @@ public class TerraBiomeSource extends BiomeSource {
.stream(pack.getBiomeProvider()
.getBiomes()
.spliterator(), false)
.map(b -> ((ProtoPlatformBiome) b.getPlatformBiome()).get(biomes)));
.map(b -> ((ProtoPlatformBiome) b.getPlatformBiome()).getDelegate()));
this.biomeRegistry = biomes;
this.seed = seed;
this.pack = pack;

View File

@@ -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);
}
}

View File

@@ -46,7 +46,7 @@ public class ProtoPlatformBiome implements PlatformBiome {
}
public RegistryEntry<Biome> getDelegate() {
return Objects.requireNonNull(delegate);
return delegate;
}
public void setDelegate(RegistryEntry<Biome> delegate) {

View File

@@ -4,6 +4,7 @@
"package": "com.dfsek.terra.fabric.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [
"Test",
"access.BiomeEffectsAccessor",
"access.MobSpawnerLogicAccessor",
"access.StateAccessor",
@@ -32,9 +33,9 @@
"implementations.inventory.meta.ItemStackMetaMixin",
"implementations.world.ChunkRegionMixin",
"implementations.world.ServerWorldMixin",
"lifecycle.RegistryMixin",
"lifecycle.DataPackContentsMixin",
"lifecycle.MinecraftServerMixin"
"lifecycle.MinecraftServerMixin",
"lifecycle.RegistryMixin"
],
"client": [
"access.GeneratorTypeAccessor",