Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/Spigot-Server-Patches/0003-mc-dev-imports.patch
2015-06-01 22:27:22 -07:00

371 Zeilen
12 KiB
Diff

From ac9821545063d6507b166969b3c1be76471d91db 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
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
index 0000000..57b3d9d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -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();
+
+ 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) {
+ 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;
+ }
+ }
+
+ public static boolean a(World world, EntityHuman entityhuman, BlockPosition blockposition, ItemStack itemstack) {
+ MinecraftServer minecraftserver = MinecraftServer.getServer();
+
+ if (minecraftserver == null) {
+ return false;
+ } else {
+ if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("BlockEntityTag", 10)) {
+ TileEntity tileentity = world.getTileEntity(blockposition);
+
+ if (tileentity != null) {
+ if (!world.isClientSide && tileentity.F() && !minecraftserver.getPlayerList().isOp(entityhuman.getProfile())) {
+ return false;
+ }
+
+ 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;
+ }
+ }
+ }
+
+ return false;
+ }
+ }
+
+ 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/ItemMilkBucket.java b/src/main/java/net/minecraft/server/ItemMilkBucket.java
new file mode 100644
index 0000000..91ea70d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemMilkBucket.java
@@ -0,0 +1,35 @@
+package net.minecraft.server;
+
+public class ItemMilkBucket extends Item {
+
+ public ItemMilkBucket() {
+ this.c(1);
+ this.a(CreativeModeTab.f);
+ }
+
+ public ItemStack b(ItemStack itemstack, World world, EntityHuman entityhuman) {
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ }
+
+ if (!world.isClientSide) {
+ entityhuman.removeAllEffects();
+ }
+
+ entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]);
+ return itemstack.count <= 0 ? new ItemStack(Items.BUCKET) : itemstack;
+ }
+
+ public int d(ItemStack itemstack) {
+ return 32;
+ }
+
+ public EnumAnimation e(ItemStack itemstack) {
+ return EnumAnimation.DRINK;
+ }
+
+ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
+ entityhuman.a(itemstack, this.d(itemstack));
+ return itemstack;
+ }
+}
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..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 {
+
+ 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 0000000..794cdc8
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
@@ -0,0 +1,87 @@
+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 0000000..f75e2de
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
@@ -0,0 +1,16 @@
+package net.minecraft.server;
+
+public class TileEntityLightDetector extends TileEntity implements IUpdatePlayerListBox {
+
+ public TileEntityLightDetector() {}
+
+ public void c() {
+ if (this.world != null && !this.world.isClientSide && this.world.getTime() % 20L == 0L) {
+ this.e = this.w();
+ if (this.e instanceof BlockDaylightDetector) {
+ ((BlockDaylightDetector) this.e).f(this.world, this.position);
+ }
+ }
+
+ }
+}
--
1.9.5.msysgit.1