diff --git a/.idea/dictionaries/moritz.xml b/.idea/dictionaries/moritz.xml
index 46f54007e..5aa5b75b4 100644
--- a/.idea/dictionaries/moritz.xml
+++ b/.idea/dictionaries/moritz.xml
@@ -4,6 +4,7 @@
clientboundcooldowngamemode
+ jitpackminosoftmojangmotd
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 712ab9d98..b00065041 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -1,6 +1,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -11,6 +21,11 @@
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 3b5814651..63f3ef1de 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,17 @@
+
+
@@ -7,6 +20,12 @@
de.bixilonMinosoft0.1
+
+
+ jitpack.io
+ http://www.jitpack.io
+
+
@@ -37,6 +56,11 @@
snakeyaml1.25
+
+ com.github.Querz
+ NBT
+ 5.4
+
\ No newline at end of file
diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/World.java b/src/main/java/de/bixilon/minosoft/game/datatypes/World.java
index ebc4a3d0e..0e0e729d2 100644
--- a/src/main/java/de/bixilon/minosoft/game/datatypes/World.java
+++ b/src/main/java/de/bixilon/minosoft/game/datatypes/World.java
@@ -14,6 +14,7 @@
package de.bixilon.minosoft.game.datatypes;
import de.bixilon.minosoft.game.datatypes.blocks.Block;
+import de.bixilon.minosoft.game.datatypes.entities.Entity;
import java.util.HashMap;
import java.util.Map;
@@ -23,6 +24,7 @@ import java.util.Map;
*/
public class World {
public final HashMap chunks;
+ public final HashMap entities;
final String name;
boolean hardcore;
boolean raining;
@@ -30,6 +32,7 @@ public class World {
public World(String name) {
this.name = name;
chunks = new HashMap<>();
+ entities = new HashMap<>();
}
public String getName() {
diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Entities.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Entities.java
new file mode 100644
index 000000000..df3b2fda1
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Entities.java
@@ -0,0 +1,60 @@
+/*
+ * Codename Minosoft
+ * Copyright (C) 2020 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.game.datatypes.entities;
+
+import de.bixilon.minosoft.game.datatypes.Identifier;
+
+public enum Entities {
+ ZOMBIE(new Identifier("zombie"), 54, Zombie.class);
+
+ final Identifier identifier;
+ final int type;
+ final Class extends Entity> clazz;
+
+ Entities(Identifier identifier, int type, Class extends Entity> clazz) {
+ this.identifier = identifier;
+ this.type = type;
+ this.clazz = clazz;
+ }
+
+ public static Entities byIdentifier(Identifier identifier) {
+ for (Entities b : values()) {
+ if (b.getIdentifier().equals(identifier)) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ public static Entities byType(int type) {
+ for (Entities b : values()) {
+ if (b.getType() == type) {
+ return b;
+ }
+ }
+ return null;
+ }
+
+ public Identifier getIdentifier() {
+ return identifier;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public Class extends Entity> getClazz() {
+ return clazz;
+ }
+}
diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Entity.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Entity.java
new file mode 100644
index 000000000..6f193324c
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Entity.java
@@ -0,0 +1,46 @@
+/*
+ * Codename Minosoft
+ * Copyright (C) 2020 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.game.datatypes.entities;
+
+public interface Entity {
+ Entities getEntityType();
+
+ int getId();
+
+ Location getLocation();
+
+ void setLocation(Location location);
+
+ Velocity getVelocity();
+
+ void setVelocity(Velocity velocity);
+
+ int getYaw();
+
+ void setYaw(int yaw);
+
+ int getPitch();
+
+ void setPitch(int pitch);
+
+ float getWidth();
+
+ float getHeight();
+
+ EntityMetaData getMetaData();
+
+ void setMetaData(EntityMetaData data);
+
+
+}
diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EntityMetaData.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EntityMetaData.java
new file mode 100644
index 000000000..8ba25cdff
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/EntityMetaData.java
@@ -0,0 +1,39 @@
+/*
+ * Codename Minosoft
+ * Copyright (C) 2020 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.game.datatypes.entities;
+
+import net.querz.nbt.io.NBTUtil;
+import net.querz.nbt.io.NamedTag;
+
+import java.io.IOException;
+
+public class EntityMetaData {
+ NamedTag nbt;
+
+ public EntityMetaData(byte[] nbt) {
+ try {
+ this.nbt = NBTUtil.read(new String(nbt));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public EntityMetaData(String nbt) {
+ try {
+ this.nbt = NBTUtil.read(nbt);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Velocity.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Velocity.java
new file mode 100644
index 000000000..16750fc3c
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Velocity.java
@@ -0,0 +1,47 @@
+/*
+ * Codename Minosoft
+ * Copyright (C) 2020 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.game.datatypes.entities;
+
+public class Velocity {
+ private final short x;
+ private final short y;
+ private final short z;
+
+ public Velocity(short x, short y, short z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public short getX() {
+ return x;
+ }
+
+ public short getY() {
+ return y;
+ }
+
+ public short getZ() {
+ return z;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (super.equals(obj)) {
+ return true;
+ }
+ Velocity that = (Velocity) obj;
+ return that.getX() == getX() && that.getY() == getY() && that.getZ() == getZ();
+ }
+}
diff --git a/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Zombie.java b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Zombie.java
new file mode 100644
index 000000000..84a3e0f4c
--- /dev/null
+++ b/src/main/java/de/bixilon/minosoft/game/datatypes/entities/Zombie.java
@@ -0,0 +1,99 @@
+/*
+ * Codename Minosoft
+ * Copyright (C) 2020 Moritz Zwerger
+ *
+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with this program. If not, see .
+ *
+ * This software is not affiliated with Mojang AB, the original developer of Minecraft.
+ */
+
+package de.bixilon.minosoft.game.datatypes.entities;
+
+public class Zombie implements Entity {
+ final int id;
+ Location location;
+ Velocity velocity;
+ int yaw;
+ int pitch;
+ EntityMetaData data;
+
+ public Zombie(int id) {
+ this.id = id;
+ }
+
+ @Override
+ public Entities getEntityType() {
+ return Entities.ZOMBIE;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ @Override
+ public Location getLocation() {
+ return location;
+ }
+
+ @Override
+ public void setLocation(Location location) {
+ this.location = location;
+
+ }
+
+ @Override
+ public Velocity getVelocity() {
+ return velocity;
+ }
+
+ @Override
+ public void setVelocity(Velocity velocity) {
+ this.velocity = velocity;
+ }
+
+ @Override
+ public int getYaw() {
+ return 0;
+ }
+
+ @Override
+ public void setYaw(int yaw) {
+ this.yaw = yaw;
+
+ }
+
+ @Override
+ public int getPitch() {
+ return 0;
+ }
+
+ @Override
+ public void setPitch(int pitch) {
+ this.pitch = pitch;
+
+ }
+
+ @Override
+ public float getWidth() {
+ return 0;
+ }
+
+ @Override
+ public float getHeight() {
+ return 0;
+ }
+
+ @Override
+ public EntityMetaData getMetaData() {
+ return data;
+ }
+
+ @Override
+ public void setMetaData(EntityMetaData data) {
+ this.data = data;
+ }
+}