Skip to content

Commit

Permalink
Add all the patches of the paper about the fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Nov 8, 2020
1 parent 3341f5b commit caefe36
Show file tree
Hide file tree
Showing 66 changed files with 1,970 additions and 457 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ project(':forge') {
url 'https://repo.maven.apache.org/maven2/'
}
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public/' }
maven { url 'https://papermc.io/repo/repository/maven-public/' }
}

ext {
Expand Down Expand Up @@ -383,6 +384,9 @@ project(':forge') {
// spigot
installer 'net.md-5:bungeecord-chat:1.16-R0.3'

// paper
//installer 'co.aikar:cleaner:1.0-SNAPSHOT'

fmllauncherImplementation 'com.google.guava:guava:21.0'
fmllauncherImplementation 'com.google.code.gson:gson:2.8.0'
fmllauncherImplementation 'org.lwjgl:lwjgl:3.2.2'
Expand Down
14 changes: 11 additions & 3 deletions patches/minecraft/net/minecraft/block/AbstractRailBlock.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@
return railshape != null && railshape.func_208092_c() ? field_190959_b : field_185590_a;
}

@@ -61,7 +62,7 @@
@@ -54,6 +55,7 @@
p_235327_1_ = this.func_208489_a(p_235327_2_, p_235327_3_, p_235327_1_, true);
if (this.field_196277_c) {
p_235327_1_.func_215697_a(p_235327_2_, p_235327_3_, this, p_235327_3_, p_235327_4_);
+ p_235327_1_ = p_235327_2_.func_180495_p(p_235327_3_); // Paper - don't desync, update again
}

return p_235327_1_;
@@ -61,7 +63,7 @@

public void func_220069_a(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_, BlockPos p_220069_5_, boolean p_220069_6_) {
if (!p_220069_2_.field_72995_K && p_220069_2_.func_180495_p(p_220069_3_).func_203425_a(this)) {
Expand All @@ -26,7 +34,7 @@
if (func_235328_a_(p_220069_3_, p_220069_2_, railshape)) {
func_220075_c(p_220069_1_, p_220069_2_, p_220069_3_);
p_220069_2_.func_217377_a(p_220069_3_, p_220069_6_);
@@ -110,7 +111,7 @@
@@ -110,7 +112,7 @@
public void func_196243_a(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState 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_);
Expand All @@ -35,7 +43,7 @@
p_196243_2_.func_195593_d(p_196243_3_.func_177984_a(), this);
}

@@ -129,5 +130,20 @@
@@ -129,5 +131,20 @@
return blockstate.func_206870_a(this.func_176560_l(), flag ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH);
}

Expand Down
24 changes: 16 additions & 8 deletions patches/minecraft/net/minecraft/block/Block.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@
this.field_176227_L = builder.func_235882_a_(Block::func_176223_P, BlockState::new);
this.func_180632_j(this.field_176227_L.func_177621_b());
}
@@ -261,19 +266,46 @@
@@ -240,6 +245,7 @@

}

