forked from Nan1t/NanoLimbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added schematic containers and loader. Added world-related classes
- Loading branch information
Showing
17 changed files
with
684 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 2020 Nan1t | ||
* | ||
* 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/>. | ||
*/ | ||
|
||
package ru.nanit.limbo.world; | ||
|
||
public class BlockData { | ||
|
||
private final String state; | ||
private final int id; | ||
private final byte data; | ||
|
||
public BlockData(String state, int id, byte data) { | ||
this.state = state; | ||
this.id = id; | ||
this.data = data; | ||
} | ||
|
||
public BlockData(String state) { | ||
this(state, 0, (byte) 0); | ||
} | ||
|
||
public BlockData(int id, byte data) { | ||
this(null, id, data); | ||
} | ||
|
||
public String getState() { | ||
return state; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public byte getData() { | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2020 Nan1t | ||
* | ||
* 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/>. | ||
*/ | ||
|
||
package ru.nanit.limbo.world; | ||
|
||
import net.kyori.adventure.nbt.CompoundBinaryTag; | ||
|
||
public class BlockEntity { | ||
|
||
private final Location pos; | ||
private final String id; | ||
private final CompoundBinaryTag data; | ||
|
||
public BlockEntity(Location pos, String id, CompoundBinaryTag data) { | ||
this.pos = pos; | ||
this.id = id; | ||
this.data = data; | ||
} | ||
|
||
public Location getPos() { | ||
return pos; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public CompoundBinaryTag getData() { | ||
return data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2020 Nan1t | ||
* | ||
* 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/>. | ||
*/ | ||
|
||
package ru.nanit.limbo.world; | ||
|
||
import ru.nanit.limbo.protocol.registry.Version; | ||
|
||
public final class BlockMap { | ||
|
||
public BlockData convert(int id, byte data, Version version) { | ||
// TODO | ||
return null; | ||
} | ||
|
||
public BlockData convert(String state, Version version) { | ||
// TODO | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* Copyright (C) 2020 Nan1t | ||
* | ||
* 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/>. | ||
*/ | ||
|
||
package ru.nanit.limbo.world; | ||
|
||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
import org.spongepowered.configurate.ConfigurationNode; | ||
import org.spongepowered.configurate.serialize.TypeSerializer; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
public class Location { | ||
|
||
private final double x; | ||
private final double y; | ||
private final double z; | ||
private final float yaw; | ||
private final float pitch; | ||
|
||
Location(double x, double y, double z, float yaw, float pitch) { | ||
this.x = x; | ||
this.y = y; | ||
this.z = z; | ||
this.yaw = yaw; | ||
this.pitch = pitch; | ||
} | ||
|
||
Location(double x, double y, double z) { | ||
this(x, y, z, 0.0F, 0.0F); | ||
} | ||
|
||
public double getX() { | ||
return x; | ||
} | ||
|
||
public int getBlockX() { | ||
return (int) x; | ||
} | ||
|
||
public double getY() { | ||
return y; | ||
} | ||
|
||
public int getBlockY() { | ||
return (int) y; | ||
} | ||
|
||
public double getZ() { | ||
return z; | ||
} | ||
|
||
public int getBlockZ() { | ||
return (int) z; | ||
} | ||
|
||
public float getYaw() { | ||
return yaw; | ||
} | ||
|
||
public float getPitch() { | ||
return pitch; | ||
} | ||
|
||
public static Location of(double x, double y, double z) { | ||
return new Location(x, y, z); | ||
} | ||
|
||
public static Location of(double x, double y, double z, float yaw, float pitch) { | ||
return new Location(x, y, z, yaw, pitch); | ||
} | ||
|
||
public static Location pos(int x, int y, int z) { | ||
return new Location(x, y, z); | ||
} | ||
|
||
public static class Serializer implements TypeSerializer<Location> { | ||
|
||
@Override | ||
public Location deserialize(Type type, ConfigurationNode node) { | ||
double x = node.node("x").getDouble(0); | ||
double y = node.node("y").getDouble(0); | ||
double z = node.node("z").getDouble(0); | ||
float yaw = node.node("yaw").getFloat(0.0F); | ||
float pitch = node.node("pitch").getFloat(0.0F); | ||
|
||
return new Location(x, y, z, yaw, pitch); | ||
} | ||
|
||
@Override | ||
public void serialize(Type type, @Nullable Location obj, ConfigurationNode node) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.