diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Bat.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Bat.java new file mode 100644 index 000000000..359fdbee7 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Bat.java @@ -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 . + * + * 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.BatMetaData; +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 Bat extends Mob implements MobInterface { + BatMetaData metaData; + + public Bat(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new BatMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.BAT; + } + + @Override + public BatMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (BatMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.5F; + } + + @Override + public float getHeight() { + return 0.9F; + } + + @Override + public int getMaxHealth() { + return 6; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Blaze.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Blaze.java new file mode 100644 index 000000000..cd5c269fe --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Blaze.java @@ -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 . + * + * 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.BlazeMetaData; +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 Blaze extends Mob implements MobInterface { + BlazeMetaData metaData; + + public Blaze(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new BlazeMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.BLAZE; + } + + @Override + public BlazeMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (BlazeMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.6F; + } + + @Override + public float getHeight() { + return 1.8F; + } + + @Override + public int getMaxHealth() { + return 20; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/CaveSpider.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/CaveSpider.java new file mode 100644 index 000000000..f0fbb6a89 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/CaveSpider.java @@ -0,0 +1,44 @@ +/* + * 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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.game.datatypes.entities; + +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class CaveSpider extends Spider { + public CaveSpider(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity, buffer, v); + } + + + @Override + public Mobs getEntityType() { + return Mobs.CAVE_SPIDER; + } + + @Override + public float getWidth() { + return 0.7F; + } + + @Override + public float getHeight() { + return 0.5F; + } + + @Override + public int getMaxHealth() { + return 12; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Chicken.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Chicken.java new file mode 100644 index 000000000..c58abc2d9 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Chicken.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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.AgeableMetaData; +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 Chicken extends Mob implements MobInterface { + AgeableMetaData metaData; + + public Chicken(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new AgeableMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.CHICKEN; + } + + @Override + public AgeableMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (AgeableMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 0.4F; + } + return 0.2F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 0.7F; + } + return 0.35F; + } + + @Override + public int getMaxHealth() { + return 4; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Cow.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Cow.java new file mode 100644 index 000000000..6292f3ae5 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Cow.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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.AgeableMetaData; +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 Cow extends Mob implements MobInterface { + AgeableMetaData metaData; + + public Cow(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new AgeableMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.COW; + } + + @Override + public AgeableMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (AgeableMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 1.4F; + } + return 0.7F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 0.7F; + } + return 0.45F; + } + + @Override + public int getMaxHealth() { + return 10; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Creeper.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Creeper.java index 193f14758..b1ccd9e3f 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Creeper.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Creeper.java @@ -32,7 +32,7 @@ public class Creeper extends Mob implements MobInterface { } @Override - public EntityMetaData getMetaData() { + public CreeperMetaData getMetaData() { return metaData; } @@ -53,6 +53,6 @@ public class Creeper extends Mob implements MobInterface { @Override public int getMaxHealth() { - return 40; + return 20; } } diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EnderDragon.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EnderDragon.java new file mode 100644 index 000000000..9a73a62d2 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EnderDragon.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.MobMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class EnderDragon extends Mob implements MobInterface { + MobMetaData metaData; + + public EnderDragon(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new MobMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.ENDER_DRAGON; + } + + @Override + public MobMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (MobMetaData) metaData; + } + + @Override + public float getWidth() { + return 16.0F; + } + + @Override + public float getHeight() { + return 8.0F; + } + + @Override + public int getMaxHealth() { + return 200; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EnderMan.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EnderMan.java new file mode 100644 index 000000000..5077b9fa6 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EnderMan.java @@ -0,0 +1,62 @@ +/* + * 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 . + * + * 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.EndermanMetaData; +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 EnderMan extends Mob implements MobInterface { + EndermanMetaData metaData; + + public EnderMan(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new EndermanMetaData(buffer, v); + } + + + @Override + public Mobs getEntityType() { + return Mobs.ENDERMAN; + } + + @Override + public EndermanMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (EndermanMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.6F; + } + + @Override + public float getHeight() { + if (metaData.isScreaming()) { + return 3.25F; + } + return 2.9F; + } + + @Override + public int getMaxHealth() { + return 40; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Ghast.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Ghast.java new file mode 100644 index 000000000..921fbef6f --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Ghast.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.GhastMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Ghast extends Mob implements MobInterface { + GhastMetaData metaData; + + public Ghast(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new GhastMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.GHAST; + } + + @Override + public GhastMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (GhastMetaData) metaData; + } + + @Override + public float getWidth() { + return 4.0F; + } + + @Override + public float getHeight() { + return 4.0F; + } + + @Override + public int getMaxHealth() { + return 10; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/GiantZombie.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/GiantZombie.java new file mode 100644 index 000000000..0bce82f7a --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/GiantZombie.java @@ -0,0 +1,43 @@ +/* + * 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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.game.datatypes.entities; + +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class GiantZombie extends Zombie { + public GiantZombie(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity, buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.GIANT_ZOMBIE; + } + + @Override + public float getWidth() { + return 3.6F; + } + + @Override + public float getHeight() { + return 10.8F; + } + + @Override + public int getMaxHealth() { + return 100; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Horse.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Horse.java new file mode 100644 index 000000000..bb2aebafc --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Horse.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.HorseMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Horse extends Mob implements MobInterface { + HorseMetaData metaData; + + public Horse(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new HorseMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.HORSE; + } + + @Override + public HorseMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (HorseMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 1.3965F; + } + return 0.6982F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 1.6F; + } + return 0.8F; + } + + @Override + public int getMaxHealth() { + return 100; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/IronGolem.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/IronGolem.java new file mode 100644 index 000000000..e6c5257aa --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/IronGolem.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.MobMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class IronGolem extends Mob implements MobInterface { + MobMetaData metaData; + + public IronGolem(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new MobMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.IRON_GOLEM; + } + + @Override + public MobMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (MobMetaData) metaData; + } + + @Override + public float getWidth() { + return 1.4F; + } + + @Override + public float getHeight() { + return 2.7F; + } + + @Override + public int getMaxHealth() { + return 100; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/MagmaCube.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/MagmaCube.java new file mode 100644 index 000000000..d5f2410a8 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/MagmaCube.java @@ -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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.game.datatypes.entities; + +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class MagmaCube extends Slime { + + public MagmaCube(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity, buffer, v); + } + + + @Override + public Mobs getEntityType() { + return Mobs.MAGMA_CUBE; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Mobs.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Mobs.java index 60ab2b5db..3fe171198 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Mobs.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Mobs.java @@ -16,9 +16,36 @@ package de.bixilon.minosoft.game.datatypes.entities; import de.bixilon.minosoft.game.datatypes.Identifier; public enum Mobs { - ZOMBIE(new Identifier("zombie"), 54, Zombie.class), PLAYER(null, 92, OtherPlayer.class), - CREEPER(new Identifier("creeper"), 50, Creeper.class); + CREEPER(new Identifier("creeper"), 50, Creeper.class), + SKELETON(new Identifier("skeleton"), 51, Skeleton.class), + SPIDER(new Identifier("spider"), 52, Spider.class), + GIANT_ZOMBIE(new Identifier("giant"), 53, GiantZombie.class), + ZOMBIE(new Identifier("zombie"), 54, Zombie.class), + SLIME(new Identifier("slime"), 55, Slime.class), + GHAST(new Identifier("ghast"), 56, Ghast.class), + ZOMBIE_PIGMAN(new Identifier("zombie_pigman"), 57, ZombiePigman.class), + ENDERMAN(new Identifier("enderman"), 58, EnderMan.class), + CAVE_SPIDER(new Identifier("cave_spider"), 59, CaveSpider.class), + SILVERFISH(new Identifier("silverfish"), 60, Silverfish.class), + BLAZE(new Identifier("blaze"), 61, Blaze.class), + MAGMA_CUBE(new Identifier("magma_cube"), 62, MagmaCube.class), + ENDER_DRAGON(new Identifier("ender_dragon"), 63, EnderDragon.class), + WITHER(new Identifier("wither"), 64, Wither.class), + BAT(new Identifier("bat"), 65, Bat.class), + WITCH(new Identifier("witch"), 66, Witch.class), + PIG(new Identifier("pig"), 90, Pig.class), + SHEEP(new Identifier("sheep"), 91, Sheep.class), + COW(new Identifier("cow"), 92, Cow.class), + CHICKEN(new Identifier("chicken"), 93, Chicken.class), + SQUID(new Identifier("squid"), 94, Squid.class), + WOLF(new Identifier("wolf"), 95, Wolf.class), + MOOSHROOM(new Identifier("mooshroom"), 95, Mooshroom.class), + SNOW_GOLEM(new Identifier("snow_golem"), 97, SnowGolem.class), + OCELOT(new Identifier("ocelot"), 98, Ocelot.class), + IRON_GOLEM(new Identifier("iron_golem"), 99, IronGolem.class), + HORSE(new Identifier("horse"), 100, Horse.class), + VILLAGER(new Identifier("villager"), 120, Villager.class); final Identifier identifier; final int type; diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Mooshroom.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Mooshroom.java new file mode 100644 index 000000000..0d1a7cd1e --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Mooshroom.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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.AgeableMetaData; +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 Mooshroom extends Mob implements MobInterface { + AgeableMetaData metaData; + + public Mooshroom(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new AgeableMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.MOOSHROOM; + } + + @Override + public AgeableMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (AgeableMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 0.9F; + } + return 0.45F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 1.4F; + } + return 0.7F; + } + + @Override + public int getMaxHealth() { + return 10; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Ocelot.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Ocelot.java new file mode 100644 index 000000000..b26b4482e --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Ocelot.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.OcelotMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Ocelot extends Mob implements MobInterface { + OcelotMetaData metaData; + + public Ocelot(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new OcelotMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.OCELOT; + } + + @Override + public OcelotMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (OcelotMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 0.6F; + } + return 0.45F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 0.7F; + } + return 0.35F; + } + + @Override + public int getMaxHealth() { + return 10; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Pig.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Pig.java new file mode 100644 index 000000000..3a6ac373e --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Pig.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.PigMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Pig extends Mob implements MobInterface { + PigMetaData metaData; + + public Pig(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new PigMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.PIG; + } + + @Override + public PigMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (PigMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 0.9F; + } + return 0.45F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 0.9F; + } + return 0.45F; + } + + @Override + public int getMaxHealth() { + return 10; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Sheep.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Sheep.java new file mode 100644 index 000000000..8539fd8d4 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Sheep.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.SheepMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Sheep extends Mob implements MobInterface { + SheepMetaData metaData; + + public Sheep(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new SheepMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.SHEEP; + } + + @Override + public SheepMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (SheepMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 1.3F; + } + return 0.65F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 0.9F; + } + return 0.45F; + } + + @Override + public int getMaxHealth() { + return 8; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Silverfish.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Silverfish.java new file mode 100644 index 000000000..014e22b5e --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Silverfish.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.MobMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Silverfish extends Mob implements MobInterface { + MobMetaData metaData; + + public Silverfish(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new MobMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.SILVERFISH; + } + + @Override + public MobMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (MobMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.4F; + } + + @Override + public float getHeight() { + return 0.3F; + } + + @Override + public int getMaxHealth() { + return 8; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Skeleton.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Skeleton.java new file mode 100644 index 000000000..14ff12439 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Skeleton.java @@ -0,0 +1,64 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.SkeletonMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Skeleton extends Mob implements MobInterface { + SkeletonMetaData metaData; + + public Skeleton(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new SkeletonMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.SKELETON; + } + + @Override + public SkeletonMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (SkeletonMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isWitherSkeleton()) { + return 0.7F; + } + return 0.6F; + } + + @Override + public float getHeight() { + if (metaData.isWitherSkeleton()) { + return 2.4F; + } + return 1.99F; + } + + @Override + public int getMaxHealth() { + return 20; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Slime.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Slime.java new file mode 100644 index 000000000..2bd20dd92 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Slime.java @@ -0,0 +1,67 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.SlimeMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Slime extends Mob implements MobInterface { + SlimeMetaData metaData; + + public Slime(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new SlimeMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.SLIME; + } + + @Override + public SlimeMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (SlimeMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.6F * metaData.getSize(); + } + + @Override + public float getHeight() { + return 0.6F * metaData.getSize(); + } + + @Override + public int getMaxHealth() { + switch (metaData.getSize()) { + case 1: + return 1; + case 2: + return 4; + case 4: + return 16; + + } + return 0; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/SnowGolem.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/SnowGolem.java new file mode 100644 index 000000000..327e87f46 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/SnowGolem.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.MobMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class SnowGolem extends Mob implements MobInterface { + MobMetaData metaData; + + public SnowGolem(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new MobMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.SNOW_GOLEM; + } + + @Override + public MobMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (MobMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.7F; + } + + @Override + public float getHeight() { + return 1.9F; + } + + @Override + public int getMaxHealth() { + return 4; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Spider.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Spider.java new file mode 100644 index 000000000..e67b4c796 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Spider.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.SpiderMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Spider extends Mob implements MobInterface { + SpiderMetaData metaData; + + public Spider(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new SpiderMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.SPIDER; + } + + @Override + public SpiderMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (SpiderMetaData) metaData; + } + + @Override + public float getWidth() { + return 1.4F; + } + + @Override + public float getHeight() { + return 0.9F; + } + + @Override + public int getMaxHealth() { + return 16; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Squid.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Squid.java new file mode 100644 index 000000000..ac51ee17e --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Squid.java @@ -0,0 +1,65 @@ +/* + * 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 . + * + * 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.AgeableMetaData; +import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData; +import de.bixilon.minosoft.game.datatypes.entities.meta.MobMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Squid extends Mob implements MobInterface { + AgeableMetaData metaData; + + public Squid(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new AgeableMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.SQUID; + } + + @Override + public MobMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (AgeableMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 0.8F; + } + return 0.4F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 0.8F; + } + return 0.4F; + } + + @Override + public int getMaxHealth() { + return 4; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Villager.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Villager.java new file mode 100644 index 000000000..823b389de --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Villager.java @@ -0,0 +1,65 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.VillagerMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Villager extends Mob implements MobInterface { + VillagerMetaData metaData; + + public Villager(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new VillagerMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.VILLAGER; + } + + @Override + public VillagerMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (VillagerMetaData) metaData; + } + + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 0.6F; + } + return 0.3F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 1.95F; + } + return 0.975F; + } + + @Override + public int getMaxHealth() { + return 100; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Witch.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Witch.java new file mode 100644 index 000000000..2daf10471 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Witch.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.WitchMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Witch extends Mob implements MobInterface { + WitchMetaData metaData; + + public Witch(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new WitchMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.WITCH; + } + + @Override + public WitchMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (WitchMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.6F; + } + + @Override + public float getHeight() { + return 1.95F; + } + + @Override + public int getMaxHealth() { + return 26; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Wither.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Wither.java new file mode 100644 index 000000000..2a6b317e0 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Wither.java @@ -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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.WitherMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Wither extends Mob implements MobInterface { + WitherMetaData metaData; + + public Wither(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new WitherMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.WITHER; + } + + @Override + public WitherMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (WitherMetaData) metaData; + } + + @Override + public float getWidth() { + return 0.9F; + } + + @Override + public float getHeight() { + return 4.0F; + } + + @Override + public int getMaxHealth() { + return 300; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Wolf.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Wolf.java new file mode 100644 index 000000000..51c40ad92 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Wolf.java @@ -0,0 +1,67 @@ +/* + * 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 . + * + * 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; +import de.bixilon.minosoft.game.datatypes.entities.meta.WolfMetaData; +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class Wolf extends Mob implements MobInterface { + WolfMetaData metaData; + + public Wolf(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity); + this.metaData = new WolfMetaData(buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.WOLF; + } + + @Override + public WolfMetaData getMetaData() { + return metaData; + } + + @Override + public void setMetaData(EntityMetaData metaData) { + this.metaData = (WolfMetaData) metaData; + } + + @Override + public float getWidth() { + if (metaData.isAdult()) { + return 0.6F; + } + return 0.3F; + } + + @Override + public float getHeight() { + if (metaData.isAdult()) { + return 0.85F; + } + return 0.425F; + } + + @Override + public int getMaxHealth() { + if (metaData.isTame()) { + return 8; + } + return 20; + } +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Zombie.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Zombie.java index 11ee0f0a7..acf377c52 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Zombie.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Zombie.java @@ -26,10 +26,6 @@ public class Zombie extends Mob implements MobInterface { this.metaData = new ZombieMetaData(buffer, v); } - @Override - public int getMaxHealth() { - return 40; - } @Override public Mobs getEntityType() { @@ -37,7 +33,7 @@ public class Zombie extends Mob implements MobInterface { } @Override - public EntityMetaData getMetaData() { + public ZombieMetaData getMetaData() { return metaData; } @@ -55,4 +51,9 @@ public class Zombie extends Mob implements MobInterface { public float getHeight() { return 1.8F; } + + @Override + public int getMaxHealth() { + return 20; + } } diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/ZombiePigman.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/ZombiePigman.java new file mode 100644 index 000000000..1620681ac --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/ZombiePigman.java @@ -0,0 +1,46 @@ +/* + * 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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.game.datatypes.entities; + +import de.bixilon.minosoft.protocol.protocol.InByteBuffer; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class ZombiePigman extends Zombie { + + public ZombiePigman(int id, Location location, int yaw, int pitch, Velocity velocity, InByteBuffer buffer, ProtocolVersion v) { + super(id, location, yaw, pitch, velocity, buffer, v); + } + + @Override + public Mobs getEntityType() { + return Mobs.ZOMBIE_PIGMAN; + } + + @Override + public float getWidth() { + if (metaData.isChild()) { + return 0.3F; + } + return 0.6F; + } + + @Override + public float getHeight() { + if (metaData.isChild()) { + return 0.975F; + } + return 1.95F; + } + +} diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/AgeableMetaData.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/AgeableMetaData.java index 46b1fb7f2..c81223639 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/AgeableMetaData.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/AgeableMetaData.java @@ -31,5 +31,9 @@ public class AgeableMetaData extends MobMetaData { return 0; } + public boolean isAdult() { + return getAge() >= 0; + } + } diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/OcelotMetaData.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/OcelotMetaData.java index 70b1c55a6..2d38b90b6 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/OcelotMetaData.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/OcelotMetaData.java @@ -16,7 +16,7 @@ package de.bixilon.minosoft.game.datatypes.entities.meta; import de.bixilon.minosoft.protocol.protocol.InByteBuffer; import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; -public class OcelotMetaData extends TamableMetaData { +public class OcelotMetaData extends TameableMetaData { public OcelotMetaData(InByteBuffer buffer, ProtocolVersion v) { super(buffer, v); diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/TamableMetaData.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/TameableMetaData.java similarity index 92% rename from src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/TamableMetaData.java rename to src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/TameableMetaData.java index 06b1bf16b..dace491c5 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/TamableMetaData.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/TameableMetaData.java @@ -17,9 +17,9 @@ import de.bixilon.minosoft.protocol.protocol.InByteBuffer; import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; import de.bixilon.minosoft.util.BitByte; -public class TamableMetaData extends MobMetaData { +public class TameableMetaData extends AgeableMetaData { - public TamableMetaData(InByteBuffer buffer, ProtocolVersion v) { + public TameableMetaData(InByteBuffer buffer, ProtocolVersion v) { super(buffer, v); } diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/WolfMetaData.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/WolfMetaData.java index fbea537db..ea47327c3 100644 --- a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/WolfMetaData.java +++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/meta/WolfMetaData.java @@ -18,7 +18,7 @@ import de.bixilon.minosoft.protocol.protocol.InByteBuffer; import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; import de.bixilon.minosoft.util.BitByte; -public class WolfMetaData extends TamableMetaData { +public class WolfMetaData extends TameableMetaData { public WolfMetaData(InByteBuffer buffer, ProtocolVersion v) { super(buffer, v);