Skip to content

Commit

Permalink
fix horse jump event
Browse files Browse the repository at this point in the history
and some 1.17 stuff and some meta
  • Loading branch information
mcmonkey4eva committed Jun 22, 2021
1 parent f03d486 commit 090d57a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
Expand Up @@ -62,19 +62,15 @@ public boolean matches(ScriptPath path) {
String arg1 = path.eventArgLowerAt(0);
String arg2 = path.eventArgLowerAt(1);
String tamed = arg2.equals("jumps") ? arg1 : arg2;

if (!tryEntity(entity, tamed)) {
return false;
}

if (path.eventArgLowerAt(2).equals("jumps") && !arg1.equals(CoreUtilities.toLowerCase(color.toString()))) {
if (path.eventArgLowerAt(2).equals("jumps") && (color == null || !arg1.equals(CoreUtilities.toLowerCase(color.toString())))) {
return false;
}

if (!runInCheck(path, entity.getLocation())) {
return false;
}

return super.matches(path);
}

Expand Down Expand Up @@ -107,12 +103,10 @@ public ObjectTag getContext(String name) {

@EventHandler
public void onHorseJumps(HorseJumpEvent event) {
if (event.getEntity() instanceof Horse) {
entity = new EntityTag(event.getEntity());
color = new ElementTag(((Horse) event.getEntity()).getColor().name());
this.event = event;
fire(event);
}
entity = new EntityTag(event.getEntity());
color = event.getEntity() instanceof Horse ? new ElementTag(((Horse) event.getEntity()).getColor().name()) : null;
this.event = event;
fire(event);
}

}
Expand Up @@ -47,7 +47,7 @@ public DebugBlockCommand() {
// The underlying color input is a full color value, however the current minecraft client can only render shades between green and gray (ie the red and blue color channels are ignored).
//
// @Tags
// None.
// None
//
// @Usage
// Use to show a debug block where the player is looking.
Expand Down
Expand Up @@ -114,7 +114,7 @@ public void send(Packet<?> packet) {
public void handlePacketIn(Packet<ServerGamePacketListener> packet) {
denizenNetworkManager.packetsReceived++;
if (NMSHandler.debugPackets) {
Debug.log("Packet: " + packet.getClass().getCanonicalName() + " sent from " + player.getName());
Debug.log("Packet: " + packet.getClass().getCanonicalName() + " sent from " + player.getScoreboardName());
}
}

Expand Down
Expand Up @@ -186,7 +186,7 @@ public void send(Packet<?> packet) {
@Override
public void send(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
if (NMSHandler.debugPackets) {
Debug.log("Packet: " + packet.getClass().getCanonicalName() + " sent to " + player.getName());
Debug.log("Packet: " + packet.getClass().getCanonicalName() + " sent to " + player.getScoreboardName());
}
packetsSent++;
if (processAttachToForPacket(packet)
Expand Down
Expand Up @@ -95,7 +95,7 @@ public void handleContainerClick(ServerboundContainerClickPacket packet) {
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
if (NMSHandler.debugPackets) {
Debug.log("Custom packet payload: " + packet.identifier.toString() + " sent from " + player.getName());
Debug.log("Custom packet payload: " + packet.identifier.toString() + " sent from " + player.getScoreboardName());
}
if (packet.identifier.getNamespace().equals("minecraft") && packet.identifier.getPath().equals("brand")) {
FriendlyByteBuf newData = new FriendlyByteBuf(packet.data.copy());
Expand Down

0 comments on commit 090d57a

Please sign in to comment.