Posted August 31, 201510 yr Hey folks, I am triing to create a new type of air (toxic air), which means I need a block that will be semi transparent. To do so I took a look at glass and how it does that. I think that my solution lies in shouldSideBeRendered, but I feel like Im missing something. I took the original method from the BlockBreakable class and removed some unnecessary checks, but its rendering as a full block. The reason I dont extend BlockBreakable is because the method I want is hardcoded to work for glass. package de.failender.shadowsrising.blocks; import de.failender.shadowsrising.ShadowsRising; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ToxicAir extends Block{ public ToxicAir() { super(Material.air); setCreativeTab(ShadowsRising.shadowTab); } public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { return null; } public boolean isOpaqueCube() { return false; } public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) { return false; } @Override public boolean isReplaceable(World worldIn, BlockPos pos) { return true; } public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side) { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate) { return true; } if (block == this) { return false; } return block == this ? false : super.shouldSideBeRendered(worldIn, pos, side); } }
August 31, 201510 yr What is the problem that you are having? 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.
August 31, 201510 yr Author Oh sorry I was rewriting my text and removed the problem.. retarded me. The block is not transparent. Its passable and all that but rendering like there is no transparency
August 31, 201510 yr The problem is in your json file. Take a look at the json files for colored glass. 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.
September 1, 201510 yr Author to be honest. im not sure whats the problem in there. if i compare those jsons.. block models { "parent": "block/cube_all", "textures": { "all": "shadowsrising:blocks/toxicair" } } { "parent": "block/cube_all", "textures": { "all": "blocks/glass_yellow" } } blockstates { "variants": { "normal": { "model": "shadowsrising:toxicair"} } } { "variants": { "normal": { "model": "glass_yellow" } } }
September 1, 201510 yr If you look in BlockStainedGlass you will find this @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.TRANSLUCENT; } while in Normal Glass TRANSLUCENT is instead CUTOUT. Add this to your block class and it should fix the problem you are having. Did you really need to know?
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.