+ public static void dropNaturally(BlockState state, IWorld worldIn, BlockPos pos, @Nullable TileEntity tileEntityIn) { func_220059_a(state, worldIn, pos, tileEntityIn); }
public static void func_220059_a(BlockState p_220059_0_, IWorld p_220059_1_, BlockPos p_220059_2_, @Nullable TileEntity p_220059_3_) {
if (p_220059_1_ instanceof ServerWorld) {
func_220070_a(p_220059_0_, (ServerWorld)p_220059_1_, p_220059_2_, p_220059_3_).forEach((p_220061_2_) -> {
@@ -261,19 +267,46 @@
}

public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_) {
Expand Down Expand Up @@ -81,39 +89,39 @@
while(p_180637_3_ > 0) {
int i = ExperienceOrbEntity.func_70527_a(p_180637_3_);
p_180637_3_ -= i;
@@ -283,6 +315,7 @@
@@ -283,6 +316,7 @@

}

+ @Deprecated //Forge: Use more sensitive version
public float func_149638_a() {
return this.field_235689_au_;
}
@@ -332,6 +365,7 @@
@@ -332,6 +366,7 @@
p_176216_2_.func_213317_d(p_176216_2_.func_213322_ci().func_216372_d(1.0D, 0.0D, 1.0D));
}

+ @Deprecated //Forge: Use more sensitive version
public ItemStack func_185473_a(IBlockReader p_185473_1_, BlockPos p_185473_2_, BlockState p_185473_3_) {
return new ItemStack(this);
}
@@ -363,6 +397,7 @@
@@ -363,6 +398,7 @@
public void func_176224_k(World p_176224_1_, BlockPos p_176224_2_) {
}

+ @Deprecated //Forge: Use more sensitive version
public boolean func_149659_a(Explosion p_149659_1_) {
return true;
}
@@ -382,6 +417,7 @@
@@ -382,6 +418,7 @@
return this.field_196275_y;
}

+ @Deprecated //Forge: Use more sensitive version {@link IForgeBlockState#getSoundType(IWorldReader, BlockPos, Entity) }
public SoundType func_220072_p(BlockState p_220072_1_) {
return this.field_149762_H;
}
@@ -391,7 +427,7 @@
@@ -391,7 +428,7 @@
this.field_220086_i = Item.func_150898_a(this);
}

Expand All @@ -122,7 +130,7 @@
}

public boolean func_208619_r() {
@@ -399,7 +435,7 @@
@@ -399,7 +436,7 @@
}

public String toString() {
Expand All @@ -131,7 +139,7 @@
}

@OnlyIn(Dist.CLIENT)
@@ -410,6 +446,83 @@
@@ -410,6 +447,83 @@
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@

public class DetectorRailBlock extends AbstractRailBlock {
public static final EnumProperty<RailShape> field_176573_b = BlockStateProperties.field_208166_S;
@@ -72,6 +73,14 @@
@@ -66,12 +67,21 @@

private void func_176570_e(World p_176570_1_, BlockPos p_176570_2_, BlockState p_176570_3_) {
if (this.func_196260_a(p_176570_3_, p_176570_1_, p_176570_2_)) {
+ if (p_176570_3_.func_177230_c() != this) { return; } // Paper - not our block, don't do anything
boolean flag = p_176570_3_.func_177229_b(field_176574_M);
boolean flag1 = false;
List<AbstractMinecartEntity> list = this.func_200878_a(p_176570_1_, p_176570_2_, AbstractMinecartEntity.class, (Predicate<Entity>)null);
if (!list.isEmpty()) {
flag1 = true;
}
Expand All @@ -23,7 +30,7 @@

if (flag1 && !flag) {
BlockState blockstate = p_176570_3_.func_206870_a(field_176574_M, Boolean.valueOf(true));
@@ -131,6 +140,8 @@
@@ -131,6 +141,8 @@
}

List<AbstractMinecartEntity> list1 = this.func_200878_a(p_180641_2_, p_180641_3_, AbstractMinecartEntity.class, EntityPredicates.field_96566_b);
Expand Down
62 changes: 57 additions & 5 deletions patches/minecraft/net/minecraft/block/RailState.java.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/net/minecraft/block/RailState.java
+++ b/net/minecraft/block/RailState.java
@@ -15,14 +15,16 @@
@@ -15,17 +15,31 @@
private BlockState field_196923_d;
private final boolean field_208513_e;
private final List<BlockPos> field_196924_e = Lists.newArrayList();
Expand All @@ -19,7 +19,34 @@
this.func_208509_a(railshape);
}

@@ -178,7 +180,7 @@
+ public final World getWorld() { return this.field_196920_a; } // Paper - OBFHELPER
+
+ public final BlockPos getPos() { return this.field_196921_b; } // Paper - OBFHELPER
+
+ public final BlockState getRailState() { return this.field_196923_d; } // Paper - OBFHELPER
+
+ // Paper start - prevent desync
+ public boolean isValid() {
+ return this.getWorld().func_180495_p(this.getPos()).func_177230_c() == this.getRailState().func_177230_c();
+ }
+ // Paper end - prevent desync
+
public List<BlockPos> func_196907_a() {
return this.field_196924_e;
}
@@ -142,6 +156,11 @@
}

private void func_208510_c(RailState p_208510_1_) {
+ // Paper start - prevent desync
+ if (!this.isValid() || !p_208510_1_.isValid()) {
+ return;
+ }
+ // Paper end - prevent desync
this.field_196924_e.add(p_208510_1_.field_196921_b);
BlockPos blockpos = this.field_196921_b.func_177978_c();
BlockPos blockpos1 = this.field_196921_b.func_177968_d();
@@ -178,7 +197,7 @@
}
}

