mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-09 09:57:45 +01:00
Zombies
This commit is contained in:
parent
7a7c63afc2
commit
2a55ed654d
@ -0,0 +1,16 @@
|
||||
package net.minestom.server.entity.type.monster;
|
||||
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by k.shandurenko on 23.02.2021
|
||||
*/
|
||||
public class EntityDrowned extends EntityZombie {
|
||||
|
||||
public EntityDrowned(@NotNull Position spawnPosition) {
|
||||
super(EntityType.DROWNED, spawnPosition);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package net.minestom.server.entity.type.monster;
|
||||
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by k.shandurenko on 23.02.2021
|
||||
*/
|
||||
public class EntityHusk extends EntityZombie {
|
||||
|
||||
public EntityHusk(@NotNull Position spawnPosition) {
|
||||
super(EntityType.HUSK, spawnPosition);
|
||||
}
|
||||
|
||||
}
|
@ -5,11 +5,16 @@ import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.type.Monster;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EntityZombie extends EntityCreature implements Monster {
|
||||
|
||||
public EntityZombie(Position spawnPosition) {
|
||||
super(EntityType.ZOMBIE, spawnPosition);
|
||||
public EntityZombie(@NotNull Position spawnPosition) {
|
||||
this(EntityType.ZOMBIE, spawnPosition);
|
||||
}
|
||||
|
||||
EntityZombie(@NotNull EntityType entityType, @NotNull Position spawnPosition) {
|
||||
super(entityType, spawnPosition);
|
||||
setBoundingBox(0.6f, 1.95f, 0.6f);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
package net.minestom.server.entity.type.monster;
|
||||
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by k.shandurenko on 23.02.2021
|
||||
*/
|
||||
public class EntityZombieVillager extends EntityZombie {
|
||||
|
||||
public EntityZombieVillager(@NotNull Position spawnPosition) {
|
||||
super(EntityType.ZOMBIE_VILLAGER, spawnPosition);
|
||||
}
|
||||
|
||||
public boolean isConverting() {
|
||||
return this.metadata.getIndex((byte) 18, false);
|
||||
}
|
||||
|
||||
public void setConverting(boolean value) {
|
||||
this.metadata.setIndex((byte) 18, Metadata.Boolean(value));
|
||||
}
|
||||
|
||||
public int[] getVillagerData() {
|
||||
return this.metadata.getIndex((byte) 19, new int[]{});
|
||||
}
|
||||
|
||||
public void setVillagerData(int[] value) {
|
||||
this.metadata.setIndex((byte) 19, Metadata.VillagerData(value[0], value[1], value[2]));
|
||||
}
|
||||
|
||||
}
|
@ -1,46 +1,16 @@
|
||||
package net.minestom.server.entity.type.monster;
|
||||
|
||||
import net.minestom.server.entity.EntityCreature;
|
||||
import net.minestom.server.entity.EntityType;
|
||||
import net.minestom.server.entity.Metadata;
|
||||
import net.minestom.server.entity.type.Monster;
|
||||
import net.minestom.server.utils.Position;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EntityZombifiedPiglin extends EntityCreature implements Monster {
|
||||
/**
|
||||
* Created by k.shandurenko on 23.02.2021
|
||||
*/
|
||||
public class EntityZombifiedPiglin extends EntityZombie {
|
||||
|
||||
public EntityZombifiedPiglin(Position spawnPosition) {
|
||||
public EntityZombifiedPiglin(@NotNull Position spawnPosition) {
|
||||
super(EntityType.ZOMBIFIED_PIGLIN, spawnPosition);
|
||||
setBoundingBox(0.6f, 1.95f, 0.6f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the pig zombie is a baby.
|
||||
*
|
||||
* @return true if it is a baby, false otherwise
|
||||
*/
|
||||
public boolean isBaby() {
|
||||
return metadata.getIndex((byte) 15, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the pig zombie a baby or adult.
|
||||
*
|
||||
* @param baby true to make it a baby, false otherwise
|
||||
*/
|
||||
public void setBaby(boolean baby) {
|
||||
this.metadata.setIndex((byte) 15, Metadata.Boolean(baby));
|
||||
}
|
||||
|
||||
public boolean isBecomingDrowned() {
|
||||
return metadata.getIndex((byte) 17, false);
|
||||
}
|
||||
|
||||
public void setBecomingDrowned(boolean becomingDrowned) {
|
||||
this.metadata.setIndex((byte) 17, Metadata.Boolean(becomingDrowned));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getEyeHeight() {
|
||||
return isBaby() ? 0.93 : 1.74;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user