mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
add all entity metadata (entities wip 9)
This commit is contained in:
parent
93ae83910b
commit
edf1095fdd
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class ArrowMetaData extends EntityMetaData {
|
||||
|
||||
public ArrowMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public boolean isCritical() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class BatMetaData extends MobMetaData {
|
||||
|
||||
public BatMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public boolean isHanging() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class BlazeMetaData extends MobMetaData {
|
||||
|
||||
public BlazeMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public boolean isOnFire() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class BoatMetaData extends EntityMetaData {
|
||||
|
||||
public BoatMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public int getTimeSinceHit() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(17).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getForwardDirection() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(18).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getDamageTaken() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (float) sets.get(19).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -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.meta;
|
||||
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class CreeperMetaData extends MobMetaData {
|
||||
|
||||
public CreeperMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public byte getState() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPowered() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(17).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class EnderCrystalMetaData extends EntityMetaData {
|
||||
|
||||
public EnderCrystalMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public int getHealth() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(8).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -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.meta;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.blocks.Block;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class EndermanMetaData extends MobMetaData {
|
||||
|
||||
public EndermanMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public Block getCarriedBlock() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return Block.byLegacy((short) sets.get(16).getData(), (byte) sets.get(17).getData());
|
||||
}
|
||||
return Block.AIR;
|
||||
}
|
||||
|
||||
public boolean isScreaming() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(17).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -21,7 +21,7 @@ import de.bixilon.minosoft.util.BitByte;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class EntityMetaData {
|
||||
HashMap<Byte, MetaDataSet> sets = new HashMap<>();
|
||||
HashMap<Integer, MetaDataSet> sets = new HashMap<>();
|
||||
ProtocolVersion version;
|
||||
|
||||
public EntityMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
@ -55,7 +55,7 @@ public class EntityMetaData {
|
||||
default:
|
||||
throw new IllegalStateException("Unexpected value: " + type);
|
||||
}
|
||||
sets.put(index, new MetaDataSet(index, data));
|
||||
sets.put((int) index, new MetaDataSet(index, data));
|
||||
|
||||
|
||||
item = buffer.readByte();
|
||||
@ -142,7 +142,7 @@ public class EntityMetaData {
|
||||
|
||||
}
|
||||
|
||||
public HashMap<Byte, MetaDataSet> getSets() {
|
||||
public HashMap<Integer, MetaDataSet> getSets() {
|
||||
return sets;
|
||||
}
|
||||
|
||||
|
@ -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.game.datatypes.Slot;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class FireworkMetaData extends EntityMetaData {
|
||||
|
||||
public FireworkMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public Slot getInfo() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (Slot) sets.get(8).getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class FurnaceMetaData extends EntityMetaData {
|
||||
|
||||
public FurnaceMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public boolean getPowered() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class GhastMetaData extends MobMetaData {
|
||||
|
||||
public GhastMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public boolean isAttacking() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
/*
|
||||
* 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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
import de.bixilon.minosoft.util.BitByte;
|
||||
|
||||
public class HorseMetaData extends AgeableMetaData {
|
||||
|
||||
public HorseMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public boolean isTame() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSaddle() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasChest() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 3);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBred() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 4);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isEating() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 5);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isRearing() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 6);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isMouthOpen() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 7);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public HorseType getType() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return HorseType.byId((Integer) sets.get(19).getData());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getOwnerName() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (String) sets.get(21).getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// ToDo: entity color (index 20)
|
||||
|
||||
|
||||
enum HorseType {
|
||||
HORSE(0),
|
||||
DONKEY(1),
|
||||
MULE(2),
|
||||
ZOMBIE(3),
|
||||
SKELETON(4);
|
||||
|
||||
final int id;
|
||||
|
||||
HorseType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static HorseType byId(int id) {
|
||||
for (HorseType h : values()) {
|
||||
if (h.getId() == id) {
|
||||
return h;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
enum Armor {
|
||||
NO_ARMOR(0),
|
||||
IRON_ARMOR(1),
|
||||
GOLD_ARMOR(2),
|
||||
DIAMOND_ARMOR(3);
|
||||
|
||||
final int id;
|
||||
|
||||
Armor(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static Armor byId(int id) {
|
||||
for (Armor a : values()) {
|
||||
if (a.getId() == id) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class IronGolemMetaData extends MobMetaData {
|
||||
|
||||
public IronGolemMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public boolean isCreatedByPlayer() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.Slot;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class ItemFrameMetaData extends EntityMetaData {
|
||||
|
||||
public ItemFrameMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public Slot getItem() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (Slot) sets.get(2).getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public byte getRotation() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(3).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -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.game.datatypes.Slot;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class ItemMetaData extends EntityMetaData {
|
||||
|
||||
public ItemMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public Slot getSlot() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (Slot) sets.get(10).getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -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.meta;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.blocks.Block;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class MinecartMetaData extends EntityMetaData {
|
||||
|
||||
public MinecartMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public int getShakingPower() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(17).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getShakingDirection() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(18).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getDamageTaken() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (float) sets.get(19).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return Block.byLegacy((int) sets.get(20).getData() & 0xFF, (int) sets.get(20).getData() & 0xFF00);
|
||||
}
|
||||
return Block.AIR;
|
||||
}
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class OcelotMetaData extends TamableMetaData {
|
||||
|
||||
public OcelotMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public byte getType() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(18).getData();
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class PigMetaData extends AgeableMetaData {
|
||||
|
||||
public PigMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasSaddle() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -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.meta;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.Color;
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
import de.bixilon.minosoft.util.BitByte;
|
||||
|
||||
public class SheepMetaData extends AgeableMetaData {
|
||||
|
||||
public SheepMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public Color getColor() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return Color.byId((byte) sets.get(16).getData() & 0xF);
|
||||
}
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
public boolean isSheared() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((byte) sets.get(16).getData(), 5);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class SkeletonMetaData extends MobMetaData {
|
||||
|
||||
public SkeletonMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public boolean isWitherSkeleton() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(13).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class SlimeMetaData extends MobMetaData {
|
||||
|
||||
public SlimeMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public byte getSize() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class SpiderMetaData extends MobMetaData {
|
||||
|
||||
public SpiderMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public boolean isClimbing() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(16).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
import de.bixilon.minosoft.util.BitByte;
|
||||
|
||||
public class TamableMetaData extends MobMetaData {
|
||||
|
||||
public TamableMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public boolean isSitting() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTame() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getOwnerName() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (String) sets.get(17).getData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class VillagerMetaData extends AgeableMetaData {
|
||||
|
||||
public VillagerMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public VillagerType getVillagerType() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return VillagerType.byId((int) sets.get(17).getData());
|
||||
}
|
||||
return VillagerType.FARMER;
|
||||
}
|
||||
|
||||
public enum VillagerType {
|
||||
FARMER(0),
|
||||
LIBRARIAN(1),
|
||||
PRIEST(2),
|
||||
BLACKSMITH(3),
|
||||
BUTCHER(4);
|
||||
|
||||
|
||||
final int id;
|
||||
|
||||
VillagerType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static VillagerType byId(int id) {
|
||||
for (VillagerType t : values()) {
|
||||
if (t.getId() == id) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class WitchMetaData extends MobMetaData {
|
||||
|
||||
public WitchMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public boolean isAggressive() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(13).getData() == 0x01;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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.meta;
|
||||
|
||||
import de.bixilon.minosoft.protocol.protocol.InByteBuffer;
|
||||
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
|
||||
|
||||
public class WitherMetaData extends MobMetaData {
|
||||
|
||||
public WitherMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
public int getWatchedTarget1() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(17).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getWatchedTarget2() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(18).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getWatchedTarget3() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(19).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getInvulnerableTime() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(20).getData();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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.meta;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.Color;
|
||||
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 WolfMetaData(InByteBuffer buffer, ProtocolVersion v) {
|
||||
super(buffer, v);
|
||||
}
|
||||
|
||||
|
||||
public byte getType() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (byte) sets.get(18).getData();
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
public boolean isAngry() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return BitByte.isBitSet((int) sets.get(16).getData(), 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public float getHealth() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (float) sets.get(19).getData();
|
||||
}
|
||||
return 0.00F;
|
||||
}
|
||||
|
||||
|
||||
public Color getColor() {
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return Color.byId((byte) sets.get(20).getData());
|
||||
}
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user