Skip to content

Commit

Permalink
Merged stairs feature handler with block's one
Browse files Browse the repository at this point in the history
Merged stairs feature handler with block's one.
Relates to #9.
  • Loading branch information
Elix-x committed Jul 20, 2016
1 parent 8c5d85d commit dc7ddfe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 143 deletions.
29 changes: 8 additions & 21 deletions src/main/java/appeng/block/AEBaseBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

Expand All @@ -66,6 +63,7 @@
import appeng.util.LookDirection;
import appeng.util.Platform;


public abstract class AEBaseBlock extends Block implements IAEFeature
{

Expand All @@ -78,8 +76,7 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
private boolean hasSubtypes = false;
private boolean isInventory = false;
private IFeatureHandler handler;
private String textureName;


protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;

@Override
Expand Down Expand Up @@ -131,7 +128,7 @@ public String toString()
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {} );
return new BlockStateContainer( this, this.getAEStates() );
}

protected IProperty[] getAEStates()
Expand Down Expand Up @@ -168,7 +165,7 @@ public boolean isOpaque()
}

@Override
public boolean isNormalCube(IBlockState state)
public boolean isNormalCube( IBlockState state )
{
return this.isFullSize() && this.isOpaque();
}
Expand All @@ -187,7 +184,7 @@ public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, Blo
{
return boundingBox;
}

@Override
public void addCollisionBoxToList( final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
Expand All @@ -211,7 +208,7 @@ public void addCollisionBoxToList( final IBlockState state, final World w, final
super.addCollisionBoxToList( state, w, pos, bb, out, e );
}
}

@Override
@SideOnly( Side.CLIENT )
public AxisAlignedBB getSelectedBoundingBox( IBlockState state, final World w, final BlockPos pos )
Expand Down Expand Up @@ -297,7 +294,7 @@ public AxisAlignedBB getSelectedBoundingBox( IBlockState state, final World w, f
}

@Override
public final boolean isOpaqueCube(IBlockState state)
public final boolean isOpaqueCube( IBlockState state )
{
return this.isOpaque();
}
Expand Down Expand Up @@ -363,7 +360,7 @@ public final void getSubBlocks( final Item item, final CreativeTabs tabs, final
}

@Override
public boolean hasComparatorInputOverride(IBlockState state)
public boolean hasComparatorInputOverride( IBlockState state )
{
return this.isInventory();
}
Expand Down Expand Up @@ -541,16 +538,6 @@ public EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
return null;
}

public void setBlockTextureName( final String texture )
{
this.textureName = texture;
}

private String getTextureName()
{
return this.textureName;
}

public boolean isFullSize()
{
return this.isFullSize;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/appeng/block/AEBaseStairBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;

import appeng.core.features.AEBlockFeatureHandler;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
import appeng.core.features.StairBlockFeatureHandler;


public abstract class AEBaseStairBlock extends BlockStairs implements IAEFeature
Expand All @@ -45,7 +45,7 @@ protected AEBaseStairBlock( final Block block, final EnumSet<AEFeature> features
Preconditions.checkNotNull( block.getUnlocalizedName() );
Preconditions.checkArgument( block.getUnlocalizedName().length() > 0 );

this.features = new StairBlockFeatureHandler( features, this, Optional.of( type ) );
this.features = new AEBlockFeatureHandler( features, this, Optional.of( type ) );

this.setUnlocalizedName( "stair." + type );
this.setLightOpacity( 0 );
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/appeng/core/features/AEBlockFeatureHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.google.common.base.Optional;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelBakery;
Expand All @@ -35,22 +36,21 @@
import net.minecraftforge.fml.relauncher.Side;

import appeng.api.definitions.IBlockDefinition;
import appeng.block.AEBaseBlock;
import appeng.client.render.model.AEIgnoringStateMapper;
import appeng.core.AppEng;
import appeng.core.CreativeTab;


public final class AEBlockFeatureHandler implements IFeatureHandler
{
private final AEBaseBlock featured;
private final Block featured;
private final FeatureNameExtractor extractor;
private final boolean enabled;
private final BlockDefinition definition;

private ResourceLocation registryName;

public AEBlockFeatureHandler( final EnumSet<AEFeature> features, final AEBaseBlock featured, final Optional<String> subName )
public AEBlockFeatureHandler( final EnumSet<AEFeature> features, final Block featured, final Optional<String> subName )
{
final ActivityState state = new FeaturedActiveChecker( features ).getActivityState();

Expand Down
117 changes: 0 additions & 117 deletions src/main/java/appeng/core/features/StairBlockFeatureHandler.java

This file was deleted.

0 comments on commit dc7ddfe

Please sign in to comment.