Fix Furnace Minecarts losing all of their velocity on corners
This commit is contained in:
parent
2eb853b0af
commit
3ebeccc109
@ -1,4 +1,4 @@
|
||||
From 4b137c6b41c6fb9c38e2cd48b09f6bdab46ddfe7 Mon Sep 17 00:00:00 2001
|
||||
From cd3036746ad8fd0286f07c257fa2321f76ad610a Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <zach.brown@destroystokyo.com>
|
||||
Date: Mon, 25 May 2015 15:37:00 -0500
|
||||
Subject: [PATCH] mc-dev imports
|
||||
@ -3013,6 +3013,157 @@ index 0000000..2f01bbf
|
||||
+ return this.getOrCreateChunk(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
|
||||
new file mode 100644
|
||||
index 0000000..55f04b4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
|
||||
@@ -0,0 +1,145 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+public class EntityMinecartFurnace extends EntityMinecartAbstract {
|
||||
+
|
||||
+ private int c;
|
||||
+ public double a;
|
||||
+ public double b;
|
||||
+
|
||||
+ public EntityMinecartFurnace(World world) {
|
||||
+ super(world);
|
||||
+ }
|
||||
+
|
||||
+ public EntityMinecartFurnace(World world, double d0, double d1, double d2) {
|
||||
+ super(world, d0, d1, d2);
|
||||
+ }
|
||||
+
|
||||
+ public EnumMinecartType s() {
|
||||
+ return EnumMinecartType.FURNACE;
|
||||
+ }
|
||||
+
|
||||
+ protected void h() {
|
||||
+ super.h();
|
||||
+ this.datawatcher.a(16, new Byte((byte) 0));
|
||||
+ }
|
||||
+
|
||||
+ public void t_() {
|
||||
+ super.t_();
|
||||
+ if (this.c > 0) {
|
||||
+ --this.c;
|
||||
+ }
|
||||
+
|
||||
+ if (this.c <= 0) {
|
||||
+ this.a = this.b = 0.0D;
|
||||
+ }
|
||||
+
|
||||
+ this.i(this.c > 0);
|
||||
+ if (this.j() && this.random.nextInt(4) == 0) {
|
||||
+ this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ protected double m() {
|
||||
+ return 0.2D;
|
||||
+ }
|
||||
+
|
||||
+ public void a(DamageSource damagesource) {
|
||||
+ super.a(damagesource);
|
||||
+ if (!damagesource.isExplosion() && this.world.getGameRules().getBoolean("doEntityDrops")) {
|
||||
+ this.a(new ItemStack(Blocks.FURNACE, 1), 0.0F);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ protected void a(BlockPosition blockposition, IBlockData iblockdata) {
|
||||
+ super.a(blockposition, iblockdata);
|
||||
+ double d0 = this.a * this.a + this.b * this.b;
|
||||
+
|
||||
+ if (d0 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) {
|
||||
+ d0 = (double) MathHelper.sqrt(d0);
|
||||
+ this.a /= d0;
|
||||
+ this.b /= d0;
|
||||
+ if (this.a * this.motX + this.b * this.motZ < 0.0D) {
|
||||
+ this.a = 0.0D;
|
||||
+ this.b = 0.0D;
|
||||
+ } else {
|
||||
+ double d1 = d0 / this.m();
|
||||
+
|
||||
+ this.a *= d1;
|
||||
+ this.b *= d1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ protected void o() {
|
||||
+ double d0 = this.a * this.a + this.b * this.b;
|
||||
+
|
||||
+ if (d0 > 1.0E-4D) {
|
||||
+ d0 = (double) MathHelper.sqrt(d0);
|
||||
+ this.a /= d0;
|
||||
+ this.b /= d0;
|
||||
+ double d1 = 1.0D;
|
||||
+
|
||||
+ this.motX *= 0.800000011920929D;
|
||||
+ this.motY *= 0.0D;
|
||||
+ this.motZ *= 0.800000011920929D;
|
||||
+ this.motX += this.a * d1;
|
||||
+ this.motZ += this.b * d1;
|
||||
+ } else {
|
||||
+ this.motX *= 0.9800000190734863D;
|
||||
+ this.motY *= 0.0D;
|
||||
+ this.motZ *= 0.9800000190734863D;
|
||||
+ }
|
||||
+
|
||||
+ super.o();
|
||||
+ }
|
||||
+
|
||||
+ public boolean e(EntityHuman entityhuman) {
|
||||
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
+
|
||||
+ if (itemstack != null && itemstack.getItem() == Items.COAL) {
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count == 0) {
|
||||
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
|
||||
+ }
|
||||
+
|
||||
+ this.c += 3600;
|
||||
+ }
|
||||
+
|
||||
+ this.a = this.locX - entityhuman.locX;
|
||||
+ this.b = this.locZ - entityhuman.locZ;
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ protected void b(NBTTagCompound nbttagcompound) {
|
||||
+ super.b(nbttagcompound);
|
||||
+ nbttagcompound.setDouble("PushX", this.a);
|
||||
+ nbttagcompound.setDouble("PushZ", this.b);
|
||||
+ nbttagcompound.setShort("Fuel", (short) this.c);
|
||||
+ }
|
||||
+
|
||||
+ protected void a(NBTTagCompound nbttagcompound) {
|
||||
+ super.a(nbttagcompound);
|
||||
+ this.a = nbttagcompound.getDouble("PushX");
|
||||
+ this.b = nbttagcompound.getDouble("PushZ");
|
||||
+ this.c = nbttagcompound.getShort("Fuel");
|
||||
+ }
|
||||
+
|
||||
+ protected boolean j() {
|
||||
+ return (this.datawatcher.getByte(16) & 1) != 0;
|
||||
+ }
|
||||
+
|
||||
+ protected void i(boolean flag) {
|
||||
+ if (flag) {
|
||||
+ this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) | 1)));
|
||||
+ } else {
|
||||
+ this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) & -2)));
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ public IBlockData u() {
|
||||
+ return (this.j() ? Blocks.LIT_FURNACE : Blocks.FURNACE).getBlockData().set(BlockFurnace.FACING, EnumDirection.NORTH);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
|
||||
new file mode 100644
|
||||
index 0000000..57b3d9d
|
||||
|
@ -0,0 +1,38 @@
|
||||
From 301c9572f887f801b027e43cfc4121e4fd520828 Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thinkofdeath@spigotmc.org>
|
||||
Date: Mon, 15 Feb 2016 23:16:00 -0600
|
||||
Subject: [PATCH] Fix FurnaceMinecarts losing all of their velocity on certain
|
||||
corners
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
|
||||
index 55f04b4..908620d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java
|
||||
@@ -58,17 +58,12 @@ public class EntityMinecartFurnace extends EntityMinecartAbstract {
|
||||
|
||||
if (d0 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) {
|
||||
d0 = (double) MathHelper.sqrt(d0);
|
||||
- this.a /= d0;
|
||||
- this.b /= d0;
|
||||
- if (this.a * this.motX + this.b * this.motZ < 0.0D) {
|
||||
- this.a = 0.0D;
|
||||
- this.b = 0.0D;
|
||||
- } else {
|
||||
- double d1 = d0 / this.m();
|
||||
-
|
||||
- this.a *= d1;
|
||||
- this.b *= d1;
|
||||
- }
|
||||
+ // PaperSpigot - Don't lose all your velocity on corners
|
||||
+ // https://bugs.mojang.com/browse/MC-51053?focusedCommentId=223854
|
||||
+ double d1 = (double) MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
|
||||
+ this.a = (motX / d1) * d0;
|
||||
+ this.b = (motZ / d1) * d0;
|
||||
+ // PaperSpigot end
|
||||
}
|
||||
|
||||
}
|
||||
--
|
||||
2.7.1
|
||||
|
Loading…
Reference in New Issue
Block a user