From a319adba53dc3557b5552fda253ac00adab08401 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sun, 13 Dec 2015 15:35:15 -0600 Subject: [PATCH] Added addLandingEffects allowing mods to override landing particles, for blocks that require world information to determine textures. --- .../net/minecraft/block/Block.java.patch | 19 +++++++- .../entity/EntityLivingBase.java.patch | 46 +++++++++++-------- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index 737fdf5b4..d871f030a 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -188,7 +188,7 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -1010,6 +1030,1045 @@ +@@ -1010,6 +1030,1062 @@ return "Block{" + field_149771_c.func_177774_c(this) + "}"; } @@ -807,6 +807,23 @@ + } + + /** ++ * Allows a block to override the standard EntityLivingBase.updateFallState ++ * particles, this is a server side method that spawns particles with ++ * WorldServer.spawnParticle ++ * ++ * @param world The current Server world ++ * @param blockPosition of the block that the entity landed on. ++ * @param iblockstate State at the specific world/pos ++ * @param entity the entity that hit landed on the block. ++ * @param numberOfParticles that vanilla would have spawned. ++ * @return True to prevent vanilla landing particles form spawning. ++ */ ++ public boolean addLandingEffects(net.minecraft.world.WorldServer worldObj, BlockPos blockPosition, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles ) ++ { ++ return false; ++ } ++ ++ /** + * Spawn a digging particle effect in the world, this is a wrapper + * around EffectRenderer.addBlockHitEffects to allow the block more + * control over the particles. Useful when you have entirely different diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 945d7ebcc..7906ba9b3 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -1,6 +1,14 @@ --- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java +++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java -@@ -237,7 +237,7 @@ +@@ -170,6 +170,7 @@ + } + + int i = (int)(150.0D * d0); ++ if ( !block.addLandingEffects( (WorldServer)this.field_70170_p, p_180433_5_, iblockstate, this, i ) ) + ((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.BLOCK_DUST, this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.func_176210_f(iblockstate)}); + } + } +@@ -237,7 +238,7 @@ } } @@ -9,7 +17,7 @@ { this.func_70078_a((Entity)null); } -@@ -319,7 +319,7 @@ +@@ -319,7 +320,7 @@ if (!this.field_70170_p.field_72995_K && (this.field_70718_bc > 0 || this.func_70684_aJ()) && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { int i = this.func_70693_a(this.field_70717_bb); @@ -18,7 +26,7 @@ while (i > 0) { int j = EntityXPOrb.func_70527_a(i); -@@ -380,6 +380,7 @@ +@@ -380,6 +381,7 @@ { this.field_70755_b = p_70604_1_; this.field_70756_c = this.field_70173_aa; @@ -26,7 +34,7 @@ } public EntityLivingBase func_110144_aD() -@@ -663,7 +664,6 @@ +@@ -663,7 +665,6 @@ return this.func_70668_bt() == EnumCreatureAttribute.UNDEAD; } @@ -34,7 +42,7 @@ public void func_70618_n(int p_70618_1_) { this.field_70713_bf.remove(Integer.valueOf(p_70618_1_)); -@@ -712,6 +712,8 @@ +@@ -712,6 +713,8 @@ public void func_70691_i(float p_70691_1_) { @@ -43,7 +51,7 @@ float f = this.func_110143_aJ(); if (f > 0.0F) -@@ -732,6 +734,7 @@ +@@ -732,6 +735,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -51,7 +59,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -797,9 +800,9 @@ +@@ -797,9 +801,9 @@ this.field_70718_bc = 100; this.field_70717_bb = (EntityPlayer)entity; } @@ -63,7 +71,7 @@ if (entitywolf.func_70909_n()) { -@@ -883,6 +886,7 @@ +@@ -883,6 +887,7 @@ public void func_70645_a(DamageSource p_70645_1_) { @@ -71,7 +79,7 @@ Entity entity = p_70645_1_.func_76346_g(); EntityLivingBase entitylivingbase = this.func_94060_bK(); -@@ -908,6 +912,9 @@ +@@ -908,6 +913,9 @@ i = EnchantmentHelper.func_77519_f((EntityLivingBase)entity); } @@ -81,7 +89,7 @@ if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")) { this.func_70628_a(this.field_70718_bc > 0, i); -@@ -918,6 +925,16 @@ +@@ -918,6 +926,16 @@ this.func_82164_bB(); } } @@ -98,7 +106,7 @@ } this.field_70170_p.func_72960_a(this, (byte)3); -@@ -972,7 +989,7 @@ +@@ -972,7 +990,7 @@ int j = MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b); int k = MathHelper.func_76128_c(this.field_70161_v); Block block = this.field_70170_p.func_180495_p(new BlockPos(i, j, k)).func_177230_c(); @@ -107,7 +115,7 @@ } public boolean func_70089_S() -@@ -982,6 +999,9 @@ +@@ -982,6 +1000,9 @@ public void func_180430_e(float p_180430_1_, float p_180430_2_) { @@ -117,7 +125,7 @@ super.func_180430_e(p_180430_1_, p_180430_2_); PotionEffect potioneffect = this.func_70660_b(Potion.field_76430_j); float f = potioneffect != null ? (float)(potioneffect.func_76458_c() + 1) : 0.0F; -@@ -1094,6 +1114,8 @@ +@@ -1094,6 +1115,8 @@ { if (!this.func_180431_b(p_70665_1_)) { @@ -126,7 +134,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_; -@@ -1142,6 +1164,11 @@ +@@ -1142,6 +1165,11 @@ public void func_71038_i() { @@ -138,7 +146,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; -@@ -1281,6 +1308,7 @@ +@@ -1281,6 +1309,7 @@ public void func_110145_l(Entity p_110145_1_) { @@ -146,7 +154,7 @@ double d0 = p_110145_1_.field_70165_t; double d1 = p_110145_1_.func_174813_aQ().field_72338_b + (double)p_110145_1_.field_70131_O; double d2 = p_110145_1_.field_70161_v; -@@ -1346,6 +1374,7 @@ +@@ -1346,6 +1375,7 @@ } this.field_70160_al = true; @@ -154,7 +162,7 @@ } protected void func_70629_bd() -@@ -1530,6 +1559,7 @@ +@@ -1530,6 +1560,7 @@ public void func_70071_h_() { @@ -162,7 +170,7 @@ super.func_70071_h_(); if (!this.field_70170_p.field_72995_K) -@@ -1817,6 +1847,7 @@ +@@ -1817,6 +1848,7 @@ public void func_70078_a(Entity p_70078_1_) { @@ -170,7 +178,7 @@ if (this.field_70154_o != null && p_70078_1_ == null) { if (!this.field_70170_p.field_72995_K) -@@ -1998,4 +2029,39 @@ +@@ -1998,4 +2030,39 @@ { this.field_70752_e = true; }