Modify Craftbukkit

This commit is contained in:
libraryaddict 2015-10-23 21:28:01 +13:00
parent aedf04b3e3
commit de9678a20f
12 changed files with 359 additions and 412 deletions

View File

@ -1,46 +0,0 @@
From 0b2e6d55efca6de55c7e6dc48de65c7c4ffb6166 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 04:37:32 +1300
Subject: [PATCH] Change VehicleExitEvent to support non-vechicles
diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java
index 364451b..9d36cad 100644
--- a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java
+++ b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java
@@ -1,21 +1,29 @@
package org.bukkit.event.vehicle;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* Raised when a living entity exits a vehicle.
*/
-public class VehicleExitEvent extends VehicleEvent implements Cancellable {
+public class VehicleExitEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final LivingEntity exited;
+ private final Entity vehicle;
- public VehicleExitEvent(final Vehicle vehicle, final LivingEntity exited) {
- super(vehicle);
+ public VehicleExitEvent(final Entity vehicle, final LivingEntity exited) {
this.exited = exited;
+ this.vehicle = vehicle;
+ }
+
+ public Entity getVehicle()
+ {
+ return vehicle;
}
/**
--
1.9.5.msysgit.0

View File

@ -1,7 +1,7 @@
From c465eb8207feeb742f11eee16e7e1f44b0e3f33c Mon Sep 17 00:00:00 2001
From f037882f13b3ea9d0a0137260e365a4332a8e751 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 04:38:17 +1300
Subject: [PATCH] Change LivingEntity to support Mineplex calls
Date: Fri, 23 Oct 2015 21:23:18 +1300
Subject: [PATCH] LivingEntity changes
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java

View File

@ -1,7 +1,7 @@
From 4ddf4eaf665e146583fe29d22045e17738bd8160 Mon Sep 17 00:00:00 2001
From b9014b76bbb262a39ce2d70cbe831ceb07acf68d Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 04:44:17 +1300
Subject: [PATCH] Modifications to Packets, mostly making fields public
Date: Fri, 23 Oct 2015 21:14:50 +1300
Subject: [PATCH] Modify packets to public
diff --git a/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java b/src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java
@ -1929,6 +1929,54 @@ index 0000000..9a40921
+ }
+}
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java
new file mode 100644
index 0000000..c799c99
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java
@@ -0,0 +1,41 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutUpdateHealth
+ implements Packet<PacketListenerPlayOut>
+{
+ public float a;
+ public int b;
+ public float c;
+
+ public PacketPlayOutUpdateHealth()
+ {
+ }
+
+ public PacketPlayOutUpdateHealth(float f, int i, float f1)
+ {
+ a = f;
+ b = i;
+ c = f1;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer)
+ {
+ a = packetdataserializer.readFloat();
+ b = packetdataserializer.e();
+ c = packetdataserializer.readFloat();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer)
+ {
+ packetdataserializer.writeFloat(a);
+ packetdataserializer.b(b);
+ packetdataserializer.writeFloat(c);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout)
+ {
+ packetlistenerplayout.a(this);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java
new file mode 100644
index 0000000..4c2705b

View File

@ -1,11 +1,11 @@
From 2cd75b80dd6039fb20279d0d17a5429323ec2c18 Mon Sep 17 00:00:00 2001
From 9f12f0f7abe2a94fe4a724a7c17245b9c0f33a70 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 04:56:35 +1300
Subject: [PATCH] Modifications to entities
Date: Fri, 23 Oct 2015 21:16:07 +1300
Subject: [PATCH] Modifiy entity
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e345dd7..ee19bd6 100644
index e345dd7..cb9ba53 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -137,6 +137,31 @@ public abstract class Entity implements ICommandListener {
@ -60,28 +60,35 @@ index e345dd7..ee19bd6 100644
this.world.makeSound(this, s, f, f1);
}
@@ -1537,8 +1564,8 @@ public abstract class Entity implements ICommandListener {
@@ -984,6 +1011,10 @@ public abstract class Entity implements ICommandListener {
this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1;
+
+ if (this instanceof EntityLiving)
+ ((EntityLiving) this).aK = f;
+
double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) {
@@ -1537,7 +1568,7 @@ public abstract class Entity implements ICommandListener {
if (entity == null) {
if (this.vehicle != null) {
// CraftBukkit start
- if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
- VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ if ((this.bukkitEntity instanceof LivingEntity)) {
+ VehicleExitEvent event = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ if ((this.bukkitEntity instanceof LivingEntity) && vehicle.getBukkitEntity() instanceof Vehicle) {
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
pluginManager.callEvent(event);
if (event.isCancelled() || vehicle != originalVehicle) {
@@ -1557,8 +1584,8 @@ public abstract class Entity implements ICommandListener {
@@ -1557,7 +1588,7 @@ public abstract class Entity implements ICommandListener {
if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
// It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are.
VehicleExitEvent exitEvent = null;
- if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) {
- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ if (this.vehicle != null) {
+ exitEvent = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
pluginManager.callEvent(exitEvent);
if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java
new file mode 100644
index 0000000..c078fa6
@ -594,19 +601,6 @@ index f131419..f293118 100644
if (flag) {
this.datawatcher.watch(16, Integer.valueOf(j | i));
} else {
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index eb54e7f..66c3d0c 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -133,7 +133,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.g != null) {
ItemStack itemstack = this.inventory.getItemInHand();
- if (itemstack == this.g) {
+ if (ItemStack.equals(itemstack, this.g)) {
if (this.h <= 25 && this.h % 4 == 0) {
this.b(itemstack, 5);
}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index a8a327d..b7647bc 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
@ -754,30 +748,6 @@ index 2d22327..83e71c1 100644
}
public void t_() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 49c7fa6..0cd36e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -836,7 +836,7 @@ public class CraftWorld implements World {
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
if (data != null) {
- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!");
+ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
} else {
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
}
@@ -1122,10 +1122,6 @@ public class CraftWorld implements World {
public <T extends Entity> T addEntity(net.minecraft.server.Entity entity, SpawnReason reason) throws IllegalArgumentException {
Preconditions.checkArgument(entity != null, "Cannot spawn null entity");
- if (entity instanceof EntityInsentient) {
- ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null);
- }
-
world.addEntity(entity, reason);
return (T) entity.getBukkitEntity();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 5317cff..60e8584 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@ -829,62 +799,6 @@ index 5317cff..60e8584 100644
public double getHealth() {
return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth());
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 29082aa..2d508b0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -325,7 +325,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public <T> void playEffect(Location loc, Effect effect, T data) {
if (data != null) {
- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!");
+ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
} else {
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
}
@@ -870,10 +870,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void hidePlayer(Player player) {
+ hidePlayer(player, false, true);
+ }
+
+ public void hidePlayer(Player player, boolean override, boolean hideList)
+ {
Validate.notNull(player, "hidden player cannot be null");
if (getHandle().playerConnection == null) return;
if (equals(player)) return;
- if (hiddenPlayers.contains(player.getUniqueId())) return;
+ if (!override && hiddenPlayers.contains(player.getUniqueId())) return;
hiddenPlayers.add(player.getUniqueId());
//remove this player from the hidden player's EntityTrackerEntry
@@ -885,7 +890,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
//remove the hidden player from this player user list
- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
+ if (hideList)
+ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
}
@Override
@@ -1363,13 +1369,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean getCollidesWithEntities()
{
- return getHandle().collidesWithEntities;
+ return !getHandle().spectating;
}
@Override
public void setCollidesWithEntities(boolean collides)
{
- getHandle().collidesWithEntities = collides;
+ getHandle().spectating = collides;
getHandle().k = collides; // First boolean of Entity
}
--
1.9.5.msysgit.0

View File

@ -1,7 +1,7 @@
From 2cb042088947c79ccde8d49ad957a861120ba57d Mon Sep 17 00:00:00 2001
From 71c20f9d0c8bfa388f6bf0ba1a7b765a83e9de2a Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 04:57:46 +1300
Subject: [PATCH] Add Mineplex chunk events, misc modifications.
Date: Fri, 23 Oct 2015 21:21:32 +1300
Subject: [PATCH] Chunk changes
diff --git a/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java
@ -230,54 +230,6 @@ index 975d666..a55bd6c 100644
if (server != null) {
/*
* If it's a new world, the first few chunks are generated inside
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index c30867d..b86369b 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -132,7 +132,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." );
}
// Spigot End
- if (!this.p.a() && !eulaAgreed) { // Spigot
+ if (false && !this.p.a() && !eulaAgreed) { // Spigot
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
this.p.b();
return false;
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 4f280dd..73a288c 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -59,7 +59,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
this.A();
}
- private void A() {
+ public void A() {
if (this.i && this.j > 0 && !this.world.isClientSide && this.k > 0) {
double d0 = (double) (this.j * 10 + 10);
byte b0 = 0;
@@ -94,7 +94,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
}
- private void B() {
+ public void B() {
int i = this.j;
int j = this.position.getX();
int k = this.position.getY();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2759425..f57c785 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -412,7 +412,7 @@ public final class CraftServer implements Server {
int delta = Integer.MAX_VALUE;
for (Player player : getOnlinePlayers()) {
if (player.getName().toLowerCase().startsWith(lowerName)) {
- int curDelta = Math.abs(player.getName().length() - lowerName.length());
+ int curDelta = player.getName().length() - lowerName.length();
if (curDelta < delta) {
found = player;
delta = curDelta;
--
1.9.5.msysgit.0

View File

@ -1,7 +1,7 @@
From 97a412e3bbb4bf718e132b2f8c779b434b772e05 Mon Sep 17 00:00:00 2001
From 47c08a6099856faf0049c0b0cdde495a8ae4166e Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 04:45:17 +1300
Subject: [PATCH] Add Mineplex packetlisteners
Date: Fri, 23 Oct 2015 21:22:05 +1300
Subject: [PATCH] Packet listener changes
diff --git a/src/main/java/com/mineplex/spigot/IPacketVerifier.java b/src/main/java/com/mineplex/spigot/IPacketVerifier.java

View File

@ -1,6 +1,6 @@
From 251376d9f0a36844f72d955fbc9334c34d8294a5 Mon Sep 17 00:00:00 2001
From 702360d29859ed580b44255ccb7f2f124e6aa24b Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 04:50:19 +1300
Date: Fri, 23 Oct 2015 21:22:36 +1300
Subject: [PATCH] Inventory changes

View File

@ -1,57 +0,0 @@
From 3532fbe2e215a6a0ccee91c7bab806054039424b Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 21 Oct 2015 19:53:48 +1300
Subject: [PATCH] Add missing update packet
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java
new file mode 100644
index 0000000..c799c99
--- /dev/null
+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateHealth.java
@@ -0,0 +1,41 @@
+package net.minecraft.server;
+
+import java.io.IOException;
+
+public class PacketPlayOutUpdateHealth
+ implements Packet<PacketListenerPlayOut>
+{
+ public float a;
+ public int b;
+ public float c;
+
+ public PacketPlayOutUpdateHealth()
+ {
+ }
+
+ public PacketPlayOutUpdateHealth(float f, int i, float f1)
+ {
+ a = f;
+ b = i;
+ c = f1;
+ }
+
+ public void a(PacketDataSerializer packetdataserializer)
+ {
+ a = packetdataserializer.readFloat();
+ b = packetdataserializer.e();
+ c = packetdataserializer.readFloat();
+ }
+
+ public void b(PacketDataSerializer packetdataserializer)
+ {
+ packetdataserializer.writeFloat(a);
+ packetdataserializer.b(b);
+ packetdataserializer.writeFloat(c);
+ }
+
+ public void a(PacketListenerPlayOut packetlistenerplayout)
+ {
+ packetlistenerplayout.a(this);
+ }
+}
\ No newline at end of file
--
1.9.5.msysgit.0

View File

@ -0,0 +1,277 @@
From 088fc9372c061edac80ee5cce669382ebed0b1e3 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:23:00 +1300
Subject: [PATCH] Misc changes
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
new file mode 100644
index 0000000..2263d5d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
@@ -0,0 +1,101 @@
+package net.minecraft.server;
+
+public class ControllerLook
+{
+ private EntityInsentient a;
+ private float b;
+ private float c;
+ private boolean d;
+ private double e;
+ private double f;
+ private double g;
+
+ public ControllerLook(EntityInsentient paramEntityInsentient)
+ {
+ this.a = paramEntityInsentient;
+ }
+
+ public void a(Entity paramEntity, float paramFloat1, float paramFloat2) {
+ this.e = paramEntity.locX;
+ if ((paramEntity instanceof EntityLiving))
+ this.f = (paramEntity.locY + paramEntity.getHeadHeight());
+ else {
+ this.f = ((paramEntity.getBoundingBox().b + paramEntity.getBoundingBox().e) / 2.0D);
+ }
+ this.g = paramEntity.locZ;
+ this.b = paramFloat1;
+ this.c = paramFloat2;
+ this.d = true;
+ }
+
+ public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) {
+ this.e = paramDouble1;
+ this.f = paramDouble2;
+ this.g = paramDouble3;
+ this.b = paramFloat1;
+ this.c = paramFloat2;
+ this.d = true;
+ }
+
+ public void a() {
+ if (a.isVegetated())
+ return;
+ this.a.pitch = 0.0F;
+
+ if (this.d) {
+ this.d = false;
+
+ double d1 = this.e - this.a.locX;
+ double d2 = this.f - (this.a.locY + this.a.getHeadHeight());
+ double d3 = this.g - this.a.locZ;
+ double d4 = MathHelper.sqrt(d1 * d1 + d3 * d3);
+
+ float f1 = (float)(MathHelper.b(d3, d1) * 180.0D / 3.141592741012573D) - 90.0F;
+ float f2 = (float)-(MathHelper.b(d2, d4) * 180.0D / 3.141592741012573D);
+ this.a.pitch = a(this.a.pitch, f2, this.c);
+ this.a.aK = a(this.a.aK, f1, this.b);
+ } else {
+ this.a.aK = a(this.a.aK, this.a.aI, 10.0F);
+ }
+
+ float f3 = MathHelper.g(this.a.aK - this.a.aI);
+
+ if (!this.a.getNavigation().m())
+ {
+ if (f3 < -75.0F) {
+ this.a.aK = (this.a.aI - 75.0F);
+ }
+ if (f3 > 75.0F)
+ this.a.aK = (this.a.aI + 75.0F);
+ }
+ }
+
+ private float a(float paramFloat1, float paramFloat2, float paramFloat3)
+ {
+ float f1 = MathHelper.g(paramFloat2 - paramFloat1);
+ if (f1 > paramFloat3) {
+ f1 = paramFloat3;
+ }
+ if (f1 < -paramFloat3) {
+ f1 = -paramFloat3;
+ }
+ return paramFloat1 + f1;
+ }
+
+ public boolean b() {
+ return this.d;
+ }
+
+ public double e()
+ {
+ return this.e;
+ }
+
+ public double f() {
+ return this.f;
+ }
+
+ public double g() {
+ return this.g;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index c30867d..b86369b 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -132,7 +132,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." );
}
// Spigot End
- if (!this.p.a() && !eulaAgreed) { // Spigot
+ if (false && !this.p.a() && !eulaAgreed) { // Spigot
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
this.p.b();
return false;
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index eb54e7f..66c3d0c 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -133,7 +133,7 @@ public abstract class EntityHuman extends EntityLiving {
if (this.g != null) {
ItemStack itemstack = this.inventory.getItemInHand();
- if (itemstack == this.g) {
+ if (ItemStack.equals(itemstack, this.g)) {
if (this.h <= 25 && this.h % 4 == 0) {
this.b(itemstack, 5);
}
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 4f280dd..73a288c 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -59,7 +59,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
this.A();
}
- private void A() {
+ public void A() {
if (this.i && this.j > 0 && !this.world.isClientSide && this.k > 0) {
double d0 = (double) (this.j * 10 + 10);
byte b0 = 0;
@@ -94,7 +94,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
}
- private void B() {
+ public void B() {
int i = this.j;
int j = this.position.getX();
int k = this.position.getY();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2759425..f57c785 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -412,7 +412,7 @@ public final class CraftServer implements Server {
int delta = Integer.MAX_VALUE;
for (Player player : getOnlinePlayers()) {
if (player.getName().toLowerCase().startsWith(lowerName)) {
- int curDelta = Math.abs(player.getName().length() - lowerName.length());
+ int curDelta = player.getName().length() - lowerName.length();
if (curDelta < delta) {
found = player;
delta = curDelta;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 49c7fa6..0cd36e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -836,7 +836,7 @@ public class CraftWorld implements World {
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
if (data != null) {
- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!");
+ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
} else {
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
}
@@ -1122,10 +1122,6 @@ public class CraftWorld implements World {
public <T extends Entity> T addEntity(net.minecraft.server.Entity entity, SpawnReason reason) throws IllegalArgumentException {
Preconditions.checkArgument(entity != null, "Cannot spawn null entity");
- if (entity instanceof EntityInsentient) {
- ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null);
- }
-
world.addEntity(entity, reason);
return (T) entity.getBukkitEntity();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 29082aa..e979f69 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -325,7 +325,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public <T> void playEffect(Location loc, Effect effect, T data) {
if (data != null) {
- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!");
+ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
} else {
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
}
@@ -870,10 +870,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void hidePlayer(Player player) {
+ hidePlayer(player, false, true);
+ }
+
+ public void hidePlayer(Player player, boolean override, boolean hideList)
+ {
Validate.notNull(player, "hidden player cannot be null");
if (getHandle().playerConnection == null) return;
if (equals(player)) return;
- if (hiddenPlayers.contains(player.getUniqueId())) return;
+ if (!override && hiddenPlayers.contains(player.getUniqueId())) return;
hiddenPlayers.add(player.getUniqueId());
//remove this player from the hidden player's EntityTrackerEntry
@@ -885,11 +890,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
//remove the hidden player from this player user list
- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
+ if (hideList)
+ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
}
@Override
public void showPlayer(Player player) {
+ showPlayer(player, true);
+ }
+
+ public void showPlayer(Player player, boolean showList)
+ {
Validate.notNull(player, "shown player cannot be null");
if (getHandle().playerConnection == null) return;
if (equals(player)) return;
@@ -899,7 +910,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
EntityTracker tracker = ((WorldServer) entity.world).tracker;
EntityPlayer other = ((CraftPlayer) player).getHandle();
- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
+ if (showList)
+ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.getId());
if (entry != null && !entry.trackedPlayers.contains(getHandle())) {
@@ -1363,13 +1375,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean getCollidesWithEntities()
{
- return getHandle().collidesWithEntities;
+ return !getHandle().spectating;
}
@Override
public void setCollidesWithEntities(boolean collides)
{
- getHandle().collidesWithEntities = collides;
+ getHandle().spectating = collides;
getHandle().k = collides; // First boolean of Entity
}
--
1.9.5.msysgit.0

View File

@ -1,24 +0,0 @@
From ff4ee42a168c7990c2d39e7a19adfc14496182bd Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Thu, 22 Oct 2015 05:50:51 +1300
Subject: [PATCH] Set aK field on LivingEntity spawn to do facing direction
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index ee19bd6..f940b45 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1011,6 +1011,10 @@ public abstract class Entity implements ICommandListener {
this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1;
+
+ if (this instanceof EntityLiving)
+ ((EntityLiving) this).aK = f;
+
double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) {
--
1.9.5.msysgit.0

View File

@ -1,117 +0,0 @@
From 9f0406a4f0cd0ed941f2e167f9badf6fc4d1ebcf Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Thu, 22 Oct 2015 07:57:48 +1300
Subject: [PATCH] Add and modify ControllerLook to ignore vegetated entities
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
new file mode 100644
index 0000000..2263d5d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
@@ -0,0 +1,101 @@
+package net.minecraft.server;
+
+public class ControllerLook
+{
+ private EntityInsentient a;
+ private float b;
+ private float c;
+ private boolean d;
+ private double e;
+ private double f;
+ private double g;
+
+ public ControllerLook(EntityInsentient paramEntityInsentient)
+ {
+ this.a = paramEntityInsentient;
+ }
+
+ public void a(Entity paramEntity, float paramFloat1, float paramFloat2) {
+ this.e = paramEntity.locX;
+ if ((paramEntity instanceof EntityLiving))
+ this.f = (paramEntity.locY + paramEntity.getHeadHeight());
+ else {
+ this.f = ((paramEntity.getBoundingBox().b + paramEntity.getBoundingBox().e) / 2.0D);
+ }
+ this.g = paramEntity.locZ;
+ this.b = paramFloat1;
+ this.c = paramFloat2;
+ this.d = true;
+ }
+
+ public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) {
+ this.e = paramDouble1;
+ this.f = paramDouble2;
+ this.g = paramDouble3;
+ this.b = paramFloat1;
+ this.c = paramFloat2;
+ this.d = true;
+ }
+
+ public void a() {
+ if (a.isVegetated())
+ return;
+ this.a.pitch = 0.0F;
+
+ if (this.d) {
+ this.d = false;
+
+ double d1 = this.e - this.a.locX;
+ double d2 = this.f - (this.a.locY + this.a.getHeadHeight());
+ double d3 = this.g - this.a.locZ;
+ double d4 = MathHelper.sqrt(d1 * d1 + d3 * d3);
+
+ float f1 = (float)(MathHelper.b(d3, d1) * 180.0D / 3.141592741012573D) - 90.0F;
+ float f2 = (float)-(MathHelper.b(d2, d4) * 180.0D / 3.141592741012573D);
+ this.a.pitch = a(this.a.pitch, f2, this.c);
+ this.a.aK = a(this.a.aK, f1, this.b);
+ } else {
+ this.a.aK = a(this.a.aK, this.a.aI, 10.0F);
+ }
+
+ float f3 = MathHelper.g(this.a.aK - this.a.aI);
+
+ if (!this.a.getNavigation().m())
+ {
+ if (f3 < -75.0F) {
+ this.a.aK = (this.a.aI - 75.0F);
+ }
+ if (f3 > 75.0F)
+ this.a.aK = (this.a.aI + 75.0F);
+ }
+ }
+
+ private float a(float paramFloat1, float paramFloat2, float paramFloat3)
+ {
+ float f1 = MathHelper.g(paramFloat2 - paramFloat1);
+ if (f1 > paramFloat3) {
+ f1 = paramFloat3;
+ }
+ if (f1 < -paramFloat3) {
+ f1 = -paramFloat3;
+ }
+ return paramFloat1 + f1;
+ }
+
+ public boolean b() {
+ return this.d;
+ }
+
+ public double e()
+ {
+ return this.e;
+ }
+
+ public double f() {
+ return this.f;
+ }
+
+ public double g() {
+ return this.g;
+ }
+}
\ No newline at end of file
--
1.9.5.msysgit.0

Binary file not shown.