diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 1a7edb72b..7bfdbcf4b 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -39,7 +39,20 @@ } public EntityLivingBase func_110144_aD() -@@ -812,6 +814,8 @@ +@@ -668,8 +670,10 @@ + else + { + Collection collection = this.field_70713_bf.values(); +- this.field_70180_af.func_187227_b(field_184634_g, Boolean.valueOf(func_184593_a(collection))); +- this.field_70180_af.func_187227_b(field_184633_f, Integer.valueOf(PotionUtils.func_185181_a(collection))); ++ net.minecraftforge.event.entity.living.PotionColorCalculationEvent event = new net.minecraftforge.event.entity.living.PotionColorCalculationEvent(this, PotionUtils.func_185181_a(collection), func_184593_a(collection), collection); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event); ++ this.field_70180_af.func_187227_b(field_184634_g, event.areParticlesHidden()); ++ this.field_70180_af.func_187227_b(field_184633_f, event.getColor()); + this.func_82142_c(this.func_70644_a(MobEffects.field_76441_p)); + } + } +@@ -812,6 +816,8 @@ public void func_70691_i(float p_70691_1_) { @@ -48,7 +61,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) -@@ -832,6 +836,7 @@ +@@ -832,6 +838,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -56,7 +69,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -918,9 +923,9 @@ +@@ -918,9 +925,9 @@ this.field_70718_bc = 100; this.field_70717_bb = (EntityPlayer)entity1; } @@ -68,7 +81,7 @@ if (entitywolf.func_70909_n()) { -@@ -1107,6 +1112,7 @@ +@@ -1107,6 +1114,7 @@ public void func_70645_a(DamageSource p_70645_1_) { @@ -76,7 +89,7 @@ if (!this.field_70729_aU) { Entity entity = p_70645_1_.func_76346_g(); -@@ -1127,18 +1133,26 @@ +@@ -1127,18 +1135,26 @@ if (!this.field_70170_p.field_72995_K) { @@ -108,7 +121,7 @@ } this.field_70170_p.func_72960_a(this, (byte)3); -@@ -1215,7 +1229,7 @@ +@@ -1215,7 +1231,7 @@ BlockPos blockpos = new BlockPos(i, j, k); IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); Block block = iblockstate.func_177230_c(); @@ -117,7 +130,7 @@ } } -@@ -1241,6 +1255,9 @@ +@@ -1241,6 +1257,9 @@ public void func_180430_e(float p_180430_1_, float p_180430_2_) { @@ -127,7 +140,7 @@ super.func_180430_e(p_180430_1_, p_180430_2_); PotionEffect potioneffect = this.func_70660_b(MobEffects.field_76430_j); float f = potioneffect == null ? 0.0F : (float)(potioneffect.func_76458_c() + 1); -@@ -1257,7 +1274,7 @@ +@@ -1257,7 +1276,7 @@ if (iblockstate.func_185904_a() != Material.field_151579_a) { @@ -136,7 +149,7 @@ this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F); } } -@@ -1334,6 +1351,8 @@ +@@ -1334,6 +1353,8 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -145,7 +158,7 @@ p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_); p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_); float f = p_70665_2_; -@@ -1383,6 +1402,11 @@ +@@ -1383,6 +1404,11 @@ public void func_184609_a(EnumHand p_184609_1_) { @@ -157,7 +170,7 @@ if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0) { this.field_110158_av = -1; -@@ -1613,7 +1637,7 @@ +@@ -1613,7 +1639,7 @@ if (!this.field_70170_p.func_184143_b(axisalignedbb1)) { @@ -166,7 +179,7 @@ { this.func_70634_a(d11, this.field_70163_u + 1.0D, d12); return; -@@ -1621,14 +1645,14 @@ +@@ -1621,14 +1647,14 @@ BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12); @@ -183,7 +196,7 @@ { d1 = d11; d13 = this.field_70163_u + 2.0D; -@@ -1700,6 +1724,7 @@ +@@ -1700,6 +1726,7 @@ } this.field_70160_al = true; @@ -191,7 +204,7 @@ } protected void func_70629_bd() -@@ -1972,6 +1997,7 @@ +@@ -1972,6 +1999,7 @@ public void func_70071_h_() { @@ -199,7 +212,7 @@ super.func_70071_h_(); this.func_184608_ct(); -@@ -2015,6 +2041,7 @@ +@@ -2015,6 +2043,7 @@ if (!ItemStack.func_77989_b(itemstack1, itemstack)) { ((WorldServer)this.field_70170_p).func_73039_n().func_151247_a(this, new SPacketEntityEquipment(this.func_145782_y(), entityequipmentslot, itemstack1)); @@ -207,7 +220,7 @@ if (!itemstack.func_190926_b()) { -@@ -2488,6 +2515,40 @@ +@@ -2488,6 +2517,40 @@ this.field_70752_e = true; } @@ -248,7 +261,7 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() -@@ -2508,12 +2569,19 @@ +@@ -2508,12 +2571,19 @@ if (itemstack == this.field_184627_bm) { @@ -269,7 +282,7 @@ { this.func_71036_o(); } -@@ -2531,8 +2599,10 @@ +@@ -2531,8 +2601,10 @@ if (!itemstack.func_190926_b() && !this.func_184587_cr()) { @@ -281,7 +294,7 @@ if (!this.field_70170_p.field_72995_K) { -@@ -2613,7 +2683,9 @@ +@@ -2613,7 +2685,9 @@ if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { this.func_184584_a(this.field_184627_bm, 16); @@ -292,7 +305,7 @@ this.func_184602_cy(); } } -@@ -2637,7 +2709,8 @@ +@@ -2637,7 +2711,8 @@ { if (!this.field_184627_bm.func_190926_b()) { @@ -302,7 +315,7 @@ } this.func_184602_cy(); -@@ -2761,4 +2834,29 @@ +@@ -2761,4 +2836,29 @@ { return true; } diff --git a/src/main/java/net/minecraftforge/event/entity/living/PotionColorCalculationEvent.java b/src/main/java/net/minecraftforge/event/entity/living/PotionColorCalculationEvent.java new file mode 100644 index 000000000..f80865a1c --- /dev/null +++ b/src/main/java/net/minecraftforge/event/entity/living/PotionColorCalculationEvent.java @@ -0,0 +1,78 @@ +/* + * Minecraft Forge + * Copyright (c) 2016. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package net.minecraftforge.event.entity.living; + +import java.util.Collection; +import java.util.Collections; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.potion.PotionEffect; + +/** + * Fires after Potion Color Calculation. + * + * this event is not {@link Cancelable} + * + * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + */ +public class PotionColorCalculationEvent extends LivingEvent +{ + private int color; + private boolean hideParticle; + private final Collection effectList; + + public PotionColorCalculationEvent(EntityLivingBase entity, int color, boolean hideParticle, + Collection effectList) + { + super(entity); + this.color = color; + this.effectList = effectList; + this.hideParticle = hideParticle; + } + + public int getColor() + { + return color; + } + + public void setColor(int color) + { + this.color = color; + } + + public boolean areParticlesHidden() + { + return hideParticle; + } + + public void shouldHideParticles(boolean hideParticle) + { + this.hideParticle = hideParticle; + } + + /** + * Note that returned list is unmodifiable. + * + * @return effects + */ + public Collection getEffects() + { + return Collections.unmodifiableCollection(effectList); + } +} \ No newline at end of file