end update in the end wohoo idfk

This commit is contained in:
2026-03-29 19:13:20 +02:00
parent 0a120a8ee6
commit 6fc34318bf
11 changed files with 118 additions and 52 deletions

View File

@@ -1412,7 +1412,7 @@ public class Szar implements ModInitializer {
}
}
});
TheEndBiomeData.addEndBiomeReplacement(BiomeKeys.END_HIGHLANDS, Szar.CHORUS_FOREST, 0.3);
TheEndBiomeData.addEndBiomeReplacement(BiomeKeys.END_HIGHLANDS, Szar.CHORUS_FOREST, 0.7);
}
public static final Block TIC_TAC_TOE_BLOCK = Registry.register(
@@ -1515,11 +1515,6 @@ public class Szar implements ModInitializer {
RegistryKeys.BIOME,
new Identifier(MOD_ID, "chorus_forest")
);
public static final Feature<DefaultFeatureConfig> SURFACE_REPLACE = Registry.register(
Registries.FEATURE,
new Identifier(MOD_ID, "surface_replace"),
new SurfaceReplaceFeature(DefaultFeatureConfig.CODEC)
);
// Blocks
public static final TrackerBlock TRACKER_BLOCK = Registry.register(
Registries.BLOCK, new Identifier(MOD_ID, "tracker"),

View File

@@ -0,0 +1,46 @@
package dev.tggamesyt.szar.mixin;
import dev.tggamesyt.szar.Szar;
import net.minecraft.block.Blocks;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.chunk.Blender;
import net.minecraft.world.gen.chunk.NoiseChunkGenerator;
import net.minecraft.world.ChunkRegion;
import net.minecraft.world.gen.StructureAccessor;
import net.minecraft.world.gen.noise.NoiseConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(NoiseChunkGenerator.class)
public class NoiseChunkGeneratorMixin {
@Inject(method = "buildSurface*", at = @At("TAIL"))
private void replaceSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk, CallbackInfo ci) {
BlockPos.Mutable mutable = new BlockPos.Mutable();
int startX = chunk.getPos().getStartX();
int startZ = chunk.getPos().getStartZ();
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
int worldX = startX + x;
int worldZ = startZ + z;
int topY = chunk.getHeightmap(net.minecraft.world.Heightmap.Type.WORLD_SURFACE_WG).get(x, z);
mutable.set(worldX, topY, worldZ);
RegistryEntry<Biome> biome = region.getBiome(mutable);
if (biome.matchesKey(Szar.CHORUS_FOREST)) {
mutable.set(worldX, topY - 1, worldZ);
if (chunk.getBlockState(mutable).isOf(Blocks.END_STONE)) {
chunk.setBlockState(mutable, Szar.CHORUS_ENDSTONE.getDefaultState(), false);
}
}
}
}
}
}

View File

@@ -0,0 +1,50 @@
package dev.tggamesyt.szar.mixin;
import dev.tggamesyt.szar.Szar;
import net.minecraft.registry.RegistryEntryLookup;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.math.ChunkSectionPos;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeKeys;
import net.minecraft.world.biome.source.BiomeCoords;
import net.minecraft.world.biome.source.TheEndBiomeSource;
import net.minecraft.world.biome.source.util.MultiNoiseUtil;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(TheEndBiomeSource.class)
public class TheEndBiomeSourceMixin {
@Unique
private RegistryEntry<Biome> szar$chorusEntry;
@Inject(method = "<init>", at = @At("TAIL"))
private void onInit(RegistryEntry<Biome> centerBiome, RegistryEntry<Biome> highlandsBiome, RegistryEntry<Biome> midlandsBiome, RegistryEntry<Biome> smallIslandsBiome, RegistryEntry<Biome> barrensBiome, CallbackInfo ci) {
RegistryEntryLookup<Biome> lookup = net.fabricmc.fabric.impl.biome.TheEndBiomeData.biomeRegistry.get();
if (lookup != null) {
this.szar$chorusEntry = lookup.getOrThrow(Szar.CHORUS_FOREST);
}
}
@Inject(method = "getBiome", at = @At("RETURN"), cancellable = true)
private void overrideBiome(int x, int y, int z, MultiNoiseUtil.MultiNoiseSampler noise, CallbackInfoReturnable<RegistryEntry<Biome>> cir) {
if (szar$chorusEntry == null) return;
RegistryEntry<Biome> result = cir.getReturnValue();
if (!result.matchesKey(BiomeKeys.END_HIGHLANDS)
&& !result.matchesKey(BiomeKeys.END_MIDLANDS)
&& !result.matchesKey(BiomeKeys.END_BARRENS)) return;
int islandX = ChunkSectionPos.getSectionCoord(BiomeCoords.toBlock(x)) >> 3;
int islandZ = ChunkSectionPos.getSectionCoord(BiomeCoords.toBlock(z)) >> 3;
long islandSeed = (long) islandX * 341873128712L + (long) islandZ * 132897987541L;
if (new java.util.Random(islandSeed).nextFloat() < 0.4f) {
cir.setReturnValue(szar$chorusEntry);
}
}
}

View File

@@ -1,24 +0,0 @@
package dev.tggamesyt.szar.mixin;
import dev.tggamesyt.szar.Szar;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.surfacebuilder.MaterialRules;
import net.minecraft.world.gen.surfacebuilder.VanillaSurfaceRules;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(VanillaSurfaceRules.class)
public class VanillaSurfaceRulesMixin {
@Inject(method = "getEndStoneRule", at = @At("RETURN"), cancellable = true)
private static void overrideEndStoneRule(CallbackInfoReturnable<MaterialRules.MaterialRule> cir) {
MaterialRules.MaterialRule chorusForest = MaterialRules.condition(
MaterialRules.biome(Szar.CHORUS_FOREST),
MaterialRules.block(Szar.CHORUS_ENDSTONE.getDefaultState())
);
cir.setReturnValue(MaterialRules.sequence(chorusForest, cir.getReturnValue()));
}
}

View File

@@ -1,5 +1,6 @@
{
"values": [
"szar:chemical_workbench",
"szar:roulette",
"szar:slot_machine",
"szar:tictactoe",

View File

@@ -0,0 +1,14 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "szar:chemical_workbench"
}
]
}
]
}

View File

@@ -1,4 +0,0 @@
{
"type": "szar:surface_replace",
"config": {}
}

View File

@@ -1,15 +0,0 @@
{
"feature": "szar:chorus_endstone_surface",
"placement": [
{
"type": "minecraft:in_square"
},
{
"type": "minecraft:heightmap",
"heightmap": "WORLD_SURFACE_WG"
},
{
"type": "minecraft:biome"
}
]
}

View File

@@ -2,6 +2,8 @@
"feature": "szar:small_chorus",
"placement": [
{ "type": "minecraft:count", "count": 5 },
{ "type": "minecraft:in_square" }
{ "type": "minecraft:in_square" },
{ "type": "minecraft:heightmap", "heightmap": "WORLD_SURFACE_WG" },
{ "type": "minecraft:biome" }
]
}

View File

@@ -14,13 +14,14 @@
"LevelSummaryMixin",
"LivingEntityFallDamageMixin",
"NoClipMixin",
"NoiseChunkGeneratorMixin",
"PlaneBlockInteractionMixin",
"PlayerDropMixin",
"PlayerEntityMixin",
"PlayerInteractionMixin",
"PlayerSleepMixin",
"RadiatedItemMixin",
"VanillaSurfaceRulesMixin"
"TheEndBiomeSourceMixin"
],
"injectors": {
"defaultRequire": 1