mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 02:15:34 -04:00
all entity meta data (1.13)
This commit is contained in:
parent
be2d3443b9
commit
f52c049729
@ -34,6 +34,8 @@ public class AbstractHorseMetaData extends AgeableMetaData {
|
||||
return BitByte.isBitMask((int) sets.get(12).getData(), 0x02);
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x02);
|
||||
}
|
||||
return false;
|
||||
@ -48,6 +50,8 @@ public class AbstractHorseMetaData extends AgeableMetaData {
|
||||
return BitByte.isBitMask((int) sets.get(12).getData(), 0x04);
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x04);
|
||||
}
|
||||
return false;
|
||||
@ -64,6 +68,7 @@ public class AbstractHorseMetaData extends AgeableMetaData {
|
||||
case VERSION_1_11_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x10);
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x08);
|
||||
}
|
||||
return false;
|
||||
@ -80,6 +85,7 @@ public class AbstractHorseMetaData extends AgeableMetaData {
|
||||
case VERSION_1_11_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x20);
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x10);
|
||||
}
|
||||
return false;
|
||||
@ -96,6 +102,7 @@ public class AbstractHorseMetaData extends AgeableMetaData {
|
||||
case VERSION_1_11_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x40);
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x20);
|
||||
}
|
||||
return false;
|
||||
@ -112,6 +119,7 @@ public class AbstractHorseMetaData extends AgeableMetaData {
|
||||
case VERSION_1_11_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x80);
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x40);
|
||||
}
|
||||
return false;
|
||||
@ -147,6 +155,7 @@ public class AbstractHorseMetaData extends AgeableMetaData {
|
||||
return (UUID) sets.get(16).getData();
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (UUID) sets.get(14).getData();
|
||||
}
|
||||
return null;
|
||||
|
@ -26,6 +26,7 @@ public class AbstractIllagerMetaData extends MobMetaData {
|
||||
public boolean hasTarget() {
|
||||
switch (version) {
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
|
@ -43,6 +43,7 @@ public class AgeableMetaData extends InsentientMetaData {
|
||||
return (boolean) sets.get(12).getData();
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return !(boolean) sets.get(12).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -17,7 +17,7 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AreaEffectCloudMetaData extends MobMetaData {
|
||||
public class AreaEffectCloudMetaData extends EntityMetaData {
|
||||
|
||||
public AreaEffectCloudMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
@ -31,6 +31,7 @@ public class AreaEffectCloudMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (float) sets.get(6).getData();
|
||||
}
|
||||
return 0.5F;
|
||||
@ -43,6 +44,7 @@ public class AreaEffectCloudMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(7).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -55,6 +57,7 @@ public class AreaEffectCloudMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(8).getData();
|
||||
}
|
||||
return false;
|
||||
@ -68,6 +71,8 @@ public class AreaEffectCloudMetaData extends MobMetaData {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return Particles.byId((int) sets.get(9).getData());
|
||||
case VERSION_1_13_2:
|
||||
return (Particles) sets.get(9).getData();
|
||||
}
|
||||
return Particles.EFFECT;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(11).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
@ -44,7 +45,6 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_9_4:
|
||||
return BitByte.isBitMask((byte) sets.get(10).getData(), 0x02);
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_12_2:
|
||||
return BitByte.isBitMask((byte) sets.get(11).getData(), 0x02);
|
||||
default:
|
||||
return super.hasGravity();
|
||||
@ -59,6 +59,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(11).getData(), 0x04);
|
||||
}
|
||||
return true;
|
||||
@ -72,6 +73,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(11).getData(), 0x08);
|
||||
}
|
||||
return false;
|
||||
@ -85,6 +87,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(11).getData(), 0x10);
|
||||
}
|
||||
return false;
|
||||
@ -98,6 +101,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (EntityRotation) sets.get(12).getData();
|
||||
}
|
||||
return new EntityRotation(0, 0, 0);
|
||||
@ -111,6 +115,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (EntityRotation) sets.get(13).getData();
|
||||
}
|
||||
return new EntityRotation(0, 0, 0);
|
||||
@ -124,6 +129,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (EntityRotation) sets.get(14).getData();
|
||||
}
|
||||
return new EntityRotation(-10, 0, -10);
|
||||
@ -137,6 +143,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (EntityRotation) sets.get(15).getData();
|
||||
}
|
||||
return new EntityRotation(-15, 0, 10);
|
||||
@ -150,6 +157,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (EntityRotation) sets.get(16).getData();
|
||||
}
|
||||
return new EntityRotation(-1, 0, -1);
|
||||
@ -163,6 +171,7 @@ public class ArmorStandMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (EntityRotation) sets.get(17).getData();
|
||||
}
|
||||
return new EntityRotation(1, 0, 1);
|
||||
|
@ -16,6 +16,7 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
import de.bixilon.minosoft.util.BitByte;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ArrowMetaData extends EntityMetaData {
|
||||
|
||||
@ -33,9 +34,26 @@ public class ArrowMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(6).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNoClip() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(6).getData(), 0x02);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public UUID getShooterUUID() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (UUID) sets.get(7).getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ public class BatMetaData extends InsentientMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
|
@ -35,6 +35,7 @@ public class BlazeMetaData extends MobMetaData {
|
||||
return BitByte.isBitMask((byte) sets.get(17).getData(), 0x01);
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
|
@ -32,6 +32,7 @@ public class BoatMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(6).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -47,6 +48,7 @@ public class BoatMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(7).getData();
|
||||
}
|
||||
return 1;
|
||||
@ -62,6 +64,7 @@ public class BoatMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (float) sets.get(8).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -74,6 +77,7 @@ public class BoatMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BoatMaterial.byId((int) sets.get(9).getData());
|
||||
}
|
||||
return BoatMaterial.OAK;
|
||||
@ -87,6 +91,8 @@ public class BoatMetaData extends EntityMetaData {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return (boolean) sets.get(10).getData();
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(11).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -94,6 +100,7 @@ public class BoatMetaData extends EntityMetaData {
|
||||
public boolean isLeftPaddleTurning() {
|
||||
switch (version) {
|
||||
case VERSION_1_9_4:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(10).getData();
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
@ -103,6 +110,14 @@ public class BoatMetaData extends EntityMetaData {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getSplashTimer() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(12).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public enum BoatMaterial {
|
||||
OAK(0),
|
||||
SPRUCE(1),
|
||||
|
@ -34,6 +34,7 @@ public class ChestedHorseMetaData extends AbstractHorseMetaData {
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x08);
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(15).getData(), 0x08);
|
||||
}
|
||||
return false;
|
||||
|
@ -30,6 +30,7 @@ public class CommandBlockMinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (String) sets.get(12).getData();
|
||||
}
|
||||
return "";
|
||||
@ -42,6 +43,7 @@ public class CommandBlockMinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (TextComponent) sets.get(13).getData();
|
||||
}
|
||||
return null;
|
||||
|
@ -33,6 +33,7 @@ public class CreeperMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(12).getData();
|
||||
}
|
||||
return -1;
|
||||
@ -49,6 +50,7 @@ public class CreeperMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(13).getData();
|
||||
}
|
||||
return false;
|
||||
@ -60,6 +62,8 @@ public class CreeperMetaData extends MobMetaData {
|
||||
return (boolean) sets.get(13).getData();
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(14).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.game.datatypes.world.BlockPosition;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class DolphinMetaData extends InsentientMetaData {
|
||||
|
||||
public DolphinMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
}
|
||||
|
||||
public BlockPosition isTreasure() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (BlockPosition) sets.get(12).getData();
|
||||
}
|
||||
return new BlockPosition(0, (short) 0, 0);
|
||||
}
|
||||
|
||||
public boolean canFireTreasure() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(13).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasFish() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(14).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -39,6 +39,7 @@ public class EnderCrystalMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (BlockPosition) sets.get(6).getData();
|
||||
}
|
||||
return null;
|
||||
@ -51,6 +52,7 @@ public class EnderCrystalMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(7).getData();
|
||||
}
|
||||
return true;
|
||||
|
@ -30,6 +30,7 @@ public class EnderDragonMetaData extends InsentientMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return ((int) sets.get(12).getData());
|
||||
}
|
||||
return 0;
|
||||
|
@ -34,6 +34,7 @@ public class EndermanMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (Blocks) sets.get(12).getData();
|
||||
}
|
||||
return Blocks.AIR;
|
||||
@ -49,6 +50,7 @@ public class EndermanMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(13).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -12,10 +12,7 @@
|
||||
*/
|
||||
package de.bixilon.minosoft.game.datatypes.entities.meta;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.EntityRotation;
|
||||
import de.bixilon.minosoft.game.datatypes.MapSet;
|
||||
import de.bixilon.minosoft.game.datatypes.Vector;
|
||||
import de.bixilon.minosoft.game.datatypes.VersionValueMap;
|
||||
import de.bixilon.minosoft.game.datatypes.*;
|
||||
import de.bixilon.minosoft.game.datatypes.blocks.Blocks;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
@ -34,6 +31,7 @@ public class EntityMetaData {
|
||||
1.8: https://wiki.vg/index.php?title=Entity_metadata&oldid=6611
|
||||
1.9.4: https://wiki.vg/index.php?title=Entity_metadata&oldid=7955
|
||||
1.10: https://wiki.vg/index.php?title=Entity_metadata&oldid=8241
|
||||
1.13: https://wiki.vg/index.php?title=Entity_metadata&oldid=14800
|
||||
*/
|
||||
public EntityMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
this.sets = sets;
|
||||
@ -129,6 +127,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(0).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
@ -142,6 +141,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(0).getData(), 0x02);
|
||||
}
|
||||
return false;
|
||||
@ -155,6 +155,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(0).getData(), 0x08);
|
||||
}
|
||||
return false;
|
||||
@ -171,6 +172,14 @@ public class EntityMetaData {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isSwimming() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(0).getData(), 0x10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isDrinking() {
|
||||
return isEating();
|
||||
}
|
||||
@ -187,6 +196,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitSet((byte) sets.get(0).getData(), 0x20);
|
||||
}
|
||||
return false;
|
||||
@ -200,6 +210,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitSet((byte) sets.get(0).getData(), 0x40);
|
||||
}
|
||||
return false;
|
||||
@ -213,18 +224,21 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitSet((byte) sets.get(0).getData(), 0x80);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getNameTag() {
|
||||
public TextComponent getNameTag() {
|
||||
switch (version) {
|
||||
case VERSION_1_9_4:
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return (String) sets.get(2).getData();
|
||||
return new TextComponent((String) sets.get(2).getData());
|
||||
case VERSION_1_13_2:
|
||||
return (TextComponent) sets.get(2).getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -235,6 +249,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(3).getData();
|
||||
}
|
||||
return false;
|
||||
@ -246,6 +261,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(4).getData();
|
||||
}
|
||||
return false;
|
||||
@ -256,6 +272,7 @@ public class EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return !(boolean) sets.get(5).getData();
|
||||
}
|
||||
return true;
|
||||
@ -269,25 +286,23 @@ public class EntityMetaData {
|
||||
FLOAT(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_7_10, 3), new MapSet<>(ProtocolVersion.VERSION_1_9_4, 2)}),
|
||||
STRING(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_7_10, 4), new MapSet<>(ProtocolVersion.VERSION_1_9_4, 3)}),
|
||||
CHAT(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 4)}),
|
||||
OPT_CHAT(-1),
|
||||
SLOT(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_7_10, 5)}),
|
||||
BOOLEAN(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 6)}),
|
||||
OPT_CHAT(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_13_2, 5)}),
|
||||
SLOT(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_7_10, 5), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 6)}),
|
||||
BOOLEAN(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 6), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 7)}),
|
||||
VECTOR(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_7_10, 6), new MapSet<>(ProtocolVersion.VERSION_1_9_4, 1002)}),
|
||||
ROTATION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_7_10, 7)}),
|
||||
POSITION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 8)}),
|
||||
OPT_POSITION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 9)}),
|
||||
DIRECTION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 10)}),
|
||||
OPT_UUID(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 11)}),
|
||||
ROTATION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_7_10, 7), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 8)}),
|
||||
POSITION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 8), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 9)}),
|
||||
OPT_POSITION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 9), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 10)}),
|
||||
DIRECTION(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 10), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 11)}),
|
||||
OPT_UUID(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 11), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 12)}),
|
||||
BLOCK_ID(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_9_4, 12), new MapSet<>(ProtocolVersion.VERSION_1_10, 1003)}),
|
||||
OPT_BLOCK_ID(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_10, 12)}),
|
||||
NBT(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_12_2, 13)}),
|
||||
PARTICLE(-1),
|
||||
OPT_BLOCK_ID(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_10, 12), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 13)}),
|
||||
NBT(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_12_2, 13), new MapSet<>(ProtocolVersion.VERSION_1_13_2, 14)}),
|
||||
PARTICLE(new MapSet[]{new MapSet<>(ProtocolVersion.VERSION_1_13_2, 15)}),
|
||||
VILLAGER_DATA(-1),
|
||||
OPT_VAR_INT(-1),
|
||||
POSE(-1);
|
||||
|
||||
//ToDo: add all types by version
|
||||
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
Types(MapSet<ProtocolVersion, Integer>[] values) {
|
||||
|
@ -30,6 +30,7 @@ public class FallingBlockMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (BlockPosition) sets.get(6).getData();
|
||||
}
|
||||
return new BlockPosition(0, (short) 0, 0);
|
||||
|
@ -33,6 +33,7 @@ public class FireworkMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (Slot) sets.get(6).getData();
|
||||
}
|
||||
return null;
|
||||
@ -42,6 +43,7 @@ public class FireworkMetaData extends EntityMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(7).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class FishMetaData extends InsentientMetaData {
|
||||
|
||||
public FishMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
}
|
||||
|
||||
public boolean fromBucket() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(12).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class FishingHookMetaData extends MobMetaData {
|
||||
public class FishingHookMetaData extends EntityMetaData {
|
||||
|
||||
public FishingHookMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
@ -30,6 +30,7 @@ public class FishingHookMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(6).getData();
|
||||
}
|
||||
return -1;
|
||||
|
@ -32,6 +32,7 @@ public class FurnaceMinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(12).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -32,6 +32,7 @@ public class GhastMetaData extends InsentientMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(12).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -44,6 +44,7 @@ public class GuardianMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitSet((byte) sets.get(12).getData(), 0x02);
|
||||
}
|
||||
return false;
|
||||
@ -59,6 +60,7 @@ public class GuardianMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(13).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -32,6 +32,7 @@ public class HorseMetaData extends AbstractHorseMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return HorseColor.byId((int) sets.get(15).getData() & 0xFF);
|
||||
}
|
||||
return HorseColor.WHITE;
|
||||
@ -47,6 +48,7 @@ public class HorseMetaData extends AbstractHorseMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return HorseDots.byId((int) sets.get(15).getData() & 0xFF00);
|
||||
}
|
||||
return HorseDots.NONE;
|
||||
@ -60,6 +62,7 @@ public class HorseMetaData extends AbstractHorseMetaData {
|
||||
case VERSION_1_9_4:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return HorseArmor.byId((int) sets.get(16).getData());
|
||||
case VERSION_1_10:
|
||||
return HorseArmor.byId((int) sets.get(17).getData());
|
||||
|
@ -35,6 +35,7 @@ public class HumanMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (float) sets.get(11).getData();
|
||||
}
|
||||
return 0.0F;
|
||||
@ -50,6 +51,7 @@ public class HumanMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(12).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -63,6 +65,7 @@ public class HumanMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return Hand.byId((byte) sets.get(14).getData());
|
||||
}
|
||||
return Hand.RIGHT;
|
||||
@ -71,6 +74,7 @@ public class HumanMetaData extends MobMetaData {
|
||||
public CompoundTag getLeftShoulderEntityData() {
|
||||
switch (version) {
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (CompoundTag) sets.get(15).getData();
|
||||
}
|
||||
return null;
|
||||
@ -79,6 +83,7 @@ public class HumanMetaData extends MobMetaData {
|
||||
public CompoundTag getRightShoulderEntityData() {
|
||||
switch (version) {
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (CompoundTag) sets.get(16).getData();
|
||||
}
|
||||
return null;
|
||||
|
@ -34,6 +34,7 @@ public class InsentientMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(11).getData(), 0x01);
|
||||
default:
|
||||
return super.hasAI();
|
||||
@ -47,6 +48,7 @@ public class InsentientMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(11).getData(), 0x02);
|
||||
}
|
||||
return false;
|
||||
|
@ -33,6 +33,7 @@ public class IronGolemMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
|
@ -34,6 +34,7 @@ public class ItemFrameMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (Slot) sets.get(6).getData();
|
||||
}
|
||||
return null;
|
||||
@ -50,6 +51,7 @@ public class ItemFrameMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(7).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -33,6 +33,7 @@ public class ItemMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (Slot) sets.get(6).getData();
|
||||
}
|
||||
return null;
|
||||
|
@ -27,6 +27,7 @@ public class LlamaMetaData extends ChestedHorseMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(16).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -36,6 +37,7 @@ public class LlamaMetaData extends ChestedHorseMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return Color.byId((int) sets.get(17).getData());
|
||||
}
|
||||
return null;
|
||||
@ -45,6 +47,7 @@ public class LlamaMetaData extends ChestedHorseMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return LlamaVariants.byId((int) sets.get(17).getData());
|
||||
}
|
||||
return null;
|
||||
|
@ -33,6 +33,7 @@ public class MinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(6).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -48,6 +49,7 @@ public class MinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(7).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -63,6 +65,7 @@ public class MinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (float) sets.get(8).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -78,6 +81,7 @@ public class MinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return Blocks.byId((int) sets.get(9).getData() & 0xFF, (int) sets.get(9).getData() >>> 4);
|
||||
}
|
||||
return Blocks.AIR;
|
||||
@ -92,6 +96,7 @@ public class MinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(10).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -106,6 +111,7 @@ public class MinecartMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(11).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
package de.bixilon.minosoft.game.datatypes.entities.meta;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.TextComponent;
|
||||
import de.bixilon.minosoft.game.datatypes.player.Hand;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
import de.bixilon.minosoft.util.BitByte;
|
||||
@ -34,6 +35,7 @@ public class MobMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (float) sets.get(7).getData();
|
||||
}
|
||||
return 1.0F;
|
||||
@ -49,6 +51,7 @@ public class MobMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(8).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -65,6 +68,7 @@ public class MobMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(9).getData();
|
||||
}
|
||||
return false;
|
||||
@ -80,18 +84,19 @@ public class MobMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(10).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameTag() {
|
||||
public TextComponent getNameTag() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (String) sets.get(10).getData();
|
||||
return new TextComponent((String) sets.get(10).getData());
|
||||
case VERSION_1_8:
|
||||
return (String) sets.get(2).getData();
|
||||
return new TextComponent((String) sets.get(2).getData());
|
||||
default:
|
||||
return super.getNameTag();
|
||||
}
|
||||
@ -124,6 +129,7 @@ public class MobMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(6).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
@ -137,10 +143,18 @@ public class MobMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(6).getData(), 0x02) ? Hand.LEFT : Hand.RIGHT;
|
||||
}
|
||||
return Hand.RIGHT;
|
||||
}
|
||||
|
||||
public boolean isRiptideAttack() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(6).getData(), 0x04);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public class OcelotMetaData extends TameableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return OcelotTypes.byId((int) sets.get(15).getData());
|
||||
}
|
||||
return OcelotTypes.UNTAMED;
|
||||
|
@ -25,6 +25,7 @@ public class ParrotMetaData extends TameableMetaData {
|
||||
public ParrotVariants getVariant() {
|
||||
switch (version) {
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return ParrotVariants.byId((Integer) sets.get(15).getData());
|
||||
}
|
||||
return ParrotVariants.RED_BLUE;
|
||||
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PhantomMetaData extends InsentientMetaData {
|
||||
|
||||
public PhantomMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(12).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -33,6 +33,7 @@ public class PigMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(13).getData();
|
||||
}
|
||||
return false;
|
||||
@ -42,6 +43,7 @@ public class PigMetaData extends AgeableMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(14).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -30,6 +30,7 @@ public class PotionMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (Slot) sets.get(6).getData();
|
||||
}
|
||||
return null;
|
||||
|
@ -29,6 +29,7 @@ public class PrimedTNTMetaData extends EntityMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(6).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class PufferFishMetaData extends FishMetaData {
|
||||
|
||||
public PufferFishMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
}
|
||||
|
||||
public int getPuffState() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(13).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
*/
|
||||
package de.bixilon.minosoft.game.datatypes.entities.meta;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.world.BlockPosition;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -23,18 +24,51 @@ public class RabbitMetaData extends TameableMetaData {
|
||||
}
|
||||
|
||||
|
||||
public int getType() {
|
||||
public BlockPosition getHomePosition() {
|
||||
switch (version) {
|
||||
case VERSION_1_8:
|
||||
return (byte) sets.get(18).getData();
|
||||
case VERSION_1_9_4:
|
||||
return (int) sets.get(12).getData();
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return (int) sets.get(13).getData();
|
||||
case VERSION_1_13_2:
|
||||
return (BlockPosition) sets.get(13).getData();
|
||||
}
|
||||
return 0;
|
||||
return new BlockPosition(0, (short) 0, 0);
|
||||
}
|
||||
|
||||
public boolean hasEgg() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(14).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLayingEgg() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(15).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public BlockPosition getTravelPosition() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (BlockPosition) sets.get(16).getData();
|
||||
}
|
||||
return new BlockPosition(0, (short) 0, 0);
|
||||
}
|
||||
|
||||
public boolean isGoingHome() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(17).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTraveling() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(18).getData();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public class SheepMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return Color.byId((byte) sets.get(13).getData() & 0xF);
|
||||
}
|
||||
return Color.WHITE;
|
||||
@ -50,6 +51,7 @@ public class SheepMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(13).getData(), 0x10);
|
||||
}
|
||||
return false;
|
||||
|
@ -32,6 +32,7 @@ public class ShulkerMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (Direction) sets.get(12).getData();
|
||||
}
|
||||
return Direction.DOWN;
|
||||
@ -44,6 +45,7 @@ public class ShulkerMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (BlockPosition) sets.get(13).getData();
|
||||
}
|
||||
return null;
|
||||
@ -56,6 +58,7 @@ public class ShulkerMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (byte) sets.get(14).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -65,6 +68,7 @@ public class ShulkerMetaData extends MobMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return Color.byId((byte) sets.get(15).getData());
|
||||
}
|
||||
return Color.PURPLE;
|
||||
|
@ -40,6 +40,7 @@ public class SkeletonMetaData extends MobMetaData {
|
||||
case VERSION_1_9_4:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(12).getData();
|
||||
case VERSION_1_10:
|
||||
return (boolean) sets.get(13).getData();
|
||||
|
@ -32,6 +32,7 @@ public class SlimeMetaData extends InsentientMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(12).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -31,6 +31,7 @@ public class SnowGolemMetaData extends MobMetaData {
|
||||
case VERSION_1_11_2:
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x10);
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
//ToDo: obviously wrong
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x01);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ public class SpellcasterMetaData extends MobMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (byte) sets.get(13).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -34,6 +34,7 @@ public class SpiderMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
|
@ -35,6 +35,7 @@ public class TameableMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
@ -50,6 +51,7 @@ public class TameableMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x04);
|
||||
}
|
||||
return false;
|
||||
@ -62,6 +64,7 @@ public class TameableMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((int) sets.get(13).getData(), 0x02);
|
||||
}
|
||||
return false;
|
||||
@ -83,6 +86,7 @@ public class TameableMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (UUID) sets.get(14).getData();
|
||||
}
|
||||
return null;
|
||||
|
@ -30,6 +30,8 @@ public class TippedArrowMetaData extends ArrowMetaData {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return (int) sets.get(7).getData();
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(8).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TridentMetaData extends ArrowMetaData {
|
||||
|
||||
public TridentMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
}
|
||||
|
||||
public int getLoyaltyLevel() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(8).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class TropicalFishMetaData extends FishMetaData {
|
||||
|
||||
public TropicalFishMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
}
|
||||
|
||||
public int getVariant() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(13).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ public class VexMetaData extends MobMetaData {
|
||||
switch (version) {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return BitByte.isBitMask((byte) sets.get(12).getData(), 0x01);
|
||||
}
|
||||
return false;
|
||||
|
@ -33,6 +33,7 @@ public class VillagerMetaData extends AgeableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return VillagerType.byId((int) sets.get(13).getData());
|
||||
}
|
||||
return VillagerType.FARMER;
|
||||
|
@ -31,7 +31,6 @@ public class WitchMetaData extends MobMetaData {
|
||||
return (boolean) sets.get(11).getData();
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return (boolean) sets.get(12).getData();
|
||||
}
|
||||
return false;
|
||||
@ -40,6 +39,7 @@ public class WitchMetaData extends MobMetaData {
|
||||
public boolean isDrinkingPotion() {
|
||||
switch (version) {
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(12).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -32,6 +32,7 @@ public class WitherMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(12).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -47,6 +48,7 @@ public class WitherMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(13).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -62,6 +64,7 @@ public class WitherMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(14).getData();
|
||||
}
|
||||
return 0;
|
||||
@ -77,6 +80,7 @@ public class WitherMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (int) sets.get(15).getData();
|
||||
}
|
||||
return 0;
|
||||
|
@ -16,7 +16,7 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class WitherSkullMetaData extends TameableMetaData {
|
||||
public class WitherSkullMetaData extends EntityMetaData {
|
||||
|
||||
public WitherSkullMetaData(HashMap<Integer, MetaDataSet> sets, ProtocolVersion version) {
|
||||
super(sets, version);
|
||||
@ -30,6 +30,7 @@ public class WitherSkullMetaData extends TameableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(6).getData();
|
||||
}
|
||||
return false;
|
||||
|
@ -54,6 +54,7 @@ public class WolfMetaData extends TameableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (float) sets.get(15).getData();
|
||||
}
|
||||
return getHealth();
|
||||
@ -70,6 +71,7 @@ public class WolfMetaData extends TameableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return (boolean) sets.get(16).getData();
|
||||
}
|
||||
return false;
|
||||
@ -85,6 +87,7 @@ public class WolfMetaData extends TameableMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return Color.byId((byte) sets.get(17).getData());
|
||||
}
|
||||
return Color.RED;
|
||||
|
@ -33,6 +33,7 @@ public class ZombieMetaData extends MobMetaData {
|
||||
case VERSION_1_10:
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return ((boolean) sets.get(12).getData());
|
||||
}
|
||||
return false;
|
||||
@ -72,8 +73,17 @@ public class ZombieMetaData extends MobMetaData {
|
||||
return ((boolean) sets.get(15).getData());
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
case VERSION_1_13_2:
|
||||
return ((boolean) sets.get(16).getData());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBecomingADrowned() {
|
||||
switch (version) {
|
||||
case VERSION_1_13_2:
|
||||
return ((boolean) sets.get(15).getData());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ public class ZombieVillagerMetaData extends ZombieMetaData {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return VillagerMetaData.VillagerType.byId((int) sets.get(16).getData() + 1);
|
||||
case VERSION_1_13_2:
|
||||
return VillagerMetaData.VillagerType.byId((int) sets.get(17).getData() + 1);
|
||||
}
|
||||
return VillagerMetaData.VillagerType.FARMER;
|
||||
}
|
||||
@ -38,6 +40,9 @@ public class ZombieVillagerMetaData extends ZombieMetaData {
|
||||
case VERSION_1_11_2:
|
||||
case VERSION_1_12_2:
|
||||
return ((boolean) sets.get(15).getData());
|
||||
case VERSION_1_13_2:
|
||||
return ((boolean) sets.get(16).getData());
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user