Continue fabric 1.21.5 WIP

This commit is contained in:
Zoë Gidiere 2025-06-03 13:59:11 -06:00
parent 016961c19c
commit f14d22b264
5 changed files with 14 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package com.dfsek.terra.mod.config;
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.BiomeAdditionsSound;
import net.minecraft.sound.BiomeMoodSound;
import net.minecraft.sound.MusicSound;
@ -87,7 +88,8 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("villager-type")
@Default
private VillagerType villagerType = null;
private
RegistryKey<VillagerType> villagerType = null;
public Integer getGrassColor() {
return grassColor;
@ -157,7 +159,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return spawnSettings;
}
public VillagerType getVillagerType() {
public RegistryKey<VillagerType> getVillagerType() {
return villagerType;
}
}

View File

@ -4,17 +4,19 @@ 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 net.minecraft.registry.Registries;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.village.VillagerType;
public class VillagerTypeTemplate implements ObjectTemplate<VillagerType> {
public class VillagerTypeTemplate implements ObjectTemplate<RegistryKey<VillagerType>> {
@Value("id")
@Default
private Identifier id = null;
private String id = null;
@Override
public VillagerType get() {
return Registries.VILLAGER_TYPE.getEntry(id).orElseThrow().value();
public RegistryKey<VillagerType> get() {
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, Identifier.ofVanilla(id));
}
}

View File

@ -12,7 +12,7 @@ import java.util.Map;
@Mixin(VillagerType.class)
public interface VillagerTypeAccessor {
@Accessor("BIOME_TO_TYPE")
static Map<RegistryKey<Biome>, VillagerType> getBiomeTypeToIdMap() {
static Map<RegistryKey<Biome>, RegistryKey<VillagerType>> getBiomeTypeToIdMap() {
throw new AssertionError("Untransformed Accessor!");
}
}

View File

@ -47,11 +47,11 @@ public abstract class WorldChunkMixin {
@Shadow
@Nullable
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, boolean moved);
public abstract net.minecraft.block.BlockState setBlockState(BlockPos pos, net.minecraft.block.BlockState state, int flags);
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
BlockPos blockPos = new BlockPos(x, y, z);
setBlockState(blockPos, (net.minecraft.block.BlockState) data, false);
setBlockState(blockPos, (net.minecraft.block.BlockState) data, 0);
if(physics) {
net.minecraft.block.BlockState state = ((net.minecraft.block.BlockState) data);
if(state.isLiquid()) {

View File

@ -72,7 +72,7 @@ public final class LifecycleBiomeUtil {
minecraftBiome));
}
Map<RegistryKey<net.minecraft.world.biome.Biome>, VillagerType> villagerMap = VillagerTypeAccessor.getBiomeTypeToIdMap();
Map<RegistryKey<net.minecraft.world.biome.Biome>, RegistryKey<VillagerType>> villagerMap = VillagerTypeAccessor.getBiomeTypeToIdMap();
villagerMap.put(RegistryKey.of(RegistryKeys.BIOME, identifier),
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),