Reimplented connected textures with jsons

- Reimplented connected glass textures using jsons. @shartte can't be
done with jsons, huh?
This commit is contained in:
elix-x 2016-08-20 14:38:46 +02:00
parent 0c4cb295f3
commit 588b5d91cc
16 changed files with 107 additions and 24 deletions

View File

@ -22,6 +22,8 @@ package appeng.decorative.solid;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
@ -30,11 +32,18 @@ import net.minecraft.world.IBlockAccess;
import appeng.block.AEBaseBlock;
import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
public class BlockQuartzGlass extends AEBaseBlock
{
public static final PropertyBool[] props = { PropertyBool.create( "down" ), PropertyBool.create( "up" ), PropertyBool.create( "north" ), PropertyBool.create( "south" ), PropertyBool.create( "west" ), PropertyBool.create( "east" ) };
private static boolean isGlassBlock( IBlockAccess world, BlockPos pos, EnumFacing facing )
{
return world.getBlockState( pos.offset( facing ) ).getBlock() instanceof BlockQuartzGlass;
}
public BlockQuartzGlass()
{
super( Material.GLASS );
@ -43,9 +52,26 @@ public class BlockQuartzGlass extends AEBaseBlock
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
private static boolean isGlassBlock( IBlockAccess world, BlockPos pos, EnumFacing facing )
@Override
protected IProperty[] getAEStates()
{
return world.getBlockState( pos.offset( facing ) ).getBlock() instanceof BlockQuartzGlass;
return props;
}
@Override
public int getMetaFromState( IBlockState state )
{
return 0;
}
@Override
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
for( EnumFacing facing : EnumFacing.values() )
{
state = state.withProperty( props[facing.ordinal()], isGlassBlock( world, pos, facing ) );
}
return state;
}
@Override
@ -57,15 +83,7 @@ public class BlockQuartzGlass extends AEBaseBlock
@Override
public boolean shouldSideBeRendered( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
{
final Material mat = w.getBlockState( pos ).getBlock().getMaterial( state );
if( mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE )
{
if( w.getBlockState( pos ).getBlock().getRenderType( state ) == this.getRenderType( state ) )
{
return false;
}
}
return super.shouldSideBeRendered( state, w, pos, side );
return !isGlassBlock( w, pos, side ) && super.shouldSideBeRendered( state, w, pos, side );
}
@Override

View File

@ -1,7 +1,31 @@
{
"variants": {
"normal": {
"model": "appliedenergistics2:quartz"
"multipart": [
{
"apply": [{ "model": "appliedenergistics2:quartz_glass_1" }, { "model": "appliedenergistics2:quartz_glass_2" }, { "model": "appliedenergistics2:quartz_glass_3" }, { "model": "appliedenergistics2:quartz_glass_4" }]
},
{
"when": { "down": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "x": 90 }
},
{
"when": { "up": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "x": -90 }
},
{
"when": { "north": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame"}
},
{
"when": { "south": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "y": 180 }
},
{
"when": { "west": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "y": -90 }
},
{
"when": { "east": "false" },
"apply": { "model": "appliedenergistics2:quartz_glass_frame", "y": 90 }
}
}
}
]
}

View File

@ -1,6 +0,0 @@
{
"parent": "block/cube_all",
"textures": {
"all": "appliedenergistics2:blocks/quartz_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "appliedenergistics2:blocks/quartz_glass_1"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "appliedenergistics2:blocks/quartz_glass_2"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "appliedenergistics2:blocks/quartz_glass_3"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "appliedenergistics2:blocks/quartz_glass_4"
}
}

View File

@ -0,0 +1,18 @@
{
"textures": {
"0": "appliedenergistics2:blocks/quartz_glass_frame"
},
"elements": [
{
"name": "Frame",
"from": [ 0.0, 0.0, 0.0 ],
"to": [ 16.0, 16.0, 1.0 ],
"faces": {
"east": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 16.0 ], "cullface": "east" },
"west": { "texture": "#0", "uv": [ 0.0, 0.0, 1.0, 16.0 ], "cullface": "west" },
"up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ], "cullface": "up" },
"down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ], "cullface": "down" }
}
}
]
}

View File

@ -1,6 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "appliedenergistics2:items/quartz_glass"
"all": "appliedenergistics2:blocks/quartz_glass"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,5 @@
{
"animation": {
"frametime": 100
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B