From 6fc34318bf51d2bcf4f62d53b0511b3850e7b024 Mon Sep 17 00:00:00 2001 From: TGGamesYT Date: Sun, 29 Mar 2026 19:13:20 +0200 Subject: [PATCH] end update in the end wohoo idfk --- gradle.properties | 2 +- src/main/java/dev/tggamesyt/szar/Szar.java | 7 +-- .../szar/mixin/NoiseChunkGeneratorMixin.java | 46 +++++++++++++++++ .../szar/mixin/TheEndBiomeSourceMixin.java | 50 +++++++++++++++++++ .../szar/mixin/VanillaSurfaceRulesMixin.java | 24 --------- .../minecraft/tags/blocks/mineable/axe.json | 1 + .../blocks/chemical_workbench.json | 14 ++++++ .../chorus_endstone_surface.json | 4 -- .../chorus_endstone_surface.json | 15 ------ .../placed_feature/small_chorus_patch.json | 4 +- src/main/resources/szar.mixins.json | 3 +- 11 files changed, 118 insertions(+), 52 deletions(-) create mode 100644 src/main/java/dev/tggamesyt/szar/mixin/NoiseChunkGeneratorMixin.java create mode 100644 src/main/java/dev/tggamesyt/szar/mixin/TheEndBiomeSourceMixin.java delete mode 100644 src/main/java/dev/tggamesyt/szar/mixin/VanillaSurfaceRulesMixin.java create mode 100644 src/main/resources/data/szar/loot_tables/blocks/chemical_workbench.json delete mode 100644 src/main/resources/data/szar/worldgen/configured_feature/chorus_endstone_surface.json delete mode 100644 src/main/resources/data/szar/worldgen/placed_feature/chorus_endstone_surface.json diff --git a/gradle.properties b/gradle.properties index 44ea246..95848ac 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.20.1 yarn_mappings=1.20.1+build.10 loader_version=0.18.3 # Mod Properties -mod_version=26.3.29 +mod_version=26.3.29.1 maven_group=dev.tggamesyt archives_base_name=szar # Dependencies diff --git a/src/main/java/dev/tggamesyt/szar/Szar.java b/src/main/java/dev/tggamesyt/szar/Szar.java index 7775d34..a695894 100644 --- a/src/main/java/dev/tggamesyt/szar/Szar.java +++ b/src/main/java/dev/tggamesyt/szar/Szar.java @@ -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 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"), diff --git a/src/main/java/dev/tggamesyt/szar/mixin/NoiseChunkGeneratorMixin.java b/src/main/java/dev/tggamesyt/szar/mixin/NoiseChunkGeneratorMixin.java new file mode 100644 index 0000000..701c26b --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/mixin/NoiseChunkGeneratorMixin.java @@ -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 = 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); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/mixin/TheEndBiomeSourceMixin.java b/src/main/java/dev/tggamesyt/szar/mixin/TheEndBiomeSourceMixin.java new file mode 100644 index 0000000..9f19877 --- /dev/null +++ b/src/main/java/dev/tggamesyt/szar/mixin/TheEndBiomeSourceMixin.java @@ -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 szar$chorusEntry; + + @Inject(method = "", at = @At("TAIL")) + private void onInit(RegistryEntry centerBiome, RegistryEntry highlandsBiome, RegistryEntry midlandsBiome, RegistryEntry smallIslandsBiome, RegistryEntry barrensBiome, CallbackInfo ci) { + RegistryEntryLookup 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> cir) { + if (szar$chorusEntry == null) return; + + RegistryEntry 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); + } + } +} \ No newline at end of file diff --git a/src/main/java/dev/tggamesyt/szar/mixin/VanillaSurfaceRulesMixin.java b/src/main/java/dev/tggamesyt/szar/mixin/VanillaSurfaceRulesMixin.java deleted file mode 100644 index 4c664f1..0000000 --- a/src/main/java/dev/tggamesyt/szar/mixin/VanillaSurfaceRulesMixin.java +++ /dev/null @@ -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 cir) { - MaterialRules.MaterialRule chorusForest = MaterialRules.condition( - MaterialRules.biome(Szar.CHORUS_FOREST), - MaterialRules.block(Szar.CHORUS_ENDSTONE.getDefaultState()) - ); - - cir.setReturnValue(MaterialRules.sequence(chorusForest, cir.getReturnValue())); - } -} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json index 6ef030f..f2fbfac 100644 --- a/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json +++ b/src/main/resources/data/minecraft/tags/blocks/mineable/axe.json @@ -1,5 +1,6 @@ { "values": [ + "szar:chemical_workbench", "szar:roulette", "szar:slot_machine", "szar:tictactoe", diff --git a/src/main/resources/data/szar/loot_tables/blocks/chemical_workbench.json b/src/main/resources/data/szar/loot_tables/blocks/chemical_workbench.json new file mode 100644 index 0000000..2f19355 --- /dev/null +++ b/src/main/resources/data/szar/loot_tables/blocks/chemical_workbench.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:item", + "name": "szar:chemical_workbench" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/szar/worldgen/configured_feature/chorus_endstone_surface.json b/src/main/resources/data/szar/worldgen/configured_feature/chorus_endstone_surface.json deleted file mode 100644 index c33d0a4..0000000 --- a/src/main/resources/data/szar/worldgen/configured_feature/chorus_endstone_surface.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "szar:surface_replace", - "config": {} -} \ No newline at end of file diff --git a/src/main/resources/data/szar/worldgen/placed_feature/chorus_endstone_surface.json b/src/main/resources/data/szar/worldgen/placed_feature/chorus_endstone_surface.json deleted file mode 100644 index aefb536..0000000 --- a/src/main/resources/data/szar/worldgen/placed_feature/chorus_endstone_surface.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "feature": "szar:chorus_endstone_surface", - "placement": [ - { - "type": "minecraft:in_square" - }, - { - "type": "minecraft:heightmap", - "heightmap": "WORLD_SURFACE_WG" - }, - { - "type": "minecraft:biome" - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/szar/worldgen/placed_feature/small_chorus_patch.json b/src/main/resources/data/szar/worldgen/placed_feature/small_chorus_patch.json index 0b19e58..0204271 100644 --- a/src/main/resources/data/szar/worldgen/placed_feature/small_chorus_patch.json +++ b/src/main/resources/data/szar/worldgen/placed_feature/small_chorus_patch.json @@ -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" } ] } \ No newline at end of file diff --git a/src/main/resources/szar.mixins.json b/src/main/resources/szar.mixins.json index 1fd74fd..ee685ac 100644 --- a/src/main/resources/szar.mixins.json +++ b/src/main/resources/szar.mixins.json @@ -14,13 +14,14 @@ "LevelSummaryMixin", "LivingEntityFallDamageMixin", "NoClipMixin", + "NoiseChunkGeneratorMixin", "PlaneBlockInteractionMixin", "PlayerDropMixin", "PlayerEntityMixin", "PlayerInteractionMixin", "PlayerSleepMixin", "RadiatedItemMixin", - "VanillaSurfaceRulesMixin" + "TheEndBiomeSourceMixin" ], "injectors": { "defaultRequire": 1