mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
[ci-skip] More attributes work
This commit is contained in:
@@ -4,18 +4,6 @@ Date: Sun, 12 May 2019 00:43:12 -0500
|
||||
Subject: [PATCH] Giants AI settings
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/AttributeMapBase.java b/src/main/java/net/minecraft/server/AttributeMapBase.java
|
||||
index c57e23e16b79017fe6dc084d634226cfdac772b5..92aa104dc51efa833eac289198bb9ee7dbacd66b 100644
|
||||
--- a/src/main/java/net/minecraft/server/AttributeMapBase.java
|
||||
+++ b/src/main/java/net/minecraft/server/AttributeMapBase.java
|
||||
@@ -41,6 +41,7 @@ public class AttributeMapBase {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
+ @Nullable public AttributeModifiable getAttribute(AttributeBase attributebase) { return a(attributebase); } // Purpur - OBFHELPER
|
||||
@Nullable
|
||||
public AttributeModifiable a(AttributeBase attributebase) {
|
||||
return (AttributeModifiable) this.b.computeIfAbsent(attributebase, (attributebase1) -> {
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index d93db1049ef9421f6b3edd0dc52a421c4d1b51c2..0502ba688d3d16f15fea1ddda1f7d0bcbe59d701 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -30,10 +18,10 @@ index d93db1049ef9421f6b3edd0dc52a421c4d1b51c2..0502ba688d3d16f15fea1ddda1f7d0bc
|
||||
public float I;
|
||||
protected final Random random;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityGiantZombie.java b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
||||
index 9f4f56c47ecd4b35ebf33ca0bf9a040074ababf2..cf899bb6a5bd9d913ea90facdd5f3cc0dda1e9d2 100644
|
||||
index 9f4f56c47ecd4b35ebf33ca0bf9a040074ababf2..565c938d879940d8e12fe320ea8524d2cf679c1f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityGiantZombie.java
|
||||
@@ -4,9 +4,69 @@ public class EntityGiantZombie extends EntityMonster {
|
||||
@@ -4,9 +4,66 @@ public class EntityGiantZombie extends EntityMonster {
|
||||
|
||||
public EntityGiantZombie(EntityTypes<? extends EntityGiantZombie> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -65,13 +53,10 @@ index 9f4f56c47ecd4b35ebf33ca0bf9a040074ababf2..cf899bb6a5bd9d913ea90facdd5f3cc0
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void initAttributes(World world) {
|
||||
+ if (world != null) {
|
||||
+ getAttributeMap().getAttribute(GenericAttributes.MAX_HEALTH).setValue(world.purpurConfig.giantMaxHealth);
|
||||
+ getAttributeMap().getAttribute(GenericAttributes.MOVEMENT_SPEED).setValue(world.purpurConfig.giantMovementSpeed);
|
||||
+ getAttributeMap().getAttribute(GenericAttributes.ATTACK_DAMAGE).setValue(world.purpurConfig.giantAttackDamage);
|
||||
+ setHealth(getMaxHealth());
|
||||
+ }
|
||||
+ protected void initAttributes() {
|
||||
+ this.getAttributeInstance(GenericAttributes.MAX_HEALTH).setValue(this.world.purpurConfig.giantMaxHealth);
|
||||
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(this.world.purpurConfig.giantMovementSpeed);
|
||||
+ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(this.world.purpurConfig.giantAttackDamage);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -104,7 +89,7 @@ index 9f4f56c47ecd4b35ebf33ca0bf9a040074ababf2..cf899bb6a5bd9d913ea90facdd5f3cc0
|
||||
@Override
|
||||
protected float b(EntityPose entitypose, EntitySize entitysize) {
|
||||
return 10.440001F;
|
||||
@@ -18,6 +78,6 @@ public class EntityGiantZombie extends EntityMonster {
|
||||
@@ -18,6 +75,6 @@ public class EntityGiantZombie extends EntityMonster {
|
||||
|
||||
@Override
|
||||
public float a(BlockPosition blockposition, IWorldReader iworldreader) {
|
||||
@@ -113,7 +98,7 @@ index 9f4f56c47ecd4b35ebf33ca0bf9a040074ababf2..cf899bb6a5bd9d913ea90facdd5f3cc0
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
index 7b32a1fb79dcae355a8d95f3a8aa4284ec5d10db..b281ca841b2b7b51add3409318e2b92deb51eeda 100644
|
||||
index 7b32a1fb79dcae355a8d95f3a8aa4284ec5d10db..fba53ad6792236f0282279283570ffbd6d666f19 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -948,6 +948,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
@@ -132,25 +117,28 @@ index 7b32a1fb79dcae355a8d95f3a8aa4284ec5d10db..b281ca841b2b7b51add3409318e2b92d
|
||||
protected void b(DifficultyDamageScaler difficultydamagescaler) {
|
||||
float f = difficultydamagescaler.d();
|
||||
|
||||
@@ -1096,10 +1098,12 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||
} else {
|
||||
this.setLeftHanded(false);
|
||||
}
|
||||
-
|
||||
+ initAttributes(world.getMinecraftWorld()); // Purpur
|
||||
return groupdataentity;
|
||||
}
|
||||
|
||||
+ protected void initAttributes(World world) {} // Purpur
|
||||
+
|
||||
public boolean er() {
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index 4bbfb21d13c7e2f3ffcaaa31bd9ceee3755aa7cc..9af491260a586d322796f8419d6aa1fffae10140 100644
|
||||
index 4bbfb21d13c7e2f3ffcaaa31bd9ceee3755aa7cc..1fa5edd4dfbbe5cc68856a32b01a0c8ea83e3f6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -2171,7 +2171,7 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -165,6 +165,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.activeItem = ItemStack.b;
|
||||
this.by = Optional.empty();
|
||||
this.attributeMap = new AttributeMapBase(AttributeDefaults.a(entitytypes));
|
||||
+ this.initAttributes(); // Purpur
|
||||
this.craftAttributes = new CraftAttributeMap(attributeMap); // CraftBukkit
|
||||
// CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
|
||||
this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue());
|
||||
@@ -180,6 +181,8 @@ public abstract class EntityLiving extends Entity {
|
||||
this.bg = this.a(new Dynamic(dynamicopsnbt, dynamicopsnbt.createMap((Map) ImmutableMap.of(dynamicopsnbt.createString("memories"), dynamicopsnbt.emptyMap()))));
|
||||
}
|
||||
|
||||
+ protected void initAttributes() {} // Purpur
|
||||
+
|
||||
public BehaviorController<?> getBehaviorController() {
|
||||
return this.bg;
|
||||
}
|
||||
@@ -2171,7 +2174,7 @@ public abstract class EntityLiving extends Entity {
|
||||
this.enderTeleportTo(vec3d.x, vec3d.y, vec3d.z);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user