mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
Continue fabric 1.21.5 WIP
This commit is contained in:
parent
016961c19c
commit
f14d22b264
@ -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.ConfigTemplate;
|
||||||
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 net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.sound.BiomeAdditionsSound;
|
import net.minecraft.sound.BiomeAdditionsSound;
|
||||||
import net.minecraft.sound.BiomeMoodSound;
|
import net.minecraft.sound.BiomeMoodSound;
|
||||||
import net.minecraft.sound.MusicSound;
|
import net.minecraft.sound.MusicSound;
|
||||||
@ -87,7 +88,8 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
|||||||
|
|
||||||
@Value("villager-type")
|
@Value("villager-type")
|
||||||
@Default
|
@Default
|
||||||
private VillagerType villagerType = null;
|
private
|
||||||
|
RegistryKey<VillagerType> villagerType = null;
|
||||||
|
|
||||||
public Integer getGrassColor() {
|
public Integer getGrassColor() {
|
||||||
return grassColor;
|
return grassColor;
|
||||||
@ -157,7 +159,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
|||||||
return spawnSettings;
|
return spawnSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VillagerType getVillagerType() {
|
public RegistryKey<VillagerType> getVillagerType() {
|
||||||
return villagerType;
|
return villagerType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.annotations.Value;
|
||||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
|
import net.minecraft.registry.RegistryKey;
|
||||||
|
import net.minecraft.registry.RegistryKeys;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.village.VillagerType;
|
import net.minecraft.village.VillagerType;
|
||||||
|
|
||||||
|
|
||||||
public class VillagerTypeTemplate implements ObjectTemplate<VillagerType> {
|
public class VillagerTypeTemplate implements ObjectTemplate<RegistryKey<VillagerType>> {
|
||||||
@Value("id")
|
@Value("id")
|
||||||
@Default
|
@Default
|
||||||
private Identifier id = null;
|
private String id = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VillagerType get() {
|
public RegistryKey<VillagerType> get() {
|
||||||
return Registries.VILLAGER_TYPE.getEntry(id).orElseThrow().value();
|
return RegistryKey.of(RegistryKeys.VILLAGER_TYPE, Identifier.ofVanilla(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import java.util.Map;
|
|||||||
@Mixin(VillagerType.class)
|
@Mixin(VillagerType.class)
|
||||||
public interface VillagerTypeAccessor {
|
public interface VillagerTypeAccessor {
|
||||||
@Accessor("BIOME_TO_TYPE")
|
@Accessor("BIOME_TO_TYPE")
|
||||||
static Map<RegistryKey<Biome>, VillagerType> getBiomeTypeToIdMap() {
|
static Map<RegistryKey<Biome>, RegistryKey<VillagerType>> getBiomeTypeToIdMap() {
|
||||||
throw new AssertionError("Untransformed Accessor!");
|
throw new AssertionError("Untransformed Accessor!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,11 +47,11 @@ public abstract class WorldChunkMixin {
|
|||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
@Nullable
|
@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) {
|
public void terra$setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
||||||
BlockPos blockPos = new BlockPos(x, y, z);
|
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) {
|
if(physics) {
|
||||||
net.minecraft.block.BlockState state = ((net.minecraft.block.BlockState) data);
|
net.minecraft.block.BlockState state = ((net.minecraft.block.BlockState) data);
|
||||||
if(state.isLiquid()) {
|
if(state.isLiquid()) {
|
||||||
|
@ -72,7 +72,7 @@ public final class LifecycleBiomeUtil {
|
|||||||
minecraftBiome));
|
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),
|
villagerMap.put(RegistryKey.of(RegistryKeys.BIOME, identifier),
|
||||||
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),
|
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user