Update Patch Files

This commit is contained in:
Shaun Bennett 2015-04-21 20:15:32 -04:00
parent 60a3e1e92e
commit b0e9b93ba8
9 changed files with 2878 additions and 2290 deletions

View File

@ -0,0 +1,89 @@
From 1826c70f0d5e8cd6161b7fb78f1cec042f0c2cbd Mon Sep 17 00:00:00 2001
From: Shaun Bennett <phination@me.com>
Date: Tue, 21 Apr 2015 19:12:35 -0400
Subject: [PATCH] Mineplex - Entity Changes
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 48e2508..a94867b 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -215,7 +215,7 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource {
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
- *
+ *
* @return damage taken since the last no damage ticks time period
*/
@Deprecated
@@ -232,7 +232,7 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource {
* This method exists for legacy reasons to provide backwards
* compatibility. It will not exist at runtime and should not be used
* under any circumstances.
- *
+ *
* @param damage amount of damage
*/
@Deprecated
@@ -392,4 +392,20 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource {
* @return whether the operation was successful
*/
public boolean setLeashHolder(Entity holder);
+
+ public boolean shouldBreakLeash();
+
+ public void setShouldBreakLeash(boolean shouldBreakLeash);
+
+ public boolean shouldPullWhileLeashed();
+
+ public void setPullWhileLeashed(boolean pullWhileLeashed);
+
+ public boolean isVegetated();
+
+ public void setVegetated(boolean vegetated);
+
+ public boolean isGhost();
+
+ public void setGhost(boolean ghost);
}
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;
}
/**
--
2.3.5

View File

@ -1,162 +0,0 @@
From 8d364bbf8ea9d6632348ca84c5b075bcbe78098b Mon Sep 17 00:00:00 2001
From: Shaun Bennett <shaun@mineplex.com>
Date: Sat, 29 Nov 2014 23:14:25 -0600
Subject: [PATCH] Mineplex Changes
diff --git a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java
index 364451b..31dfe8e 100644
--- a/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java
+++ b/src/main/java/org/bukkit/event/vehicle/VehicleExitEvent.java
@@ -1,21 +1,24 @@
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 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;
}
/**
@@ -35,6 +38,11 @@ public class VehicleExitEvent extends VehicleEvent implements Cancellable {
this.cancelled = cancel;
}
+ public Entity getVehicle()
+ {
+ return vehicle;
+ }
+
@Override
public HandlerList getHandlers() {
return handlers;
diff --git a/src/main/java/org/bukkit/event/world/ChunkAddEntityEvent.java b/src/main/java/org/bukkit/event/world/ChunkAddEntityEvent.java
new file mode 100644
index 0000000..6a2b07a
--- /dev/null
+++ b/src/main/java/org/bukkit/event/world/ChunkAddEntityEvent.java
@@ -0,0 +1,35 @@
+package org.bukkit.event.world;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+/**
+ * Created by Shaun on 11/29/2014.
+ */
+public class ChunkAddEntityEvent extends Event
+{
+ private static final HandlerList handlers = new HandlerList();
+ private Entity _entity;
+
+ public ChunkAddEntityEvent(Entity entity)
+ {
+ _entity = entity;
+ }
+
+ public HandlerList getHandlers()
+ {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+
+ public Entity getEntity()
+ {
+ return _entity;
+ }
+
+}
diff --git a/src/main/java/org/bukkit/event/world/ChunkPreLoadEvent.java b/src/main/java/org/bukkit/event/world/ChunkPreLoadEvent.java
new file mode 100644
index 0000000..6764e30
--- /dev/null
+++ b/src/main/java/org/bukkit/event/world/ChunkPreLoadEvent.java
@@ -0,0 +1,62 @@
+package org.bukkit.event.world;
+
+import org.bukkit.World;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+/**
+ * Created by Shaun on 11/29/2014.
+ */
+public class ChunkPreLoadEvent extends Event implements Cancellable
+{
+ private static final HandlerList handlers = new HandlerList();
+ private boolean _cancelled;
+ private World _world;
+ private int _x;
+ private int _z;
+
+ public ChunkPreLoadEvent(World world, int x, int z)
+ {
+ _world = world;
+ _x = x;
+ _z = z;
+ }
+
+ public HandlerList getHandlers()
+ {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+
+ public World getWorld()
+ {
+ return _world;
+ }
+
+ public int getX()
+ {
+ return _x;
+ }
+
+ public int getZ()
+ {
+ return _z;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return _cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel)
+ {
+ _cancelled = cancel;
+ }
+}
--
1.9.4.msysgit.0

View File

@ -0,0 +1,235 @@
From ae9ac1273b240b9fc5209bd5c7fe59bf1072e944 Mon Sep 17 00:00:00 2001
From: Shaun Bennett <phination@me.com>
Date: Sun, 19 Apr 2015 01:54:13 -0400
Subject: [PATCH] Mineplex - Chunk Changes
diff --git a/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java
new file mode 100644
index 0000000..3f16935
--- /dev/null
+++ b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java
@@ -0,0 +1,31 @@
+package com.mineplex.spigot;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ChunkAddEntityEvent extends Event
+{
+ private static final HandlerList handlers = new HandlerList();
+ private Entity _entity;
+
+ public ChunkAddEntityEvent(Entity _entity)
+ {
+ this._entity = _entity;
+ }
+
+ public Entity getEntity()
+ {
+ return _entity;
+ }
+
+ public HandlerList getHandlers()
+ {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java
new file mode 100644
index 0000000..21d75c7
--- /dev/null
+++ b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java
@@ -0,0 +1,60 @@
+package com.mineplex.spigot;
+
+import org.bukkit.World;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ChunkPreLoadEvent extends Event implements Cancellable
+{
+ private static final HandlerList handlers = new HandlerList();
+ private boolean _cancelled;
+ private World _world;
+ private int _x;
+ private int _z;
+
+ public ChunkPreLoadEvent(World world, int x, int z)
+ {
+ _world = world;
+ _x = x;
+ _z = z;
+ }
+
+ public World getWorld()
+ {
+ return _world;
+ }
+
+ public int getX()
+ {
+ return _x;
+ }
+
+ public int getZ()
+ {
+ return _z;
+ }
+
+ @Override
+ public boolean isCancelled()
+ {
+ return _cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel)
+ {
+ _cancelled = cancel;
+ }
+
+ @Override
+ public HandlerList getHandlers()
+ {
+ return null;
+ }
+
+ public static HandlerList getHandlerList()
+ {
+ return handlers;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index d5922fe..0a0e778 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -11,6 +11,8 @@ import java.util.Map;
import java.util.Random;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
+
+import com.mineplex.spigot.ChunkAddEntityEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -660,6 +662,9 @@ public class Chunk {
entity.die();
}
+ ChunkAddEntityEvent event = new ChunkAddEntityEvent(entity.bukkitEntity);
+ Bukkit.getServer().getPluginManager().callEvent(event);
+
int k = MathHelper.floor(entity.locY / 16.0D);
if (k < 0) {
@@ -1317,6 +1322,10 @@ public class Chunk {
return this.done;
}
+ public void setDone(boolean done) {
+ this.done = done;
+ }
+
public void d(boolean flag) {
this.done = flag;
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 74710f9..b0d132f 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -8,6 +8,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+
+import com.mineplex.spigot.ChunkPreLoadEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -88,6 +90,13 @@ public class ChunkProviderServer implements IChunkProvider {
}
+ private boolean callChunkPreLoad(int i, int j)
+ {
+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j);
+ world.getServer().getPluginManager().callEvent(event);
+ return event.isCancelled();
+ }
+
// CraftBukkit start - Add async variant, provide compatibility
public Chunk getChunkIfLoaded(int x, int z) {
return chunks.get(LongHash.toLong(x, z));
@@ -109,10 +118,30 @@ public class ChunkProviderServer implements IChunkProvider {
// We can only use the queue for already generated chunks
if (chunk == null && loader != null && loader.chunkExists(world, i, j)) {
if (runnable != null) {
- ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable);
+ if (callChunkPreLoad(i, j))
+ {
+ runnable.run();
+ chunk = new EmptyChunk(world, i, j);
+ chunk.setDone(true);
+ chunks.put(LongHash.toLong(i, j), chunk);
+ }
+ else
+ {
+ ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable);
+ }
+
return null;
} else {
- chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
+ if (callChunkPreLoad(i, j))
+ {
+ chunk = new EmptyChunk(world, i, j);
+ chunk.setDone(true);
+ chunks.put(LongHash.toLong(i, j), chunk);
+ }
+ else
+ {
+ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
+ }
}
} else if (chunk == null) {
chunk = originalGetChunkAt(i, j);
@@ -131,6 +160,20 @@ public class ChunkProviderServer implements IChunkProvider {
boolean newChunk = false;
// CraftBukkit end
+ Server server = world.getServer();
+
+ if (chunk == null && server != null)
+ {
+ if (callChunkPreLoad(i, j))
+ {
+ chunk = new EmptyChunk(world, i, j);
+ chunk.setDone(true);
+ chunks.put(LongHash.toLong(i, j), chunk);
+
+ return chunk;
+ }
+ }
+
if (chunk == null) {
world.timings.syncChunkLoadTimer.startTiming(); // Spigot
chunk = this.loadChunk(i, j);
@@ -158,7 +201,6 @@ public class ChunkProviderServer implements IChunkProvider {
chunk.addEntities();
// CraftBukkit start
- Server server = world.getServer();
if (server != null) {
/*
* If it's a new world, the first few chunks are generated inside
--
2.3.5

View File

@ -0,0 +1,22 @@
From ea05a1c2416044cfea21d0442675b0094dbaecab Mon Sep 17 00:00:00 2001
From: Shaun Bennett <phination@me.com>
Date: Sun, 19 Apr 2015 02:01:08 -0400
Subject: [PATCH] Mineplex - Ignore EULA
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 86ff385..95ff1d4 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -133,7 +133,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;
--
2.3.5

View File

@ -0,0 +1,901 @@
From 03e6d60b6ac992d560d2a404e3eae2f63085edda Mon Sep 17 00:00:00 2001
From: Shaun Bennett <phination@me.com>
Date: Tue, 21 Apr 2015 19:12:35 -0400
Subject: [PATCH] Mineplex - Entity Changes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d6bef0b..c683d78 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -124,6 +124,20 @@ public abstract class Entity implements ICommandListener {
public void inactiveTick() { }
// Spigot end
+ // Mineplex
+ private boolean _silent;
+ private boolean _invisible;
+
+ public boolean isSilent()
+ {
+ return _silent;
+ }
+
+ public void setSilent(boolean silent)
+ {
+ _silent = silent;
+ }
+
public int getId() {
return this.id;
}
@@ -683,7 +697,9 @@ public abstract class Entity implements ICommandListener {
this.makeSound(this.P(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
}
- this.a(blockposition, block);
+ if (!isSilent())
+ this.a(blockposition, block);
+
block.a(this.world, blockposition, this); // CraftBukkit moved from above
}
}
@@ -785,7 +801,7 @@ public abstract class Entity implements ICommandListener {
}
public void makeSound(String s, float f, float f1) {
- if (!this.R()) {
+ if (!isSilent() || !this.R()) {
this.world.makeSound(this, s, f, f1);
}
@@ -1536,8 +1552,8 @@ 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);
pluginManager.callEvent(event);
if (event.isCancelled() || vehicle != originalVehicle) {
@@ -1553,11 +1569,11 @@ public abstract class Entity implements ICommandListener {
this.vehicle = null;
} else {
// CraftBukkit start
- if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
+ if ((this.bukkitEntity instanceof LivingEntity) && 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);
pluginManager.callEvent(exitEvent);
if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
@@ -1679,9 +1695,20 @@ public abstract class Entity implements ICommandListener {
}
public void setInvisible(boolean flag) {
+ if (isMineplexInvisible() && !flag)
+ return;
+
this.b(5, flag);
}
+ public boolean isMineplexInvisible() {
+ return _invisible;
+ }
+
+ public void setMineplexInvisible(boolean flag) {
+ _invisible = flag;
+ }
+
public void f(boolean flag) {
this.b(4, flag);
}
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..bffd3dc
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityBat.java
@@ -0,0 +1,206 @@
+package net.minecraft.server;
+
+import java.util.Calendar;
+
+public class EntityBat extends EntityAmbient {
+
+ private BlockPosition a;
+ private boolean _vegetated;
+
+ public EntityBat(World world) {
+ super(world);
+ this.setSize(0.5F, 0.9F);
+ this.setAsleep(true);
+
+ _vegetated = false;
+ }
+
+ public void setVegetated(boolean flag) {
+ _vegetated = flag;
+ }
+
+ public boolean isVegetated() {
+ return _vegetated;
+ }
+
+ protected void h() {
+ super.h();
+ this.datawatcher.a(16, new Byte((byte) 0));
+ }
+
+ protected float bB() {
+ return 0.1F;
+ }
+
+ protected float bC() {
+ return super.bC() * 0.95F;
+ }
+
+ protected String z() {
+ return this.isAsleep() && this.random.nextInt(4) != 0 ? null : "mob.bat.idle";
+ }
+
+ protected String bo() {
+ return "mob.bat.hurt";
+ }
+
+ protected String bp() {
+ return "mob.bat.death";
+ }
+
+ public boolean ae() {
+ return false;
+ }
+
+ protected void s(Entity entity) {}
+
+ protected void bL() {}
+
+ protected void initAttributes()
+ {
+ super.initAttributes();
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D);
+ }
+
+ public boolean isAsleep() {
+ return (this.datawatcher.getByte(16) & 1) != 0;
+ }
+
+ public void setAsleep(boolean flag) {
+ byte b0 = this.datawatcher.getByte(16);
+
+ if (flag) {
+ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
+ } else {
+ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
+ }
+
+ }
+
+ public void t_() {
+ super.t_();
+
+ if (isVegetated())
+ return;
+
+ if (this.isAsleep()) {
+ this.motX = this.motY = this.motZ = 0.0D;
+ this.locY = (double) MathHelper.floor(this.locY) + 1.0D - (double) this.length;
+ } else {
+ this.motY *= 0.6000000238418579D;
+ }
+
+ }
+
+ protected void E() {
+ super.E();
+
+ if (isVegetated())
+ return;
+
+ BlockPosition blockposition = new BlockPosition(this);
+ BlockPosition blockposition1 = blockposition.up();
+
+ if (this.isAsleep()) {
+ if (!this.world.getType(blockposition1).getBlock().isOccluding()) {
+ this.setAsleep(false);
+ this.world.a((EntityHuman) null, 1015, blockposition, 0);
+ } else {
+ if (this.random.nextInt(200) == 0) {
+ this.aK = (float) this.random.nextInt(360);
+ }
+
+ if (this.world.findNearbyPlayer(this, 4.0D) != null) {
+ this.setAsleep(false);
+ this.world.a((EntityHuman) null, 1015, blockposition, 0);
+ }
+ }
+ } else {
+ if (this.a != null && (!this.world.isEmpty(this.a) || this.a.getY() < 1)) {
+ this.a = null;
+ }
+
+ if (this.a == null || this.random.nextInt(30) == 0 || this.a.c((double) ((int) this.locX), (double) ((int) this.locY), (double) ((int) this.locZ)) < 4.0D) {
+ this.a = new BlockPosition((int) this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int) this.locY + this.random.nextInt(6) - 2, (int) this.locZ + this.random.nextInt(7) - this.random.nextInt(7));
+ }
+
+ double d0 = (double) this.a.getX() + 0.5D - this.locX;
+ double d1 = (double) this.a.getY() + 0.1D - this.locY;
+ double d2 = (double) this.a.getZ() + 0.5D - this.locZ;
+
+ this.motX += (Math.signum(d0) * 0.5D - this.motX) * 0.10000000149011612D;
+ this.motY += (Math.signum(d1) * 0.699999988079071D - this.motY) * 0.10000000149011612D;
+ this.motZ += (Math.signum(d2) * 0.5D - this.motZ) * 0.10000000149011612D;
+ float f = (float) (MathHelper.b(this.motZ, this.motX) * 180.0D / 3.1415927410125732D) - 90.0F;
+ float f1 = MathHelper.g(f - this.yaw);
+
+ this.ba = 0.5F;
+ this.yaw += f1;
+ if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).getBlock().isOccluding()) {
+ this.setAsleep(true);
+ }
+ }
+
+ }
+
+ protected boolean s_() {
+ return false;
+ }
+
+ public void e(float f, float f1) {}
+
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {}
+
+ public boolean aI() {
+ return true;
+ }
+
+ public boolean damageEntity(DamageSource damagesource, float f) {
+ if (this.isInvulnerable(damagesource)) {
+ return false;
+ } else {
+ if (!this.world.isClientSide && this.isAsleep()) {
+ this.setAsleep(false);
+ }
+
+ return super.damageEntity(damagesource, f);
+ }
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ this.datawatcher.watch(16, Byte.valueOf(nbttagcompound.getByte("BatFlags")));
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ nbttagcompound.setByte("BatFlags", this.datawatcher.getByte(16));
+ }
+
+ public boolean bR() {
+ BlockPosition blockposition = new BlockPosition(this.locX, this.getBoundingBox().b, this.locZ);
+
+ if (blockposition.getY() >= this.world.F()) {
+ return false;
+ } else {
+ int i = this.world.getLightLevel(blockposition);
+ byte b0 = 4;
+
+ if (this.a(this.world.Y())) {
+ b0 = 7;
+ } else if (this.random.nextBoolean()) {
+ return false;
+ }
+
+ return i > this.random.nextInt(b0) ? false : super.bR();
+ }
+ }
+
+ private boolean a(Calendar calendar) {
+ return calendar.get(2) + 1 == 10 && calendar.get(5) >= 20 || calendar.get(2) + 1 == 11 && calendar.get(5) <= 3;
+ }
+
+ public float getHeadHeight() {
+ return this.length / 2.0F;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
new file mode 100644
index 0000000..53da5c2
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -0,0 +1,207 @@
+package net.minecraft.server;
+
+public class EntityBlaze extends EntityMonster {
+
+ private float a = 0.5F;
+ private int b;
+
+ public EntityBlaze(World world) {
+ super(world);
+ this.fireProof = true;
+ this.b_ = 10;
+ this.goalSelector.a(4, new EntityBlaze.PathfinderGoalBlazeFireball(this));
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0]));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
+ }
+
+ protected void initAttributes() {
+ super.initAttributes();
+ this.getAttributeInstance(GenericAttributes.e).setValue(6.0D);
+ this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D);
+ this.getAttributeInstance(GenericAttributes.b).setValue(48.0D);
+ }
+
+ protected void h() {
+ super.h();
+ this.datawatcher.a(16, new Byte((byte) 0));
+ }
+
+ protected String z() {
+ return "mob.blaze.breathe";
+ }
+
+ protected String bo() {
+ return "mob.blaze.hit";
+ }
+
+ protected String bp() {
+ return "mob.blaze.death";
+ }
+
+ public float c(float f) {
+ return 1.0F;
+ }
+
+ public void m() {
+ if (!isVegetated() && !this.onGround && this.motY < 0.0D) {
+ this.motY *= 0.6D;
+ }
+
+ if (this.world.isClientSide) {
+ if (this.random.nextInt(24) == 0 && !this.R()) {
+ this.world.a(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F, false);
+ }
+
+ for (int i = 0; i < 2; ++i) {
+ this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]);
+ }
+ }
+
+ super.m();
+ }
+
+ protected void E() {
+ if (this.U()) {
+ this.damageEntity(DamageSource.DROWN, 1.0F);
+ }
+
+ --this.b;
+ if (this.b <= 0) {
+ this.b = 100;
+ this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F;
+ }
+
+ EntityLiving entityliving = this.getGoalTarget();
+
+ if (!isVegetated() && entityliving != null && entityliving.locY + (double) entityliving.getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) {
+ this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
+ this.ai = true;
+ }
+
+ super.E();
+ }
+
+ public void e(float f, float f1) {}
+
+ protected Item getLoot() {
+ return Items.BLAZE_ROD;
+ }
+
+ public boolean isBurning() {
+ return this.n();
+ }
+
+ protected void dropDeathLoot(boolean flag, int i) {
+ if (flag) {
+ int j = this.random.nextInt(2 + i);
+
+ for (int k = 0; k < j; ++k) {
+ this.a(Items.BLAZE_ROD, 1);
+ }
+ }
+
+ }
+
+ public boolean n() {
+ return (this.datawatcher.getByte(16) & 1) != 0;
+ }
+
+ public void a(boolean flag) {
+ byte b0 = this.datawatcher.getByte(16);
+
+ if (flag) {
+ b0 = (byte) (b0 | 1);
+ } else {
+ b0 &= -2;
+ }
+
+ this.datawatcher.watch(16, Byte.valueOf(b0));
+ }
+
+ protected boolean n_() {
+ return true;
+ }
+
+ static class PathfinderGoalBlazeFireball extends PathfinderGoal {
+
+ private EntityBlaze a;
+ private int b;
+ private int c;
+
+ public PathfinderGoalBlazeFireball(EntityBlaze entityblaze) {
+ this.a = entityblaze;
+ this.a(3);
+ }
+
+ public boolean a() {
+ EntityLiving entityliving = this.a.getGoalTarget();
+
+ return entityliving != null && entityliving.isAlive();
+ }
+
+ public void c() {
+ this.b = 0;
+ }
+
+ public void d() {
+ this.a.a(false);
+ }
+
+ public void e() {
+ --this.c;
+ EntityLiving entityliving = this.a.getGoalTarget();
+ double d0 = this.a.h(entityliving);
+
+ if (d0 < 4.0D) {
+ if (this.c <= 0) {
+ this.c = 20;
+ this.a.r(entityliving);
+ }
+
+ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D);
+ } else if (d0 < 256.0D) {
+ double d1 = entityliving.locX - this.a.locX;
+ double d2 = entityliving.getBoundingBox().b + (double) (entityliving.length / 2.0F) - (this.a.locY + (double) (this.a.length / 2.0F));
+ double d3 = entityliving.locZ - this.a.locZ;
+
+ if (this.c <= 0) {
+ ++this.b;
+ if (this.b == 1) {
+ this.c = 60;
+ this.a.a(true);
+ } else if (this.b <= 4) {
+ this.c = 6;
+ } else {
+ this.c = 100;
+ this.b = 0;
+ this.a.a(false);
+ }
+
+ if (this.b > 1) {
+ float f = MathHelper.c(MathHelper.sqrt(d0)) * 0.5F;
+
+ this.a.world.a((EntityHuman) null, 1009, new BlockPosition((int) this.a.locX, (int) this.a.locY, (int) this.a.locZ), 0);
+
+ for (int i = 0; i < 1; ++i) {
+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.a.world, this.a, d1 + this.a.bc().nextGaussian() * (double) f, d2, d3 + this.a.bc().nextGaussian() * (double) f);
+
+ entitysmallfireball.locY = this.a.locY + (double) (this.a.length / 2.0F) + 0.5D;
+ this.a.world.addEntity(entitysmallfireball);
+ }
+ }
+ }
+
+ this.a.getControllerLook().a(entityliving, 10.0F, 10.0F);
+ } else {
+ this.a.getNavigation().n();
+ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D);
+ }
+
+ super.e();
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 4bdcfc6..9539b66 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -60,6 +60,18 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
super.h();
}
+ public void setTargetBlock(int x, int y, int z) {
+ // Mineplex
+ this.a = x;
+ this.b = y;
+ this.c = z;
+ this.bA = null;
+ }
+
+ public void setTargetEntity(Entity e) {
+ this.bA = e;
+ }
+
public double[] b(int i, float f) {
if (this.getHealth() <= 0.0F) {
f = 0.0F;
@@ -170,7 +182,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.c += this.random.nextGaussian() * 2.0D;
}
- if (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E) {
+ if (!isVegetated() && (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E)) {
this.cf();
}
@@ -253,7 +265,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.bs.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
this.bt.t_();
this.bt.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
- if (!this.world.isClientSide && this.hurtTicks == 0) {
+ if (!this.world.isClientSide && this.hurtTicks == 0 && !isGhost()) {
this.a(this.world.getEntities(this, this.bs.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D)));
this.a(this.world.getEntities(this, this.bt.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D)));
this.b(this.world.getEntities(this, this.bn.getBoundingBox().grow(1.0D, 1.0D, 1.0D)));
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index ce91553..59ada33 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -17,6 +17,8 @@ public class EntityFallingBlock extends Entity {
private float fallHurtAmount = 2.0F;
public NBTTagCompound tileEntityData;
+ public boolean spectating;
+
public EntityFallingBlock(World world) {
super(world);
}
@@ -42,7 +44,7 @@ public class EntityFallingBlock extends Entity {
protected void h() {}
public boolean ad() {
- return !this.dead;
+ return !this.dead && !spectating;
}
public void t_() {
@@ -219,6 +221,14 @@ public class EntityFallingBlock extends Entity {
}
+ @Override
+ public boolean damageEntity(DamageSource damagesource, float f)
+ {
+ CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f);
+
+ return true;
+ }
+
public void a(boolean flag) {
this.hurtEntities = flag;
}
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
index 688099f..404dda2 100644
--- a/src/main/java/net/minecraft/server/EntityHorse.java
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
@@ -125,6 +125,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
private void c(int i, boolean flag) {
int j = this.datawatcher.getInt(16);
+ if (isVegetated())
+ return;
+
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 d73395a..7a9eacb 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 9621ce0..463d578 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -35,6 +35,10 @@ public abstract class EntityInsentient extends EntityLiving {
private Entity bp;
private NBTTagCompound bq;
+ private boolean _vegetated;
+ private boolean _shouldBreakLeash;
+ private boolean _pullWhileLeashed;
+
public EntityInsentient(World world) {
super(world);
this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
@@ -53,6 +57,11 @@ public abstract class EntityInsentient extends EntityLiving {
// CraftBukkit start - default persistance to type's persistance value
this.persistent = !isTypeNotPersistent();
// CraftBukkit end
+
+ // Mineplex
+ _vegetated = false;
+ _shouldBreakLeash = true;
+ _pullWhileLeashed = true;
}
protected void initAttributes() {
@@ -149,7 +158,7 @@ public abstract class EntityInsentient extends EntityLiving {
public void K() {
super.K();
this.world.methodProfiler.a("mobBaseTick");
- if (this.isAlive() && this.random.nextInt(1000) < this.a_++) {
+ if (this.isAlive() && !isSilent() && this.random.nextInt(1000) < this.a_++) {
this.a_ = -this.w();
this.x();
}
@@ -771,7 +780,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
public final boolean e(EntityHuman entityhuman) {
- if (this.cc() && this.getLeashHolder() == entityhuman) {
+ if (this.cc() && this.getLeashHolder() == entityhuman && _shouldBreakLeash) {
// CraftBukkit start - fire PlayerUnleashEntityEvent
if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
@@ -836,7 +845,7 @@ public abstract class EntityInsentient extends EntityLiving {
}
public void unleash(boolean flag, boolean flag1) {
- if (this.bo) {
+ if (this.bo && _shouldBreakLeash) {
this.bo = false;
this.bp = null;
if (!this.world.isClientSide && flag1) {
@@ -936,6 +945,32 @@ public abstract class EntityInsentient extends EntityLiving {
return this.datawatcher.getByte(15) != 0;
}
+ public void setVegetated(boolean flag) {
+ _vegetated = flag;
+ }
+
+ public void setShouldBreakLeash(boolean shouldBreakLeash)
+ {
+ _shouldBreakLeash = shouldBreakLeash;
+ }
+
+ public void setPullWhileLeashed(boolean pullWhileLeashed)
+ {
+ _pullWhileLeashed = pullWhileLeashed;
+ }
+
+ public boolean isVegetated() {
+ return _vegetated;
+ }
+
+ public boolean shouldBreakLeash() {
+ return shouldBreakLeash();
+ }
+
+ public boolean shouldPullWhileLeashed() {
+ return _pullWhileLeashed;
+ }
+
public static enum EnumEntityPositionType {
ON_GROUND, IN_AIR, IN_WATER;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 99b120a..12d735d 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -97,6 +97,8 @@ public abstract class EntityLiving extends Entity {
}
// Spigot end
+ private boolean _ghost;
+
public void G() {
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
}
@@ -1782,7 +1784,7 @@ public abstract class EntityLiving extends Entity {
}
public boolean ad() {
- return !this.dead;
+ return !isGhost() && !this.dead;
}
public boolean ae() {
@@ -1836,4 +1838,12 @@ public abstract class EntityLiving extends Entity {
protected void bP() {
this.updateEffects = true;
}
+
+ public boolean isGhost() {
+ return _ghost;
+ }
+
+ public void setGhost(boolean ghost) {
+ _ghost = ghost;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 3854edf..c52d591 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -65,10 +65,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// Spigot start
public boolean collidesWithEntities = true;
+ // Mineplex
+ public boolean spectating;
+
@Override
public boolean ad()
{
- return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
+ return !spectating && this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
}
@Override
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 2d22327..3aa9467 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -9,6 +9,9 @@ public class EntityTNTPrimed extends Entity {
public float yield = 4; // CraftBukkit - add field
public boolean isIncendiary = false; // CraftBukkit - add field
+ // Mineplex
+ public boolean spectating;
+
public EntityTNTPrimed(World world) {
super(world);
this.k = true;
@@ -37,7 +40,7 @@ public class EntityTNTPrimed extends Entity {
}
public boolean ad() {
- return !this.dead;
+ return !spectating && !this.dead;
}
public void t_() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 5317cff..3ab939f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -461,6 +461,54 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return true;
}
+ @Override
+ public boolean shouldBreakLeash()
+ {
+ return ((EntityInsentient) getHandle()).shouldBreakLeash();
+ }
+
+ @Override
+ public void setShouldBreakLeash(boolean shouldBreakLeash)
+ {
+ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash);
+ }
+
+ @Override
+ public boolean shouldPullWhileLeashed()
+ {
+ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed();
+ }
+
+ @Override
+ public void setPullWhileLeashed(boolean pullWhileLeashed)
+ {
+ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed);
+ }
+
+ @Override
+ public boolean isVegetated()
+ {
+ return ((EntityInsentient) getHandle()).isVegetated();
+ }
+
+ @Override
+ public void setVegetated(boolean vegetated)
+ {
+ ((EntityInsentient) getHandle()).setVegetated(vegetated);
+ }
+
+ @Override
+ public boolean isGhost()
+ {
+ return getHandle().isGhost();
+ }
+
+ @Override
+ public void setGhost(boolean ghost)
+ {
+ getHandle().setGhost(ghost);
+ }
+
@Deprecated
public int _INVALID_getLastDamage() {
return NumberConversions.ceil(getLastDamage());
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 06e014c..0adc2a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -874,10 +874,14 @@ 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
@@ -889,7 +893,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
@@ -1336,13 +1341,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean getCollidesWithEntities()
{
- return getHandle().collidesWithEntities;
+ return !getHandle().spectating;
+// return getHandle().collidesWithEntities;
}
@Override
public void setCollidesWithEntities(boolean collides)
{
- getHandle().collidesWithEntities = collides;
+ getHandle().spectating = !collides;
getHandle().k = collides; // First boolean of Entity
}
--
2.3.5

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,429 @@
From f41348c5d0e7540905fca648b076234fabb63db1 Mon Sep 17 00:00:00 2001
From: Shaun Bennett <phination@me.com>
Date: Tue, 21 Apr 2015 19:56:41 -0400
Subject: [PATCH] Mineplex - Item/Inventory Changes
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index a8028e3..5f62731 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -437,8 +437,8 @@ public class CraftInventory implements Inventory {
return InventoryType.ENCHANTING;
} else if (inventory instanceof TileEntityBrewingStand) {
return InventoryType.BREWING;
- } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) {
- return ((CraftInventoryCustom.MinecraftInventory) inventory).getType();
+ } else if (inventory instanceof MinecraftInventory) {
+ return ((MinecraftInventory) inventory).getType();
} else if (inventory instanceof InventoryEnderChest) {
return InventoryType.ENDER_CHEST;
} else if (inventory instanceof InventoryMerchant) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
index 947c493..eed9afa 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
@@ -31,168 +31,4 @@ public class CraftInventoryCustom extends CraftInventory {
public CraftInventoryCustom(InventoryHolder owner, int size, String title) {
super(new MinecraftInventory(owner, size, title));
}
-
- static class MinecraftInventory implements IInventory {
- private final ItemStack[] items;
- private int maxStack = MAX_STACK;
- private final List<HumanEntity> viewers;
- private final String title;
- private InventoryType type;
- private final InventoryHolder owner;
-
- public MinecraftInventory(InventoryHolder owner, InventoryType type) {
- this(owner, type.getDefaultSize(), type.getDefaultTitle());
- this.type = type;
- }
-
- public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) {
- this(owner, type.getDefaultSize(), title);
- this.type = type;
- }
-
- public MinecraftInventory(InventoryHolder owner, int size) {
- this(owner, size, "Chest");
- }
-
- public MinecraftInventory(InventoryHolder owner, int size, String title) {
- Validate.notNull(title, "Title cannot be null");
- Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters");
- this.items = new ItemStack[size];
- this.title = title;
- this.viewers = new ArrayList<HumanEntity>();
- this.owner = owner;
- this.type = InventoryType.CHEST;
- }
-
- public int getSize() {
- return items.length;
- }
-
- public ItemStack getItem(int i) {
- return items[i];
- }
-
- public ItemStack splitStack(int i, int j) {
- ItemStack stack = this.getItem(i);
- ItemStack result;
- if (stack == null) return null;
- if (stack.count <= j) {
- this.setItem(i, null);
- result = stack;
- } else {
- result = CraftItemStack.copyNMSStack(stack, j);
- stack.count -= j;
- }
- this.update();
- return result;
- }
-
- public ItemStack splitWithoutUpdate(int i) {
- ItemStack stack = this.getItem(i);
- ItemStack result;
- if (stack == null) return null;
- if (stack.count <= 1) {
- this.setItem(i, null);
- result = stack;
- } else {
- result = CraftItemStack.copyNMSStack(stack, 1);
- stack.count -= 1;
- }
- return result;
- }
-
- public void setItem(int i, ItemStack itemstack) {
- items[i] = itemstack;
- if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) {
- itemstack.count = this.getMaxStackSize();
- }
- }
-
- public int getMaxStackSize() {
- return maxStack;
- }
-
- public void setMaxStackSize(int size) {
- maxStack = size;
- }
-
- public void update() {}
-
- public boolean a(EntityHuman entityhuman) {
- return true;
- }
-
- public ItemStack[] getContents() {
- return items;
- }
-
- public void onOpen(CraftHumanEntity who) {
- viewers.add(who);
- }
-
- public void onClose(CraftHumanEntity who) {
- viewers.remove(who);
- }
-
- public List<HumanEntity> getViewers() {
- return viewers;
- }
-
- public InventoryType getType() {
- return type;
- }
-
- public InventoryHolder getOwner() {
- return owner;
- }
-
- public boolean b(int i, ItemStack itemstack) {
- return true;
- }
-
- @Override
- public void startOpen(EntityHuman entityHuman) {
-
- }
-
- @Override
- public void closeContainer(EntityHuman entityHuman) {
-
- }
-
- @Override
- public int getProperty(int i) {
- return 0;
- }
-
- @Override
- public void b(int i, int i1) {
-
- }
-
- @Override
- public int g() {
- return 0;
- }
-
- @Override
- public void l() {
-
- }
-
- @Override
- public String getName() {
- return title;
- }
-
- @Override
- public boolean hasCustomName() {
- return title != null;
- }
-
- @Override
- public IChatBaseComponent getScoreboardDisplayName() {
- return new ChatComponentText(title);
- }
- }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
index 23f05f4..fdaf026 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
@@ -26,7 +26,7 @@ import net.minecraft.server.NBTTagString;
import org.bukkit.craftbukkit.util.CraftChatMessage;
@DelegateDeserialization(ItemStack.class)
-public final class CraftItemStack extends ItemStack {
+public class CraftItemStack extends ItemStack {
public static net.minecraft.server.ItemStack asNMSCopy(ItemStack original) {
if (original instanceof CraftItemStack) {
@@ -95,26 +95,30 @@ public final class CraftItemStack extends ItemStack {
/**
* Mirror
*/
- private CraftItemStack(net.minecraft.server.ItemStack item) {
+ protected CraftItemStack(net.minecraft.server.ItemStack item) {
this.handle = item;
}
- private CraftItemStack(ItemStack item) {
+ protected CraftItemStack(ItemStack item) {
this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null);
}
- private CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) {
+ protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) {
setType(type);
setAmount(amount);
setDurability(durability);
setItemMeta(itemMeta);
}
- private CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) {
+ protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) {
this(Material.getMaterial(typeId), amount, durability, itemMeta);
}
+ public net.minecraft.server.ItemStack getHandle() {
+ return handle;
+ }
+
@Override
public int getTypeId() {
return handle != null ? CraftMagicNumbers.getId(handle.getItem()) : 0;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java
new file mode 100644
index 0000000..d90d218
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java
@@ -0,0 +1,177 @@
+package org.bukkit.craftbukkit.inventory;
+
+import net.minecraft.server.*;
+import org.apache.commons.lang.Validate;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.event.inventory.InventoryType;
+import org.bukkit.inventory.InventoryHolder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MinecraftInventory implements IInventory
+{
+ private final ItemStack[] items;
+ private int maxStack = MAX_STACK;
+ private final List<HumanEntity> viewers;
+ private final String title;
+ private InventoryType type;
+ private final InventoryHolder owner;
+
+ public MinecraftInventory(InventoryHolder owner, InventoryType type) {
+ this(owner, type.getDefaultSize(), type.getDefaultTitle());
+ this.type = type;
+ }
+
+ public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) {
+ this(owner, type.getDefaultSize(), title);
+ this.type = type;
+ }
+
+ public MinecraftInventory(InventoryHolder owner, int size) {
+ this(owner, size, "Chest");
+ }
+
+ public MinecraftInventory(InventoryHolder owner, int size, String title) {
+ Validate.notNull(title, "Title cannot be null");
+ Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters");
+ this.items = new ItemStack[size];
+ this.title = title;
+ this.viewers = new ArrayList<HumanEntity>();
+ this.owner = owner;
+ this.type = InventoryType.CHEST;
+ }
+
+ public int getSize() {
+ return items.length;
+ }
+
+ public ItemStack getItem(int i) {
+ return items[i];
+ }
+
+ public ItemStack splitStack(int i, int j) {
+ ItemStack stack = this.getItem(i);
+ ItemStack result;
+ if (stack == null) return null;
+ if (stack.count <= j) {
+ this.setItem(i, null);
+ result = stack;
+ } else {
+ result = CraftItemStack.copyNMSStack(stack, j);
+ stack.count -= j;
+ }
+ this.update();
+ return result;
+ }
+
+ public ItemStack splitWithoutUpdate(int i) {
+ ItemStack stack = this.getItem(i);
+ ItemStack result;
+ if (stack == null) return null;
+ if (stack.count <= 1) {
+ this.setItem(i, null);
+ result = stack;
+ } else {
+ result = CraftItemStack.copyNMSStack(stack, 1);
+ stack.count -= 1;
+ }
+ return result;
+ }
+
+ public void setItem(int i, ItemStack itemstack) {
+ items[i] = itemstack;
+ if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
+ }
+ }
+
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ public void update() {}
+
+ public boolean a(EntityHuman entityhuman) {
+ return true;
+ }
+
+ public ItemStack[] getContents() {
+ return items;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ viewers.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ viewers.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return viewers;
+ }
+
+ public InventoryType getType() {
+ return type;
+ }
+
+ public InventoryHolder getOwner() {
+ return owner;
+ }
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
+
+ @Override
+ public void startOpen(EntityHuman entityHuman) {
+
+ }
+
+ @Override
+ public void closeContainer(EntityHuman entityHuman) {
+
+ }
+
+ @Override
+ public int getProperty(int i) {
+ return 0;
+ }
+
+ @Override
+ public void b(int i, int i1) {
+
+ }
+
+ @Override
+ public int g() {
+ return 0;
+ }
+
+ @Override
+ public void l() {
+
+ }
+
+ @Override
+ public String getName() {
+ return title;
+ }
+
+ @Override
+ public boolean hasCustomName() {
+ return title != null;
+ }
+
+ @Override
+ public IChatBaseComponent getScoreboardDisplayName() {
+ return new ChatComponentText(title);
+ }
+}
\ No newline at end of file
--
2.3.5

View File

@ -0,0 +1,26 @@
From 3a9421a5ab5ebab8ec294d8c32e321080b07d56e Mon Sep 17 00:00:00 2001
From: Shaun Bennett <phination@me.com>
Date: Tue, 21 Apr 2015 19:58:54 -0400
Subject: [PATCH] Mineplex - World Changes
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index db0697b..35b216b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1114,9 +1114,9 @@ public class CraftWorld implements World {
( (EntityOcelot) entity ).spawnBonus = false;
}
// Spigot end
- if (entity instanceof EntityInsentient) {
- ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null);
- }
+// if (entity instanceof EntityInsentient) {
+// ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null);
+// }
world.addEntity(entity, reason);
return (T) entity.getBukkitEntity();
--
2.3.5