Search in sources :

Example 1 with MapDecoration

use of net.minecraft.world.level.saveddata.maps.MapDecoration in project SpongeCommon by SpongePowered.

the class MapItemSavedDataMixin method bridge$setDecorations.

@SuppressWarnings("SuspiciousMethodCalls")
@Override
public void bridge$setDecorations(final Set<org.spongepowered.api.map.decoration.MapDecoration> newDecorations) {
    this.decorations.clear();
    for (final org.spongepowered.api.map.decoration.MapDecoration decoration : newDecorations) {
        this.impl$addDecorationToDecorationsMapIfNotExists((MapDecoration) decoration);
    }
    for (final MapDecoration existingDecoration : this.decorations.values()) {
        if (!newDecorations.contains(existingDecoration)) {
            // Removed.
            ((MapDecorationBridge) existingDecoration).notifyRemovedFromMap((MapInfo) this);
            this.setDirty();
        }
    }
    if (newDecorations.isEmpty()) {
        ((SpongeDataHolderBridge) this).bridge$remove(Keys.MAP_DECORATIONS);
    } else {
        ((SpongeDataHolderBridge) this).bridge$offer(Keys.MAP_DECORATIONS, newDecorations);
    }
}
Also used : MapDecoration(net.minecraft.world.level.saveddata.maps.MapDecoration) MapDecorationBridge(org.spongepowered.common.bridge.world.storage.MapDecorationBridge) SpongeDataHolderBridge(org.spongepowered.common.bridge.data.SpongeDataHolderBridge)

Aggregations

MapDecoration (net.minecraft.world.level.saveddata.maps.MapDecoration)1 SpongeDataHolderBridge (org.spongepowered.common.bridge.data.SpongeDataHolderBridge)1 MapDecorationBridge (org.spongepowered.common.bridge.world.storage.MapDecorationBridge)1