Search in sources :

Example 1 with LanternFireworkShape

use of org.lanternpowered.server.item.firework.LanternFireworkShape in project LanternServer by LanternPowered.

the class FireworkChargeItemTypeObjectSerializer method serializeExplosion.

static DataView serializeExplosion(FireworkEffect effect) {
    final DataView dataView = DataContainer.createNew(DataView.SafetyMode.NO_DATA_CLONED);
    dataView.set(FLICKER, (byte) (effect.flickers() ? 1 : 0));
    dataView.set(TRAIL, (byte) (effect.hasTrail() ? 1 : 0));
    dataView.set(TYPE, (byte) ((LanternFireworkShape) effect.getShape()).getInternalId());
    dataView.set(COLORS, effect.getColors().stream().mapToInt(Color::getRgb).toArray());
    dataView.set(FADE_COLORS, effect.getFadeColors().stream().mapToInt(Color::getRgb).toArray());
    return dataView;
}
Also used : LanternFireworkShape(org.lanternpowered.server.item.firework.LanternFireworkShape) DataView(org.spongepowered.api.data.DataView) Color(org.spongepowered.api.util.Color)

Example 2 with LanternFireworkShape

use of org.lanternpowered.server.item.firework.LanternFireworkShape in project LanternServer by LanternPowered.

the class FireworkShapeRegistryModule method registerDefaults.

@Override
public void registerDefaults() {
    register(new LanternFireworkShape("minecraft", "ball", 0));
    register(new LanternFireworkShape("minecraft", "large_ball", 1));
    register(new LanternFireworkShape("minecraft", "star", 2));
    register(new LanternFireworkShape("minecraft", "creeper", 3));
    register(new LanternFireworkShape("minecraft", "burst", 4));
}
Also used : LanternFireworkShape(org.lanternpowered.server.item.firework.LanternFireworkShape)

Aggregations

LanternFireworkShape (org.lanternpowered.server.item.firework.LanternFireworkShape)2 DataView (org.spongepowered.api.data.DataView)1 Color (org.spongepowered.api.util.Color)1