Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 11:30:06 +01:00
SkeletonHorse Additions (#1283)
Dieser Commit ist enthalten in:
Ursprung
7abf02b17c
Commit
adcd0c1505
76
Spigot-API-Patches/0127-SkeletonHorse-Additions.patch
Normale Datei
76
Spigot-API-Patches/0127-SkeletonHorse-Additions.patch
Normale Datei
@ -0,0 +1,76 @@
|
|||||||
|
From 9bff75502f5c0651e30841d8dc67f4139a126601 Mon Sep 17 00:00:00 2001
|
||||||
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||||
|
Date: Fri, 27 Jul 2018 22:36:17 -0500
|
||||||
|
Subject: [PATCH] SkeletonHorse Additions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..55bae018
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
|
||||||
|
@@ -0,0 +1,43 @@
|
||||||
|
+package com.destroystokyo.paper.event.entity;
|
||||||
|
+
|
||||||
|
+import org.bukkit.entity.SkeletonHorse;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+import org.bukkit.event.entity.EntityEvent;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Event called when a player gets close to a skeleton horse and triggers the lightning trap
|
||||||
|
+ */
|
||||||
|
+public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean cancelled;
|
||||||
|
+
|
||||||
|
+ public SkeletonHorseTrapEvent(SkeletonHorse horse) {
|
||||||
|
+ super(horse);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public SkeletonHorse getEntity() {
|
||||||
|
+ return (SkeletonHorse) super.getEntity();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled() {
|
||||||
|
+ return cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancel) {
|
||||||
|
+ this.cancelled = cancel;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public HandlerList getHandlers() {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static HandlerList getHandlerList() {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/SkeletonHorse.java b/src/main/java/org/bukkit/entity/SkeletonHorse.java
|
||||||
|
index b2c6b6a8..ba998346 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/SkeletonHorse.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/SkeletonHorse.java
|
||||||
|
@@ -3,4 +3,12 @@ package org.bukkit.entity;
|
||||||
|
/**
|
||||||
|
* Represents a SkeletonHorse - variant of {@link AbstractHorse}.
|
||||||
|
*/
|
||||||
|
-public interface SkeletonHorse extends AbstractHorse { }
|
||||||
|
+public interface SkeletonHorse extends AbstractHorse {
|
||||||
|
+ // Paper start
|
||||||
|
+ int getTrapTime();
|
||||||
|
+
|
||||||
|
+ boolean isTrap();
|
||||||
|
+
|
||||||
|
+ void setTrap(boolean trap);
|
||||||
|
+ // Paper end
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
75
Spigot-Server-Patches/0315-SkeletonHorse-Additions.patch
Normale Datei
75
Spigot-Server-Patches/0315-SkeletonHorse-Additions.patch
Normale Datei
@ -0,0 +1,75 @@
|
|||||||
|
From 3cd11a4c4b611ce91d5dfb1e75c0f1e1e460f4a5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||||
|
Date: Fri, 27 Jul 2018 22:36:31 -0500
|
||||||
|
Subject: [PATCH] SkeletonHorse Additions
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
|
||||||
|
index 70985bf52..9fb86eefd 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java
|
||||||
|
@@ -6,7 +6,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
|
||||||
|
|
||||||
|
private final PathfinderGoalHorseTrap bM = new PathfinderGoalHorseTrap(this);
|
||||||
|
private boolean bN;
|
||||||
|
- private int bO;
|
||||||
|
+ private int bO; public int getTrapTime() { return this.bO; } // Paper - OBFHELPER
|
||||||
|
|
||||||
|
public EntityHorseSkeleton(World world) {
|
||||||
|
super(EntityTypes.SKELETON_HORSE, world);
|
||||||
|
@@ -114,10 +114,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract {
|
||||||
|
return 0.96F;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public boolean isTrap() { return this.dz(); } // Paper - OBFHELPER
|
||||||
|
public boolean dz() {
|
||||||
|
return this.bN;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public void setTrap(boolean trap) { this.s(trap); } // Paper - OBFHELPER
|
||||||
|
public void s(boolean flag) {
|
||||||
|
if (flag != this.bN) {
|
||||||
|
this.bN = flag;
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
|
||||||
|
index f69170559..cba8b91e5 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java
|
||||||
|
@@ -13,6 +13,7 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void e() {
|
||||||
|
+ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity()).callEvent()) return; // Paper
|
||||||
|
DifficultyDamageScaler difficultydamagescaler = this.a.world.getDamageScaler(new BlockPosition(this.a));
|
||||||
|
|
||||||
|
this.a.s(false);
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
|
||||||
|
index e822c2200..496d0c0ca 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java
|
||||||
|
@@ -26,4 +26,23 @@ public class CraftSkeletonHorse extends CraftAbstractHorse implements SkeletonHo
|
||||||
|
public Variant getVariant() {
|
||||||
|
return Variant.SKELETON_HORSE;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Paper start
|
||||||
|
+ @Override
|
||||||
|
+ public EntityHorseSkeleton getHandle() {
|
||||||
|
+ return (EntityHorseSkeleton) super.getHandle();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int getTrapTime() {
|
||||||
|
+ return getHandle().getTrapTime();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isTrap() {
|
||||||
|
+ return getHandle().isTrap();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setTrap(boolean trap) {
|
||||||
|
+ getHandle().setTrap(trap);
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.11.0
|
||||||
|
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren