Initial attempt at updating mixin-commons

This commit is contained in:
OakLoaf
2025-04-17 17:41:45 +01:00
parent 9f3e225b62
commit 016961c19c
8 changed files with 17 additions and 15 deletions

View File

@@ -44,7 +44,7 @@ import com.dfsek.terra.mod.config.MusicSoundTemplate;
import com.dfsek.terra.mod.config.ProtoPlatformBiome;
import com.dfsek.terra.mod.config.SoundEventTemplate;
import com.dfsek.terra.mod.config.SpawnCostConfig;
import com.dfsek.terra.mod.config.SpawnEntryTemplate;
import com.dfsek.terra.mod.config.SpawnEntryConfig;
import com.dfsek.terra.mod.config.SpawnSettingsTemplate;
import com.dfsek.terra.mod.config.SpawnTypeConfig;
import com.dfsek.terra.mod.config.VillagerTypeTemplate;
@@ -90,7 +90,7 @@ public abstract class ModPlatform extends AbstractPlatform {
.registerLoader(MusicSound.class, MusicSoundTemplate::new)
.registerLoader(EntityType.class, EntityTypeTemplate::new)
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
.registerLoader(SpawnEntry.class, SpawnEntryTemplate::new)
.registerLoader(SpawnEntry.class, SpawnEntryConfig::new)
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
.registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new)
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);

View File

@@ -7,7 +7,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntry> {
@Value("type")
@Default
private EntityType<?> type = null;
@@ -24,8 +24,12 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
@Default
private Integer maxGroupSize = null;
public Integer getWeight() {
return weight;
}
@Override
public SpawnEntry get() {
return new SpawnEntry(type, weight, minGroupSize, maxGroupSize);
return new SpawnEntry(type, minGroupSize, maxGroupSize);
}
}

View File

@@ -5,7 +5,6 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.world.biome.SpawnSettings;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import java.util.List;
@@ -28,8 +27,8 @@ public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
SpawnSettings.Builder builder = new SpawnSettings.Builder();
for(SpawnTypeConfig spawn : spawns) {
SpawnGroup group = spawn.getGroup();
for(SpawnEntry entry : spawn.getEntry()) {
builder.spawn(group, entry);
for(SpawnEntryConfig entry : spawn.getEntry()) {
builder.spawn(group, entry.getWeight(), entry.get());
}
}
for(SpawnCostConfig cost : costs) {

View File

@@ -4,7 +4,6 @@ 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.entity.SpawnGroup;
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
import java.util.List;
@@ -16,13 +15,13 @@ public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
@Value("entries")
@Default
private List<SpawnEntry> entry = null;
private List<SpawnEntryConfig> entry = null;
public SpawnGroup getGroup() {
return group;
}
public List<SpawnEntry> getEntry() {
public List<SpawnEntryConfig> getEntry() {
return entry;
}

View File

@@ -140,10 +140,10 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
if(noise > threshold) {
chunk.setBlockState(new BlockPos(x, y, z), (BlockState) delegate
.getPalette(x + xi, y, z + zi, world, biomeProvider)
.get(depth, x + xi, y, z + zi, world.getSeed()), false);
.get(depth, x + xi, y, z + zi, world.getSeed()), 0);
depth++;
} else if(noise < airThreshold) {
chunk.setBlockState(new BlockPos(x, y, z), Blocks.AIR.getDefaultState(), false);
chunk.setBlockState(new BlockPos(x, y, z), Blocks.AIR.getDefaultState(), 0);
} else {
depth = 0;
}

View File

@@ -55,7 +55,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
public EntityType terra$getSpawnedType() {
return (EntityType) Registries.ENTITY_TYPE.getEntry(
Identifier.tryParse(((MobSpawnerLogicAccessor) getLogic()).getSpawnEntry().getNbt().getString("id"))).orElseThrow();
Identifier.tryParse(((MobSpawnerLogicAccessor) getLogic()).getSpawnEntry().getNbt().getString("id").orElseThrow())).orElseThrow();
}
public void terra$setSpawnedType(@NotNull EntityType creatureType) {

View File

@@ -65,7 +65,7 @@ public abstract class WorldChunkMixin {
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
((net.minecraft.world.chunk.Chunk) (Object) this).setBlockState(new BlockPos(x, y, z), (net.minecraft.block.BlockState) blockState,
false);
0);
}
@Intrinsic

View File

@@ -40,7 +40,7 @@ public abstract class ProtoChunkMixin {
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
((net.minecraft.world.chunk.Chunk) (Object) this).setBlockState(new BlockPos(x, y, z), (net.minecraft.block.BlockState) blockState,
false);
0);
}
public @NotNull BlockState terra$getBlock(int x, int y, int z) {