From 1bc6d5ade070faffab7dedb9da09b18a33ee8dc9 Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Thu, 5 Jan 2017 15:41:31 -0600 Subject: [PATCH] Fix brewery not playing particles when it finishes --- .../botania/common/block/tile/TileBrewery.java | 12 +++--------- .../common/network/PacketBotaniaEffect.java | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/vazkii/botania/common/block/tile/TileBrewery.java b/src/main/java/vazkii/botania/common/block/tile/TileBrewery.java index bc6cd53a3..335fa2eac 100644 --- a/src/main/java/vazkii/botania/common/block/tile/TileBrewery.java +++ b/src/main/java/vazkii/botania/common/block/tile/TileBrewery.java @@ -36,6 +36,8 @@ 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.network.PacketBotaniaEffect; +import vazkii.botania.common.network.PacketHandler; // This is mostly copypasta from TileRuneAltar public class TileBrewery extends TileSimpleInventory implements IManaReceiver { @@ -164,15 +166,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver { public void craftingFanciness() { world.playSound(null, pos, BotaniaSoundEvents.potionCreate, SoundCategory.BLOCKS, 1F, 1.5F + (float) Math.random() * 0.25F); - for(int i = 0; i < 25; i++) { - Color color = new Color(recipe.getBrew().getColor(itemHandler.getStackInSlot(0))); - float r = color.getRed() / 255F; - float g = color.getGreen() / 255F; - float b = color.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); - } + PacketHandler.sendToNearby(world, pos, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BREWERY_FINISH, pos.getX(), pos.getY(), pos.getZ(), recipe.getBrew().getColor(itemHandler.getStackInSlot(0)))); } @Override diff --git a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java index 9367c0811..a453d1de4 100644 --- a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java +++ b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java @@ -240,6 +240,17 @@ 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); + } + } } } }); @@ -251,7 +262,7 @@ 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: colour + 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 @@ -259,7 +270,8 @@ public class PacketBotaniaEffect implements IMessage { ENCHANTER_CRAFT(0), ENCHANTER_DESTROY(0), ENTROPINNYUM(0), - BLACK_LOTUS_DISSOLVE(0); + BLACK_LOTUS_DISSOLVE(0), + BREWERY_FINISH(1); // Arg: RGB private final int argCount;