Jump to content

[1.14.3] how to make a block like the cauldron


Finiox

Recommended Posts

Hello,

 

So I created a block where it's model is copied from the cauldron and I altered it in a program called "Blockbench" which was listed on the minecraft wiki but when I open it ingame the block registers it as a "full block" and removed things like transparency (it seems).

 

Blockbench render:

image.thumb.png.06c20eda9f043a3611517bcec70a0137.png]

 

Minecraft render:
image.thumb.png.0d9ee3ca06d26c1318bc7fa02e546c57.png

image.png.fc00de7fb5b79cd2fd0848c04b4b0833.png

 

So the 2 main problems are that the glass is not transparent. Which is weird because I copied textures from a normal glass block in paint.NET and the top is transparent.

And the other one is have the block below it turns into an transparent block which is logical because it's face isn't drawn because it has a full block above but I want to prevent this.

 

So what approach do I need to make this "fish tank" into a block like the cauldron with the same hitboxes?

Thanks in advance!

 

 

Code:

 

Spoiler

public class FishTankBlock extends Block {

    public static final String ID = "fish_tank";

    public FishTankBlock(Properties properties) {
        super(properties);
    }

    public static Block newInstance() {
        return new FishTankBlock(
            Properties
                .create(Material.GLASS)
                .hardnessAndResistance(1.0f, 1.0f)
                .sound(SoundType.GLASS)
        )
        .setRegistryName(new ResourceLocation(XioCraftMod.ID, FishTankBlock.ID));
    }

    public static Item getItem() {
        return new BlockItem(
            BlockList.fish_tank,
            new Item.Properties()
                    .group(ItemGroup.DECORATIONS)
        )
        .setRegistryName(ID);
    }
}
Spoiler

