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:
elix-x 2016-08-10 12:10:48 +02:00
parent 746bca8c40
commit 3d1d2a3468
10 changed files with 106 additions and 18 deletions

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,46 @@
{
"variants": {
"normal": { "model": "appliedenergistics2:skystone.block.stairs" },
"inventory": { "model": "appliedenergistics2:skystone.block.stairs" },
"facing=east,half=bottom,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs" },
"facing=west,half=bottom,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer" },
"facing=west,half=bottom,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer", "y": 270, "uvlock": true },
"facing=west,half=bottom,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer", "y": 90, "uvlock": true },
"facing=south,half=bottom,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer" },
"facing=north,half=bottom,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer", "y": 180, "uvlock": true },
"facing=east,half=bottom,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner" },
"facing=west,half=bottom,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner", "y": 180, "uvlock": true },
"facing=south,half=bottom,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner", "y": 90, "uvlock": true },
"facing=north,half=bottom,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner", "y": 270, "uvlock": true },
"facing=east,half=bottom,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner", "y": 270, "uvlock": true },
"facing=west,half=bottom,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner", "y": 90, "uvlock": true },
"facing=south,half=bottom,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner" },
"facing=north,half=bottom,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner", "y": 180, "uvlock": true },
"facing=east,half=top,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs", "x": 180, "uvlock": true },
"facing=west,half=top,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=straight": { "model": "appliedenergistics2:skystone.block.stairs", "x": 180, "y": 270, "uvlock": true },
"facing=east,half=top,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "y": 90, "uvlock": true },
"facing=west,half=top,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "y": 270, "uvlock": true },
"facing=south,half=top,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "y": 180, "uvlock": true },
"facing=north,half=top,shape=outer_right": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "uvlock": true },
"facing=east,half=top,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "uvlock": true },
"facing=west,half=top,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=outer_left": { "model": "appliedenergistics2:skystone.block.stairs.outer", "x": 180, "y": 270, "uvlock": true },
"facing=east,half=top,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "y": 90, "uvlock": true },
"facing=west,half=top,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "y": 270, "uvlock": true },
"facing=south,half=top,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "y": 180, "uvlock": true },
"facing=north,half=top,shape=inner_right": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "uvlock": true },
"facing=east,half=top,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "uvlock": true },
"facing=west,half=top,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "y": 180, "uvlock": true },
"facing=south,half=top,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "y": 90, "uvlock": true },
"facing=north,half=top,shape=inner_left": { "model": "appliedenergistics2:skystone.block.stairs.inner", "x": 180, "y": 270, "uvlock": true }
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/inner_stairs",
"textures": {
"side": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK",
"top": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK",
"bottom": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/stairs",
"textures": {
"side": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK",
"top": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK",
"bottom": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/outer_stairs",
"textures": {
"side": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK",
"top": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK",
"bottom": "appliedenergistics2:blocks/SkyStoneBlock.BLOCK"
}
}

View File

@ -1,13 +1,3 @@
{
"parent": "appliedenergistics2:block/stair/skystone/block/block",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
},
"gui": {
"rotation": [ 0, 180, 0 ]
}
}
"parent": "appliedenergistics2:block/skystone.block.stairs"
}