refactor: clean source code
This commit is contained in:
22
Patches/Bukkit-Patches/0001-Update-groupId.patch
Normal file
22
Patches/Bukkit-Patches/0001-Update-groupId.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From b3c9291331205afc5b78e85435b5daa099813a1b Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Mon, 15 Feb 2016 09:39:33 +1100
|
||||
Subject: [PATCH] Update groupId
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index cb142f2..378fd01 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -9,7 +9,7 @@
|
||||
<version>9</version>
|
||||
</parent>
|
||||
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
+ <groupId>com.mineplex</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
--
|
||||
2.7.4
|
||||
|
34
Patches/Bukkit-Patches/0002-LivingEntity-changes.patch
Normal file
34
Patches/Bukkit-Patches/0002-LivingEntity-changes.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From ad41271f22ea5f75476451b2c23f3ab0e54e2a6d Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
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
|
||||
index 48e2508..fb623ae 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -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);
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
|
47
Patches/Bukkit-Patches/0003-EntityDismountEvent.patch
Normal file
47
Patches/Bukkit-Patches/0003-EntityDismountEvent.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From d3dc42fb5ba3a934b78f0ced14011facb075887d Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Sun, 22 Nov 2015 14:37:11 +1300
|
||||
Subject: [PATCH] EntityDismountEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
index 24d4942..02943d6 100644
|
||||
--- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
@@ -2,13 +2,14 @@ package org.spigotmc.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
|
||||
/**
|
||||
* Called when an entity stops riding another entity.
|
||||
*
|
||||
*/
|
||||
-public class EntityDismountEvent extends EntityEvent
|
||||
+public class EntityDismountEvent extends EntityEvent implements Cancellable
|
||||
{
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -36,4 +37,17 @@ public class EntityDismountEvent extends EntityEvent
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled()
|
||||
+ {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel)
|
||||
+ {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
|
21
Patches/Bukkit-Patches/0004-Add-Elytra.patch
Normal file
21
Patches/Bukkit-Patches/0004-Add-Elytra.patch
Normal file
@ -0,0 +1,21 @@
|
||||
From 0c6ede1fb4e6dbaac8d8acf4fa72aa28ca6d9dc7 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Wed, 30 Dec 2015 19:57:10 +1300
|
||||
Subject: [PATCH] Add Elytra
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||
index 0fb2605..bc930d1 100644
|
||||
--- a/src/main/java/org/bukkit/Material.java
|
||||
+++ b/src/main/java/org/bukkit/Material.java
|
||||
@@ -443,6 +443,7 @@ public enum Material {
|
||||
JUNGLE_DOOR_ITEM(429),
|
||||
ACACIA_DOOR_ITEM(430),
|
||||
DARK_OAK_DOOR_ITEM(431),
|
||||
+ ELYTRA(443),
|
||||
GOLD_RECORD(2256, 1),
|
||||
GREEN_RECORD(2257, 1),
|
||||
RECORD_3(2258, 1),
|
||||
--
|
||||
2.7.4
|
||||
|
46
Patches/Bukkit-Patches/0005-Levitation-potion-effect.patch
Normal file
46
Patches/Bukkit-Patches/0005-Levitation-potion-effect.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From a465cb15a5aea5c5f70957d5af0fe6b55108bff7 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Wed, 30 Dec 2015 21:05:47 +1300
|
||||
Subject: [PATCH] Levitation potion effect
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||
index 4919d59..e75aa18 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||
@@ -126,6 +126,11 @@ public abstract class PotionEffectType {
|
||||
*/
|
||||
public static final PotionEffectType SATURATION = new PotionEffectTypeWrapper(23);
|
||||
|
||||
+ /**
|
||||
+ * Slows the fall rate down
|
||||
+ */
|
||||
+ public static final PotionEffectType LEVITATION = new PotionEffectTypeWrapper(25);
|
||||
+
|
||||
private final int id;
|
||||
|
||||
protected PotionEffectType(int id) {
|
||||
@@ -202,7 +207,7 @@ public abstract class PotionEffectType {
|
||||
return "PotionEffectType[" + id + ", " + getName() + "]";
|
||||
}
|
||||
|
||||
- private static final PotionEffectType[] byId = new PotionEffectType[24];
|
||||
+ private static final PotionEffectType[] byId = new PotionEffectType[26];
|
||||
private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>();
|
||||
// will break on updates.
|
||||
private static boolean acceptingNew = true;
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java
|
||||
index 6ad9a91..a3dc228 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionType.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionType.java
|
||||
@@ -15,6 +15,7 @@ public enum PotionType {
|
||||
INSTANT_DAMAGE(12, PotionEffectType.HARM, 2),
|
||||
WATER_BREATHING(13, PotionEffectType.WATER_BREATHING, 1),
|
||||
INVISIBILITY(14, PotionEffectType.INVISIBILITY, 1),
|
||||
+ LEVITATION(15, PotionEffectType.LEVITATION, 1),
|
||||
;
|
||||
|
||||
private final int damageValue, maxLevel;
|
||||
--
|
||||
2.7.4
|
||||
|
22
Patches/Bukkit-Patches/0006-Update-pom-version.patch
Normal file
22
Patches/Bukkit-Patches/0006-Update-pom-version.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From c8afa4514a06be8257d3a05e0d261d4051a4dad0 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Mon, 25 Apr 2016 10:32:40 +1000
|
||||
Subject: [PATCH] Update pom version
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 378fd01..13a555d 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<groupId>com.mineplex</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
- <version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
+ <version>1.8.8-1.9-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Spigot-API</name>
|
||||
--
|
||||
2.7.4
|
||||
|
31
Patches/CraftBukkit-Patches/0001-Update-groupId.patch
Normal file
31
Patches/CraftBukkit-Patches/0001-Update-groupId.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From 4c5177323b3556b7c6616ddd5bfa854a0b1b7e3c Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Mon, 15 Feb 2016 09:56:14 +1100
|
||||
Subject: [PATCH] Update groupId
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index 91627ff..c1d1fb7 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -1,7 +1,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
+ <groupId>com.mineplex</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
@@ -34,7 +34,7 @@
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
- <groupId>org.spigotmc</groupId>
|
||||
+ <groupId>com.mineplex</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>jar</type>
|
||||
--
|
||||
2.7.4
|
||||
|
2037
Patches/CraftBukkit-Patches/0002-Modify-packets-to-public.patch
Normal file
2037
Patches/CraftBukkit-Patches/0002-Modify-packets-to-public.patch
Normal file
File diff suppressed because it is too large
Load Diff
804
Patches/CraftBukkit-Patches/0003-Modifiy-entity.patch
Normal file
804
Patches/CraftBukkit-Patches/0003-Modifiy-entity.patch
Normal file
@ -0,0 +1,804 @@
|
||||
From 90e32385d69e8936969ac3e7e7b2cd52f2d19e28 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
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..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 {
|
||||
this.die();
|
||||
}
|
||||
|
||||
+ private boolean _silent;
|
||||
+ private boolean _invisible;
|
||||
+
|
||||
+ public boolean isSilent()
|
||||
+ {
|
||||
+ return _silent;
|
||||
+ }
|
||||
+
|
||||
+ public void setSilent(boolean silent)
|
||||
+ {
|
||||
+ _silent = silent;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isMineplexInvisible()
|
||||
+ {
|
||||
+ return _invisible;
|
||||
+ }
|
||||
+
|
||||
+ public void setMineplexInvisible(boolean invisible)
|
||||
+ {
|
||||
+ _invisible = invisible;
|
||||
+
|
||||
+ setInvisible(isMineplexInvisible() || isInvisible());
|
||||
+ }
|
||||
+
|
||||
public Entity(World world) {
|
||||
this.id = Entity.entityCount++;
|
||||
this.j = 1.0D;
|
||||
@@ -684,7 +709,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
|
||||
}
|
||||
}
|
||||
@@ -786,7 +813,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);
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
+ if ((this.bukkitEntity instanceof LivingEntity) && vehicle.getBukkitEntity() instanceof Vehicle) {
|
||||
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
pluginManager.callEvent(event);
|
||||
|
||||
@@ -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) {
|
||||
+ if (this.vehicle != null) {
|
||||
exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
pluginManager.callEvent(exitEvent);
|
||||
|
||||
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
|
||||
--- /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;
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
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..a759e00
|
||||
--- /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.ATTACK_DAMAGE).setValue(6.0D);
|
||||
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D);
|
||||
+ this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).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();
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index d246ae7..ed7f549 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -51,6 +51,18 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
this.ah = true;
|
||||
}
|
||||
|
||||
+ public void setTargetBlock(int x, int y, int z) {
|
||||
+ // Mineplex
|
||||
+ this.a = x;
|
||||
+ this.b = y;
|
||||
+ this.c = z;
|
||||
+ this.target = null;
|
||||
+ }
|
||||
+
|
||||
+ public void setTargetEntity(Entity e) {
|
||||
+ this.target = e;
|
||||
+ }
|
||||
+
|
||||
protected void initAttributes() {
|
||||
super.initAttributes();
|
||||
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(200.0D);
|
||||
@@ -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 7a42040..d3403a1 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,15 @@ public class EntityFallingBlock extends Entity {
|
||||
protected void h() {}
|
||||
|
||||
public boolean ad() {
|
||||
- return !this.dead;
|
||||
+ return !this.dead && !spectating;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean damageEntity(DamageSource damagesource, float f)
|
||||
+ {
|
||||
+ CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f);
|
||||
+
|
||||
+ return true;
|
||||
}
|
||||
|
||||
public void t_() {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
|
||||
index f131419..f293118 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/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index a8a327d..b7647bc 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -34,6 +34,10 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
private Entity bp;
|
||||
private NBTTagCompound bq;
|
||||
|
||||
+ private boolean _vegetated;
|
||||
+ private boolean _shouldBreakLeash = true;
|
||||
+ private boolean _pullWhileLeashed = true;
|
||||
+
|
||||
public EntityInsentient(World world) {
|
||||
super(world);
|
||||
this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
|
||||
@@ -53,6 +57,32 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
this.persistent = !isTypeNotPersistent();
|
||||
// CraftBukkit end
|
||||
}
|
||||
+
|
||||
+ 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;
|
||||
+ }
|
||||
|
||||
protected void initAttributes() {
|
||||
super.initAttributes();
|
||||
@@ -148,7 +178,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 (!isSilent() && this.isAlive() && this.random.nextInt(1000) < this.a_++) {
|
||||
this.a_ = -this.w();
|
||||
this.x();
|
||||
}
|
||||
@@ -770,7 +800,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()));
|
||||
@@ -835,7 +865,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) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index f643b29..f75b0b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -101,6 +101,18 @@ public abstract class EntityLiving extends Entity {
|
||||
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
|
||||
}
|
||||
|
||||
+ private boolean _ghost;
|
||||
+
|
||||
+ public boolean isGhost()
|
||||
+ {
|
||||
+ return _ghost;
|
||||
+ }
|
||||
+
|
||||
+ public void setGhost(boolean ghost)
|
||||
+ {
|
||||
+ _ghost = ghost;
|
||||
+ }
|
||||
+
|
||||
public EntityLiving(World world) {
|
||||
super(world);
|
||||
this.initAttributes();
|
||||
@@ -1784,7 +1796,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
public boolean ad() {
|
||||
- return !this.dead;
|
||||
+ return !isGhost() && !this.dead;
|
||||
}
|
||||
|
||||
public boolean ae() {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 3810f86..44ac587 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -65,10 +65,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
// Spigot start
|
||||
public boolean collidesWithEntities = true;
|
||||
|
||||
+ 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..83e71c1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -9,6 +9,8 @@ public class EntityTNTPrimed extends Entity {
|
||||
public float yield = 4; // CraftBukkit - add field
|
||||
public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
|
||||
+ public boolean spectating;
|
||||
+
|
||||
public EntityTNTPrimed(World world) {
|
||||
super(world);
|
||||
this.k = true;
|
||||
@@ -37,7 +39,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..60e8584 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -74,6 +74,46 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
+ public boolean shouldBreakLeash()
|
||||
+ {
|
||||
+ return ((EntityInsentient) getHandle()).shouldBreakLeash();
|
||||
+ }
|
||||
+
|
||||
+ public void setShouldBreakLeash(boolean shouldBreakLeash)
|
||||
+ {
|
||||
+ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash);
|
||||
+ }
|
||||
+
|
||||
+ public boolean shouldPullWhileLeashed()
|
||||
+ {
|
||||
+ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed();
|
||||
+ }
|
||||
+
|
||||
+ public void setPullWhileLeashed(boolean pullWhileLeashed)
|
||||
+ {
|
||||
+ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isVegetated()
|
||||
+ {
|
||||
+ return ((EntityInsentient) getHandle()).isVegetated();
|
||||
+ }
|
||||
+
|
||||
+ public void setVegetated(boolean vegetated)
|
||||
+ {
|
||||
+ ((EntityInsentient) getHandle()).setVegetated(vegetated);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isGhost()
|
||||
+ {
|
||||
+ return getHandle().isGhost();
|
||||
+ }
|
||||
+
|
||||
+ public void setGhost(boolean ghost)
|
||||
+ {
|
||||
+ getHandle().setGhost(ghost);
|
||||
+ }
|
||||
+
|
||||
public double getHealth() {
|
||||
return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth());
|
||||
}
|
||||
--
|
||||
2.7.4
|
||||
|
235
Patches/CraftBukkit-Patches/0004-Chunk-changes.patch
Normal file
235
Patches/CraftBukkit-Patches/0004-Chunk-changes.patch
Normal file
@ -0,0 +1,235 @@
|
||||
From 72e734acdc1912563f5d8e4a906579e3ab65064b Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
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
|
||||
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..564efe6
|
||||
--- /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 handlers;
|
||||
+ }
|
||||
+
|
||||
+ 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 022ba31..464d0c2 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 975d666..a55bd6c 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.7.4
|
||||
|
353
Patches/CraftBukkit-Patches/0005-Packet-listener-changes.patch
Normal file
353
Patches/CraftBukkit-Patches/0005-Packet-listener-changes.patch
Normal file
@ -0,0 +1,353 @@
|
||||
From 1da9bcc60b080e3b068aff9202dbe7823d1abe64 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
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
|
||||
new file mode 100644
|
||||
index 0000000..f86dfd1
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/mineplex/spigot/IPacketVerifier.java
|
||||
@@ -0,0 +1,8 @@
|
||||
+package com.mineplex.spigot;
|
||||
+
|
||||
+import net.minecraft.server.Packet;
|
||||
+
|
||||
+public interface IPacketVerifier
|
||||
+{
|
||||
+ public boolean handlePacket(Packet packet);
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/com/mineplex/spigot/PacketProcessor.java b/src/main/java/com/mineplex/spigot/PacketProcessor.java
|
||||
new file mode 100644
|
||||
index 0000000..5695899
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/mineplex/spigot/PacketProcessor.java
|
||||
@@ -0,0 +1,250 @@
|
||||
+package com.mineplex.spigot;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.HashMap;
|
||||
+import io.netty.util.concurrent.GenericFutureListener;
|
||||
+
|
||||
+import net.minecraft.server.NetworkManager;
|
||||
+import net.minecraft.server.IChatBaseComponent;
|
||||
+
|
||||
+import net.minecraft.server.Packet;
|
||||
+import net.minecraft.server.PacketListenerPlayIn;
|
||||
+import net.minecraft.server.IUpdatePlayerListBox;
|
||||
+import net.minecraft.server.PlayerConnection;
|
||||
+import net.minecraft.server.PacketPlayInChat;
|
||||
+import net.minecraft.server.PacketPlayInTabComplete;
|
||||
+import net.minecraft.server.PacketPlayInClientCommand;
|
||||
+import net.minecraft.server.PacketPlayInSettings;
|
||||
+import net.minecraft.server.PacketPlayInTransaction;
|
||||
+import net.minecraft.server.PacketPlayInEnchantItem;
|
||||
+import net.minecraft.server.PacketPlayInWindowClick;
|
||||
+import net.minecraft.server.PacketPlayInCloseWindow;
|
||||
+import net.minecraft.server.PacketPlayInCustomPayload;
|
||||
+import net.minecraft.server.PacketPlayInUseEntity;
|
||||
+import net.minecraft.server.PacketPlayInKeepAlive;
|
||||
+import net.minecraft.server.PacketPlayInFlying;
|
||||
+import net.minecraft.server.PacketPlayInAbilities;
|
||||
+import net.minecraft.server.PacketPlayInBlockDig;
|
||||
+import net.minecraft.server.PacketPlayInEntityAction;
|
||||
+import net.minecraft.server.PacketPlayInSteerVehicle;
|
||||
+import net.minecraft.server.PacketPlayInHeldItemSlot;
|
||||
+import net.minecraft.server.PacketPlayInSetCreativeSlot;
|
||||
+import net.minecraft.server.PacketPlayInUpdateSign;
|
||||
+import net.minecraft.server.PacketPlayInBlockPlace;
|
||||
+import net.minecraft.server.PacketPlayInSpectate;
|
||||
+import net.minecraft.server.PacketPlayInResourcePackStatus;
|
||||
+import net.minecraft.server.PacketPlayInArmAnimation;
|
||||
+
|
||||
+public class PacketProcessor implements PacketListenerPlayIn, IUpdatePlayerListBox
|
||||
+{
|
||||
+ private IPacketVerifier _packetVerifier;
|
||||
+ private PlayerConnection _packetListener;
|
||||
+ private static volatile HashMap<Class, Boolean> _listenedPackets = new HashMap<Class, Boolean>();
|
||||
+
|
||||
+ public PacketProcessor(PlayerConnection packetListener)
|
||||
+ {
|
||||
+ _packetListener = packetListener;
|
||||
+ }
|
||||
+
|
||||
+ public void setPacketVerifier(IPacketVerifier verifier)
|
||||
+ {
|
||||
+ _packetVerifier = verifier;
|
||||
+ }
|
||||
+
|
||||
+ public void c()
|
||||
+ {
|
||||
+ _packetListener.c();
|
||||
+ }
|
||||
+
|
||||
+ public static void addPacket(Class packetClass, boolean forceMainThread)
|
||||
+ {
|
||||
+ _listenedPackets.put(packetClass, forceMainThread);
|
||||
+ }
|
||||
+
|
||||
+ public static void removePacket(Class packetClass)
|
||||
+ {
|
||||
+ _listenedPackets.remove(packetClass);
|
||||
+ }
|
||||
+
|
||||
+ public void processOutgoingPacket(Packet packet, NetworkManager networkManager)
|
||||
+ {
|
||||
+ if (!_listenedPackets.containsKey(packet.getClass()))
|
||||
+ {
|
||||
+ networkManager.handle(packet);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ boolean addDefaultPacket = true;
|
||||
+
|
||||
+ if (_packetVerifier != null)
|
||||
+ {
|
||||
+ if (!_packetVerifier.handlePacket(packet))
|
||||
+ {
|
||||
+ addDefaultPacket = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (addDefaultPacket)
|
||||
+ {
|
||||
+ networkManager.handle(packet);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void processIncomingPacket(final Packet packet)
|
||||
+ {
|
||||
+ if (!_listenedPackets.containsKey(packet.getClass()))
|
||||
+ {
|
||||
+ packet.a(_packetListener);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (!_packetListener.player.u().isMainThread() && _listenedPackets.get(packet.getClass()))
|
||||
+ {
|
||||
+ _packetListener.player.u().postToMainThread(new Runnable()
|
||||
+ {
|
||||
+ public void run()
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ boolean addDefaultPacket = true;
|
||||
+
|
||||
+ if (_packetVerifier != null)
|
||||
+ {
|
||||
+ if (!_packetVerifier.handlePacket(packet))
|
||||
+ {
|
||||
+ addDefaultPacket = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (addDefaultPacket)
|
||||
+ {
|
||||
+ packet.a(_packetListener);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInChat packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInTabComplete packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInClientCommand packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInSettings packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInTransaction packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInEnchantItem packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInWindowClick packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInCloseWindow packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInCustomPayload packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInUseEntity packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInKeepAlive packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInFlying packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInAbilities packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInBlockDig packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInEntityAction packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInSteerVehicle packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInHeldItemSlot packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInSetCreativeSlot packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInUpdateSign packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInBlockPlace packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInSpectate packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInResourcePackStatus packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(PacketPlayInArmAnimation packet)
|
||||
+ {
|
||||
+ processIncomingPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ public void a(IChatBaseComponent packet)
|
||||
+ {
|
||||
+ _packetListener.a(packet);
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
index 9d23c6c..83a600c 100644
|
||||
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||
@@ -27,6 +27,8 @@ import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
+import com.mineplex.spigot.PacketProcessor;
|
||||
+
|
||||
public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
|
||||
|
||||
private static final Logger g = LogManager.getLogger();
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 5740e49..5edef3e 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -62,6 +62,8 @@ import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.util.NumberConversions;
|
||||
// CraftBukkit end
|
||||
|
||||
+import com.mineplex.spigot.PacketProcessor;
|
||||
+
|
||||
public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox {
|
||||
|
||||
private static final Logger c = LogManager.getLogger();
|
||||
@@ -87,15 +89,20 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
private boolean checkMovement = true;
|
||||
private boolean processedDisconnect; // CraftBukkit - added
|
||||
|
||||
+ public PacketProcessor PacketVerifier;
|
||||
+
|
||||
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||
this.minecraftServer = minecraftserver;
|
||||
this.networkManager = networkmanager;
|
||||
- networkmanager.a((PacketListener) this);
|
||||
this.player = entityplayer;
|
||||
entityplayer.playerConnection = this;
|
||||
|
||||
// CraftBukkit start - add fields and methods
|
||||
this.server = minecraftserver.server;
|
||||
+
|
||||
+
|
||||
+ PacketVerifier = new PacketProcessor(this);
|
||||
+ networkmanager.a(PacketVerifier);
|
||||
}
|
||||
|
||||
private final org.bukkit.craftbukkit.CraftServer server;
|
||||
@@ -904,7 +911,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
// CraftBukkit end
|
||||
|
||||
try {
|
||||
- this.networkManager.handle(packet);
|
||||
+ PacketVerifier.processOutgoingPacket(packet, networkManager);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
|
||||
@@ -1408,9 +1415,12 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u());
|
||||
|
||||
- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
|
||||
+ if (packetplayinclosewindow.id == player.activeContainer.windowId)
|
||||
+ {
|
||||
+ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
|
||||
|
||||
- this.player.p();
|
||||
+ this.player.p();
|
||||
+ }
|
||||
}
|
||||
|
||||
public void a(PacketPlayInWindowClick packetplayinwindowclick) {
|
||||
--
|
||||
2.7.4
|
||||
|
70
Patches/CraftBukkit-Patches/0006-Inventory-changes.patch
Normal file
70
Patches/CraftBukkit-Patches/0006-Inventory-changes.patch
Normal file
@ -0,0 +1,70 @@
|
||||
From bf6cbe47c5b1ab50e4ceb7a98b25975b90ae92c2 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Fri, 23 Oct 2015 21:22:36 +1300
|
||||
Subject: [PATCH] Inventory changes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
index e99b8cc..428836c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
@@ -32,7 +32,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
super(new MinecraftInventory(owner, size, title));
|
||||
}
|
||||
|
||||
- static class MinecraftInventory implements IInventory {
|
||||
+ public static class MinecraftInventory implements IInventory {
|
||||
private final ItemStack[] items;
|
||||
private int maxStack = MAX_STACK;
|
||||
private final List<HumanEntity> viewers;
|
||||
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;
|
||||
--
|
||||
2.7.4
|
||||
|
277
Patches/CraftBukkit-Patches/0007-Misc-changes.patch
Normal file
277
Patches/CraftBukkit-Patches/0007-Misc-changes.patch
Normal file
@ -0,0 +1,277 @@
|
||||
From ed2a06418ba178cb6ff227ef1aca14f7b5f951df 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
|
||||
}
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,605 @@
|
||||
From 562c6e8165bebbabc22f7f1d472e1fc0bf54dc86 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Wed, 28 Oct 2015 09:00:24 +1300
|
||||
Subject: [PATCH] EntityGuardian is now vegetateable
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityGuardian.java b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
new file mode 100644
|
||||
index 0000000..c14caf2
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||
@@ -0,0 +1,590 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import com.google.common.base.Predicate;
|
||||
+import java.util.*;
|
||||
+
|
||||
+public class EntityGuardian extends EntityMonster
|
||||
+{
|
||||
+ static class ControllerMoveGuardian extends ControllerMove
|
||||
+ {
|
||||
+
|
||||
+ public void c()
|
||||
+ {
|
||||
+ if(!this.f || g.getNavigation().m())
|
||||
+ {
|
||||
+ g.k(0.0F);
|
||||
+ EntityGuardian.a(g, false);
|
||||
+ return;
|
||||
+ }
|
||||
+ double d = b - g.locX;
|
||||
+ double d1 = c - g.locY;
|
||||
+ double d2 = this.d - g.locZ;
|
||||
+ double d3 = d * d + d1 * d1 + d2 * d2;
|
||||
+ d3 = MathHelper.sqrt(d3);
|
||||
+ d1 /= d3;
|
||||
+ float f = (float)((MathHelper.b(d2, d) * 180D) / 3.1415927410125732D) - 90F;
|
||||
+ g.yaw = a(g.yaw, f, 30F);
|
||||
+ g.aI = g.yaw;
|
||||
+ float f1 = (float)(e * g.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||
+ g.k(g.bI() + (f1 - g.bI()) * 0.125F);
|
||||
+ double d4 = Math.sin((double)(g.ticksLived + g.getId()) * 0.5D) * 0.050000000000000003D;
|
||||
+ double d5 = Math.cos((g.yaw * 3.141593F) / 180F);
|
||||
+ double d6 = Math.sin((g.yaw * 3.141593F) / 180F);
|
||||
+ g.motX += d4 * d5;
|
||||
+ g.motZ += d4 * d6;
|
||||
+ d4 = Math.sin((double)(g.ticksLived + g.getId()) * 0.75D) * 0.050000000000000003D;
|
||||
+ g.motY += d4 * (d6 + d5) * 0.25D;
|
||||
+ g.motY += (double)g.bI() * d1 * 0.10000000000000001D;
|
||||
+ ControllerLook controllerlook = g.getControllerLook();
|
||||
+ double d7 = g.locX + (d / d3) * 2D;
|
||||
+ double d8 = (double)g.getHeadHeight() + g.locY + (d1 / d3) * 1.0D;
|
||||
+ double d9 = g.locZ + (d2 / d3) * 2D;
|
||||
+ double d10 = controllerlook.e();
|
||||
+ double d11 = controllerlook.f();
|
||||
+ double d12 = controllerlook.g();
|
||||
+ if(!controllerlook.b())
|
||||
+ {
|
||||
+ d10 = d7;
|
||||
+ d11 = d8;
|
||||
+ d12 = d9;
|
||||
+ }
|
||||
+ g.getControllerLook().a(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10F, 40F);
|
||||
+ EntityGuardian.a(g, true);
|
||||
+ }
|
||||
+
|
||||
+ private EntityGuardian g;
|
||||
+
|
||||
+ public ControllerMoveGuardian(EntityGuardian entityguardian)
|
||||
+ {
|
||||
+ super(entityguardian);
|
||||
+ g = entityguardian;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static class PathfinderGoalGuardianAttack extends PathfinderGoal
|
||||
+ {
|
||||
+
|
||||
+ public boolean a()
|
||||
+ {
|
||||
+ EntityLiving entityliving = a.getGoalTarget();
|
||||
+ return entityliving != null && entityliving.isAlive();
|
||||
+ }
|
||||
+
|
||||
+ public boolean b()
|
||||
+ {
|
||||
+ return super.b() && (a.isElder() || a.h(a.getGoalTarget()) > 9D);
|
||||
+ }
|
||||
+
|
||||
+ public void c()
|
||||
+ {
|
||||
+ b = -10;
|
||||
+ a.getNavigation().n();
|
||||
+ a.getControllerLook().a(a.getGoalTarget(), 90F, 90F);
|
||||
+ a.ai = true;
|
||||
+ }
|
||||
+
|
||||
+ public void d()
|
||||
+ {
|
||||
+ EntityGuardian.a(a, 0);
|
||||
+ a.setGoalTarget(null);
|
||||
+ EntityGuardian.a(a).f();
|
||||
+ }
|
||||
+
|
||||
+ public void e()
|
||||
+ {
|
||||
+ EntityLiving entityliving = a.getGoalTarget();
|
||||
+ a.getNavigation().n();
|
||||
+ a.getControllerLook().a(entityliving, 90F, 90F);
|
||||
+ if(!a.hasLineOfSight(entityliving))
|
||||
+ {
|
||||
+ a.setGoalTarget(null);
|
||||
+ return;
|
||||
+ }
|
||||
+ b++;
|
||||
+ if(b == 0)
|
||||
+ {
|
||||
+ EntityGuardian.a(a, a.getGoalTarget().getId());
|
||||
+ a.world.broadcastEntityEffect(a, (byte)21);
|
||||
+ } else
|
||||
+ if(b >= a.cm())
|
||||
+ {
|
||||
+ float f = 1.0F;
|
||||
+ if(a.world.getDifficulty() == EnumDifficulty.HARD)
|
||||
+ f += 2.0F;
|
||||
+ if(a.isElder())
|
||||
+ f += 2.0F;
|
||||
+ entityliving.damageEntity(DamageSource.b(a, a), f);
|
||||
+ entityliving.damageEntity(DamageSource.mobAttack(a), (float)a.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).getValue());
|
||||
+ a.setGoalTarget(null);
|
||||
+ } else
|
||||
+ if(b >= 60)
|
||||
+ if(b % 20 != 0);
|
||||
+ super.e();
|
||||
+ }
|
||||
+
|
||||
+ private EntityGuardian a;
|
||||
+ private int b;
|
||||
+
|
||||
+ public PathfinderGoalGuardianAttack(EntityGuardian entityguardian)
|
||||
+ {
|
||||
+ a = entityguardian;
|
||||
+ a(3);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static class EntitySelectorGuardianTargetHumanSquid
|
||||
+ implements Predicate
|
||||
+ {
|
||||
+
|
||||
+ public boolean a(EntityLiving entityliving)
|
||||
+ {
|
||||
+ return ((entityliving instanceof EntityHuman) || (entityliving instanceof EntitySquid)) && entityliving.h(a) > 9D;
|
||||
+ }
|
||||
+
|
||||
+ public boolean apply(Object obj)
|
||||
+ {
|
||||
+ return a((EntityLiving)obj);
|
||||
+ }
|
||||
+
|
||||
+ private EntityGuardian a;
|
||||
+
|
||||
+ public EntitySelectorGuardianTargetHumanSquid(EntityGuardian entityguardian)
|
||||
+ {
|
||||
+ a = entityguardian;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public EntityGuardian(World world)
|
||||
+ {
|
||||
+ super(world);
|
||||
+ b_ = 10;
|
||||
+ setSize(0.85F, 0.85F);
|
||||
+ goalSelector.a(4, new PathfinderGoalGuardianAttack(this));
|
||||
+ PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction;
|
||||
+ goalSelector.a(5, pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
|
||||
+ goalSelector.a(7, goalRandomStroll = new PathfinderGoalRandomStroll(this, 1.0D, 80));
|
||||
+ goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8F));
|
||||
+ goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityGuardian.class, 12F, 0.01F));
|
||||
+ goalSelector.a(9, new PathfinderGoalRandomLookaround(this));
|
||||
+ goalRandomStroll.a(3);
|
||||
+ pathfindergoalmovetowardsrestriction.a(3);
|
||||
+ targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 10, true, false, new EntitySelectorGuardianTargetHumanSquid(this)));
|
||||
+ moveController = new ControllerMoveGuardian(this);
|
||||
+ b = a = random.nextFloat();
|
||||
+ }
|
||||
+
|
||||
+ public void initAttributes()
|
||||
+ {
|
||||
+ super.initAttributes();
|
||||
+ getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6D);
|
||||
+ getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.5D);
|
||||
+ getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(16D);
|
||||
+ getAttributeInstance(GenericAttributes.maxHealth).setValue(30D);
|
||||
+ }
|
||||
+
|
||||
+ public void a(NBTTagCompound nbttagcompound)
|
||||
+ {
|
||||
+ super.a(nbttagcompound);
|
||||
+ setElder(nbttagcompound.getBoolean("Elder"));
|
||||
+ }
|
||||
+
|
||||
+ public void b(NBTTagCompound nbttagcompound)
|
||||
+ {
|
||||
+ super.b(nbttagcompound);
|
||||
+ nbttagcompound.setBoolean("Elder", isElder());
|
||||
+ }
|
||||
+
|
||||
+ protected NavigationAbstract b(World world)
|
||||
+ {
|
||||
+ return new NavigationGuardian(this, world);
|
||||
+ }
|
||||
+
|
||||
+ protected void h()
|
||||
+ {
|
||||
+ super.h();
|
||||
+ datawatcher.a(16, Integer.valueOf(0));
|
||||
+ datawatcher.a(17, Integer.valueOf(0));
|
||||
+ }
|
||||
+
|
||||
+ private boolean a(int j)
|
||||
+ {
|
||||
+ return (datawatcher.getInt(16) & j) != 0;
|
||||
+ }
|
||||
+
|
||||
+ private void a(int j, boolean flag)
|
||||
+ {
|
||||
+ int k = datawatcher.getInt(16);
|
||||
+ if(flag)
|
||||
+ datawatcher.watch(16, Integer.valueOf(k | j));
|
||||
+ else
|
||||
+ datawatcher.watch(16, Integer.valueOf(k & ~j));
|
||||
+ }
|
||||
+
|
||||
+ public boolean n()
|
||||
+ {
|
||||
+ return a(2);
|
||||
+ }
|
||||
+
|
||||
+ private void l(boolean flag)
|
||||
+ {
|
||||
+ a(2, flag);
|
||||
+ }
|
||||
+
|
||||
+ public int cm()
|
||||
+ {
|
||||
+ return !isElder() ? 80 : 60;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isElder()
|
||||
+ {
|
||||
+ return a(4);
|
||||
+ }
|
||||
+
|
||||
+ public void setElder(boolean flag)
|
||||
+ {
|
||||
+ a(4, flag);
|
||||
+ if(flag)
|
||||
+ {
|
||||
+ setSize(1.9975F, 1.9975F);
|
||||
+ getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.30000001192092896D);
|
||||
+ getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(8D);
|
||||
+ getAttributeInstance(GenericAttributes.maxHealth).setValue(80D);
|
||||
+ bX();
|
||||
+ goalRandomStroll.setTimeBetweenMovement(400);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void b(int j)
|
||||
+ {
|
||||
+ datawatcher.watch(17, Integer.valueOf(j));
|
||||
+ }
|
||||
+
|
||||
+ public boolean cp()
|
||||
+ {
|
||||
+ return datawatcher.getInt(17) != 0;
|
||||
+ }
|
||||
+
|
||||
+ public EntityLiving cq()
|
||||
+ {
|
||||
+ if(!cp())
|
||||
+ return null;
|
||||
+ if(world.isClientSide)
|
||||
+ {
|
||||
+ if(bo != null)
|
||||
+ return bo;
|
||||
+ Entity entity = world.a(datawatcher.getInt(17));
|
||||
+ if(entity instanceof EntityLiving)
|
||||
+ {
|
||||
+ bo = (EntityLiving)entity;
|
||||
+ return bo;
|
||||
+ } else
|
||||
+ {
|
||||
+ return null;
|
||||
+ }
|
||||
+ } else
|
||||
+ {
|
||||
+ return getGoalTarget();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void i(int j)
|
||||
+ {
|
||||
+ super.i(j);
|
||||
+ if(j == 16)
|
||||
+ {
|
||||
+ if(isElder() && width < 1.0F)
|
||||
+ setSize(1.9975F, 1.9975F);
|
||||
+ } else
|
||||
+ if(j == 17)
|
||||
+ {
|
||||
+ bp = 0;
|
||||
+ bo = null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public int w()
|
||||
+ {
|
||||
+ return 160;
|
||||
+ }
|
||||
+
|
||||
+ protected String z()
|
||||
+ {
|
||||
+ if(!V())
|
||||
+ return "mob.guardian.land.idle";
|
||||
+ if(isElder())
|
||||
+ return "mob.guardian.elder.idle";
|
||||
+ else
|
||||
+ return "mob.guardian.idle";
|
||||
+ }
|
||||
+
|
||||
+ protected String bo()
|
||||
+ {
|
||||
+ if(!V())
|
||||
+ return "mob.guardian.land.hit";
|
||||
+ if(isElder())
|
||||
+ return "mob.guardian.elder.hit";
|
||||
+ else
|
||||
+ return "mob.guardian.hit";
|
||||
+ }
|
||||
+
|
||||
+ protected String bp()
|
||||
+ {
|
||||
+ if(!V())
|
||||
+ return "mob.guardian.land.death";
|
||||
+ if(isElder())
|
||||
+ return "mob.guardian.elder.death";
|
||||
+ else
|
||||
+ return "mob.guardian.death";
|
||||
+ }
|
||||
+
|
||||
+ protected boolean s_()
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public float getHeadHeight()
|
||||
+ {
|
||||
+ return length * 0.5F;
|
||||
+ }
|
||||
+
|
||||
+ public float a(BlockPosition blockposition)
|
||||
+ {
|
||||
+ if(world.getType(blockposition).getBlock().getMaterial() == Material.WATER)
|
||||
+ return (10F + world.o(blockposition)) - 0.5F;
|
||||
+ else
|
||||
+ return super.a(blockposition);
|
||||
+ }
|
||||
+
|
||||
+ public void m()
|
||||
+ {
|
||||
+ if(world.isClientSide)
|
||||
+ {
|
||||
+ b = a;
|
||||
+ if(!V())
|
||||
+ {
|
||||
+ c = 2.0F;
|
||||
+ if(motY > 0.0D && bq && !R())
|
||||
+ world.a(locX, locY, locZ, "mob.guardian.flop", 1.0F, 1.0F, false);
|
||||
+ bq = motY < 0.0D && world.d((new BlockPosition(this)).down(), false);
|
||||
+ } else
|
||||
+ if(n())
|
||||
+ {
|
||||
+ if(c < 0.5F)
|
||||
+ c = 4F;
|
||||
+ else
|
||||
+ c = c + (0.5F - c) * 0.1F;
|
||||
+ } else
|
||||
+ {
|
||||
+ c = c + (0.125F - c) * 0.2F;
|
||||
+ }
|
||||
+ a += c;
|
||||
+ bn = bm;
|
||||
+ if(!V())
|
||||
+ bm = random.nextFloat();
|
||||
+ else
|
||||
+ if(n())
|
||||
+ bm = bm + (0.0F - bm) * 0.25F;
|
||||
+ else
|
||||
+ bm = bm + (1.0F - bm) * 0.06F;
|
||||
+ if(n() && V())
|
||||
+ {
|
||||
+ Vec3D vec3d = d(0.0F);
|
||||
+ for(int j = 0; j < 2; j++)
|
||||
+ world.addParticle(EnumParticle.WATER_BUBBLE, (locX + (random.nextDouble() - 0.5D) * (double)width) - vec3d.a * 1.5D, (locY + random.nextDouble() * (double)length) - vec3d.b * 1.5D, (locZ + (random.nextDouble() - 0.5D) * (double)width) - vec3d.c * 1.5D, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
+
|
||||
+ }
|
||||
+ if(cp())
|
||||
+ {
|
||||
+ if(bp < cm())
|
||||
+ bp++;
|
||||
+ EntityLiving entityliving = cq();
|
||||
+ if(entityliving != null)
|
||||
+ {
|
||||
+ getControllerLook().a(entityliving, 90F, 90F);
|
||||
+ getControllerLook().a();
|
||||
+ double d = q(0.0F);
|
||||
+ double d1 = entityliving.locX - locX;
|
||||
+ double d2 = (entityliving.locY + (double)(entityliving.length * 0.5F)) - (locY + (double)getHeadHeight());
|
||||
+ double d3 = entityliving.locZ - locZ;
|
||||
+ double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
+ d1 /= d4;
|
||||
+ d2 /= d4;
|
||||
+ d3 /= d4;
|
||||
+ for(double d5 = random.nextDouble(); d5 < d4;)
|
||||
+ {
|
||||
+ d5 += (1.8D - d) + random.nextDouble() * (1.7D - d);
|
||||
+ world.addParticle(EnumParticle.WATER_BUBBLE, locX + d1 * d5, locY + d2 * d5 + (double)getHeadHeight(), locZ + d3 * d5, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if(isVegetated() || inWater)
|
||||
+ setAirTicks(300);
|
||||
+ else
|
||||
+ if(onGround)
|
||||
+ {
|
||||
+ motY += 0.5D;
|
||||
+ motX += (random.nextFloat() * 2.0F - 1.0F) * 0.4F;
|
||||
+ motZ += (random.nextFloat() * 2.0F - 1.0F) * 0.4F;
|
||||
+ yaw = random.nextFloat() * 360F;
|
||||
+ onGround = false;
|
||||
+ ai = true;
|
||||
+ }
|
||||
+ if(cp())
|
||||
+ yaw = aK;
|
||||
+ super.m();
|
||||
+ }
|
||||
+
|
||||
+ public float q(float f)
|
||||
+ {
|
||||
+ return ((float)bp + f) / (float)cm();
|
||||
+ }
|
||||
+
|
||||
+ protected void E()
|
||||
+ {
|
||||
+ super.E();
|
||||
+ if(isElder())
|
||||
+ {
|
||||
+ int i = 1200;
|
||||
+ int j = 1200;
|
||||
+ int k = 6000;
|
||||
+ int m = 2;
|
||||
+
|
||||
+ if ((this.ticksLived + getId()) % 1200 == 0) {
|
||||
+ MobEffectList mobeffectlist = MobEffectList.SLOWER_DIG;
|
||||
+ List list = world.b(EntityPlayer.class, new Predicate() {
|
||||
+
|
||||
+ public boolean a(EntityPlayer entityplayer1)
|
||||
+ {
|
||||
+ return h(entityplayer1) < 2500D && entityplayer1.playerInteractManager.c();
|
||||
+ }
|
||||
+
|
||||
+ public boolean apply(Object obj)
|
||||
+ {
|
||||
+ return a((EntityPlayer)obj);
|
||||
+ }
|
||||
+ }
|
||||
+);
|
||||
+ Iterator iterator = list.iterator();
|
||||
+ do
|
||||
+ {
|
||||
+ if(!iterator.hasNext())
|
||||
+ break;
|
||||
+ EntityPlayer entityplayer = (EntityPlayer)iterator.next();
|
||||
+ if(!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200)
|
||||
+ {
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(10, 0.0F));
|
||||
+ entityplayer.addEffect(new MobEffect(mobeffectlist.id, 6000, 2));
|
||||
+ }
|
||||
+ } while(true);
|
||||
+ }
|
||||
+ if(!ck())
|
||||
+ a(new BlockPosition(this), 16);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ protected void dropDeathLoot(boolean flag, int j)
|
||||
+ {
|
||||
+ int k = random.nextInt(3) + random.nextInt(j + 1);
|
||||
+ if(k > 0)
|
||||
+ a(new ItemStack(Items.PRISMARINE_SHARD, k, 0), 1.0F);
|
||||
+ if(random.nextInt(3 + j) > 1)
|
||||
+ a(new ItemStack(Items.FISH, 1, ItemFish.EnumFish.COD.a()), 1.0F);
|
||||
+ else
|
||||
+ if(random.nextInt(3 + j) > 1)
|
||||
+ a(new ItemStack(Items.PRISMARINE_CRYSTALS, 1, 0), 1.0F);
|
||||
+ if(flag && isElder())
|
||||
+ a(new ItemStack(Blocks.SPONGE, 1, 1), 1.0F);
|
||||
+ }
|
||||
+
|
||||
+ protected void getRareDrop()
|
||||
+ {
|
||||
+ ItemStack itemstack = ((PossibleFishingResult)WeightedRandom.a(random, EntityFishingHook.j())).a(random);
|
||||
+ a(itemstack, 1.0F);
|
||||
+ }
|
||||
+
|
||||
+ protected boolean n_()
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ public boolean canSpawn()
|
||||
+ {
|
||||
+ return world.a(getBoundingBox(), this) && world.getCubes(this, getBoundingBox()).isEmpty();
|
||||
+ }
|
||||
+
|
||||
+ public boolean bR()
|
||||
+ {
|
||||
+ return (random.nextInt(20) == 0 || !world.j(new BlockPosition(this))) && super.bR();
|
||||
+ }
|
||||
+
|
||||
+ public boolean damageEntity(DamageSource damagesource, float f)
|
||||
+ {
|
||||
+ if(!n() && !damagesource.isMagic() && (damagesource.i() instanceof EntityLiving))
|
||||
+ {
|
||||
+ EntityLiving entityliving = (EntityLiving)damagesource.i();
|
||||
+ if(!damagesource.isExplosion())
|
||||
+ {
|
||||
+ entityliving.damageEntity(DamageSource.a(this), 2.0F);
|
||||
+ entityliving.makeSound("damage.thorns", 0.5F, 1.0F);
|
||||
+ }
|
||||
+ }
|
||||
+ goalRandomStroll.f();
|
||||
+ return super.damageEntity(damagesource, f);
|
||||
+ }
|
||||
+
|
||||
+ public int bQ()
|
||||
+ {
|
||||
+ return 180;
|
||||
+ }
|
||||
+
|
||||
+ public void g(float f, float f1)
|
||||
+ {
|
||||
+ if(bM())
|
||||
+ {
|
||||
+ if(V())
|
||||
+ {
|
||||
+ a(f, f1, 0.1F);
|
||||
+ move(motX, motY, motZ);
|
||||
+ motX *= 0.89999997615814209D;
|
||||
+ motY *= 0.89999997615814209D;
|
||||
+ motZ *= 0.89999997615814209D;
|
||||
+ if(!n() && getGoalTarget() == null)
|
||||
+ motY -= 0.0050000000000000001D;
|
||||
+ } else
|
||||
+ {
|
||||
+ super.g(f, f1);
|
||||
+ }
|
||||
+ } else
|
||||
+ {
|
||||
+ super.g(f, f1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ static void a(EntityGuardian entityguardian, int j)
|
||||
+ {
|
||||
+ entityguardian.b(j);
|
||||
+ }
|
||||
+
|
||||
+ static PathfinderGoalRandomStroll a(EntityGuardian entityguardian)
|
||||
+ {
|
||||
+ return entityguardian.goalRandomStroll;
|
||||
+ }
|
||||
+
|
||||
+ static void a(EntityGuardian entityguardian, boolean flag)
|
||||
+ {
|
||||
+ entityguardian.l(flag);
|
||||
+ }
|
||||
+
|
||||
+ private float a;
|
||||
+ private float b;
|
||||
+ private float c;
|
||||
+ private float bm;
|
||||
+ private float bn;
|
||||
+ private EntityLiving bo;
|
||||
+ private int bp;
|
||||
+ private boolean bq;
|
||||
+ public PathfinderGoalRandomStroll goalRandomStroll;
|
||||
+}
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,43 @@
|
||||
From 5455de50dc5b6fe4ea5ba5b98b0f9169705a0e65 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Fri, 30 Oct 2015 20:02:58 +1300
|
||||
Subject: [PATCH] Controller look vegetateHead, Entity collide changes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||
index 2263d5d..f2d7b1e 100644
|
||||
--- a/src/main/java/net/minecraft/server/ControllerLook.java
|
||||
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||
@@ -37,9 +37,15 @@ public class ControllerLook
|
||||
this.d = true;
|
||||
}
|
||||
|
||||
+ public void vegetateHead(boolean vegetate)
|
||||
+ {
|
||||
+ _vegeHead = vegetate;
|
||||
+ }
|
||||
+
|
||||
+ private boolean _vegeHead;
|
||||
+
|
||||
public void a() {
|
||||
- if (a.isVegetated())
|
||||
- return;
|
||||
+ if (_vegeHead)return;
|
||||
this.a.pitch = 0.0F;
|
||||
|
||||
if (this.d) {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index cb9ba53..8660762 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1087,6 +1087,7 @@ public abstract class Entity implements ICommandListener {
|
||||
int numCollisions = 0; // Spigot
|
||||
public void collide(Entity entity) {
|
||||
if (entity.passenger != this && entity.vehicle != this) {
|
||||
+ if ((!(entity instanceof EntityLiving) || !((EntityLiving) entity).isGhost()) && (!(this instanceof EntityLiving) || !((EntityLiving) this).isGhost()))
|
||||
if (!entity.noclip && !this.noclip) {
|
||||
double d0 = entity.locX - this.locX;
|
||||
double d1 = entity.locZ - this.locZ;
|
||||
--
|
||||
2.7.4
|
||||
|
139
Patches/CraftBukkit-Patches/0010-Vegetate-head-ai.patch
Normal file
139
Patches/CraftBukkit-Patches/0010-Vegetate-head-ai.patch
Normal file
@ -0,0 +1,139 @@
|
||||
From 9f6ec15bfe47f1860d878212035f477b5b253c63 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Tue, 3 Nov 2015 21:21:02 +1300
|
||||
Subject: [PATCH] Vegetate head ai
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||
index f2d7b1e..1538ca6 100644
|
||||
--- a/src/main/java/net/minecraft/server/ControllerLook.java
|
||||
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||
@@ -9,6 +9,28 @@ public class ControllerLook
|
||||
private double e;
|
||||
private double f;
|
||||
private double g;
|
||||
+ private boolean _allowInput = true;
|
||||
+ private boolean _resetPitch = true;
|
||||
+
|
||||
+ public boolean isPitchReset()
|
||||
+ {
|
||||
+ return _resetPitch;
|
||||
+ }
|
||||
+
|
||||
+ public boolean setPitchReset(boolean resetPitch)
|
||||
+ {
|
||||
+ _resetPitch = resetPitch;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isAllowInput()
|
||||
+ {
|
||||
+ return _allowInput;
|
||||
+ }
|
||||
+
|
||||
+ public void setAllowInput(boolean allowInput)
|
||||
+ {
|
||||
+ _allowInput = allowInput;
|
||||
+ }
|
||||
|
||||
public ControllerLook(EntityInsentient paramEntityInsentient)
|
||||
{
|
||||
@@ -16,6 +38,9 @@ public class ControllerLook
|
||||
}
|
||||
|
||||
public void a(Entity paramEntity, float paramFloat1, float paramFloat2) {
|
||||
+
|
||||
+ if (!isAllowInput())
|
||||
+ return;
|
||||
this.e = paramEntity.locX;
|
||||
if ((paramEntity instanceof EntityLiving))
|
||||
this.f = (paramEntity.locY + paramEntity.getHeadHeight());
|
||||
@@ -29,6 +54,8 @@ public class ControllerLook
|
||||
}
|
||||
|
||||
public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) {
|
||||
+ if (!isAllowInput())
|
||||
+ return;
|
||||
this.e = paramDouble1;
|
||||
this.f = paramDouble2;
|
||||
this.g = paramDouble3;
|
||||
@@ -37,15 +64,8 @@ public class ControllerLook
|
||||
this.d = true;
|
||||
}
|
||||
|
||||
- public void vegetateHead(boolean vegetate)
|
||||
- {
|
||||
- _vegeHead = vegetate;
|
||||
- }
|
||||
-
|
||||
- private boolean _vegeHead;
|
||||
-
|
||||
public void a() {
|
||||
- if (_vegeHead)return;
|
||||
+ if (isResetPitch())
|
||||
this.a.pitch = 0.0F;
|
||||
|
||||
if (this.d) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index b7647bc..c2ef000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -512,6 +512,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
this.world.methodProfiler.a("move");
|
||||
this.moveController.c();
|
||||
this.world.methodProfiler.c("look");
|
||||
+ if (!isVegetatedHead())
|
||||
this.lookController.a();
|
||||
this.world.methodProfiler.c("jump");
|
||||
this.g.b();
|
||||
@@ -542,6 +543,8 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
float f2 = (float) (MathHelper.b(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||
float f3 = (float) (-(MathHelper.b(d2, d3) * 180.0D / 3.1415927410125732D));
|
||||
|
||||
+ if (isVegetatedHead())
|
||||
+ return;
|
||||
this.pitch = this.b(this.pitch, f3, f1);
|
||||
this.yaw = this.b(this.yaw, f2, f);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index f75b0b1..e384c2c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -113,6 +113,18 @@ public abstract class EntityLiving extends Entity {
|
||||
_ghost = ghost;
|
||||
}
|
||||
|
||||
+ private boolean _vegetateHead;
|
||||
+
|
||||
+ public boolean isHeadVegetated()
|
||||
+ {
|
||||
+ return _vegetateHead;
|
||||
+ }
|
||||
+
|
||||
+ public void setHeadVegetated(boolean vegetateHead)
|
||||
+ {
|
||||
+ _vegetateHead = vegetateHead;
|
||||
+ }
|
||||
+
|
||||
public EntityLiving(World world) {
|
||||
super(world);
|
||||
this.initAttributes();
|
||||
@@ -1497,6 +1509,8 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
|
||||
this.m();
|
||||
+ if (isVegetatedHead())
|
||||
+ return;
|
||||
SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
|
||||
double d0 = this.locX - this.lastX;
|
||||
double d1 = this.locZ - this.lastZ;
|
||||
@@ -1607,6 +1621,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.pitch = (float) ((double) this.pitch + (this.bh - (double) this.pitch) / (double) this.bc);
|
||||
--this.bc;
|
||||
this.setPosition(d0, d1, d2);
|
||||
+ if (!isHeadVegetated())
|
||||
this.setYawPitch(this.yaw, this.pitch);
|
||||
} else if (!this.bM()) {
|
||||
this.motX *= 0.98D;
|
||||
--
|
||||
2.7.4
|
||||
|
1618
Patches/CraftBukkit-Patches/0011-Modifications-to-cb.patch
Normal file
1618
Patches/CraftBukkit-Patches/0011-Modifications-to-cb.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,119 @@
|
||||
From 9d2015fe106bc67d93ea1d9a80d057f1bfad0fd0 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Mon, 9 Nov 2015 00:07:26 +1300
|
||||
Subject: [PATCH] Add IEntitySelector, have isGhost() return the same as
|
||||
isSpectator()
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
new file mode 100644
|
||||
index 0000000..1536600
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
@@ -0,0 +1,103 @@
|
||||
+package net.minecraft.server;
|
||||
+
|
||||
+import com.google.common.base.Predicate;
|
||||
+
|
||||
+public final class IEntitySelector
|
||||
+{
|
||||
+ public static class EntitySelectorEquipable
|
||||
+ implements Predicate
|
||||
+ {
|
||||
+
|
||||
+ public boolean a(Entity entity)
|
||||
+ {
|
||||
+ if(!entity.isAlive())
|
||||
+ return false;
|
||||
+ if(!(entity instanceof EntityLiving))
|
||||
+ return false;
|
||||
+ EntityLiving entityliving = (EntityLiving)entity;
|
||||
+ if(entityliving.getEquipment(EntityInsentient.c(a)) != null)
|
||||
+ return false;
|
||||
+ if(entityliving instanceof EntityInsentient)
|
||||
+ return ((EntityInsentient)entityliving).bY();
|
||||
+ if(entityliving instanceof EntityArmorStand)
|
||||
+ return true;
|
||||
+ return entityliving instanceof EntityHuman;
|
||||
+ }
|
||||
+
|
||||
+ public boolean apply(Object obj)
|
||||
+ {
|
||||
+ return a((Entity)obj);
|
||||
+ }
|
||||
+
|
||||
+ private final ItemStack a;
|
||||
+
|
||||
+ public EntitySelectorEquipable(ItemStack itemstack)
|
||||
+ {
|
||||
+ a = itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public static final Predicate a = new Predicate() {
|
||||
+
|
||||
+ public boolean a(Entity entity)
|
||||
+ {
|
||||
+ return entity.isAlive();
|
||||
+ }
|
||||
+
|
||||
+ public boolean apply(Object obj)
|
||||
+ {
|
||||
+ return a((Entity)obj);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+;
|
||||
+ public static final Predicate b = new Predicate() {
|
||||
+
|
||||
+ public boolean a(Entity entity)
|
||||
+ {
|
||||
+ return entity.isAlive() && entity.passenger == null && entity.vehicle == null;
|
||||
+ }
|
||||
+
|
||||
+ public boolean apply(Object obj)
|
||||
+ {
|
||||
+ return a((Entity)obj);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+;
|
||||
+ public static final Predicate c = new Predicate() {
|
||||
+
|
||||
+ public boolean a(Entity entity)
|
||||
+ {
|
||||
+ return (entity instanceof IInventory) && entity.isAlive();
|
||||
+ }
|
||||
+
|
||||
+ public boolean apply(Object obj)
|
||||
+ {
|
||||
+ return a((Entity)obj);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+;
|
||||
+ public static final Predicate d = new Predicate() {
|
||||
+
|
||||
+ public boolean a(Entity entity)
|
||||
+ {
|
||||
+ if (entity instanceof EntityLiving && ((EntityLiving) entity).isGhost())
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator();
|
||||
+ }
|
||||
+
|
||||
+ public boolean apply(Object obj)
|
||||
+ {
|
||||
+ return a((Entity)obj);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+;
|
||||
+
|
||||
+}
|
||||
--
|
||||
2.7.4
|
||||
|
22
Patches/CraftBukkit-Patches/0013-Add-player-spectator.patch
Normal file
22
Patches/CraftBukkit-Patches/0013-Add-player-spectator.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From 436b55243d79c6ae0d839a2666a2f43ed186fe70 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Mon, 9 Nov 2015 00:13:21 +1300
|
||||
Subject: [PATCH] Add player spectator
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
index 1536600..f86cf48 100644
|
||||
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
@@ -89,7 +89,7 @@ public final class IEntitySelector
|
||||
return false;
|
||||
}
|
||||
|
||||
- return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator();
|
||||
+ return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() && !((EntityPlayer)entity).spectating);
|
||||
}
|
||||
|
||||
public boolean apply(Object obj)
|
||||
--
|
||||
2.7.4
|
||||
|
22
Patches/CraftBukkit-Patches/0014-Fixed-ai-typo.patch
Normal file
22
Patches/CraftBukkit-Patches/0014-Fixed-ai-typo.patch
Normal file
@ -0,0 +1,22 @@
|
||||
From b1e36dc87d3c5623283c9f461807a65d40538be3 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Mon, 9 Nov 2015 02:41:31 +1300
|
||||
Subject: [PATCH] Fixed ai typo
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
index f86cf48..b4d70ad 100644
|
||||
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||
@@ -89,7 +89,7 @@ public final class IEntitySelector
|
||||
return false;
|
||||
}
|
||||
|
||||
- return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() && !((EntityPlayer)entity).spectating);
|
||||
+ return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() || ((EntityPlayer)entity).spectating);
|
||||
}
|
||||
|
||||
public boolean apply(Object obj)
|
||||
--
|
||||
2.7.4
|
||||
|
64
Patches/CraftBukkit-Patches/0015-Fix-casting-bug.patch
Normal file
64
Patches/CraftBukkit-Patches/0015-Fix-casting-bug.patch
Normal file
@ -0,0 +1,64 @@
|
||||
From 838463c93cd7f0b29814507cab9e7c3465e75bbb Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Wed, 11 Nov 2015 00:21:54 +1300
|
||||
Subject: [PATCH] Fix casting bug
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 60e8584..746961e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -76,32 +76,44 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
|
||||
public boolean shouldBreakLeash()
|
||||
{
|
||||
- return ((EntityInsentient) getHandle()).shouldBreakLeash();
|
||||
+ if (getHandle() instanceof EntityInsentient)
|
||||
+ return ((EntityInsentient) getHandle()).shouldBreakLeash();
|
||||
+
|
||||
+ return false;
|
||||
}
|
||||
|
||||
public void setShouldBreakLeash(boolean shouldBreakLeash)
|
||||
{
|
||||
- ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash);
|
||||
+ if (getHandle() instanceof EntityInsentient)
|
||||
+ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash);
|
||||
}
|
||||
|
||||
public boolean shouldPullWhileLeashed()
|
||||
{
|
||||
- return ((EntityInsentient) getHandle()).shouldPullWhileLeashed();
|
||||
+ if (getHandle() instanceof EntityInsentient)
|
||||
+ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed();
|
||||
+
|
||||
+ return false;
|
||||
}
|
||||
|
||||
public void setPullWhileLeashed(boolean pullWhileLeashed)
|
||||
{
|
||||
- ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed);
|
||||
+ if (getHandle() instanceof EntityInsentient)
|
||||
+ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed);
|
||||
}
|
||||
|
||||
public boolean isVegetated()
|
||||
{
|
||||
- return ((EntityInsentient) getHandle()).isVegetated();
|
||||
+ if (getHandle() instanceof EntityInsentient)
|
||||
+ return ((EntityInsentient) getHandle()).isVegetated();
|
||||
+
|
||||
+ return false;
|
||||
}
|
||||
|
||||
public void setVegetated(boolean vegetated)
|
||||
{
|
||||
- ((EntityInsentient) getHandle()).setVegetated(vegetated);
|
||||
+ if (getHandle() instanceof EntityInsentient)
|
||||
+ ((EntityInsentient) getHandle()).setVegetated(vegetated);
|
||||
}
|
||||
|
||||
public boolean isGhost()
|
||||
--
|
||||
2.7.4
|
||||
|
37
Patches/CraftBukkit-Patches/0016-Fix-schedulers.patch
Normal file
37
Patches/CraftBukkit-Patches/0016-Fix-schedulers.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From e1d672bf80a66283809f25f925121487cc02e040 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Wed, 11 Nov 2015 11:43:17 +1300
|
||||
Subject: [PATCH] Fix schedulers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 1d29ae7..55e2afd 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -705,6 +705,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
}
|
||||
|
||||
public void B() {
|
||||
+ SpigotTimings.schedulerTimer.startTiming(); // Spigot
|
||||
+ // CraftBukkit start
|
||||
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks);
|
||||
+ SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
||||
+
|
||||
this.methodProfiler.a("jobs");
|
||||
Queue queue = this.j;
|
||||
|
||||
@@ -718,11 +723,6 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||
|
||||
this.methodProfiler.c("levels");
|
||||
|
||||
- SpigotTimings.schedulerTimer.startTiming(); // Spigot
|
||||
- // CraftBukkit start
|
||||
- this.server.getScheduler().mainThreadHeartbeat(this.ticks);
|
||||
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
||||
-
|
||||
// Run tasks that are waiting on processing
|
||||
SpigotTimings.processQueueTimer.startTiming(); // Spigot
|
||||
while (!processQueue.isEmpty()) {
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,137 @@
|
||||
From 08847caa91ab71f3a67bbb4bef1ebd00acac6f6a Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Sun, 22 Nov 2015 14:41:11 +1300
|
||||
Subject: [PATCH] EntityDismountEvent & teleport crash fix
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 81ca499..2a4f819 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1591,7 +1591,11 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
- pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
|
||||
+ org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ); // Spigot
|
||||
+ pluginManager.callEvent(event); // Spigot
|
||||
+ if (event.isCancelled() || vehicle != originalVehicle) {
|
||||
+ return;
|
||||
+ }
|
||||
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
this.vehicle.passenger = null;
|
||||
}
|
||||
@@ -1599,44 +1603,44 @@ 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 (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;
|
||||
+ org.spigotmc.event.entity.EntityDismountEvent exitEvent1 = null;
|
||||
if (this.vehicle != null) {
|
||||
- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
- pluginManager.callEvent(exitEvent);
|
||||
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
|
||||
+ 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)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ exitEvent1 = new org.spigotmc.event.entity.EntityDismountEvent(this.vehicle.getBukkitEntity(), this.bukkitEntity);
|
||||
+ pluginManager.callEvent(exitEvent1);
|
||||
|
||||
- if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
+ if (exitEvent1.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
- VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
|
||||
- pluginManager.callEvent(event);
|
||||
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
|
||||
+ VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
|
||||
+ pluginManager.callEvent(event);
|
||||
|
||||
- // If a plugin messes with the vehicle or the vehicle's passenger
|
||||
- if (event.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
- // If we only cancelled the enterevent then we need to put the player in a decent position.
|
||||
- if (exitEvent != null && this.vehicle == originalVehicle && this.vehicle != null && this.vehicle.passenger == originalPassenger) {
|
||||
- this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
- this.vehicle.passenger = null;
|
||||
- this.vehicle = null;
|
||||
+ // If a plugin messes with the vehicle or the vehicle's passenger
|
||||
+ if (event.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
+ // If we only cancelled the enterevent then we need to put the player in a decent position.
|
||||
+ if (exitEvent != null && this.vehicle == originalVehicle && this.vehicle != null && this.vehicle.passenger == originalPassenger) {
|
||||
+ this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
+ this.vehicle.passenger = null;
|
||||
+ this.vehicle = null;
|
||||
+ }
|
||||
+ return;
|
||||
}
|
||||
- return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
- // Spigot Start
|
||||
- if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) )
|
||||
- {
|
||||
- org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() );
|
||||
- pluginManager.callEvent( event );
|
||||
- if ( event.isCancelled() )
|
||||
- {
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- // Spigot End
|
||||
|
||||
if (this.vehicle != null) {
|
||||
this.vehicle.passenger = null;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index f75b0b1..19fc521 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -1725,6 +1725,13 @@ public abstract class EntityLiving extends Entity {
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
+ getBukkitEntity().getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled() || vehicle != originalVehicle) {
|
||||
+ return;
|
||||
+ }
|
||||
// CraftBukkit end
|
||||
org.bukkit.Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index efbf1a8..ad53590 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
+import com.google.common.primitives.Doubles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -233,6 +234,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
// If this entity is riding another entity, we must dismount before teleporting.
|
||||
entity.mount(null);
|
||||
+ if (!Doubles.isFinite(location.getX()) || !Doubles.isFinite(location.getY()) || !Doubles.isFinite(location.getZ())) {
|
||||
+ Thread.dumpStack();
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
// Spigot start
|
||||
if (!location.getWorld().equals(getWorld())) {
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,68 @@
|
||||
From 76027e46da8c636f0c59912ce06379373880862c Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Fri, 27 Nov 2015 22:26:34 +1300
|
||||
Subject: [PATCH] Server freezing, fix fake yaw/pitch
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 2a4f819..721d0e6 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
+import com.google.common.primitives.Doubles;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -151,6 +152,12 @@ public abstract class Entity implements ICommandListener {
|
||||
public void setFakeHead(boolean fakeHead)
|
||||
{
|
||||
_fakeHead = fakeHead;
|
||||
+
|
||||
+ if (!isFakeHead())
|
||||
+ {
|
||||
+ this.fakeYaw = yaw;
|
||||
+ this.fakePitch = pitch;
|
||||
+ }
|
||||
}
|
||||
|
||||
public boolean isSilent()
|
||||
@@ -1022,9 +1029,18 @@ public abstract class Entity implements ICommandListener {
|
||||
this.lastX = this.locX = d0;
|
||||
this.lastY = this.locY = d1;
|
||||
this.lastZ = this.locZ = d2;
|
||||
- this.lastYaw = this.yaw = fakeYaw = f;
|
||||
- this.lastPitch = this.pitch = fakePitch = f1;
|
||||
+ this.lastYaw = this.yaw = f;
|
||||
+ this.lastPitch = this.pitch = f1;
|
||||
+
|
||||
+ if (!isFakeHead())
|
||||
+ {
|
||||
+ this.fakeYaw = yaw;
|
||||
+ this.fakePitch = pitch;
|
||||
+ }
|
||||
|
||||
+ if (!Doubles.isFinite(locX) || !Doubles.isFinite(locY) || !Doubles.isFinite(locZ))
|
||||
+ Thread.dumpStack();
|
||||
+
|
||||
if (this instanceof EntityLiving)
|
||||
((EntityLiving) this).aK = f;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 5edef3e..d3b1586 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -208,7 +208,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
|
||||
public void a(PacketPlayInFlying packetplayinflying) {
|
||||
PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.u());
|
||||
- if (this.b(packetplayinflying)) {
|
||||
+ if (this.b(packetplayinflying) || !Doubles.isFinite(player.locX) || !Doubles.isFinite(player.locY) || !Doubles.isFinite(player.locZ)) {
|
||||
this.disconnect("Invalid move packet received");
|
||||
} else {
|
||||
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,26 @@
|
||||
From c97267c98bac90ee24f0bb7bfa710a58f3c990af Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Tue, 12 Jan 2016 19:56:07 +1300
|
||||
Subject: [PATCH] Sound and vehicle fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
index 0cc8f9b..dd07600 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
@@ -14,9 +14,9 @@ public class CraftSound {
|
||||
set(AMBIENCE_RAIN, "ambient.weather.rain");
|
||||
set(AMBIENCE_THUNDER, "ambient.weather.thunder");
|
||||
// Damage
|
||||
- set(HURT_FLESH, "game.neutral.hurt");
|
||||
- set(FALL_BIG, "game.neutral.hurt.fall.big");
|
||||
- set(FALL_SMALL, "game.neutral.hurt.fall.small");
|
||||
+ set(HURT_FLESH, "game.player.hurt");
|
||||
+ set(FALL_BIG, "game.player.hurt.fall.big");
|
||||
+ set(FALL_SMALL, "game.player.hurt.fall.small");
|
||||
// Dig Sounds
|
||||
set(DIG_WOOL, "dig.cloth");
|
||||
set(DIG_GRASS, "dig.grass");
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,31 @@
|
||||
From fd52634ee952e6c24f5d874d4130abae2524ac39 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Fri, 29 Jan 2016 16:59:00 +1300
|
||||
Subject: [PATCH] md_5's player interaction for specs patch
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index d3b1586..6fd49b3 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -1206,6 +1206,17 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||
if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand());
|
||||
}
|
||||
+ // Spigot start
|
||||
+ else if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK
|
||||
+ && (player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.ADVENTURE || player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.SPECTATOR)) {
|
||||
+ // RIGHT_CLICK_BLOCK sets this flag
|
||||
+ if (player.playerInteractManager.firedInteract) {
|
||||
+ player.playerInteractManager.firedInteract = false;
|
||||
+ } else {
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, movingobjectposition.a(), movingobjectposition.direction, player.inventory.getItemInHand(), true);
|
||||
+ }
|
||||
+ }
|
||||
+ // Spigot end
|
||||
|
||||
// Arm swing animation
|
||||
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer());
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 967ca8d8c01a90f93d52bd9aa2bbe1e9d2fd7a66 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Fri, 29 Jan 2016 16:59:12 +1300
|
||||
Subject: [PATCH] Fix enderman teleporting when vegetated
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
index a250062..5ad2d07 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
|
||||
@@ -157,6 +157,11 @@ public class EntityEnderman extends EntityMonster {
|
||||
}
|
||||
|
||||
protected boolean k(double d0, double d1, double d2) {
|
||||
+ if (isVegetated())
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
double d3 = this.locX;
|
||||
double d4 = this.locY;
|
||||
double d5 = this.locZ;
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,327 @@
|
||||
From 87e9cd7cd56efee729c47710a8b1d9ed265c8903 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Sun, 7 Feb 2016 20:28:54 +1100
|
||||
Subject: [PATCH] Implement Sentry for exception monitoring.
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index c1d1fb7..ceb3ec2 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -29,6 +29,12 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
+ <groupId>net.kencochrane.raven</groupId>
|
||||
+ <artifactId>raven-log4j2</artifactId>
|
||||
+ <version>6.0.0</version>
|
||||
+ <scope>compile</scope>
|
||||
+ </dependency>
|
||||
+ <dependency>
|
||||
<groupId>net.sf.trove4j</groupId>
|
||||
<artifactId>trove4j</artifactId>
|
||||
<version>3.0.3</version>
|
||||
@@ -202,6 +208,20 @@
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
+ <filters>
|
||||
+ <filter>
|
||||
+ <artifact>*:*</artifact>
|
||||
+ <excludes>
|
||||
+ <exclude>META-INF/org/apache/logging/log4j/core/config/plugins/</exclude>
|
||||
+ </excludes>
|
||||
+ </filter>
|
||||
+ <filter>
|
||||
+ <artifact>*:minecraft-server</artifact>
|
||||
+ <excludes>
|
||||
+ <exclude>org/apache/logging/log4j/</exclude>
|
||||
+ </excludes>
|
||||
+ </filter>
|
||||
+ </filters>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>joptsimple</pattern>
|
||||
diff --git a/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java b/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
|
||||
deleted file mode 100644
|
||||
index 341eaa3..0000000
|
||||
--- a/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
|
||||
+++ /dev/null
|
||||
@@ -1,245 +0,0 @@
|
||||
-/*
|
||||
- * Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
- * contributor license agreements. See the NOTICE file distributed with
|
||||
- * this work for additional information regarding copyright ownership.
|
||||
- * The ASF licenses this file to You under the Apache license, Version 2.0
|
||||
- * (the "License"); you may not use this file except in compliance with
|
||||
- * the License. You may obtain a copy of the License at
|
||||
- *
|
||||
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||
- *
|
||||
- * Unless required by applicable law or agreed to in writing, software
|
||||
- * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
- * See the license for the specific language governing permissions and
|
||||
- * limitations under the license.
|
||||
- */
|
||||
-package org.apache.logging.log4j.core.appender;
|
||||
-
|
||||
-import java.io.IOException;
|
||||
-import java.io.OutputStream;
|
||||
-import java.io.PrintStream;
|
||||
-import java.io.Serializable;
|
||||
-import java.io.UnsupportedEncodingException;
|
||||
-import java.lang.reflect.Constructor;
|
||||
-import java.nio.charset.Charset;
|
||||
-
|
||||
-import org.apache.logging.log4j.core.Filter;
|
||||
-import org.apache.logging.log4j.core.Layout;
|
||||
-import org.apache.logging.log4j.core.config.plugins.Plugin;
|
||||
-import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
|
||||
-import org.apache.logging.log4j.core.config.plugins.PluginElement;
|
||||
-import org.apache.logging.log4j.core.config.plugins.PluginFactory;
|
||||
-import org.apache.logging.log4j.core.helpers.Booleans;
|
||||
-import org.apache.logging.log4j.core.helpers.Loader;
|
||||
-import org.apache.logging.log4j.core.layout.PatternLayout;
|
||||
-import org.apache.logging.log4j.util.PropertiesUtil;
|
||||
-
|
||||
-/**
|
||||
- * ConsoleAppender appends log events to <code>System.out</code> or
|
||||
- * <code>System.err</code> using a layout specified by the user. The
|
||||
- * default target is <code>System.out</code>.
|
||||
- * @doubt accessing System.out or .err as a byte stream instead of a writer
|
||||
- * bypasses the JVM's knowledge of the proper encoding. (RG) Encoding
|
||||
- * is handled within the Layout. Typically, a Layout will generate a String
|
||||
- * and then call getBytes which may use a configured encoding or the system
|
||||
- * default. OTOH, a Writer cannot print byte streams.
|
||||
- */
|
||||
-@Plugin(name = "Console", category = "Core", elementType = "appender", printObject = true)
|
||||
-public final class ConsoleAppender extends AbstractOutputStreamAppender {
|
||||
-
|
||||
- private static final String JANSI_CLASS = "org.fusesource.jansi.WindowsAnsiOutputStream";
|
||||
- private static ConsoleManagerFactory factory = new ConsoleManagerFactory();
|
||||
-
|
||||
- /**
|
||||
- * Enumeration of console destinations.
|
||||
- */
|
||||
- public enum Target {
|
||||
- /** Standard output. */
|
||||
- SYSTEM_OUT,
|
||||
- /** Standard error output. */
|
||||
- SYSTEM_ERR
|
||||
- }
|
||||
-
|
||||
- private ConsoleAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
|
||||
- final OutputStreamManager manager,
|
||||
- final boolean ignoreExceptions) {
|
||||
- super(name, layout, filter, ignoreExceptions, true, manager);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Create a Console Appender.
|
||||
- * @param layout The layout to use (required).
|
||||
- * @param filter The Filter or null.
|
||||
- * @param t The target ("SYSTEM_OUT" or "SYSTEM_ERR"). The default is "SYSTEM_OUT".
|
||||
- * @param follow If true will follow changes to the underlying output stream.
|
||||
- * @param name The name of the Appender (required).
|
||||
- * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
|
||||
- * they are propagated to the caller.
|
||||
- * @return The ConsoleAppender.
|
||||
- */
|
||||
- @PluginFactory
|
||||
- public static ConsoleAppender createAppender(
|
||||
- @PluginElement("Layout") Layout<? extends Serializable> layout,
|
||||
- @PluginElement("Filters") final Filter filter,
|
||||
- @PluginAttribute("target") final String t,
|
||||
- @PluginAttribute("name") final String name,
|
||||
- @PluginAttribute("follow") final String follow,
|
||||
- @PluginAttribute("ignoreExceptions") final String ignore) {
|
||||
- if (name == null) {
|
||||
- LOGGER.error("No name provided for ConsoleAppender");
|
||||
- return null;
|
||||
- }
|
||||
- if (layout == null) {
|
||||
- layout = PatternLayout.createLayout(null, null, null, null, null);
|
||||
- }
|
||||
- final boolean isFollow = Boolean.parseBoolean(follow);
|
||||
- final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
|
||||
- final Target target = t == null ? Target.SYSTEM_OUT : Target.valueOf(t);
|
||||
- return new ConsoleAppender(name, layout, filter, getManager(isFollow, target, layout), ignoreExceptions);
|
||||
- }
|
||||
-
|
||||
- private static OutputStreamManager getManager(final boolean follow, final Target target, final Layout<? extends Serializable> layout) {
|
||||
- final String type = target.name();
|
||||
- final OutputStream os = getOutputStream(follow, target);
|
||||
- return OutputStreamManager.getManager(target.name() + "." + follow, new FactoryData(os, type, layout), factory);
|
||||
- }
|
||||
-
|
||||
- private static OutputStream getOutputStream(final boolean follow, final Target target) {
|
||||
- final String enc = Charset.defaultCharset().name();
|
||||
- PrintStream printStream = null;
|
||||
- try {
|
||||
- printStream = target == Target.SYSTEM_OUT ?
|
||||
- follow ? new PrintStream(new SystemOutStream(), true, enc) : System.out :
|
||||
- follow ? new PrintStream(new SystemErrStream(), true, enc) : System.err;
|
||||
- } catch (final UnsupportedEncodingException ex) { // should never happen
|
||||
- throw new IllegalStateException("Unsupported default encoding " + enc, ex);
|
||||
- }
|
||||
- final PropertiesUtil propsUtil = PropertiesUtil.getProperties();
|
||||
- if (!propsUtil.getStringProperty("os.name").startsWith("Windows") ||
|
||||
- propsUtil.getBooleanProperty("log4j.skipJansi")) {
|
||||
- return printStream;
|
||||
- }
|
||||
- try {
|
||||
- final ClassLoader loader = Loader.getClassLoader();
|
||||
- // We type the parameter as a wildcard to avoid a hard reference to Jansi.
|
||||
- final Class<?> clazz = loader.loadClass(JANSI_CLASS);
|
||||
- final Constructor<?> constructor = clazz.getConstructor(OutputStream.class);
|
||||
- return (OutputStream) constructor.newInstance(printStream);
|
||||
- } catch (final ClassNotFoundException cnfe) {
|
||||
- LOGGER.debug("Jansi is not installed, cannot find {}", JANSI_CLASS);
|
||||
- } catch (final NoSuchMethodException nsme) {
|
||||
- LOGGER.warn("{} is missing the proper constructor", JANSI_CLASS);
|
||||
- } catch (final Throwable ex) { // CraftBukkit - Exception -> Throwable
|
||||
- LOGGER.warn("Unable to instantiate {}", JANSI_CLASS);
|
||||
- }
|
||||
- return printStream;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * An implementation of OutputStream that redirects to the current System.err.
|
||||
- */
|
||||
- private static class SystemErrStream extends OutputStream {
|
||||
- public SystemErrStream() {
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void close() {
|
||||
- // do not close sys err!
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void flush() {
|
||||
- System.err.flush();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void write(final byte[] b) throws IOException {
|
||||
- System.err.write(b);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void write(final byte[] b, final int off, final int len)
|
||||
- throws IOException {
|
||||
- System.err.write(b, off, len);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void write(final int b) {
|
||||
- System.err.write(b);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * An implementation of OutputStream that redirects to the current System.out.
|
||||
- */
|
||||
- private static class SystemOutStream extends OutputStream {
|
||||
- public SystemOutStream() {
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void close() {
|
||||
- // do not close sys out!
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void flush() {
|
||||
- System.out.flush();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void write(final byte[] b) throws IOException {
|
||||
- System.out.write(b);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void write(final byte[] b, final int off, final int len)
|
||||
- throws IOException {
|
||||
- System.out.write(b, off, len);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void write(final int b) throws IOException {
|
||||
- System.out.write(b);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Data to pass to factory method.
|
||||
- */
|
||||
- private static class FactoryData {
|
||||
- private final OutputStream os;
|
||||
- private final String type;
|
||||
- private final Layout<? extends Serializable> layout;
|
||||
-
|
||||
- /**
|
||||
- * Constructor.
|
||||
- * @param os The OutputStream.
|
||||
- * @param type The name of the target.
|
||||
- * @param layout A Serializable layout
|
||||
- */
|
||||
- public FactoryData(final OutputStream os, final String type, final Layout<? extends Serializable> layout) {
|
||||
- this.os = os;
|
||||
- this.type = type;
|
||||
- this.layout = layout;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Factory to create the Appender.
|
||||
- */
|
||||
- private static class ConsoleManagerFactory implements ManagerFactory<OutputStreamManager, FactoryData> {
|
||||
-
|
||||
- /**
|
||||
- * Create an OutputStreamManager.
|
||||
- * @param name The name of the entity to manage.
|
||||
- * @param data The data required to create the entity.
|
||||
- * @return The OutputStreamManager
|
||||
- */
|
||||
- @Override
|
||||
- public OutputStreamManager createManager(final String name, final FactoryData data) {
|
||||
- return new OutputStreamManager(data.os, data.type, data.layout);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
-}
|
||||
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
|
||||
index f37d1c2..b9d8704 100644
|
||||
--- a/src/main/resources/log4j2.xml
|
||||
+++ b/src/main/resources/log4j2.xml
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
-<Configuration status="WARN" packages="com.mojang.util">
|
||||
+<Configuration status="WARN" packages="com.mojang.util,net.kencochrane.raven.log4j2">
|
||||
<Appenders>
|
||||
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
|
||||
<Queue name="TerminalConsole">
|
||||
@@ -12,6 +12,9 @@
|
||||
<OnStartupTriggeringPolicy />
|
||||
</Policies>
|
||||
</RollingRandomAccessFile>
|
||||
+ <Raven name="Sentry">
|
||||
+ <dsn>https://9dbb188a495a4145998c3478534c7052:89fefe0909f34090a6a7ad9397a31bd7@app.getsentry.com/66319</dsn>
|
||||
+ </Raven>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="info">
|
||||
@@ -21,6 +24,7 @@
|
||||
<AppenderRef ref="WINDOWS_COMPAT" level="info"/>
|
||||
<AppenderRef ref="File"/>
|
||||
<AppenderRef ref="TerminalConsole" level="info"/>
|
||||
+ <AppenderRef ref="Sentry" level="error"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
--
|
||||
2.7.4
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,82 @@
|
||||
From 4374ab4f758cd98b874600ad6c2b5c1474135a93 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Wed, 30 Dec 2015 22:38:30 +1300
|
||||
Subject: [PATCH] Some debug and crash fixes
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index b1348b9..147295e 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -932,12 +932,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
protected void a(MobEffect mobeffect, boolean flag) {
|
||||
super.a(mobeffect, flag);
|
||||
- this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
|
||||
+ if (this.playerConnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
|
||||
+ this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
|
||||
}
|
||||
|
||||
protected void b(MobEffect mobeffect) {
|
||||
super.b(mobeffect);
|
||||
- this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect));
|
||||
+ if (this.playerConnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
|
||||
+ this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect));
|
||||
}
|
||||
|
||||
public void enderTeleportTo(double d0, double d1, double d2) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||
index 39f0b73..e5c947f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||
@@ -428,7 +428,8 @@ public class EntityTrackerEntry {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffect mobeffect = (MobEffect) iterator.next();
|
||||
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.tracker.getId(), mobeffect));
|
||||
+ if (entityplayer.playerConnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.tracker.getId(), mobeffect));
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
||||
index ef51cd4..54c1ec9 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
|
||||
@@ -14,7 +14,7 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
|
||||
|
||||
public PacketPlayOutMapChunkBulk() {}
|
||||
|
||||
- public PacketPlayOutMapChunkBulk(List<Chunk> list) {Thread.dumpStack();
|
||||
+ public PacketPlayOutMapChunkBulk(List<Chunk> list) {
|
||||
int i = list.size();
|
||||
mapChunks = list;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 8d826df..b50db37 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -168,7 +168,8 @@ public abstract class PlayerList {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffect mobeffect = (MobEffect) iterator.next();
|
||||
|
||||
- playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
|
||||
+ if (playerconnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
|
||||
+ playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
|
||||
}
|
||||
|
||||
entityplayer.syncInventory();
|
||||
@@ -615,7 +616,9 @@ public abstract class PlayerList {
|
||||
entityplayer.updateAbilities();
|
||||
for (Object o1 : entityplayer.getEffects()) {
|
||||
MobEffect mobEffect = (MobEffect) o1;
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
|
||||
+
|
||||
+ if (entityplayer.playerConnection.networkManager.getVersion() > 47 || mobEffect.getEffectId() != 25)
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
|
||||
}
|
||||
// entityplayer1.syncInventory();
|
||||
// CraftBukkit end
|
||||
--
|
||||
2.7.4
|
||||
|
267
Patches/CraftBukkit-Patches/0026-Current-patch-stuff.patch
Normal file
267
Patches/CraftBukkit-Patches/0026-Current-patch-stuff.patch
Normal file
@ -0,0 +1,267 @@
|
||||
From 7c7c941e8a0275a063065f592d57db5bdc103db8 Mon Sep 17 00:00:00 2001
|
||||
From: git <libraryaddict115@yahoo.co.nz>
|
||||
Date: Thu, 25 Feb 2016 18:20:02 +1300
|
||||
Subject: [PATCH] Current patch stuff
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 41eede5..40d4232 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -549,13 +549,13 @@ public abstract class EntityLiving extends Entity {
|
||||
protected void B() {
|
||||
if (this.effects.isEmpty()) {
|
||||
this.bj();
|
||||
- this.setInvisible(false);
|
||||
+ this.setInvisible(isMineplexInvisible());
|
||||
} else {
|
||||
int i = PotionBrewer.a(this.effects.values());
|
||||
|
||||
this.datawatcher.watch(8, Byte.valueOf((byte) (PotionBrewer.b(this.effects.values()) ? 1 : 0)), META_AMBIENT_POTION, PotionBrewer.b(this.effects.values()));
|
||||
this.datawatcher.watch(7, Integer.valueOf(i), META_POTION_COLOR, i);
|
||||
- this.setInvisible(this.hasEffect(MobEffectList.INVISIBILITY.id));
|
||||
+ this.setInvisible(isMineplexInvisible() || this.hasEffect(MobEffectList.INVISIBILITY.id));
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EnumProtocol.java b/src/main/java/net/minecraft/server/EnumProtocol.java
|
||||
index f3877e4..0343bf8 100644
|
||||
--- a/src/main/java/net/minecraft/server/EnumProtocol.java
|
||||
+++ b/src/main/java/net/minecraft/server/EnumProtocol.java
|
||||
@@ -219,7 +219,11 @@ public enum EnumProtocol
|
||||
public Integer a(EnumProtocolDirection enumprotocoldirection, Packet packet, boolean is1_8)
|
||||
{
|
||||
Entry entry = (Entry) ((BiMap)j.get(enumprotocoldirection)).inverse().get(packet.getClass());
|
||||
- if ((Integer) (is1_8 ? entry.getKey() : entry.getValue()) < 0){System.out.print("Trying to send unsupported " + packet.getClass().getSimpleName());Thread.dumpStack();}
|
||||
+ if ((Integer) (is1_8 ? entry.getKey() : entry.getValue()) < 0)
|
||||
+ {
|
||||
+ System.out.print("Trying to send unsupported " + packet.getClass().getSimpleName());
|
||||
+ Thread.dumpStack();
|
||||
+ }
|
||||
return (Integer) (is1_8 ? entry.getKey() : entry.getValue());
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
index 31e1ea1..f6e8560 100644
|
||||
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
|
||||
int version = packethandshakinginsetprotocol.b();
|
||||
//System.out.print(version);
|
||||
- boolean supported = version == 47 || version == 94;
|
||||
+ boolean supported = version == 47 || version == 104;
|
||||
|
||||
if (supported)
|
||||
{
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
||||
index 702d33d..c3a067e 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
||||
@@ -5,9 +5,9 @@ import java.io.IOException;
|
||||
public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
||||
|
||||
public int a;
|
||||
- public byte b;
|
||||
- public byte c;
|
||||
- public byte d;
|
||||
+ public short b;
|
||||
+ public short c;
|
||||
+ public short d;
|
||||
public byte e;
|
||||
public byte f;
|
||||
public boolean g;
|
||||
@@ -87,9 +87,18 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
super.b(packetdataserializer);
|
||||
- packetdataserializer.writeByte(this.b);
|
||||
- packetdataserializer.writeByte(this.c);
|
||||
- packetdataserializer.writeByte(this.d);
|
||||
+ if (packetdataserializer.version != 47)
|
||||
+ {
|
||||
+ packetdataserializer.writeShort(this.b);
|
||||
+ packetdataserializer.writeShort(this.c);
|
||||
+ packetdataserializer.writeShort(this.d);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ packetdataserializer.writeByte(this.b);
|
||||
+ packetdataserializer.writeByte(this.c);
|
||||
+ packetdataserializer.writeByte(this.d);
|
||||
+ }
|
||||
packetdataserializer.writeBoolean(this.g);
|
||||
}
|
||||
}
|
||||
@@ -123,9 +132,18 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
super.b(packetdataserializer);
|
||||
- packetdataserializer.writeByte(this.b);
|
||||
- packetdataserializer.writeByte(this.c);
|
||||
- packetdataserializer.writeByte(this.d);
|
||||
+ if (packetdataserializer.version != 47)
|
||||
+ {
|
||||
+ packetdataserializer.writeShort(this.b);
|
||||
+ packetdataserializer.writeShort(this.c);
|
||||
+ packetdataserializer.writeShort(this.d);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ packetdataserializer.writeByte(this.b);
|
||||
+ packetdataserializer.writeByte(this.c);
|
||||
+ packetdataserializer.writeByte(this.d);
|
||||
+ }
|
||||
packetdataserializer.writeByte(this.e);
|
||||
packetdataserializer.writeByte(this.f);
|
||||
packetdataserializer.writeBoolean(this.g);
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
||||
index 4730b34..3fa9fe4 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
|
||||
@@ -44,9 +44,15 @@ public class PacketPlayOutEntityTeleport implements Packet<PacketListenerPlayOut
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer) {
|
||||
packetdataserializer.b(this.a);
|
||||
+ if (packetdataserializer.version == 47){
|
||||
packetdataserializer.writeInt(this.b);
|
||||
packetdataserializer.writeInt(this.c);
|
||||
packetdataserializer.writeInt(this.d);
|
||||
+ } else {
|
||||
+ packetdataserializer.writeDouble(this.b/32D);
|
||||
+ packetdataserializer.writeDouble(this.c/32D);
|
||||
+ packetdataserializer.writeDouble(this.d/32D);
|
||||
+ }
|
||||
packetdataserializer.writeByte(this.e);
|
||||
packetdataserializer.writeByte(this.f);
|
||||
packetdataserializer.writeBoolean(this.g);
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
|
||||
index 340787a..efc9a08 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
|
||||
@@ -48,9 +48,15 @@ public class PacketPlayOutNamedEntitySpawn implements Packet<PacketListenerPlayO
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
packetdataserializer.b(this.a);
|
||||
packetdataserializer.a(this.b);
|
||||
- packetdataserializer.writeInt(this.c);
|
||||
- packetdataserializer.writeInt(this.d);
|
||||
- packetdataserializer.writeInt(this.e);
|
||||
+ if (packetdataserializer.version != 47){
|
||||
+ packetdataserializer.writeDouble(this.c/32D);
|
||||
+ packetdataserializer.writeDouble(this.d/32D);
|
||||
+ packetdataserializer.writeDouble(this.e/32D);
|
||||
+ }else {
|
||||
+ packetdataserializer.writeInt(this.c);
|
||||
+ packetdataserializer.writeInt(this.d);
|
||||
+ packetdataserializer.writeInt(this.e);
|
||||
+ }
|
||||
packetdataserializer.writeByte(this.f);
|
||||
packetdataserializer.writeByte(this.g);
|
||||
if (packetdataserializer.version == 47)
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
|
||||
index 6c8c8fa..b72b7d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
|
||||
@@ -279,6 +279,7 @@ public class PacketPlayOutNamedSoundEffect
|
||||
toPlay = sounds.get(toPlay);
|
||||
|
||||
packetdataserializer.a(toPlay);
|
||||
+ packetdataserializer.b(0);
|
||||
packetdataserializer.writeInt(b);
|
||||
packetdataserializer.writeInt(c);
|
||||
packetdataserializer.writeInt(d);
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
|
||||
index 0c60066..c9de471 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
|
||||
@@ -93,9 +93,15 @@ public class PacketPlayOutSpawnEntity implements Packet<PacketListenerPlayOut> {
|
||||
if (packetdataserializer.version != 47)
|
||||
packetdataserializer.a(this.uuid);
|
||||
packetdataserializer.writeByte(this.j);
|
||||
- packetdataserializer.writeInt(this.b);
|
||||
- packetdataserializer.writeInt(this.c);
|
||||
- packetdataserializer.writeInt(this.d);
|
||||
+ if (packetdataserializer.version != 47){
|
||||
+ packetdataserializer.writeDouble(this.b/32D);
|
||||
+ packetdataserializer.writeDouble(this.c/32D);
|
||||
+ packetdataserializer.writeDouble(this.d/32D);
|
||||
+ }else {
|
||||
+ packetdataserializer.writeInt(this.b);
|
||||
+ packetdataserializer.writeInt(this.c);
|
||||
+ packetdataserializer.writeInt(this.d);
|
||||
+ }
|
||||
packetdataserializer.writeByte(this.h);
|
||||
packetdataserializer.writeByte(this.i);
|
||||
packetdataserializer.writeInt(this.k);
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java
|
||||
index 4f2b03e..0a39433 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java
|
||||
@@ -42,9 +42,15 @@ public class PacketPlayOutSpawnEntityExperienceOrb
|
||||
throws IOException
|
||||
{
|
||||
packetdataserializer.b(a);
|
||||
- packetdataserializer.writeInt(b);
|
||||
- packetdataserializer.writeInt(c);
|
||||
- packetdataserializer.writeInt(d);
|
||||
+ if (packetdataserializer.version != 47){
|
||||
+ packetdataserializer.writeDouble(this.b/32D);
|
||||
+ packetdataserializer.writeDouble(this.c/32D);
|
||||
+ packetdataserializer.writeDouble(this.d/32D);
|
||||
+ }else {
|
||||
+ packetdataserializer.writeInt(this.b);
|
||||
+ packetdataserializer.writeInt(this.c);
|
||||
+ packetdataserializer.writeInt(this.d);
|
||||
+ }
|
||||
packetdataserializer.writeShort(e);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
|
||||
index 9da448e..ea7c98b 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
|
||||
@@ -88,9 +88,15 @@ public class PacketPlayOutSpawnEntityLiving implements Packet<PacketListenerPlay
|
||||
if (packetdataserializer.version != 47)
|
||||
packetdataserializer.a(this.uuid);
|
||||
packetdataserializer.writeByte(this.b & 255);
|
||||
- packetdataserializer.writeInt(this.c);
|
||||
- packetdataserializer.writeInt(this.d);
|
||||
- packetdataserializer.writeInt(this.e);
|
||||
+ if (packetdataserializer.version != 47){
|
||||
+ packetdataserializer.writeDouble(this.c/32D);
|
||||
+ packetdataserializer.writeDouble(this.d/32D);
|
||||
+ packetdataserializer.writeDouble(this.e/32D);
|
||||
+ }else {
|
||||
+ packetdataserializer.writeInt(this.c);
|
||||
+ packetdataserializer.writeInt(this.d);
|
||||
+ packetdataserializer.writeInt(this.e);
|
||||
+ }
|
||||
packetdataserializer.writeByte(this.i);
|
||||
packetdataserializer.writeByte(this.j);
|
||||
packetdataserializer.writeByte(this.k);
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java
|
||||
index 2ce95fa..51a3a21 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java
|
||||
@@ -44,9 +44,15 @@ public class PacketPlayOutSpawnEntityWeather
|
||||
{
|
||||
packetdataserializer.b(a);
|
||||
packetdataserializer.writeByte(e);
|
||||
- packetdataserializer.writeInt(b);
|
||||
- packetdataserializer.writeInt(c);
|
||||
- packetdataserializer.writeInt(d);
|
||||
+ if (packetdataserializer.version != 47){
|
||||
+ packetdataserializer.writeDouble(this.b/32D);
|
||||
+ packetdataserializer.writeDouble(this.c/32D);
|
||||
+ packetdataserializer.writeDouble(this.d/32D);
|
||||
+ }else {
|
||||
+ packetdataserializer.writeInt(this.b);
|
||||
+ packetdataserializer.writeInt(this.c);
|
||||
+ packetdataserializer.writeInt(this.d);
|
||||
+ }
|
||||
}
|
||||
|
||||
public void a(PacketListenerPlayOut packetlistenerplayout)
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,135 @@
|
||||
From 9dfce5478dba231619b0527f28af3640aef5480c Mon Sep 17 00:00:00 2001
|
||||
From: git <libraryaddict115@yahoo.co.nz>
|
||||
Date: Sun, 28 Feb 2016 00:37:30 +1300
|
||||
Subject: [PATCH] Changed maven version, fixed entity movement, fixed sound
|
||||
packet
|
||||
|
||||
|
||||
diff --git a/pom.xml b/pom.xml
|
||||
index ceb3ec2..a44f7b1 100644
|
||||
--- a/pom.xml
|
||||
+++ b/pom.xml
|
||||
@@ -4,7 +4,7 @@
|
||||
<groupId>com.mineplex</groupId>
|
||||
<artifactId>spigot</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
- <version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
+ <version>1.8.8-1.9-SNAPSHOT</version>
|
||||
<name>Spigot</name>
|
||||
<url>http://www.spigotmc.org</url>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||
index e5c947f..9cd9be6 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
|
||||
@@ -145,6 +145,7 @@ public class EntityTrackerEntry {
|
||||
int k1 = j - this.yLoc;
|
||||
int l1 = k - this.zLoc;
|
||||
Object object = null;
|
||||
+ Object object2 = null;
|
||||
boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0;
|
||||
boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4;
|
||||
|
||||
@@ -163,10 +164,12 @@ public class EntityTrackerEntry {
|
||||
|
||||
if (this.m > 0 || this.tracker instanceof EntityArrow) {
|
||||
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x && this.y == this.tracker.onGround) {
|
||||
+ object2 = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, this.tracker.onGround);
|
||||
if ((!flag || !flag1) && !(this.tracker instanceof EntityArrow)) {
|
||||
if (flag) {
|
||||
object = new PacketPlayOutEntity.PacketPlayOutRelEntityMove(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, this.tracker.onGround);
|
||||
} else if (flag1) {
|
||||
+ object2 = null;
|
||||
object = new PacketPlayOutEntity.PacketPlayOutEntityLook(this.tracker.getId(), (byte) l, (byte) i1, this.tracker.onGround);
|
||||
}
|
||||
} else {
|
||||
@@ -200,7 +203,15 @@ public class EntityTrackerEntry {
|
||||
}
|
||||
|
||||
if (object != null) {
|
||||
- this.broadcast((Packet) object);
|
||||
+
|
||||
+ Iterator iterator = this.trackedPlayers.iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
+ Packet packetToSend = object2 == null || entityplayer.playerConnection.networkManager.getVersion() == 47 ? (Packet) object : (Packet) object2;
|
||||
+
|
||||
+ entityplayer.playerConnection.sendPacket(packetToSend);
|
||||
+ }
|
||||
}
|
||||
|
||||
this.b();
|
||||
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
index f6e8560..fae7922 100644
|
||||
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
|
||||
int version = packethandshakinginsetprotocol.b();
|
||||
//System.out.print(version);
|
||||
- boolean supported = version == 47 || version == 104;
|
||||
+ boolean supported = version == 47 || version >= 104;
|
||||
|
||||
if (supported)
|
||||
{
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
||||
index c3a067e..8436897 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
|
||||
@@ -5,9 +5,9 @@ import java.io.IOException;
|
||||
public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
||||
|
||||
public int a;
|
||||
- public short b;
|
||||
- public short c;
|
||||
- public short d;
|
||||
+ public byte b;
|
||||
+ public byte c;
|
||||
+ public byte d;
|
||||
public byte e;
|
||||
public byte f;
|
||||
public boolean g;
|
||||
@@ -89,9 +89,9 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
||||
super.b(packetdataserializer);
|
||||
if (packetdataserializer.version != 47)
|
||||
{
|
||||
- packetdataserializer.writeShort(this.b);
|
||||
- packetdataserializer.writeShort(this.c);
|
||||
- packetdataserializer.writeShort(this.d);
|
||||
+ packetdataserializer.writeShort((short) this.b);
|
||||
+ packetdataserializer.writeShort((short) this.c);
|
||||
+ packetdataserializer.writeShort((short) this.d);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -134,9 +134,9 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
|
||||
super.b(packetdataserializer);
|
||||
if (packetdataserializer.version != 47)
|
||||
{
|
||||
- packetdataserializer.writeShort(this.b);
|
||||
- packetdataserializer.writeShort(this.c);
|
||||
- packetdataserializer.writeShort(this.d);
|
||||
+ packetdataserializer.writeShort((short) this.b);
|
||||
+ packetdataserializer.writeShort((short) this.c);
|
||||
+ packetdataserializer.writeShort((short) this.d);
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
|
||||
index b72b7d7..bcfdab9 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
|
||||
@@ -279,7 +279,8 @@ public class PacketPlayOutNamedSoundEffect
|
||||
toPlay = sounds.get(toPlay);
|
||||
|
||||
packetdataserializer.a(toPlay);
|
||||
- packetdataserializer.b(0);
|
||||
+ if (packetdataserializer.version > 47)
|
||||
+ packetdataserializer.b(0);
|
||||
packetdataserializer.writeInt(b);
|
||||
packetdataserializer.writeInt(c);
|
||||
packetdataserializer.writeInt(d);
|
||||
--
|
||||
2.7.4
|
||||
|
@ -0,0 +1,60 @@
|
||||
From 6e5d8f23968f7b24c084816f2b55edfbc99e820f Mon Sep 17 00:00:00 2001
|
||||
From: git <libraryaddict115@yahoo.co.nz>
|
||||
Date: Tue, 1 Mar 2016 09:29:32 +1300
|
||||
Subject: [PATCH] Update to 1.9, fix blocking
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 51ca1f3..c6d3183 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1755,6 +1755,14 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
|
||||
public void f(boolean flag) {
|
||||
+ if (this instanceof EntityPlayer)
|
||||
+ {
|
||||
+ EntityPlayer player = (EntityPlayer) this;
|
||||
+
|
||||
+ if (player.playerConnection.networkManager.getVersion() != 47 && player.bS() && player.getHeldItem().getItem().e(player.getHeldItem()) == EnumAnimation.BLOCK)
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
this.b(4, flag);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 743df69..998ea69 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -124,8 +124,13 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
}
|
||||
|
||||
+ public ItemStack getHeldItem()
|
||||
+ {
|
||||
+ return this.g;
|
||||
+ }
|
||||
+
|
||||
public boolean isBlocking() {
|
||||
- return this.bS() && this.g.getItem().e(this.g) == EnumAnimation.BLOCK;
|
||||
+ return ((EntityPlayer) this).playerConnection.networkManager.getVersion() == 47 && this.bS() && this.g.getItem().e(this.g) == EnumAnimation.BLOCK;
|
||||
}
|
||||
|
||||
public void t_() {
|
||||
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
index fae7922..7d12515 100644
|
||||
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
|
||||
@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
|
||||
|
||||
int version = packethandshakinginsetprotocol.b();
|
||||
//System.out.print(version);
|
||||
- boolean supported = version == 47 || version >= 104;
|
||||
+ boolean supported = version == 47 || version == 107;
|
||||
|
||||
if (supported)
|
||||
{
|
||||
--
|
||||
2.7.4
|
||||
|
29
Patches/CraftBukkit-Patches/0029-Fix-TnT-Datawatcher.patch
Normal file
29
Patches/CraftBukkit-Patches/0029-Fix-TnT-Datawatcher.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 6e7c7edf9e6144385bc909b17dd14539d8ac98d6 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Mon, 25 Apr 2016 10:36:56 +1000
|
||||
Subject: [PATCH] Fix TnT Datawatcher
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
index 9b13620..4f4511f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||
@@ -97,13 +97,13 @@ public class EntityTNTPrimed extends Entity {
|
||||
|
||||
protected void a(NBTTagCompound nbttagcompound) {
|
||||
this.fuseTicks = nbttagcompound.getByte("Fuse");
|
||||
- datawatcher.a(24, 0, META_FUSE, fuseTicks);
|
||||
+ datawatcher.watch(24, 0, META_FUSE, fuseTicks);
|
||||
}
|
||||
|
||||
public void setFuseTicks(int newTicks)
|
||||
{
|
||||
fuseTicks = newTicks;
|
||||
- datawatcher.a(24, 0, META_FUSE, fuseTicks);
|
||||
+ datawatcher.watch(24, 0, META_FUSE, fuseTicks);
|
||||
}
|
||||
|
||||
public EntityLiving getSource() {
|
||||
--
|
||||
2.7.4
|
||||
|
BIN
Patches/craftbukkit.jar
Normal file
BIN
Patches/craftbukkit.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user