Custom Model Loader
This commit is contained in:
@@ -19,15 +19,12 @@
|
||||
package appeng.decorative;
|
||||
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
|
||||
public abstract class AEDecorativeBlock extends AEBaseBlock
|
||||
public class AEDecorativeBlock extends AEBaseBlock
|
||||
{
|
||||
public AEDecorativeBlock( final Material mat )
|
||||
{
|
||||
super( mat );
|
||||
public AEDecorativeBlock(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
// @Override
|
||||
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// return Api.INSTANCE
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystalCharged()
|
||||
@@ -53,7 +53,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
// @Override
|
||||
// public int damageDropped( final BlockState state )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// return Api.INSTANCE
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystalCharged()
|
||||
@@ -65,7 +65,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
// @Override
|
||||
// public ItemStack getPickBlock( BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// return Api.INSTANCE
|
||||
// .definitions()
|
||||
// .blocks()
|
||||
// .quartzOreCharged()
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
|
||||
|
||||
public final class BlockChiseledQuartz extends AEDecorativeBlock
|
||||
{
|
||||
public BlockChiseledQuartz()
|
||||
{
|
||||
super( Material.ROCK );
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
|
||||
|
||||
public final class BlockQuartz extends AEDecorativeBlock
|
||||
{
|
||||
public BlockQuartz()
|
||||
{
|
||||
super( Material.ROCK );
|
||||
}
|
||||
}
|
||||
@@ -22,94 +22,80 @@ package appeng.decorative.solid;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
|
||||
|
||||
public class BlockQuartzGlass extends AEBaseBlock
|
||||
{
|
||||
|
||||
// This unlisted property is used to determine the actual block that should be rendered
|
||||
public static final UnlistedGlassStateProperty GLASS_STATE = new UnlistedGlassStateProperty();
|
||||
|
||||
public BlockQuartzGlass()
|
||||
{
|
||||
super( Material.GLASS );
|
||||
this.setLightOpacity( 0 );
|
||||
super( Properties.create(Material.GLASS) );
|
||||
// FIXME this.setLightOpacity( 0 );
|
||||
this.setOpaque( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
IProperty[] listedProperties = new IProperty[0];
|
||||
IUnlistedProperty[] unlistedProperties = new IUnlistedProperty[] { GLASS_STATE };
|
||||
return new ExtendedBlockState( this, listedProperties, unlistedProperties );
|
||||
// @Override
|
||||
// protected BlockStateContainer createBlockState()
|
||||
// {
|
||||
// IProperty[] listedProperties = new IProperty[0];
|
||||
// IUnlistedProperty[] unlistedProperties = new IUnlistedProperty[] { GLASS_STATE };
|
||||
// return new ExtendedBlockState( this, listedProperties, unlistedProperties );
|
||||
// }
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public BlockRenderLayer getBlockLayer()
|
||||
// FIXME {
|
||||
// FIXME return BlockRenderLayer.CUTOUT;
|
||||
// FIXME }
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public boolean shouldSideBeRendered( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
// FIXME {
|
||||
// FIXME BlockPos adjacentPos = pos.offset( side );
|
||||
// FIXME
|
||||
// FIXME final Material mat = w.getBlockState( adjacentPos ).getMaterial();
|
||||
// FIXME
|
||||
// FIXME if( mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE )
|
||||
// FIXME {
|
||||
// FIXME if( w.getBlockState( adjacentPos ).getRenderType() == this.getRenderType( state ) )
|
||||
// FIXME {
|
||||
// FIXME return false;
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME return super.shouldSideBeRendered( state, w, pos, side );
|
||||
// FIXME }
|
||||
|
||||
// BEGIN: Copied from AbstractGlassBlock
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public float getAmbientOcclusionLightValue(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
|
||||
EnumSet<Direction> flushWith = EnumSet.noneOf( Direction.class );
|
||||
// Test every direction for another glass block
|
||||
for( Direction facing : Direction.values() )
|
||||
{
|
||||
if( isGlassBlock( world, pos, facing ) )
|
||||
{
|
||||
flushWith.add( facing );
|
||||
}
|
||||
}
|
||||
|
||||
GlassState glassState = new GlassState( pos.getX(), pos.getY(), pos.getZ(), flushWith );
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
|
||||
return extState.withProperty( GLASS_STATE, glassState );
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isGlassBlock( IBlockReader world, BlockPos pos, Direction facing )
|
||||
{
|
||||
return world.getBlockState( pos.offset( facing ) ).getBlock() instanceof BlockQuartzGlass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSideBeRendered( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
{
|
||||
BlockPos adjacentPos = pos.offset( side );
|
||||
|
||||
final Material mat = w.getBlockState( adjacentPos ).getMaterial();
|
||||
|
||||
if( mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE )
|
||||
{
|
||||
if( w.getBlockState( adjacentPos ).getRenderType() == this.getRenderType( state ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return super.shouldSideBeRendered( state, w, pos, side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( BlockState state )
|
||||
{
|
||||
public boolean causesSuffocation(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEntitySpawn(BlockState state, IBlockReader worldIn, BlockPos pos, EntityType<?> type) {
|
||||
return false;
|
||||
}
|
||||
// END: Copied from AbstractGlassBlock
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BlockQuartzOre extends AEBaseBlock
|
||||
// @Override
|
||||
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// return Api.INSTANCE
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystal()
|
||||
@@ -86,7 +86,7 @@ public class BlockQuartzOre extends AEBaseBlock
|
||||
// @Override
|
||||
// public int damageDropped( final BlockState state )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// return Api.INSTANCE
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystal()
|
||||
|
||||
@@ -19,9 +19,11 @@
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -29,32 +31,24 @@ import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.helpers.MetaRotation;
|
||||
|
||||
|
||||
public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock
|
||||
public class BlockQuartzPillar extends AEDecorativeBlock implements IOrientableBlock
|
||||
{
|
||||
public static final EnumProperty<Direction.Axis> AXIS = BlockStateProperties.AXIS;
|
||||
|
||||
public BlockQuartzPillar()
|
||||
{
|
||||
super( Material.ROCK );
|
||||
public BlockQuartzPillar(Properties props) {
|
||||
super(props);
|
||||
|
||||
// The upwards facing pillar is the default (i.e. for the item model)
|
||||
this.setDefaultState( this.getDefaultState().with( AXIS, Direction.Axis.Y ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AXIS };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMetadata()
|
||||
{
|
||||
return true;
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(AXIS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user