mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
Obfuscation helpers
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
From cfbb0bb30d3e59592aeb8799880857a3a88f92c1 Mon Sep 17 00:00:00 2001
|
||||
From 5c6fa6e2f30756c23b1e2998a4978e934fcc9e3a Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sat, 4 May 2019 01:10:30 -0500
|
||||
Subject: [PATCH] cows to mooshroom when fed mushrooms
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/Entity.java | 1 +
|
||||
.../java/net/minecraft/server/EntityCow.java | 76 ++++++++++++++++++-
|
||||
.../java/net/minecraft/server/Entity.java | 2 +
|
||||
.../java/net/minecraft/server/EntityCow.java | 71 ++++++++++++++++++-
|
||||
.../net/minecraft/server/EntityLiving.java | 10 ++-
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 5 ++
|
||||
3 files changed, 81 insertions(+), 1 deletion(-)
|
||||
4 files changed, 85 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index c5198af94b..485da37a73 100644
|
||||
index 0a2c9a9f8..dd7da4117 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -1048,6 +1048,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -21,26 +22,19 @@ index c5198af94b..485da37a73 100644
|
||||
public void a(SoundEffect soundeffect, float f, float f1) {
|
||||
if (!this.isSilent()) {
|
||||
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, soundeffect, this.getSoundCategory(), f, f1);
|
||||
@@ -2545,6 +2546,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
this.invulnerable = flag;
|
||||
}
|
||||
|
||||
+ public void copyPositionRotation(Entity entity) { this.u(entity); } // Purpur - OBFHELPER
|
||||
public void u(Entity entity) {
|
||||
this.setPositionRotation(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
|
||||
index d2c2e3cc33..f053ff0e50 100644
|
||||
index d2c2e3cc3..c3aef0b2a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityCow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityCow.java
|
||||
@@ -1,9 +1,14 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
// CraftBukkit start
|
||||
+import net.pl3x.purpur.PurpurConfig;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
// CraftBukkit end
|
||||
+// Purpur start
|
||||
+import com.destroystokyo.paper.event.entity.EntityTransformedEvent;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+// Purpur end
|
||||
|
||||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
@@ -16,7 +21,7 @@ public class EntityCow extends EntityAnimal {
|
||||
@@ -16,7 +16,7 @@ public class EntityCow extends EntityAnimal {
|
||||
this.goalSelector.a(0, new PathfinderGoalFloat(this));
|
||||
this.goalSelector.a(1, new PathfinderGoalPanic(this, 2.0D));
|
||||
this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
|
||||
@@ -49,7 +43,7 @@ index d2c2e3cc33..f053ff0e50 100644
|
||||
this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D));
|
||||
this.goalSelector.a(5, new PathfinderGoalRandomStrollLand(this, 1.0D));
|
||||
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
|
||||
@@ -79,11 +84,80 @@ public class EntityCow extends EntityAnimal {
|
||||
@@ -79,11 +79,80 @@ public class EntityCow extends EntityAnimal {
|
||||
// CraftBukkit end
|
||||
|
||||
return true;
|
||||
@@ -81,7 +75,7 @@ index d2c2e3cc33..f053ff0e50 100644
|
||||
+ private boolean feedMushroom(EntityHuman entityhuman, ItemStack itemstack) {
|
||||
+ world.broadcastEntityEffect(this, (byte) 18); // hearts
|
||||
+ playSound(SoundEffects.ENTITY_COW_MILK, 1.0F, 1.0F);
|
||||
+ if (incrementFeedCount(itemstack) < PurpurConfig.feedMushroomsToCows) {
|
||||
+ if (incrementFeedCount(itemstack) < net.pl3x.purpur.PurpurConfig.feedMushroomsToCows) {
|
||||
+ if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
+ itemstack.subtract(1);
|
||||
+ }
|
||||
@@ -99,18 +93,18 @@ index d2c2e3cc33..f053ff0e50 100644
|
||||
+ mooshroom.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
+ mooshroom.setHealth(this.getHealth());
|
||||
+ mooshroom.setAge(getAge());
|
||||
+ mooshroom.u(this);
|
||||
+ mooshroom.aK = this.aK;
|
||||
+ mooshroom.aM = this.aM;
|
||||
+ mooshroom.copyPositionRotation(this);
|
||||
+ mooshroom.setRenderYawOffset(this.getRenderYawOffset());
|
||||
+ mooshroom.setHeadRotation(this.getHeadRotation());
|
||||
+ mooshroom.lastYaw = this.lastYaw;
|
||||
+ mooshroom.lastPitch = this.lastPitch;
|
||||
+ if (this.hasCustomName()) {
|
||||
+ mooshroom.setCustomName(this.getCustomName());
|
||||
+ }
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, mooshroom, EntityTransformEvent.TransformReason.SHROOMED).isCancelled()) {
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, mooshroom, org.bukkit.event.entity.EntityTransformEvent.TransformReason.SHROOMED).isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!new EntityTransformedEvent(this.getBukkitEntity(), mooshroom.getBukkitEntity(), EntityTransformedEvent.TransformedReason.SHROOMED).callEvent()) {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), mooshroom.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHROOMED).callEvent()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.world.addEntity(mooshroom);
|
||||
@@ -130,8 +124,29 @@ index d2c2e3cc33..f053ff0e50 100644
|
||||
@Override
|
||||
public EntityCow createChild(EntityAgeable entityageable) {
|
||||
return (EntityCow) EntityTypes.COW.a(this.world);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index d44ea9ec5..84bc1a629 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2742,8 +2742,14 @@ public abstract class EntityLiving extends Entity {
|
||||
this.aM = f;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public void l(float f) {
|
||||
+ // Purpur start
|
||||
+ public float getRenderYawOffset() {
|
||||
+ return this.aK;
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
+ public void setRenderYawOffset(float f) { this.l(f); } // Purpur - OBFHELPER
|
||||
+ @Override public void l(float f) {
|
||||
this.aK = f;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index 2f87a929c1..3a1a6b9671 100644
|
||||
index 2f87a929c..3a1a6b967 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -124,4 +124,9 @@ public class PurpurConfig {
|
||||
|
||||
Reference in New Issue
Block a user