From 7e2b6b046495ead163b6f6d3fbde5c997a9c18ca Mon Sep 17 00:00:00 2001 From: KnightMiner Date: Sun, 5 Jun 2016 16:47:56 -0500 Subject: [PATCH] Add base stuff for a block with connected textures Only adds "full", no horizontal or alike. All the models are done using a Forge blockstate for simplicity, so copying the example Blockstate and changing the textures is the easiest way to add a model This is based off the tutorial by Darkhax linked below, though with a few things modified to make it easier for extending and support adding via EnumBlocks. http://tutorials.darkhax.net/connected-block-textures.html --- .../mantle/block/BlockConnectedTexture.java | 94 ++++++++++++++++++ .../slimeknights/mantle/block/EnumBlock.java | 3 +- .../block/EnumBlockConnectedTexture.java | 80 ++++++++++++++++ .../client/gui/book/element/BookElement.java | 30 +++--- .../mantle/blockstate/connected_example.json | 96 +++++++++++++++++++ .../mantle/models/block/connected_0.json | 13 +++ .../mantle/models/block/connected_1.json | 13 +++ .../mantle/models/block/connected_2.json | 13 +++ .../models/block/connected_2_angle.json | 13 +++ .../mantle/models/block/connected_3_T1.json | 13 +++ .../mantle/models/block/connected_3_T2.json | 13 +++ .../models/block/connected_3_angle.json | 13 +++ .../models/block/connected_4_angle.json | 13 +++ .../models/block/connected_4_cross.json | 13 +++ .../mantle/models/block/tinted_cube.json | 16 ++++ 15 files changed, 420 insertions(+), 16 deletions(-) create mode 100644 src/main/java/slimeknights/mantle/block/BlockConnectedTexture.java create mode 100644 src/main/java/slimeknights/mantle/block/EnumBlockConnectedTexture.java create mode 100644 src/main/resources/assets/mantle/blockstate/connected_example.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_0.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_1.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_2.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_2_angle.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_3_T1.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_3_T2.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_3_angle.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_4_angle.json create mode 100644 src/main/resources/assets/mantle/models/block/connected_4_cross.json create mode 100644 src/main/resources/assets/mantle/models/block/tinted_cube.json diff --git a/src/main/java/slimeknights/mantle/block/BlockConnectedTexture.java b/src/main/java/slimeknights/mantle/block/BlockConnectedTexture.java new file mode 100644 index 0000000..d31a74c --- /dev/null +++ b/src/main/java/slimeknights/mantle/block/BlockConnectedTexture.java @@ -0,0 +1,94 @@ +package slimeknights.mantle.block; + +import javax.annotation.Nonnull; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; + + /** + * Creates a block with textures that connect to other blocks + *

