diff --git a/patches/minecraft/net/minecraft/block/Block.java.patch b/patches/minecraft/net/minecraft/block/Block.java.patch index ab5d77d8d9..cca97972e4 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; -@@ -319,7 +320,7 @@ +@@ -75,6 +76,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; +@@ -319,7 +321,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_) -@@ -357,9 +358,10 @@ +@@ -357,9 +359,10 @@ return this.field_149789_z; } @@ -37,7 +45,7 @@ } @Deprecated -@@ -372,13 +374,13 @@ +@@ -372,13 +375,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 { -@@ -442,7 +444,7 @@ +@@ -442,7 +445,7 @@ } } @@ -62,7 +70,7 @@ } @Deprecated -@@ -534,6 +536,10 @@ +@@ -534,6 +537,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_) -@@ -549,16 +555,7 @@ +@@ -549,16 +556,7 @@ @Deprecated public float func_180647_a(IBlockState p_180647_1_, EntityPlayer p_180647_2_, World p_180647_3_, BlockPos p_180647_4_) { @@ -91,7 +99,7 @@ } public final void func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_) -@@ -568,20 +565,16 @@ +@@ -568,20 +566,16 @@ 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_) { @@ -117,7 +125,7 @@ } } } -@@ -589,8 +582,13 @@ +@@ -589,8 +583,13 @@ public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) { @@ -132,7 +140,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; -@@ -619,6 +617,7 @@ +@@ -619,6 +618,7 @@ return 0; } @@ -140,7 +148,7 @@ public float func_149638_a(Entity p_149638_1_) { return this.field_149781_w / 5.0F; -@@ -657,7 +656,7 @@ +@@ -657,7 +657,7 @@ public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_) { @@ -149,7 +157,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_) -@@ -669,6 +668,8 @@ +@@ -669,6 +669,8 @@ { } @@ -158,7 +166,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_); -@@ -710,21 +711,35 @@ +@@ -710,21 +712,35 @@ p_180657_2_.func_71029_a(StatList.func_188055_a(this)); p_180657_2_.func_71020_j(0.005F); @@ -197,7 +205,7 @@ } protected ItemStack func_180643_i(IBlockState p_180643_1_) -@@ -810,12 +825,12 @@ +@@ -810,12 +826,12 @@ p_176216_2_.field_70181_x = 0.0D; } @@ -211,7 +219,7 @@ public void func_149666_a(CreativeTabs p_149666_1_, NonNullList p_149666_2_) { p_149666_2_.add(new ItemStack(this)); -@@ -831,7 +846,6 @@ +@@ -831,7 +847,6 @@ { } @@ -219,7 +227,7 @@ public CreativeTabs func_149708_J() { return this.field_149772_a; -@@ -921,6 +935,7 @@ +@@ -921,6 +936,7 @@ } } @@ -227,7 +235,7 @@ public SoundType func_185467_w() { return this.field_149762_H; -@@ -936,6 +951,1250 @@ +@@ -936,6 +952,1287 @@ { } @@ -236,6 +244,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 this block, taking into account the given state and coordinates, normal ranges are between 0 and 15 + * @@ -1478,7 +1523,7 @@ public static void func_149671_p() { func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air")); -@@ -1232,31 +2491,6 @@ +@@ -1232,31 +2529,6 @@ block15.field_149783_u = flag; } } 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 a5dc1bd3fc..26b82f6f31 100644 --- a/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch +++ b/patches/minecraft/net/minecraft/entity/EntityLivingBase.java.patch @@ -232,7 +232,27 @@ } protected void func_70629_bd() -@@ -2054,6 +2077,7 @@ +@@ -1874,7 +1897,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); +@@ -1894,7 +1918,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_()) +@@ -2054,6 +2079,7 @@ public void func_70071_h_() { @@ -240,7 +260,7 @@ super.func_70071_h_(); this.func_184608_ct(); -@@ -2096,7 +2120,9 @@ +@@ -2096,7 +2122,9 @@ if (!ItemStack.func_77989_b(itemstack1, itemstack)) { @@ -250,7 +270,7 @@ if (!itemstack.func_190926_b()) { -@@ -2575,6 +2601,40 @@ +@@ -2575,6 +2603,40 @@ this.field_70752_e = true; } @@ -291,7 +311,7 @@ public abstract EnumHandSide func_184591_cq(); public boolean func_184587_cr() -@@ -2595,12 +2655,19 @@ +@@ -2595,12 +2657,19 @@ if (itemstack == this.field_184627_bm) { @@ -312,7 +332,7 @@ { this.func_71036_o(); } -@@ -2618,8 +2685,10 @@ +@@ -2618,8 +2687,10 @@ if (!itemstack.func_190926_b() && !this.func_184587_cr()) { @@ -324,7 +344,7 @@ if (!this.field_70170_p.field_72995_K) { -@@ -2700,7 +2769,9 @@ +@@ -2700,7 +2771,9 @@ if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr()) { this.func_184584_a(this.field_184627_bm, 16); @@ -335,7 +355,7 @@ this.func_184602_cy(); } } -@@ -2724,7 +2795,8 @@ +@@ -2724,7 +2797,8 @@ { if (!this.field_184627_bm.func_190926_b()) { @@ -345,7 +365,7 @@ } this.func_184602_cy(); -@@ -2852,6 +2924,31 @@ +@@ -2852,6 +2926,31 @@ 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..46a988983c --- /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 +@@ -508,7 +508,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; + } + +@@ -980,4 +980,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 75fa7b08e7..1eb7106fc6 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(); -@@ -167,8 +174,16 @@ +@@ -135,7 +142,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; +@@ -167,8 +176,16 @@ } } @@ -46,7 +57,7 @@ this.func_70106_y(); } } -@@ -225,6 +240,10 @@ +@@ -225,6 +242,10 @@ { return false; } @@ -57,7 +68,7 @@ else { itemstack1.func_190917_f(itemstack.func_190916_E()); -@@ -282,6 +301,7 @@ +@@ -282,6 +303,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; -@@ -314,6 +334,7 @@ +@@ -314,6 +336,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) { -@@ -358,18 +379,24 @@ +@@ -358,18 +381,24 @@ { this.func_70106_y(); } @@ -99,7 +110,7 @@ p_70100_1_.func_71001_a(this, i); if (itemstack.func_190926_b()) -@@ -476,6 +503,6 @@ +@@ -476,6 +505,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())); + } +} +