add all mobs, fix in meta data

This commit is contained in:
bixilon 2020-06-11 02:43:19 +02:00
parent 8a01fc2b5a
commit fa3f6ca61a
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
34 changed files with 1626 additions and 13 deletions

View File

@ -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.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;
}
}

View File

@ -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.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;
}
}

View File

@ -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 <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.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;
}
}

View File

@ -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 <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.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;
}
}

View File

@ -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 <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.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;
}
}

View File

@ -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;
}
}

View File

@ -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.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;
}
}

View File

@ -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 <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.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;
}
}

View File

@ -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.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;
}
}

View File

@ -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 <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.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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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.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;
}
}

View File

@ -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.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;
}
}

View File

@ -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;

View File

@ -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 <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.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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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.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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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.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;
}
}

View File

@ -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.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;
}
}

View File

@ -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 <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.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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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.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;
}
}

View File

@ -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.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;
}
}

View File

@ -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 <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;
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;
}
}

View File

@ -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;
}
}

View File

@ -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 <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.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;
}
}

View File

@ -31,5 +31,9 @@ public class AgeableMetaData extends MobMetaData {
return 0;
}
public boolean isAdult() {
return getAge() >= 0;
}
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);