+ * Based off a tutorial by Darkhax, used under the Creative Commons Zero 1.0 Universal license + */ +public class BlockConnectedTexture extends Block { + + // These are the properties used for determining whether or not a side is connected. They + // do NOT take up block IDs, they are unlisted properties + public static final PropertyBool CONNECTED_DOWN = PropertyBool.create("connected_down"); + public static final PropertyBool CONNECTED_UP = PropertyBool.create("connected_up"); + public static final PropertyBool CONNECTED_NORTH = PropertyBool.create("connected_north"); + public static final PropertyBool CONNECTED_SOUTH = PropertyBool.create("connected_south"); + public static final PropertyBool CONNECTED_WEST = PropertyBool.create("connected_west"); + public static final PropertyBool CONNECTED_EAST = PropertyBool.create("connected_east"); + + public BlockConnectedTexture(Material material) { + + super(material); + // By default none of the sides are connected + this.setDefaultState(this.blockState.getBaseState() + .withProperty(CONNECTED_DOWN, Boolean.FALSE) + .withProperty(CONNECTED_EAST, Boolean.FALSE) + .withProperty(CONNECTED_NORTH, Boolean.FALSE) + .withProperty(CONNECTED_SOUTH, Boolean.FALSE) + .withProperty(CONNECTED_UP, Boolean.FALSE) + .withProperty(CONNECTED_WEST, Boolean.FALSE)); + } + + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos position) { + + // Creates the state to use for the block. This is where we check if every side is + // connectable or not. + return state.withProperty(CONNECTED_DOWN, this.isSideConnectable(world, position, EnumFacing.DOWN)) + .withProperty(CONNECTED_EAST, this.isSideConnectable(world, position, EnumFacing.EAST)) + .withProperty(CONNECTED_NORTH, this.isSideConnectable(world, position, EnumFacing.NORTH)) + .withProperty(CONNECTED_SOUTH, this.isSideConnectable(world, position, EnumFacing.SOUTH)) + .withProperty(CONNECTED_UP, this.isSideConnectable(world, position, EnumFacing.UP)) + .withProperty(CONNECTED_WEST, this.isSideConnectable(world, position, EnumFacing.WEST)); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, new IProperty[] { CONNECTED_DOWN, CONNECTED_UP, CONNECTED_NORTH, CONNECTED_SOUTH, CONNECTED_WEST, CONNECTED_EAST }); + } + + // Since the block has state information but we are not switching the meta value, we have + // to override this method to return 0 + @Override + public int getMetaFromState(IBlockState state) { + return 0; + } + + /** + * Checks if a specific side of a block can connect to this block. For this example, a side + * is connectable if the block is the same block as this one. + * + * @param world The world to run the check in. + * @param pos The position of the block to check for. + * @param side The side of the block to check. + * @return Whether or not the side is connectable. + */ + private boolean isSideConnectable(IBlockAccess world, BlockPos pos, EnumFacing side) { + final IBlockState original = world.getBlockState(pos); + final IBlockState connected = world.getBlockState(pos.offset(side)); + + return original != null && connected != null && canConnect(original, connected); + } + + /** + * Checks if this block should connect to another block + * @param state BlockState to check + * @return True if the block is valid to connect + */ + protected boolean canConnect(@Nonnull IBlockState original, @Nonnull IBlockState connected) { + return original.getBlock() == connected.getBlock(); + } +} \ No newline at end of file diff --git a/src/main/java/slimeknights/mantle/block/EnumBlock.java b/src/main/java/slimeknights/mantle/block/EnumBlock.java index 1ac9386..c0c41bb 100644 --- a/src/main/java/slimeknights/mantle/block/EnumBlock.java +++ b/src/main/java/slimeknights/mantle/block/EnumBlock.java @@ -21,7 +21,7 @@ public class EnumBlock & EnumBlock.IEnumMeta & IStringSerializ public final PropertyEnum prop; private final E[] values; - private static PropertyEnum tmp; + protected static PropertyEnum tmp; public EnumBlock(Material material, PropertyEnum prop, Class clazz) { super(preInit(material, prop)); @@ -29,7 +29,6 @@ public class EnumBlock & EnumBlock.IEnumMeta & IStringSerializ values = clazz.getEnumConstants(); } - @SuppressWarnings("unchecked") private static Material preInit(Material material, PropertyEnum property) { tmp = property; return material; diff --git a/src/main/java/slimeknights/mantle/block/EnumBlockConnectedTexture.java b/src/main/java/slimeknights/mantle/block/EnumBlockConnectedTexture.java new file mode 100644 index 0000000..f0d69ff --- /dev/null +++ b/src/main/java/slimeknights/mantle/block/EnumBlockConnectedTexture.java @@ -0,0 +1,80 @@ +package slimeknights.mantle.block; + +import javax.annotation.Nonnull; + +import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyEnum; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; + + /** + * Creates a block with textures that connect to other blocks + *

+ * Based off a tutorial by Darkhax, used under the Creative Commons Zero 1.0 Universal license + */ +public class EnumBlockConnectedTexture & EnumBlock.IEnumMeta & IStringSerializable> extends EnumBlock { + + public EnumBlockConnectedTexture(Material material, PropertyEnum prop, Class clazz) { + super(material, prop, clazz); + + // By default none of the sides are connected + this.setDefaultState(this.blockState.getBaseState() + .withProperty(BlockConnectedTexture.CONNECTED_DOWN, Boolean.FALSE) + .withProperty(BlockConnectedTexture.CONNECTED_EAST, Boolean.FALSE) + .withProperty(BlockConnectedTexture.CONNECTED_NORTH, Boolean.FALSE) + .withProperty(BlockConnectedTexture.CONNECTED_SOUTH, Boolean.FALSE) + .withProperty(BlockConnectedTexture.CONNECTED_UP, Boolean.FALSE) + .withProperty(BlockConnectedTexture.CONNECTED_WEST, Boolean.FALSE)); + } + + @Override + public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos position) { + // Creates the state to use for the block. This is where we check if every side is + // connectable or not. + return state.withProperty(BlockConnectedTexture.CONNECTED_DOWN, this.isSideConnectable(world, position, EnumFacing.DOWN)) + .withProperty(BlockConnectedTexture.CONNECTED_EAST, this.isSideConnectable(world, position, EnumFacing.EAST)) + .withProperty(BlockConnectedTexture.CONNECTED_NORTH, this.isSideConnectable(world, position, EnumFacing.NORTH)) + .withProperty(BlockConnectedTexture.CONNECTED_SOUTH, this.isSideConnectable(world, position, EnumFacing.SOUTH)) + .withProperty(BlockConnectedTexture.CONNECTED_UP, this.isSideConnectable(world, position, EnumFacing.UP)) + .withProperty(BlockConnectedTexture.CONNECTED_WEST, this.isSideConnectable(world, position, EnumFacing.WEST)); + } + + @Nonnull + @Override + protected BlockStateContainer createBlockState() { + if(prop == null) { + return new BlockStateContainer(this, new IProperty[] { tmp, BlockConnectedTexture.CONNECTED_DOWN, BlockConnectedTexture.CONNECTED_UP, BlockConnectedTexture.CONNECTED_NORTH, BlockConnectedTexture.CONNECTED_SOUTH, BlockConnectedTexture.CONNECTED_WEST, BlockConnectedTexture.CONNECTED_EAST }); + } + return new BlockStateContainer(this, new IProperty[] { prop, BlockConnectedTexture.CONNECTED_DOWN, BlockConnectedTexture.CONNECTED_UP, BlockConnectedTexture.CONNECTED_NORTH, BlockConnectedTexture.CONNECTED_SOUTH, BlockConnectedTexture.CONNECTED_WEST, BlockConnectedTexture.CONNECTED_EAST }); + } + + /** + * Checks if a specific side of a block can connect to this block. For this example, a side + * is connectable if the block is the same block as this one. + * + * @param world The world to run the check in. + * @param pos The position of the block to check for. + * @param side The side of the block to check. + * @return Whether or not the side is connectable. + */ + private boolean isSideConnectable(IBlockAccess world, BlockPos pos, EnumFacing side) { + final IBlockState original = world.getBlockState(pos); + final IBlockState connected = world.getBlockState(pos.offset(side)); + + return original != null && connected != null && canConnect(original, connected); + } + + /** + * Checks if this block should connect to another block + * @param state BlockState to check + * @return True if the block is valid to connect + */ + protected boolean canConnect(IBlockState original, IBlockState connected) { + return connected.getBlock() == original.getBlock() && connected.getValue(prop) == original.getValue(prop); + } +} \ No newline at end of file diff --git a/src/main/java/slimeknights/mantle/client/gui/book/element/BookElement.java b/src/main/java/slimeknights/mantle/client/gui/book/element/BookElement.java index 4fdeaa5..6a550e7 100644 --- a/src/main/java/slimeknights/mantle/client/gui/book/element/BookElement.java +++ b/src/main/java/slimeknights/mantle/client/gui/book/element/BookElement.java @@ -41,22 +41,24 @@ public abstract class BookElement extends Gui { } public void renderToolTip(FontRenderer fontRenderer, ItemStack stack, int x, int y) { - List list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips); - - for(int i = 0; i < list.size(); ++i) { - if(i == 0) { - list.set(i, stack.getRarity().rarityColor + list.get(i)); - } else { - list.set(i, TextFormatting.GRAY + list.get(i)); + if(stack != null) { + List list = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips); + + for(int i = 0; i < list.size(); ++i) { + if(i == 0) { + list.set(i, stack.getRarity().rarityColor + list.get(i)); + } else { + list.set(i, TextFormatting.GRAY + list.get(i)); + } } + + FontRenderer font = stack.getItem().getFontRenderer(stack); + if(font == null) { + font = fontRenderer; + } + GuiUtils.drawHoveringText(list, x, y, GuiBook.PAGE_WIDTH, GuiBook.PAGE_HEIGHT, -1, font); + RenderHelper.disableStandardItemLighting(); } - - FontRenderer font = stack.getItem().getFontRenderer(stack); - if(font == null) { - font = fontRenderer; - } - GuiUtils.drawHoveringText(list, x, y, GuiBook.PAGE_WIDTH, GuiBook.PAGE_HEIGHT, -1, font); - RenderHelper.disableStandardItemLighting(); } @Deprecated diff --git a/src/main/resources/assets/mantle/blockstate/connected_example.json b/src/main/resources/assets/mantle/blockstate/connected_example.json new file mode 100644 index 0000000..59dc3c7 --- /dev/null +++ b/src/main/resources/assets/mantle/blockstate/connected_example.json @@ -0,0 +1,96 @@ +{ + "forge_marker": 1, + "defaults": { + "textures": { + "normal": "MOD:blocks/NAME_normal", + "u": "MOD:blocks/NAME_u", + "r": "MOD:blocks/NAME_r", + "ud": "MOD:blocks/NAME_ud", + "ul": "MOD:blocks/NAME_ul", + "ur": "MOD:blocks/NAME_ur", + "lr": "MOD:blocks/NAME_lr", + "udr": "MOD:blocks/NAME_udr", + "udl": "MOD:blocks/NAME_udl", + "ulr": "MOD:blocks/NAME_ulr", + "udlr": "MOD:blocks/NAME_udlr" + } + }, + "variants": { + "inventory": { "model": "mantle:connected_0" }, + "connected_down=false,connected_east=false,connected_north=false,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_0" }, + + "connected_down=false,connected_east=false,connected_north=false,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_1" }, + "connected_down=true,connected_east=false,connected_north=false,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_1", "x": 180 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_1", "x": 90 }, + "connected_down=false,connected_east=false,connected_north=false,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_1", "x": -90 }, + "connected_down=false,connected_east=false,connected_north=false,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_1", "x": 90, "y": -90 }, + "connected_down=false,connected_east=true,connected_north=false,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_1", "x": 90, "y": 90 }, + + "connected_down=false,connected_east=true,connected_north=false,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_2_angle" }, + "connected_down=false,connected_east=false,connected_north=false,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_2_angle", "y": 180 }, + "connected_down=true,connected_east=true,connected_north=false,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_2_angle", "x": 180 }, + "connected_down=true,connected_east=false,connected_north=false,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_2_angle", "x": 180, "y": 180 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_2_angle", "y": -90 }, + "connected_down=false,connected_east=false,connected_north=false,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_2_angle", "y": 90 }, + "connected_down=true,connected_east=false,connected_north=true,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_2_angle", "x": 180, "y": -90 }, + "connected_down=true,connected_east=false,connected_north=false,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_2_angle", "x": 180, "y": 90 }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_2_angle", "x": 90 }, + "connected_down=false,connected_east=true,connected_north=false,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_2_angle", "x": -90 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_2_angle", "x": 90, "y": -90 }, + "connected_down=false,connected_east=false,connected_north=false,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_2_angle", "x": -90, "y": 90 }, + + "connected_down=true,connected_east=false,connected_north=false,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_2" }, + "connected_down=false,connected_east=true,connected_north=false,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_2", "x": -90, "y": 90 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_2", "x": -90 }, + + "connected_down=true,connected_east=false,connected_north=false,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_3_T1" }, + "connected_down=true,connected_east=false,connected_north=false,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_3_T1", "y": -90 }, + "connected_down=true,connected_east=true,connected_north=false,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_3_T1", "y": -180 }, + "connected_down=true,connected_east=false,connected_north=true,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_3_T1", "y": 90 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_3_T1", "x": -90 }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_3_T1", "x": -90, "y": 180 }, + + "connected_down=false,connected_east=true,connected_north=false,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_3_T2" }, + "connected_down=false,connected_east=true,connected_north=false,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_3_T2", "x": -90 }, + "connected_down=true,connected_east=true,connected_north=false,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_3_T2", "x": 180 }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_3_T2", "x": 90 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_3_T2", "y": 90 }, + "connected_down=true,connected_east=false,connected_north=true,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_3_T2", "x": 180, "y": 90 }, + + "connected_down=false,connected_east=true,connected_north=false,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_3_angle" }, + "connected_down=false,connected_east=false,connected_north=false,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_3_angle", "y": 90 }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_3_angle", "x": 90 }, + "connected_down=true,connected_east=true,connected_north=true,connected_south=false,connected_up=false,connected_west=false": { "model": "mantle:connected_3_angle", "x": 180 }, + "connected_down=true,connected_east=true,connected_north=false,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_3_angle", "x": 270 }, + + "connected_down=true,connected_east=false,connected_north=false,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_3_angle", "x": 180, "y": -180 }, + "connected_down=true,connected_east=false,connected_north=true,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_3_angle", "x": -90, "y": -180 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_3_angle", "x": 90, "y": -90 }, + + "connected_down=true,connected_east=true,connected_north=false,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_4_cross" }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_4_cross", "x": 90 }, + "connected_down=true,connected_east=false,connected_north=true,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_4_cross", "y": 90 }, + + "connected_down=true,connected_east=false,connected_north=true,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_4_angle" }, + "connected_down=true,connected_east=false,connected_north=true,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_4_angle", "x": 90 }, + "connected_down=false,connected_east=false,connected_north=true,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_4_angle", "x": -90 }, + "connected_down=true,connected_east=false,connected_north=false,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_4_angle", "y": -90 }, + "connected_down=true,connected_east=true,connected_north=true,connected_south=false,connected_up=true,connected_west=false": { "model": "mantle:connected_4_angle", "y": 90 }, + "connected_down=true,connected_east=true,connected_north=false,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_4_angle", "y": 180 }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_4_angle", "x": -90, "y": 180 }, + "connected_down=true,connected_east=true,connected_north=true,connected_south=true,connected_up=false,connected_west=false": { "model": "mantle:connected_4_angle", "x": 90, "y": 180 }, + "connected_down=false,connected_east=true,connected_north=false,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_4_angle", "x": -90, "y": -90 }, + "connected_down=true,connected_east=true,connected_north=false,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_4_angle", "x": -270, "y": -90 }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_4_angle", "x": -90, "y": 90 }, + "connected_down=true,connected_east=true,connected_north=true,connected_south=false,connected_up=false,connected_west=true": { "model": "mantle:connected_4_angle", "x": -270, "y": -270 }, + + "connected_down=true,connected_east=true,connected_north=true,connected_south=true,connected_up=false,connected_west=true": { "model": "mantle:connected_4_cross" }, + "connected_down=true,connected_east=true,connected_north=false,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_4_cross" }, + "connected_down=true,connected_east=false,connected_north=true,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_4_cross" }, + "connected_down=true,connected_east=true,connected_north=true,connected_south=true,connected_up=true,connected_west=false": { "model": "mantle:connected_4_cross" }, + "connected_down=true,connected_east=true,connected_north=true,connected_south=false,connected_up=true,connected_west=true": { "model": "mantle:connected_4_cross" }, + "connected_down=false,connected_east=true,connected_north=true,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_4_cross" }, + + "connected_down=true,connected_east=true,connected_north=true,connected_south=true,connected_up=true,connected_west=true": { "model": "mantle:connected_4_cross" } + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_0.json b/src/main/resources/assets/mantle/models/block/connected_0.json new file mode 100644 index 0000000..19f52bb --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_0.json @@ -0,0 +1,13 @@ +{ + "__comment": "The model for a block that is not being connected to on any angle.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#normal", + "up": "#normal", + "north": "#normal", + "south": "#normal", + "west": "#normal", + "east": "#normal" + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_1.json b/src/main/resources/assets/mantle/models/block/connected_1.json new file mode 100644 index 0000000..3a39193 --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_1.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model for when only one side is connected.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#normal", + "up": "#udlr", + "north": "#u", + "south": "#u", + "west": "#u", + "east": "#u" + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_2.json b/src/main/resources/assets/mantle/models/block/connected_2.json new file mode 100644 index 0000000..98f93f5 --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_2.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model for when two sides are connected.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#udlr", + "up": "#udlr", + "north": "#ud", + "south": "#ud", + "west": "#ud", + "east": "#ud" + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_2_angle.json b/src/main/resources/assets/mantle/models/block/connected_2_angle.json new file mode 100644 index 0000000..f540af8 --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_2_angle.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model for when two adgacent sides are connected.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#r", + "up": "#udlr", + "north": "#ul", + "south": "#ur", + "west": "#u", + "east": "#udlr" + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_3_T1.json b/src/main/resources/assets/mantle/models/block/connected_3_T1.json new file mode 100644 index 0000000..4861628 --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_3_T1.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model for when three adjacent connected sides are a T shape.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#udlr", + "up": "#udlr", + "north": "#udr", + "south": "#udl", + "west": "#udlr", + "east": "#ud" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/mantle/models/block/connected_3_T2.json b/src/main/resources/assets/mantle/models/block/connected_3_T2.json new file mode 100644 index 0000000..e1a7f1a --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_3_T2.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model for when three adjacent sides connected sides in a T shape.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#lr", + "up": "#udlr", + "north": "#ulr", + "south": "#ulr", + "west": "#udlr", + "east": "#udlr" + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_3_angle.json b/src/main/resources/assets/mantle/models/block/connected_3_angle.json new file mode 100644 index 0000000..ef0170c --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_3_angle.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model for when three adjacent sides are connected.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#ur", + "up": "#udlr", + "north": "#ul", + "south": "#udlr", + "west": "#ur", + "east": "#udlr" + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_4_angle.json b/src/main/resources/assets/mantle/models/block/connected_4_angle.json new file mode 100644 index 0000000..1866ca0 --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_4_angle.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model for when four connected sides at an angle.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#udlr", + "up": "#udlr", + "north": "#udlr", + "south": "#udl", + "west": "#udlr", + "east": "#udr" + } +} diff --git a/src/main/resources/assets/mantle/models/block/connected_4_cross.json b/src/main/resources/assets/mantle/models/block/connected_4_cross.json new file mode 100644 index 0000000..91e459f --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/connected_4_cross.json @@ -0,0 +1,13 @@ +{ + "__comment": "Model file for four or more connected sides in a cross shape.", + "parent": "mantle:block/tinted_cube", + "textures": { + "particle": "#normal", + "down": "#udlr", + "up": "#udlr", + "north": "#udlr", + "south": "#udlr", + "west": "#udlr", + "east": "#udlr" + } +} diff --git a/src/main/resources/assets/mantle/models/block/tinted_cube.json b/src/main/resources/assets/mantle/models/block/tinted_cube.json new file mode 100644 index 0000000..30801c3 --- /dev/null +++ b/src/main/resources/assets/mantle/models/block/tinted_cube.json @@ -0,0 +1,16 @@ +{ + "parent": "block/block", + "elements": [ + { "from": [ 0, 0, 0 ], + "to": [ 16, 16, 16 ], + "faces": { + "down": { "texture": "#down", "cullface": "down", "tintindex": 0 }, + "up": { "texture": "#up", "cullface": "up", "tintindex": 0 }, + "north": { "texture": "#north", "cullface": "north", "tintindex": 0 }, + "south": { "texture": "#south", "cullface": "south", "tintindex": 0 }, + "west": { "texture": "#west", "cullface": "west", "tintindex": 0 }, + "east": { "texture": "#east", "cullface": "east", "tintindex": 0 } + } + } + ] +}