Jump to content

[1.8] [SOLVED] Blockstates json Wildcards?


jeffryfisher

Recommended Posts

In a json file (blockstates), must each listed state be complete (i.e. provide a value for each and every property)?

 

Is there a wildcard like "any" that would allow me to write one line to take the place of many (where one property has no effect in this list)?

 

What I am trying to do is to separate my block's geometry from its skin (texture). I want to use some of the block's properties to control what model to use, and I want to use a separate property to choose texture. Because there are 32 geometries and 15 textures, I desperately want to avoid having to list the complete 480-line Cartesian product of all those models and textures. What I have in mind is something along these lines for my blockstates file (an extension of BlockWall:

 

{
    "textures": {
        "skin=0":  { "texture": "blocks/stonebrick" },
        "skin=1":  { "texture": "blocks/stonebrick_mossy" },
        "skin=2":  { "texture": "blocks/stonebrick_cracked" },
        "skin=3":  { "texture": "blocks/stonebrick_carved" },
        "skin=4":  { "texture": "blocks/brick" },
        "skin=5":  { "texture": "blocks/hardened_clay" },
        "skin=6":  { "texture": "blocks/netherrack" },
        "skin=7":  { "texture": "blocks/quartz_block_chiseled" },
        "skin=8":  { "texture": "blocks/obsidian" },
        "skin=9":  { "texture": "blocks/sandstone_normal" },
        "skin=10": { "texture": "blocks/sandstone_carved" },
        "skin=11": { "texture": "blocks/stone" },
        "skin=12": { "texture": "blocks/stone_andesite_smooth" },
        "skin=13": { "texture": "blocks/stone_diorite_smooth" },
        "skin=14": { "texture": "blocks/stone_granite_smooth" }
    }
    "variants": {
        "east=false,north=false,south=false,up=false,west=false": { "model": "wall_post" },
        "east=false,north=false,south=false,up=true,west=false":  { "model": "wall_post" },
        "east=false,north=true,south=false,up=false,west=false":  { "model": "wall_n" },
        "east=true,north=false,south=false,up=false,west=false":  { "model": "wall_n", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=false,west=false":  { "model": "wall_n", "y": 180, "uvlock": true },
        "east=false,north=false,south=false,up=false,west=true":  { "model": "wall_n", "y": 270, "uvlock": true },
        "east=false,north=true,south=false,up=true,west=false":   { "model": "wall_n" },
        "east=true,north=false,south=false,up=true,west=false":   { "model": "wall_n", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=true,west=false":   { "model": "wall_n", "y": 180, "uvlock": true },
        "east=false,north=false,south=false,up=true,west=true":   { "model": "wall_n", "y": 270, "uvlock": true },
        "east=true,north=true,south=false,up=false,west=false":   { "model": "wall_ne" },
        "east=true,north=false,south=true,up=false,west=false":   { "model": "wall_ne", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=false,west=true":   { "model": "wall_ne", "y": 180, "uvlock": true },
        "east=false,north=true,south=false,up=false,west=true":   { "model": "wall_ne", "y": 270, "uvlock": true },
        "east=true,north=true,south=false,up=true,west=false":    { "model": "wall_ne" },
        "east=true,north=false,south=true,up=true,west=false":    { "model": "wall_ne", "y": 90, "uvlock": true },
        "east=false,north=false,south=true,up=true,west=true":    { "model": "wall_ne", "y": 180, "uvlock": true },
        "east=false,north=true,south=false,up=true,west=true":    { "model": "wall_ne", "y": 270, "uvlock": true },
        "east=false,north=true,south=true,up=false,west=false":   { "model": "wall_ns" },
        "east=true,north=false,south=false,up=false,west=true":   { "model": "wall_ns", "y": 90, "uvlock": true },
        "east=false,north=true,south=true,up=true,west=false":    { "model": "wall_ns_above" },
        "east=true,north=false,south=false,up=true,west=true":    { "model": "wall_ns_above", "y": 90, "uvlock": true },
        "east=true,north=true,south=true,up=false,west=false":    { "model": "wall_nse" },
        "east=true,north=false,south=true,up=false,west=true":    { "model": "wall_nse", "y": 90, "uvlock": true },
        "east=false,north=true,south=true,up=false,west=true":    { "model": "wall_nse", "y": 180, "uvlock": true },
        "east=true,north=true,south=false,up=false,west=true":    { "model": "wall_nse", "y": 270, "uvlock": true },
        "east=true,north=true,south=true,up=true,west=false":     { "model": "wall_nse" },
        "east=true,north=false,south=true,up=true,west=true":     { "model": "wall_nse", "y": 90, "uvlock": true },
        "east=false,north=true,south=true,up=true,west=true":     { "model": "wall_nse", "y": 180, "uvlock": true },
        "east=true,north=true,south=false,up=true,west=true":     { "model": "wall_nse", "y": 270, "uvlock": true },
        "east=true,north=true,south=true,up=false,west=true":     { "model": "wall_nsew" },
        "east=true,north=true,south=true,up=true,west=true":      { "model": "wall_nsew" }
    }
}

Sadly, looking at how vanilla created a full brace of models for each type of wall (mossy and cobble), with each model simply repeating the texture in its own name, I am pessimistic for my chances to do something more elegant. If there's no way to treat independent properties separately, then I'll end up with 15 nearly identical blockstates files and 85 model files, every one of them prone to typing errors  :o

 

It's so ugly that the artist in me has to try to do better.

 

BTW, Does anyone know where the json files get processed? If I could lay eyes on the source code, then I might answer my own question (or make an improvement).

 

Update:

 

By having the debugger blow up on launch, I've found a Forge block properties loader with an interesting bit of Forge magic switching on a "marker" to a custom branch of json loading that I don't yet understand. I'm hoping that what I want to do is or can be supported in there. If property wildcards are not yet supported, then perhaps I should write a wish-list request (either wildcards or something like "intake multiple, disjoint sets and perform the Cartesian product on the fly") in a different subforum.

 

Where may I read up on the features of Forge's enhanced json loader (and how do I set the marker)? Are wildcard property values supported? How about bracketed value-lists? Could an enhanced loader read in a texture list plus a model list and perform a Cartesian product in software? Can you tell that I miss mc1.7.10 where all I had to do was extend class BlockWall and override the texture function to use metadata?

 

UPDATE:

 

Workaround: Forge has a custom json format that can at least break the Cartesian product into tolerable independent variables. See discussion below.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Hi

 

You can use a custom state mapper for your block properties to ignore some of them

 

http://www.minecraftforge.net/forum/index.php/topic,28997.msg149446.html#msg149446

 

After re-reading your post, I don't think that will help with decoupling skin textures from the blockstates, though. 

You could consider either implementing an ISmartBlockModel with custom block loader to substitute the texture at loading (https://github.com/TheGreyGhost/MinecraftByExample MBE04, MBE05) or perhaps the forge blockstates can do this (I'm not familiar with those).

 

-TGG

Link to comment
Share on other sites

From the doc:

Instead of defining “this combination of properties gives model X” we say “this value for this property has THAT impact on the model”.

 

That's EXACTLY the mindset I have for my mod!

 

Note to tutorial writers: Mention both json structures, and include Lex's link to the doc.

 

I expect success shortly, whereupon I'll add SOLVED to the OP subject line.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Regarding Forge blockstates:

 

Can I nest properties? Can the effect of one property value be another property with a set of values?

 

In my case, I have two values of one property that then look at another property for a true/false before choosing a model.

 

I'm giving it a try, but I might not intuit the syntax correctly:

    "geometry": {
        "0":  { "model": "wall_post" },
        "4":  { "model": "wall_n" },
        "8":  { "model": "wall_n", "y": 90, "uvlock": true },
        "2":  { "model": "wall_n", "y": 180, "uvlock": true },
        "1":  { "model": "wall_n", "y": 270, "uvlock": true },
        "12": { "model": "wall_ne" },
        "10": { "model": "wall_ne", "y": 90, "uvlock": true },
        "3":  { "model": "wall_ne", "y": 180, "uvlock": true },
        "5":  { "model": "wall_ne", "y": 270, "uvlock": true },
        "6":  {
          "up": {
            "true":  { "model": "wall_ns" },
            "false": { "model": "wall_ns_above" }
          }
        },
        "9":  {
          "up": {
            "true":  { "model": "wall_ns", "y": 90, "uvlock": true },
            "false": { "model": "wall_ns_above", "y": 90, "uvlock": true }
          }
        },
        "14":    { "model": "wall_nse" },
        "11":    { "model": "wall_nse", "y": 90, "uvlock": true },
        "7":    { "model": "wall_nse", "y": 180, "uvlock": true },
        "13":    { "model": "wall_nse", "y": 270, "uvlock": true },
        "15":     { "model": "wall_nsew" },
    }
  }

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

No they can't. The Forge blockstate format is simply a system that builds all the cartesian products for the given entries for you instead of you having to specify them all.

The json is not a scripting system, if you need it to be then you're doing something wrong.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Fair enough; I can copy-paste all 32 wall geometries. I'm just happy that I don't need to multiply that by all 15 (and counting) skins!

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

The Forge state loader seems to be working for the walls, but now I'm hung up on a multi-part blockstates file for my iron gate. The error message is "No base model or submodel provided for this MultiModel.Baked". I guess I don't understand the rules for the new json format. Here's my half baked (so to speak) blockstates json (which passes the json lint tool):

 

{
  "forge_marker" : 1,
   "defaults" : {
    "textures" : { "texture" : "blocks/iron_block" }
  },
   "variants" : {
    "context" : {
      "0" : { "model" : "block/fence_gate_closed" },
      "1" : { "model" : "block/wall_gate_closed" },
      "2" : { "model" : "block/fence_gate_open" },
      "3" : { "model" : "block/wall_gate_open" }
    },
    "facing" : {
      "south" : { },
      "west"  : {  "y" : 90,  "uvlock": true  },
      "north" : {  "y" : 180, "uvlock": true  },
      "east"  : {  "y" : 270, "uvlock": true  }
    }
  }
}

 

The "model" is determined by the value of the context property, and every possible value of context is covered, so I can't see why I'm being told that there's no model. What rule am I missing? Based on my (extremely) limited understanding of json format, I was expecting the loader to emit the Cartesian product of 4 models times 4 facings. Is it possible to separate those, or may I only separate textures from "variants"?

 

Here's the full crash report:

[11:08:09] [Client thread/INFO]: Created: 512x512 textures-atlas
[11:08:10] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: ---- Minecraft Crash Report ----
// Daisy, daisy...

Time: 8/25/15 11:08 AM
Description: Initializing game

java.lang.RuntimeException: No base model or submodel provided for this MultiModel.Baked.
at net.minecraftforge.client.model.MultiModel$Baked.<init>(MultiModel.java:50)
at net.minecraftforge.client.model.MultiModel.bake(MultiModel.java:196)
at net.minecraftforge.client.model.ModelLoader$WeightedPartWrapper.bake(ModelLoader.java:393)
at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.bake(ModelLoader.java:458)
at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:122)
at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29)
at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:130)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:511)
at net.minecraft.client.Minecraft.run(Minecraft.java:356)
at net.minecraft.client.main.Main.main(Main.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.minecraftforge.client.model.MultiModel$Baked.<init>(MultiModel.java:50)
at net.minecraftforge.client.model.MultiModel.bake(MultiModel.java:196)
at net.minecraftforge.client.model.ModelLoader$WeightedPartWrapper.bake(ModelLoader.java:393)
at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.bake(ModelLoader.java:458)
at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:122)
at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29)
at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:130)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:511)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:356)
at net.minecraft.client.main.Main.main(Main.java:117)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows XP (x86) version 5.1
Java Version: 1.7.0_55, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode, sharing), Oracle Corporation
Memory: 79954512 bytes (76 MB) / 193601536 bytes (184 MB) up to 259522560 bytes (247 MB)
JVM Flags: 0 total; 
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1450 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
UCH	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1450.jar) 
UCH	Forge{11.14.3.1450} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1450.jar) 
UCH	jrfwalls{v1.7.10-00.01.05 Beta} [uncle Jeff's Walls Mod] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'ATI Technologies Inc.' Version: '3.2.9232' Renderer: 'ATI Radeon HD 3200 Graphics'
Launched Version: 1.6
LWJGL: 2.9.1
OpenGL: ATI Radeon HD 3200 Graphics GL version 3.2.9232, ATI Technologies Inc.
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: No
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
[11:08:10] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:663]: #@!@# Game crashed!
Crash report saved to: #@!@# D:\Projects\Minecraft\Forge1450\.\crash-reports\crash-2015-08-25_11.08.10-client.txt

 

