mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-11 00:23:42 -04:00
Load block models per version
This commit is contained in:
parent
62e1f5599c
commit
24e08aa11f
@ -27,8 +27,13 @@ import de.bixilon.minosoft.data.mappings.blocks.Block;
|
|||||||
import de.bixilon.minosoft.data.mappings.blocks.Blocks;
|
import de.bixilon.minosoft.data.mappings.blocks.Blocks;
|
||||||
import de.bixilon.minosoft.data.mappings.particle.Particle;
|
import de.bixilon.minosoft.data.mappings.particle.Particle;
|
||||||
import de.bixilon.minosoft.data.mappings.statistics.Statistic;
|
import de.bixilon.minosoft.data.mappings.statistics.Statistic;
|
||||||
|
import de.bixilon.minosoft.data.world.BlockPosition;
|
||||||
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition;
|
import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition;
|
||||||
import javafx.util.Pair;
|
import de.bixilon.minosoft.render.blockModels.BlockModelInterface;
|
||||||
|
import de.bixilon.minosoft.render.blockModels.BlockModelLoader;
|
||||||
|
import de.bixilon.minosoft.render.blockModels.Face.FaceOrientation;
|
||||||
|
import de.bixilon.minosoft.util.Pair;
|
||||||
|
import org.apache.commons.collections.primitives.ArrayFloatList;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -55,6 +60,8 @@ public class VersionMapping {
|
|||||||
private HashMap<EntityMetaDataFields, Integer> entityMetaIndexMap;
|
private HashMap<EntityMetaDataFields, Integer> entityMetaIndexMap;
|
||||||
private HashMap<String, Pair<String, Integer>> entityMetaIndexOffsetParentMapping;
|
private HashMap<String, Pair<String, Integer>> entityMetaIndexOffsetParentMapping;
|
||||||
private HashBiMap<Integer, Class<? extends Entity>> entityIdClassMap;
|
private HashBiMap<Integer, Class<? extends Entity>> entityIdClassMap;
|
||||||
|
private HashMap<String, HashMap<String, BlockModelInterface>> modelMap;
|
||||||
|
private Integer blockTextureId; // OpenGL texture id for all block texture
|
||||||
|
|
||||||
public VersionMapping(Version version) {
|
public VersionMapping(Version version) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
@ -276,6 +283,45 @@ public class VersionMapping {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockModelInterface getBlockModel(Block block) {
|
||||||
|
if (parentMapping != null) {
|
||||||
|
BlockModelInterface blockModelInterface = parentMapping.getBlockModel(block);
|
||||||
|
if (blockModelInterface != null) {
|
||||||
|
return blockModelInterface;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BlockModelInterface model = modelMap.get(block.getMod()).get(block.getIdentifier());
|
||||||
|
if (model == null) {
|
||||||
|
throw new NullPointerException(String.format("The block model for the following block could not be found: %s", block));
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBlockFull(Block block, FaceOrientation orientation) {
|
||||||
|
if (block == null || block.equals(Blocks.nullBlock)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getBlockModel(block).full(block, orientation);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isBlockFull(Block block) {
|
||||||
|
return block != null && !block.equals(Blocks.nullBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayFloatList prepareBlock(Block block, HashSet<FaceOrientation> facesToDraw, BlockPosition position) {
|
||||||
|
return getBlockModel(block).prepare(facesToDraw, position, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getBlockTextureId() {
|
||||||
|
if (parentMapping != null) {
|
||||||
|
Integer blockTextureId = parentMapping.getBlockTextureId();
|
||||||
|
if (blockTextureId != null) {
|
||||||
|
return blockTextureId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return blockTextureId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void load(Mappings type, @Nullable JsonObject data, Version version) {
|
public void load(Mappings type, @Nullable JsonObject data, Version version) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -404,6 +450,21 @@ public class VersionMapping {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case BLOCK_MODELS -> {
|
||||||
|
if (!version.isFlattened() && version.getVersionId() != ProtocolDefinition.PRE_FLATTENING_VERSION_ID) {
|
||||||
|
// clone all values
|
||||||
|
modelMap = Versions.PRE_FLATTENING_MAPPING.modelMap;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data == null) {
|
||||||
|
modelMap = new HashMap<>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Pair<HashMap<String, HashMap<String, BlockModelInterface>>, Integer> pair = BlockModelLoader.load(data);
|
||||||
|
modelMap = pair.key;
|
||||||
|
blockTextureId = pair.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loaded.add(type);
|
loaded.add(type);
|
||||||
}
|
}
|
||||||
@ -428,7 +489,7 @@ public class VersionMapping {
|
|||||||
loadEntityMapping(mod, parent, fullModData);
|
loadEntityMapping(mod, parent, fullModData);
|
||||||
}
|
}
|
||||||
|
|
||||||
metaDataIndexOffset += entityMetaIndexOffsetParentMapping.get(parent).getValue();
|
metaDataIndexOffset += entityMetaIndexOffsetParentMapping.get(parent).value;
|
||||||
}
|
}
|
||||||
// meta data index
|
// meta data index
|
||||||
if (data.has("data")) {
|
if (data.has("data")) {
|
||||||
|
@ -157,12 +157,12 @@ public class WorldRenderer {
|
|||||||
yield nibbleBlocks.get(new InChunkSectionLocation(location.getX(), location.getY(), location.getZ() + 1));
|
yield nibbleBlocks.get(new InChunkSectionLocation(location.getX(), location.getY(), location.getZ() + 1));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (dependedBlock == null || !BlockModelLoader.getInstance().isFull(dependedBlock, FaceOrientation.inverse(orientation))) {
|
if (dependedBlock == null || !connection.getMapping().isBlockFull(dependedBlock, FaceOrientation.inverse(orientation))) {
|
||||||
facesToDraw.add(orientation);
|
facesToDraw.add(orientation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!facesToDraw.isEmpty()) {
|
if (!facesToDraw.isEmpty()) {
|
||||||
nibbleMap.addAll(BlockModelLoader.getInstance().prepare(block, facesToDraw, new BlockPosition(chunkLocation, sectionHeight, location)));
|
nibbleMap.addAll(connection.getMapping().prepareBlock(block, facesToDraw, new BlockPosition(chunkLocation, sectionHeight, location)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return nibbleMap;
|
return nibbleMap;
|
||||||
@ -171,7 +171,7 @@ public class WorldRenderer {
|
|||||||
|
|
||||||
public void draw() {
|
public void draw() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glBindTexture(GL_TEXTURE_2D, BlockModelLoader.getInstance().getTextureLoader().getTextureID());
|
glBindTexture(GL_TEXTURE_2D, connection.getMapping().getBlockTextureId());
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
for (ConcurrentHashMap<Byte, ArrayFloatList> chunk : faces.values()) {
|
for (ConcurrentHashMap<Byte, ArrayFloatList> chunk : faces.values()) {
|
||||||
for (ArrayFloatList nibble : chunk.values()) {
|
for (ArrayFloatList nibble : chunk.values()) {
|
||||||
|
@ -22,6 +22,7 @@ import de.bixilon.minosoft.data.world.BlockPosition;
|
|||||||
import de.bixilon.minosoft.render.blockModels.Face.FaceOrientation;
|
import de.bixilon.minosoft.render.blockModels.Face.FaceOrientation;
|
||||||
import de.bixilon.minosoft.render.blockModels.subBlocks.SubBlock;
|
import de.bixilon.minosoft.render.blockModels.subBlocks.SubBlock;
|
||||||
import de.bixilon.minosoft.render.texture.TextureLoader;
|
import de.bixilon.minosoft.render.texture.TextureLoader;
|
||||||
|
import de.bixilon.minosoft.util.Pair;
|
||||||
import de.bixilon.minosoft.util.Util;
|
import de.bixilon.minosoft.util.Util;
|
||||||
import org.apache.commons.collections.primitives.ArrayFloatList;
|
import org.apache.commons.collections.primitives.ArrayFloatList;
|
||||||
|
|
||||||
@ -31,11 +32,13 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class BlockModelLoader {
|
public class BlockModelLoader {
|
||||||
private final TextureLoader textureLoader;
|
/**
|
||||||
private final HashMap<String, HashMap<String, BlockModelInterface>> modelMap;
|
*
|
||||||
|
* @param data json file which describes all block models
|
||||||
public BlockModelLoader(JsonObject data) {
|
* @return blockModels, textureID
|
||||||
modelMap = new HashMap<>();
|
*/
|
||||||
|
public static Pair<HashMap<String, HashMap<String, BlockModelInterface>>, Integer> load(JsonObject data) {
|
||||||
|
HashMap<String, HashMap<String, BlockModelInterface>> modelMap = new HashMap<>();
|
||||||
HashSet<JsonObject> mods = new HashSet<>();
|
HashSet<JsonObject> mods = new HashSet<>();
|
||||||
mods.add(data);
|
mods.add(data);
|
||||||
HashMap<String, float[]> tints = null;
|
HashMap<String, float[]> tints = null;
|
||||||
@ -52,14 +55,15 @@ public class BlockModelLoader {
|
|||||||
}
|
}
|
||||||
blockModels.put(modName, loadModels(mod));
|
blockModels.put(modName, loadModels(mod));
|
||||||
}
|
}
|
||||||
textureLoader = new TextureLoader(getTextures(blockModels), tints);
|
TextureLoader textureLoader = new TextureLoader(getTextures(blockModels), tints);
|
||||||
applyTextures(blockModels);
|
applyTextures(modelMap, blockModels, textureLoader);
|
||||||
for (JsonObject mod : mods) {
|
for (JsonObject mod : mods) {
|
||||||
loadBlocks(mod, blockModels.get(mod.get("mod").getAsString()));
|
loadBlocks(modelMap, mod, blockModels.get(mod.get("mod").getAsString()));
|
||||||
}
|
}
|
||||||
|
return new Pair<>(modelMap, textureLoader.getTextureID());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadBlocks(JsonObject mod, HashMap<String, HashSet<SubBlock>> blockModels) {
|
private static void loadBlocks(HashMap<String, HashMap<String, BlockModelInterface>> modelMap, JsonObject mod, HashMap<String, HashSet<SubBlock>> blockModels) {
|
||||||
for (Map.Entry<String, JsonElement> blockEntry : mod.get("blockStates").getAsJsonObject().entrySet()) {
|
for (Map.Entry<String, JsonElement> blockEntry : mod.get("blockStates").getAsJsonObject().entrySet()) {
|
||||||
JsonObject block = blockEntry.getValue().getAsJsonObject();
|
JsonObject block = blockEntry.getValue().getAsJsonObject();
|
||||||
if (block.has("states")) {
|
if (block.has("states")) {
|
||||||
@ -71,7 +75,7 @@ public class BlockModelLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, HashSet<SubBlock>> loadModels(JsonObject mod) {
|
private static HashMap<String, HashSet<SubBlock>> loadModels(JsonObject mod) {
|
||||||
HashMap<String, HashSet<SubBlock>> modMap = new HashMap<>();
|
HashMap<String, HashSet<SubBlock>> modMap = new HashMap<>();
|
||||||
for (Map.Entry<String, JsonElement> block : mod.getAsJsonObject("blockModels").entrySet()) {
|
for (Map.Entry<String, JsonElement> block : mod.getAsJsonObject("blockModels").entrySet()) {
|
||||||
modMap.put(block.getKey(), BlockModelInterface.load(block.getValue().getAsJsonObject(), mod.getAsJsonObject("blockModels")));
|
modMap.put(block.getKey(), BlockModelInterface.load(block.getValue().getAsJsonObject(), mod.getAsJsonObject("blockModels")));
|
||||||
@ -79,7 +83,7 @@ public class BlockModelLoader {
|
|||||||
return modMap;
|
return modMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, HashSet<String>> getTextures(HashMap<String, HashMap<String, HashSet<SubBlock>>> blockModels) {
|
public static HashMap<String, HashSet<String>> getTextures(HashMap<String, HashMap<String, HashSet<SubBlock>>> blockModels) {
|
||||||
HashMap<String, HashSet<String>> textures = new HashMap<>();
|
HashMap<String, HashSet<String>> textures = new HashMap<>();
|
||||||
for (Map.Entry<String, HashMap<String, HashSet<SubBlock>>> mod : blockModels.entrySet()) {
|
for (Map.Entry<String, HashMap<String, HashSet<SubBlock>>> mod : blockModels.entrySet()) {
|
||||||
HashSet<String> modTextures = new HashSet<>();
|
HashSet<String> modTextures = new HashSet<>();
|
||||||
@ -93,7 +97,7 @@ public class BlockModelLoader {
|
|||||||
return textures;
|
return textures;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyTextures(HashMap<String, HashMap<String, HashSet<SubBlock>>> blockModels) {
|
public static void applyTextures(HashMap<String, HashMap<String, BlockModelInterface>> modelMap, HashMap<String, HashMap<String, HashSet<SubBlock>>> blockModels, TextureLoader textureLoader) {
|
||||||
for (Map.Entry<String, HashMap<String, HashSet<SubBlock>>> mod : blockModels.entrySet()) {
|
for (Map.Entry<String, HashMap<String, HashSet<SubBlock>>> mod : blockModels.entrySet()) {
|
||||||
for (Map.Entry<String, HashSet<SubBlock>> block : mod.getValue().entrySet()) {
|
for (Map.Entry<String, HashSet<SubBlock>> block : mod.getValue().entrySet()) {
|
||||||
for (SubBlock subBlock : block.getValue()) {
|
for (SubBlock subBlock : block.getValue()) {
|
||||||
@ -103,7 +107,7 @@ public class BlockModelLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, float[]> readTints(JsonObject json) {
|
private static HashMap<String, float[]> readTints(JsonObject json) {
|
||||||
HashMap<String, float[]> result = new HashMap<>();
|
HashMap<String, float[]> result = new HashMap<>();
|
||||||
if (json.has("tinted_textures")) {
|
if (json.has("tinted_textures")) {
|
||||||
JsonObject textures = json.get("tinted_textures").getAsJsonObject();
|
JsonObject textures = json.get("tinted_textures").getAsJsonObject();
|
||||||
@ -118,35 +122,4 @@ public class BlockModelLoader {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockModelInterface getBlockModel(Block block) {
|
|
||||||
BlockModelInterface model = modelMap.get(block.getMod()).get(block.getIdentifier());
|
|
||||||
if (model == null) {
|
|
||||||
throw new RuntimeException(String.format("Block model for could not be found: %s", block));
|
|
||||||
}
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFull(Block block, FaceOrientation orientation) {
|
|
||||||
if (block == null || block.equals(Blocks.nullBlock)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return getBlockModel(block).full(block, orientation);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFull(Block block) {
|
|
||||||
return block != null && !block.equals(Blocks.nullBlock);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayFloatList prepare(Block block, HashSet<FaceOrientation> facesToDraw, BlockPosition position) {
|
|
||||||
return getBlockModel(block).prepare(facesToDraw, position, block);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TextureLoader getTextureLoader() {
|
|
||||||
return textureLoader;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
modelMap.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SubBlock {
|
public class SubBlock {
|
||||||
private final HashMap<FaceOrientation, Float> textureCoordinates;
|
|
||||||
private HashMap<FaceOrientation, String> textures;
|
private HashMap<FaceOrientation, String> textures;
|
||||||
private final HashMap<FaceOrientation, Integer> textureRotations;
|
private final HashMap<FaceOrientation, Integer> textureRotations;
|
||||||
private final boolean[] full;
|
private final boolean[] full;
|
||||||
@ -38,7 +37,6 @@ public class SubBlock {
|
|||||||
uv = new HashMap<>();
|
uv = new HashMap<>();
|
||||||
textures = new HashMap<>();
|
textures = new HashMap<>();
|
||||||
textureRotations = new HashMap<>();
|
textureRotations = new HashMap<>();
|
||||||
textureCoordinates = new HashMap<>();
|
|
||||||
|
|
||||||
SubBlockPosition from = new SubBlockPosition(json.getAsJsonArray("from"));
|
SubBlockPosition from = new SubBlockPosition(json.getAsJsonArray("from"));
|
||||||
SubBlockPosition to = new SubBlockPosition(json.getAsJsonArray("to"));
|
SubBlockPosition to = new SubBlockPosition(json.getAsJsonArray("to"));
|
||||||
@ -57,7 +55,6 @@ public class SubBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SubBlock(SubBlock subBlock) {
|
public SubBlock(SubBlock subBlock) {
|
||||||
textureCoordinates = subBlock.textureCoordinates;
|
|
||||||
textureRotations = subBlock.textureRotations;
|
textureRotations = subBlock.textureRotations;
|
||||||
uv = subBlock.uv;
|
uv = subBlock.uv;
|
||||||
cuboid = new Cuboid(subBlock.cuboid);
|
cuboid = new Cuboid(subBlock.cuboid);
|
||||||
@ -94,7 +91,7 @@ public class SubBlock {
|
|||||||
if (texture == -1) {
|
if (texture == -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
textureCoordinates.put(entry.getKey(), texture);
|
uv.get(entry.getKey()).prepare(texture, loader);
|
||||||
}
|
}
|
||||||
// clean up
|
// clean up
|
||||||
textures.clear();
|
textures.clear();
|
||||||
@ -132,13 +129,12 @@ public class SubBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ArrayFloatList prepareFace(FaceOrientation faceDirection, BlockPosition position) {
|
private ArrayFloatList prepareFace(FaceOrientation faceDirection, BlockPosition position) {
|
||||||
if (!textureCoordinates.containsKey(faceDirection)) {
|
if (! uv.get(faceDirection).exists()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ArrayFloatList result = new ArrayFloatList();
|
ArrayFloatList result = new ArrayFloatList();
|
||||||
SubBlockPosition[] positions = cuboid.getFacePositions(faceDirection);
|
SubBlockPosition[] positions = cuboid.getFacePositions(faceDirection);
|
||||||
InFaceUV inFaceUV = uv.get(faceDirection);
|
InFaceUV inFaceUV = uv.get(faceDirection);
|
||||||
inFaceUV.prepare(textureCoordinates.get(faceDirection));
|
|
||||||
int rotation = textureRotations.get(faceDirection);
|
int rotation = textureRotations.get(faceDirection);
|
||||||
for (int i = 0; i < positions.length; i++) {
|
for (int i = 0; i < positions.length; i++) {
|
||||||
result.addAll(inFaceUV.getFloats(i + rotation));
|
result.addAll(inFaceUV.getFloats(i + rotation));
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.render.movement;
|
package de.bixilon.minosoft.render.movement;
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.data.mappings.versions.VersionMapping;
|
||||||
import de.bixilon.minosoft.data.world.BlockPosition;
|
import de.bixilon.minosoft.data.world.BlockPosition;
|
||||||
import de.bixilon.minosoft.data.world.World;
|
import de.bixilon.minosoft.data.world.World;
|
||||||
import de.bixilon.minosoft.protocol.network.Connection;
|
import de.bixilon.minosoft.protocol.network.Connection;
|
||||||
@ -23,10 +24,12 @@ import de.bixilon.minosoft.render.utility.Vec3;
|
|||||||
public class CollisionHandler {
|
public class CollisionHandler {
|
||||||
private final World world;
|
private final World world;
|
||||||
private final PlayerController controller;
|
private final PlayerController controller;
|
||||||
|
private final VersionMapping versionMapping;
|
||||||
|
|
||||||
public CollisionHandler(Connection connection) {
|
public CollisionHandler(Connection connection) {
|
||||||
world = connection.getPlayer().getWorld();
|
world = connection.getPlayer().getWorld();
|
||||||
this.controller = connection.getRenderProperties().getController();
|
this.controller = connection.getRenderProperties().getController();
|
||||||
|
this.versionMapping = connection.getMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleCollisions() {
|
public void handleCollisions() {
|
||||||
@ -90,16 +93,14 @@ public class CollisionHandler {
|
|||||||
float width = controller.getPlayerWidth();
|
float width = controller.getPlayerWidth();
|
||||||
|
|
||||||
int[] xPositions = AdditionalMath.valuesBetween(AdditionalMath.betterRound(testPosition.x + width), AdditionalMath.betterRound(testPosition.x - width));
|
int[] xPositions = AdditionalMath.valuesBetween(AdditionalMath.betterRound(testPosition.x + width), AdditionalMath.betterRound(testPosition.x - width));
|
||||||
|
|
||||||
int[] yPositions = AdditionalMath.valuesBetween(AdditionalMath.betterRound(testPosition.y), AdditionalMath.betterRound(testPosition.y + controller.getPlayerHeight()));
|
int[] yPositions = AdditionalMath.valuesBetween(AdditionalMath.betterRound(testPosition.y), AdditionalMath.betterRound(testPosition.y + controller.getPlayerHeight()));
|
||||||
|
|
||||||
int[] zPositions = AdditionalMath.valuesBetween(AdditionalMath.betterRound(testPosition.z + width), AdditionalMath.betterRound(testPosition.z - width));
|
int[] zPositions = AdditionalMath.valuesBetween(AdditionalMath.betterRound(testPosition.z + width), AdditionalMath.betterRound(testPosition.z - width));
|
||||||
|
|
||||||
for (int xPos : xPositions) {
|
for (int xPos : xPositions) {
|
||||||
for (int yPos : yPositions) {
|
for (int yPos : yPositions) {
|
||||||
for (int zPos : zPositions) {
|
for (int zPos : zPositions) {
|
||||||
BlockPosition pos = new BlockPosition(xPos, (short) yPos, zPos);
|
BlockPosition pos = new BlockPosition(xPos, (short) yPos, zPos);
|
||||||
if (BlockModelLoader.getInstance().isFull(world.getBlock(pos))) {
|
if (versionMapping.isBlockFull(world.getBlock(pos))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import org.apache.commons.collections.primitives.ArrayFloatList;
|
|||||||
public class InFaceUV {
|
public class InFaceUV {
|
||||||
public final int u1, v1, u2, v2;
|
public final int u1, v1, u2, v2;
|
||||||
|
|
||||||
public float realU1, realV1, realU2, realV2;
|
public float realU1 = -1, realV1, realU2, realV2;
|
||||||
|
|
||||||
public InFaceUV(JsonArray json) {
|
public InFaceUV(JsonArray json) {
|
||||||
u1 = json.get(0).getAsInt();
|
u1 = json.get(0).getAsInt();
|
||||||
@ -35,9 +35,9 @@ public class InFaceUV {
|
|||||||
u2 = v2 = 16;
|
u2 = v2 = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepare(float texture) {
|
public void prepare(float texture, TextureLoader textureLoader) {
|
||||||
realU1 = texture + u1 * BlockModelLoader.getInstance().getTextureLoader().getStep() / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
realU1 = texture + u1 * textureLoader.getStep() / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
||||||
realU2 = texture + u2 * BlockModelLoader.getInstance().getTextureLoader().getStep() / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
realU2 = texture + u2 * textureLoader.getStep() / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
||||||
realV1 = (float) v1 / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
realV1 = (float) v1 / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
||||||
realV2 = (float) v2 / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
realV2 = (float) v2 / RenderConstants.TEXTURE_PACK_RESOLUTION;
|
||||||
}
|
}
|
||||||
@ -71,4 +71,8 @@ public class InFaceUV {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean exists() {
|
||||||
|
return realU1 == -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@ public class AdditionalMath {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int betterRound(double x) {
|
public static int betterRound(double value) {
|
||||||
if (x >= 0) {
|
if (value >= 0) {
|
||||||
return (int) x;
|
return (int) value;
|
||||||
}
|
}
|
||||||
return (int) x - 1;
|
return (int) value - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
112
util/.idea/workspace.xml
generated
112
util/.idea/workspace.xml
generated
@ -2,13 +2,16 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="34edf7e9-254a-4d39-b77b-418e1a3041e3" name="Default Changelist" comment="">
|
<list default="true" id="34edf7e9-254a-4d39-b77b-418e1a3041e3" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/.gitignore" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/data/mappings/versions/VersionMapping.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/data/mappings/versions/VersionMapping.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/WorldRenderer.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/WorldRenderer.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/blockModels/BlockModelLoader.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/blockModels/BlockModelLoader.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/blockModels/subBlocks/SubBlock.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/blockModels/subBlocks/SubBlock.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/movement/CollisionHandler.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/movement/CollisionHandler.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/texture/InFaceUV.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/texture/InFaceUV.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/mappingsDownloader.py" beforeDir="false" afterPath="$PROJECT_DIR$/mappingsDownloader.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/utility/AdditionalMath.java" beforeDir="false" afterPath="$PROJECT_DIR$/../src/main/java/de/bixilon/minosoft/render/utility/AdditionalMath.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/blockModelCombinder.py" beforeDir="false" afterPath="$PROJECT_DIR$/blockModelGenerator.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/version_mappings_generator.py" beforeDir="false" afterPath="$PROJECT_DIR$/version_mappings_generator.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -43,6 +46,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||||
|
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
||||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
<property name="android.sdk.path" value="/opt/AndroidSDK" />
|
<property name="android.sdk.path" value="/opt/AndroidSDK" />
|
||||||
<property name="aspect.path.notification.shown" value="true" />
|
<property name="aspect.path.notification.shown" value="true" />
|
||||||
@ -52,7 +56,7 @@
|
|||||||
<property name="project.structure.side.proportion" value="0.2" />
|
<property name="project.structure.side.proportion" value="0.2" />
|
||||||
<property name="settings.editor.selected.configurable" value="AndroidSdkUpdater" />
|
<property name="settings.editor.selected.configurable" value="AndroidSdkUpdater" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager" selected="Python.version_mappings_generator">
|
||||||
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
|
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
|
||||||
<option name="arquillianRunConfiguration">
|
<option name="arquillianRunConfiguration">
|
||||||
<value>
|
<value>
|
||||||
@ -86,13 +90,38 @@
|
|||||||
<option name="INPUT_FILE" value="" />
|
<option name="INPUT_FILE" value="" />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration name="version_mappings_generator" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="util" />
|
||||||
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
|
<option name="PARENT_ENVS" value="true" />
|
||||||
|
<envs>
|
||||||
|
<env name="PYTHONUNBUFFERED" value="1" />
|
||||||
|
</envs>
|
||||||
|
<option name="SDK_HOME" value="" />
|
||||||
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
|
<option name="IS_MODULE_SDK" value="true" />
|
||||||
|
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||||
|
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||||
|
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/version_mappings_generator.py" />
|
||||||
|
<option name="PARAMETERS" value="" />
|
||||||
|
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||||
|
<option name="EMULATE_TERMINAL" value="false" />
|
||||||
|
<option name="MODULE_MODE" value="false" />
|
||||||
|
<option name="REDIRECT_INPUT" value="false" />
|
||||||
|
<option name="INPUT_FILE" value="" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="Python.version_mappings_generator" />
|
||||||
<item itemvalue="Python.mappingsDownloader" />
|
<item itemvalue="Python.mappingsDownloader" />
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
<component name="SpellCheckerSettings" BundledDictionaries="0" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" Dictionaries="0" CorrectionsLimit="5" DefaultDictionary="application-level" UseSingleDictionary="true" />
|
||||||
|
<component name="SvnConfiguration">
|
||||||
|
<configuration />
|
||||||
|
</component>
|
||||||
<component name="TaskManager">
|
<component name="TaskManager">
|
||||||
<task active="true" id="Default" summary="Default task">
|
<task active="true" id="Default" summary="Default task">
|
||||||
<changelist id="34edf7e9-254a-4d39-b77b-418e1a3041e3" name="Default Changelist" comment="" />
|
<changelist id="34edf7e9-254a-4d39-b77b-418e1a3041e3" name="Default Changelist" comment="" />
|
||||||
@ -107,6 +136,17 @@
|
|||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
<option name="version" value="3" />
|
<option name="version" value="3" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
<option name="TAB_STATES">
|
||||||
|
<map>
|
||||||
|
<entry key="MAIN">
|
||||||
|
<value>
|
||||||
|
<State />
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="WindowStateProjectService">
|
<component name="WindowStateProjectService">
|
||||||
<state x="444" y="1168" key="#Project_Structure" timestamp="1605462076420">
|
<state x="444" y="1168" key="#Project_Structure" timestamp="1605462076420">
|
||||||
<screen x="0" y="1050" width="1920" height="1080" />
|
<screen x="0" y="1050" width="1920" height="1080" />
|
||||||
@ -116,28 +156,60 @@
|
|||||||
<screen x="0" y="1050" width="1920" height="1080" />
|
<screen x="0" y="1050" width="1920" height="1080" />
|
||||||
</state>
|
</state>
|
||||||
<state x="419" y="1248" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462499568" />
|
<state x="419" y="1248" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462499568" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.bottom" timestamp="1605462580595">
|
<state width="1259" height="329" key="GridCell.Tab.0.bottom" timestamp="1605648137613">
|
||||||
<screen x="0" y="1050" width="1920" height="1080" />
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.0.bottom/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648137613" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.bottom/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
<state width="1874" height="281" key="GridCell.Tab.0.bottom/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.center" timestamp="1605462580595">
|
<state width="1259" height="329" key="GridCell.Tab.0.center" timestamp="1605648137613">
|
||||||
<screen x="0" y="1050" width="1920" height="1080" />
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.0.center/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648137613" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.center/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
<state width="1874" height="281" key="GridCell.Tab.0.center/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.left" timestamp="1605462580595">
|
<state width="1259" height="329" key="GridCell.Tab.0.left" timestamp="1605648137613">
|
||||||
<screen x="0" y="1050" width="1920" height="1080" />
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.0.left/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648137613" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.left/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
<state width="1874" height="281" key="GridCell.Tab.0.left/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.right" timestamp="1605462580595">
|
<state width="1259" height="329" key="GridCell.Tab.0.right" timestamp="1605648137613">
|
||||||
<screen x="0" y="1050" width="1920" height="1080" />
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
</state>
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.0.right/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648137613" />
|
||||||
<state width="1874" height="281" key="GridCell.Tab.0.right/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
<state width="1874" height="281" key="GridCell.Tab.0.right/0.40.1680.1010/0.1050.1920.1080/1680.26.1280.1024@0.1050.1920.1080" timestamp="1605462580595" />
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.bottom" timestamp="1605648130133">
|
||||||
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.bottom/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648130133" />
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.center" timestamp="1605648130133">
|
||||||
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.center/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648130133" />
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.left" timestamp="1605648130133">
|
||||||
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.left/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648130133" />
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.right" timestamp="1605648130133">
|
||||||
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
|
</state>
|
||||||
|
<state width="1259" height="329" key="GridCell.Tab.1.right/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605648130133" />
|
||||||
|
<state x="177" y="226" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2" timestamp="1605647956189">
|
||||||
|
<screen x="0" y="0" width="1280" height="994" />
|
||||||
|
</state>
|
||||||
|
<state x="177" y="226" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2/-1360.107.1360.738/0.0.1280.994@0.0.1280.994" timestamp="1605647956189" />
|
||||||
|
</component>
|
||||||
|
<component name="XDebuggerManager">
|
||||||
|
<breakpoint-manager>
|
||||||
|
<breakpoints>
|
||||||
|
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
|
||||||
|
<url>file://$PROJECT_DIR$/version_mappings_generator.py</url>
|
||||||
|
<line>281</line>
|
||||||
|
<option name="timeStamp" value="1" />
|
||||||
|
</line-breakpoint>
|
||||||
|
</breakpoints>
|
||||||
|
</breakpoint-manager>
|
||||||
</component>
|
</component>
|
||||||
<component name="XSLT-Support.FileAssociations.UIState">
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
<expand />
|
<expand />
|
||||||
<select />
|
<select />
|
||||||
</component>
|
</component>
|
||||||
<component name="com.intellij.coverage.CoverageDataManagerImpl">
|
|
||||||
<SUITE FILE_PATH="coverage/util$mappingsDownloader.coverage" NAME="mappingsDownloader Coverage Results" MODIFIED="1605462580588" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
</project>
|
</project>
|
@ -1,13 +1,5 @@
|
|||||||
# minosoft
|
# minosoft
|
||||||
# Copyright (C) 2020 Moritz Zwerger
|
# Copyright (C) 2020 Lukas Eisenhauer
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
#
|
||||||
# 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 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.
|
||||||
#
|
#
|
||||||
@ -17,21 +9,14 @@
|
|||||||
#
|
#
|
||||||
# This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
# This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||||
|
|
||||||
import \
|
import io
|
||||||
io
|
import requests
|
||||||
import \
|
import sys
|
||||||
requests
|
import ujson
|
||||||
import \
|
import zipfile
|
||||||
sys
|
|
||||||
import \
|
|
||||||
ujson
|
|
||||||
import \
|
|
||||||
zipfile
|
|
||||||
|
|
||||||
if len(
|
if len(sys.argv) != 3:
|
||||||
sys.argv) != 2:
|
print("Usage: %s <destination path> <jar url>".format(
|
||||||
print(
|
|
||||||
"useage: %s <jar url>".format(
|
|
||||||
sys.argv[
|
sys.argv[
|
||||||
0]))
|
0]))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
@ -44,10 +29,7 @@ modName = "minecraft"
|
|||||||
print(
|
print(
|
||||||
"Downloading minecraft jar...")
|
"Downloading minecraft jar...")
|
||||||
|
|
||||||
request = requests.get(
|
request = requests.get(sys.argv[2], allow_redirects=True)
|
||||||
sys.argv[
|
|
||||||
1],
|
|
||||||
allow_redirects=True)
|
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"Unpacking minecraft jar...")
|
"Unpacking minecraft jar...")
|
||||||
@ -196,17 +178,10 @@ finalJson = {
|
|||||||
"blockModels": blockModels,
|
"blockModels": blockModels,
|
||||||
}
|
}
|
||||||
|
|
||||||
print(
|
print("Saving...")
|
||||||
"Saving...")
|
with open(sys.argv[1], "w+") as file:
|
||||||
with open(
|
finalJson = ujson.dumps(finalJson)
|
||||||
"../../../AppData/Roaming/Minosoft/assets/assets/blockModels.json",
|
file.write(finalJson.replace("minecraft:", ""))
|
||||||
"w+") as file:
|
|
||||||
finalJson = ujson.dumps(
|
|
||||||
finalJson)
|
|
||||||
file.write(
|
|
||||||
finalJson.replace(
|
|
||||||
"minecraft:",
|
|
||||||
""))
|
|
||||||
|
|
||||||
print(
|
print(
|
||||||
"Finished succesfully")
|
"Finished successfully")
|
@ -277,9 +277,9 @@ for version in VERSION_MANIFEST["versions"]:
|
|||||||
# save to file
|
# save to file
|
||||||
with open(versionTempBaseFolder + "entities.json", 'w') as file:
|
with open(versionTempBaseFolder + "entities.json", 'w') as file:
|
||||||
file.write(ujson.dumps({"minecraft": entities}))
|
file.write(ujson.dumps({"minecraft": entities}))
|
||||||
elif fileName == "blockModels.json":
|
elif fileName == "block_models.json":
|
||||||
# blockModelsCombiner.py will do the trick for us
|
# blockModelsCombiner.py will do the trick for us
|
||||||
os.popen('python3 blockModelGenerator.py %s %s' % (versionTempBaseFolder + "block_models.json", versionJson['downloads']['client']['url'])).read()
|
os.popen('python blockModelGenerator.py %s %s' % (versionTempBaseFolder + "block_models.json", versionJson['downloads']['client']['url'])).read()
|
||||||
continue
|
continue
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user