Fixes and cleanup
- Compile error fixes (blame @biggles2206). Fixes #53. - UVLModelLoader is now cross compatible with vanilla (vanilla can use uvl parents who have vanilla parents). - Due to it, now using uvlMarker instead of .uvl. - General code reformatting and cleanup.
This commit is contained in:
parent
24ddc0e574
commit
63f426336b
|
@ -67,11 +67,6 @@ import appeng.util.Platform;
|
|||
public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
|
||||
<<<<<<< HEAD
|
||||
public static final PropertyEnum<EnumFacing.Axis> AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class );
|
||||
|
||||
=======
|
||||
>>>>>>> refs/heads/pr/38
|
||||
private final String featureFullName;
|
||||
private final Optional<String> featureSubName;
|
||||
private boolean isOpaque = true;
|
||||
|
|
|
@ -57,7 +57,6 @@ import net.minecraftforge.client.model.ICustomModelLoader;
|
|||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.animation.ModelBlockAnimation;
|
||||
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.client.model.pipeline.VertexLighterFlat;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
|
@ -69,6 +68,8 @@ public enum UVLModelLoader implements ICustomModelLoader
|
|||
{
|
||||
INSTANCE;
|
||||
|
||||
private static final Gson gson = new Gson();
|
||||
|
||||
private static final Constructor<? extends IModel> vanillaModelWrapper;
|
||||
private static final Field faceBakery;
|
||||
|
||||
|
@ -153,7 +154,15 @@ public enum UVLModelLoader implements ICustomModelLoader
|
|||
@Override
|
||||
public boolean accepts( ResourceLocation modelLocation )
|
||||
{
|
||||
return modelLocation.getResourcePath().endsWith( ".uvl" );
|
||||
try
|
||||
{
|
||||
return gson.fromJson( new InputStreamReader( Minecraft.getMinecraft().getResourceManager().getResource( modelLocation ).getInputStream() ), UVLMarker.class ).uvlMarker;
|
||||
}
|
||||
catch( IOException e )
|
||||
{
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -322,4 +331,9 @@ public enum UVLModelLoader implements ICustomModelLoader
|
|||
|
||||
}
|
||||
|
||||
class UVLMarker
|
||||
{
|
||||
boolean uvlMarker = false;
|
||||
}
|
||||
|
||||
}
|
|
@ -22,14 +22,11 @@ package appeng.container.implementations;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import invtweaks.api.container.ChestContainer;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotNormal;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
|
||||
|
||||
@ChestContainer
|
||||
public class ContainerSkyChest extends AEBaseContainer
|
||||
{
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ import appeng.helpers.MetaRotation;
|
|||
|
||||
public class QuartzPillarBlock extends AEBaseBlock implements IOrientableBlock
|
||||
{
|
||||
public static final PropertyEnum AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class );
|
||||
public static final PropertyEnum<EnumFacing.Axis> AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class );
|
||||
|
||||
public QuartzPillarBlock()
|
||||
{
|
||||
|
@ -49,15 +49,15 @@ public class QuartzPillarBlock extends AEBaseBlock implements IOrientableBlock
|
|||
@Override
|
||||
public int getMetaFromState( final IBlockState state )
|
||||
{
|
||||
return state.getValue(AXIS_ORIENTATION).ordinal();
|
||||
return state.getValue( AXIS_ORIENTATION ).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
// Simply use the ordinal here
|
||||
EnumFacing.Axis axis = EnumFacing.Axis.values()[meta];
|
||||
return this.getDefaultState().withProperty(AXIS_ORIENTATION, axis);
|
||||
// Simply use the ordinal here
|
||||
EnumFacing.Axis axis = EnumFacing.Axis.values()[meta];
|
||||
return this.getDefaultState().withProperty( AXIS_ORIENTATION, axis );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.World;
|
|||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.decorative.solid.QuartzPillarBlock;
|
||||
|
||||
|
||||
public class MetaRotation implements IOrientable
|
||||
|
@ -71,7 +72,8 @@ public class MetaRotation implements IOrientable
|
|||
return state.getValue( facingProp );
|
||||
}
|
||||
|
||||
Axis a = state.getValue( AEBaseBlock.AXIS_ORIENTATION );
|
||||
//TODO 1.10.2-R - Temp
|
||||
Axis a = state.getValue( QuartzPillarBlock.AXIS_ORIENTATION );
|
||||
|
||||
if( a == null )
|
||||
{
|
||||
|
@ -101,7 +103,8 @@ public class MetaRotation implements IOrientable
|
|||
}
|
||||
else
|
||||
{
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( AEBaseBlock.AXIS_ORIENTATION, up.getAxis() ) );
|
||||
//TODO 1.10.2-R - Temp
|
||||
( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( QuartzPillarBlock.AXIS_ORIENTATION, up.getAxis() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
@ -14,21 +16,18 @@ import net.minecraft.util.ResourceLocation;
|
|||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.client.render.model.UVLModelLoader;
|
||||
|
||||
@Mod(modid = "UVLightmapJsonTest", name = "UVLightmapJsonTest", version ="0.0.0")
|
||||
@Mod( modid = "UVLightmapJsonTest", name = "UVLightmapJsonTest", version = "0.0.0" )
|
||||
public class UVLightmapJsonTest
|
||||
{
|
||||
|
||||
private static final ModelResourceLocation uvlblockModel = new ModelResourceLocation( new ResourceLocation( "UVLightmapJsonTest", "uvlblock" ), "normal" );
|
||||
private static final ResourceLocation uvlblockR = new ResourceLocation( "UVLightmapJsonTest", "uvlblock" );
|
||||
|
||||
public static Block uvlblock;
|
||||
public static Item uvlblockItem;
|
||||
|
@ -40,17 +39,17 @@ public class UVLightmapJsonTest
|
|||
|
||||
final AxisAlignedBB box = new AxisAlignedBB( 0.25, 0, 7 / 16d, 0.75, 1, 9 / 16d );
|
||||
|
||||
public boolean isFullBlock(IBlockState state)
|
||||
public boolean isFullBlock( IBlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
public boolean isOpaqueCube( IBlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
|
||||
{
|
||||
return box;
|
||||
}
|
||||
|
@ -60,17 +59,17 @@ public class UVLightmapJsonTest
|
|||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
}.setLightLevel( 0.2f ).setCreativeTab( CreativeTabs.DECORATIONS ).setRegistryName( new ResourceLocation( "UVLightmapJsonTest", "uvlblock" ) ) );
|
||||
GameRegistry.register( uvlblockItem = new ItemBlock( uvlblock ).setRegistryName( new ResourceLocation( "UVLightmapJsonTest", "uvlblock" ) ) );
|
||||
}.setLightLevel( 0.2f ).setCreativeTab( CreativeTabs.DECORATIONS ).setRegistryName( uvlblockR ) );
|
||||
GameRegistry.register( uvlblockItem = new ItemBlock( uvlblock ).setRegistryName( uvlblockR ) );
|
||||
|
||||
ModelBakery.registerItemVariants( uvlblockItem, uvlblockModel );
|
||||
ModelBakery.registerItemVariants( uvlblockItem, uvlblockR );
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init( FMLInitializationEvent event )
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(uvlblockItem, 0, uvlblockModel);
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register( uvlblockItem, 0, new ModelResourceLocation( uvlblockR, "inventory" ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"variants": {
|
||||
"normal": { "model": "UVLightmapJsonTest:uvlblock.uvl" }
|
||||
"normal": { "model": "uvlightmapjsontest:uvlblock_vanilla" }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"uvlMarker": true,
|
||||
"textures": {
|
||||
"0": "blocks/obsidian",
|
||||
"1": "uvlightmapjsontest:blocks/BlockControllerLights"
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "uvlightmapjsontest:block/uvlblock",
|
||||
"textures": {
|
||||
"0": "blocks/diamond_block"
|
||||
}
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"parent": "uvlightmapjsontest:block/uvlblock.uvl"
|
||||
"parent": "uvlightmapjsontest:block/uvlblock"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue