Minor network bandwidth optimization: use vanilla block events when possible because those hvae smaller packet sizes

This commit is contained in:
Vincent Lee committed 2017-12-28 13:11:50 -06:00
1 parent 6339c75e40
commit d244e12437
9 files changed
+145 -123

No files matched your search

@@ -51,6 +51,6 @@ public abstract class BlockMod extends Block implements IModelRegister {
public boolean eventReceived(IBlockState state, World world, BlockPos pos, int id, int param) {
super.eventReceived(state, world, pos, id, param);
TileEntity tileentity = world.getTileEntity(pos);
return tileentity != null ? tileentity.receiveClientEvent(id, param) : false;
return tileentity != null && tileentity.receiveClientEvent(id, param);
}
}
@@ -10,13 +10,16 @@
*/
package vazkii.botania.common.block.subtile.generating;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.network.PacketBotaniaEffect;
import vazkii.botania.common.network.PacketHandler;
@@ -26,6 +29,7 @@ import java.util.List;
public class SubTileEntropinnyum extends SubTileGenerating {
private static final int RANGE = 12;
private static final int EXPLODE_EFFECT_EVENT = 0;
@Override
public void onUpdate() {
@@ -40,12 +44,29 @@ public class SubTileEntropinnyum extends SubTileGenerating {
mana += getMaxMana();
sync();
PacketHandler.sendToNearby(supertile.getWorld(), supertile.getPos(), new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ENTROPINNYUM, tnt.posX, tnt.posY, tnt.posZ));
getWorld().addBlockEvent(getPos(), supertile.getBlockType(), EXPLODE_EFFECT_EVENT, tnt.getEntityId());
}
}
}
}
@Override
public boolean receiveClientEvent(int event, int param) {
if(event == EXPLODE_EFFECT_EVENT) {
if(getWorld().isRemote && getWorld().getEntityByID(param) instanceof EntityTNTPrimed) {
Entity e = getWorld().getEntityByID(param);
for(int i = 0; i < 50; i++)
Botania.proxy.sparkleFX(e.posX + Math.random() * 4 - 2, e.posY + Math.random() * 4 - 2, e.posZ + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
getWorld().spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, e.posX, e.posY, e.posZ, 1D, 0D, 0D);
}
return true;
} else {
return super.receiveClientEvent(event, param);
}
}
@Override
public int getColor() {
return 0xcb0000;
@@ -64,6 +64,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
private static final Pattern SEED_PATTERN = Pattern.compile("(?:(?:(?:[A-Z-_.:]|^)seed)|(?:(?:[a-z-_.:]|^)Seed))(?:[sA-Z-_.:]|$)");
private static final int SET_KEEP_TICKS_EVENT = 0;
private static final int CRAFT_EFFECT_EVENT = 1;
public static final String TAG_HAS_WATER = "hasWater";
public static final String TAG_HAS_LAVA = "hasLava";
@@ -153,7 +154,7 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
setWater(false);
world.updateComparatorOutputLevel(pos, world.getBlockState(pos).getBlock());
craftingFanciness();
world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);
didChange = true;
break;
@@ -225,12 +226,6 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
}
}
private void craftingFanciness() {
world.playSound(null, pos, ModSounds.altarCraft, SoundCategory.BLOCKS, 1F, 1F);
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.APOTHECARY_CRAFT, getPos().getX(), getPos().getY(), getPos().getZ()));
}
public boolean isEmpty() {
for(int i = 0; i < getSizeInventory(); i++)
if(!itemHandler.getStackInSlot(i).isEmpty())
@@ -308,11 +303,21 @@ public class TileAltar extends TileSimpleInventory implements IPetalApothecary {
@Override
public boolean receiveClientEvent(int id, int param) {
if(id == SET_KEEP_TICKS_EVENT) {
recipeKeepTicks = param;
return true;
} else {
return false;
switch(id) {
case SET_KEEP_TICKS_EVENT: recipeKeepTicks = param; return true;
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.altarCraft, SoundCategory.BLOCKS, 1F, 1F, false);
}
return true;
}
default: return super.receiveClientEvent(id, param);
}
}
@@ -38,10 +38,10 @@ import javax.annotation.Nullable;
import java.awt.Color;
import java.util.List;
// This is mostly copypasta from TileRuneAltar
public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
private static final String TAG_MANA = "mana";
private static final int CRAFT_EFFECT_EVENT = 0;
public RecipeBrew recipe;
int mana = 0;
@@ -129,16 +129,14 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
if(mana >= getManaCost() && !world.isRemote) {
int mana = getManaCost();
recieveMana(-mana);
if(!world.isRemote) {
ItemStack output = recipe.getOutput(itemHandler.getStackInSlot(0));
EntityItem outputItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.spawnEntity(outputItem);
}
ItemStack output = recipe.getOutput(itemHandler.getStackInSlot(0));
EntityItem outputItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.spawnEntity(outputItem);
world.addBlockEvent(getPos(), ModBlocks.brewery, CRAFT_EFFECT_EVENT, recipe.getBrew().getColor(output));
for(int i = 0; i < getSizeInventory(); i++)
itemHandler.setStackInSlot(i, ItemStack.EMPTY);
craftingFanciness();
}
}
}
@@ -155,6 +153,27 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
manaLastTick = mana;
}
@Override
public boolean receiveClientEvent(int event, int param) {
if(event == CRAFT_EFFECT_EVENT) {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
Color c = new Color(param);
float r = c.getRed() / 255F;
float g = c.getGreen() / 255F;
float b = c.getBlue() / 255F;
Botania.proxy.sparkleFX(pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, r, g, b, (float) Math.random() * 2F + 0.5F, 10);
for(int j = 0; j < 2; j++)
Botania.proxy.wispFX(pos.getX() + 0.7 - Math.random() * 0.4, pos.getY() + 0.9 - Math.random() * 0.2, pos.getZ() + 0.7 - Math.random() * 0.4, 0.2F, 0.2F, 0.2F, 0.1F + (float) Math.random() * 0.2F, 0.05F - (float) Math.random() * 0.1F, 0.05F + (float) Math.random() * 0.03F, 0.05F - (float) Math.random() * 0.1F);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.potionCreate, SoundCategory.BLOCKS, 1F, 1.5F + (float) Math.random() * 0.25F, false);
}
return true;
} else {
return super.receiveClientEvent(event, param);
}
}
public int getManaCost() {
ItemStack stack = itemHandler.getStackInSlot(0);
if(recipe == null || stack.isEmpty() || !(stack.getItem() instanceof IBrewContainer))
@@ -163,11 +182,6 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver {
return container.getManaCost(recipe.getBrew(), stack);
}
public void craftingFanciness() {
world.playSound(null, pos, ModSounds.potionCreate, SoundCategory.BLOCKS, 1F, 1.5F + (float) Math.random() * 0.25F);
PacketHandler.sendToNearby(world, pos, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BREWERY_FINISH, pos.getX(), pos.getY(), pos.getZ(), recipe.getBrew().getColor(itemHandler.getStackInSlot(0))));
}
@Override
public void writePacketNBT(NBTTagCompound par1nbtTagCompound) {
super.writePacketNBT(par1nbtTagCompound);
@@ -42,6 +42,7 @@ import vazkii.botania.api.mana.spark.ISparkEntity;
import vazkii.botania.api.mana.spark.SparkHelper;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.network.PacketBotaniaEffect;
@@ -63,6 +64,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
private static final String TAG_MANA = "mana";
private static final String TAG_ITEM = "item";
private static final String TAG_ENCHANTS = "enchantsToApply";
private static final int CRAFT_EFFECT_EVENT = 0;
public State stage = State.IDLE;
public int stageTicks = 0;
@@ -246,7 +248,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
manaRequired = -1;
mana = 0;
craftingFanciness();
world.addBlockEvent(getPos(), ModBlocks.enchanter, CRAFT_EFFECT_EVENT, 0);
advanceStage();
}
break;
@@ -282,10 +284,25 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
sync();
}
private void craftingFanciness() {
world.playSound(null, pos, ModSounds.enchanterEnchant, SoundCategory.BLOCKS, 1F, 1F);
PacketHandler.sendToNearby(world, pos,
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ENCHANTER_CRAFT, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5));
@Override
public boolean receiveClientEvent(int event, int param) {
switch(event) {
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(
getPos().getX() + Math.random() * 0.4 - 0.2, getPos().getY(), getPos().getZ() + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.enchanterEnchant, SoundCategory.BLOCKS, 1F, 1F, false);
}
return true;
}
default: return super.receiveClientEvent(event, param);
}
}
@Nonnull
@@ -48,6 +48,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
private static final String TAG_MANA_TO_GET = "manaToGet";
private static final int SET_KEEP_TICKS_EVENT = 0;
private static final int SET_COOLDOWN_EVENT = 1;
private static final int CRAFT_EFFECT_EVENT = 2;
RecipeRuneAltar currentRecipe;
@@ -105,6 +106,18 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
switch (id) {
case SET_KEEP_TICKS_EVENT: recipeKeepTicks = param; return true;
case SET_COOLDOWN_EVENT: cooldown = param; return true;
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
world.playSound(pos.getX(), pos.getY(), pos.getZ(), ModSounds.runeAltarCraft, SoundCategory.BLOCKS, 1, 1, false);
}
return true;
}
default: return super.receiveClientEvent(id, param);
}
}
@@ -238,6 +251,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
world.spawnEntity(outputItem);
currentRecipe = null;
world.addBlockEvent(getPos(), ModBlocks.runeAltar, SET_COOLDOWN_EVENT, 60);
world.addBlockEvent(getPos(), ModBlocks.runeAltar, CRAFT_EFFECT_EVENT, 0);
saveLastRecipe();
for(int i = 0; i < getSizeInventory(); i++) {
@@ -253,18 +267,10 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver
}
livingrock.getItem().shrink(1);
craftingFanciness();
}
}
}
public void craftingFanciness() {
world.playSound(null, pos, ModSounds.runeAltarCraft, SoundCategory.BLOCKS, 1, 1);
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.RUNE_CRAFT, getPos().getX(), getPos().getY(), getPos().getZ()));
}
public boolean isEmpty() {
for(int i = 0; i < getSizeInventory(); i++)
if(!itemHandler.getStackInSlot(i).isEmpty())
@@ -56,6 +56,7 @@ import vazkii.botania.common.block.tile.TileMod;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.handler.ModSounds;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.item.ItemManaTablet;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.network.PacketBotaniaEffect;
@@ -82,6 +83,8 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
private static final String TAG_FRAGILE = "fragile";
private static final String TAG_INPUT_KEY = "inputKey";
private static final String TAG_OUTPUT_KEY = "outputKey";
private static final int CRAFT_EFFECT_EVENT = 0;
private static final int CHARGE_EFFECT_EVENT = 1;
private boolean outputting = false;
@@ -197,8 +200,39 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
soundTicks = 6;
}
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.POOL_CRAFT, pos.getX(), pos.getY(), pos.getZ()));
world.addBlockEvent(getPos(), getBlockType(), CRAFT_EFFECT_EVENT, 0);
}
@Override
public boolean receiveClientEvent(int event, int param) {
switch(event) {
case CRAFT_EFFECT_EVENT: {
if(world.isRemote) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 0.75, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
}
return true;
}
case CHARGE_EFFECT_EVENT: {
if(world.isRemote) {
if(ConfigHandler.chargingAnimationEnabled) {
boolean outputting = param == 1;
Vector3 itemVec = Vector3.fromBlockPos(pos).add(0.5, 0.5 + Math.random() * 0.3, 0.5);
Vector3 tileVec = Vector3.fromBlockPos(pos).add(0.2 + Math.random() * 0.6, 0, 0.2 + Math.random() * 0.6);
Botania.proxy.lightningFX(outputting ? tileVec : itemVec,
outputting ? itemVec : tileVec, 80, world.rand.nextLong(), 0x4400799c, 0x4400C6FF);
}
}
return true;
}
default: return super.receiveClientEvent(event, param);
}
}
@Override
@@ -270,8 +304,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
if(didSomething) {
if(ConfigHandler.chargingAnimationEnabled && world.rand.nextInt(20) == 0) {
PacketHandler.sendToNearby(world, getPos(),
new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.POOL_CHARGE, getPos().getX(), getPos().getY(), getPos().getZ(), outputting ? 1 : 0));
world.addBlockEvent(getPos(), getBlockType(), CHARGE_EFFECT_EVENT, outputting ? 1 : 0);
}
isDoingTransfer = outputting;
}
@@ -73,9 +73,9 @@ public class ItemBlackLotus extends ItemMod implements IManaDissolvable {
pool.recieveMana(t2 ? MANA_PER_T2 : MANA_PER);
stack.shrink(1);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(item.world, tile.getPos());
PacketHandler.sendToNearby(item.world, item, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BLACK_LOTUS_DISSOLVE, item.posX, tile.getPos().getY() + 0.5, item.posZ));
}
PacketHandler.sendToNearby(item.world, item, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BLACK_LOTUS_DISSOLVE, item.posX, tile.getPos().getY() + 0.5, item.posZ));
item.playSound(ModSounds.blackLotus, 0.5F, t2 ? 0.1F : 1F);
}
@@ -21,6 +21,8 @@ import vazkii.botania.common.entity.EntityDoppleganger;
import java.awt.Color;
// Prefer using World.addBlockEvent/Block.eventReceived/TileEntity.receiveClientEvent where possible
// as those use less network bandwidth (~14 bytes), vs 26+ bytes here
public class PacketBotaniaEffect implements IMessage {
private EffectType type;
@@ -41,7 +43,7 @@ public class PacketBotaniaEffect implements IMessage {
@Override
public void fromBytes(ByteBuf buf) {
type = EffectType.values()[buf.readShort()];
type = EffectType.values()[buf.readByte()];
x = buf.readDouble();
y = buf.readDouble();
z = buf.readDouble();
@@ -54,7 +56,7 @@ public class PacketBotaniaEffect implements IMessage {
@Override
public void toBytes(ByteBuf buf) {
buf.writeShort(type.ordinal());
buf.writeByte(type.ordinal());
buf.writeDouble(x);
buf.writeDouble(y);
buf.writeDouble(z);
@@ -75,27 +77,6 @@ public class PacketBotaniaEffect implements IMessage {
Minecraft mc = Minecraft.getMinecraft();
World world = mc.world;
switch (message.type) {
case POOL_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 0.75, message.z + 0.5 + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
break;
}
case POOL_CHARGE: {
if(ConfigHandler.chargingAnimationEnabled) {
boolean outputting = message.args[0] == 1;
BlockPos pos = new BlockPos(message.x, message.y, message.z);
Vector3 itemVec = Vector3.fromBlockPos(pos).add(0.5, 0.5 + Math.random() * 0.3, 0.5);
Vector3 tileVec = Vector3.fromBlockPos(pos).add(0.2 + Math.random() * 0.6, 0, 0.2 + Math.random() * 0.6);
Botania.proxy.lightningFX(outputting ? tileVec : itemVec,
outputting ? itemVec : tileVec, 80, world.rand.nextLong(), 0x4400799c, 0x4400C6FF);
}
break;
}
case PAINT_LENS: {
EnumDyeColor placeColor = EnumDyeColor.byMetadata(message.args[0]);
int hex = placeColor.getColorValue();
@@ -192,17 +173,6 @@ public class PacketBotaniaEffect implements IMessage {
size, (float) motion.x, (float) motion.y, (float) motion.z);
break;
}
case ENCHANTER_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(
message.x + Math.random() * 0.4 - 0.2, message.y, message.z + Math.random() * 0.4 - 0.2,
red, green, blue, (float) Math.random(), 10);
}
break;
}
case ENCHANTER_DESTROY: {
for(int i = 0; i < 50; i++) {
float red = (float) Math.random();
@@ -213,13 +183,6 @@ public class PacketBotaniaEffect implements IMessage {
}
break;
}
case ENTROPINNYUM: {
for(int i = 0; i < 50; i++)
Botania.proxy.sparkleFX(message.x + Math.random() * 4 - 2, message.y + Math.random() * 4 - 2, message.z + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, message.x, message.y, message.z, 1D, 0D, 0D);
break;
}
case BLACK_LOTUS_DISSOLVE: {
for(int i = 0; i < 50; i++) {
float r = (float) Math.random() * 0.35F;
@@ -237,17 +200,6 @@ public class PacketBotaniaEffect implements IMessage {
break;
}
case BREWERY_FINISH: {
for(int i = 0; i < 25; i++) {
Color c = new Color(message.args[0]);
float r = c.getRed() / 255F;
float g = c.getGreen() / 255F;
float b = c.getBlue() / 255F;
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2, r, g, b, (float) Math.random() * 2F + 0.5F, 10);
for(int j = 0; j < 2; j++)
Botania.proxy.wispFX(message.x + 0.7 - Math.random() * 0.4, message.y + 0.9 - Math.random() * 0.2, message.z + 0.7 - Math.random() * 0.4, 0.2F, 0.2F, 0.2F, 0.1F + (float) Math.random() * 0.2F, 0.05F - (float) Math.random() * 0.1F, 0.05F + (float) Math.random() * 0.03F, 0.05F - (float) Math.random() * 0.1F);
}
}
case TERRA_PLATE: {
TileEntity te = world.getTileEntity(new BlockPos(message.x, message.y, message.z));
if(te instanceof TileTerraPlate) {
@@ -280,25 +232,6 @@ public class PacketBotaniaEffect implements IMessage {
}
}
}
case APOTHECARY_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
break;
}
case RUNE_CRAFT: {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
Botania.proxy.sparkleFX(message.x + 0.5 + Math.random() * 0.4 - 0.2, message.y + 1, message.z + 0.5 + Math.random() * 0.4 - 0.2, red, green, blue, (float) Math.random(), 10);
}
break;
}
case FLUGEL_EFFECT: {
Entity entity = world.getEntityByID(message.args[0]);
if(entity != null) {
@@ -320,21 +253,14 @@ public class PacketBotaniaEffect implements IMessage {
}
public enum EffectType {
POOL_CRAFT(0),
POOL_CHARGE(1), // Arg: 1 if outputting, 0 if inputting
PAINT_LENS(1), // Arg: EnumDyeColor
ARENA_INDICATOR(0),
ITEM_SMOKE(2), // Arg: Entity ID, number of particles
SPARK_NET_INDICATOR(2), // Arg: Entity ID from, Entity ID towards
SPARK_MANA_FLOW(2), // Arg: Entity ID from, Entity ID towards
ENCHANTER_CRAFT(0),
ENCHANTER_DESTROY(0),
ENTROPINNYUM(0),
BLACK_LOTUS_DISSOLVE(0),
BREWERY_FINISH(1), // Arg: RGB
TERRA_PLATE(0),
APOTHECARY_CRAFT(0),
RUNE_CRAFT(0),
FLUGEL_EFFECT(1); // Arg: Entity ID
private final int argCount;