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:
committed by
Sebastian Hartte
parent
66df324ef0
commit
6f2bbfab4c
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -33,12 +31,10 @@ 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.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -47,7 +43,6 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileCellWorkbench.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,19 +20,17 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.lwjgl.util.vector.Matrix4f;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -53,7 +51,6 @@ import appeng.client.render.renderable.ItemRenderable;
|
||||
import appeng.client.render.tesr.ModularTESR;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
@@ -70,7 +67,6 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
this.setTileEntity( TileCharger.class );
|
||||
this.setLightOpacity( 2 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,13 +126,6 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public TileEntitySpecialRenderer<TileCharger> getTESR()
|
||||
{
|
||||
return new ModularTESR( new ItemRenderable<TileCharger>( tile -> new ImmutablePair( tile.getStackInSlot( 0 ), new Matrix4f().translate( new Vector3f( 0.5f, 0.4f, 0.5f ) ) ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||
{
|
||||
@@ -198,4 +187,10 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public static TileEntitySpecialRenderer<TileCharger> createTesr()
|
||||
{
|
||||
return new ModularTESR<>( new ItemRenderable<TileCharger>( tile -> new ImmutablePair<>( tile.getStackInSlot( 0 ), new Matrix4f().translate( new Vector3f( 0.5f, 0.4f, 0.5f ) ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -33,7 +31,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.misc.TileCondenser;
|
||||
import appeng.util.Platform;
|
||||
@@ -47,7 +44,6 @@ public class BlockCondenser extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileCondenser.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -33,12 +31,10 @@ 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.misc.TileInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockInscriber extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -49,7 +45,6 @@ public class BlockInscriber extends AEBaseTileBlock
|
||||
this.setTileEntity( TileInscriber.class );
|
||||
this.setLightOpacity( 2 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.Inscriber ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -37,12 +36,10 @@ import net.minecraft.world.World;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockInterface extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -53,7 +50,6 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileInterface.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,14 +20,11 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -36,15 +33,11 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import appeng.tile.misc.TileLightDetector;
|
||||
|
||||
|
||||
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
|
||||
{
|
||||
|
||||
@@ -57,13 +50,6 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
this.setOpaque( false );
|
||||
|
||||
this.setTileEntity( TileLightDetector.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.LightDetector ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -39,11 +38,9 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockPaint extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -55,7 +52,6 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -32,12 +31,13 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -52,7 +52,6 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock
|
||||
super( Material.ROCK );
|
||||
this.setSoundType( SoundType.METAL );
|
||||
this.setTileEntity( TileQuartzGrowthAccelerator.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
this.setDefaultState( getDefaultState().withProperty( POWERED, false ) );
|
||||
}
|
||||
|
||||
@@ -69,9 +68,10 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, POWERED };
|
||||
return new IProperty[] { POWERED };
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -47,11 +46,9 @@ import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
|
||||
|
||||
public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, ICustomCollision
|
||||
{
|
||||
|
||||
@@ -66,7 +63,6 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
|
||||
super( Material.CIRCUITS );
|
||||
|
||||
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeLights ) );
|
||||
this.setLightLevel( 0.9375F );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -34,12 +32,10 @@ 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.misc.TileSecurity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockSecurity extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -48,7 +44,6 @@ public class BlockSecurity extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileSecurity.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Security ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -33,11 +32,9 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.misc.TileSkyCompass;
|
||||
|
||||
|
||||
public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
@@ -47,7 +44,6 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
this.setTileEntity( TileSkyCompass.class );
|
||||
this.setOpaque( this.setFullSize( false ) );
|
||||
this.lightOpacity = 0;
|
||||
this.setFeature( EnumSet.of( AEFeature.MeteoriteCompass ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,13 +20,10 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -36,7 +33,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -49,12 +45,9 @@ import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.entity.EntityIds;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.hooks.DispenserBehaviorTinyTNT;
|
||||
|
||||
|
||||
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
{
|
||||
@@ -67,18 +60,10 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setSoundType( SoundType.GROUND );
|
||||
this.setHardness( 0F );
|
||||
this.setFeature( EnumSet.of( AEFeature.TinyTNT ) );
|
||||
|
||||
EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
super.postInit();
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( Item.getItemFromBlock( this ), new DispenserBehaviorTinyTNT() );
|
||||
}
|
||||
|
||||
@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 )
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -39,13 +38,11 @@ import net.minecraft.world.World;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -57,7 +54,6 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileVibrationChamber.class );
|
||||
this.setHardness( 4.2F );
|
||||
this.setFeature( EnumSet.of( AEFeature.PowerGen ) );
|
||||
this.setDefaultState( getDefaultState().withProperty( ACTIVE, false ) );
|
||||
}
|
||||
|
||||
@@ -74,7 +70,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[]{ AE_BLOCK_FORWARD, AE_BLOCK_UP, ACTIVE };
|
||||
return new IProperty[]{ ACTIVE };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user