@@ -257,11 +257,19 @@ private void updateNestedEffect(final CompoundTag effectsTag) {
257257 final ListTag <CompoundTag > terms ;
258258 if (requirements != null && (terms = requirements .getListTag ("terms" , CompoundTag .class )) != null ) {
259259 for (final CompoundTag term : terms ) {
260- final CompoundTag predicate = term .getCompoundTag ("predicate" );
261- if (predicate != null && Key .equals (term .getString ("condition" ), "entity_properties" )) {
262- updateType (predicate , "type" , protocol .getMappingData ().getEntityMappings ());
263- }
260+ updateEnchantmentTerm (term );
261+ }
262+ }
263+ }
264+
265+ private void updateEnchantmentTerm (final CompoundTag term ) {
266+ if (Key .equals (term .getString ("condition" ), "entity_properties" )) {
267+ final CompoundTag predicate = term .getCompoundTag ("predicate" );
268+ if (predicate != null ) {
269+ updateType (predicate , "type" , protocol .getMappingData ().getEntityMappings ());
264270 }
271+ } else if (Key .equals (term .getString ("condition" ), "block_state_property" )) {
272+ updateType (term , "block" , protocol .getMappingData ().getFullBlockMappings ());
265273 }
266274 }
267275
@@ -299,20 +307,34 @@ private void runEffectRewriters(final CompoundTag effectTag) {
299307 final Consumer <CompoundTag > rewriter = enchantmentEffectHandlers .get (effect );
300308 if (rewriter != null ) {
301309 rewriter .accept (effectTag );
310+ } else if (effect .equals ("play_sound" )) {
311+ updateType (effectTag , "sound" , protocol .getMappingData ().getFullSoundMappings ());
302312 }
303313 }
304314
305315 protected void updateType (final CompoundTag tag , final String key , final FullMappings mappings ) {
306- final StringTag typeTag = tag .getStringTag (key );
316+ final Tag typeTag = tag .get (key );
307317 if (typeTag == null || mappings == null ) {
308318 return ;
309319 }
310320
311- String mappedType = mappings .mappedIdentifier (typeTag .getValue ());
321+ if (typeTag instanceof StringTag stringTag ) {
322+ setMappedOrDummyId (mappings , stringTag );
323+ } else if (typeTag instanceof ListTag <?> listTag && listTag .getElementType () == StringTag .class ) {
324+ //noinspection unchecked
325+ final ListTag <StringTag > typesTag = (ListTag <StringTag >) listTag ;
326+ for (final StringTag entry : typesTag ) {
327+ setMappedOrDummyId (mappings , entry );
328+ }
329+ }
330+ }
331+
332+ private void setMappedOrDummyId (final FullMappings mappings , final StringTag tag ) {
333+ String mappedType = mappings .mappedIdentifier (tag .getValue ());
312334 if (mappedType == null ) {
313335 mappedType = mappings .mappedIdentifier (0 ); // Dummy
314336 }
315- typeTag .setValue (mappedType );
337+ tag .setValue (mappedType );
316338 }
317339
318340 private void updateItemList (final ListTag <StringTag > listTag ) {
0 commit comments