Jump to content

[1.10][Solved] See through ItemBlock but not in Block form


Recommended Posts

Posted

Hey, I made item models involving water, and they turned really good... but when i tried blocks, they dont wanna be see-trough :(,

 

I made an example for the sake of showing this,

 

all.png

block.png

 

There you see all the item forms are see-through, and the block is not.

 

BlockState

 

{
    "variants": {
        "normal": { "model": "test:water" },
        "inventory": { "model": "test:water" }
    }
}

 

 

Block model

 

{
    "textures": {
        "wf": "blocks/water_flow",
        "ws": "blocks/water_still"
    },
    "elements": [
        {
            "name": "Water",
            "from": [ 0.0, 0.0, 0.0 ], 
            "to": [ 16.0, 16.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#wf", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "east": { "texture": "#wf", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "south": { "texture": "#wf", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "west": { "texture": "#wf", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "up": { "texture": "#ws", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "down": { "texture": "#ws", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }
            }
        }
    ]
}

 

 

Item model

 

{
    "parent": "test:block/water"
}

 

 

Block class

 

package test.stuff;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class WaterTest extends Block {

public WaterTest() {
	super(Material.WATER);
	this.setRegistryName("water");
	this.setUnlocalizedName("water");
	this.setLightOpacity(0);
	this.setLightLevel(0);
}

@SideOnly(Side.CLIENT)
    public BlockRenderLayer getBlockLayer() {
        return BlockRenderLayer.CUTOUT_MIPPED;
    }

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

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

 

 

Item Class

 

package test.stuff;

import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import test.Initialization;

public class WaterTestItem extends ItemBlock{

public WaterTestItem() {
	super(Initialization.WATER);
	this.setRegistryName("waterItem");
        this.setUnlocalizedName("waterItem");
}

}

 

 

Initialization class

 

package test;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import test.stuff.WaterTest;
import test.stuff.WaterTestItem;

public class Initialization {

public static WaterTest WATER;
public static WaterTestItem WATERITEM;

public static void Init() {
	WATER = new WaterTest();
	WATERITEM = new WaterTestItem();
}

public static void Register() {
	GameRegistry.register(WATER);
	GameRegistry.register(WATERITEM);
}

public static void RegisterModels() {
	ModelResourceLocation model;
	model= new ModelResourceLocation(WATER.getRegistryName(), "inventory");
        ModelLoader.setCustomModelResourceLocation(WATERITEM, 0, model);
        model = new ModelResourceLocation(WATERITEM.getRegistryName(), "inventory");
        ModelLoader.setCustomModelResourceLocation(WATERITEM, 0, model);
}
}

 

 

Am I doing something wrong? :(

Is it not possible due to water texture implementation?

 

Thanks in advance,

NewDivide

Posted

return BlockRenderLayer.CUTOUT_MIPPED;

 

Cutout means that the alpha transparency is either 0 or 1.

You want BlockRenderLayer.TRANSPARENT;

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.

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.