Fixed stair rendering, still missing textures and itemblock for some reason

This commit is contained in:
thatsIch
2015-06-26 22:44:47 +02:00
parent 4e863e7d90
commit e21dab14e5
10 changed files with 83 additions and 147 deletions
@@ -21,15 +21,16 @@ package appeng.block;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
import appeng.core.features.StairBlockFeatureHandler;
import com.google.common.base.Optional;
public abstract class AEBaseStairBlock extends BlockStairs implements IAEFeature
{
@@ -22,11 +22,12 @@ package appeng.block.stair;
import java.util.EnumSet;
import net.minecraft.block.Block;
import appeng.block.AEBaseStairBlock;
import appeng.core.features.AEFeature;
public class BlockStairCommon extends AEBaseStairBlock
public final class BlockStairCommon extends AEBaseStairBlock
{
public BlockStairCommon( Block material, String type )
{
@@ -123,8 +123,8 @@ public class ClientHelper extends ServerHelper
@Override
public void init()
{
Item fluixItem = GameRegistry.findItem( "appliedenergistics2", "BlockFluix" );
ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation( "appliedenergistics2:BlockFluix", "inventory" );
Item fluixItem = GameRegistry.findItem( "appliedenergistics2", "fluix" );
ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation( "appliedenergistics2:fluix", "inventory" );
final int DEFAULT_ITEM_SUBTYPE = 0;
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( fluixItem, DEFAULT_ITEM_SUBTYPE, itemModelResourceLocation );
}
@@ -1,70 +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.client.render;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
public class ItemRenderer implements IItemRenderer
{
public static final ItemRenderer INSTANCE = new ItemRenderer();
@Override
public boolean handleRenderType( ItemStack item, ItemRenderType type )
{
return true;
}
@Override
public boolean shouldUseRenderHelper( ItemRenderType type, ItemStack item, ItemRendererHelper helper )
{
return true;
}
@Override
public void renderItem( ItemRenderType type, ItemStack item, Object... data )
{
GL11.glPushMatrix();
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
GL11.glEnable( GL11.GL_ALPHA_TEST );
GL11.glEnable( GL11.GL_DEPTH_TEST );
GL11.glEnable( GL11.GL_BLEND );
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
if( type == ItemRenderType.ENTITY )
{
GL11.glTranslatef( -0.5f, -0.5f, -0.5f );
}
if( type == ItemRenderType.INVENTORY )
{
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
}
WorldRender.INSTANCE.renderItemBlock( item, type, data );
GL11.glPopAttrib();
GL11.glPopMatrix();
}
}
@@ -19,6 +19,8 @@
package appeng.core.api.definitions;
import net.minecraft.block.Block;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IBlocks;
import appeng.api.definitions.ITileDefinition;
@@ -173,8 +175,8 @@ public final class ApiBlocks implements IBlocks
this.skyStone_block = constructor.registerBlockDefinition( new BlockSkyStone( SkystoneType.block ) );
this.skyStone_brick = constructor.registerBlockDefinition( new BlockSkyStone( SkystoneType.brick ) );
this.skyStone_smallbrick = constructor.registerBlockDefinition( new BlockSkyStone( SkystoneType.smallbrick ) );
this.skyChest = constructor.registerBlockDefinition( new BlockSkyChest(SkyChestType.STONE) );
this.skyChestBlock = constructor.registerBlockDefinition( new BlockSkyChest(SkyChestType.BLOCK) );
this.skyChest = constructor.registerBlockDefinition( new BlockSkyChest( SkyChestType.STONE ) );
this.skyChestBlock = constructor.registerBlockDefinition( new BlockSkyChest( SkyChestType.BLOCK ) );
this.skyCompass = constructor.registerBlockDefinition( new BlockSkyCompass() );
this.grindStone = constructor.registerTileDefinition( new BlockGrinder() );
this.crankHandle = constructor.registerTileDefinition( new BlockCrank() );
@@ -201,25 +203,25 @@ public final class ApiBlocks implements IBlocks
this.energyCell = constructor.registerTileDefinition( new BlockEnergyCell() );
this.energyCellDense = constructor.registerTileDefinition( new BlockDenseEnergyCell() );
this.energyCellCreative = constructor.registerTileDefinition( new BlockCreativeEnergyCell() );
this.craftingUnit = constructor.registerTileDefinition( new BlockCraftingUnit(CraftingUnitType.UNIT) );
this.craftingAccelerator = constructor.registerTileDefinition( new BlockCraftingUnit(CraftingUnitType.ACCELERATOR) );
this.craftingStorage1k = constructor.registerTileDefinition( new BlockCraftingStorage(CraftingUnitType.STORAGE_1K) );
this.craftingStorage4k = constructor.registerTileDefinition( new BlockCraftingStorage(CraftingUnitType.STORAGE_4K) );
this.craftingStorage16k = constructor.registerTileDefinition( new BlockCraftingStorage(CraftingUnitType.STORAGE_16K) );
this.craftingStorage64k = constructor.registerTileDefinition( new BlockCraftingStorage(CraftingUnitType.STORAGE_64K) );
this.craftingUnit = constructor.registerTileDefinition( new BlockCraftingUnit( CraftingUnitType.UNIT ) );
this.craftingAccelerator = constructor.registerTileDefinition( new BlockCraftingUnit( CraftingUnitType.ACCELERATOR ) );
this.craftingStorage1k = constructor.registerTileDefinition( new BlockCraftingStorage( CraftingUnitType.STORAGE_1K ) );
this.craftingStorage4k = constructor.registerTileDefinition( new BlockCraftingStorage( CraftingUnitType.STORAGE_4K ) );
this.craftingStorage16k = constructor.registerTileDefinition( new BlockCraftingStorage( CraftingUnitType.STORAGE_16K ) );
this.craftingStorage64k = constructor.registerTileDefinition( new BlockCraftingStorage( CraftingUnitType.STORAGE_64K ) );
this.craftingMonitor = constructor.registerTileDefinition( new BlockCraftingMonitor() );
this.molecularAssembler = constructor.registerTileDefinition( new BlockMolecularAssembler() );
this.lightDetector = constructor.registerTileDefinition( new BlockLightDetector() );
this.paint = constructor.registerTileDefinition( new BlockPaint() );
this.skyStoneStair = makeStairs( constructor,skyStone_stone, "skystone" ) ;
this.skyStoneBlockStair = makeStairs( constructor,skyStone_block, "skystone.block" ) ;
this.skyStoneBrickStair = makeStairs( constructor,skyStone_brick, "skystone.brick" ) ;
this.skyStoneSmallBrickStair = makeStairs( constructor, skyStone_smallbrick, "skystone.brick.small" ) ;
this.fluixStair = makeStairs( constructor, fluix, "fluix" ) ;
this.quartzStair = makeStairs( constructor,quartz, "quartz.certus" ) ;
this.chiseledQuartzStair = makeStairs( constructor, quartzChiseled, "quartz.certus.chiseled" ) ;
this.quartzPillarStair = makeStairs( constructor, quartzPillar, "quartz.certus.pillar" ) ;
this.skyStoneStair = makeStairs( constructor, skyStone_stone, "skystone" );
this.skyStoneBlockStair = makeStairs( constructor, skyStone_block, "skystone.block" );
this.skyStoneBrickStair = makeStairs( constructor, skyStone_brick, "skystone.brick" );
this.skyStoneSmallBrickStair = makeStairs( constructor, skyStone_smallbrick, "skystone.brick.small" );
this.fluixStair = makeStairs( constructor, fluix, "fluix" );
this.quartzStair = makeStairs( constructor, quartz, "quartz.certus" );
this.chiseledQuartzStair = makeStairs( constructor, quartzChiseled, "quartz.certus.chiseled" );
this.quartzPillarStair = makeStairs( constructor, quartzPillar, "quartz.certus.pillar" );
// TODO Re-Add Slabs...
/*
@@ -232,17 +234,20 @@ public final class ApiBlocks implements IBlocks
this.chiseledQuartzSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( chiseledQuartz, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "ChiseledQuartzSlabBlock" ) );;
this.quartzPillarSlab = constructor.registerBlockDefinition( new AEBaseSlabBlock( quartzPillar, EnumSet.of(AEFeature.DecorativeQuartzBlocks), false, "QuartzPillarSlabBlock" ) )
*/
this.itemGen = constructor.registerBlockDefinition( new BlockItemGen() );
this.chunkLoader = constructor.registerBlockDefinition( new BlockChunkloader() );
this.phantomNode = constructor.registerBlockDefinition( new BlockPhantomNode() );
this.cubeGenerator = constructor.registerBlockDefinition( new BlockCubeGenerator() );
}
private IBlockDefinition makeStairs(DefinitionConstructor constructor, IBlockDefinition block, String name )
private IBlockDefinition makeStairs( DefinitionConstructor constructor, IBlockDefinition definition, String name )
{
if ( block.maybeBlock().isPresent() )
return constructor.registerBlockDefinition( new BlockStairCommon( block.maybeBlock().get(), name ));
for( Block block : definition.maybeBlock().asSet() )
{
return constructor.registerBlockDefinition( new BlockStairCommon( block, name ) );
}
return null;
}
@@ -445,7 +450,7 @@ public final class ApiBlocks implements IBlocks
return this.quartzPillarSlab;
}
*/
@Override
public ITileDefinition grindStone()
{
@@ -675,5 +680,4 @@ public final class ApiBlocks implements IBlocks
{
return this.cubeGenerator;
}
}