mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-12 06:58:11 +02:00
219 lines
6.9 KiB
Diff
219 lines
6.9 KiB
Diff
From 5fad8a996eeca6952e2db084f9ddb41ae4f65fa9 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <Zbob750@live.com>
|
|
Date: Tue, 22 Jul 2014 21:05:53 -0500
|
|
Subject: [PATCH] mc-dev imports
|
|
|
|
|
|
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);
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
|
new file mode 100644
|
|
index 0000000..9342a3f
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java
|
|
@@ -0,0 +1,74 @@
|
|
+package net.minecraft.server;
|
|
+
|
|
+import java.util.Random;
|
|
+
|
|
+public class RandomPositionGenerator {
|
|
+
|
|
+ private static Vec3D a = Vec3D.a(0.0D, 0.0D, 0.0D);
|
|
+
|
|
+ public static Vec3D a(EntityCreature entitycreature, int i, int j) {
|
|
+ return c(entitycreature, i, j, (Vec3D) null);
|
|
+ }
|
|
+
|
|
+ public static Vec3D a(EntityCreature entitycreature, int i, int j, Vec3D vec3d) {
|
|
+ a.a = vec3d.a - entitycreature.locX;
|
|
+ a.b = vec3d.b - entitycreature.locY;
|
|
+ a.c = vec3d.c - entitycreature.locZ;
|
|
+ return c(entitycreature, i, j, a);
|
|
+ }
|
|
+
|
|
+ public static Vec3D b(EntityCreature entitycreature, int i, int j, Vec3D vec3d) {
|
|
+ a.a = entitycreature.locX - vec3d.a;
|
|
+ a.b = entitycreature.locY - vec3d.b;
|
|
+ a.c = entitycreature.locZ - vec3d.c;
|
|
+ return c(entitycreature, i, j, a);
|
|
+ }
|
|
+
|
|
+ private static Vec3D c(EntityCreature entitycreature, int i, int j, Vec3D vec3d) {
|
|
+ Random random = entitycreature.aI();
|
|
+ boolean flag = false;
|
|
+ int k = 0;
|
|
+ int l = 0;
|
|
+ int i1 = 0;
|
|
+ float f = -99999.0F;
|
|
+ boolean flag1;
|
|
+
|
|
+ if (entitycreature.bY()) {
|
|
+ double d0 = (double) (entitycreature.bV().e(MathHelper.floor(entitycreature.locX), MathHelper.floor(entitycreature.locY), MathHelper.floor(entitycreature.locZ)) + 4.0F);
|
|
+ double d1 = (double) (entitycreature.bW() + (float) i);
|
|
+
|
|
+ flag1 = d0 < d1 * d1;
|
|
+ } else {
|
|
+ flag1 = false;
|
|
+ }
|
|
+
|
|
+ for (int j1 = 0; j1 < 10; ++j1) {
|
|
+ int k1 = random.nextInt(2 * i) - i;
|
|
+ int l1 = random.nextInt(2 * j) - j;
|
|
+ int i2 = random.nextInt(2 * i) - i;
|
|
+
|
|
+ if (vec3d == null || (double) k1 * vec3d.a + (double) i2 * vec3d.c >= 0.0D) {
|
|
+ k1 += MathHelper.floor(entitycreature.locX);
|
|
+ l1 += MathHelper.floor(entitycreature.locY);
|
|
+ i2 += MathHelper.floor(entitycreature.locZ);
|
|
+ if (!flag1 || entitycreature.b(k1, l1, i2)) {
|
|
+ float f1 = entitycreature.a(k1, l1, i2);
|
|
+
|
|
+ if (f1 > f) {
|
|
+ f = f1;
|
|
+ k = k1;
|
|
+ l = l1;
|
|
+ i1 = i2;
|
|
+ flag = true;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (flag) {
|
|
+ return Vec3D.a((double) k, (double) l, (double) i1);
|
|
+ } else {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
+}
|
|
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..b205ab7
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java
|
|
@@ -0,0 +1,84 @@
|
|
+package net.minecraft.server;
|
|
+
|
|
+public class TileEntityEnderChest extends TileEntity {
|
|
+
|
|
+ public float a;
|
|
+ public float i;
|
|
+ public int j;
|
|
+ private int k;
|
|
+
|
|
+ public TileEntityEnderChest() {}
|
|
+
|
|
+ public void h() {
|
|
+ super.h();
|
|
+ if (++this.k % 20 * 4 == 0) {
|
|
+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
|
|
+ }
|
|
+
|
|
+ this.i = this.a;
|
|
+ float f = 0.1F;
|
|
+ double d0;
|
|
+
|
|
+ if (this.j > 0 && this.a == 0.0F) {
|
|
+ double d1 = (double) this.x + 0.5D;
|
|
+
|
|
+ d0 = (double) this.z + 0.5D;
|
|
+ this.world.makeSound(d1, (double) this.y + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
|
|
+ }
|
|
+
|
|
+ if (this.j == 0 && this.a > 0.0F || this.j > 0 && this.a < 1.0F) {
|
|
+ float f1 = this.a;
|
|
+
|
|
+ if (this.j > 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) this.x + 0.5D;
|
|
+ double d2 = (double) this.z + 0.5D;
|
|
+
|
|
+ this.world.makeSound(d0, (double) this.y + 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.j = j;
|
|
+ return true;
|
|
+ } else {
|
|
+ return super.c(i, j);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public void s() {
|
|
+ this.u();
|
|
+ super.s();
|
|
+ }
|
|
+
|
|
+ public void a() {
|
|
+ ++this.j;
|
|
+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
|
|
+ }
|
|
+
|
|
+ public void b() {
|
|
+ --this.j;
|
|
+ this.world.playBlockAction(this.x, this.y, this.z, Blocks.ENDER_CHEST, 1, this.j);
|
|
+ }
|
|
+
|
|
+ public boolean a(EntityHuman entityhuman) {
|
|
+ return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 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..143cffb
|
|
--- /dev/null
|
|
+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java
|
|
@@ -0,0 +1,15 @@
|
|
+package net.minecraft.server;
|
|
+
|
|
+public class TileEntityLightDetector extends TileEntity {
|
|
+
|
|
+ public TileEntityLightDetector() {}
|
|
+
|
|
+ public void h() {
|
|
+ if (this.world != null && !this.world.isStatic && this.world.getTime() % 20L == 0L) {
|
|
+ this.h = this.q();
|
|
+ if (this.h instanceof BlockDaylightDetector) {
|
|
+ ((BlockDaylightDetector) this.h).e(this.world, this.x, this.y, this.z);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+}
|
|
--
|
|
1.9.1
|
|
|