From 0755202a3580a702746072483afb1677b70eaef3 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Mon, 4 Apr 2016 13:35:10 -0400 Subject: [PATCH] Fixed custom potion effects so they could be applied server-sided --- changelog.txt | 1 + .../bloodmagic/registry/ModPotions.java | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/changelog.txt b/changelog.txt index 92f2b590..f7513698 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ Version 2.0.0-31 - Soft Fall decreases all fall damage, up to 100% at level 5. - Added increase in speed for Routing nodes inside of a chunk with Demon Aura - Fixed OutOfBoundsException in the Sentient Sword when you didn't have enough Will. +- Fixed custom potion effects so they could be applied server-sided ------------------------------------------------------ Version 2.0.0-30 diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java b/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java index 5922c9a8..d448e8e9 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModPotions.java @@ -1,10 +1,10 @@ package WayofTime.bloodmagic.registry; +import net.minecraft.potion.Potion; +import net.minecraft.util.ResourceLocation; import WayofTime.bloodmagic.api.util.helper.PlayerSacrificeHelper; import WayofTime.bloodmagic.potion.PotionBloodMagic; import WayofTime.bloodmagic.potion.PotionEventHandlers; -import net.minecraft.potion.Potion; -import net.minecraft.util.ResourceLocation; public class ModPotions { @@ -28,17 +28,26 @@ public class ModPotions // drowning = new PotionBloodMagic("Drowning", new // ResourceLocation(resourceLocation + // drowning.getName().toLowerCase()), true, 0, 0, 0); - boost = new PotionBloodMagic("Boost", new ResourceLocation("boost") + boost = registerPotion("Boost", new ResourceLocation("boost"), false, 0xFFFFFF, 0, 0); // new ResourceLocation(resourceLocation + // boost.getName().toLowerCase()) - , false, 0, 0, 0); - whirlwind = new PotionBloodMagic("Whirlwind", new ResourceLocation("whirlwind"), false, 0, 0, 0); - planarBinding = new PotionBloodMagic("Planar Binding", new ResourceLocation("planarBinding"), false, 0, 0, 0); - soulSnare = new PotionBloodMagic("Soul Snare", new ResourceLocation("soulSnare"), false, 0xFFFFFF, 0, 0); - soulFray = new PotionBloodMagic("Soul Fray", new ResourceLocation("soulFray"), true, 0xFFFFFF, 0, 0); + + whirlwind = registerPotion("Whirlwind", new ResourceLocation("whirlwind"), false, 0, 0, 0); + planarBinding = registerPotion("Planar Binding", new ResourceLocation("planarBinding"), false, 0, 0, 0); + soulSnare = registerPotion("Soul Snare", new ResourceLocation("soulSnare"), false, 0xFFFFFF, 0, 0); + soulFray = registerPotion("Soul Fray", new ResourceLocation("soulFray"), true, 0xFFFFFF, 0, 0); PlayerSacrificeHelper.soulFrayId = soulFray; // heavyHeart = new PotionBloodMagic("Heavy Heart", new // ResourceLocation(resourceLocation + // heavyHeart.getName().toLowerCase()), true, 0, 0, 0); } + + protected static Potion registerPotion(String name, ResourceLocation location, boolean badEffect, int potionColour, int x, int y) + { + Potion potion = new PotionBloodMagic(name, location, badEffect, potionColour, x, y); + + Potion.potionRegistry.register(-1, location, potion); + + return potion; + } }