mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -04:00
Creeper support, cleanup entity classes to make less duplicated
This commit is contained in:
parent
edf1095fdd
commit
8a01fc2b5a
@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Codename Minosoft
|
||||||
|
* Copyright (C) 2020 Moritz Zwerger
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.bixilon.minosoft.game.datatypes.entities;
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.game.datatypes.entities.meta.CreeperMetaData;
|
||||||
|
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||||
|
|
||||||
|
public class Creeper extends Mob implements MobInterface {
|
||||||
|
CreeperMetaData metaData;
|
||||||
|
|
||||||
|
public Creeper(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) {
|
||||||
|
super(id, location, yaw, pitch, velocity);
|
||||||
|
this.metaData = new CreeperMetaData(buffer, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mobs getEntityType() {
|
||||||
|
return Mobs.CREEPER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityMetaData getMetaData() {
|
||||||
|
return metaData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setMetaData(EntityMetaData metaData) {
|
||||||
|
this.metaData = (CreeperMetaData) metaData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getWidth() {
|
||||||
|
return 0.6F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getHeight() {
|
||||||
|
return 1.7F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxHealth() {
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
}
|
@ -15,42 +15,77 @@ package de.bixilon.minosoft.game.datatypes.entities;
|
|||||||
|
|
||||||
import de.bixilon.minosoft.game.datatypes.Slot;
|
import de.bixilon.minosoft.game.datatypes.Slot;
|
||||||
import de.bixilon.minosoft.game.datatypes.Slots;
|
import de.bixilon.minosoft.game.datatypes.Slots;
|
||||||
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
|
|
||||||
|
|
||||||
public interface Entity {
|
import java.util.HashMap;
|
||||||
Mobs getEntityType();
|
|
||||||
|
|
||||||
int getId();
|
public abstract class Entity implements EntityInterface {
|
||||||
|
final int id;
|
||||||
|
final HashMap<Slots.Entity, Slot> equipment;
|
||||||
|
Location location;
|
||||||
|
Velocity velocity;
|
||||||
|
int yaw;
|
||||||
|
int pitch;
|
||||||
|
|
||||||
Location getLocation();
|
public Entity(int id, Location location, int yaw, int pitch, Velocity velocity) {
|
||||||
|
this.id = id;
|
||||||
|
this.location = location;
|
||||||
|
this.yaw = yaw;
|
||||||
|
this.pitch = pitch;
|
||||||
|
this.velocity = velocity;
|
||||||
|
this.equipment = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
void setLocation(Location location);
|
|
||||||
|
|
||||||
void setLocation(RelativeLocation location);
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
Velocity getVelocity();
|
public Location getLocation() {
|
||||||
|
return location;
|
||||||
void setVelocity(Velocity velocity);
|
}
|
||||||
|
|
||||||
int getYaw();
|
|
||||||
|
|
||||||
void setYaw(int yaw);
|
|
||||||
|
|
||||||
int getPitch();
|
|
||||||
|
|
||||||
void setPitch(int pitch);
|
|
||||||
|
|
||||||
float getWidth();
|
|
||||||
|
|
||||||
float getHeight();
|
|
||||||
|
|
||||||
<T extends EntityMetaData> EntityMetaData getMetaData();
|
|
||||||
|
|
||||||
void setMetaData(EntityMetaData data);
|
|
||||||
|
|
||||||
void setEquipment(Slots.Entity slot, Slot data);
|
|
||||||
|
|
||||||
Slot getEquipment(Slots.Entity slot);
|
|
||||||
|
|
||||||
|
public void setLocation(Location location) {
|
||||||
|
this.location = location;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(RelativeLocation relativeLocation) {
|
||||||
|
// change relative location
|
||||||
|
location = new Location(location.getX() + relativeLocation.getX(), location.getY() + relativeLocation.getY(), location.getZ() + relativeLocation.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Velocity getVelocity() {
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVelocity(Velocity velocity) {
|
||||||
|
this.velocity = velocity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getYaw() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYaw(int yaw) {
|
||||||
|
this.yaw = yaw;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPitch() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPitch(int pitch) {
|
||||||
|
this.pitch = pitch;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquipment(Slots.Entity slot, Slot data) {
|
||||||
|
equipment.put(slot, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Slot getEquipment(Slots.Entity slot) {
|
||||||
|
return equipment.get(slot);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Codename Minosoft
|
||||||
|
* Copyright (C) 2020 Moritz Zwerger
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.bixilon.minosoft.game.datatypes.entities;
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
|
||||||
|
|
||||||
|
public interface EntityInterface {
|
||||||
|
|
||||||
|
Mobs getEntityType();
|
||||||
|
|
||||||
|
EntityMetaData getMetaData();
|
||||||
|
|
||||||
|
void setMetaData(EntityMetaData metaData);
|
||||||
|
|
||||||
|
float getWidth();
|
||||||
|
|
||||||
|
float getHeight();
|
||||||
|
|
||||||
|
}
|
@ -13,14 +13,20 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.game.datatypes.entities;
|
package de.bixilon.minosoft.game.datatypes.entities;
|
||||||
|
|
||||||
public interface Mob extends Entity {
|
public abstract class Mob extends Entity implements MobInterface {
|
||||||
float getHealth();
|
int headYaw;
|
||||||
|
|
||||||
|
public Mob(int id, Location location, int yaw, int pitch, Velocity velocity) {
|
||||||
|
super(id, location, yaw, pitch, velocity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getHeadYaw() {
|
||||||
|
return headYaw;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeadYaw(int headYaw) {
|
||||||
|
this.headYaw = headYaw;
|
||||||
|
}
|
||||||
|
|
||||||
void setHealth(float health);
|
|
||||||
|
|
||||||
int getMaxHealth();
|
|
||||||
|
|
||||||
int getHeadYaw();
|
|
||||||
|
|
||||||
void setHeadYaw(int headYaw);
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Codename Minosoft
|
||||||
|
* Copyright (C) 2020 Moritz Zwerger
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.bixilon.minosoft.game.datatypes.entities;
|
||||||
|
|
||||||
|
public interface MobInterface extends EntityInterface {
|
||||||
|
int getMaxHealth();
|
||||||
|
}
|
@ -17,8 +17,8 @@ import de.bixilon.minosoft.game.datatypes.Identifier;
|
|||||||
|
|
||||||
public enum Mobs {
|
public enum Mobs {
|
||||||
ZOMBIE(new Identifier("zombie"), 54, Zombie.class),
|
ZOMBIE(new Identifier("zombie"), 54, Zombie.class),
|
||||||
PLAYER(null, 92, OtherPlayer.class);
|
PLAYER(null, 92, OtherPlayer.class),
|
||||||
// ToDo all mobs
|
CREEPER(new Identifier("creeper"), 50, Creeper.class);
|
||||||
|
|
||||||
final Identifier identifier;
|
final Identifier identifier;
|
||||||
final int type;
|
final int type;
|
||||||
|
@ -15,41 +15,26 @@ package de.bixilon.minosoft.game.datatypes.entities;
|
|||||||
|
|
||||||
|
|
||||||
import de.bixilon.minosoft.game.datatypes.PlayerPropertyData;
|
import de.bixilon.minosoft.game.datatypes.PlayerPropertyData;
|
||||||
import de.bixilon.minosoft.game.datatypes.Slot;
|
|
||||||
import de.bixilon.minosoft.game.datatypes.Slots;
|
|
||||||
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
|
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
|
||||||
import de.bixilon.minosoft.game.datatypes.entities.meta.HumanMetaData;
|
import de.bixilon.minosoft.game.datatypes.entities.meta.HumanMetaData;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class OtherPlayer implements Mob {
|
public class OtherPlayer extends Mob implements MobInterface {
|
||||||
final int id;
|
|
||||||
final String name;
|
final String name;
|
||||||
final UUID uuid;
|
final UUID uuid;
|
||||||
PlayerPropertyData[] properties;
|
PlayerPropertyData[] properties;
|
||||||
Location location;
|
|
||||||
Velocity velocity;
|
|
||||||
int yaw;
|
|
||||||
int pitch;
|
|
||||||
int headYaw;
|
|
||||||
short currentItem;
|
short currentItem;
|
||||||
HumanMetaData metaData;
|
HumanMetaData metaData;
|
||||||
float health;
|
|
||||||
Pose status = Pose.STANDING;
|
Pose status = Pose.STANDING;
|
||||||
final HashMap<Slots.Entity, Slot> equipment;
|
|
||||||
|
|
||||||
public OtherPlayer(int id, String name, UUID uuid, PlayerPropertyData[] properties, Location location, int yaw, int pitch, short currentItem, HumanMetaData metaData) {
|
public OtherPlayer(int id, String name, UUID uuid, PlayerPropertyData[] properties, Location location, Velocity velocity, int yaw, int pitch, short currentItem, HumanMetaData metaData) {
|
||||||
this.id = id;
|
super(id, location, yaw, pitch, velocity);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.location = location;
|
|
||||||
this.yaw = yaw;
|
|
||||||
this.pitch = pitch;
|
|
||||||
this.currentItem = currentItem;
|
this.currentItem = currentItem;
|
||||||
this.metaData = metaData;
|
this.metaData = metaData;
|
||||||
equipment = new HashMap<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -57,59 +42,6 @@ public class OtherPlayer implements Mob {
|
|||||||
return Mobs.PLAYER;
|
return Mobs.PLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Location getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLocation(Location location) {
|
|
||||||
this.location = location;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLocation(RelativeLocation relativeLocation) {
|
|
||||||
// change relative location
|
|
||||||
location = new Location(location.getX() + relativeLocation.getX(), location.getY() + relativeLocation.getY(), location.getZ() + relativeLocation.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Velocity getVelocity() {
|
|
||||||
return velocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVelocity(Velocity velocity) {
|
|
||||||
this.velocity = velocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getYaw() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setYaw(int yaw) {
|
|
||||||
this.yaw = yaw;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPitch() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPitch(int pitch) {
|
|
||||||
this.pitch = pitch;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWidth() {
|
public float getWidth() {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -148,19 +80,10 @@ public class OtherPlayer implements Mob {
|
|||||||
this.metaData = (HumanMetaData) data;
|
this.metaData = (HumanMetaData) data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getHealth() {
|
|
||||||
return health;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHealth(float health) {
|
|
||||||
this.health = health;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxHealth() {
|
public int getMaxHealth() {
|
||||||
return 40;
|
return 40;
|
||||||
|
//ToDo
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@ -179,28 +102,8 @@ public class OtherPlayer implements Mob {
|
|||||||
return currentItem;
|
return currentItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeadYaw() {
|
|
||||||
return headYaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeadYaw(int headYaw) {
|
|
||||||
this.headYaw = headYaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Pose getStatus() {
|
public Pose getStatus() {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setEquipment(Slots.Entity slot, Slot data) {
|
|
||||||
equipment.put(slot, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Slot getEquipment(Slots.Entity slot) {
|
|
||||||
return equipment.get(slot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,34 +13,22 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.game.datatypes.entities;
|
package de.bixilon.minosoft.game.datatypes.entities;
|
||||||
|
|
||||||
import de.bixilon.minosoft.game.datatypes.Slot;
|
|
||||||
import de.bixilon.minosoft.game.datatypes.Slots;
|
|
||||||
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
|
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
|
||||||
import de.bixilon.minosoft.game.datatypes.entities.meta.ZombieMetaData;
|
import de.bixilon.minosoft.game.datatypes.entities.meta.ZombieMetaData;
|
||||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||||
|
|
||||||
import java.util.HashMap;
|
public class Zombie extends Mob implements MobInterface {
|
||||||
|
|
||||||
public class Zombie implements Mob {
|
|
||||||
final int id;
|
|
||||||
Location location;
|
|
||||||
Velocity velocity;
|
|
||||||
int yaw;
|
|
||||||
int pitch;
|
|
||||||
int headYaw;
|
|
||||||
ZombieMetaData metaData;
|
ZombieMetaData metaData;
|
||||||
float health;
|
|
||||||
final HashMap<Slots.Entity, Slot> equipment;
|
|
||||||
|
|
||||||
public Zombie(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) {
|
public Zombie(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) {
|
||||||
this.id = id;
|
super(id, location, yaw, pitch, velocity);
|
||||||
this.location = location;
|
|
||||||
this.yaw = yaw;
|
|
||||||
this.pitch = pitch;
|
|
||||||
this.velocity = velocity;
|
|
||||||
this.metaData = new ZombieMetaData(buffer, v);
|
this.metaData = new ZombieMetaData(buffer, v);
|
||||||
this.equipment = new HashMap<>();
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxHealth() {
|
||||||
|
return 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,57 +36,14 @@ public class Zombie implements Mob {
|
|||||||
return Mobs.ZOMBIE;
|
return Mobs.ZOMBIE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId() {
|
@Override
|
||||||
return id;
|
public EntityMetaData getMetaData() {
|
||||||
|
return metaData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getLocation() {
|
public void setMetaData(EntityMetaData metaData) {
|
||||||
return location;
|
this.metaData = (ZombieMetaData) metaData;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLocation(Location location) {
|
|
||||||
this.location = location;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setLocation(RelativeLocation relativeLocation) {
|
|
||||||
// change relative location
|
|
||||||
location = new Location(location.getX() + relativeLocation.getX(), location.getY() + relativeLocation.getY(), location.getZ() + relativeLocation.getZ());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Velocity getVelocity() {
|
|
||||||
return velocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setVelocity(Velocity velocity) {
|
|
||||||
this.velocity = velocity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getYaw() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setYaw(int yaw) {
|
|
||||||
this.yaw = yaw;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPitch() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPitch(int pitch) {
|
|
||||||
this.pitch = pitch;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -108,51 +53,6 @@ public class Zombie implements Mob {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getHeight() {
|
public float getHeight() {
|
||||||
return 1.95F;
|
return 1.8F;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ZombieMetaData getMetaData() {
|
|
||||||
return metaData;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMetaData(EntityMetaData data) {
|
|
||||||
this.metaData = (ZombieMetaData) data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setEquipment(Slots.Entity slot, Slot data) {
|
|
||||||
equipment.put(slot, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Slot getEquipment(Slots.Entity slot) {
|
|
||||||
return equipment.get(slot);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float getHealth() {
|
|
||||||
return health;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHealth(float health) {
|
|
||||||
this.health = health;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxHealth() {
|
|
||||||
return 40;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHeadYaw() {
|
|
||||||
return headYaw;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setHeadYaw(int headYaw) {
|
|
||||||
this.headYaw = headYaw;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class PacketSpawnPlayer implements ClientboundPacket {
|
|||||||
short currentItem = buffer.readShort();
|
short currentItem = buffer.readShort();
|
||||||
HumanMetaData metaData = new HumanMetaData(buffer, v);
|
HumanMetaData metaData = new HumanMetaData(buffer, v);
|
||||||
|
|
||||||
this.player = new OtherPlayer(entityId, name, uuid, properties, location, yaw, pitch, currentItem, metaData);
|
this.player = new OtherPlayer(entityId, name, uuid, properties, location, null, yaw, pitch, currentItem, metaData);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user