From fa154993885190d74a264f2e2525877b6cb41a62 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Tue, 19 Jan 2016 22:03:46 -0500 Subject: [PATCH] Added particles to the Blood Altar. --- changelog.txt | 1 + .../bloodmagic/altar/BloodAltar.java | 35 ++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/changelog.txt b/changelog.txt index 0ed03728..9f143d03 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Version 2.0.0-7 ------------------------------------------------------ - [API] Method to easily get instances of Items and Blocks - JEI now displays more information for Altar recipes. Hover over the Altar image to view it. +- Added particles to the Blood Altar on the server-side. ------------------------------------------------------ Version 2.0.0-6 diff --git a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java index 8b85a44d..a0d15aab 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java @@ -9,6 +9,7 @@ import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; +import net.minecraft.world.WorldServer; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; import WayofTime.bloodmagic.api.BlockStack; @@ -392,11 +393,6 @@ public class BloodAltar if (world.isRemote) return; - float f = 1.0F; - float f1 = f * 0.6F + 0.4F; - float f2 = f * f * 0.7F - 0.5F; - float f3 = f * f * 0.6F - 0.7F; - if (!canBeFilled) { boolean hasOperated = false; @@ -423,15 +419,21 @@ public class BloodAltar hasOperated = true; - if (internalCounter % 4 == 0) - world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3); + if (internalCounter % 4 == 0 && world instanceof WorldServer) + { + WorldServer server = (WorldServer) world; + server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.2, 0, 0.2, 0, new int[0]); + } } else if (!hasOperated && progress > 0) { progress -= (int) (efficiencyMultiplier * drainRate); - if (internalCounter % 2 == 0) - world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3); + if (internalCounter % 2 == 0 && world instanceof WorldServer) + { + WorldServer server = (WorldServer) world; + server.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.1, 0, 0.1, 0, new int[0]); + } } if (hasOperated) @@ -446,9 +448,13 @@ public class BloodAltar tileAltar.setInventorySlotContents(0, result); progress = 0; - for (int i = 0; i < 8; i++) - world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3); + if (world instanceof WorldServer) + { + WorldServer server = (WorldServer) world; + server.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 40, 0.3, 0, 0.3, 0, new int[0]); + } + this.cooldownAfterCrafting = 100; this.isActive = false; } } @@ -478,8 +484,11 @@ public class BloodAltar fluid.amount = fluid.amount - drain; - if (internalCounter % 4 == 0) - world.spawnParticle(EnumParticleTypes.REDSTONE, pos.getX() + Math.random() - Math.random(), pos.getY() + Math.random() - Math.random(), pos.getZ() + Math.random() - Math.random(), f1, f2, f3); + if (drain > 0 && internalCounter % 4 == 0 && world instanceof WorldServer) + { + WorldServer server = (WorldServer) world; + server.spawnParticle(EnumParticleTypes.SPELL_WITCH, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.001, new int[] {}); + } } }