Search in sources :

Example 1 with PacketTotemEffectMusic

use of pokefenn.totemic.network.server.PacketTotemEffectMusic in project Totemic by TeamTotemic.

the class StateTotemEffect method update.

@Override
public void update() {
    World world = tile.getWorld();
    for (Multiset.Entry<TotemEffect> entry : tile.getTotemEffectSet().entrySet()) {
        TotemEffect effect = entry.getElement();
        if (world.getTotalWorldTime() % effect.getInterval() == 0)
            effect.effect(world, tile.getPos(), tile, entry.getCount());
    }
    // Diminish melody over time, about 5 minutes to fully deplete
    if (musicAmount > 0 && world.getTotalWorldTime() % 47 == 0) {
        musicAmount--;
        tile.markDirty();
    }
    if (musicAdded && !world.isRemote && world.getTotalWorldTime() % 20 == 0) {
        NetworkHandler.sendAround(new PacketTotemEffectMusic(tile.getPos(), musicAmount), tile, 32);
        musicAdded = false;
    }
    if (world.isRemote && world.getTotalWorldTime() % 40 == 0)
        spawnParticles();
}
Also used : PacketTotemEffectMusic(pokefenn.totemic.network.server.PacketTotemEffectMusic) Multiset(com.google.common.collect.Multiset) World(net.minecraft.world.World) TotemEffect(pokefenn.totemic.api.totem.TotemEffect)

Aggregations

Multiset (com.google.common.collect.Multiset)1 World (net.minecraft.world.World)1 TotemEffect (pokefenn.totemic.api.totem.TotemEffect)1 PacketTotemEffectMusic (pokefenn.totemic.network.server.PacketTotemEffectMusic)1