{
   "credit": "Made with Blockbench",
   "ambientocclusion": false,
   "textures": {
      "top": "xiocraft:block/fish_tank_top",
      "bottom": "xiocraft:block/fish_tank_bottom",
      "side": "xiocraft:block/fish_tank_side",
      "particle": "xiocraft:block/fish_tank_side",
      "inside": "xiocraft:block/fish_tank_inner"
   },
   "elements": [
      {
         "from": [0, 3, 0],
         "to": [2, 16, 16],
         "faces": {
            "north": {"uv": [14, 0, 16, 13], "texture": "#side", "cullface": "north"},
            "east": {"uv": [0, 0, 16, 13], "texture": "#side", "cullface": "up"},
            "south": {"uv": [0, 0, 2, 13], "texture": "#side", "cullface": "south"},
            "west": {"uv": [0, 0, 16, 13], "texture": "#side", "cullface": "west"},
            "up": {"uv": [0, 0, 2, 16], "texture": "#top", "cullface": "up"},
            "down": {"uv": [0, 0, 2, 16], "texture": "#inside"}
         }
      },
      {
         "from": [2, 3, 2],
         "to": [14, 4, 14],
         "faces": {
            "north": {"uv": [2, 12, 14, 13], "texture": "#inside"},
            "east": {"uv": [2, 12, 14, 13], "texture": "#inside"},
            "south": {"uv": [2, 12, 14, 13], "texture": "#inside"},
            "west": {"uv": [2, 12, 14, 13], "texture": "#inside"},
            "up": {"uv": [0, 0, 16, 16], "texture": "#inside", "cullface": "up"},
            "down": {"uv": [0, 0, 16, 16], "texture": "#inside"}
         }
      },
      {
         "from": [14, 3, 0],
         "to": [16, 16, 16],
         "faces": {
            "north": {"uv": [0, 0, 2, 13], "texture": "#side", "cullface": "north"},
            "east": {"uv": [0, 0, 16, 13], "texture": "#side", "cullface": "east"},
            "south": {"uv": [14, 0, 16, 13], "texture": "#side", "cullface": "south"},
            "west": {"uv": [0, 0, 16, 13], "texture": "#side", "cullface": "up"},
            "up": {"uv": [14, 0, 16, 16], "texture": "#top", "cullface": "up"},
            "down": {"uv": [14, 0, 16, 16], "texture": "#inside"}
         }
      },
      {
         "from": [2, 3, 0],
         "to": [14, 16, 2],
         "faces": {
            "north": {"uv": [2, 0, 14, 13], "texture": "#side", "cullface": "north"},
            "south": {"uv": [2, 0, 14, 13], "texture": "#side", "cullface": "up"},
            "up": {"uv": [2, 0, 14, 2], "texture": "#top", "cullface": "up"},
            "down": {"uv": [2, 14, 14, 16], "texture": "#inside"}
         }
      },
      {
         "from": [2, 3, 14],
         "to": [14, 16, 16],
         "faces": {
            "north": {"uv": [2, 0, 14, 13], "texture": "#side", "cullface": "up"},
            "south": {"uv": [2, 0, 14, 13], "texture": "#side", "cullface": "south"},
            "up": {"uv": [2, 14, 14, 16], "texture": "#top", "cullface": "up"},
            "down": {"uv": [2, 0, 14, 2], "texture": "#inside"}
         }
      },
      {
         "from": [0, 0, 0],
         "to": [4, 3, 2],
         "faces": {
            "north": {"uv": [12, 13, 16, 16], "texture": "#side", "cullface": "north"},
            "east": {"uv": [14, 13, 16, 16], "texture": "#side"},
            "south": {"uv": [0, 13, 4, 16], "texture": "#side"},
            "west": {"uv": [0, 13, 2, 16], "texture": "#side", "cullface": "west"},
            "up": {"uv": [0, 0, 4, 2], "texture": "#top"},
            "down": {"uv": [0, 14, 4, 16], "texture": "#bottom", "cullface": "down"}
         }
      },
      {
         "from": [0, 0, 2],
         "to": [2, 3, 4],
         "faces": {
            "east": {"uv": [12, 13, 14, 16], "texture": "#side"},
            "south": {"uv": [0, 13, 2, 16], "texture": "#side"},
            "west": {"uv": [2, 13, 4, 16], "texture": "#side", "cullface": "west"},
            "up": {"uv": [0, 2, 2, 4], "texture": "#top"},
            "down": {"uv": [0, 12, 2, 14], "texture": "#bottom", "cullface": "down"}
         }
      },
      {
         "from": [12, 0, 0],
         "to": [16, 3, 2],
         "faces": {
            "north": {"uv": [0, 13, 4, 16], "texture": "#side", "cullface": "north"},
            "east": {"uv": [14, 12, 16, 15], "texture": "#side", "cullface": "east"},
            "south": {"uv": [12, 13, 16, 16], "texture": "#side"},
            "west": {"uv": [0, 13, 2, 16], "texture": "#side"},
            "up": {"uv": [11, 0, 16, 2], "texture": "#top"},
            "down": {"uv": [12, 14, 16, 16], "texture": "#bottom", "cullface": "down"}
         }
      },
      {
         "from": [14, 0, 2],
         "to": [16, 3, 4],
         "faces": {
            "east": {"uv": [12, 13, 14, 16], "texture": "#side", "cullface": "east"},
            "south": {"uv": [14, 13, 16, 16], "texture": "#side"},
            "west": {"uv": [2, 13, 4, 16], "texture": "#side"},
            "up": {"uv": [14, 2, 16, 4], "texture": "#top"},
            "down": {"uv": [14, 12, 16, 14], "texture": "#bottom", "cullface": "down"}
         }
      },
      {
         "from": [0, 0, 14],
         "to": [4, 3, 16],
         "faces": {
            "north": {"uv": [12, 13, 16, 16], "texture": "#side"},
            "east": {"uv": [0, 13, 2, 16], "texture": "#side"},
            "south": {"uv": [0, 13, 4, 16], "texture": "#side", "cullface": "south"},
            "west": {"uv": [14, 13, 16, 16], "texture": "#side", "cullface": "west"},
            "up": {"uv": [0, 14, 4, 16], "texture": "#top"},
            "down": {"uv": [0, 0, 4, 2], "texture": "#bottom", "cullface": "down"}
         }
      },
      {
         "from": [0, 0, 12],
         "to": [2, 3, 14],
         "faces": {
            "north": {"uv": [14, 13, 16, 16], "texture": "#side"},
            "east": {"uv": [2, 13, 4, 16], "texture": "#side"},
            "west": {"uv": [12, 13, 14, 16], "texture": "#side", "cullface": "west"},
            "up": {"uv": [0, 12, 2, 14], "texture": "#top"},
            "down": {"uv": [0, 2, 2, 4], "texture": "#bottom", "cullface": "down"}
         }
      },
      {
         "from": [12, 0, 14],
         "to": [16, 3, 16],
         "faces": {
            "north": {"uv": [0, 13, 4, 16], "texture": "#side"},
            "east": {"uv": [0, 13, 2, 16], "texture": "#side", "cullface": "east"},
            "south": {"uv": [12, 13, 16, 16], "texture": "#side", "cullface": "south"},
            "west": {"uv": [14, 13, 16, 16], "texture": "#side"},
            "up": {"uv": [12, 14, 16, 16], "texture": "#top"},
            "down": {"uv": [12, 0, 16, 2], "texture": "#bottom", "cullface": "down"}
         }
      },
      {
         "from": [14, 0, 12],
         "to": [16, 3, 14],
         "faces": {
            "north": {"uv": [0, 13, 2, 16], "texture": "#side"},
            "east": {"uv": [2, 13, 4, 16], "texture": "#side", "cullface": "east"},
            "west": {"uv": [12, 13, 14, 16], "texture": "#side"},
            "up": {"uv": [14, 12, 16, 14], "texture": "#top"},
            "down": {"uv": [14, 2, 16, 4], "texture": "#bottom", "cullface": "down"}
         }
      }
   ]
}

 

