More patchwork.
This commit is contained in:
parent
acb7acd661
commit
b6ddb0a7cf
52 changed files with 1614 additions and 83 deletions
|
@ -64,7 +64,7 @@
|
|||
public int func_196264_a(IBlockState p_196264_1_, Random p_196264_2_) {
|
||||
return 1;
|
||||
}
|
||||
@@ -502,30 +509,27 @@
|
||||
@@ -502,30 +509,30 @@
|
||||
if (f == -1.0F) {
|
||||
return 0.0F;
|
||||
} else {
|
||||
|
@ -87,13 +87,15 @@
|
|||
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(item));
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ if (!p_196255_2_.field_72995_K && !p_196255_2_.restoringBlockSnapshots) { // do not drop items while restoring blockstates, prevents item dupe
|
||||
+ NonNullList<ItemStack> drops = NonNullList.func_191196_a();
|
||||
+ getDrops(p_196255_1_, drops, p_196255_2_, p_196255_3_, p_196255_5_); // use the old method until it gets removed, for backward compatibility
|
||||
+ getDrops(p_196255_1_, drops, p_196255_2_, p_196255_3_, p_196255_5_);
|
||||
+ p_196255_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(drops, p_196255_2_, p_196255_3_, p_196255_1_, p_196255_5_, p_196255_4_, false, harvesters.get());
|
||||
+ drops.forEach(stack -> func_180635_a(p_196255_2_, p_196255_3_, stack));
|
||||
+ for (ItemStack stack : drops) {
|
||||
+ if (p_196255_2_.field_73012_v.nextFloat() <= p_196255_4_)
|
||||
+ func_180635_a(p_196255_2_, p_196255_3_, stack);
|
||||
}
|
||||
-
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +109,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;
|
||||
@@ -547,6 +551,7 @@
|
||||
@@ -547,6 +554,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -115,7 +117,7 @@
|
|||
public float func_149638_a() {
|
||||
return this.field_149781_w;
|
||||
}
|
||||
@@ -615,16 +620,22 @@
|
||||
@@ -615,16 +623,22 @@
|
||||
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
|
||||
p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
|
||||
p_180657_2_.func_71020_j(0.005F);
|
||||
|
@ -140,7 +142,7 @@
|
|||
protected boolean func_149700_E() {
|
||||
return this.func_176223_P().func_185917_h() && !this.func_149716_u();
|
||||
}
|
||||
@@ -681,6 +692,7 @@
|
||||
@@ -681,6 +695,7 @@
|
||||
p_176216_2_.field_70181_x = 0.0D;
|
||||
}
|
||||
|
||||
|
@ -148,7 +150,7 @@
|
|||
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_) {
|
||||
return new ItemStack(this);
|
||||
}
|
||||
@@ -755,6 +767,7 @@
|
||||
@@ -755,6 +770,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +158,7 @@
|
|||
public SoundType func_185467_w() {
|
||||
return this.field_149762_H;
|
||||
}
|
||||
@@ -1147,7 +1160,7 @@
|
||||
@@ -1147,7 +1163,7 @@
|
||||
func_196254_a("chiseled_quartz_block", new Block(Block.Builder.func_200949_a(Material.field_151576_e, MapColor.field_151677_p).func_200943_b(0.8F)));
|
||||
func_196254_a("quartz_pillar", new BlockRotatedPillar(Block.Builder.func_200949_a(Material.field_151576_e, MapColor.field_151677_p).func_200943_b(0.8F)));
|
||||
func_196254_a("quartz_stairs", new BlockStairs(block42.func_176223_P(), Block.Builder.func_200950_a(block42)));
|
||||
|
@ -165,7 +167,7 @@
|
|||
func_196254_a("dropper", new BlockDropper(Block.Builder.func_200945_a(Material.field_151576_e).func_200943_b(3.5F)));
|
||||
func_196254_a("white_terracotta", new Block(Block.Builder.func_200949_a(Material.field_151576_e, MapColor.field_193561_M).func_200948_a(1.25F, 4.2F)));
|
||||
func_196254_a("orange_terracotta", new Block(Block.Builder.func_200949_a(Material.field_151576_e, MapColor.field_193562_N).func_200948_a(1.25F, 4.2F)));
|
||||
@@ -1604,4 +1617,83 @@
|
||||
@@ -1604,4 +1620,83 @@
|
||||
return Objects.hash(this.field_212164_a, this.field_212165_b, this.field_212166_c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
--- a/net/minecraft/block/BlockAbstractSkull.java
|
||||
+++ b/net/minecraft/block/BlockAbstractSkull.java
|
||||
@@ -38,6 +38,7 @@
|
||||
}
|
||||
|
||||
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
|
||||
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
|
||||
}
|
||||
|
||||
public void func_176208_a(World p_176208_1_, BlockPos p_176208_2_, IBlockState p_176208_3_, EntityPlayer p_176208_4_) {
|
||||
@@ -45,6 +46,7 @@
|
||||
TileEntitySkull.func_195486_a(p_176208_1_, p_176208_2_);
|
||||
}
|
||||
|
||||
+ this.func_196255_a(p_176208_3_, p_176208_1_, p_176208_2_, 1.0f, 0);
|
||||
super.func_176208_a(p_176208_1_, p_176208_2_, p_176208_3_, p_176208_4_);
|
||||
}
|
||||
|
||||
@@ -55,7 +57,7 @@
|
||||
public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) {
|
||||
if (p_196243_1_.func_177230_c() != p_196243_4_.func_177230_c() && !p_196243_2_.field_72995_K) {
|
||||
TileEntity tileentity = p_196243_2_.func_175625_s(p_196243_3_);
|
||||
- if (tileentity instanceof TileEntitySkull) {
|
||||
+ if (false && tileentity instanceof TileEntitySkull) { //Forge: Moved to getDrops
|
||||
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
|
||||
if (tileentityskull.func_195487_d()) {
|
||||
ItemStack itemstack = this.func_185473_a(p_196243_2_, p_196243_3_, p_196243_1_);
|
||||
@@ -74,6 +76,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
+ TileEntity te = world.func_175625_s(pos);
|
||||
+ if (te instanceof TileEntitySkull) {
|
||||
+ TileEntitySkull skull = (TileEntitySkull)te;
|
||||
+ if (skull.func_195487_d()) {
|
||||
+ ItemStack ret = func_185473_a(world, pos, state);
|
||||
+ Block block = skull.func_195044_w().func_177230_c();
|
||||
+ if ((block == Blocks.field_196710_eS || block == Blocks.field_196709_eR) && skull.func_152108_a() != null) {
|
||||
+ NBTTagCompound nbt = new NBTTagCompound();
|
||||
+ NBTUtil.func_180708_a(nbt, skull.func_152108_a());
|
||||
+ ret.func_196082_o().func_74782_a("SkullOwner", nbt);
|
||||
+ }
|
||||
+ drops.add(ret);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public BlockSkull.ISkullType func_196292_N_() {
|
||||
return this.field_196293_a;
|
|
@ -9,17 +9,12 @@
|
|||
protected static final VoxelShape field_196397_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
|
||||
|
||||
protected BlockDeadBush(Block.Builder p_i48418_1_) {
|
||||
@@ -46,4 +46,14 @@
|
||||
@@ -46,4 +46,9 @@
|
||||
|
||||
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, flag ? Blocks.field_150350_a.func_176223_P() : p_180657_4_, p_180657_5_, p_180657_6_);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isShearable(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) {
|
||||
+ return java.util.Arrays.asList(new ItemStack(Blocks.field_196555_aI));
|
||||
+ }
|
||||
|
|
|
@ -22,6 +22,15 @@
|
|||
}
|
||||
|
||||
public IBlockState func_196271_a(IBlockState p_196271_1_, EnumFacing p_196271_2_, IBlockState p_196271_3_, IWorld p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
|
||||
@@ -80,7 +77,7 @@
|
||||
p_196271_4_.func_205219_F_().func_205360_a(p_196271_5_, Fluids.field_204546_a, Fluids.field_204546_a.func_205569_a(p_196271_4_));
|
||||
}
|
||||
|
||||
- return p_196271_2_.func_176740_k().func_176716_d() == EnumFacing.Plane.HORIZONTAL ? (IBlockState)p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.func_196416_a(p_196271_3_, p_196271_3_.func_193401_d(p_196271_4_, p_196271_6_, p_196271_2_.func_176734_d())))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
|
||||
+ return p_196271_2_.func_176740_k().func_176716_d() == EnumFacing.Plane.HORIZONTAL ? (IBlockState)p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.canFenceConnectTo(p_196271_4_, p_196271_5_, p_196271_2_))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
|
||||
}
|
||||
|
||||
protected void func_206840_a(StateContainer.Builder<Block, IBlockState> p_206840_1_) {
|
||||
@@ -90,4 +87,16 @@
|
||||
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
|
||||
return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE : BlockFaceShape.CENTER;
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
--- a/net/minecraft/block/BlockIronBars.java
|
||||
+++ b/net/minecraft/block/BlockIronBars.java
|
||||
@@ -25,15 +25,12 @@
|
||||
IBlockReader iblockreader = p_196258_1_.func_195991_k();
|
||||
BlockPos blockpos = p_196258_1_.func_195995_a();
|
||||
IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a());
|
||||
- BlockPos blockpos1 = blockpos.func_177978_c();
|
||||
- BlockPos blockpos2 = blockpos.func_177968_d();
|
||||
- BlockPos blockpos3 = blockpos.func_177976_e();
|
||||
- BlockPos blockpos4 = blockpos.func_177974_f();
|
||||
- IBlockState iblockstate = iblockreader.func_180495_p(blockpos1);
|
||||
- IBlockState iblockstate1 = iblockreader.func_180495_p(blockpos2);
|
||||
- IBlockState iblockstate2 = iblockreader.func_180495_p(blockpos3);
|
||||
- IBlockState iblockstate3 = iblockreader.func_180495_p(blockpos4);
|
||||
- return (IBlockState)((IBlockState)((IBlockState)((IBlockState)((IBlockState)this.func_176223_P().func_206870_a(field_196409_a, Boolean.valueOf(this.func_196417_a(iblockstate, iblockstate.func_193401_d(iblockreader, blockpos1, EnumFacing.SOUTH))))).func_206870_a(field_196413_c, Boolean.valueOf(this.func_196417_a(iblockstate1, iblockstate1.func_193401_d(iblockreader, blockpos2, EnumFacing.NORTH))))).func_206870_a(field_196414_y, Boolean.valueOf(this.func_196417_a(iblockstate2, iblockstate2.func_193401_d(iblockreader, blockpos3, EnumFacing.EAST))))).func_206870_a(field_196411_b, Boolean.valueOf(this.func_196417_a(iblockstate3, iblockstate3.func_193401_d(iblockreader, blockpos4, EnumFacing.WEST))))).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
|
||||
+ return this.func_176223_P()
|
||||
+ .func_206870_a(field_196409_a, canPaneConnectTo(iblockreader, blockpos, EnumFacing.NORTH))
|
||||
+ .func_206870_a(field_196413_c, canPaneConnectTo(iblockreader, blockpos, EnumFacing.SOUTH))
|
||||
+ .func_206870_a(field_196414_y, canPaneConnectTo(iblockreader, blockpos, EnumFacing.WEST))
|
||||
+ .func_206870_a(field_196411_b, canPaneConnectTo(iblockreader, blockpos, EnumFacing.EAST))
|
||||
+ .func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
|
||||
}
|
||||
|
||||
public IBlockState func_196271_a(IBlockState p_196271_1_, EnumFacing p_196271_2_, IBlockState p_196271_3_, IWorld p_196271_4_, BlockPos p_196271_5_, BlockPos p_196271_6_) {
|
||||
@@ -41,7 +38,7 @@
|
||||
p_196271_4_.func_205219_F_().func_205360_a(p_196271_5_, Fluids.field_204546_a, Fluids.field_204546_a.func_205569_a(p_196271_4_));
|
||||
}
|
||||
|
||||
- return p_196271_2_.func_176740_k().func_176722_c() ? (IBlockState)p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.func_196417_a(p_196271_3_, p_196271_3_.func_193401_d(p_196271_4_, p_196271_6_, p_196271_2_.func_176734_d())))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
|
||||
+ return p_196271_2_.func_176740_k().func_176722_c() ? (IBlockState)p_196271_1_.func_206870_a(field_196415_z.get(p_196271_2_), Boolean.valueOf(this.canPaneConnectTo(p_196271_4_, p_196271_5_, p_196271_2_))) : super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
|
||||
}
|
||||
|
||||
public boolean func_149686_d(IBlockState p_149686_1_) {
|
||||
@@ -87,4 +84,16 @@
|
||||
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
|
||||
return p_193383_4_ != EnumFacing.UP && p_193383_4_ != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE_THIN : BlockFaceShape.CENTER_SMALL;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) {
|
||||
+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing));
|
||||
+ return func_196417_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d()));
|
||||
+ }
|
||||
+
|
||||
+ private boolean canPaneConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) {
|
||||
+ BlockPos offset = pos.func_177972_a(facing);
|
||||
+ IBlockState other = world.func_180495_p(offset);
|
||||
+ return other.canBeConnectedTo(world, offset, facing.func_176734_d()) || func_176223_P().canBeConnectedTo(world, pos, facing.func_176734_d());
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
--- a/net/minecraft/block/BlockPistonBase.java
|
||||
+++ b/net/minecraft/block/BlockPistonBase.java
|
||||
@@ -235,7 +235,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- return !block.func_149716_u();
|
||||
+ return !p_185646_0_.hasTileEntity();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -266,7 +266,9 @@
|
||||
for(int j = list2.size() - 1; j >= 0; --j) {
|
||||
BlockPos blockpos1 = list2.get(j);
|
||||
IBlockState iblockstate = p_176319_1_.func_180495_p(blockpos1);
|
||||
- iblockstate.func_196949_c(p_176319_1_, blockpos1, 0);
|
||||
+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
|
||||
+ float chance = iblockstate.func_177230_c() instanceof BlockSnow ? -1.0f : 1.0f;
|
||||
+ iblockstate.func_196941_a(p_176319_1_, blockpos1, chance, 0);
|
||||
p_176319_1_.func_180501_a(blockpos1, Blocks.field_150350_a.func_176223_P(), 18);
|
||||
--k;
|
||||
aiblockstate[k] = iblockstate;
|
||||
@@ -320,6 +322,10 @@
|
||||
return (IBlockState)p_185499_1_.func_206870_a(field_176387_N, p_185499_2_.func_185831_a((EnumFacing)p_185499_1_.func_177229_b(field_176387_N)));
|
||||
}
|
||||
|
||||
+ public IBlockState rotate(IBlockState state, net.minecraft.world.IWorld world, BlockPos pos, Rotation direction) {
|
||||
+ return state.func_177229_b(field_176320_b) ? state : super.rotate(state, world, pos, direction);
|
||||
+ }
|
||||
+
|
||||
public IBlockState func_185471_a(IBlockState p_185471_1_, Mirror p_185471_2_) {
|
||||
return p_185471_1_.func_185907_a(p_185471_2_.func_185800_a((EnumFacing)p_185471_1_.func_177229_b(field_176387_N)));
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
--- a/net/minecraft/block/BlockPistonMoving.java
|
||||
+++ b/net/minecraft/block/BlockPistonMoving.java
|
||||
@@ -86,14 +86,22 @@
|
||||
}
|
||||
|
||||
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
|
||||
- if (!p_196255_2_.field_72995_K) {
|
||||
+ if (false && !p_196255_2_.field_72995_K) { //Forge: Noop this out
|
||||
TileEntityPiston tileentitypiston = this.func_196342_a(p_196255_2_, p_196255_3_);
|
||||
if (tileentitypiston != null) {
|
||||
tileentitypiston.func_200230_i().func_196949_c(p_196255_2_, p_196255_3_, 0);
|
||||
}
|
||||
}
|
||||
+ super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, 1, p_196255_5_); // mimic vanilla behavior from above and ignore chance
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
+ TileEntityPiston te = this.func_196342_a(world, pos);
|
||||
+ if (te != null)
|
||||
+ te.func_200230_i().getDrops(drops, world, pos, fortune);
|
||||
+ }
|
||||
+
|
||||
public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) {
|
||||
return ShapeUtils.func_197880_a();
|
||||
}
|
11
patches/minecraft/net/minecraft/block/BlockPortal.java.patch
Normal file
11
patches/minecraft/net/minecraft/block/BlockPortal.java.patch
Normal file
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/block/BlockPortal.java
|
||||
+++ b/net/minecraft/block/BlockPortal.java
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
public boolean func_176548_d(IWorld p_176548_1_, BlockPos p_176548_2_) {
|
||||
BlockPortal.Size blockportal$size = this.func_201816_b(p_176548_1_, p_176548_2_);
|
||||
- if (blockportal$size != null) {
|
||||
+ if (blockportal$size != null && !net.minecraftforge.event.ForgeEventFactory.onTrySpawnPortal(p_176548_1_, p_176548_2_, blockportal$size)) {
|
||||
blockportal$size.func_150859_c();
|
||||
return true;
|
||||
} else {
|
25
patches/minecraft/net/minecraft/block/BlockPotato.java.patch
Normal file
25
patches/minecraft/net/minecraft/block/BlockPotato.java.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
--- a/net/minecraft/block/BlockPotato.java
|
||||
+++ b/net/minecraft/block/BlockPotato.java
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
|
||||
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
|
||||
- if (!p_196255_2_.field_72995_K) {
|
||||
+ if (false && !p_196255_2_.field_72995_K) { //Forge: Moved to getDrops
|
||||
if (this.func_185525_y(p_196255_1_) && p_196255_2_.field_73012_v.nextInt(50) == 0) {
|
||||
func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(Items.field_151170_bI));
|
||||
}
|
||||
@@ -34,6 +34,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
+ super.getDrops(state, drops, world, pos, fortune);
|
||||
+ if (this.func_185525_y(state) && world.field_73012_v.nextInt(50) == 0)
|
||||
+ drops.add(new ItemStack(Items.field_151170_bI));
|
||||
+ }
|
||||
+
|
||||
public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) {
|
||||
return field_196396_a[p_196244_1_.func_177229_b(this.func_185524_e())];
|
||||
}
|
122
patches/minecraft/net/minecraft/block/BlockRailBase.java.patch
Normal file
122
patches/minecraft/net/minecraft/block/BlockRailBase.java.patch
Normal file
|
@ -0,0 +1,122 @@
|
|||
--- a/net/minecraft/block/BlockRailBase.java
|
||||
+++ b/net/minecraft/block/BlockRailBase.java
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
public VoxelShape func_196244_b(IBlockState p_196244_1_, IBlockReader p_196244_2_, BlockPos p_196244_3_) {
|
||||
- RailShape railshape = p_196244_1_.func_177230_c() == this ? (RailShape)p_196244_1_.func_177229_b(this.func_176560_l()) : null;
|
||||
+ RailShape railshape = p_196244_1_.func_177230_c() == this ? getRailDirection(p_196244_1_, p_196244_2_, p_196244_3_, null) : null;
|
||||
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
}
|
||||
|
||||
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
|
||||
- return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q();
|
||||
+ return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
|
||||
}
|
||||
|
||||
public void func_196259_b(IBlockState p_196259_1_, World p_196259_2_, BlockPos p_196259_3_, IBlockState p_196259_4_) {
|
||||
@@ -67,19 +67,19 @@
|
||||
|
||||
public void func_189540_a(IBlockState p_189540_1_, World p_189540_2_, BlockPos p_189540_3_, Block p_189540_4_, BlockPos p_189540_5_) {
|
||||
if (!p_189540_2_.field_72995_K) {
|
||||
- RailShape railshape = (RailShape)p_189540_1_.func_177229_b(this.func_176560_l());
|
||||
+ RailShape railshape = getRailDirection(p_189540_1_, p_189540_2_, p_189540_3_, null);
|
||||
boolean flag = false;
|
||||
- if (!p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_185896_q()) {
|
||||
+ if (p_189540_2_.func_180495_p(p_189540_3_.func_177977_b()).func_193401_d(p_189540_2_, p_189540_3_.func_177977_b(), EnumFacing.UP) != BlockFaceShape.SOLID) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (railshape == RailShape.ASCENDING_EAST && !p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).func_185896_q()) {
|
||||
+ if (railshape == RailShape.ASCENDING_EAST && p_189540_2_.func_180495_p(p_189540_3_.func_177974_f()).func_193401_d(p_189540_2_, p_189540_3_.func_177974_f(), EnumFacing.UP) != BlockFaceShape.SOLID) {
|
||||
flag = true;
|
||||
- } else if (railshape == RailShape.ASCENDING_WEST && !p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).func_185896_q()) {
|
||||
+ } else if (railshape == RailShape.ASCENDING_WEST && p_189540_2_.func_180495_p(p_189540_3_.func_177976_e()).func_193401_d(p_189540_2_, p_189540_3_.func_177976_e(), EnumFacing.UP) != BlockFaceShape.SOLID) {
|
||||
flag = true;
|
||||
- } else if (railshape == RailShape.ASCENDING_NORTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).func_185896_q()) {
|
||||
+ } else if (railshape == RailShape.ASCENDING_NORTH && p_189540_2_.func_180495_p(p_189540_3_.func_177978_c()).func_193401_d(p_189540_2_, p_189540_3_.func_177978_c(), EnumFacing.UP) != BlockFaceShape.SOLID) {
|
||||
flag = true;
|
||||
- } else if (railshape == RailShape.ASCENDING_SOUTH && !p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).func_185896_q()) {
|
||||
+ } else if (railshape == RailShape.ASCENDING_SOUTH && p_189540_2_.func_180495_p(p_189540_3_.func_177968_d()).func_193401_d(p_189540_2_, p_189540_3_.func_177968_d(), EnumFacing.UP) != BlockFaceShape.SOLID) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
public void func_196243_a(IBlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, IBlockState p_196243_4_, boolean p_196243_5_) {
|
||||
if (!p_196243_5_) {
|
||||
super.func_196243_a(p_196243_1_, p_196243_2_, p_196243_3_, p_196243_4_, p_196243_5_);
|
||||
- if (((RailShape)p_196243_1_.func_177229_b(this.func_176560_l())).func_208092_c()) {
|
||||
+ if (getRailDirection(p_196243_1_, p_196243_2_, p_196243_3_, null).func_208092_c()) {
|
||||
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
|
||||
}
|
||||
|
||||
@@ -123,5 +123,66 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ //Forge: Use getRailDirection(IBlockAccess, BlockPos, IBlockState, EntityMinecart) for enhanced ability
|
||||
public abstract IProperty<RailShape> func_176560_l();
|
||||
+
|
||||
+ /* ======================================== FORGE START =====================================*/
|
||||
+ /**
|
||||
+ * Return true if the rail can make corners.
|
||||
+ * Used by placement logic.
|
||||
+ * @param world The world.
|
||||
+ * @param pos Block's position in world
|
||||
+ * @return True if the rail can make corners.
|
||||
+ */
|
||||
+ public boolean isFlexibleRail(IBlockState state, IBlockReader world, BlockPos pos)
|
||||
+ {
|
||||
+ return !this.field_196277_c;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns true if the rail can make up and down slopes.
|
||||
+ * Used by placement logic.
|
||||
+ * @param world The world.
|
||||
+ * @param pos Block's position in world
|
||||
+ * @return True if the rail can make slopes.
|
||||
+ */
|
||||
+ public boolean canMakeSlopes(IBlockState state, IBlockReader world, BlockPos pos) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Return the rail's direction.
|
||||
+ * Can be used to make the cart think the rail is a different shape,
|
||||
+ * for example when making diamond junctions or switches.
|
||||
+ * The cart parameter will often be null unless it it called from EntityMinecart.
|
||||
+ *
|
||||
+ * @param world The world.
|
||||
+ * @param pos Block's position in world
|
||||
+ * @param state The BlockState
|
||||
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
|
||||
+ * @return The direction.
|
||||
+ */
|
||||
+ public RailShape getRailDirection(IBlockState state, IBlockReader world, BlockPos pos, @javax.annotation.Nullable net.minecraft.entity.item.EntityMinecart cart) {
|
||||
+ return state.func_177229_b(func_176560_l());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the max speed of the rail at the specified position.
|
||||
+ * @param world The world.
|
||||
+ * @param cart The cart on the rail, may be null.
|
||||
+ * @param pos Block's position in world
|
||||
+ * @return The max speed of the current rail.
|
||||
+ */
|
||||
+ public float getRailMaxSpeed(IBlockState state, World world, BlockPos pos, net.minecraft.entity.item.EntityMinecart cart) {
|
||||
+ return 0.4f;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * This function is called by any minecart that passes over this rail.
|
||||
+ * It is called once per update tick that the minecart is on the rail.
|
||||
+ * @param world The world.
|
||||
+ * @param cart The cart on the rail.
|
||||
+ * @param pos Block's position in world
|
||||
+ */
|
||||
+ public void onMinecartPass(IBlockState state, World world, BlockPos pos, net.minecraft.entity.item.EntityMinecart cart) { }
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/block/BlockRailDetector.java
|
||||
+++ b/net/minecraft/block/BlockRailDetector.java
|
||||
@@ -127,6 +127,8 @@
|
||||
|
||||
public int func_180641_l(IBlockState p_180641_1_, World p_180641_2_, BlockPos p_180641_3_) {
|
||||
if (p_180641_1_.func_177229_b(field_176574_M)) {
|
||||
+ List<EntityMinecart> carts = this.func_200878_a(p_180641_2_, p_180641_3_, EntityMinecart.class, null);
|
||||
+ if (!carts.isEmpty() && carts.get(0).getComparatorLevel() > -1) return carts.get(0).getComparatorLevel();
|
||||
List<EntityMinecartCommandBlock> list = this.<EntityMinecartCommandBlock>func_200878_a(p_180641_2_, p_180641_3_, EntityMinecartCommandBlock.class, (Predicate)null);
|
||||
if (!list.isEmpty()) {
|
||||
return ((EntityMinecartCommandBlock)list.get(0)).func_145822_e().func_145760_g();
|
|
@ -0,0 +1,57 @@
|
|||
--- a/net/minecraft/block/BlockRailState.java
|
||||
+++ b/net/minecraft/block/BlockRailState.java
|
||||
@@ -16,14 +16,16 @@
|
||||
private IBlockState field_196923_d;
|
||||
private final boolean field_208513_e;
|
||||
private final List<BlockPos> field_196924_e = Lists.<BlockPos>newArrayList();
|
||||
+ private final boolean canMakeSlopes;
|
||||
|
||||
public BlockRailState(World p_i47755_1_, BlockPos p_i47755_2_, IBlockState p_i47755_3_) {
|
||||
this.field_196920_a = p_i47755_1_;
|
||||
this.field_196921_b = p_i47755_2_;
|
||||
this.field_196923_d = p_i47755_3_;
|
||||
this.field_196922_c = (BlockRailBase)p_i47755_3_.func_177230_c();
|
||||
- RailShape railshape = (RailShape)p_i47755_3_.func_177229_b(this.field_196922_c.func_176560_l());
|
||||
- this.field_208513_e = this.field_196922_c.func_208490_b();
|
||||
+ RailShape railshape = this.field_196922_c.getRailDirection(field_196923_d, p_i47755_1_, p_i47755_2_, null);
|
||||
+ this.field_208513_e = this.field_196922_c.isFlexibleRail(field_196923_d, p_i47755_1_, p_i47755_2_);
|
||||
+ this.canMakeSlopes = this.field_196922_c.canMakeSlopes(field_196923_d, p_i47755_1_, p_i47755_2_);
|
||||
this.func_208509_a(railshape);
|
||||
}
|
||||
|
||||
@@ -179,7 +181,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (railshape == RailShape.NORTH_SOUTH) {
|
||||
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
|
||||
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
|
||||
railshape = RailShape.ASCENDING_NORTH;
|
||||
}
|
||||
@@ -189,7 +191,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (railshape == RailShape.EAST_WEST) {
|
||||
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
|
||||
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
|
||||
railshape = RailShape.ASCENDING_EAST;
|
||||
}
|
||||
@@ -299,7 +301,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (railshape == RailShape.NORTH_SOUTH) {
|
||||
+ if (railshape == RailShape.NORTH_SOUTH && canMakeSlopes) {
|
||||
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
|
||||
railshape = RailShape.ASCENDING_NORTH;
|
||||
}
|
||||
@@ -309,7 +311,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (railshape == RailShape.EAST_WEST) {
|
||||
+ if (railshape == RailShape.EAST_WEST && canMakeSlopes) {
|
||||
if (BlockRailBase.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
|
||||
railshape = RailShape.ASCENDING_EAST;
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
--- a/net/minecraft/block/BlockRedstoneComparator.java
|
||||
+++ b/net/minecraft/block/BlockRedstoneComparator.java
|
||||
@@ -156,4 +156,16 @@
|
||||
protected void func_206840_a(StateContainer.Builder<Block, IBlockState> p_206840_1_) {
|
||||
p_206840_1_.func_206894_a(field_185512_D, field_176463_b, field_196348_c);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean getWeakChanges(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onNeighborChange(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, BlockPos neighbor) {
|
||||
+ if (pos.func_177956_o() == neighbor.func_177956_o() && world instanceof World && !((World)world).func_201670_d()) {
|
||||
+ func_189540_a(state, (World)world, pos, world.func_180495_p(neighbor).func_177230_c(), neighbor);
|
||||
+ }
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
--- a/net/minecraft/block/BlockRedstoneDiode.java
|
||||
+++ b/net/minecraft/block/BlockRedstoneDiode.java
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
|
||||
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
|
||||
- return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q();
|
||||
+ return p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_185896_q() || p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
|
||||
}
|
||||
|
||||
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
|
||||
@@ -172,6 +172,8 @@
|
||||
protected void func_176400_h(World p_176400_1_, BlockPos p_176400_2_, IBlockState p_176400_3_) {
|
||||
EnumFacing enumfacing = (EnumFacing)p_176400_3_.func_177229_b(field_185512_D);
|
||||
BlockPos blockpos = p_176400_2_.func_177972_a(enumfacing.func_176734_d());
|
||||
+ if (net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(p_176400_1_, p_176400_2_, p_176400_1_.func_180495_p(p_176400_2_), java.util.EnumSet.of(enumfacing.func_176734_d()), false).isCanceled())
|
||||
+ return;
|
||||
p_176400_1_.func_190524_a(blockpos, this, p_176400_2_);
|
||||
p_176400_1_.func_175695_a(blockpos, this, enumfacing);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
--- a/net/minecraft/block/BlockRedstoneOre.java
|
||||
+++ b/net/minecraft/block/BlockRedstoneOre.java
|
||||
@@ -72,11 +72,17 @@
|
||||
|
||||
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
|
||||
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
|
||||
- if (this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) {
|
||||
+ if (false && this.func_199769_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_5_) != this) {
|
||||
int i = 1 + p_196255_2_.field_73012_v.nextInt(5);
|
||||
this.func_180637_b(p_196255_2_, p_196255_3_, i);
|
||||
}
|
||||
+ }
|
||||
|
||||
+ @Override
|
||||
+ public int getExpDrop(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) {
|
||||
+ if (!(world instanceof World) || func_199769_a(state, (World)world, pos, fortune) != this)
|
||||
+ return 1 + RANDOM.nextInt(5);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/block/BlockRedstoneTorch.java
|
||||
+++ b/net/minecraft/block/BlockRedstoneTorch.java
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
public class BlockRedstoneTorch extends BlockTorch {
|
||||
public static final BooleanProperty field_196528_a = BlockStateProperties.field_208190_q;
|
||||
- private static final Map<IBlockReader, List<BlockRedstoneTorch.Toggle>> field_196529_b = Maps.<IBlockReader, List<BlockRedstoneTorch.Toggle>>newHashMap();
|
||||
+ private static final Map<IBlockReader, List<BlockRedstoneTorch.Toggle>> field_196529_b = new java.util.WeakHashMap<IBlockReader, List<BlockRedstoneTorch.Toggle>>(); // FORGE - fix vanilla MC-101233
|
||||
|
||||
protected BlockRedstoneTorch(Block.Builder p_i48342_1_) {
|
||||
super(p_i48342_1_);
|
|
@ -0,0 +1,79 @@
|
|||
--- a/net/minecraft/block/BlockRedstoneWire.java
|
||||
+++ b/net/minecraft/block/BlockRedstoneWire.java
|
||||
@@ -124,8 +124,8 @@
|
||||
IBlockState iblockstate = p_208074_1_.func_180495_p(p_208074_2_.func_177972_a(p_208074_3_));
|
||||
IBlockState iblockstate1 = p_208074_1_.func_180495_p(p_208074_2_.func_177984_a());
|
||||
if (!iblockstate1.func_185915_l()) {
|
||||
- boolean flag = p_208074_1_.func_180495_p(blockpos).func_185896_q() || p_208074_1_.func_180495_p(blockpos).func_177230_c() == Blocks.field_150426_aN;
|
||||
- if (flag && func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177984_a()))) {
|
||||
+ boolean flag = iblockstate.func_193401_d(p_208074_1_, blockpos, EnumFacing.UP) == BlockFaceShape.SOLID || iblockstate.func_177230_c() == Blocks.field_150426_aN;
|
||||
+ if (flag && canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177984_a()), p_208074_1_, blockpos.func_177984_a(), null)) {
|
||||
if (iblockstate.func_185898_k()) {
|
||||
return RedstoneSide.UP;
|
||||
}
|
||||
@@ -134,7 +134,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- return !func_176343_a(p_208074_1_.func_180495_p(blockpos), p_208074_3_) && (iblockstate.func_185915_l() || !func_176346_d(p_208074_1_.func_180495_p(blockpos.func_177977_b()))) ? RedstoneSide.NONE : RedstoneSide.SIDE;
|
||||
+ return !canConnectTo(p_208074_1_.func_180495_p(blockpos), p_208074_1_, blockpos, p_208074_3_) && (iblockstate.func_185915_l() || !canConnectTo(p_208074_1_.func_180495_p(blockpos.func_177977_b()), p_208074_1_, blockpos.func_177977_b(), null)) ? RedstoneSide.NONE : RedstoneSide.SIDE;
|
||||
}
|
||||
|
||||
public boolean func_149686_d(IBlockState p_149686_1_) {
|
||||
@@ -143,7 +143,7 @@
|
||||
|
||||
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
|
||||
IBlockState iblockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
- return iblockstate.func_185896_q() || iblockstate.func_177230_c() == Blocks.field_150426_aN;
|
||||
+ return iblockstate.func_185896_q() || iblockstate.func_177230_c() == Blocks.field_150426_aN || iblockstate.func_193401_d(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP) == BlockFaceShape.SOLID;
|
||||
}
|
||||
|
||||
private IBlockState func_176338_e(World p_176338_1_, BlockPos p_176338_2_, IBlockState p_176338_3_) {
|
||||
@@ -337,36 +337,28 @@
|
||||
IBlockState iblockstate = p_176339_1_.func_180495_p(blockpos);
|
||||
boolean flag = iblockstate.func_185915_l();
|
||||
boolean flag1 = p_176339_1_.func_180495_p(p_176339_2_.func_177984_a()).func_185915_l();
|
||||
- if (!flag1 && flag && func_176340_e(p_176339_1_, blockpos.func_177984_a())) {
|
||||
+ if (!flag1 && flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177984_a()), p_176339_1_, blockpos.func_177984_a(), null)) {
|
||||
return true;
|
||||
- } else if (func_176343_a(iblockstate, p_176339_3_)) {
|
||||
+ } else if (canConnectTo(iblockstate, p_176339_1_, p_176339_2_, p_176339_3_)) {
|
||||
return true;
|
||||
} else if (iblockstate.func_177230_c() == Blocks.field_196633_cV && iblockstate.func_177229_b(BlockRedstoneDiode.field_196348_c) && iblockstate.func_177229_b(BlockRedstoneDiode.field_185512_D) == p_176339_3_) {
|
||||
return true;
|
||||
} else {
|
||||
- return !flag && func_176340_e(p_176339_1_, blockpos.func_177977_b());
|
||||
+ return !flag && canConnectTo(p_176339_1_.func_180495_p(blockpos.func_177977_b()), p_176339_1_, blockpos.func_177977_b(), null);
|
||||
}
|
||||
}
|
||||
|
||||
- protected static boolean func_176340_e(IBlockReader p_176340_0_, BlockPos p_176340_1_) {
|
||||
- return func_176346_d(p_176340_0_.func_180495_p(p_176340_1_));
|
||||
- }
|
||||
-
|
||||
- protected static boolean func_176346_d(IBlockState p_176346_0_) {
|
||||
- return func_176343_a(p_176346_0_, (EnumFacing)null);
|
||||
- }
|
||||
-
|
||||
- protected static boolean func_176343_a(IBlockState p_176343_0_, @Nullable EnumFacing p_176343_1_) {
|
||||
- Block block = p_176343_0_.func_177230_c();
|
||||
+ protected boolean canConnectTo(IBlockState blockState, IBlockReader world, BlockPos pos, @Nullable EnumFacing side) {
|
||||
+ Block block = blockState.func_177230_c();
|
||||
if (block == Blocks.field_150488_af) {
|
||||
return true;
|
||||
- } else if (p_176343_0_.func_177230_c() == Blocks.field_196633_cV) {
|
||||
- EnumFacing enumfacing = (EnumFacing)p_176343_0_.func_177229_b(BlockRedstoneRepeater.field_185512_D);
|
||||
- return enumfacing == p_176343_1_ || enumfacing.func_176734_d() == p_176343_1_;
|
||||
- } else if (Blocks.field_190976_dk == p_176343_0_.func_177230_c()) {
|
||||
- return p_176343_1_ == p_176343_0_.func_177229_b(BlockObserver.field_176387_N);
|
||||
+ } else if (blockState.func_177230_c() == Blocks.field_196633_cV) {
|
||||
+ EnumFacing enumfacing = (EnumFacing)blockState.func_177229_b(BlockRedstoneRepeater.field_185512_D);
|
||||
+ return enumfacing == side || enumfacing.func_176734_d() == side;
|
||||
+ } else if (Blocks.field_190976_dk == blockState.func_177230_c()) {
|
||||
+ return side == blockState.func_177229_b(BlockObserver.field_176387_N);
|
||||
} else {
|
||||
- return p_176343_0_.func_185897_m() && p_176343_1_ != null;
|
||||
+ return blockState.canConnectRedstone(world, pos, side);
|
||||
}
|
||||
}
|
||||
|
52
patches/minecraft/net/minecraft/block/BlockReed.java.patch
Normal file
52
patches/minecraft/net/minecraft/block/BlockReed.java.patch
Normal file
|
@ -0,0 +1,52 @@
|
|||
--- a/net/minecraft/block/BlockReed.java
|
||||
+++ b/net/minecraft/block/BlockReed.java
|
||||
@@ -18,7 +18,7 @@
|
||||
import net.minecraft.world.IWorldReaderBase;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-public class BlockReed extends Block {
|
||||
+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable {
|
||||
public static final IntegerProperty field_176355_a = BlockStateProperties.field_208171_X;
|
||||
protected static final VoxelShape field_196503_b = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 16.0D, 14.0D);
|
||||
|
||||
@@ -40,12 +40,15 @@
|
||||
|
||||
if (i < 3) {
|
||||
int j = p_196267_1_.func_177229_b(field_176355_a);
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, true)) {
|
||||
if (j == 15) {
|
||||
p_196267_2_.func_175656_a(p_196267_3_.func_177984_a(), this.func_176223_P());
|
||||
p_196267_2_.func_180501_a(p_196267_3_, (IBlockState)p_196267_1_.func_206870_a(field_176355_a, Integer.valueOf(0)), 4);
|
||||
} else {
|
||||
p_196267_2_.func_180501_a(p_196267_3_, (IBlockState)p_196267_1_.func_206870_a(field_176355_a, Integer.valueOf(j + 1)), 4);
|
||||
}
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +59,9 @@
|
||||
}
|
||||
|
||||
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
|
||||
+ IBlockState soil = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
+ if (soil.canSustainPlant(p_196260_2_, p_196260_3_.func_177977_b(), EnumFacing.UP, this)) return true;
|
||||
+
|
||||
Block block = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b()).func_177230_c();
|
||||
if (block == this) {
|
||||
return true;
|
||||
@@ -91,4 +97,14 @@
|
||||
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockReader world, BlockPos pos) {
|
||||
+ return net.minecraftforge.common.EnumPlantType.Beach;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public IBlockState getPlant(IBlockReader world, BlockPos pos) {
|
||||
+ return func_176223_P();
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
--- a/net/minecraft/block/BlockSapling.java
|
||||
+++ b/net/minecraft/block/BlockSapling.java
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
|
||||
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
|
||||
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
|
||||
if (p_196267_2_.func_201696_r(p_196267_3_.func_177984_a()) >= 9 && p_196267_4_.nextInt(7) == 0) {
|
||||
this.func_176478_d(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_);
|
||||
}
|
||||
@@ -39,6 +40,7 @@
|
||||
if (p_176478_3_.func_177229_b(field_176479_b) == 0) {
|
||||
p_176478_1_.func_180501_a(p_176478_2_, (IBlockState)p_176478_3_.func_177231_a(field_176479_b), 4);
|
||||
} else {
|
||||
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_176478_1_, p_176478_4_, p_176478_2_)) return;
|
||||
this.field_196387_c.func_196935_a(p_176478_1_, p_176478_2_, p_176478_3_, p_176478_4_);
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
--- a/net/minecraft/block/BlockSnowLayer.java
|
||||
+++ b/net/minecraft/block/BlockSnowLayer.java
|
||||
@@ -84,30 +84,45 @@
|
||||
|
||||
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, @Nullable TileEntity p_180657_5_, ItemStack p_180657_6_) {
|
||||
Integer integer = (Integer)p_180657_4_.func_177229_b(field_176315_a);
|
||||
- if (this.func_149700_E() && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
|
||||
+ net.minecraft.util.NonNullList<ItemStack> items = net.minecraft.util.NonNullList.func_191196_a();
|
||||
+ int fortune = EnchantmentHelper.func_77506_a(Enchantments.field_185308_t, p_180657_6_);
|
||||
+ float chance = 1.0f;
|
||||
+
|
||||
+ if (this.canSilkHarvest(p_180657_4_, p_180657_1_, p_180657_3_, p_180657_2_) && EnchantmentHelper.func_77506_a(Enchantments.field_185306_r, p_180657_6_) > 0) {
|
||||
if (integer == 8) {
|
||||
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_196604_cC));
|
||||
+ items.add(new ItemStack(Blocks.field_196604_cC));
|
||||
} else {
|
||||
for(int i = 0; i < integer; ++i) {
|
||||
- func_180635_a(p_180657_1_, p_180657_3_, this.func_180643_i(p_180657_4_));
|
||||
+ items.add(this.func_180643_i(p_180657_4_));
|
||||
}
|
||||
}
|
||||
+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, 0, 1.0f, true, p_180657_2_);
|
||||
} else {
|
||||
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Items.field_151126_ay, integer));
|
||||
+ getDrops(p_180657_4_, items, p_180657_1_, p_180657_3_, fortune);
|
||||
+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_4_, fortune, 1.0f, false, p_180657_2_);
|
||||
}
|
||||
|
||||
+ for (ItemStack item : items) {
|
||||
+ if (p_180657_1_.field_73012_v.nextFloat() <= chance)
|
||||
+ func_180635_a(p_180657_1_, p_180657_3_, item);
|
||||
+ }
|
||||
+
|
||||
p_180657_1_.func_175698_g(p_180657_3_);
|
||||
p_180657_2_.func_71029_a(StatList.field_188065_ae.func_199076_b(this));
|
||||
p_180657_2_.func_71020_j(0.005F);
|
||||
}
|
||||
|
||||
public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) {
|
||||
- return Items.field_190931_a;
|
||||
+ return Items.field_151126_ay;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public int func_196264_a(IBlockState state, Random random) {
|
||||
+ return state.func_177229_b(field_176315_a) + 1;
|
||||
+ }
|
||||
+
|
||||
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
|
||||
if (p_196267_2_.func_175642_b(EnumLightType.BLOCK, p_196267_3_) > 11) {
|
||||
- p_196267_1_.func_196949_c(p_196267_2_, p_196267_3_, 0);
|
||||
p_196267_2_.func_175698_g(p_196267_3_);
|
||||
}
|
||||
|
55
patches/minecraft/net/minecraft/block/BlockStem.java.patch
Normal file
55
patches/minecraft/net/minecraft/block/BlockStem.java.patch
Normal file
|
@ -0,0 +1,55 @@
|
|||
--- a/net/minecraft/block/BlockStem.java
|
||||
+++ b/net/minecraft/block/BlockStem.java
|
||||
@@ -39,22 +39,24 @@
|
||||
|
||||
public void func_196267_b(IBlockState p_196267_1_, World p_196267_2_, BlockPos p_196267_3_, Random p_196267_4_) {
|
||||
super.func_196267_b(p_196267_1_, p_196267_2_, p_196267_3_, p_196267_4_);
|
||||
+ if (!p_196267_2_.func_205050_e(p_196267_3_, 1)) return; // Forge: prevent loading unloaded chunks when checking neighbor's light
|
||||
if (p_196267_2_.func_201669_a(p_196267_3_.func_177984_a(), 0) >= 9) {
|
||||
float f = BlockCrops.func_180672_a(this, p_196267_2_, p_196267_3_);
|
||||
- if (p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0) {
|
||||
+ if (net.minecraftforge.common.ForgeHooks.onCropsGrowPre(p_196267_2_, p_196267_3_, p_196267_1_, p_196267_4_.nextInt((int)(25.0F / f) + 1) == 0)) {
|
||||
int i = p_196267_1_.func_177229_b(field_176484_a);
|
||||
if (i < 7) {
|
||||
- p_196267_1_ = (IBlockState)p_196267_1_.func_206870_a(field_176484_a, Integer.valueOf(i + 1));
|
||||
- p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_, 2);
|
||||
+ p_196267_2_.func_180501_a(p_196267_3_, p_196267_1_.func_206870_a(field_176484_a, i + 1), 2);
|
||||
} else {
|
||||
EnumFacing enumfacing = EnumFacing.Plane.HORIZONTAL.func_179518_a(p_196267_4_);
|
||||
BlockPos blockpos = p_196267_3_.func_177972_a(enumfacing);
|
||||
- Block block = p_196267_2_.func_180495_p(blockpos.func_177977_b()).func_177230_c();
|
||||
- if (p_196267_2_.func_180495_p(blockpos).func_196958_f() && (block == Blocks.field_150458_ak || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) {
|
||||
+ IBlockState soil = p_196267_2_.func_180495_p(blockpos.func_177977_b());
|
||||
+ Block block = soil.func_177230_c();
|
||||
+ if (p_196267_2_.func_180495_p(blockpos).isAir(p_196267_2_, blockpos) && (soil.canSustainPlant(p_196267_2_, blockpos.func_177977_b(), EnumFacing.UP, this) || block == Blocks.field_150346_d || block == Blocks.field_196660_k || block == Blocks.field_196661_l || block == Blocks.field_196658_i)) {
|
||||
p_196267_2_.func_175656_a(blockpos, this.field_149877_a.func_176223_P());
|
||||
p_196267_2_.func_175656_a(p_196267_3_, (IBlockState)this.field_149877_a.func_196523_e().func_176223_P().func_206870_a(BlockHorizontal.field_185512_D, enumfacing));
|
||||
}
|
||||
}
|
||||
+ net.minecraftforge.common.ForgeHooks.onCropsGrowPost(p_196267_2_, p_196267_3_, p_196267_1_);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,14 +64,18 @@
|
||||
|
||||
public void func_196255_a(IBlockState p_196255_1_, World p_196255_2_, BlockPos p_196255_3_, float p_196255_4_, int p_196255_5_) {
|
||||
super.func_196255_a(p_196255_1_, p_196255_2_, p_196255_3_, p_196255_4_, p_196255_5_);
|
||||
- if (!p_196255_2_.field_72995_K) {
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
+ {
|
||||
Item item = this.func_176481_j();
|
||||
if (item != null) {
|
||||
- int i = p_196255_1_.func_177229_b(field_176484_a);
|
||||
+ int i = state.func_177229_b(field_176484_a);
|
||||
|
||||
for(int j = 0; j < 3; ++j) {
|
||||
- if (p_196255_2_.field_73012_v.nextInt(15) <= i) {
|
||||
- func_180635_a(p_196255_2_, p_196255_3_, new ItemStack(item));
|
||||
+ if (world.field_73012_v.nextInt(15) <= i) {
|
||||
+ drops.add(new ItemStack(item));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
--- a/net/minecraft/block/BlockTallGrass.java
|
||||
+++ b/net/minecraft/block/BlockTallGrass.java
|
||||
@@ -15,7 +15,7 @@
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-public class BlockTallGrass extends BlockBush implements IGrowable {
|
||||
+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable {
|
||||
protected static final VoxelShape field_196389_a = Block.func_208617_a(2.0D, 0.0D, 2.0D, 14.0D, 13.0D, 14.0D);
|
||||
|
||||
protected BlockTallGrass(Block.Builder p_i48310_1_) {
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
public IItemProvider func_199769_a(IBlockState p_199769_1_, World p_199769_2_, BlockPos p_199769_3_, int p_199769_4_) {
|
||||
- return p_199769_2_.field_73012_v.nextInt(8) == 0 ? Items.field_151014_N : Items.field_190931_a;
|
||||
+ return Items.field_190931_a;
|
||||
}
|
||||
|
||||
public int func_196251_a(IBlockState p_196251_1_, int p_196251_2_, World p_196251_3_, BlockPos p_196251_4_, Random p_196251_5_) {
|
||||
@@ -64,4 +64,17 @@
|
||||
public Block.EnumOffsetType func_176218_Q() {
|
||||
return Block.EnumOffsetType.XYZ;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) {
|
||||
+ return java.util.Arrays.asList(new ItemStack(this));
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void getDrops(IBlockState state, net.minecraft.util.NonNullList<ItemStack> drops, World world, BlockPos pos, int fortune) {
|
||||
+ if (world.field_73012_v.nextInt(8) != 0) return;
|
||||
+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(world.field_73012_v, fortune);
|
||||
+ if (!seed.func_190926_b())
|
||||
+ drops.add(seed);
|
||||
+ }
|
||||
}
|
13
patches/minecraft/net/minecraft/block/BlockTorch.java.patch
Normal file
13
patches/minecraft/net/minecraft/block/BlockTorch.java.patch
Normal file
|
@ -0,0 +1,13 @@
|
|||
--- a/net/minecraft/block/BlockTorch.java
|
||||
+++ b/net/minecraft/block/BlockTorch.java
|
||||
@@ -37,9 +37,7 @@
|
||||
|
||||
public boolean func_196260_a(IBlockState p_196260_1_, IWorldReaderBase p_196260_2_, BlockPos p_196260_3_) {
|
||||
IBlockState iblockstate = p_196260_2_.func_180495_p(p_196260_3_.func_177977_b());
|
||||
- Block block = iblockstate.func_177230_c();
|
||||
- boolean flag = block instanceof BlockFence || block instanceof BlockStainedGlass || block == Blocks.field_150359_w || block == Blocks.field_150463_bK || block == Blocks.field_196723_eg || iblockstate.func_185896_q();
|
||||
- return flag && block != Blocks.field_185775_db;
|
||||
+ return iblockstate.canPlaceTorchOnTop(p_196260_2_, p_196260_3_);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
|
@ -0,0 +1,17 @@
|
|||
--- a/net/minecraft/block/BlockTrapDoor.java
|
||||
+++ b/net/minecraft/block/BlockTrapDoor.java
|
||||
@@ -186,4 +186,14 @@
|
||||
|
||||
return super.func_196271_a(p_196271_1_, p_196271_2_, p_196271_3_, p_196271_4_, p_196271_5_, p_196271_6_);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) {
|
||||
+ if (state.func_177229_b(field_176283_b)) {
|
||||
+ IBlockState down = world.func_180495_p(pos.func_177977_b());
|
||||
+ if (down.func_177230_c() == net.minecraft.init.Blocks.field_150468_ap)
|
||||
+ return down.func_177229_b(BlockLadder.field_176382_a) == state.func_177229_b(field_185512_D);
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
}
|
35
patches/minecraft/net/minecraft/block/BlockVine.java.patch
Normal file
35
patches/minecraft/net/minecraft/block/BlockVine.java.patch
Normal file
|
@ -0,0 +1,35 @@
|
|||
--- a/net/minecraft/block/BlockVine.java
|
||||
+++ b/net/minecraft/block/BlockVine.java
|
||||
@@ -29,7 +29,7 @@
|
||||
import net.minecraft.world.IWorldReaderBase;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-public class BlockVine extends Block {
|
||||
+public class BlockVine extends Block implements net.minecraftforge.common.IShearable {
|
||||
public static final BooleanProperty field_176277_a = BlockSixWay.field_196496_z;
|
||||
public static final BooleanProperty field_176273_b = BlockSixWay.field_196488_a;
|
||||
public static final BooleanProperty field_176278_M = BlockSixWay.field_196490_b;
|
||||
@@ -171,7 +171,7 @@
|
||||
p_196267_2_.func_175698_g(p_196267_3_);
|
||||
}
|
||||
|
||||
- } else if (p_196267_2_.field_73012_v.nextInt(4) == 0) {
|
||||
+ } else if (p_196267_2_.field_73012_v.nextInt(4) == 0 && p_196267_2_.func_205050_e(p_196267_3_, 4)) { // Forge: check area to prevent loading unloaded chunks
|
||||
EnumFacing enumfacing = EnumFacing.func_176741_a(p_196267_4_);
|
||||
BlockPos blockpos = p_196267_3_.func_177984_a();
|
||||
if (enumfacing.func_176740_k().func_176722_c() && !p_196267_1_.func_177229_b(func_176267_a(enumfacing))) {
|
||||
@@ -365,4 +365,14 @@
|
||||
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLadder(IBlockState state, net.minecraft.world.IWorldReader world, BlockPos pos, net.minecraft.entity.EntityLivingBase entity) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) {
|
||||
+ return java.util.Arrays.asList(new ItemStack(this));
|
||||
+ }
|
||||
}
|
44
patches/minecraft/net/minecraft/block/BlockWall.java.patch
Normal file
44
patches/minecraft/net/minecraft/block/BlockWall.java.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
--- a/net/minecraft/block/BlockWall.java
|
||||
+++ b/net/minecraft/block/BlockWall.java
|
||||
@@ -51,6 +51,18 @@
|
||||
return !func_194143_e(block) && p_196421_2_ == BlockFaceShape.SOLID || flag;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public boolean canBeConnectedTo(IBlockState state, IBlockReader world, BlockPos pos, EnumFacing facing) {
|
||||
+ IBlockState other = world.func_180495_p(pos.func_177972_a(facing));
|
||||
+ return func_196421_a(other, other.func_193401_d(world, pos.func_177972_a(facing), facing.func_176734_d()));
|
||||
+ }
|
||||
+
|
||||
+ private boolean canWallConnectTo(IBlockReader world, BlockPos pos, EnumFacing facing) {
|
||||
+ BlockPos off = pos.func_177972_a(facing);
|
||||
+ IBlockState other = world.func_180495_p(off);
|
||||
+ return other.canBeConnectedTo(world, off, facing.func_176734_d()) || func_196421_a(other, other.func_193401_d(world, off, facing.func_176734_d()));
|
||||
+ }
|
||||
+
|
||||
public static boolean func_194143_e(Block p_194143_0_) {
|
||||
return Block.func_193382_c(p_194143_0_) || p_194143_0_ == Blocks.field_180401_cv || p_194143_0_ == Blocks.field_150440_ba || p_194143_0_ == Blocks.field_150423_aK || p_194143_0_ == Blocks.field_196625_cS || p_194143_0_ == Blocks.field_196628_cT || p_194143_0_ == Blocks.field_185778_de || p_194143_0_ == Blocks.field_150335_W;
|
||||
}
|
||||
@@ -59,18 +71,10 @@
|
||||
IWorldReaderBase iworldreaderbase = p_196258_1_.func_195991_k();
|
||||
BlockPos blockpos = p_196258_1_.func_195995_a();
|
||||
IFluidState ifluidstate = p_196258_1_.func_195991_k().func_204610_c(p_196258_1_.func_195995_a());
|
||||
- BlockPos blockpos1 = blockpos.func_177978_c();
|
||||
- BlockPos blockpos2 = blockpos.func_177974_f();
|
||||
- BlockPos blockpos3 = blockpos.func_177968_d();
|
||||
- BlockPos blockpos4 = blockpos.func_177976_e();
|
||||
- IBlockState iblockstate = iworldreaderbase.func_180495_p(blockpos1);
|
||||
- IBlockState iblockstate1 = iworldreaderbase.func_180495_p(blockpos2);
|
||||
- IBlockState iblockstate2 = iworldreaderbase.func_180495_p(blockpos3);
|
||||
- IBlockState iblockstate3 = iworldreaderbase.func_180495_p(blockpos4);
|
||||
- boolean flag = this.func_196421_a(iblockstate, iblockstate.func_193401_d(iworldreaderbase, blockpos1, EnumFacing.SOUTH));
|
||||
- boolean flag1 = this.func_196421_a(iblockstate1, iblockstate1.func_193401_d(iworldreaderbase, blockpos2, EnumFacing.WEST));
|
||||
- boolean flag2 = this.func_196421_a(iblockstate2, iblockstate2.func_193401_d(iworldreaderbase, blockpos3, EnumFacing.NORTH));
|
||||
- boolean flag3 = this.func_196421_a(iblockstate3, iblockstate3.func_193401_d(iworldreaderbase, blockpos4, EnumFacing.EAST));
|
||||
+ boolean flag = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.NORTH);
|
||||
+ boolean flag1 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.EAST);
|
||||
+ boolean flag2 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.SOUTH);
|
||||
+ boolean flag3 = canWallConnectTo(iworldreaderbase, blockpos, EnumFacing.WEST);
|
||||
boolean flag4 = (!flag || flag1 || !flag2 || flag3) && (flag || !flag1 || flag2 || !flag3);
|
||||
return (IBlockState)((IBlockState)((IBlockState)((IBlockState)((IBlockState)((IBlockState)this.func_176223_P().func_206870_a(field_176256_a, Boolean.valueOf(flag4 || !iworldreaderbase.func_175623_d(blockpos.func_177984_a())))).func_206870_a(field_196409_a, Boolean.valueOf(flag))).func_206870_a(field_196411_b, Boolean.valueOf(flag1))).func_206870_a(field_196413_c, Boolean.valueOf(flag2))).func_206870_a(field_196414_y, Boolean.valueOf(flag3))).func_206870_a(field_204514_u, Boolean.valueOf(ifluidstate.func_206886_c() == Fluids.field_204546_a));
|
||||
}
|
21
patches/minecraft/net/minecraft/block/BlockWeb.java.patch
Normal file
21
patches/minecraft/net/minecraft/block/BlockWeb.java.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
--- a/net/minecraft/block/BlockWeb.java
|
||||
+++ b/net/minecraft/block/BlockWeb.java
|
||||
@@ -16,7 +16,7 @@
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
-public class BlockWeb extends Block {
|
||||
+public class BlockWeb extends Block implements net.minecraftforge.common.IShearable {
|
||||
public BlockWeb(Block.Builder p_i48296_1_) {
|
||||
super(p_i48296_1_);
|
||||
}
|
||||
@@ -54,4 +54,9 @@
|
||||
public BlockFaceShape func_193383_a(IBlockReader p_193383_1_, IBlockState p_193383_2_, BlockPos p_193383_3_, EnumFacing p_193383_4_) {
|
||||
return BlockFaceShape.UNDEFINED;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IWorldReader world, BlockPos pos, int fortune) {
|
||||
+ return java.util.Arrays.asList(new ItemStack(this));
|
||||
+ }
|
||||
}
|
27
patches/minecraft/net/minecraft/block/SoundType.java.patch
Normal file
27
patches/minecraft/net/minecraft/block/SoundType.java.patch
Normal file
|
@ -0,0 +1,27 @@
|
|||
--- a/net/minecraft/block/SoundType.java
|
||||
+++ b/net/minecraft/block/SoundType.java
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
-import net.minecraftforge.api.distmarker.Dist;
|
||||
-import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public class SoundType {
|
||||
public static final SoundType field_185848_a = new SoundType(1.0F, 1.0F, SoundEvents.field_187881_gQ, SoundEvents.field_187897_gY, SoundEvents.field_187891_gV, SoundEvents.field_187889_gU, SoundEvents.field_187887_gT);
|
||||
@@ -46,7 +44,6 @@
|
||||
return this.field_185861_n;
|
||||
}
|
||||
|
||||
- @OnlyIn(Dist.CLIENT)
|
||||
public SoundEvent func_185845_c() {
|
||||
return this.field_185862_o;
|
||||
}
|
||||
@@ -59,7 +56,6 @@
|
||||
return this.field_185864_q;
|
||||
}
|
||||
|
||||
- @OnlyIn(Dist.CLIENT)
|
||||
public SoundEvent func_185846_f() {
|
||||
return this.field_185865_r;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
--- a/net/minecraft/crash/CrashReportCategory.java
|
||||
+++ b/net/minecraft/crash/CrashReportCategory.java
|
||||
@@ -98,8 +98,10 @@
|
||||
if (astacktraceelement.length <= 0) {
|
||||
return 0;
|
||||
} else {
|
||||
- this.field_85075_d = new StackTraceElement[astacktraceelement.length - 3 - p_85073_1_];
|
||||
- System.arraycopy(astacktraceelement, 3 + p_85073_1_, this.field_85075_d, 0, this.field_85075_d.length);
|
||||
+ int len = astacktraceelement.length - 3 - p_85073_1_;
|
||||
+ if (len <= 0) len = astacktraceelement.length;
|
||||
+ this.field_85075_d = new StackTraceElement[len];
|
||||
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.field_85075_d, 0, this.field_85075_d.length);
|
||||
return this.field_85075_d.length;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/entity/item/EntityArmorStand.java
|
||||
+++ b/net/minecraft/entity/item/EntityArmorStand.java
|
||||
@@ -54,7 +54,7 @@
|
||||
public static final DataParameter<Rotations> field_184806_f = EntityDataManager.<Rotations>func_187226_a(EntityArmorStand.class, DataSerializers.field_187199_i);
|
||||
public static final DataParameter<Rotations> field_184807_g = EntityDataManager.<Rotations>func_187226_a(EntityArmorStand.class, DataSerializers.field_187199_i);
|
||||
private static final Predicate<Entity> field_184798_bv = (p_200617_0_) -> {
|
||||
- return p_200617_0_ instanceof EntityMinecart && ((EntityMinecart)p_200617_0_).func_184264_v() == EntityMinecart.Type.RIDEABLE;
|
||||
+ return p_200617_0_ instanceof EntityMinecart && ((EntityMinecart)p_200617_0_).canBeRidden();
|
||||
};
|
||||
private final NonNullList<ItemStack> field_184799_bw;
|
||||
private final NonNullList<ItemStack> field_184800_bx;
|
|
@ -0,0 +1,32 @@
|
|||
--- a/net/minecraft/entity/item/EntityBoat.java
|
||||
+++ b/net/minecraft/entity/item/EntityBoat.java
|
||||
@@ -461,7 +461,7 @@
|
||||
blockpos$pooledmutableblockpos.func_181079_c(l1, k2, i2);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos$pooledmutableblockpos);
|
||||
if (!(iblockstate.func_177230_c() instanceof BlockLilyPad) && ShapeUtils.func_197879_c(iblockstate.func_196952_d(this.field_70170_p, blockpos$pooledmutableblockpos).func_197751_a((double)l1, (double)k2, (double)i2), voxelshape, IBooleanFunction.AND)) {
|
||||
- f += iblockstate.func_177230_c().func_208618_m();
|
||||
+ f += iblockstate.getSlipperiness(field_70170_p, blockpos$pooledmutableblockpos, this);
|
||||
++k1;
|
||||
}
|
||||
}
|
||||
@@ -780,6 +780,20 @@
|
||||
this.field_184463_aC = p_184442_4_;
|
||||
}
|
||||
|
||||
+ // 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;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public static enum Status {
|
||||
IN_WATER,
|
||||
UNDER_WATER,
|
|
@ -0,0 +1,17 @@
|
|||
--- a/net/minecraft/entity/item/EntityItemFrame.java
|
||||
+++ b/net/minecraft/entity/item/EntityItemFrame.java
|
||||
@@ -175,12 +175,13 @@
|
||||
}
|
||||
|
||||
private void func_110131_b(ItemStack p_110131_1_) {
|
||||
- if (p_110131_1_.func_77973_b() == Items.field_151098_aY) {
|
||||
+ if (p_110131_1_.func_77973_b() instanceof net.minecraft.item.ItemMap) {
|
||||
MapData mapdata = ItemMap.func_195950_a(p_110131_1_, this.field_70170_p);
|
||||
mapdata.field_76203_h.remove("frame-" + this.func_145782_y());
|
||||
}
|
||||
|
||||
p_110131_1_.func_82842_a((EntityItemFrame)null);
|
||||
+ this.func_82334_a(ItemStack.field_190927_a); //Forge: Fix MC-124833 Pistons duplicating Items.
|
||||
}
|
||||
|
||||
public ItemStack func_82335_i() {
|
|
@ -1,18 +1,258 @@
|
|||
--- a/net/minecraft/entity/item/EntityMinecart.java
|
||||
+++ b/net/minecraft/entity/item/EntityMinecart.java
|
||||
@@ -808,4 +808,15 @@
|
||||
return p_184955_0_ >= 0 && p_184955_0_ < field_184965_h.length ? field_184965_h[p_184955_0_] : RIDEABLE;
|
||||
@@ -37,7 +37,7 @@
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
-public abstract class EntityMinecart extends Entity implements INameable {
|
||||
+public abstract class EntityMinecart extends Entity implements INameable, net.minecraftforge.common.extensions.IForgeEntityMinecart {
|
||||
private static final DataParameter<Integer> field_184265_a = EntityDataManager.<Integer>func_187226_a(EntityMinecart.class, DataSerializers.field_187192_b);
|
||||
private static final DataParameter<Integer> field_184266_b = EntityDataManager.<Integer>func_187226_a(EntityMinecart.class, DataSerializers.field_187192_b);
|
||||
private static final DataParameter<Float> field_184267_c = EntityDataManager.<Float>func_187226_a(EntityMinecart.class, DataSerializers.field_187193_c);
|
||||
@@ -58,6 +58,7 @@
|
||||
private double field_70507_ar;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private double field_70506_as;
|
||||
+ private boolean canBePushed = true;
|
||||
|
||||
protected EntityMinecart(EntityType<?> p_i48538_1_, World p_i48538_2_) {
|
||||
super(p_i48538_1_, p_i48538_2_);
|
||||
@@ -110,11 +111,12 @@
|
||||
|
||||
@Nullable
|
||||
public AxisAlignedBB func_70114_g(Entity p_70114_1_) {
|
||||
+ if (getCollisionHandler() != null) return getCollisionHandler().getCollisionBox(this, p_70114_1_);
|
||||
return p_70114_1_.func_70104_M() ? p_70114_1_.func_174813_aQ() : null;
|
||||
}
|
||||
|
||||
public boolean func_70104_M() {
|
||||
- return true;
|
||||
+ return canBePushed;
|
||||
}
|
||||
|
||||
public double func_70042_X() {
|
||||
@@ -259,7 +261,7 @@
|
||||
|
||||
BlockPos blockpos = new BlockPos(k, l, i1);
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
|
||||
- if (iblockstate.func_203425_a(BlockTags.field_203437_y)) {
|
||||
+ if (canUseRail() && iblockstate.func_203425_a(BlockTags.field_203437_y)) {
|
||||
this.func_180460_a(blockpos, iblockstate);
|
||||
if (iblockstate.func_177230_c() == Blocks.field_150408_cc) {
|
||||
this.func_96095_a(k, l, i1, iblockstate.func_177229_b(BlockRailPowered.field_176569_M));
|
||||
@@ -286,8 +288,11 @@
|
||||
}
|
||||
|
||||
this.func_70101_b(this.field_70177_z, this.field_70125_A);
|
||||
- if (this.func_184264_v() == EntityMinecart.Type.RIDEABLE && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D) {
|
||||
- List<Entity> list = this.field_70170_p.func_175674_a(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F), EntitySelectors.func_200823_a(this));
|
||||
+ AxisAlignedBB box;
|
||||
+ if (getCollisionHandler() != null) box = getCollisionHandler().getMinecartCollisionBox(this);
|
||||
+ else box = this.func_174813_aQ().func_72314_b(0.2F, 0.0D, 0.2F);
|
||||
+ if (canBeRidden() && this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y > 0.01D) {
|
||||
+ List<Entity> list = this.field_70170_p.func_175674_a(this, box, EntitySelectors.func_200823_a(this));
|
||||
if (!list.isEmpty()) {
|
||||
for(int j1 = 0; j1 < list.size(); ++j1) {
|
||||
Entity entity1 = list.get(j1);
|
||||
@@ -299,7 +304,7 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- for(Entity entity : this.field_70170_p.func_72839_b(this, this.func_174813_aQ().func_72314_b((double)0.2F, 0.0D, (double)0.2F))) {
|
||||
+ for(Entity entity : this.field_70170_p.func_72839_b(this, box)) {
|
||||
if (!this.func_184196_w(entity) && entity.func_70104_M() && entity instanceof EntityMinecart) {
|
||||
entity.func_70108_f(this);
|
||||
}
|
||||
@@ -307,6 +312,7 @@
|
||||
}
|
||||
|
||||
this.func_70072_I();
|
||||
+ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartUpdateEvent(this, this.getCurrentRailPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,20 +324,30 @@
|
||||
}
|
||||
|
||||
protected void func_180459_n() {
|
||||
- double d0 = this.func_174898_m();
|
||||
+ double d0 = field_70122_E ? this.func_174898_m() : getMaxSpeedAirLateral();
|
||||
this.field_70159_w = MathHelper.func_151237_a(this.field_70159_w, -d0, d0);
|
||||
this.field_70179_y = MathHelper.func_151237_a(this.field_70179_y, -d0, d0);
|
||||
+
|
||||
+ public ItemStack getCartItem() {
|
||||
+ switch (func_184264_v()) {
|
||||
+ case FURNACE: return new ItemStack(Items.field_151109_aJ);
|
||||
+ case CHEST: return new ItemStack(Items.field_151108_aI);
|
||||
+ case TNT: return new ItemStack(Items.field_151142_bV);
|
||||
+ case HOPPER: return new ItemStack(Items.field_151140_bW);
|
||||
+ case COMMAND_BLOCK: return new ItemStack(Items.field_151095_cc);
|
||||
+ default: return new ItemStack(Items.field_151143_au);
|
||||
+ double moveY = field_70181_x;
|
||||
+ if(getMaxSpeedAirVertical() > 0 && field_70181_x > getMaxSpeedAirVertical()) {
|
||||
+ moveY = getMaxSpeedAirVertical();
|
||||
+ if(Math.abs(field_70159_w) < 0.3f && Math.abs(field_70179_y) < 0.3f) {
|
||||
+ moveY = 0.15f;
|
||||
+ field_70181_x = moveY;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (this.field_70122_E) {
|
||||
this.field_70159_w *= 0.5D;
|
||||
this.field_70181_x *= 0.5D;
|
||||
this.field_70179_y *= 0.5D;
|
||||
}
|
||||
|
||||
- this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y);
|
||||
+ this.func_70091_d(MoverType.SELF, this.field_70159_w, moveY, this.field_70179_y);
|
||||
if (!this.field_70122_E) {
|
||||
- this.field_70159_w *= (double)0.95F;
|
||||
- this.field_70181_x *= (double)0.95F;
|
||||
- this.field_70179_y *= (double)0.95F;
|
||||
+ this.field_70159_w *= getDragAir();
|
||||
+ this.field_70181_x *= getDragAir();
|
||||
+ this.field_70179_y *= getDragAir();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -348,23 +364,23 @@
|
||||
flag1 = !flag;
|
||||
}
|
||||
|
||||
- double d0 = 0.0078125D;
|
||||
- RailShape railshape = (RailShape)p_180460_2_.func_177229_b(blockrailbase.func_176560_l());
|
||||
+ double slopeAdjustment = getSlopeAdjustment();
|
||||
+ RailShape railshape = ((BlockRailBase)p_180460_2_.func_177230_c()).getRailDirection(p_180460_2_, field_70170_p, p_180460_1_, this);
|
||||
switch(railshape) {
|
||||
case ASCENDING_EAST:
|
||||
- this.field_70159_w -= 0.0078125D;
|
||||
+ this.field_70159_w -= slopeAdjustment;
|
||||
++this.field_70163_u;
|
||||
break;
|
||||
case ASCENDING_WEST:
|
||||
- this.field_70159_w += 0.0078125D;
|
||||
+ this.field_70159_w += slopeAdjustment;
|
||||
++this.field_70163_u;
|
||||
break;
|
||||
case ASCENDING_NORTH:
|
||||
- this.field_70179_y += 0.0078125D;
|
||||
+ this.field_70179_y += slopeAdjustment;
|
||||
++this.field_70163_u;
|
||||
break;
|
||||
case ASCENDING_SOUTH:
|
||||
- this.field_70179_y -= 0.0078125D;
|
||||
+ this.field_70179_y -= slopeAdjustment;
|
||||
++this.field_70163_u;
|
||||
}
|
||||
|
||||
@@ -400,7 +416,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (flag1) {
|
||||
+ if (flag1 && shouldDoRailFunctions()) {
|
||||
double d17 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y);
|
||||
if (d17 < 0.03D) {
|
||||
this.field_70159_w *= 0.0D;
|
||||
@@ -435,17 +451,7 @@
|
||||
this.field_70165_t = d18 + d1 * d10;
|
||||
this.field_70161_v = d19 + d2 * d10;
|
||||
this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v);
|
||||
- double d22 = this.field_70159_w;
|
||||
- double d23 = this.field_70179_y;
|
||||
- if (this.func_184207_aI()) {
|
||||
- d22 *= 0.75D;
|
||||
- d23 *= 0.75D;
|
||||
- }
|
||||
-
|
||||
- double d13 = this.func_174898_m();
|
||||
- d22 = MathHelper.func_151237_a(d22, -d13, d13);
|
||||
- d23 = MathHelper.func_151237_a(d23, -d13, d13);
|
||||
- this.func_70091_d(MoverType.SELF, d22, 0.0D, d23);
|
||||
+ this.moveMinecartOnRail(p_180460_1_);
|
||||
if (aint[0][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[0][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[0][2]) {
|
||||
this.func_70107_b(this.field_70165_t, this.field_70163_u + (double)aint[0][1], this.field_70161_v);
|
||||
} else if (aint[1][1] != 0 && MathHelper.func_76128_c(this.field_70165_t) - p_180460_1_.func_177958_n() == aint[1][0] && MathHelper.func_76128_c(this.field_70161_v) - p_180460_1_.func_177952_p() == aint[1][2]) {
|
||||
@@ -473,7 +479,10 @@
|
||||
this.field_70179_y = d5 * (double)(i - p_180460_1_.func_177952_p());
|
||||
}
|
||||
|
||||
- if (flag) {
|
||||
+ if (shouldDoRailFunctions())
|
||||
+ ((BlockRailBase)p_180460_2_.func_177230_c()).onMinecartPass(p_180460_2_, field_70170_p, p_180460_1_, this);
|
||||
+
|
||||
+ if (flag && shouldDoRailFunctions()) {
|
||||
double d15 = Math.sqrt(this.field_70159_w * this.field_70159_w + this.field_70179_y * this.field_70179_y);
|
||||
if (d15 > 0.01D) {
|
||||
double d16 = 0.06D;
|
||||
@@ -530,7 +539,7 @@
|
||||
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k));
|
||||
if (iblockstate.func_203425_a(BlockTags.field_203437_y)) {
|
||||
- RailShape railshape = (RailShape)iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l());
|
||||
+ RailShape railshape = ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(iblockstate, field_70170_p, new BlockPos(i, j, k), this);
|
||||
p_70495_3_ = (double)j;
|
||||
if (railshape.func_208092_c()) {
|
||||
p_70495_3_ = (double)(j + 1);
|
||||
@@ -567,7 +576,7 @@
|
||||
|
||||
IBlockState iblockstate = this.field_70170_p.func_180495_p(new BlockPos(i, j, k));
|
||||
if (iblockstate.func_203425_a(BlockTags.field_203437_y)) {
|
||||
- RailShape railshape = (RailShape)iblockstate.func_177229_b(((BlockRailBase)iblockstate.func_177230_c()).func_176560_l());
|
||||
+ RailShape railshape = ((BlockRailBase)iblockstate.func_177230_c()).getRailDirection(iblockstate, field_70170_p, new BlockPos(i, j, k), this);
|
||||
int[][] aint = field_70500_g[railshape.func_208091_a()];
|
||||
double d0 = (double)i + 0.5D + (double)aint[0][0] * 0.5D;
|
||||
double d1 = (double)j + 0.0625D + (double)aint[0][1] * 0.5D;
|
||||
@@ -630,6 +639,11 @@
|
||||
}
|
||||
|
||||
public void func_70108_f(Entity p_70108_1_) {
|
||||
+ //net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartCollisionEvent(this, entityIn));
|
||||
+ if (getCollisionHandler() != null) {
|
||||
+ getCollisionHandler().onEntityCollision(this, p_70108_1_);
|
||||
+ return;
|
||||
+ }
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
if (!p_70108_1_.field_70145_X && !this.field_70145_X) {
|
||||
if (!this.func_184196_w(p_70108_1_)) {
|
||||
@@ -665,13 +679,13 @@
|
||||
|
||||
double d7 = p_70108_1_.field_70159_w + this.field_70159_w;
|
||||
double d8 = p_70108_1_.field_70179_y + this.field_70179_y;
|
||||
- if (((EntityMinecart)p_70108_1_).func_184264_v() == EntityMinecart.Type.FURNACE && this.func_184264_v() != EntityMinecart.Type.FURNACE) {
|
||||
+ if (((EntityMinecart)p_70108_1_).isPoweredCart() && !isPoweredCart()) {
|
||||
this.field_70159_w *= (double)0.2F;
|
||||
this.field_70179_y *= (double)0.2F;
|
||||
this.func_70024_g(p_70108_1_.field_70159_w - d0, 0.0D, p_70108_1_.field_70179_y - d1);
|
||||
p_70108_1_.field_70159_w *= (double)0.95F;
|
||||
p_70108_1_.field_70179_y *= (double)0.95F;
|
||||
- } else if (((EntityMinecart)p_70108_1_).func_184264_v() != EntityMinecart.Type.FURNACE && this.func_184264_v() == EntityMinecart.Type.FURNACE) {
|
||||
+ } else if (!((EntityMinecart)p_70108_1_).isPoweredCart() && isPoweredCart()) {
|
||||
p_70108_1_.field_70159_w *= (double)0.2F;
|
||||
p_70108_1_.field_70179_y *= (double)0.2F;
|
||||
p_70108_1_.func_70024_g(this.field_70159_w + d0, 0.0D, this.field_70179_y + d1);
|
||||
@@ -781,6 +795,32 @@
|
||||
this.func_184212_Q().func_187227_b(field_184270_f, p_94096_1_);
|
||||
}
|
||||
|
||||
+ private boolean canUseRail = true;
|
||||
+ @Override public boolean canUseRail() { return canUseRail; }
|
||||
+ @Override public void setCanUseRail(boolean value) { this.canUseRail = value; }
|
||||
+ private float currentSpeedOnRail;
|
||||
+ @Override public float getCurrentCartSpeedCapOnRail() { return currentSpeedOnRail; }
|
||||
+ @Override public void setCurrentCartSpeedCapOnRail(float value) { currentSpeedOnRail = Math.min(value, getMaxCartSpeedOnRail()); }
|
||||
+ private float maxSpeedAirLateral = DEFAULT_MAX_SPEED_AIR_LATERAL;
|
||||
+ @Override public float getMaxSpeedAirLateral() { return maxSpeedAirLateral; }
|
||||
+ @Override public void setMaxSpeedAirLateral(float value) { maxSpeedAirLateral = value; }
|
||||
+ private float maxSpeedAirVertical = DEFAULT_MAX_SPEED_AIR_VERTICAL;
|
||||
+ @Override public float getMaxSpeedAirVertical() { return maxSpeedAirVertical; }
|
||||
+ @Override public void setMaxSpeedAirVertical(float value) { maxSpeedAirVertical = value; }
|
||||
+ private double dragAir = DEFAULT_AIR_DRAG;
|
||||
+ @Override public double getDragAir() { return dragAir; }
|
||||
+ @Override public void setDragAir(double value) { dragAir = value; }
|
||||
+ @Override
|
||||
+ public double getMaxSpeed() { //Non-default because getMaximumSpeed is protected
|
||||
+ if (!canUseRail()) return func_174898_m();
|
||||
+ BlockPos pos = this.getCurrentRailPosition();
|
||||
+ IBlockState state = getMinecart().field_70170_p.func_180495_p(pos);
|
||||
+ if (!state.func_203425_a(BlockTags.field_203437_y)) return func_174898_m();
|
||||
+
|
||||
+ float railMaxSpeed = ((BlockRailBase)state.func_177230_c()).getRailMaxSpeed(state, getMinecart().field_70170_p, pos, getMinecart());
|
||||
+ return Math.min(railMaxSpeed, getCurrentCartSpeedCapOnRail());
|
||||
+ }
|
||||
+
|
||||
public static enum Type {
|
||||
RIDEABLE(0),
|
||||
CHEST(1),
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/entity/item/EntityMinecartCommandBlock.java
|
||||
+++ b/net/minecraft/entity/item/EntityMinecartCommandBlock.java
|
||||
@@ -72,6 +72,7 @@
|
||||
}
|
||||
|
||||
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) {
|
||||
+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true;
|
||||
this.field_145824_a.func_175574_a(p_184230_1_);
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/entity/item/EntityMinecartEmpty.java
|
||||
+++ b/net/minecraft/entity/item/EntityMinecartEmpty.java
|
||||
@@ -15,6 +15,7 @@
|
||||
}
|
||||
|
||||
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) {
|
||||
+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true;
|
||||
if (p_184230_1_.func_70093_af()) {
|
||||
return false;
|
||||
} else if (this.func_184207_aI()) {
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/entity/item/EntityMinecartFurnace.java
|
||||
+++ b/net/minecraft/entity/item/EntityMinecartFurnace.java
|
||||
@@ -115,6 +115,7 @@
|
||||
}
|
||||
|
||||
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) {
|
||||
+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true;
|
||||
ItemStack itemstack = p_184230_1_.func_184586_b(p_184230_2_);
|
||||
if (field_195407_e.test(itemstack) && this.field_94110_c + 3600 <= 32000) {
|
||||
if (!p_184230_1_.field_71075_bZ.field_75098_d) {
|
|
@ -0,0 +1,10 @@
|
|||
--- a/net/minecraft/entity/item/EntityMinecartHopper.java
|
||||
+++ b/net/minecraft/entity/item/EntityMinecartHopper.java
|
||||
@@ -47,6 +47,7 @@
|
||||
}
|
||||
|
||||
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) {
|
||||
+ if (super.func_184230_a(p_184230_1_, p_184230_2_)) return true;
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
p_184230_1_.func_71007_a(this);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
--- a/net/minecraft/entity/item/EntityMinecartMobSpawner.java
|
||||
+++ b/net/minecraft/entity/item/EntityMinecartMobSpawner.java
|
||||
@@ -23,6 +23,12 @@
|
||||
public BlockPos func_177221_b() {
|
||||
return new BlockPos(EntityMinecartMobSpawner.this);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ @javax.annotation.Nullable
|
||||
+ public net.minecraft.entity.Entity getSpawnerEntity() {
|
||||
+ return EntityMinecartMobSpawner.this;
|
||||
+ }
|
||||
};
|
||||
|
||||
public EntityMinecartMobSpawner(World p_i46752_1_) {
|
|
@ -0,0 +1,28 @@
|
|||
--- a/net/minecraft/entity/item/EntityXPOrb.java
|
||||
+++ b/net/minecraft/entity/item/EntityXPOrb.java
|
||||
@@ -117,7 +117,8 @@
|
||||
this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y);
|
||||
float f = 0.98F;
|
||||
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().func_208618_m() * 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));
|
||||
+ f = this.field_70170_p.func_180495_p(underPos).getSlipperiness(field_70170_p, underPos, this) * 0.98F;
|
||||
}
|
||||
|
||||
this.field_70159_w *= (double)f;
|
||||
@@ -150,6 +151,7 @@
|
||||
}
|
||||
|
||||
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
|
||||
+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return false; //Forge: Fixes MC-53850
|
||||
if (this.func_180431_b(p_70097_1_)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -178,6 +180,7 @@
|
||||
public void func_70100_b_(EntityPlayer p_70100_1_) {
|
||||
if (!this.field_70170_p.field_72995_K) {
|
||||
if (this.field_70532_c == 0 && p_70100_1_.field_71090_bL == 0) {
|
||||
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(p_70100_1_, this))) return;
|
||||
p_70100_1_.field_71090_bL = 2;
|
||||
p_70100_1_.func_71001_a(this, 1);
|
||||
ItemStack itemstack = EnchantmentHelper.func_92099_a(Enchantments.field_185296_A, p_70100_1_);
|
|
@ -8,12 +8,26 @@
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -421,6 +422,8 @@
|
||||
@@ -248,6 +249,9 @@
|
||||
BlockDispenser.func_199774_a(Items.field_203797_aN, ibehaviordispenseitem);
|
||||
BlockDispenser.func_199774_a(Items.field_203795_aL, ibehaviordispenseitem);
|
||||
BlockDispenser.func_199774_a(Items.field_204272_aO, ibehaviordispenseitem);
|
||||
+ BlockDispenser.func_199774_a(Items.field_151117_aB, net.minecraftforge.fluids.DispenseFluidContainer.getInstance());
|
||||
+ BlockDispenser.func_199774_a(Items.field_151133_ar, net.minecraftforge.fluids.DispenseFluidContainer.getInstance());
|
||||
+ if (false)
|
||||
BlockDispenser.func_199774_a(Items.field_151133_ar, new BehaviorDefaultDispenseItem() {
|
||||
private final BehaviorDefaultDispenseItem field_150840_b = new BehaviorDefaultDispenseItem();
|
||||
|
||||
@@ -419,8 +423,12 @@
|
||||
func_210839_a("entity", EntityType.field_200787_a, EntityType::func_210760_d);
|
||||
}
|
||||
|
||||
+ if (false) // skip redirectOutputToLog, Forge already redirects stdout and stderr output to log so that they print with more context
|
||||
func_179868_d();
|
||||
}
|
||||
+ net.minecraftforge.registries.ForgeRegistries.ITEMS.getClass(); // TODO figure out a better way to ensure these are initialized
|
||||
+ net.minecraft.tileentity.TileEntityType.field_200970_a.getClass();
|
||||
+ net.minecraftforge.registries.GameData.vanillaSnapshot();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
--- a/net/minecraft/tileentity/MobSpawnerBaseLogic.java
|
||||
+++ b/net/minecraft/tileentity/MobSpawnerBaseLogic.java
|
||||
@@ -113,8 +113,9 @@
|
||||
|
||||
EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null;
|
||||
entity.func_70012_b(entity.field_70165_t, entity.field_70163_u, entity.field_70161_v, world.field_73012_v.nextFloat() * 360.0F, 0.0F);
|
||||
- if (entityliving == null || entityliving.func_70601_bi() && entityliving.func_70058_J()) {
|
||||
+ if (entityliving == null || net.minecraftforge.event.ForgeEventFactory.canEntitySpawnSpawner(entityliving, func_98271_a(), (float)entity.field_70165_t, (float)entity.field_70163_u, (float)entity.field_70161_v, this)) {
|
||||
if (this.field_98282_f.func_185277_b().func_186856_d() == 1 && this.field_98282_f.func_185277_b().func_150297_b("id", 8) && entity instanceof EntityLiving) {
|
||||
+ if (!net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn(entityliving, this.func_98271_a(), (float)entity.field_70165_t, (float)entity.field_70163_u, (float)entity.field_70161_v, this))
|
||||
((EntityLiving)entity).func_204210_a(world.func_175649_E(new BlockPos(entity)), (IEntityLivingData)null, (NBTTagCompound)null);
|
||||
}
|
||||
|
||||
@@ -256,4 +257,9 @@
|
||||
public double func_177223_e() {
|
||||
return this.field_98284_d;
|
||||
}
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Entity getSpawnerEntity() {
|
||||
+ return null;
|
||||
+ }
|
||||
}
|
|
@ -46,6 +46,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.ClassInheritanceMultiMap;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
@ -466,8 +467,11 @@ public class ForgeChunkManager
|
|||
return false;
|
||||
}
|
||||
|
||||
static void loadWorld(World world)
|
||||
static void loadWorld(IWorld iworld)
|
||||
{
|
||||
if (!(iworld instanceof World)) return;
|
||||
World world = (World)iworld;
|
||||
|
||||
ArrayListMultimap<String, Ticket> newTickets = ArrayListMultimap.create();
|
||||
tickets.put(world, newTickets);
|
||||
|
||||
|
@ -617,8 +621,10 @@ public class ForgeChunkManager
|
|||
}
|
||||
}
|
||||
|
||||
static void unloadWorld(World world)
|
||||
static void unloadWorld(IWorld iworld)
|
||||
{
|
||||
if (!(iworld instanceof World)) return;
|
||||
World world = (World)iworld;
|
||||
// World save fires before this event so the chunk loading info will be done
|
||||
if (!(world instanceof WorldServer))
|
||||
{
|
||||
|
@ -897,8 +903,10 @@ public class ForgeChunkManager
|
|||
return forcedChunks.containsKey(world) ? forcedChunks.get(world) : ImmutableSetMultimap.of();
|
||||
}
|
||||
|
||||
static void saveWorld(World world)
|
||||
static void saveWorld(IWorld iworld)
|
||||
{
|
||||
if (!(iworld instanceof World)) return;
|
||||
World world = (World)iworld;
|
||||
// only persist persistent worlds
|
||||
if (!(world instanceof WorldServer))
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.pathfinding.PathNodeType;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.properties.BedPart;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -346,19 +347,6 @@ public interface IForgeBlock
|
|||
*/
|
||||
default void beginLeaveDecay(IBlockState state, IWorldReader world, BlockPos pos) {}
|
||||
|
||||
/**
|
||||
* Determines if this block is considered a leaf block, used to apply the leaf decay and generation system.
|
||||
*
|
||||
* @param state The current state
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @return true if this block is considered leaves.
|
||||
*/
|
||||
default boolean isLeaves(IBlockState state, IWorldReader world, BlockPos pos)
|
||||
{
|
||||
return state.getMaterial() == Material.LEAVES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines this block should be treated as an air block
|
||||
* by the rest of the code. This method is primarily
|
||||
|
@ -385,7 +373,7 @@ public interface IForgeBlock
|
|||
*/
|
||||
default boolean canBeReplacedByLeaves(IBlockState state, IWorldReader world, BlockPos pos)
|
||||
{
|
||||
return isAir(state, world, pos) || isLeaves(state, world, pos);
|
||||
return isAir(state, world, pos) || state.isIn(BlockTags.LEAVES);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -441,7 +429,7 @@ public interface IForgeBlock
|
|||
* @param side The side that is trying to make the connection, CAN BE NULL
|
||||
* @return True to make the connection
|
||||
*/
|
||||
default boolean canConnectRedstone(IBlockState state, IWorldReader world, BlockPos pos, @Nullable EnumFacing side)
|
||||
default boolean canConnectRedstone(IBlockState state, IBlockReader world, BlockPos pos, @Nullable EnumFacing side)
|
||||
{
|
||||
return state.canProvidePower() && side != null;
|
||||
}
|
||||
|
@ -455,12 +443,12 @@ public interface IForgeBlock
|
|||
* @param pos Block position in world
|
||||
* @return True to allow the torch to be placed
|
||||
*/
|
||||
default boolean canPlaceTorchOnTop(IBlockState state, IWorldReader world, BlockPos pos)
|
||||
default boolean canPlaceTorchOnTop(IBlockState state, IWorldReaderBase world, BlockPos pos)
|
||||
{
|
||||
if (state.isTopSolid() || state.getBlockFaceShape(world, pos, EnumFacing.UP) == BlockFaceShape.SOLID)
|
||||
return this.getBlock() != Blocks.END_GATEWAY && this.getBlock() != Blocks.JACK_O_LANTERN;
|
||||
return this.getBlock() != Blocks.END_GATEWAY;
|
||||
else
|
||||
return this.getBlock() instanceof BlockFence || this.getBlock() == Blocks.COBBLESTONE_WALL || this.getBlock() instanceof BlockGlass;
|
||||
return this.getBlock() instanceof BlockFence || this.getBlock() instanceof BlockStainedGlass || this.getBlock() == Blocks.GLASS || this.getBlock() == Blocks.COBBLESTONE_WALL || this.getBlock() == Blocks.MOSSY_COBBLESTONE_WALL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -43,6 +43,7 @@ import net.minecraft.world.Explosion;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.IWorldReaderBase;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -297,18 +298,6 @@ public interface IForgeBlockState
|
|||
getBlockState().getBlock().beginLeaveDecay(getBlockState(), world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if this block is considered a leaf block, used to apply the leaf decay and generation system.
|
||||
*
|
||||
* @param world The current world
|
||||
* @param pos Block position in world
|
||||
* @return true if this block is considered leaves.
|
||||
*/
|
||||
default boolean isLeaves(IWorldReader world, BlockPos pos)
|
||||
{
|
||||
return getBlockState().getBlock().isLeaves(getBlockState(), world, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines this block should be treated as an air block
|
||||
* by the rest of the code. This method is primarily
|
||||
|
@ -387,7 +376,7 @@ public interface IForgeBlockState
|
|||
* @param side The side that is trying to make the connection, CAN BE NULL
|
||||
* @return True to make the connection
|
||||
*/
|
||||
default boolean canConnectRedstone(IWorldReader world, BlockPos pos, @Nullable EnumFacing side)
|
||||
default boolean canConnectRedstone(IBlockReader world, BlockPos pos, @Nullable EnumFacing side)
|
||||
{
|
||||
return getBlockState().getBlock().canConnectRedstone(getBlockState(), world, pos, side);
|
||||
}
|
||||
|
@ -400,7 +389,7 @@ public interface IForgeBlockState
|
|||
* @param pos Block position in world
|
||||
* @return True to allow the torch to be placed
|
||||
*/
|
||||
default boolean canPlaceTorchOnTop(IWorldReader world, BlockPos pos)
|
||||
default boolean canPlaceTorchOnTop(IWorldReaderBase world, BlockPos pos)
|
||||
{
|
||||
return getBlockState().getBlock().canPlaceTorchOnTop(getBlockState(), world, pos);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* 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.common.extensions;
|
||||
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.MoverType;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.entity.item.EntityMinecartChest;
|
||||
import net.minecraft.entity.item.EntityMinecartCommandBlock;
|
||||
import net.minecraft.entity.item.EntityMinecartFurnace;
|
||||
import net.minecraft.entity.item.EntityMinecartHopper;
|
||||
import net.minecraft.entity.item.EntityMinecartTNT;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.common.IMinecartCollisionHandler;
|
||||
|
||||
public interface IForgeEntityMinecart
|
||||
{
|
||||
public static float DEFAULT_MAX_SPEED_AIR_LATERAL = 0.4f;
|
||||
public static float DEFAULT_MAX_SPEED_AIR_VERTICAL = -1.0f;
|
||||
public static double DEFAULT_AIR_DRAG = 0.95f;
|
||||
public static IMinecartCollisionHandler COLLISIONS = null;
|
||||
|
||||
default EntityMinecart getMinecart() {
|
||||
return (EntityMinecart)this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current global Minecart Collision handler if none
|
||||
* is registered, returns null
|
||||
* @return The collision handler or null
|
||||
*/
|
||||
default IMinecartCollisionHandler getCollisionHandler() {
|
||||
return COLLISIONS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal, returns the current spot to look for the attached rail.
|
||||
*/
|
||||
default BlockPos getCurrentRailPosition()
|
||||
{
|
||||
int x = MathHelper.floor(getMinecart().posX);
|
||||
int y = MathHelper.floor(getMinecart().posY);
|
||||
int z = MathHelper.floor(getMinecart().posZ);
|
||||
BlockPos pos = new BlockPos(x, y - 1, z);
|
||||
if (getMinecart().world.getBlockState(pos).isIn(BlockTags.RAILS)) pos = pos.down();
|
||||
return pos;
|
||||
}
|
||||
|
||||
double getMaxSpeed();
|
||||
|
||||
/**
|
||||
* Moved to allow overrides.
|
||||
* This code handles minecart movement and speed capping when on a rail.
|
||||
*/
|
||||
default void moveMinecartOnRail(BlockPos pos)
|
||||
{
|
||||
EntityMinecart mc = getMinecart();
|
||||
double mX = mc.motionX;
|
||||
double mZ = mc.motionZ;
|
||||
|
||||
if (mc.isBeingRidden())
|
||||
{
|
||||
mX *= 0.75D;
|
||||
mZ *= 0.75D;
|
||||
}
|
||||
|
||||
double max = getMaxSpeed();
|
||||
mX = MathHelper.clamp(mX, -max, max);
|
||||
mZ = MathHelper.clamp(mZ, -max, max);
|
||||
mc.move(MoverType.SELF, mX, 0.0D, mZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function returns an ItemStack that represents this cart.
|
||||
* This should be an ItemStack that can be used by the player to place the cart,
|
||||
* but is not necessary the item the cart drops when destroyed.
|
||||
* @return An ItemStack that can be used to place the cart.
|
||||
*/
|
||||
default ItemStack getCartItem()
|
||||
{
|
||||
switch (getMinecart().getMinecartType())
|
||||
{
|
||||
case FURNACE: return new ItemStack(Items.FURNACE_MINECART);
|
||||
case CHEST: return new ItemStack(Items.CHEST_MINECART);
|
||||
case TNT: return new ItemStack(Items.TNT_MINECART);
|
||||
case HOPPER: return new ItemStack(Items.HOPPER_MINECART);
|
||||
case COMMAND_BLOCK: return new ItemStack(Items.COMMAND_BLOCK_MINECART);
|
||||
default: return new ItemStack(Items.MINECART);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this cart can currently use rails.
|
||||
* This function is mainly used to gracefully detach a minecart from a rail.
|
||||
* @return True if the minecart can use rails.
|
||||
*/
|
||||
boolean canUseRail();
|
||||
|
||||
/**
|
||||
* Set whether the minecart can use rails.
|
||||
* This function is mainly used to gracefully detach a minecart from a rail.
|
||||
* @param use Whether the minecart can currently use rails.
|
||||
*/
|
||||
void setCanUseRail(boolean use);
|
||||
|
||||
/**
|
||||
* Return false if this cart should not call onMinecartPass() and should ignore Powered Rails.
|
||||
* @return True if this cart should call onMinecartPass().
|
||||
*/
|
||||
default boolean shouldDoRailFunctions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this cart is self propelled.
|
||||
* @return True if powered.
|
||||
*/
|
||||
default boolean isPoweredCart() {
|
||||
return getMinecart().getMinecartType() == EntityMinecart.Type.FURNACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this cart can be ridden by an Entity.
|
||||
* @return True if this cart can be ridden.
|
||||
*/
|
||||
default boolean canBeRidden() {
|
||||
return getMinecart().getMinecartType() == EntityMinecart.Type.RIDEABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the carts max speed when traveling on rails. Carts going faster
|
||||
* than 1.1 cause issues with chunk loading. Carts cant traverse slopes or
|
||||
* corners at greater than 0.5 - 0.6. This value is compared with the rails
|
||||
* max speed and the carts current speed cap to determine the carts current
|
||||
* max speed. A normal rail's max speed is 0.4.
|
||||
*
|
||||
* @return Carts max speed.
|
||||
*/
|
||||
default float getMaxCartSpeedOnRail() {
|
||||
return 1.2f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current speed cap for the cart when traveling on rails. This
|
||||
* functions differs from getMaxCartSpeedOnRail() in that it controls
|
||||
* current movement and cannot be overridden. The value however can never be
|
||||
* higher than getMaxCartSpeedOnRail().
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getCurrentCartSpeedCapOnRail();
|
||||
void setCurrentCartSpeedCapOnRail(float value);
|
||||
float getMaxSpeedAirLateral();
|
||||
void setMaxSpeedAirLateral(float value);
|
||||
float getMaxSpeedAirVertical();
|
||||
void setMaxSpeedAirVertical(float value);
|
||||
double getDragAir();
|
||||
void setDragAir(double value);
|
||||
|
||||
default double getSlopeAdjustment() {
|
||||
return 0.0078125D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from Detector Rails to retrieve a redstone power level for comparators.
|
||||
*/
|
||||
default int getComparatorLevel() {
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -62,6 +62,7 @@ import net.minecraft.util.text.ChatType;
|
|||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.village.Village;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
|
@ -191,14 +192,10 @@ public class ForgeEventFactory
|
|||
{
|
||||
Result result = canEntitySpawn(entity, world, x, y, z, spawner);
|
||||
if (result == Result.DEFAULT)
|
||||
{
|
||||
return entity.getCanSpawnHere() && entity.isNotColliding(); // vanilla logic
|
||||
}
|
||||
else
|
||||
{
|
||||
return result == Result.ALLOW;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean doSpecialSpawn(EntityLiving entity, World world, float x, float y, float z, MobSpawnerBaseLogic spawner)
|
||||
{
|
||||
|
@ -675,7 +672,7 @@ public class ForgeEventFactory
|
|||
return result == Result.DEFAULT ? def : result == Result.ALLOW;
|
||||
}
|
||||
|
||||
public static boolean onTrySpawnPortal(World world, BlockPos pos, BlockPortal.Size size)
|
||||
public static boolean onTrySpawnPortal(IWorld world, BlockPos pos, BlockPortal.Size size)
|
||||
{
|
||||
return MinecraftForge.EVENT_BUS.post(new BlockEvent.PortalSpawnEvent(world, pos, world.getBlockState(pos), size));
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event.HasResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
|
@ -51,7 +52,7 @@ public class SaplingGrowTreeEvent extends WorldEvent
|
|||
private final BlockPos pos;
|
||||
private final Random rand;
|
||||
|
||||
public SaplingGrowTreeEvent(World world, Random rand, BlockPos pos)
|
||||
public SaplingGrowTreeEvent(IWorld world, Random rand, BlockPos pos)
|
||||
{
|
||||
super(world);
|
||||
this.rand = rand;
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Random;
|
|||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -107,7 +108,7 @@ public abstract class TerrainGen
|
|||
}
|
||||
*/
|
||||
|
||||
public static boolean saplingGrowTree(World world, Random rand, BlockPos pos)
|
||||
public static boolean saplingGrowTree(IWorld world, Random rand, BlockPos pos)
|
||||
{
|
||||
SaplingGrowTreeEvent event = new SaplingGrowTreeEvent(world, rand, pos);
|
||||
MinecraftForge.TERRAIN_GEN_BUS.post(event);
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.util.EnumHand;
|
|||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
|
@ -49,17 +50,17 @@ public class BlockEvent extends Event
|
|||
{
|
||||
private static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("forge.debugBlockEvent", "false"));
|
||||
|
||||
private final World world;
|
||||
private final IWorld world;
|
||||
private final BlockPos pos;
|
||||
private final IBlockState state;
|
||||
public BlockEvent(World world, BlockPos pos, IBlockState state)
|
||||
public BlockEvent(IWorld world, BlockPos pos, IBlockState state)
|
||||
{
|
||||
this.pos = pos;
|
||||
this.world = world;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
public IWorld getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
@ -435,7 +436,7 @@ public class BlockEvent extends Event
|
|||
{
|
||||
private final BlockPortal.Size size;
|
||||
|
||||
public PortalSpawnEvent(World world, BlockPos pos, IBlockState state, BlockPortal.Size size)
|
||||
public PortalSpawnEvent(IWorld world, BlockPos pos, IBlockState state, BlockPortal.Size size)
|
||||
{
|
||||
super(world, pos, state);
|
||||
this.size = size;
|
||||
|
|
|
@ -33,6 +33,7 @@ import net.minecraft.server.integrated.IntegratedServer;
|
|||
import net.minecraft.util.IProgressUpdate;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.EnumDifficulty;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
|
@ -51,14 +52,14 @@ import net.minecraftforge.eventbus.api.Event;
|
|||
**/
|
||||
public class WorldEvent extends Event
|
||||
{
|
||||
private final World world;
|
||||
private final IWorld world;
|
||||
|
||||
public WorldEvent(World world)
|
||||
public WorldEvent(IWorld world)
|
||||
{
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
public IWorld getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ public class WorldEvent extends Event
|
|||
**/
|
||||
public static class Load extends WorldEvent
|
||||
{
|
||||
public Load(World world) { super(world); }
|
||||
public Load(IWorld world) { super(world); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,7 +100,7 @@ public class WorldEvent extends Event
|
|||
**/
|
||||
public static class Unload extends WorldEvent
|
||||
{
|
||||
public Unload(World world) { super(world); }
|
||||
public Unload(IWorld world) { super(world); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,7 +117,7 @@ public class WorldEvent extends Event
|
|||
**/
|
||||
public static class Save extends WorldEvent
|
||||
{
|
||||
public Save(World world) { super(world); }
|
||||
public Save(IWorld world) { super(world); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +135,7 @@ public class WorldEvent extends Event
|
|||
private final BlockPos pos;
|
||||
private final List<SpawnListEntry> list;
|
||||
|
||||
public PotentialSpawns(World world, EnumCreatureType type, BlockPos pos, List<SpawnListEntry> oldList)
|
||||
public PotentialSpawns(IWorld world, EnumCreatureType type, BlockPos pos, List<SpawnListEntry> oldList)
|
||||
{
|
||||
super(world);
|
||||
this.pos = pos;
|
||||
|
@ -173,7 +174,7 @@ public class WorldEvent extends Event
|
|||
public static class CreateSpawnPosition extends WorldEvent
|
||||
{
|
||||
private final WorldSettings settings;
|
||||
public CreateSpawnPosition(World world, WorldSettings settings)
|
||||
public CreateSpawnPosition(IWorld world, WorldSettings settings)
|
||||
{
|
||||
super(world);
|
||||
this.settings = settings;
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntityDispenser;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import javax.annotation.Nullable;
|
|||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IBucketPickupHandler;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
|
Loading…
Reference in a new issue