From c4f3c25d2aa944a003899ab7b7009069abe95959 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 5 Aug 2020 22:35:17 +0200 Subject: [PATCH] new block loading system v2 wip1 --- .../bixilon/minosoft/render/MainWindow.java | 8 +- .../blockModels/BlockConfiguration.java | 70 ++++ .../render/blockModels/BlockDescription.java | 67 ++-- .../render/blockModels/BlockModelLoader.java | 363 ++---------------- .../render/texture/TextureLoader.java | 40 +- .../assets/mapping/blockModels/minecraft.json | 59 +++ 6 files changed, 199 insertions(+), 408 deletions(-) create mode 100644 src/main/java/de/bixilon/minosoft/render/blockModels/BlockConfiguration.java create mode 100644 src/main/resources/assets/mapping/blockModels/minecraft.json diff --git a/src/main/java/de/bixilon/minosoft/render/MainWindow.java b/src/main/java/de/bixilon/minosoft/render/MainWindow.java index b07a4a8e8..f1428a4cd 100644 --- a/src/main/java/de/bixilon/minosoft/render/MainWindow.java +++ b/src/main/java/de/bixilon/minosoft/render/MainWindow.java @@ -100,10 +100,8 @@ public class MainWindow { public static void pause() { renderMode = MAIN_MENU; glfwSetInputMode(openGLWindow.getWindow(), GLFW_CURSOR, GLFW_CURSOR_NORMAL); - try { - connection.disconnect(); - } catch (Exception ignored) { - } + assert connection != null; + connection.disconnect(); } public static Connection getConnection() { @@ -111,7 +109,7 @@ public class MainWindow { } public static void close() { - System.exit(1); + //System.exit(0); } public static PlayerController getPlayerController() { diff --git a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockConfiguration.java b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockConfiguration.java new file mode 100644 index 000000000..2e7a8778a --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockConfiguration.java @@ -0,0 +1,70 @@ +/* + * Codename Minosoft + * 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 . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.render.blockModels; + +import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Block; +import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.BlockProperties; +import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.BlockRotation; + +import java.util.HashSet; + +public class BlockConfiguration { + HashSet rotations; + HashSet blockProperties; + + public BlockConfiguration(String config) { + rotations = new HashSet<>(); + blockProperties = new HashSet<>(); + for (String configuration : config.split(",")) { + switch (configuration) { + case "orientation:vertical": + rotations.add(BlockRotation.UP); + rotations.add(BlockRotation.DOWN); + break; + case "orientation:up": + rotations.add(BlockRotation.UP); + break; + case "orientation:down": + rotations.add(BlockRotation.DOWN); + break; + } + } + } + + public HashSet getRotations() { + return rotations; + } + + public HashSet getBlockProperties() { + return blockProperties; + } + + public boolean equals(BlockConfiguration blockConfiguration) { + return rotations.equals(blockConfiguration.getRotations()) && + blockProperties.equals(blockConfiguration.getBlockProperties()); + } + + public boolean contains(Block block) { + if (!rotations.contains(block.getRotation()) && block.getRotation() != BlockRotation.NONE) { + return false; + } + + for (BlockProperties property : blockProperties) { + if (!block.getProperties().contains(property)) { + return false; + } + } + return true; + } +} diff --git a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockDescription.java b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockDescription.java index ff2563c81..edba88f86 100644 --- a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockDescription.java +++ b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockDescription.java @@ -1,6 +1,6 @@ /* * Codename 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. * @@ -16,6 +16,7 @@ package de.bixilon.minosoft.render.blockModels; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import de.bixilon.minosoft.Config; +import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Block; import de.bixilon.minosoft.render.fullFace.FaceOrientation; import java.io.IOException; @@ -25,15 +26,43 @@ import java.util.HashSet; import static de.bixilon.minosoft.util.Util.readJsonFromFile; public class BlockDescription { - HashSet subBlocks; + HashSet defaultState; + HashMap> blockConfigurationStates; boolean isFull; - public BlockDescription(JsonObject json, HashMap variables) { - subBlocks = new HashSet<>(); - if (!json.has("textures")) { - //throw new IllegalArgumentException("could not find 'textures' in json"); + public BlockDescription(JsonElement child, String identifier, String mod) { + if (child.getAsString().equals("invisible")) { + return; + } else if (child.getAsString().equals("regular")) { + defaultState = load(mod, identifier, new HashMap<>()); + } else { + JsonObject childJson = child.getAsJsonObject(); + for (String state : childJson.keySet()) { + if (state.equals("else")) { + defaultState = load(mod, childJson.get("else").getAsString(), new HashMap<>()); + } + blockConfigurationStates.put(new BlockConfiguration(state), + load(mod, childJson.get(state).getAsString())); + } } + for (SubBlock subBlock : defaultState) { + if (subBlock.isFull()) { + isFull = true; + } + } + } + + public static HashSet load(String mod, String identifier, HashMap variables) { + String path = Config.homeDir + "assets/" + mod + "/models/block/" + identifier + ".json"; + JsonObject json = null; try { + json = readJsonFromFile(path); + } catch (IOException e) { + e.printStackTrace(); + } + HashSet result = new HashSet<>(); + try { + // read the textures into a variable hashmap JsonObject textures = json.getAsJsonObject("textures"); for (String texture : textures.keySet()) { if (texture.contains("#") && variables.containsKey(texture)) { @@ -43,42 +72,32 @@ public class BlockDescription { } } } catch (Exception ignored) { - } if (json.has("elements")) { for (JsonElement subBlockJson : json.get("elements").getAsJsonArray()) { - subBlocks.add(new SubBlock(subBlockJson.getAsJsonObject(), variables)); + result.add(new SubBlock(subBlockJson.getAsJsonObject(), variables)); } } else if (json.has("parent") && !json.get("parent").getAsString().equals("block/block")) { String parent = json.get("parent").getAsString(); - String path = Config.homeDir + "assets/minecraft/models/" + parent + ".json"; - try { - subBlocks.addAll(new BlockDescription(readJsonFromFile(path), variables).subBlocks); - } catch (IOException e) { - e.printStackTrace(); - } + String parentIdentifier = parent.substring(parent.lastIndexOf("/") + 1); + result.addAll(load(mod, parentIdentifier, variables)); } else { throw new IllegalArgumentException("json does not have a parent nor subblocks"); } - - for (SubBlock subBlock : subBlocks) { - if (subBlock.isFull()) { - isFull = true; - } - } + return result; } - public BlockDescription(JsonObject json) { - this(json, new HashMap<>()); + private HashSet load(String mod, String identifier) { + return load(mod, identifier, new HashMap<>()); } public boolean isFull() { return isFull; } - public HashSet prepare(HashMap adjacentBlocks) { + public HashSet prepare(Block block, HashMap adjacentBlocks) { HashSet result = new HashSet<>(); - for (SubBlock subBlock : subBlocks) { + for (SubBlock subBlock : defaultState) { result.addAll(subBlock.getFaces(adjacentBlocks)); } return result; diff --git a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModelLoader.java b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModelLoader.java index c50eb7dc0..e71ea9d81 100644 --- a/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModelLoader.java +++ b/src/main/java/de/bixilon/minosoft/render/blockModels/BlockModelLoader.java @@ -13,366 +13,52 @@ package de.bixilon.minosoft.render.blockModels; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import de.bixilon.minosoft.Config; import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Block; -import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.BlockProperties; import de.bixilon.minosoft.game.datatypes.objectLoader.blocks.Blocks; import de.bixilon.minosoft.logging.Log; import de.bixilon.minosoft.render.fullFace.FaceOrientation; +import java.io.File; import java.io.IOException; -import java.util.*; +import java.util.HashMap; +import java.util.HashSet; import static de.bixilon.minosoft.util.Util.readJsonFromFile; public class BlockModelLoader { - // a list of blocks not drawn by the world renderer - public static final List ignoredBlocks = new ArrayList<>(Arrays.asList( - "air", "cave_air", "void_air", "moving_piston", "shrub", "structure_void", "water", "lava", - //TODO - "chest", "trapped_chest", "oak_fence" - )); - public BlockModelLoader() { blockDescriptionMap = new HashMap<>(); - loadModels(); - } - - final HashMap> blockDescriptionMap; - - private void loadModels() { - for (Block block : Blocks.getBlockList()) { - String mod = block.getMod(); - String identifier = block.getIdentifier(); - - if (ignoredBlocks.contains(identifier)) { - continue; + try { + String folderPath = Config.homeDir + "assets/mapping/blockModels/"; + for (File file : new File(folderPath).listFiles()) { + JsonObject blockList = readJsonFromFile(file.getAbsolutePath()); + String mod = file.getName().substring(0, file.getName().lastIndexOf('.')); + loadModels(blockList, mod); } - - if (!blockDescriptionMap.containsKey(mod)) { - blockDescriptionMap.put(mod, new HashMap<>()); - } - - if (blockDescriptionMap.containsKey(mod + ":" + identifier)) { - continue; - } - - if (identifier.equals("silver_glazed_terracotta")) { - loadModel(mod, "light_gray_glazed_terracotta"); - continue; - } - if (identifier.equals("flower_upper_block")) { - // WHAT EVEN IS THIS BLOCK!?!?! - continue; - } - if (identifier.equals("bubble_column")) { - // handled with client side "particles" - continue; - } - if (identifier.equals("barrier")) { - // TODO: display barriers if setting is enabled - continue; - } - if (identifier.equals("end_portal") || identifier.equals("end_gateway")) { - // TODO: display end portals (the portal itself, not the frames - // probably with a shader - continue; - } - if (identifier.equals("structure_void")) { - // is not displayed - continue; - } - if (identifier.contains("infested")) { - // same block model as the not infested blocks - continue; - } - if (identifier.equals("conduit")) { - // shown as entity - continue; - } - if (identifier.equals("piston_extension")) { - // TODO: handle pistons - continue; - } - if (identifier.contains("skull") || identifier.contains("head")) { - // TODO: handle skulls - continue; - } - if (identifier.equals("water")) { - // TODO: handle water - continue; - } - if (identifier.equals("lava")) { - // TODO: handle lava - continue; - } - if (identifier.contains("chest")) { - // TODO: handle chests (trapped or not) - continue; - } - if (identifier.contains("banner")) { - // TODO: handle banners - continue; - } - if (identifier.contains("shulker_box")) { - // TODO: handle shulker_boxes - continue; - } - if (identifier.contains("sign")) { - // TODO: handle signs - continue; - } - if (identifier.equals("fire")) { - // TODO: handle fire - continue; - } - if (identifier.contains("tripwire_hook")) { - loadModel(mod, identifier); - loadModel(mod, identifier + "_attached"); - loadModel(mod, identifier + "_attached_on"); - loadModel(mod, identifier + "_on"); - continue; - } - if (identifier.contains("brewing_stand")) { - loadModel(mod, identifier); - for (int i = 0; i < 3; i++) { - loadModel(mod, identifier + "_bottle" + i); - loadModel(mod, identifier + "_empty" + i); - } - continue; - } - if (identifier.contains("daylight_detector")) { - loadModel(mod, identifier); - loadModel(mod, identifier + "_inverted"); - continue; - } - if (identifier.contains("lever")) { - loadModel(mod, identifier); - loadModel(mod, identifier + "_on"); - continue; - } - if (identifier.contains("comparator")) { - loadModel(mod, identifier); - loadModel(mod, identifier + "_on"); - loadModel(mod, identifier + "_on_subtract"); - loadModel(mod, identifier + "_subtract"); - continue; - } - if (identifier.contains("trapdoor")) { - loadModel(mod, identifier + "_bottom"); - loadModel(mod, identifier + "_open"); - loadModel(mod, identifier + "_top"); - continue; - } - if (identifier.contains("pane")) { - loadModel(mod, identifier + "_noside"); - loadModel(mod, identifier + "_noside_alt"); - loadModel(mod, identifier + "_Post"); - loadModel(mod, identifier + "_side"); - loadModel(mod, identifier + "_side_alt"); - continue; - } - if (identifier.equals("iron_bars")) { - loadModel(mod, identifier + "_cap"); - loadModel(mod, identifier + "_cap_alt"); - loadModel(mod, identifier + "_post"); - loadModel(mod, identifier + "_post_ends"); - loadModel(mod, identifier + "_side"); - loadModel(mod, identifier + "_side_alt"); - continue; - } - if (identifier.endsWith("bed") && !blockDescriptionMap.containsKey(mod + ":bed")) { - // TODO: handle beds - continue; - } - if (identifier.equals("vine")) { - loadModel(mod, identifier + "_1"); - loadModel(mod, identifier + "_1u"); - loadModel(mod, identifier + "_2"); - loadModel(mod, identifier + "_2u"); - loadModel(mod, identifier + "_2_opposite"); - loadModel(mod, identifier + "_2u_opposite"); - loadModel(mod, identifier + "_3"); - loadModel(mod, identifier + "_3u"); - loadModel(mod, identifier + "_4"); - loadModel(mod, identifier + "_4u"); - loadModel(mod, identifier + "_u"); - continue; - } - if (identifier.equals("tripwire")) { - loadModel(mod, identifier + "_attached_n"); - loadModel(mod, identifier + "_attached_ne"); - loadModel(mod, identifier + "_attached_ns"); - loadModel(mod, identifier + "_attached_nse"); - loadModel(mod, identifier + "_attached_nsew"); - continue; - } - if (identifier.equals("scaffolding")) { - loadModel(mod, identifier + "_stable"); - loadModel(mod, identifier + "_unstable"); - continue; - } - if (identifier.equals("bell")) { - loadModel(mod, identifier + "_between_walls"); - loadModel(mod, identifier + "_ceiling"); - loadModel(mod, identifier + "_floor"); - loadModel(mod, identifier + "_wall"); - continue; - } - if (identifier.equals("frosted_ice")) { - loadModel(mod, identifier + "_0"); - loadModel(mod, identifier + "_1"); - loadModel(mod, identifier + "_2"); - loadModel(mod, identifier + "_3"); - continue; - } - if (identifier.equals("redstone_wire")) { - loadModel(mod, "redstone_dust_dot"); - /* - loadModel(mod, "redstone_dust_side"); - loadModel(mod, "redstone_dust_side_alt"); - loadModel(mod, "redstone_dust_side_alt0"); - loadModel(mod, "redstone_dust_side_alt1"); - loadModel(mod, "redstone_dust_side0"); - loadModel(mod, "redstone_dust_side1"); - loadModel(mod, "redstone_dust_up"); - */ // throws error, can't find variable - continue; - } - if (identifier.equals("brown_mushroom_stem")) { - loadModel(mod, "brown_mushroom_block"); - continue; - } - if (identifier.equals("red_mushroom_stem")) { - loadModel(mod, "red_mushroom_block"); - continue; - } - if (identifier.equals("snow")) { - for (int height = 2; height < 16; height += 2) { - loadModel(mod, identifier + "_height" + height); - } - continue; - } - if (identifier.equals("bamboo")) { - loadModel(mod, identifier + "_large_leaves"); - loadModel(mod, identifier + "_sapling"); - loadModel(mod, identifier + "_small_leaves"); - for (int variation = 1; variation < 5; variation++) { - for (int age = 0; age < 2; age++) { - loadModel(mod, identifier + variation + "_age" + age); - } - } - continue; - } - if (identifier.equals("wheat")) { - for (int stage = 0; stage < 8; stage++) { - loadModel(mod, identifier + "_stage" + stage); - } - continue; - } - if (identifier.equals("potatoes") || identifier.equals("carrots") || - identifier.equals("beetroots") || identifier.equals("sweet_berry_bush")) { - for (int stage = 0; stage < 4; stage++) { - loadModel(mod, identifier + "_stage" + stage); - } - continue; - } - if (identifier.equals("nether_wart")) { - for (int stage = 0; stage < 3; stage++) { - loadModel(mod, identifier + "_stage" + stage); - } - continue; - } - if (identifier.equals("waterlily")) { - loadModel(mod, "lily_pad"); - continue; - } - if (identifier.equals("nether_brick")) { - loadModel(mod, "nether_bricks"); - continue; - } - if (identifier.equals("quartz_ore")) { - loadModel(mod, "nether_" + identifier); - continue; - } - if (identifier.contains("end_bricks")) { - loadModel(mod, "end_stone_bricks"); - continue; - } - if (identifier.equals("cocoa")) { - for (int stage = 0; stage < 3; stage++) { - loadModel(mod, identifier + "_stage" + stage); - } - continue; - } - if (identifier.equals("melon_stem") || identifier.equals("pumpkin_stem")) { - for (int stage = 0; stage < 8; stage++) { - loadModel(mod, identifier + "_stage" + stage); - } - continue; - } - if (identifier.equals("repeater")) { - for (int ticks = 1; ticks < 5; ticks++) { - loadModel(mod, identifier + "_" + ticks + "tick"); - loadModel(mod, identifier + "_" + ticks + "tick_locked"); - loadModel(mod, identifier + "_" + ticks + "tick_on"); - loadModel(mod, identifier + "_" + ticks + "tick_on_locked"); - } - continue; - } - if (identifier.contains("door")) { - loadModel(mod, identifier + "_bottom"); - loadModel(mod, identifier + "_bottom_hinge"); - loadModel(mod, identifier + "_top"); - loadModel(mod, identifier + "_top_hinge"); - continue; - } - if (identifier.endsWith("wall") || identifier.endsWith("fence")) { - loadModel(mod, identifier + "_inventory"); - loadModel(mod, identifier + "_post"); - loadModel(mod, identifier + "_side"); - continue; - } - if (identifier.contains("large") || identifier.contains("tall") || identifier.equals("sunflower") || - identifier.equals("rose_bush") || identifier.equals("lilac") || identifier.equals("peony")) { - loadModel(mod, identifier + "_bottom"); - loadModel(mod, identifier + "_top"); - continue; - } - if (identifier.equals("nether_portal")) { - loadModel(mod, identifier + "_ew"); - loadModel(mod, identifier + "_ns"); - continue; - } - if (identifier.equals("slime")) { - loadModel(mod, identifier + "_block"); - continue; - } - loadModel(mod, identifier); + } catch (IOException | NullPointerException e) { + e.printStackTrace(); } Log.info("finished loading all block descriptions"); } - private boolean handleProperties(Block block) { - return !block.getProperties().contains(BlockProperties.NONE) && block.getProperties().size() != 0; + final HashMap> blockDescriptionMap; + + private void loadModels(JsonObject blockList, String mod) { + blockDescriptionMap.put(mod, new HashMap<>()); + for (String identifier : blockList.keySet()) { + JsonElement child = blockList.get(identifier); + loadModel(mod, identifier, child); + } } - private void loadModel(String mod, String identifier) { - if (blockDescriptionMap.containsKey(mod) && blockDescriptionMap.get(mod).containsKey(identifier)) { - // a description for that block already exists. checking because Blocks.getBlockList() - // returns all blocks with all possible combinations (rotation, etc.) - return; - } + private void loadModel(String mod, String identifier, JsonElement child) { try { - String path = Config.homeDir + "assets/" + mod + "/models/block/" + identifier + ".json"; - JsonObject json = readJsonFromFile(path); - BlockDescription description = new BlockDescription(json); - HashMap modList = blockDescriptionMap.get(mod); + BlockDescription description = new BlockDescription(child, identifier, mod); modList.put(identifier, description); - } catch (IOException e) { - Log.debug("could not find block model for block " + mod + ":" + identifier); } catch (Exception e) { e.printStackTrace(); System.out.println(mod + ":" + identifier); @@ -382,9 +68,6 @@ public class BlockModelLoader { } public BlockDescription getBlockDescription(Block block) { - if (ignoredBlocks.contains(block.getIdentifier())) { - return null; - } if (!blockDescriptionMap.containsKey(block.getMod())) { System.out.println(String.format("No mod %s found", block.getMod())); //System.exit(-1); @@ -413,6 +96,6 @@ public class BlockModelLoader { if (description == null) { return new HashSet<>(); } - return description.prepare(adjacentBlocks); + return description.prepare(block, adjacentBlocks); } } \ No newline at end of file diff --git a/src/main/java/de/bixilon/minosoft/render/texture/TextureLoader.java b/src/main/java/de/bixilon/minosoft/render/texture/TextureLoader.java index 2fcb16fd3..2893e4f86 100644 --- a/src/main/java/de/bixilon/minosoft/render/texture/TextureLoader.java +++ b/src/main/java/de/bixilon/minosoft/render/texture/TextureLoader.java @@ -14,7 +14,6 @@ package de.bixilon.minosoft.render.texture; import de.bixilon.minosoft.Config; -import de.bixilon.minosoft.render.utility.Triplet; import de.matthiasmann.twl.utils.PNGDecoder; import javafx.util.Pair; @@ -47,9 +46,8 @@ public class TextureLoader { } catch (IOException ioException) { ioException.printStackTrace(); } - PNGDecoder decoder = null; try { - decoder = new PNGDecoder(new FileInputStream( + PNGDecoder decoder = new PNGDecoder(new FileInputStream( Config.homeDir + "assets/allTextures.png")); ByteBuffer buf = ByteBuffer.allocateDirect(decoder.getWidth() * decoder.getHeight() * 4); decoder.decode(buf, decoder.getWidth() * 4, PNGDecoder.Format.RGBA); @@ -60,39 +58,6 @@ public class TextureLoader { } - private static int makeGreen(int rgb) { - // this method has some bugs but it looks cool so let's just say it is an intended mechanic - Triplet rgbValues = getRGBTriplet(rgb); - float brightness = getBrightness(rgbValues); - rgbValues = multiply(new Triplet<>(94f / 255f, 157f / 255f, 52f / 255f), rgbValues.item1); - return getRGBInt(rgbValues); - } - - private static Triplet multiply(Triplet rgbValues, float value) { - rgbValues.item1 *= value; - rgbValues.item2 *= value; - rgbValues.item3 *= value; - return rgbValues; - } - - private static int getRGBInt(Triplet rgbValues) { - int red = (int) (rgbValues.item1 * 255); - int green = (int) (rgbValues.item2 * 255); - int blue = (int) (rgbValues.item3 * 255); - return ((red << 16) | (green << 8) | blue); - } - - static Triplet getRGBTriplet(int rgb) { - float red = (float) ((rgb >>> 16) & 0xFF) / 16f; - float green = (float) ((rgb >> 8) & 0xFF) / 16f; - float blue = (float) ((rgb) & 0xFF) / 16f; - return new Triplet<>(red, green, blue); - } - - private static float getBrightness(Triplet rgbValues) { - return .2126f * rgbValues.item1 + .7152f * rgbValues.item2 + .0722f * rgbValues.item3; - } - private void loadTextures(String textureFolder) throws IOException { // Any animated block will be stationary File[] textureFiles = new File(textureFolder).listFiles(); @@ -127,9 +92,6 @@ public class TextureLoader { for (int y = 0; y < TEXTURE_PACK_RES; y++) { for (int xPixel = 0; xPixel < TEXTURE_PACK_RES; xPixel++) { int rgb = img.getRGB(xPixel, y); - if (allTextures.get(xPos).getValue().equals("grass_block_top")) { - rgb = makeGreen(rgb); - } totalImage.setRGB(xPos * TEXTURE_PACK_RES + xPixel, y, rgb); } } diff --git a/src/main/resources/assets/mapping/blockModels/minecraft.json b/src/main/resources/assets/mapping/blockModels/minecraft.json new file mode 100644 index 000000000..e091e2944 --- /dev/null +++ b/src/main/resources/assets/mapping/blockModels/minecraft.json @@ -0,0 +1,59 @@ +{ + "stone": "regular", + "granite": "regular", + "polished_granite": "regular", + "diorite": "regular", + "polished_diorite": "regular", + "andesite": "regular", + "polished_andesite": "regular", + "grass_block": "regular", + "dirt": "regular", + "coarse_dirt": "regular", + "podzol": "regular", + "cobblestone": "regular", + "oak_planks": "regular", + "spruce_planks": "regular", + "birch_planks": "regular", + "jungle_planks": "regular", + "acacia_planks": "regular", + "dark_oak_planks": "regular", + "oak_sapling": "regular", + "spruce_sapling": "regular", + "birch_sapling": "regular", + "jungle_sapling": "regular", + "acacia_sapling": "regular", + "dark_oak_sapling": "regular", + "bedrock": "regular", + "sand": "regular", + "red_sand": "regular", + "gravel": "regular", + "gold_ore": "regular", + "iron_ore": "regular", + "coal_ore": "regular", + "spruce_log": "regular", + "birch_log": "regular", + "jungle_log": "regular", + "dark_oak_log": "regular", + "oak_leaves": "regular", + "spruce_leaves": "regular", + "jungle_leaves": "regular", + "birch_leaves": "regular", + "dark_oak_leaves": "regular", + "sponge": "regular", + "wet_sponge": "regular", + "glass": "regular", + "lapis_ore": "regular", + "lapis_block": "regular", + "dispenser": { + "orientation:vertical": "dispenser_vertical", + "else": "dispenser" + }, + "sandstone": "regular", + "chiseled_sandstone": "regular", + "smooth_sandstone": "regular", + "note_block": "regular", + "bed": "regular", + "powered_rail": { + "" + } +} \ No newline at end of file