PaperMC/Spigot-Server-Patches/mc-dev-imports.patch
2014-11-27 17:17:45 -08:00

266 lines
No EOL
9.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
Date: Thu, 27 Nov 2014 23:53:56 -0600
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+public abstract class BlockMinecartTrackAbstract extends Block {
+
+ protected final boolean a;
+
+ public static boolean d(World world, BlockPosition blockposition) {
+ return d(world.getType(blockposition));
+ }
+
+ public static boolean d(IBlockData iblockdata) {
+ Block block = iblockdata.getBlock();
+
+ return block == Blocks.RAIL || 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 AxisAlignedBB a(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ return null;
+ }
+
+ public boolean c() {
+ return false;
+ }
+
+ public MovingObjectPosition a(World world, BlockPosition blockposition, Vec3D vec3d, Vec3D vec3d1) {
+ this.updateShape(world, blockposition);
+ return super.a(world, blockposition, vec3d, vec3d1);
+ }
+
+ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) {
+ IBlockData iblockdata = iblockaccess.getType(blockposition);
+ EnumTrackPosition enumtrackposition = iblockdata.getBlock() == this ? (EnumTrackPosition) iblockdata.get(this.l()) : null;
+
+ if (enumtrackposition != null && enumtrackposition.c()) {
+ 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 boolean canPlace(World world, BlockPosition blockposition) {
+ return World.a((IBlockAccess) world, blockposition.down());
+ }
+
+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ if (!world.isStatic) {
+ iblockdata = this.a(world, blockposition, iblockdata, true);
+ if (this.a) {
+ this.doPhysics(world, blockposition, iblockdata, this);
+ }
+ }
+
+ }
+
+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ if (!world.isStatic) {
+ EnumTrackPosition enumtrackposition = (EnumTrackPosition) iblockdata.get(this.l());
+ boolean flag = false;
+
+ if (!World.a((IBlockAccess) world, blockposition.down())) {
+ flag = true;
+ }
+
+ if (enumtrackposition == EnumTrackPosition.ASCENDING_EAST && !World.a((IBlockAccess) world, blockposition.east())) {
+ flag = true;
+ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_WEST && !World.a((IBlockAccess) world, blockposition.west())) {
+ flag = true;
+ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_NORTH && !World.a((IBlockAccess) world, blockposition.north())) {
+ flag = true;
+ } else if (enumtrackposition == EnumTrackPosition.ASCENDING_SOUTH && !World.a((IBlockAccess) world, blockposition.south())) {
+ flag = true;
+ }
+
+ if (flag) {
+ this.b(world, blockposition, iblockdata, 0);
+ world.setAir(blockposition);
+ } else {
+ this.b(world, blockposition, iblockdata, block);
+ }
+
+ }
+ }
+
+ protected void b(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {}
+
+ protected IBlockData a(World world, BlockPosition blockposition, IBlockData iblockdata, boolean flag) {
+ return world.isStatic ? iblockdata : (new MinecartTrackLogic(this, world, blockposition, iblockdata)).a(world.isBlockIndirectlyPowered(blockposition), flag).b();
+ }
+
+ public int i() {
+ return 0;
+ }
+
+ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ super.remove(world, blockposition, iblockdata);
+ if (((EnumTrackPosition) iblockdata.get(this.l())).c()) {
+ world.applyPhysics(blockposition.up(), this);
+ }
+
+ if (this.a) {
+ world.applyPhysics(blockposition, this);
+ world.applyPhysics(blockposition.down(), this);
+ }
+
+ }
+
+ public abstract IBlockState l();
+}
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+public class MobEffectAttackDamage extends MobEffectList {
+
+ protected MobEffectAttackDamage(int i, MinecraftKey minecraftkey, boolean flag, int j) {
+ super(i, minecraftkey, 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);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox {
+
+ public float a;
+ public float f;
+ public int g;
+ private int h;
+
+ public TileEntityEnderChest() {}
+
+ public void c() {
+ if (++this.h % 20 * 4 == 0) {
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ this.f = this.a;
+ int i = this.position.getX();
+ int j = this.position.getY();
+ int k = this.position.getZ();
+ float f = 0.1F;
+ double d0;
+
+ if (this.g > 0 && this.a == 0.0F) {
+ double d1 = (double) i + 0.5D;
+
+ d0 = (double) k + 0.5D;
+ this.world.makeSound(d1, (double) j + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) {
+ float f1 = this.a;
+
+ if (this.g > 0) {
+ this.a += f;
+ } else {
+ this.a -= f;
+ }
+
+ if (this.a > 1.0F) {
+ this.a = 1.0F;
+ }
+
+ float f2 = 0.5F;
+
+ if (this.a < f2 && f1 >= f2) {
+ d0 = (double) i + 0.5D;
+ double d2 = (double) k + 0.5D;
+
+ this.world.makeSound(d0, (double) j + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
+ }
+
+ if (this.a < 0.0F) {
+ this.a = 0.0F;
+ }
+ }
+
+ }
+
+ public boolean c(int i, int j) {
+ if (i == 1) {
+ this.g = j;
+ return true;
+ } else {
+ return super.c(i, j);
+ }
+ }
+
+ public void y() {
+ this.E();
+ super.y();
+ }
+
+ public void b() {
+ ++this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ public void d() {
+ --this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ public boolean a(EntityHuman entityhuman) {
+ return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
@@ -0,0 +0,0 @@
+package net.minecraft.server;
+
+public class TileEntityLightDetector extends TileEntity implements IUpdatePlayerListBox {
+
+ public TileEntityLightDetector() {}
+
+ public void c() {
+ if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) {
+ this.e = this.w();
+ if (this.e instanceof BlockDaylightDetector) {
+ ((BlockDaylightDetector) this.e).d(this.world, this.position);
+ }
+ }
+
+ }
+}
--