diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileEntropinnyum.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileEntropinnyum.java index 78189cac9..58bcaf92d 100644 --- a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileEntropinnyum.java +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileEntropinnyum.java @@ -20,6 +20,8 @@ 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; import java.util.List; @@ -31,22 +33,16 @@ public class SubTileEntropinnyum extends SubTileGenerating { public void onUpdate() { super.onUpdate(); - if(mana == 0) { + if(!supertile.getWorld().isRemote && mana == 0) { List tnts = supertile.getWorld().getEntitiesWithinAABB(EntityTNTPrimed.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1))); for(EntityTNTPrimed tnt : tnts) { if(tnt.getFuse() == 1 && !tnt.isDead && !supertile.getWorld().getBlockState(new BlockPos(tnt)).getMaterial().isLiquid()) { - if(!supertile.getWorld().isRemote) { - tnt.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 0.2F, (1F + (supertile.getWorld().rand.nextFloat() - supertile.getWorld().rand.nextFloat()) * 0.2F) * 0.7F); - tnt.setDead(); - mana += getMaxMana(); - sync(); - } + tnt.playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 0.2F, (1F + (supertile.getWorld().rand.nextFloat() - supertile.getWorld().rand.nextFloat()) * 0.2F) * 0.7F); + tnt.setDead(); + mana += getMaxMana(); + sync(); - for(int i = 0; i < 50; i++) - Botania.proxy.sparkleFX(tnt.worldObj, tnt.posX + Math.random() * 4 - 2, tnt.posY + Math.random() * 4 - 2, tnt.posZ + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12); - - supertile.getWorld().spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, tnt.posX, tnt.posY, tnt.posZ, 1D, 0D, 0D); - return; + PacketHandler.sendToNearby(supertile.getWorld(), supertile.getPos(), new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.ENTROPINNYUM, tnt.posX, tnt.posY, tnt.posZ)); } } } diff --git a/src/main/java/vazkii/botania/common/item/ItemBlackLotus.java b/src/main/java/vazkii/botania/common/item/ItemBlackLotus.java index df7eddcb7..e31dff106 100644 --- a/src/main/java/vazkii/botania/common/item/ItemBlackLotus.java +++ b/src/main/java/vazkii/botania/common/item/ItemBlackLotus.java @@ -25,6 +25,8 @@ import vazkii.botania.api.mana.IManaPool; import vazkii.botania.api.sound.BotaniaSoundEvents; import vazkii.botania.common.Botania; import vazkii.botania.common.lib.LibItemNames; +import vazkii.botania.common.network.PacketBotaniaEffect; +import vazkii.botania.common.network.PacketHandler; import javax.annotation.Nonnull; import java.util.List; @@ -70,19 +72,7 @@ public class ItemBlackLotus extends ItemMod implements IManaDissolvable { VanillaPacketDispatcher.dispatchTEToNearbyPlayers(item.worldObj, tile.getPos()); } - for(int i = 0; i < 50; i++) { - float r = (float) Math.random() * 0.25F; - float g = 0F; - float b = (float) Math.random() * 0.25F; - float s = 0.45F * (float) Math.random() * 0.25F; - - float m = 0.045F; - float mx = ((float) Math.random() - 0.5F) * m; - float my = (float) Math.random() * m; - float mz = ((float) Math.random() - 0.5F) * m; - - Botania.proxy.wispFX(item.worldObj, item.posX, tile.getPos().getY() + 0.5F, item.posZ, r, g, b, s, mx, my, mz); - } + PacketHandler.sendToNearby(item.worldObj, item, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BLACK_LOTUS_DISSOLVE, item.posX, tile.getPos().getY() + 0.5, item.posZ)); item.playSound(BotaniaSoundEvents.blackLotus, 0.5F, t2 ? 0.1F : 1F); } diff --git a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java index 37d0c7fb8..a0c6f5b52 100644 --- a/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java +++ b/src/main/java/vazkii/botania/common/network/PacketBotaniaEffect.java @@ -216,6 +216,30 @@ public class PacketBotaniaEffect implements IMessage { } break; } + case ENTROPINNYUM: { + for(int i = 0; i < 50; i++) + Botania.proxy.sparkleFX(world, 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; + float g = 0F; + float b = (float) Math.random() * 0.35F; + float s = 0.45F * (float) Math.random() * 0.25F; + + float m = 0.045F; + float mx = ((float) Math.random() - 0.5F) * m; + float my = (float) Math.random() * m; + float mz = ((float) Math.random() - 0.5F) * m; + + Botania.proxy.wispFX(world, message.x, message.y, message.z, r, g, b, s, mx, my, mz); + } + + break; + } } } }); @@ -233,7 +257,9 @@ public class PacketBotaniaEffect implements IMessage { 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); + ENCHANTER_DESTROY(0), + ENTROPINNYUM(0), + BLACK_LOTUS_DISSOLVE(0); private final int argCount;