Major Refactoring of Bootstrap Code (#75)

- Refactored boostrap code:
  * Completely reworked item/block/tile registration.
  * Fixed server side startup.
  * Fixed server side startup.
  * More documentation.
  * More heavy cleanup
  * More cleanups.
  * Major refactoring of state mapping and fixes a lot of other issue related to item rendering.
  * Fixes sky chest item models (no item TESR).
  * Only use CachingRotatingBakedModel for tile entities automatically.
  Fix default rotation of quartz pillar for item model.
  * Used method reference instead of lambda for ItemMeshDefinition for multiparts.
  * Removed unnecessary IHasSpecialItemModel
  * Removed unused IconReg class.
  * Updated resource pack version.
This commit is contained in:
shartte
2016-08-22 14:25:10 +02:00
committed by Sebastian Hartte
parent 66df324ef0
commit 6f2bbfab4c
172 changed files with 2289 additions and 2863 deletions
@@ -19,8 +19,6 @@
package appeng.block.storage;
import java.util.EnumSet;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
@@ -36,7 +34,6 @@ import appeng.api.AEApi;
import appeng.api.storage.ICellHandler;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.features.AEFeature;
import appeng.core.localization.PlayerMessages;
import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileChest;
@@ -50,7 +47,6 @@ public class BlockChest extends AEBaseTileBlock
{
super( Material.IRON );
this.setTileEntity( TileChest.class );
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEChest ) );
}
@Override
@@ -19,8 +19,6 @@
package appeng.block.storage;
import java.util.EnumSet;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
@@ -34,7 +32,6 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileDrive;
import appeng.util.Platform;
@@ -47,7 +44,6 @@ public class BlockDrive extends AEBaseTileBlock
{
super( Material.IRON );
this.setTileEntity( TileDrive.class );
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEDrive ) );
}
@Override
@@ -19,8 +19,6 @@
package appeng.block.storage;
import java.util.EnumSet;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -35,7 +33,6 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
@@ -48,7 +45,6 @@ public class BlockIOPort extends AEBaseTileBlock
{
super( Material.IRON );
this.setTileEntity( TileIOPort.class );
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.IOPort ) );
}
@Override
@@ -20,16 +20,11 @@ package appeng.block.storage;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -39,24 +34,19 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
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;
import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision, IHasSpecialItemModel
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
{
public static enum SkyChestType
public enum SkyChestType
{
STONE, BLOCK
};
@@ -65,7 +55,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision,
public BlockSkyChest( final SkyChestType type )
{
super( Material.ROCK, Optional.of( type.name() ) );
super( Material.ROCK );
this.setTileEntity( TileSkyChest.class );
this.setOpaque( this.setFullSize( false ) );
this.lightOpacity = 0;
@@ -73,7 +63,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision,
this.setHardness( 50 );
this.blockResistance = 150.0f;
this.type = type;
this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.SkyStoneChests ) );
}
@Override
@@ -81,20 +70,8 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision,
{
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
@SideOnly( Side.CLIENT )
public TileEntitySpecialRenderer<TileSkyChest> getTESR()
{
return new SkyChestTESR();
}
@Override
public boolean hasItemTESR()
{
return true;
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
@@ -0,0 +1,50 @@
package appeng.block.storage;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.tesr.SkyChestTESR;
public class SkyChestRenderingCustomizer extends BlockRenderingCustomizer
{
private final BlockSkyChest.SkyChestType type;
public SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType type )
{
this.type = type;
}
@SideOnly( Side.CLIENT )
@Override
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.tesr( new SkyChestTESR() );
// Register a custom non-tesr item model
String modelName = getModelFromType();
itemRendering.model( new ModelResourceLocation( "appliedenergistics2:" + modelName, "inventory" ) );
}
private String getModelFromType()
{
final String modelName;
switch( type )
{
default:
case STONE:
modelName = "sky_chest_stone";
break;
case BLOCK:
modelName = "sky_chest_block";
break;
}
return modelName;
}
}