Expand All @@ -28,7 +55,7 @@
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -188,7 +190,7 @@
@@ -188,7 +207,7 @@
}
}

Expand All @@ -37,7 +64,7 @@
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
railshape = RailShape.ASCENDING_EAST;
}
@@ -304,7 +306,7 @@
@@ -304,7 +323,7 @@
}
}

Expand All @@ -46,7 +73,7 @@
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos.func_177984_a())) {
railshape = RailShape.ASCENDING_NORTH;
}
@@ -314,7 +316,7 @@
@@ -314,7 +333,7 @@
}
}

Expand All @@ -55,3 +82,28 @@
if (AbstractRailBlock.func_208488_a(this.field_196920_a, blockpos3.func_177984_a())) {
railshape = RailShape.ASCENDING_EAST;
}
@@ -332,10 +351,14 @@
this.field_196923_d = this.field_196923_d.func_206870_a(this.field_196922_c.func_176560_l(), railshape);
if (p_226941_2_ || this.field_196920_a.func_180495_p(this.field_196921_b) != this.field_196923_d) {
this.field_196920_a.func_180501_a(this.field_196921_b, this.field_196923_d, 3);
-
+ // Paper start - prevent desync
+ if (!this.isValid()) {
+ return this;
+ }
+ // Paper end - prevent desync
for(int i = 0; i < this.field_196924_e.size(); ++i) {
RailState railstate = this.func_196908_a(this.field_196924_e.get(i));
- if (railstate != null) {
+ if (railstate != null && railstate.isValid()) { // Paper - prevent desync
railstate.func_196903_f();
if (railstate.func_196905_c(this)) {
railstate.func_208510_c(this);
@@ -348,6 +371,6 @@
}

public BlockState func_196916_c() {
- return this.field_196923_d;
+ return this.getWorld().func_180495_p(this.getPos()); // Paper - prevent desync
}
}
8 changes: 6 additions & 2 deletions patches/minecraft/net/minecraft/block/SpongeBlock.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
++i;
if (j < 6) {
queue.add(new Tuple<>(blockpos1, j + 1));
@@ -80,6 +88,36 @@
@@ -80,6 +88,40 @@
}
}

Expand All @@ -88,7 +88,11 @@
+ // NOP
+ } else if (material == Material.field_203243_f || material == Material.field_204868_h) {
+ TileEntity tileentity = blockState.hasTileEntity() ? p_176312_1_.func_175625_s(blockposition2) : null;
+ func_220059_a(blockState, p_176312_1_, blockposition2, tileentity);
+ // Paper start
+ if (block.getHandle().func_185904_a() == Material.field_151579_a) {
+ dropNaturally(blockState, p_176312_1_, blockposition2, tileentity);
+ }
+ // Paper end
+ }
+ }
+ p_176312_1_.func_180501_a(blockposition2, block.getHandle(), block.getFlag());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
--- a/net/minecraft/command/impl/DifficultyCommand.java
+++ b/net/minecraft/command/impl/DifficultyCommand.java
@@ -9,6 +9,7 @@
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.Difficulty;
+import net.minecraft.world.server.ServerWorld;