UPDATE: Solved the latest problem -- "block/" is for textures, not models. I removed "block/" from in front of my model names and the problem went away (D'oh!). I'm in the home stretch now...

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I *finally* got this to work  :'(

 

Here's my (abstract) block class, which finishes with some ugly guts shamelessly copy-pasted from vanilla's BlockWall class:

 

/**
* Once upon a time (before MC v1., this could be a simple subclass of BlockWall, inheriting many useful methods. Sadly, v1.8
* screwed that up with its egregious implementation of properties (featuring Cartesian products).
* 
* The design now imitates the useful parts of BlockWall, replacing its properties and setting them up for Forge's enhanced json
* reader.
* 
* Being a departure from BlockWall, this becomes the extensible (abstract) class from which two or more concrete classes may be
* derived to provide a wide variety of skins on walls (including the original cobble and mossy cobble).
*/
package jrfwalls;

// import static net.minecraftforge.common.util.ForgeDirection.UP;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockWall;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

// @SuppressWarnings("rawtypes")
public abstract class classAbstractWall extends Block {

  public static final PropertyInteger GEOMETRY = PropertyInteger.create ("geometry", 0, 17);
  public static final PropertyInteger SKIN = PropertyInteger.create ("skin", 0, 15);
  public String[] subName;                  // Block subtype names defined in each concrete class, copied into ItemBlock

// public classItemWall itemblockAnystoneWall;

  public classAbstractWall(String name, String[] subNameArray) {
    super (Material.rock);
    this.setDefaultState (this.getDefaultState ().withProperty (GEOMETRY, 17));
    this.setUnlocalizedName (name);
    this.subName = subNameArray;
    this.setCreativeTab (CreativeTabs.tabBlock);

    classAnystoneWallsMod.regBlock (this, classItemWall.class);
    this.setHardness (1.5F);                // Default to stone
    this.setResistance (10.0F);             // Ditto (after auto-tripling)
    this.setStepSound (soundTypePiston);    // Ditto
  }

  // Called from ItemBlock to name an item (stack) subtype in menu or inventory or drops
  public String getUnlocalizedName(int meta) {
// return classJRFmod.cutName(getUnlocalizedName ()) + "." + subName[meta];
    return getUnlocalizedName () + "." + subName[meta];
  }

  /**
   * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
   */
  @Override
  @SideOnly(Side.CLIENT)
  public void getSubBlocks(Item i, CreativeTabs t, List list) {
    for (int meta = 0; meta <= 15; meta++ ) {
      list.add (new ItemStack (i, 1, meta));
    }
  }

  // Our replacement (abstract) wall class has only two properties
  //
  @Override
  protected BlockState createBlockState() {
    return new BlockState (this, new IProperty[] { GEOMETRY, SKIN });
  }

  /**
   * Convert the given metadata into a BlockState for this Block
   */
  @Override
  public IBlockState getStateFromMeta(int meta) {               // Block state starts with metadata being injected into default geometry
    return this.getDefaultState ().withProperty (SKIN, meta);
  }

  /**
   * Get the actual Block state of this Block at the given position. This applies properties not visible in the
   * metadata, such as fence connections.
   */
  @Override
  public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    int g = this.canConnectTo (worldIn, pos.west ()) ? 1 : 0;

    if (this.canConnectTo (worldIn, pos.south ())) g += 2;      // state parm should arrive with meta already in it
    if (this.canConnectTo (worldIn, pos.north ())) {
      g += 4;
    }
    if (this.canConnectTo (worldIn, pos.east ())) {
      g += 8;   // If that makes 9, then we're (E + W) a non post straight unless connected above
      if (g == 9 && !worldIn.isAirBlock (pos.up ())) g = 17;
    } else {    // We din't add 8, so we might be only 6 (N + S), also low-straight looking up
      if (g == 6 && !worldIn.isAirBlock (pos.up ())) g = 16;
    }
    return state.withProperty (GEOMETRY, g);                    // ...so we just add geometry
  }

  /**
   * Convert the BlockState into the correct metadata value
   */
  @Override
  public int getMetaFromState(IBlockState state) {
    return ((Integer) state.getValue (SKIN)).intValue ();
  }

  /**
   * Get the damage value that this Block should drop
   */
  @Override
  public int damageDropped(IBlockState state) {
    return getMetaFromState (state);
  }

  @Override
  @SideOnly(Side.CLIENT)
  public EnumWorldBlockLayer getBlockLayer()
  {
      return EnumWorldBlockLayer.CUTOUT;
  }

  @Override
  abstract public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion);

  // Imitate Block class until the call to abstract method
  @Override
  public int getLightValue(IBlockAccess world, BlockPos pos) {
    IBlockState bs = world.getBlockState (pos);
    Block block = bs.getBlock ();

    if (block != this) {                                // Some other block type replaced me?
      return block.getLightValue (world, pos);
    }

    return getLightValue (this.getMetaFromState (bs));  // Here's where we do something extra
  }

  abstract int getLightValue(int meta);

  /**
   * Return whether this wall can connect to an adjacent block at pos.
   */
  public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
    Block block = worldIn.getBlockState (pos).getBlock ();

    if (block == Blocks.barrier) return false;
    if (block instanceof classAbstractWall || block instanceof BlockWall || block instanceof BlockFenceGate) return true;
    if (block.isFullCube () && !block.isPassable (worldIn, pos)) {
      return block.getMaterial () != Material.gourd;
    } else {
      return false;
    }
  }

  /**
   *  All methods from here down are unaltered copies from class BlockWall. Do not mess!
  */
  @Override
  public boolean canPlaceTorchOnTop(IBlockAccess world, BlockPos pos) {
    return true;
  }

  @Override
  public boolean isFullCube() {
    return false;
  }

  @Override
  public boolean isOpaqueCube() {
    return false;
  }

  @Override
  public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) {
    this.setBlockBoundsBasedOnState (worldIn, pos);
    this.maxY = 1.5D;
    return super.getCollisionBoundingBox (worldIn, pos, state);
  }

  @SideOnly(Side.CLIENT)
  public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {
    return side == EnumFacing.DOWN ? super.shouldSideBeRendered (worldIn, pos, side) : true;
  }

  @Override
  public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
    boolean flag = this.canConnectTo (worldIn, pos.north ());
    boolean flag1 = this.canConnectTo (worldIn, pos.south ());
    boolean flag2 = this.canConnectTo (worldIn, pos.west ());
    boolean flag3 = this.canConnectTo (worldIn, pos.east ());
    float f = 0.25F;
    float f1 = 0.75F;
    float f2 = 0.25F;
    float f3 = 0.75F;
    float f4 = 1.0F;

    if (flag) {
      f2 = 0.0F;
    }

    if (flag1) {
      f3 = 1.0F;
    }

    if (flag2) {
      f = 0.0F;
    }

    if (flag3) {
      f1 = 1.0F;
    }

    if (flag && flag1 && !flag2 && !flag3) {
      f4 = 0.8125F;
      f = 0.3125F;
      f1 = 0.6875F;
    } else if (!flag && !flag1 && flag2 && flag3) {
      f4 = 0.8125F;
      f2 = 0.3125F;
      f3 = 0.6875F;
    }

    this.setBlockBounds (f, 0.0F, f2, f1, f4, f3);
  }

}

 

