Fixed stairs & chests rendering
-Fixed chests rendering in inventory (kinda). -Fixed stairs rendering. From now on, all blocks with multiple states MUST have item model. Example stair provided (though with incorrect textures). Relates to #9.
This commit is contained in:
@@ -33,7 +33,7 @@ import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
|
||||
public abstract class AEBaseStairBlock extends BlockStairs implements IAEFeature
|
||||
public abstract class AEBaseStairBlock extends BlockStairs implements IAEFeature, IHasSpecialItemModel
|
||||
{
|
||||
private final IFeatureHandler features;
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.block.IHasSpecialItemModel;
|
||||
import appeng.client.render.tesr.SkyChestTESR;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
@@ -52,7 +53,7 @@ import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision, IHasSpecialItemModel
|
||||
{
|
||||
|
||||
public static enum SkyChestType
|
||||
|
||||
@@ -49,7 +49,15 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTexture( ( (BlockSkyChest) te.getBlockType() ).type == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
|
||||
// TODO 1.10.2-R - So this is weirdly half working. Either fix it or deal with it.
|
||||
if( te != null )
|
||||
{
|
||||
this.bindTexture( ( (BlockSkyChest) te.getBlockType() ).type == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bindTexture( TEXTURE_BLOCK );
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
@@ -64,9 +72,12 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
|
||||
GlStateManager.scale( 1.0F, -1.0F, -1.0F );
|
||||
GlStateManager.translate( 0.5F, 0.5F, 0.5F );
|
||||
|
||||
FacingToRotation.get( te.getForward(), te.getUp() ).glRotateCurrentMat();
|
||||
if( te != null )
|
||||
{
|
||||
FacingToRotation.get( te.getForward(), te.getUp() ).glRotateCurrentMat();
|
||||
}
|
||||
GlStateManager.translate( -0.5F, -0.5F, -0.5F );
|
||||
float f = te.getPrevLidAngle() + ( te.getLidAngle() - te.getPrevLidAngle() ) * partialTicks;
|
||||
float f = te != null ? te.getPrevLidAngle() + ( te.getLidAngle() - te.getPrevLidAngle() ) * partialTicks : 0;
|
||||
|
||||
f = 1.0F - f;
|
||||
f = 1.0F - f * f * f;
|
||||
|
||||
@@ -36,6 +36,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.block.IHasSpecialItemModel;
|
||||
import appeng.client.render.model.AEIgnoringStateMapper;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
@@ -101,7 +102,14 @@ public final class AEBlockFeatureHandler implements IFeatureHandler
|
||||
@Override
|
||||
public void registerModel()
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.definition.maybeItem().get(), 0, new ModelResourceLocation( registryName, "normal" ) );
|
||||
if( !featured.getBlockState().getProperties().isEmpty() || featured instanceof IHasSpecialItemModel )
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.definition.maybeItem().get(), 0, new ModelResourceLocation( registryName, "inventory" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.definition.maybeItem().get(), 0, new ModelResourceLocation( registryName, "normal" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.block.IHasSpecialItemModel;
|
||||
import appeng.client.render.model.AEIgnoringStateMapper;
|
||||
import appeng.client.render.model.CachingRotatingBakedModel;
|
||||
import appeng.core.AppEng;
|
||||
@@ -122,7 +123,14 @@ public final class AETileBlockFeatureHandler implements IFeatureHandler
|
||||
@Override
|
||||
public void registerModel()
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.definition.maybeItem().get(), 0, new ModelResourceLocation( registryName, "normal" ) );
|
||||
if( !featured.getBlockState().getProperties().isEmpty() || featured instanceof IHasSpecialItemModel )
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.definition.maybeItem().get(), 0, new ModelResourceLocation( registryName, "inventory" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( this.definition.maybeItem().get(), 0, new ModelResourceLocation( registryName, "normal" ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user