Work around for blocking rail duplication

This commit is contained in:
Dmck2b 2014-08-31 14:44:52 -05:00 committed by Zach Brown
parent cab333b217
commit 9c68e2eb9f
3 changed files with 206 additions and 0 deletions

View File

@ -4,6 +4,157 @@ Date: Tue, 22 Jul 2014 21:05:53 -0500
Subject: [PATCH] mc-dev imports
diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
new file mode 100644
index 0000000..d36aacb
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
@@ -0,0 +1,145 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public abstract class BlockMinecartTrackAbstract extends Block {
+
+ protected final boolean a;
+
+ public static final boolean b_(World world, int i, int j, int k) {
+ return a(world.getType(i, j, k));
+ }
+
+ public static final boolean a(Block block) {
+ return block == Blocks.RAILS || block == Blocks.GOLDEN_RAIL || block == Blocks.DETECTOR_RAIL || block == Blocks.ACTIVATOR_RAIL;
+ }
+
+ protected BlockMinecartTrackAbstract(boolean flag) {
+ super(Material.ORIENTABLE);
+ this.a = flag;
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
+ this.a(CreativeModeTab.e);
+ }
+
+ public boolean e() {
+ return this.a;
+ }
+
+ public AxisAlignedBB a(World world, int i, int j, int k) {
+ return null;
+ }
+
+ public boolean c() {
+ return false;
+ }
+
+ public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
+ this.updateShape(world, i, j, k);
+ return super.a(world, i, j, k, vec3d, vec3d1);
+ }
+
+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
+ int l = iblockaccess.getData(i, j, k);
+
+ if (l >= 2 && l <= 5) {
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
+ } else {
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
+ }
+ }
+
+ public boolean d() {
+ return false;
+ }
+
+ public int b() {
+ return 9;
+ }
+
+ public int a(Random random) {
+ return 1;
+ }
+
+ public boolean canPlace(World world, int i, int j, int k) {
+ return World.a((IBlockAccess) world, i, j - 1, k);
+ }
+
+ public void onPlace(World world, int i, int j, int k) {
+ if (!world.isStatic) {
+ this.a(world, i, j, k, true);
+ if (this.a) {
+ this.doPhysics(world, i, j, k, this);
+ }
+ }
+ }
+
+ public void doPhysics(World world, int i, int j, int k, Block block) {
+ if (!world.isStatic) {
+ int l = world.getData(i, j, k);
+ int i1 = l;
+
+ if (this.a) {
+ i1 = l & 7;
+ }
+
+ boolean flag = false;
+
+ if (!World.a((IBlockAccess) world, i, j - 1, k)) {
+ flag = true;
+ }
+
+ if (i1 == 2 && !World.a((IBlockAccess) world, i + 1, j, k)) {
+ flag = true;
+ }
+
+ if (i1 == 3 && !World.a((IBlockAccess) world, i - 1, j, k)) {
+ flag = true;
+ }
+
+ if (i1 == 4 && !World.a((IBlockAccess) world, i, j, k - 1)) {
+ flag = true;
+ }
+
+ if (i1 == 5 && !World.a((IBlockAccess) world, i, j, k + 1)) {
+ flag = true;
+ }
+
+ if (flag) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ } else {
+ this.a(world, i, j, k, l, i1, block);
+ }
+ }
+ }
+
+ protected void a(World world, int i, int j, int k, int l, int i1, Block block) {}
+
+ protected void a(World world, int i, int j, int k, boolean flag) {
+ if (!world.isStatic) {
+ (new MinecartTrackLogic(this, world, i, j, k)).a(world.isBlockIndirectlyPowered(i, j, k), flag);
+ }
+ }
+
+ public int h() {
+ return 0;
+ }
+
+ public void remove(World world, int i, int j, int k, Block block, int l) {
+ int i1 = l;
+
+ if (this.a) {
+ i1 = l & 7;
+ }
+
+ super.remove(world, i, j, k, block, l);
+ if (i1 == 2 || i1 == 3 || i1 == 4 || i1 == 5) {
+ world.applyPhysics(i, j + 1, k, block);
+ }
+
+ if (this.a) {
+ world.applyPhysics(i, j, k, block);
+ world.applyPhysics(i, j - 1, k, block);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
new file mode 100644
index 0000000..3eb029d

View File

@ -0,0 +1,27 @@
From 7363f5f1647664776c48e011b431544859d4a908 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sun, 31 Aug 2014 12:24:10 -0500
Subject: [PATCH] test
diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
new file mode 100644
index 0000000..3eb029d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
@@ -0,0 +1,12 @@
+package net.minecraft.server;
+
+public class MobEffectAttackDamage extends MobEffectList {
+
+ protected MobEffectAttackDamage(int i, boolean flag, int j) {
+ super(i, flag, j);
+ }
+
+ public double a(int i, AttributeModifier attributemodifier) {
+ return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1);
+ }
+}
--
1.9.4.msysgit.1

View File

@ -0,0 +1,28 @@
From 8f0bafafcc47878484eb88076d3198c0dec7dd43 Mon Sep 17 00:00:00 2001
From: Dmck2b <suddenly@suddenly.coffee>
Date: Sun, 31 Aug 2014 18:12:10 +0100
Subject: [PATCH] Temporary fix for rails dupe
diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
index d36aacb..925c1f9 100644
--- a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
@@ -105,8 +105,12 @@ public abstract class BlockMinecartTrackAbstract extends Block {
}
if (flag) {
- this.b(world, i, j, k, world.getData(i, j, k), 0);
- world.setAir(i, j, k);
+ // PaperSpigot start - Rails dupe workaround
+ if (world.getType(i, j, k).getMaterial() != Material.AIR) {
+ this.b(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ }
+ // PaperSpigot end
} else {
this.a(world, i, j, k, l, i1, block);
}
--
1.9.4.msysgit.0