diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index e4ab4ff1f9..f09e767c96 100644 --- a/patches/minecraft/net/minecraft/block/Block.java.patch +++ b/patches/minecraft/net/minecraft/block/Block.java.patch @@ -16,7 +16,15 @@ public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); @Nullable public static final AxisAlignedBB field_185506_k = null; -@@ -307,7 +308,7 @@ +@@ -73,6 +74,7 @@ + public float field_149763_I; + protected final Material field_149764_J; + protected final MapColor field_181083_K; ++ @Deprecated // Forge: State/world/pos/entity sensitive version below + public float field_149765_K; + protected final BlockStateContainer field_176227_L; + private IBlockState field_176228_M; +@@ -307,7 +309,7 @@ public boolean func_176200_f(IBlockAccess p_176200_1_, BlockPos p_176200_2_) { @@ -25,7 +33,7 @@ } public Block func_149711_c(float p_149711_1_) -@@ -345,9 +346,10 @@ +@@ -345,9 +347,10 @@ return this.field_149789_z; } @@ -37,7 +45,7 @@ } @Deprecated -@@ -360,13 +362,13 @@ +@@ -360,13 +363,13 @@ @SideOnly(Side.CLIENT) public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_) { @@ -53,7 +61,7 @@ } else { -@@ -430,7 +432,7 @@ +@@ -430,7 +433,7 @@ } } @@ -62,7 +70,7 @@ } public boolean func_176212_b(IBlockAccess p_176212_1_, BlockPos p_176212_2_, EnumFacing p_176212_3_) -@@ -521,6 +523,10 @@ +@@ -521,6 +524,10 @@ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) { @@ -73,7 +81,7 @@ } public int func_149745_a(Random p_149745_1_) -@@ -536,8 +542,7 @@ +@@ -536,8 +543,7 @@ @Deprecated public float func_180647_a(IBlockState p_180647_1_, EntityPlayer p_180647_2_, World p_180647_3_, BlockPos p_180647_4_) { @@ -83,7 +91,7 @@ } public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) -@@ -547,20 +552,17 @@ +@@ -547,20 +553,17 @@ public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_) { @@ -110,7 +118,7 @@ } } } -@@ -568,8 +570,13 @@ +@@ -568,8 +571,13 @@ public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { @@ -125,7 +133,7 @@ float f = 0.5F; double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * 0.5F) + 0.25D; -@@ -598,6 +605,7 @@ +@@ -598,6 +606,7 @@ return 0; } @@ -133,7 +141,7 @@ public float func_149638_a(Entity p_149638_1_) { return this.field_149781_w / 5.0F; -@@ -636,7 +644,7 @@ +@@ -636,7 +645,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { @@ -142,7 +150,7 @@ } public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumHand p_180639_5_, EnumFacing p_180639_6_, float p_180639_7_, float p_180639_8_, float p_180639_9_) -@@ -648,6 +656,8 @@ +@@ -648,6 +657,8 @@ { } @@ -151,7 +159,7 @@ public IBlockState func_180642_a(World p_180642_1_, BlockPos p_180642_2_, EnumFacing p_180642_3_, float p_180642_4_, float p_180642_5_, float p_180642_6_, int p_180642_7_, EntityLivingBase p_180642_8_) { return this.func_176203_a(p_180642_7_); -@@ -689,21 +699,35 @@ +@@ -689,21 +700,35 @@ p_180657_2_.func_71029_a(StatList.func_188055_a(this)); p_180657_2_.func_71020_j(0.005F); @@ -190,7 +198,7 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -789,6 +813,7 @@ +@@ -789,6 +814,7 @@ p_176216_2_.field_70181_x = 0.0D; } @@ -198,7 +206,7 @@ public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) { return new ItemStack(Item.func_150898_a(this), 1, this.func_180651_a(p_185473_3_)); -@@ -893,6 +918,7 @@ +@@ -893,6 +919,7 @@ } } @@ -206,7 +214,7 @@ public SoundType func_185467_w() { return this.field_149762_H; -@@ -908,6 +934,1217 @@ +@@ -908,6 +935,1254 @@ { } @@ -215,6 +223,43 @@ + protected ThreadLocal harvesters = new ThreadLocal(); + private ThreadLocal silk_check_state = new ThreadLocal(); + protected static java.util.Random RANDOM = new java.util.Random(); // Useful for random things without a seed. ++ ++ /** ++ * Gets the slipperiness at the given location at the given state. Normally ++ * between 0 and 1. ++ *

++ * Note that entities may reduce slipperiness by a certain factor of their own; ++ * for {@link net.minecraft.entity.EntityLivingBase}, this is {@code .91}. ++ * {@link net.minecraft.entity.item.EntityItem} uses {@code .98}, and ++ * {@link net.minecraft.entity.projectile.EntityFishHook} uses {@code .92}. ++ * ++ * @param state state of the block ++ * @param world the world ++ * @param pos the position in the world ++ * @param entity the entity in question ++ * @return the factor by which the entity's motion should be multiplied ++ */ ++ public float getSlipperiness(IBlockState state, IBlockAccess world, BlockPos pos, @Nullable Entity entity) ++ { ++ return field_149765_K; ++ } ++ ++ /** ++ * Sets the base slipperiness level. Normally between 0 and 1. ++ *

