3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-20 21:40:06 +01:00
Paper/Spigot-Server-Patches/0003-mc-dev-imports.patch

330 Zeilen
11 KiB
Diff

2015-05-30 08:11:16 +02:00
From 1485ddd960cb7aef077e350e6f6aac921f1c762e Mon Sep 17 00:00:00 2001
2015-01-29 22:25:50 +01:00
From: Zach Brown <zach.brown@destroystokyo.com>
2015-05-25 22:59:30 +02:00
Date: Mon, 25 May 2015 15:37:00 -0500
Subject: [PATCH] mc-dev imports
2015-04-17 11:51:46 +02:00
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
new file mode 100644
index 0000000..29f8554
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
@@ -0,0 +1,75 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+public class BlockFalling extends Block {
+
+ public static boolean instaFall;
+
+ public BlockFalling() {
+ super(Material.SAND);
+ this.a(CreativeModeTab.b);
+ }
+
+ public BlockFalling(Material material) {
+ super(material);
+ }
+
+ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) {
+ world.a(blockposition, (Block) this, this.a(world));
+ }
+
+ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) {
+ world.a(blockposition, (Block) this, this.a(world));
+ }
+
+ public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
+ if (!world.isClientSide) {
+ this.f(world, blockposition);
+ }
+
+ }
+
+ private void f(World world, BlockPosition blockposition) {
+ if (canFall(world, blockposition.down()) && blockposition.getY() >= 0) {
+ byte b0 = 32;
+
+ if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) {
+ if (!world.isClientSide) {
+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition));
+
+ this.a(entityfallingblock);
+ world.addEntity(entityfallingblock);
+ }
+ } else {
+ world.setAir(blockposition);
+
+ BlockPosition blockposition1;
+
+ for (blockposition1 = blockposition.down(); canFall(world, blockposition1) && blockposition1.getY() > 0; blockposition1 = blockposition1.down()) {
+ ;
+ }
+
+ if (blockposition1.getY() > 0) {
+ world.setTypeUpdate(blockposition1.up(), this.getBlockData());
+ }
+ }
+
+ }
+ }
+
+ protected void a(EntityFallingBlock entityfallingblock) {}
+
+ public int a(World world) {
+ return 2;
+ }
+
+ public static boolean canFall(World world, BlockPosition blockposition) {
+ Block block = world.getType(blockposition).getBlock();
+ Material material = block.material;
+
+ return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA;
+ }
+
+ public void a_(World world, BlockPosition blockposition) {}
+}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
new file mode 100644
2015-05-25 22:59:30 +02:00
index 0000000..57b3d9d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
2015-05-25 22:59:30 +02:00
@@ -0,0 +1,100 @@
+package net.minecraft.server;
+
+public class ItemBlock extends Item {
+
+ protected final Block a;
+
+ public ItemBlock(Block block) {
+ this.a = block;
+ }
+
+ public ItemBlock b(String s) {
+ super.c(s);
+ return this;
+ }
+
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
+ IBlockData iblockdata = world.getType(blockposition);
+ Block block = iblockdata.getBlock();
+
2015-03-08 02:16:09 +01:00
+ if (!block.a(world, blockposition)) {
+ blockposition = blockposition.shift(enumdirection);
+ }
+
+ if (itemstack.count == 0) {
+ return false;
+ } else if (!entityhuman.a(blockposition, enumdirection, itemstack)) {
+ return false;
+ } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) {
+ int i = this.filterData(itemstack.getData());
+ IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman);
+
+ if (world.setTypeAndData(blockposition, iblockdata1, 3)) {
+ iblockdata1 = world.getType(blockposition);
+ if (iblockdata1.getBlock() == this.a) {
2015-05-25 22:59:30 +02:00
+ a(world, entityhuman, blockposition, itemstack);
+ this.a.postPlace(world, blockposition, iblockdata1, entityhuman, itemstack);
+ }
+
+ world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), this.a.stepSound.getPlaceSound(), (this.a.stepSound.getVolume1() + 1.0F) / 2.0F, this.a.stepSound.getVolume2() * 0.8F);
+ --itemstack.count;
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
2015-05-25 22:59:30 +02:00
+ public static boolean a(World world, EntityHuman entityhuman, BlockPosition blockposition, ItemStack itemstack) {
+ MinecraftServer minecraftserver = MinecraftServer.getServer();
+
2015-05-25 22:59:30 +02:00
+ if (minecraftserver == null) {
+ return false;
+ } else {
+ if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("BlockEntityTag", 10)) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
2015-05-25 22:59:30 +02:00
+ if (tileentity != null) {
+ if (!world.isClientSide && tileentity.F() && !minecraftserver.getPlayerList().isOp(entityhuman.getProfile())) {
+ return false;
+ }
+
2015-05-25 22:59:30 +02:00
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.clone();
+
+ tileentity.b(nbttagcompound);
+ NBTTagCompound nbttagcompound2 = (NBTTagCompound) itemstack.getTag().get("BlockEntityTag");
+
+ nbttagcompound.a(nbttagcompound2);
+ nbttagcompound.setInt("x", blockposition.getX());
+ nbttagcompound.setInt("y", blockposition.getY());
+ nbttagcompound.setInt("z", blockposition.getZ());
+ if (!nbttagcompound.equals(nbttagcompound1)) {
+ tileentity.a(nbttagcompound);
+ tileentity.update();
+ return true;
+ }
+ }
+ }
+
2015-05-25 22:59:30 +02:00
+ return false;
+ }
+ }
+
2015-05-25 22:59:30 +02:00
+ public String e_(ItemStack itemstack) {
+ return this.a.a();
+ }
+
+ public String getName() {
+ return this.a.a();
+ }
+
+ public Block d() {
+ return this.a;
+ }
+
+ public Item c(String s) {
+ return this.b(s);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
new file mode 100644
2014-11-28 02:17:45 +01:00
index 0000000..620685a
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java
@@ -0,0 +1,12 @@
+package net.minecraft.server;
+
+public class MobEffectAttackDamage extends MobEffectList {
+
2014-11-28 02:17:45 +01:00
+ 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
2014-11-28 02:17:45 +01:00
index 0000000..794cdc8
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
2014-11-28 02:17:45 +01:00
@@ -0,0 +1,87 @@
+package net.minecraft.server;
+
2014-11-28 02:17:45 +01:00
+public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox {
+
+ public float a;
2014-11-28 02:17:45 +01:00
+ public float f;
+ public int g;
+ private int h;
+
+ public TileEntityEnderChest() {}
+
2014-11-28 02:17:45 +01:00
+ public void c() {
+ if (++this.h % 20 * 4 == 0) {
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
2014-11-28 02:17:45 +01:00
+ 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;
+
2014-11-28 02:17:45 +01:00
+ if (this.g > 0 && this.a == 0.0F) {
+ double d1 = (double) i + 0.5D;
+
2014-11-28 02:17:45 +01:00
+ 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);
+ }
+
2014-11-28 02:17:45 +01:00
+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) {
+ float f1 = this.a;
+
2014-11-28 02:17:45 +01:00
+ 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) {
2014-11-28 02:17:45 +01:00
+ d0 = (double) i + 0.5D;
+ double d2 = (double) k + 0.5D;
+
2014-11-28 02:17:45 +01:00
+ 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;
+ }
+ }
2014-11-28 02:17:45 +01:00
+
+ }
+
+ public boolean c(int i, int j) {
+ if (i == 1) {
2014-11-28 02:17:45 +01:00
+ this.g = j;
+ return true;
+ } else {
+ return super.c(i, j);
+ }
+ }
+
2014-11-28 02:17:45 +01:00
+ public void y() {
+ this.E();
+ super.y();
+ }
+
2014-11-28 02:17:45 +01:00
+ public void b() {
+ ++this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
2014-11-28 02:17:45 +01:00
+ public void d() {
+ --this.g;
+ this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g);
+ }
+
+ public boolean a(EntityHuman entityhuman) {
2014-11-28 02:17:45 +01:00
+ 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
2015-03-08 02:16:09 +01:00
index 0000000..f75e2de
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
2014-11-28 02:17:45 +01:00
@@ -0,0 +1,16 @@
+package net.minecraft.server;
+
2014-11-28 02:17:45 +01:00
+public class TileEntityLightDetector extends TileEntity implements IUpdatePlayerListBox {
+
+ public TileEntityLightDetector() {}
+
2014-11-28 02:17:45 +01:00
+ public void c() {
2015-03-08 02:16:09 +01:00
+ if (this.world != null && !this.world.isClientSide && this.world.getTime() % 20L == 0L) {
2014-11-28 02:17:45 +01:00
+ this.e = this.w();
+ if (this.e instanceof BlockDaylightDetector) {
2015-03-08 02:16:09 +01:00
+ ((BlockDaylightDetector) this.e).f(this.world, this.position);
+ }
+ }
2014-11-28 02:17:45 +01:00
+
+ }
+}
2015-01-07 05:13:40 +01:00
--
2015-05-19 01:41:57 +02:00
2.4.1.windows.1