All 1.16 entities + metadata

This commit is contained in:
Bixilon 2020-07-30 23:53:16 +02:00
parent cef8cfefc1
commit 42b4ce3d81
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
13 changed files with 560 additions and 3 deletions

View File

@ -0,0 +1,36 @@
/*
* 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.meta;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class BasePiglinMetaData extends MonsterMetaData {
public BasePiglinMetaData(MetaDataHashMap sets, ProtocolVersion version) {
super(sets, version);
}
public boolean isImmuneToZombification() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 1, defaultValue);
}
@Override
protected int getLastDataIndex() {
return super.getLastDataIndex() + 1;
}
}

View File

@ -0,0 +1,36 @@
/*
* 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.meta;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class HoglinMetaData extends AnimalMetaData {
public HoglinMetaData(MetaDataHashMap sets, ProtocolVersion version) {
super(sets, version);
}
public boolean isImmuneToZombification() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 1, defaultValue);
}
@Override
protected int getLastDataIndex() {
return super.getLastDataIndex() + 1;
}
}

View File

@ -0,0 +1,22 @@
/*
* 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.meta;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class PiglinBruteMetaData extends BasePiglinMetaData {
public PiglinBruteMetaData(MetaDataHashMap sets, ProtocolVersion version) {
super(sets, version);
}
}

View File

@ -0,0 +1,53 @@
/*
* 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.meta;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class PiglinMetaData extends BasePiglinMetaData {
public PiglinMetaData(MetaDataHashMap sets, ProtocolVersion version) {
super(sets, version);
}
public boolean isBaby() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 1, defaultValue);
}
public boolean isChargingCrossbow() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 2, defaultValue);
}
public boolean isDancing() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 3, defaultValue);
}
@Override
protected int getLastDataIndex() {
return super.getLastDataIndex() + 3;
}
}

View File

@ -0,0 +1,52 @@
/*
* 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.meta;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class StriderMetaData extends AnimalMetaData {
public StriderMetaData(MetaDataHashMap sets, ProtocolVersion version) {
super(sets, version);
}
public int getTotalTimeToBoost() {
final int defaultValue = 0;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getInt(super.getLastDataIndex() + 1, defaultValue);
}
public boolean isShaking() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 2, defaultValue);
}
public boolean hasSaddle() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 3, defaultValue);
}
@Override
protected int getLastDataIndex() {
return super.getLastDataIndex() + 3;
}
}

View File

@ -0,0 +1,36 @@
/*
* 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.meta;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class ZoglinMetaData extends MonsterMetaData {
public ZoglinMetaData(MetaDataHashMap sets, ProtocolVersion version) {
super(sets, version);
}
public boolean isBaby() {
final boolean defaultValue = false;
if (version.getVersionNumber() < ProtocolVersion.VERSION_1_16_2.getVersionNumber()) {
return defaultValue;
}
return sets.getBoolean(super.getLastDataIndex() + 1, defaultValue);
}
@Override
protected int getLastDataIndex() {
return super.getLastDataIndex() + 1;
}
}

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.mob;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.Mob;
import de.bixilon.minosoft.game.datatypes.entities.MobInterface;
import de.bixilon.minosoft.game.datatypes.entities.Velocity;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.game.datatypes.entities.meta.HoglinMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class Hoglin extends Mob implements MobInterface {
HoglinMetaData metaData;
public Hoglin(int entityId, Location location, short yaw, short pitch, Velocity velocity, EntityMetaData.MetaDataHashMap sets, ProtocolVersion version) {
super(entityId, location, yaw, pitch, velocity);
this.metaData = new HoglinMetaData(sets, version);
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = (HoglinMetaData) metaData;
}
@Override
public float getWidth() {
if (metaData.isAdult()) {
return 1.3965F;
}
return 0.45F;
}
@Override
public float getHeight() {
if (metaData.isAdult()) {
return 1.4F;
}
return 0.45F;
}
@Override
public int getMaxHealth() {
return 40;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return HoglinMetaData.class;
}
}

View File

@ -0,0 +1,61 @@
/*
* 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.mob;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.Mob;
import de.bixilon.minosoft.game.datatypes.entities.MobInterface;
import de.bixilon.minosoft.game.datatypes.entities.Velocity;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.game.datatypes.entities.meta.PiglinMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class Piglin extends Mob implements MobInterface {
PiglinMetaData metaData;
public Piglin(int entityId, Location location, short yaw, short pitch, Velocity velocity, EntityMetaData.MetaDataHashMap sets, ProtocolVersion version) {
super(entityId, location, yaw, pitch, velocity);
this.metaData = new PiglinMetaData(sets, version);
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = (PiglinMetaData) metaData;
}
@Override
public float getWidth() {
return 0.6F;
}
@Override
public float getHeight() {
return 1.95F;
}
@Override
public int getMaxHealth() {
return 16;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return PiglinMetaData.class;
}
}

View File

@ -0,0 +1,61 @@
/*
* 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.mob;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.Mob;
import de.bixilon.minosoft.game.datatypes.entities.MobInterface;
import de.bixilon.minosoft.game.datatypes.entities.Velocity;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.game.datatypes.entities.meta.PiglinBruteMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class PiglinBrute extends Mob implements MobInterface {
PiglinBruteMetaData metaData;
public PiglinBrute(int entityId, Location location, short yaw, short pitch, Velocity velocity, EntityMetaData.MetaDataHashMap sets, ProtocolVersion version) {
super(entityId, location, yaw, pitch, velocity);
this.metaData = new PiglinBruteMetaData(sets, version);
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = (PiglinBruteMetaData) metaData;
}
@Override
public float getWidth() {
return 0.6F; // ToDo
}
@Override
public float getHeight() {
return 1.95F; // ToDo
}
@Override
public int getMaxHealth() {
return 50;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return PiglinBruteMetaData.class;
}
}

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.mob;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.Mob;
import de.bixilon.minosoft.game.datatypes.entities.MobInterface;
import de.bixilon.minosoft.game.datatypes.entities.Velocity;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.game.datatypes.entities.meta.StriderMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class Strider extends Mob implements MobInterface {
StriderMetaData metaData;
public Strider(int entityId, Location location, short yaw, short pitch, Velocity velocity, EntityMetaData.MetaDataHashMap sets, ProtocolVersion version) {
super(entityId, location, yaw, pitch, velocity);
this.metaData = new StriderMetaData(sets, version);
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = (StriderMetaData) metaData;
}
@Override
public float getWidth() {
if (metaData.isAdult()) {
return 0.9F;
}
return 0.45F;
}
@Override
public float getHeight() {
if (metaData.isAdult()) {
return 1.7F;
}
return 0.85F;
}
@Override
public int getMaxHealth() {
return 20;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return StriderMetaData.class;
}
}

View File

@ -0,0 +1,61 @@
/*
* 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.mob;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.Mob;
import de.bixilon.minosoft.game.datatypes.entities.MobInterface;
import de.bixilon.minosoft.game.datatypes.entities.Velocity;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.game.datatypes.entities.meta.ZoglinMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class Zoglin extends Mob implements MobInterface {
ZoglinMetaData metaData;
public Zoglin(int entityId, Location location, short yaw, short pitch, Velocity velocity, EntityMetaData.MetaDataHashMap sets, ProtocolVersion version) {
super(entityId, location, yaw, pitch, velocity);
this.metaData = new ZoglinMetaData(sets, version);
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = (ZoglinMetaData) metaData;
}
@Override
public float getWidth() {
return 1.3965F;
}
@Override
public float getHeight() {
return 1.4F;
}
@Override
public int getMaxHealth() {
return 40;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return ZoglinMetaData.class;
}
}

View File

@ -18,9 +18,9 @@ import de.bixilon.minosoft.game.datatypes.entities.Velocity;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class ZombiePigman extends Zombie {
public class ZombifiedPiglin extends Zombie {
public ZombiePigman(int entityId, Location location, short yaw, short pitch, Velocity velocity, EntityMetaData.MetaDataHashMap sets, ProtocolVersion version) {
public ZombifiedPiglin(int entityId, Location location, short yaw, short pitch, Velocity velocity, EntityMetaData.MetaDataHashMap sets, ProtocolVersion version) {
super(entityId, location, yaw, pitch, velocity, sets, version);
}

View File

@ -76,7 +76,7 @@ public class Entities {
registerEntityClass("minecraft:zombie", Zombie.class);
registerEntityClass("minecraft:slime", Slime.class);
registerEntityClass("minecraft:ghast", Ghast.class);
registerEntityClass("minecraft:zombified_piglin", ZombiePigman.class);
registerEntityClass("minecraft:zombified_piglin", ZombifiedPiglin.class);
registerEntityClass("minecraft:enderman", Enderman.class);
registerEntityClass("minecraft:cave_spider", CaveSpider.class);
registerEntityClass("minecraft:silverfish", Silverfish.class);
@ -130,6 +130,11 @@ public class Entities {
registerEntityClass("minecraft:pillager", Pillager.class);
registerEntityClass("minecraft:ravager", Ravager.class);
registerEntityClass("minecraft:bee", Bee.class);
registerEntityClass("minecraft:strider", Strider.class);
registerEntityClass("minecraft:hoglin", Hoglin.class);
registerEntityClass("minecraft:zoglin", Zoglin.class);
registerEntityClass("minecraft:piglin", Piglin.class);
registerEntityClass("minecraft:piglin_brute", PiglinBrute.class);
// not a thing anymore
registerEntityClass("minecraft:falling_dragon_Egg", FallingDragonEgg.class);