And here's the blockstates.json that I ended up using with it:

 

{
  "forge_marker": 1,
  "variants": {
    "geometry": {
        "0":  { "model": "wall_post" },
        "4":  { "model": "wall_n" },
        "8":  { "model": "wall_n", "y": 90, "uvlock": true },
        "2":  { "model": "wall_n", "y": 180, "uvlock": true },
        "1":  { "model": "wall_n", "y": 270, "uvlock": true },
        "12": { "model": "wall_ne" },
        "10": { "model": "wall_ne", "y": 90, "uvlock": true },
        "3":  { "model": "wall_ne", "y": 180, "uvlock": true },
        "5":  { "model": "wall_ne", "y": 270, "uvlock": true },
        "6":  { "model": "wall_ns" },
        "9":  { "model": "wall_ns", "y": 90, "uvlock": true },
        "14": { "model": "wall_nse" },
        "11": { "model": "wall_nse", "y": 90, "uvlock": true },
        "7":  { "model": "wall_nse", "y": 180, "uvlock": true },
        "13": { "model": "wall_nse", "y": 270, "uvlock": true },
        "15": { "model": "wall_nsew" },
        "16": { "model": "wall_ns_above" },
        "17": { "model": "wall_ns_above", "y": 90, "uvlock": true }
    },
    "skin": {
        "0":  { "textures": { "wall": "blocks/stonebrick" }},
        "1":  { "textures": { "wall": "blocks/stonebrick_mossy" }},
        "2":  { "textures": { "wall": "blocks/stonebrick_cracked" }},
        "3":  { "textures": { "wall": "blocks/stonebrick_carved" }},
        "4":  { "textures": { "wall": "blocks/brick" }},
        "5":  { "textures": { "wall": "blocks/hardened_clay" }},
        "6":  { "textures": { "wall": "blocks/netherrack" }},
        "7":  { "textures": { "wall": "blocks/quartz_block_chiseled" }},
        "8":  { "textures": { "wall": "blocks/obsidian" }},
        "9":  { "textures": { "wall": "blocks/sandstone_normal" }},
        "10": { "textures": { "wall": "blocks/sandstone_carved" }},
        "11": { "textures": { "wall": "blocks/stone" }},
        "12": { "textures": { "wall": "blocks/stone_granite_smooth" }},
        "13": { "textures": { "wall": "blocks/stone_diorite_smooth" }},
        "14": { "textures": { "wall": "blocks/stone_andesite_smooth" }},
        "15": { "textures": { "wall": "blocks/end_stone" }}
    }
  }
}

 

Notes:

 

1) The abstract wall class can be extended to as many sets of walls (16 each) as I want. I've taken to setting some custom hardness, blast resistance and light-values in each.

 

2) Because I have two whole sets of custom walls, I have another json file like this one (but with different textures).

 

3) This only put blocks in the world, not "items" (ItemBlock versions) in inventory. For the item blocks, I was forced to write 32 nearly identical json files for the models/item directory. Fortunately, each was able to declare both a texture and a vanilla parent, so I was able to avoid doing the 32 models/block files that vanilla code-monkeys did for their blocks.

 

Here's an example of the models/item json for one ItemBlock:

 

anystone_wall2.sealantern.json

{
    "parent": "block/wall_inventory",
    "textures" : {
        "wall": "blocks/sea_lantern"
    },
    "display": {
        "firstperson": {
            "rotation": [ 0, -135, 25 ],
            "translation": [ 0, 4, 2 ],
            "scale": [ 1.2, 1.2, 1.2 ]
        },
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        }
    }
}

 

The dot-subtype naming was my choice. I just had to make sure that I was consistent between file names and the result of my ItemBlock's getUnlocalizedName (ItemStack).

 

I sincerely hope that Mojang (Microsoft) can find a code-monkey with more than half a brain to come up with an elegant way to specify that a particular item can use one default model for all of its variants, also allowing me to list the skins (textures) for all 16 in one file.

 

Even better: As a default, MC could display an ItemBlock in inventory by rendering the block's default state at .375 scale. That one shortcut could eliminate hundreds of silly files and save modders hundreds of man-days of tedious effort.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • LINK ADA DI BAWAH INI  LINK LOGIN LINK DAFTAR LINK ALTERNATIF LINK LIVE CHAT EXTRAWD EXTRAWD adalah salah satu Situs Slot Megawin Login Link Alternatif Untuk Mengunakan Satu ID EXTRAWD Untuk mendapatkan Untung Gacor EXTRAWD. Situs judi online terpercaya dan terpopuler di Indonesia. Kami menyediakan platform judi yang menawarkan berbagai jenis permainan, mulai dari Sportsbook Odds hingga Live Casino, semuanya dirancang untuk memberikan pengalaman bermain yang tidak terlupakan. EXTRAWD adalah tempat yang sempurna bagi para pemain judi online yang mencari keuntungan ekstra. SE EXTRAWD menawarkan berbagai manfaat dan keuntungan bagi para pemain setia kami, membuat bermain di situs kami menjadi sebuah pengalaman yang menguntungkan dan menyenangkan. EXTRAWD Merupakan Slot Megawin Tak peduli apakah Anda merupakan pemain baru atau pemain berpengalaman, bermain di EXTRAWDakan membuat Anda merasa terhibur dan tertantang. Dengan berbagai macam permainan yang kami tawarkan, Anda bisa memilih permainan yang paling sesuai dengan selera dan kemampuan Anda. EXTRAWD jangan khawatir, kami juga menyediakan panduan bermain yang mudah dipahami agar Anda bisa segera mulai bermain dan menikmati EXTRAWD permainan yang kami tawarkan. Bahwa modal kecil dapat menghasilkan keuntungan besar di EXTRAWD , tetapi penting bagi kami untuk mengingatkan bahwa modal juga mempengaruhi besar kecilnya keuntungan yang bisa Anda peroleh. Jadi, biar berapapun modal yang Anda miliki, pastikan untuk bermain dengan bijak dan bertanggung jawab. Selamat bermain dan semoga beruntung di  EXTRAWD Mengapa Memilih EXTRAWD Sebagai Situs Judi Online Anda Mengapa EXTRAWD sebaiknya menjadi pilihan Anda untuk situs judi online? Alasan pertama adalah variasi permainan yang kami tawarkan. Dari Sportsbook Odds hingga Live Casino, kami memiliki sesuatu untuk setiap penikmat judi online. Alasan kedua adalah manfaat dan keuntungan ekstra yang kami tawarkan kepada para pemain setia kami. Di EXTRAWD , setiap taruhan yang Anda pasang dapat memberi Anda lebih banyak keuntungan dan hadiah. Alasan ketiga adalah dukungan pelanggan kami yang responsif dan profesional, selalu siap membantu Anda kapan saja Anda membutuhkan bantuan. Jadi tunggu apalagi? Bergabunglah dengan EXTRAWD  hari ini EXTRAWD dan nikmati pengalaman judi online terbaik yang Anda inginkan. Manfaat dan Keuntungan Bermain di EXTRAWD  Bermain di EXTRAWD bukan hanya tentang hiburan, namun juga tentang keuntungan dan manfaat yang dapat Anda peroleh. Pertama, kami menawarkan peluang menang yang lebih tinggi dibandingkan situs judi online lainnya. Kedua, kami memberikan bonus dan promosi menggiurkan yang EXTRAWD bisa meningkatkan modal Anda dan memberi Anda lebih banyak peluang untuk bermain dan menang. Ketiga, kami memberikan dukungan pelanggan 24/7 yang siap membantu Anda menjawab pertanyaan dan mengatasi masalah yang mungkin Anda hadapi saat bermain. Keempat, kami menjamin keamanan dan kerahasiaan data pribadi Anda, sehingga Anda bisa bermain dengan tenang dan nyaman. Dengan semua manfaat dan keuntungan ini, tidak ada alasan untuk tidak bermain di EXTRAWD . Daftar sekarang juga dan mulai raih keuntungan Anda! Mengoptimalkan Modal Anda untuk Keuntungan Maksimal di EXTRAWD Memaksimalkan modal Anda saat bermain di EXTRAWD bisa menjadi strategi kunci dalam meraih keuntungan besar. Memulai dengan taruhan kecil adalah pilihan yang bijaksana, khususnya bagi pemain baru. Ini memungkinkan Anda untuk memahami permainan dan mengembangkan strategi tanpa risiko EXTRAWD . Selanjutnya, gunakan bonus dan promosi yang kami tawarkan untuk meningkatkan modal Anda. Ini tidak hanya memberi Anda lebih banyak peluang untuk bermain, tetapi juga menambah peluang Anda untuk menang. Selalu ingat, bermain dengan bijak dan bertanggung jawab adalah kunci untuk mengoptimalkan keuntungan Anda. Di EXTRAWD, kami berkomitmen untuk membuat pengalaman bermain Anda tidak hanya menyenangkan, tetapi juga menguntungkan. Bermain dengan Bijak dan Bertanggung Jawab di EXTRAWD Bermain judi online di EXTRAWD  bukan hanya tentang menang, tetapi juga tentang bermain dengan bijak dan bertanggung jawab. Kami sangat menekankan pentingnya bermain dengan cara yang bertanggung jawab untuk memastikan bahwa Anda selalu menikmati pengalaman bermain Anda dan menghindari potensi masalah. Ingatlah untuk selalu menetapkan batas untuk diri Anda sendiri, baik itu batas waktu, batas uang, atau keduanya. Jangan pernah menghabiskan lebih banyak uang atau waktu daripada yang Anda mampu, dan selalu beristirahat jika Anda merasa lelah atau frustasi. Selain itu, jangan pernah bermain ketika Anda merasa pemarah, sedih, atau di bawah pengaruh alkohol. Di EXTRAWD, kami mendukung permainan yang bertanggung jawab dan kami selalu siap membantu jika Anda membutuhkan bantuan atau nasihat. Bagaimana EXTRAWD Meningkatkan Pengalaman Bermain Judi Situs Slot Megawin EXTRAWD  bekerja tanpa henti untuk meningkatkan pengalaman bermain judi online Anda. Kami berkomitmen dalam menghadirkan layanan terbaik dengan berbagai fitur dan fasilitas yang bertujuan untuk meningkatkan kepuasan dan kenyamanan Anda. Pertama, kami menyediakan berbagai pilihan permainan yang luas dan bervariasi, mencakup semua genre populer seperti Sportsbook Odds dan Live Casino. Kedua, platform kami dirancang dengan antarmuka yang mudah digunakan dan responsif, memastikan bahwa Anda bisa bermain dengan lancar tanpa hambatan teknis. Ketiga, kami menawarkan sistem keamanan yang solid untuk melindungi data dan transaksi Anda, sehingga Anda bisa bermain dengan tenang tanpa khawatir. Keempat, dukungan pelanggan kami selalu siap 24/7 untuk membantu Anda dengan setiap pertanyaan atau masalah yang mungkin timbul. Melalui kombinasi pilihan permainan yang berlimpah, platform yang user-friendly, keamanan yang terjamin, dan layanan pelanggan yang responsif, EXTRAWD berusaha keras untuk membuat pengalaman bermain judi online Anda menjadi yang terbaik.
    • LINK ADA DI BAWAH INI LINK LOGIN LINK ALTERNATIF LINK LIVE CHAT  Perkembangan judi online dan slot online telah mengubah cara orang berjudi. Hadirnya akses online memungkinkan siapa pun untuk menikmati permainan tanpa harus melakukan perjalanan jauh ke luar negeri. Dengan hanya memiliki smartphone dan koneksi internet stabil, judi online dapat diakses kapan saja dan di mana saja. Namun pesatnya perkembangan ini juga membawa dampak negatif, yaitu meningkatnya situs-situs yang curang dan membuat pemain rugi. Oleh karena itu, penting bagi pemain untuk memilih situs judi online yang terpercaya. Salah satu yang perlu diperhatikan adalah EXTRAWD, sebuah situs resmi yang telah memiliki reputasi baik dan sertifikasi untuk menyelenggarakan permainan judi dan slot online. Segera daftar situs nanastoto pada link alternatif EXTRAWD.
    • LINK ADA DI BAWAH INI LINK LOGIN LINK ALTERNATIF LINK LIVE CHAT  Perkembangan judi online dan slot online telah mengubah cara orang berjudi. Hadirnya akses online memungkinkan siapa pun untuk menikmati permainan tanpa harus bepergian jauh ke luar negeri. Dengan hanya memiliki smartphone dan koneksi internet stabil, judi online bisa diakses kapan saja dan di mana saja. Namun, pesatnya perkembangan ini juga membawa dampak negatif, yaitu meningkatnya situs-situs yang curang dan membuat pemain rugi. Oleh karena itu, penting bagi pemain untuk memilih situs judi online yang terpercaya. Salah satu yang patut dipertimbangkan adalah EXTRAWD, sebuah situs resmi yang telah memiliki reputasi baik dan sertifikasi untuk menyelenggarakan permainan judi dan slot online. Segera daftar situs nanastoto pada link alternatif EXTRAWD.
    • LINK ADA DI BAWAH INI {LINK LOGIN} LINK DAFTAR} {LINK ALTERNATIF} EXTRAWD: Menggapai Keseruan dan Kesenangan Tanpa Batas di Dunia Game Online Terbaru Saat ini. Dalam panggung yang semakin berkembang dan dinamis dari game online, EXTRAWD muncul sebagai angin segar di tahun 2024, menawarkan kombinasi unik antara kemudahan bermain dan pengalaman yang mendalam. Sebagai situs game online terbaru, EXTRAWD mengambil perhatian para pecinta game dengan filosofi "mudah dimainkan," menciptakan destinasi yang menjanjikan keseruan tanpa batas bagi setiap pemain. Dalam artikel ini, kita akan menjelajahi lebih dalam tentang EXTRAWD , situs game online yang sedang naik daun, serta beberapa kata kunci terkait, seperti daftar EXTRAWD , link alternatif EXTRAWD, dan server Adi Thailand. Nanaslot: Mengenali Fenomena Baru di Dunia Game Online 1. Mudah Dimainkan, Seru Dimenangkan EXTRAWD mengusung konsep sederhana namun efektif: memudahkan para pemain untuk meraih keseruan. Desain permainan yang user-friendly membuat Nanaslot cocok untuk semua tingkatan pemain, dari yang baru memulai hingga yang berpengalaman. Tanpa kerumitan berlebihan, setiap sesi bermain dijamin membawa kegembiraan dan potensi kemenangan. 2. Ragam Game yang Mengasyikkan Keberagaman game adalah salah satu kekuatan utama Nanaslot. Dari slot klasik hingga permainan inovatif dengan fitur-fitur canggih, Nanaslot memberikan pilihan yang memuaskan setiap selera pemain. Setiap game didesain dengan teliti untuk memberikan pengalaman bermain yang tak terlupakan. 3. Tampilan Grafis yang Memukau Pengalaman visual menjadi fokus EXTRAWD . Dengan tampilan grafis yang cerah, menawan, dan memukau, EXTRAWD menciptakan atmosfer yang menyenangkan. Setiap detail permainan dirancang untuk meningkatkan kegembiraan pemain dan memberikan nuansa menyenangkan di setiap putaran. 4. Bonus dan Promosi Menggiurkan Nanaslot tidak hanya menawarkan game yang mengasyikkan, tetapi juga memanjakan pemain dengan berbagai bonus dan promosi. Bonus selamat datang yang menarik dan promosi reguler memberikan nilai tambah bagi setiap pemain, memberikan motivasi tambahan untuk menjelajahi berbagai game yang ditawarkan oleh EXTRAWD. 5. Kemudahan Transaksi dan Keamanan Terjamin Proses transaksi yang mudah dan aman adalah prioritas Nanaslot. Pemain dapat melakukan deposit dan penarikan dengan cepat dan mudah, sementara sistem keamanan terkini menjaga privasi dan keamanan informasi pribadi pemain. Mendaftar di Nanaslot: Proses yang Mudah dan Cepat 1. Daftar EXTRAWD dengan Langkah Sederhana Mendaftar di Nanaslot merupakan proses yang mudah dan cepat. Pemain hanya perlu mengisi formulir pendaftaran dengan informasi dasar seperti nama, alamat email, dan nomor telepon. Setelah itu, pemain akan mendapatkan akun pribadi untuk mulai menjelajahi dunia game online yang menarik di EXTRAWD. 2. Link Alternatif Nanaslot: Akses yang Tanpa Batas EXTRAWD menyadari pentingnya aksesibilitas yang mudah bagi semua pemainnya. Oleh karena itu, Nanaslot menyediakan link alternatif yang dapat digunakan jika pemain mengalami kendala akses ke situs utama. Link alternatif ini memastikan bahwa pengalaman bermain tetap lancar tanpa terhalang oleh kendala teknis. Server EXTRAWD di Thailand: Pengalaman Bermain yang Mengglobal 1. Server Berkualitas dari Thailand EXTRAWD menjadikan Thailand sebagai basis server utamanya. Dengan kehadiran server berkualitas tinggi, pemain dijamin mendapatkan pengalaman bermain yang lancar, cepat, dan tanpa hambatan teknis. Server di Thailand juga menghadirkan kestabilan koneksi untuk memastikan setiap sesi bermain berjalan dengan baik. 2. Pengalaman Bermain yang Mengglobal Meskipun server utama berlokasi di Thailand, Nanaslot menyediakan pengalaman bermain yang mengglobal. Pemain dari berbagai negara dapat bergabung dan menikmati game online yang seru tanpa batas wilayah. Kelebihan EXTRAWD : Merajut Keunikan dalam Dunia Game Online 1. Komitmen pada Kesederhanaan Salah satu kekuatan terbesar EXTRAWD Daslot adalah komitmennya pada kesederhanaan. Tanpa banyak aturan rumit, pemain dapat langsung merasakan keseruan dan kegembiraan bermain game online. 2. Dukungan Pelanggan Profesional EXTRAWD menempatkan kepuasan pelanggan di pusat perhatiannya. Tim dukungan pelanggan yang profesional dan responsif siap membantu pemain dengan pertanyaan atau kendala teknis, menciptakan pengalaman bermain yang nyaman dan tanpa stres. 3. Kompatibilitas dengan Berbagai Perangkat EXTRAWD dirancang untuk memenuhi kebutuhan pemain yang selalu bergerak. Kompatibilitas dengan berbagai perangkat, termasuk komputer, tablet, dan ponsel pintar, memastikan pemain dapat menikmati game favorit mereka kapan saja dan di mana saja. Kesimpulan: Membuka Petualangan Baru di EXTRAWD DAFTAR EXTRAWD bukan sekadar situs game online terbaru, tetapi sebuah petualangan baru yang menjanjikan keseruan tanpa batas. Dengan fokus pada kesederhanaan, keamanan, dan pengalaman bermain yang mengasyikkan, Nanaslot menjadi pilihan utama bagi mereka yang mencari platform game online yang unik dan menarik. Daftar sekarang, nikmati bonus menarik, dan temukan pengalaman bermain yang tak terlupakan di Nanaslot. Selamat bermain, dan semoga keberuntungan selalu menyertai petualangan Anda!
    • I think its also worth mentioning that when we press disconnect we get the same error type this time it says its a mouseclicked event handler Error: java.lang.IndexOutOfBoundsException: bitIndex < 0: -1
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.