++ * Calling this method may have no effect on the function of this block, ++ * or may not have the expected result. This block is free to caclculate ++ * its slipperiness arbitrarily. This method is guaranteed to work on the ++ * base {@code Block} class. ++ * ++ * @param slipperiness the base slipperiness of this block ++ * @see #getSlipperiness(IBlockState, IBlockAccess, BlockPos, Entity) ++ */ ++ public void setDefaultSlipperiness(float slipperiness) ++ { ++ this.field_149765_K = slipperiness; ++ } ++ + /** + * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15 + * @@ -1424,7 +1469,7 @@ public static void func_149671_p() { func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air")); -@@ -1201,14 +2438,7 @@ +@@ -1201,14 +2476,7 @@ } else { diff --git a/patches/minecraft/net/minecraft/entity/EntityFlying.java.patch b/patches/minecraft/net/minecraft/entity/EntityFlying.java.patch new file mode 100644 index 0000000000..6b4ceb1355 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/EntityFlying.java.patch @@ -0,0 +1,24 @@ +--- ../src-base/minecraft/net/minecraft/entity/EntityFlying.java ++++ ../src-work/minecraft/net/minecraft/entity/EntityFlying.java +@@ -44,7 +44,9 @@ + + if (this.field_70122_E) + { +- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F; ++ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); ++ IBlockState underState = this.field_70170_p.func_180495_p(underPos); ++ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F; + } + + float f1 = 0.16277136F / (f * f * f); +@@ -53,7 +55,9 @@ + + if (this.field_70122_E) + { +- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F; ++ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); ++ IBlockState underState = this.field_70170_p.func_180495_p(underPos); ++ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F; + } + + this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y); diff --git a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch index 092240b92d..2c4f87b24a 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -223,7 +223,27 @@ } protected void func_70629_bd() -@@ -1972,6 +2002,7 @@ +@@ -1793,7 +1823,8 @@ + + if (this.field_70122_E) + { +- f6 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos).func_177230_c().field_149765_K * 0.91F; ++ IBlockState underState = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos); ++ f6 = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F; + } + + float f7 = 0.16277136F / (f6 * f6 * f6); +@@ -1813,7 +1844,8 @@ + + if (this.field_70122_E) + { +- f6 = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)).func_177230_c().field_149765_K * 0.91F; ++ IBlockState underState = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos.func_189532_c(this.field_70165_t, this.func_174813_aQ().field_72338_b - 1.0D, this.field_70161_v)); ++ f6 = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, blockpos$pooledmutableblockpos, this) * 0.91F; + } + + if (this.func_70617_f_()) +@@ -1972,6 +2004,7 @@ public void func_70071_h_() { @@ -231,7 +251,7 @@ super.func_70071_h_(); this.func_184608_ct(); -@@ -2015,6 +2046,7 @@ +@@ -2015,6 +2048,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)); @@ -239,7 +259,7 @@ if (!itemstack.func_190926_b()) { -@@ -2488,6 +2520,40 @@ +@@ -2488,6 +2522,40 @@ this.field_70752_e = true; } @@ -280,7 +300,7 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() -@@ -2508,12 +2574,19 @@ +@@ -2508,12 +2576,19 @@ if (itemstack == this.field_184627_bm) { @@ -301,7 +321,7 @@ { this.func_71036_o(); } -@@ -2531,8 +2604,10 @@ +@@ -2531,8 +2606,10 @@ if (!itemstack.func_190926_b() && !this.func_184587_cr()) { @@ -313,7 +333,7 @@ if (!this.field_70170_p.field_72995_K) { -@@ -2613,7 +2688,9 @@ +@@ -2613,7 +2690,9 @@ if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { this.func_184584_a(this.field_184627_bm, 16); @@ -324,7 +344,7 @@ this.func_184602_cy(); } } -@@ -2637,7 +2714,8 @@ +@@ -2637,7 +2716,8 @@ { if (!this.field_184627_bm.func_190926_b()) { @@ -334,7 +354,7 @@ } this.func_184602_cy(); -@@ -2761,4 +2839,29 @@ +@@ -2761,4 +2841,29 @@ { return true; } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityBoat.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityBoat.java.patch new file mode 100644 index 0000000000..15143d0f87 --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/item/EntityBoat.java.patch @@ -0,0 +1,32 @@ +--- ../src-base/minecraft/net/minecraft/entity/item/EntityBoat.java ++++ ../src-work/minecraft/net/minecraft/entity/item/EntityBoat.java +@@ -476,7 +476,7 @@ + + if (!list.isEmpty()) + { +- f += iblockstate.func_177230_c().field_149765_K; ++ f += iblockstate.func_177230_c().getSlipperiness(iblockstate, this.field_70170_p, blockpos$pooledmutableblockpos, this); + ++k1; + } + +@@ -948,4 +948,20 @@ + return values()[0]; + } + } ++ ++ // Forge: Fix MC-119811 by instantly completing lerp on board ++ @Override ++ protected void func_184200_o(Entity passenger) ++ { ++ super.func_184200_o(passenger); ++ if(this.func_184186_bw() && this.field_184476_at > 0) ++ { ++ this.field_184476_at = 0; ++ this.field_70165_t = this.field_70281_h; ++ this.field_70163_u = this.field_184477_av; ++ this.field_70161_v = this.field_184478_aw; ++ this.field_70177_z = (float)this.field_70273_g; ++ this.field_70125_A = (float)this.field_184479_ay; ++ } ++ } + } diff --git a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch index 8bba8e8265..4e94bc8152 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityItem.java.patch @@ -28,7 +28,18 @@ if (this.func_92059_d().func_190926_b()) { this.func_70106_y(); -@@ -169,8 +176,16 @@ +@@ -137,7 +144,9 @@ + + if (this.field_70122_E) + { +- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.98F; ++ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); ++ net.minecraft.block.state.IBlockState underState = this.field_70170_p.func_180495_p(underPos); ++ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.98F; + } + + this.field_70159_w *= (double)f; +@@ -169,8 +178,16 @@ } } @@ -46,7 +57,7 @@ this.func_70106_y(); } } -@@ -227,6 +242,10 @@ +@@ -227,6 +244,10 @@ { return false; } @@ -57,7 +68,7 @@ else { itemstack1.func_190917_f(itemstack.func_190916_E()); -@@ -284,6 +303,7 @@ +@@ -284,6 +305,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -65,7 +76,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -316,6 +336,7 @@ +@@ -316,6 +338,7 @@ p_70014_1_.func_74777_a("Health", (short)this.field_70291_e); p_70014_1_.func_74777_a("Age", (short)this.field_70292_b); p_70014_1_.func_74777_a("PickupDelay", (short)this.field_145804_b); @@ -73,7 +84,7 @@ if (this.func_145800_j() != null) { -@@ -360,17 +381,22 @@ +@@ -360,17 +383,22 @@ { this.func_70106_y(); } @@ -97,7 +108,7 @@ { if (item == Item.func_150898_a(Blocks.field_150364_r)) { -@@ -407,6 +433,7 @@ +@@ -407,6 +435,7 @@ } } @@ -105,7 +116,7 @@ p_70100_1_.func_71001_a(this, i); if (itemstack.func_190926_b()) -@@ -513,6 +540,6 @@ +@@ -513,6 +542,6 @@ public void func_174870_v() { this.func_174871_r(); diff --git a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch index dd711a57d5..8440a707e1 100644 --- a/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch +++ b/patches/minecraft/net/minecraft/entity/item/EntityXPOrb.java.patch @@ -1,6 +1,17 @@ --- ../src-base/minecraft/net/minecraft/entity/item/EntityXPOrb.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityXPOrb.java -@@ -170,6 +170,7 @@ +@@ -137,7 +137,9 @@ + + if (this.field_70122_E) + { +- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.98F; ++ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v)); ++ net.minecraft.block.state.IBlockState underState = this.field_70170_p.func_180495_p(underPos); ++ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.98F; + } + + this.field_70159_w *= (double)f; +@@ -170,6 +172,7 @@ public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) { @@ -8,7 +19,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; -@@ -208,6 +209,7 @@ +@@ -208,6 +211,7 @@ { if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) { diff --git a/src/test/java/net/minecraftforge/debug/SlipperinessTest.java b/src/test/java/net/minecraftforge/debug/SlipperinessTest.java new file mode 100644 index 0000000000..76fa5ff8f5 --- /dev/null +++ b/src/test/java/net/minecraftforge/debug/SlipperinessTest.java @@ -0,0 +1,42 @@ +package net.minecraftforge.debug; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventBusSubscriber; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +@Mod(modid = "slipperiness_test", name = "Slipperiness Test", version = "0.0.0") +@EventBusSubscriber +public class SlipperinessTest +{ + public static final Block BB_BLOCK = new Block(Material.PACKED_ICE) + { + @Override + public float getSlipperiness(IBlockState state, IBlockAccess world, BlockPos pos, Entity entity) + { + return entity instanceof EntityBoat ? 2 : super.getSlipperiness(state, world, pos, entity); + } + }.setUnlocalizedName("boat_blaster").setRegistryName("boat_blaster"); + + @SubscribeEvent + public static void registerBlocks(RegistryEvent.Register e) + { + e.getRegistry().register(BB_BLOCK); + } + + @SubscribeEvent + public static void registerItems(RegistryEvent.Register e) + { + e.getRegistry().register(new ItemBlock(BB_BLOCK).setRegistryName(BB_BLOCK.getRegistryName())); + } +} +