Skip to content

Commit

Permalink
更新模板实体数据
Browse files Browse the repository at this point in the history
  • Loading branch information
wode490390 committed Apr 10, 2024
1 parent 669a87e commit 64f08bc
Show file tree
Hide file tree
Showing 24 changed files with 185 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/cn/nukkit/block/BlockAnvil.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public String getName() {
@Override
public boolean place(Item item, Block block, Block target, BlockFace face, double fx, double fy, double fz, Player player) {
int damage = this.getDamage();
this.setDamage(FACES[player != null ? player.getDirection().getHorizontalIndex() : 0]);
this.setDamage(FACES[player != null ? player.getDirection().getOpposite().getHorizontalIndex() : 0]);
if (damage >= 4 && damage <= 7) {
this.setDamage(this.getDamage() | 0x04);
} else if (damage >= 8 && damage <= 11) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityBlaze.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;

Expand All @@ -25,6 +27,7 @@ public EntityBlaze(FullChunk chunk, CompoundTag nbt) {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(20);
fireProof = true;
}

@Override
Expand All @@ -42,6 +45,14 @@ public String getName() {
return "Blaze";
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}

@Override
public void spawnTo(Player player) {
if (this.hasSpawned.containsKey(player.getLoaderId())) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityEnderDragon.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.entity.attribute.Attribute;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.network.protocol.AddEntityPacket;
Expand Down Expand Up @@ -38,6 +40,7 @@ public float getHeight() {
public void initEntity() {
super.initEntity();
this.setMaxHealth(200);
fireProof = true;
}

@Override
Expand Down Expand Up @@ -91,4 +94,12 @@ public boolean canBeAffected(int effectId) {
protected float getKnockbackResistance() {
return 1;
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}
}
11 changes: 11 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityGhast.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.item.Item;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
Expand All @@ -28,6 +30,7 @@ public EntityGhast(FullChunk chunk, CompoundTag nbt) {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(10);
fireProof = true;
}

@Override
Expand Down Expand Up @@ -64,4 +67,12 @@ public Item[] getDrops() {
Item.get(Item.GUNPOWDER, 0, random.nextInt(3)),
};
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}
}
10 changes: 10 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityIronGolem.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.entity.attribute.Attribute;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.item.Item;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
Expand Down Expand Up @@ -94,4 +96,12 @@ public Item[] getDrops() {
protected float getKnockbackResistance() {
return 1;
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}
}
11 changes: 11 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityMagmaCube.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.item.Item;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
Expand All @@ -26,6 +28,7 @@ public EntityMagmaCube(FullChunk chunk, CompoundTag nbt) {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(4);
fireProof = true;
}

@Override
Expand Down Expand Up @@ -65,4 +68,12 @@ public void spawnTo(Player player) {
public int getBaseArmorValue() {
return 3 * getDataPropertyInt(DATA_VARIANT);
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}
}
10 changes: 10 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityPhantom.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.entity.EntitySmite;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.item.Item;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
Expand Down Expand Up @@ -51,6 +53,14 @@ public Item[] getDrops() {
};
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}

@Override
public void spawnTo(Player player) {
if (this.hasSpawned.containsKey(player.getLoaderId())) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityShulker.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.item.Item;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
Expand All @@ -28,6 +30,7 @@ public EntityShulker(FullChunk chunk, CompoundTag nbt) {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(30);
fireProof = true;
}

@Override
Expand Down Expand Up @@ -71,4 +74,12 @@ public int getBaseArmorValue() {
}
return 0;
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}
}
10 changes: 10 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntitySnowGolem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;

Expand Down Expand Up @@ -38,6 +40,14 @@ protected void initEntity() {
this.setMaxHealth(4);
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}

@Override
public void spawnTo(Player player) {
if (this.hasSpawned.containsKey(player.getLoaderId())) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityVex.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;

Expand All @@ -25,6 +27,7 @@ public int getNetworkId() {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(14);
fireProof = true;
}

@Override
Expand All @@ -42,6 +45,14 @@ public String getName() {
return "Vex";
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}

@Override
public void spawnTo(Player player) {
if (this.hasSpawned.containsKey(player.getLoaderId())) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityWarden.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public float getHeight() {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(500);
fireProof = true;
}

@Override
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityWither.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import cn.nukkit.entity.EntityID;
import cn.nukkit.entity.EntitySmite;
import cn.nukkit.entity.attribute.Attribute;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.item.Item;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;
Expand Down Expand Up @@ -41,6 +43,7 @@ public float getHeight() {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(600);
fireProof = true;
}

@Override
Expand Down Expand Up @@ -101,4 +104,12 @@ public boolean canBeAffected(int effectId) {
public int getBaseArmorValue() {
return 4;
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public EntityWitherSkeleton(FullChunk chunk, CompoundTag nbt) {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(20);
fireProof = true;
}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityZoglin.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public EntityZoglin(FullChunk chunk, CompoundTag nbt) {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(40);
fireProof = true;
}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cn/nukkit/entity/mob/EntityZombiePigman.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public EntityZombiePigman(FullChunk chunk, CompoundTag nbt) {
protected void initEntity() {
super.initEntity();
this.setMaxHealth(20);
fireProof = true;
}

@Override
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/cn/nukkit/entity/passive/EntityAllay.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;

Expand Down Expand Up @@ -39,6 +41,14 @@ public String getName() {
return "Allay";
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}

@Override
public void spawnTo(Player player) {
if (this.hasSpawned.containsKey(player.getLoaderId())) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/cn/nukkit/entity/passive/EntityBat.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import cn.nukkit.Player;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;

Expand Down Expand Up @@ -42,6 +44,14 @@ public void initEntity() {
this.setMaxHealth(6);
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}

@Override
public void spawnTo(Player player) {
if (this.hasSpawned.containsKey(player.getLoaderId())) {
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/cn/nukkit/entity/passive/EntityBee.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import cn.nukkit.Player;
import cn.nukkit.entity.EntityArthropod;
import cn.nukkit.entity.EntityID;
import cn.nukkit.event.entity.EntityDamageEvent;
import cn.nukkit.event.entity.EntityDamageEvent.DamageCause;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.nbt.tag.CompoundTag;

Expand Down Expand Up @@ -44,6 +46,14 @@ protected void initEntity() {
this.setMaxHealth(10);
}

@Override
public boolean attack(EntityDamageEvent source) {
if (source.getCause() == DamageCause.FALL) {
return false;
}
return super.attack(source);
}

@Override
public void spawnTo(Player player) {
if (this.hasSpawned.containsKey(player.getLoaderId())) {
Expand Down
Loading

0 comments on commit 64f08bc

Please sign in to comment.