public class DifficultyCommand {
private static final DynamicCommandExceptionType field_198349_a = new DynamicCommandExceptionType((p_208823_0_) -> {
@@ -35,10 +36,11 @@

public static int func_198345_a(CommandSource p_198345_0_, Difficulty p_198345_1_) throws CommandSyntaxException {
MinecraftServer minecraftserver = p_198345_0_.func_197028_i();
- if (minecraftserver.func_240793_aU_().func_176130_y() == p_198345_1_) {
+ ServerWorld world = p_198345_0_.func_197023_e(); // Paper
+ if (world.field_241103_E_.func_176130_y() == p_198345_1_) {
throw field_198349_a.create(p_198345_1_.func_151526_b());
} else {
- minecraftserver.func_147139_a(p_198345_1_, true);
+ minecraftserver.setDifficultyForAllWorlds(world, p_198345_1_, true);
p_198345_0_.func_197030_a(new TranslationTextComponent("commands.difficulty.success", p_198345_1_.func_199285_b()), true);
return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
DispenserBlock.func_199774_a(Items.field_196152_dE, new DefaultDispenseItemBehavior() {
public ItemStack func_82487_b(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
Direction direction = p_82487_1_.func_189992_e().func_177229_b(DispenserBlock.field_176441_a);
- FireworkRocketEntity fireworkrocketentity = new FireworkRocketEntity(p_82487_1_.func_197524_h(), p_82487_2_, p_82487_1_.func_82615_a(), p_82487_1_.func_82617_b(), p_82487_1_.func_82615_a(), true);
+ double d0 = (double)direction.func_82601_c();
+ double d1 = (double)direction.func_96559_d();
+ double d2 = (double)direction.func_82599_e();
Expand Down Expand Up @@ -137,7 +138,7 @@
+ }
+ }
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
FireworkRocketEntity fireworkrocketentity = new FireworkRocketEntity(p_82487_1_.func_197524_h(), p_82487_2_, p_82487_1_.func_82615_a(), p_82487_1_.func_82617_b(), p_82487_1_.func_82615_a(), true);
+ FireworkRocketEntity fireworkrocketentity = new FireworkRocketEntity(p_82487_1_.func_197524_h(), itemstack1, p_82487_1_.func_82615_a(), p_82487_1_.func_82617_b(), p_82487_1_.func_82615_a(), true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed
IDispenseItemBehavior.func_239785_a_(p_82487_1_, fireworkrocketentity, direction);
fireworkrocketentity.func_70186_c((double)direction.func_82601_c(), (double)direction.func_96559_d(), (double)direction.func_82599_e(), 0.5F, 1.0F);
p_82487_1_.func_197524_h().func_217376_c(fireworkrocketentity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
public int func_184492_k() {
return this.func_184212_Q().func_187225_a(field_184499_b);
}
@@ -146,6 +166,17 @@
@@ -146,10 +166,27 @@
this.field_184505_h = p_184486_1_;
}

Expand All @@ -80,15 +80,25 @@
public void func_70071_h_() {
super.func_70071_h_();
boolean flag = this.func_184497_n();
@@ -217,6 +248,7 @@
float f = this.func_184490_j();
+ // Paper start - fix MC-114618
+ if (f < 0.0F) {
+ this.func_70106_y();
+ return;
+ }
+ // Paper end
if (this.field_70170_p.field_72995_K) {
IParticleData iparticledata = this.func_195058_l();
if (flag) {
@@ -217,6 +254,7 @@
if (this.field_70173_aa % 5 == 0) {
Iterator<Entry<Entity, Integer>> iterator = this.field_184504_g.entrySet().iterator();

+ List<org.bukkit.entity.LivingEntity> entities = new java.util.ArrayList<org.bukkit.entity.LivingEntity>(); // CraftBukkit
while(iterator.hasNext()) {
Entry<Entity, Integer> entry = iterator.next();
if (this.field_70173_aa >= entry.getValue()) {
@@ -242,13 +274,24 @@
@@ -242,13 +280,24 @@
double d1 = livingentity.func_226281_cx_() - this.func_226281_cx_();
double d2 = d0 * d0 + d1 * d1;
if (d2 <= (double)(f * f)) {
Expand Down
Loading

0 comments on commit caefe36

Please sign in to comment.