Link to comment
Share on other sites

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

1 hour ago, Draco18s said:

@Draco18s thanks I also remodeled the block but your methods there are deprecated and I searched thru the `Block` class and can't find a way for entities to walk inside of the block like you can do with a cauldron.  I'm guessing its the `isFullCube` override but this is deprecated. So where would I find documentation for this to get the right methods and properties

Link to comment
Share on other sites

2 hours ago, Finiox said:

@Draco18s thanks I also remodeled the block but your methods there are deprecated and I searched thru the `Block` class and can't find a way for entities to walk inside of the block like you can do with a cauldron.  I'm guessing its the `isFullCube` override but this is deprecated. So where would I find documentation for this to get the right methods and properties

Forge's Mojang's "deprecated" means that modders should not call the method.

Overriding it, however, is fine (as stated in the Javadoc of such methods).

Edited by DavidM
Forge -> Mojang

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

23 minutes ago, DavidM said:

Forge's "deprecated" means that modders should not call the method.

Overriding it, however, is fine (as stated in the Javadoc of such methods).

Those aren't from Forge, they're from Mojang.

(But you're otherwise correct)

  • Haha 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

isOpaqueCube() is definitely still in Block (although the method signature has changed).  Its default implementation should be fine for most cases.

 

isFullCube() is gone and no longer needed since Minecraft can determine that from your block's voxel shape.

Link to comment
Share on other sites

  • 3 weeks later...

Thry out:

    @Override
    public boolean isSolid(BlockState state)
    {
        return false;
    }

my custom shaped blocks have no transparent holes in the ground below them with it.

 

And in my block registry, my blocks have ".variableOpacity()" in their registry-lines. so maybe try around with it.

Edited by Drachenbauer
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



×
×
  • Create New...

Important Information

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