@@ -130,7 +130,6 @@ protected void registerPackets() {
130130 final CompoundTag attributes = tag .getCompoundTag ("attributes" );
131131 moveAttribute (tag , attributes , "visual/cloud_height" , "cloud_height" , Function .identity (), null );
132132 moveAttribute (tag , attributes , "gameplay/can_start_raid" , "has_raids" , Function .identity (), trueTag );
133- moveAttribute (tag , attributes , "gameplay/can_start_raid" , "has_raids" , Function .identity (), trueTag );
134133 moveAttribute (tag , attributes , "gameplay/piglins_zombify" , "piglin_safe" , attributeTag -> ((NumberTag ) attributeTag ).asBoolean () ? ByteTag .ZERO : trueTag , ByteTag .ZERO );
135134 moveAttribute (tag , attributes , "gameplay/respawn_anchor_works" , "respawn_anchor_works" , Function .identity (), trueTag );
136135 moveAttribute (tag , attributes , "gameplay/bed_rule" , "bed_works" , attributeTag -> {
@@ -143,15 +142,86 @@ protected void registerPackets() {
143142 registryDataRewriter .addHandler ("worldgen/biome" , (key , tag ) -> {
144143 final CompoundTag effects = tag .getCompoundTag ("effects" );
145144
145+ // Colors
146+ moveAttribute (effects , effects , "water_color" , "water_color" , this ::mapColor , new IntTag (4159204 ));
147+ moveAttribute (effects , effects , "foliage_color" , "foliage_color" , this ::mapColor , null );
148+ moveAttribute (effects , effects , "dry_foliage_color" , "dry_foliage_color" , this ::mapColor , null );
149+ moveAttribute (effects , effects , "grass_color" , "grass_color" , this ::mapColor , null );
150+
146151 final CompoundTag attributes = tag .removeUnchecked ("attributes" );
147152 moveAttribute (effects , attributes , "visual/sky_color" , "sky_color" , this ::mapColor , new IntTag (0 ));
148153 moveAttribute (effects , attributes , "visual/water_fog_color" , "water_fog_color" , this ::mapColor , new IntTag (-16448205 ));
149154 moveAttribute (effects , attributes , "visual/fog_color" , "fog_color" , this ::mapColor , new IntTag (Key .equals (key , "the_end" ) ? END_FOG_COLOR : OVERWORLD_FOG_COLOR )); // overworld fog color as default
150155
151- moveAttribute (effects , effects , "water_color" , "water_color" , this ::mapColor , new IntTag (4159204 ));
152- moveAttribute (effects , effects , "foliage_color" , "foliage_color" , this ::mapColor , null );
153- moveAttribute (effects , effects , "dry_foliage_color" , "dry_foliage_color" , this ::mapColor , null );
154- moveAttribute (effects , effects , "grass_color" , "grass_color" , this ::mapColor , null );
156+ if (attributes == null ) {
157+ return ;
158+ }
159+
160+ // Music and sounds
161+ final CompoundTag backgroundMusic = TagUtil .getNamespacedCompoundTag (attributes , "audio/background_music" );
162+ if (backgroundMusic != null ) {
163+ final CompoundTag def = backgroundMusic .getCompoundTag ("default" );
164+ if (def != null ) {
165+ final CompoundTag data = new CompoundTag ();
166+ final Tag maxDelay = def .get ("max_delay" );
167+ final Tag minDelay = def .get ("min_delay" );
168+ final Tag sound = def .get ("sound" );
169+ if (maxDelay != null ) {
170+ data .put ("max_delay" , maxDelay );
171+ }
172+ if (minDelay != null ) {
173+ data .put ("min_delay" , minDelay );
174+ }
175+ if (sound != null ) {
176+ data .put ("sound" , sound );
177+ }
178+
179+ // Assume this by default
180+ if (!data .contains ("replace_current_music" )) {
181+ data .putBoolean ("replace_current_music" , false );
182+ }
183+
184+ final CompoundTag entry = new CompoundTag ();
185+ entry .put ("data" , data );
186+ entry .putInt ("weight" , 1 );
187+
188+ final ListTag <CompoundTag > musicList = new ListTag <>(CompoundTag .class );
189+ musicList .add (entry );
190+ effects .put ("music" , musicList );
191+ }
192+ }
193+
194+ final CompoundTag ambientSounds = TagUtil .getNamespacedCompoundTag (attributes , "audio/ambient_sounds" );
195+ if (ambientSounds != null ) {
196+ final Tag loop = ambientSounds .get ("loop" );
197+ if (loop != null ) {
198+ effects .put ("ambient_sound" , loop );
199+ }
200+
201+ final Tag mood = ambientSounds .get ("mood" );
202+ if (mood != null ) {
203+ effects .put ("mood_sound" , mood );
204+ }
205+
206+ final Tag additions = ambientSounds .get ("additions" );
207+ if (additions != null ) {
208+ effects .put ("additions_sound" , additions );
209+ }
210+ }
211+
212+ // Particles
213+ final ListTag <CompoundTag > ambientParticles = TagUtil .getNamespacedCompoundTagList (attributes , "visual/ambient_particles" );
214+ if (ambientParticles != null && !ambientParticles .isEmpty ()) {
215+ final CompoundTag first = ambientParticles .get (0 );
216+ final Tag probability = first .get ("probability" );
217+ final CompoundTag particle = first .getCompoundTag ("particle" );
218+
219+ // Single particle
220+ final CompoundTag options = new CompoundTag ();
221+ options .put ("probability" , probability );
222+ options .put ("options" , particle );
223+ effects .put ("particle" , options );
224+ }
155225 });
156226 registryDataRewriter .addHandler ("enchantment" , (key , tag ) -> {
157227 final CompoundTag effects = tag .getCompoundTag ("effects" );
0 commit comments