mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-27 12:31:29 +00:00
Initial attempt at updating mixin-commons
This commit is contained in:
@@ -44,7 +44,7 @@ import com.dfsek.terra.mod.config.MusicSoundTemplate;
|
|||||||
import com.dfsek.terra.mod.config.ProtoPlatformBiome;
|
import com.dfsek.terra.mod.config.ProtoPlatformBiome;
|
||||||
import com.dfsek.terra.mod.config.SoundEventTemplate;
|
import com.dfsek.terra.mod.config.SoundEventTemplate;
|
||||||
import com.dfsek.terra.mod.config.SpawnCostConfig;
|
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.SpawnSettingsTemplate;
|
||||||
import com.dfsek.terra.mod.config.SpawnTypeConfig;
|
import com.dfsek.terra.mod.config.SpawnTypeConfig;
|
||||||
import com.dfsek.terra.mod.config.VillagerTypeTemplate;
|
import com.dfsek.terra.mod.config.VillagerTypeTemplate;
|
||||||
@@ -90,7 +90,7 @@ public abstract class ModPlatform extends AbstractPlatform {
|
|||||||
.registerLoader(MusicSound.class, MusicSoundTemplate::new)
|
.registerLoader(MusicSound.class, MusicSoundTemplate::new)
|
||||||
.registerLoader(EntityType.class, EntityTypeTemplate::new)
|
.registerLoader(EntityType.class, EntityTypeTemplate::new)
|
||||||
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
|
.registerLoader(SpawnCostConfig.class, SpawnCostConfig::new)
|
||||||
.registerLoader(SpawnEntry.class, SpawnEntryTemplate::new)
|
.registerLoader(SpawnEntry.class, SpawnEntryConfig::new)
|
||||||
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
|
.registerLoader(SpawnTypeConfig.class, SpawnTypeConfig::new)
|
||||||
.registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new)
|
.registerLoader(SpawnSettings.class, SpawnSettingsTemplate::new)
|
||||||
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
.registerLoader(VillagerType.class, VillagerTypeTemplate::new);
|
||||||
|
|||||||
+6
-2
@@ -7,7 +7,7 @@ import net.minecraft.entity.EntityType;
|
|||||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
||||||
|
|
||||||
|
|
||||||
public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
|
public class SpawnEntryConfig implements ObjectTemplate<SpawnEntry> {
|
||||||
@Value("type")
|
@Value("type")
|
||||||
@Default
|
@Default
|
||||||
private EntityType<?> type = null;
|
private EntityType<?> type = null;
|
||||||
@@ -24,8 +24,12 @@ public class SpawnEntryTemplate implements ObjectTemplate<SpawnEntry> {
|
|||||||
@Default
|
@Default
|
||||||
private Integer maxGroupSize = null;
|
private Integer maxGroupSize = null;
|
||||||
|
|
||||||
|
public Integer getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SpawnEntry get() {
|
public SpawnEntry get() {
|
||||||
return new SpawnEntry(type, weight, minGroupSize, maxGroupSize);
|
return new SpawnEntry(type, minGroupSize, maxGroupSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+2
-3
@@ -5,7 +5,6 @@ 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.entity.SpawnGroup;
|
import net.minecraft.entity.SpawnGroup;
|
||||||
import net.minecraft.world.biome.SpawnSettings;
|
import net.minecraft.world.biome.SpawnSettings;
|
||||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -28,8 +27,8 @@ public class SpawnSettingsTemplate implements ObjectTemplate<SpawnSettings> {
|
|||||||
SpawnSettings.Builder builder = new SpawnSettings.Builder();
|
SpawnSettings.Builder builder = new SpawnSettings.Builder();
|
||||||
for(SpawnTypeConfig spawn : spawns) {
|
for(SpawnTypeConfig spawn : spawns) {
|
||||||
SpawnGroup group = spawn.getGroup();
|
SpawnGroup group = spawn.getGroup();
|
||||||
for(SpawnEntry entry : spawn.getEntry()) {
|
for(SpawnEntryConfig entry : spawn.getEntry()) {
|
||||||
builder.spawn(group, entry);
|
builder.spawn(group, entry.getWeight(), entry.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(SpawnCostConfig cost : costs) {
|
for(SpawnCostConfig cost : costs) {
|
||||||
|
|||||||
+2
-3
@@ -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.annotations.Value;
|
||||||
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
|
||||||
import net.minecraft.entity.SpawnGroup;
|
import net.minecraft.entity.SpawnGroup;
|
||||||
import net.minecraft.world.biome.SpawnSettings.SpawnEntry;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -16,13 +15,13 @@ public class SpawnTypeConfig implements ObjectTemplate<SpawnTypeConfig> {
|
|||||||
|
|
||||||
@Value("entries")
|
@Value("entries")
|
||||||
@Default
|
@Default
|
||||||
private List<SpawnEntry> entry = null;
|
private List<SpawnEntryConfig> entry = null;
|
||||||
|
|
||||||
public SpawnGroup getGroup() {
|
public SpawnGroup getGroup() {
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SpawnEntry> getEntry() {
|
public List<SpawnEntryConfig> getEntry() {
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -140,10 +140,10 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun
|
|||||||
if(noise > threshold) {
|
if(noise > threshold) {
|
||||||
chunk.setBlockState(new BlockPos(x, y, z), (BlockState) delegate
|
chunk.setBlockState(new BlockPos(x, y, z), (BlockState) delegate
|
||||||
.getPalette(x + xi, y, z + zi, world, biomeProvider)
|
.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++;
|
depth++;
|
||||||
} else if(noise < airThreshold) {
|
} 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 {
|
} else {
|
||||||
depth = 0;
|
depth = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -55,7 +55,7 @@ public abstract class MobSpawnerBlockEntityMixin extends BlockEntity {
|
|||||||
|
|
||||||
public EntityType terra$getSpawnedType() {
|
public EntityType terra$getSpawnedType() {
|
||||||
return (EntityType) Registries.ENTITY_TYPE.getEntry(
|
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) {
|
public void terra$setSpawnedType(@NotNull EntityType creatureType) {
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ public abstract class WorldChunkMixin {
|
|||||||
|
|
||||||
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
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,
|
((net.minecraft.world.chunk.Chunk) (Object) this).setBlockState(new BlockPos(x, y, z), (net.minecraft.block.BlockState) blockState,
|
||||||
false);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Intrinsic
|
@Intrinsic
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ public abstract class ProtoChunkMixin {
|
|||||||
|
|
||||||
public void terra$setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
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,
|
((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) {
|
public @NotNull BlockState terra$getBlock(int x, int y, int z) {
|
||||||
|
|||||||
Reference in New Issue
Block a user