Fix default block properties.
This commit is contained in:
@@ -21,9 +21,13 @@ package appeng.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
@@ -39,6 +43,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
|
||||
public abstract class AEBaseBlock extends Block
|
||||
@@ -53,29 +58,44 @@ public abstract class AEBaseBlock extends Block
|
||||
protected AEBaseBlock( final Block.Properties props )
|
||||
{
|
||||
super( props );
|
||||
}
|
||||
|
||||
// FIXME: Move to block registration
|
||||
// FIXME if( mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS )
|
||||
// FIXME {
|
||||
// FIXME this.setSoundType( SoundType.GLASS );
|
||||
// FIXME }
|
||||
// FIXME else if( mat == Material.ROCK )
|
||||
// FIXME {
|
||||
// FIXME this.setSoundType( SoundType.STONE );
|
||||
// FIXME }
|
||||
// FIXME else if( mat == Material.WOOD )
|
||||
// FIXME {
|
||||
// FIXME this.setSoundType( SoundType.WOOD );
|
||||
// FIXME }
|
||||
// FIXME else
|
||||
// FIXME {
|
||||
// FIXME this.setSoundType( SoundType.METAL );
|
||||
// FIXME }
|
||||
/**
|
||||
* Utility function to create block properties with some sensible defaults for AE blocks.
|
||||
*/
|
||||
public static Block.Properties defaultProps(Material material) {
|
||||
return defaultProps(material, material.getColor());
|
||||
}
|
||||
|
||||
// FIXME this.setLightOpacity( 255 );
|
||||
// FIXME this.setLightLevel( 0 );
|
||||
// FIXME this.setHardness( 2.2F );
|
||||
// FIXME this.setHarvestLevel( "pickaxe", 0 );
|
||||
/**
|
||||
* Utility function to create block properties with some sensible defaults for AE blocks.
|
||||
*/
|
||||
public static Block.Properties defaultProps(Material material, MaterialColor color) {
|
||||
return Block.Properties.create(material, color)
|
||||
// These values previousls were encoded in AEBaseBlock
|
||||
.hardnessAndResistance(2.2f, 11.f)
|
||||
.harvestTool(ToolType.PICKAXE)
|
||||
.harvestLevel(0)
|
||||
.sound(getDefaultSoundByMaterial(material));
|
||||
}
|
||||
|
||||
private static SoundType getDefaultSoundByMaterial(Material mat) {
|
||||
if( mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS )
|
||||
{
|
||||
return SoundType.GLASS;
|
||||
}
|
||||
else if( mat == Material.ROCK )
|
||||
{
|
||||
return SoundType.STONE;
|
||||
}
|
||||
else if( mat == Material.WOOD )
|
||||
{
|
||||
return SoundType.WOOD;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SoundType.METAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,7 +43,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock<TileCellWorkbench>
|
||||
|
||||
public BlockCellWorkbench()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,46 +19,44 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.renderable.ItemRenderable;
|
||||
import appeng.client.render.tesr.ModularTESR;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.renderable.ItemRenderable;
|
||||
import appeng.client.render.tesr.ModularTESR;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
import appeng.util.Platform;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
||||
public class BlockCharger extends AEBaseTileBlock<TileCharger>
|
||||
@@ -66,7 +64,7 @@ public class BlockCharger extends AEBaseTileBlock<TileCharger>
|
||||
|
||||
public BlockCharger()
|
||||
{
|
||||
super( Properties.create(Material.IRON).notSolid() );
|
||||
super( defaultProps(Material.IRON).notSolid() );
|
||||
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
}
|
||||
@@ -110,12 +108,10 @@ public class BlockCharger extends AEBaseTileBlock<TileCharger>
|
||||
return;
|
||||
}
|
||||
|
||||
final AEBaseTile tile = this.getTileEntity( w, pos );
|
||||
if( tile instanceof TileCharger )
|
||||
final TileCharger tile = this.getTileEntity( w, pos );
|
||||
if(tile != null)
|
||||
{
|
||||
final TileCharger tc = (TileCharger) tile;
|
||||
|
||||
if( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getInternalInventory().getStackInSlot( 0 ) ) )
|
||||
if( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tile.getInternalInventory().getStackInSlot( 0 ) ) )
|
||||
{
|
||||
final double xOff = 0.0;
|
||||
final double yOff = 0.0;
|
||||
@@ -125,9 +121,9 @@ public class BlockCharger extends AEBaseTileBlock<TileCharger>
|
||||
{
|
||||
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
// FIXME final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos
|
||||
// FIXME .getZ(), 0.0D, 0.0D, 0.0D );
|
||||
// FIXME Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos
|
||||
.getZ(), 0.0, 0.0, 0.0 );
|
||||
Minecraft.getInstance().particles.addEffect( fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -202,10 +198,9 @@ public class BlockCharger extends AEBaseTileBlock<TileCharger>
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private static Pair<ItemStack, Matrix4f> getRenderedItem( TileCharger tile )
|
||||
private static Pair<ItemStack, TransformationMatrix> getRenderedItem(TileCharger tile )
|
||||
{
|
||||
Matrix4f transform = new Matrix4f();
|
||||
transform.translate( new Vector3f( 0.5f, 0.4f, 0.5f ) );
|
||||
TransformationMatrix transform = new TransformationMatrix(new Vector3f( 0.5f, 0.375f, 0.5f ), null, null, null);
|
||||
return new ImmutablePair<>( tile.getInternalInventory().getStackInSlot( 0 ), transform );
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BlockCondenser extends AEBaseTileBlock<TileCondenser>
|
||||
|
||||
public BlockCondenser()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BlockInterface extends AEBaseTileBlock<TileInterface>
|
||||
|
||||
public BlockInterface()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BlockLightDetector extends AEBaseTileBlock<TileLightDetector> imple
|
||||
|
||||
public BlockLightDetector()
|
||||
{
|
||||
super( Properties.create(Material.MISCELLANEOUS).notSolid() );
|
||||
super( defaultProps(Material.MISCELLANEOUS).notSolid() );
|
||||
|
||||
this.setDefaultState( this.getDefaultState().with(BlockStateProperties.FACING, Direction.UP ).with( ODD, false ) );
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock
|
||||
|
||||
public BlockQuartzFixture()
|
||||
{
|
||||
super(Block.Properties.create(Material.MISCELLANEOUS).doesNotBlockMovement().hardnessAndResistance(0, 0).lightValue(14).sound(SoundType.GLASS));
|
||||
super(defaultProps(Material.MISCELLANEOUS).doesNotBlockMovement().hardnessAndResistance(0).lightValue(14).sound(SoundType.GLASS));
|
||||
|
||||
this.setDefaultState( getDefaultState().with( FACING, Direction.UP ).with( ODD, false ) );
|
||||
this.setFullSize( false );
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock<TileQuartzGrow
|
||||
|
||||
public BlockQuartzGrowthAccelerator()
|
||||
{
|
||||
super( Properties.create(Material.ROCK).sound(SoundType.METAL) );
|
||||
super( defaultProps(Material.ROCK).sound(SoundType.METAL) );
|
||||
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class BlockSecurityStation extends AEBaseTileBlock<TileSecurityStation>
|
||||
|
||||
public BlockSecurityStation()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
|
||||
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
|
||||
}
|
||||
|
||||
@@ -55,9 +55,9 @@ public class BlockTinyTNT extends AEBaseBlock
|
||||
|
||||
private static final VoxelShape SHAPE = VoxelShapes.create(new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f ));
|
||||
|
||||
public BlockTinyTNT()
|
||||
public BlockTinyTNT(Block.Properties props)
|
||||
{
|
||||
super( Properties.create(Material.TNT).hardnessAndResistance(0).sound(SoundType.GROUND).notSolid() );
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock<TileVibrationCh
|
||||
|
||||
public BlockVibrationChamber()
|
||||
{
|
||||
super( Properties.create(Material.IRON).hardnessAndResistance(4.2F) );
|
||||
super( defaultProps(Material.IRON).hardnessAndResistance(4.2F) );
|
||||
this.setDefaultState( this.getDefaultState().with( ACTIVE, false ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
|
||||
public BlockCableBus() {
|
||||
super(Properties.create(AEGlassMaterial.INSTANCE).notSolid());
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE).notSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BlockController extends AEBaseTileBlock<TileController>
|
||||
|
||||
public BlockController()
|
||||
{
|
||||
super( Block.Properties.create(Material.IRON).hardnessAndResistance(6) );
|
||||
super( defaultProps(Material.IRON).hardnessAndResistance(6) );
|
||||
this.setDefaultState( this.getDefaultState()
|
||||
.with( CONTROLLER_STATE, ControllerBlockState.offline )
|
||||
.with( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||
|
||||
@@ -29,6 +29,6 @@ public class BlockCreativeEnergyCell extends AEBaseTileBlock<TileCreativeEnergyC
|
||||
|
||||
public BlockCreativeEnergyCell()
|
||||
{
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
super( defaultProps(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,6 @@ public class BlockEnergyAcceptor extends AEBaseTileBlock<TileEnergyAcceptor>
|
||||
|
||||
public BlockEnergyAcceptor()
|
||||
{
|
||||
super(Block.Properties.create(Material.IRON) );
|
||||
super(defaultProps(Material.IRON) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BlockEnergyCell extends AEBaseTileBlock<TileEnergyCell>
|
||||
|
||||
public BlockEnergyCell()
|
||||
{
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
super( defaultProps(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,7 +67,7 @@ public class BlockWireless extends AEBaseTileBlock<TileWireless>
|
||||
|
||||
public BlockWireless()
|
||||
{
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE).notSolid() );
|
||||
super( defaultProps(AEGlassMaterial.INSTANCE).notSolid() );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setDefaultState( this.getDefaultState().with( STATE, State.OFF ) );
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BlockPaint extends AEBaseTileBlock<TilePaint>
|
||||
{
|
||||
public BlockPaint()
|
||||
{
|
||||
super(Properties.create(Material.WATER, MaterialColor.AIR));
|
||||
super(defaultProps(Material.WATER, MaterialColor.AIR));
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
|
||||
public BlockQuantumLinkChamber()
|
||||
{
|
||||
super(Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
super(defaultProps(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class BlockQuantumRing extends BlockQuantumBase {
|
||||
private static final VoxelShape SHAPE_FORMED = createShape(1.0 / 16.0);
|
||||
|
||||
public BlockQuantumRing() {
|
||||
super(Properties.create(Material.IRON));
|
||||
super(defaultProps(Material.IRON));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock<TileSpatialIOPort>
|
||||
|
||||
public BlockSpatialIOPort()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock<TileSpatialPylon>
|
||||
|
||||
public BlockSpatialPylon()
|
||||
{
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
super( defaultProps(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BlockChest extends AEBaseTileBlock<TileChest>
|
||||
|
||||
public BlockChest()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
this.setDefaultState( this.getDefaultState().with( SLOT_STATE, DriveSlotState.EMPTY ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class BlockDrive extends AEBaseTileBlock<TileDrive>
|
||||
|
||||
public BlockDrive()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BlockIOPort extends AEBaseTileBlock<TileIOPort>
|
||||
|
||||
public BlockIOPort()
|
||||
{
|
||||
super( Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class LightningFX extends SpriteTexturedParticle
|
||||
private final double[] verticesWithUV = new double[3];
|
||||
private boolean hasData = false;
|
||||
|
||||
private LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b )
|
||||
public LightningFX( final World w, final double x, final double y, final double z, final double r, final double g, final double b )
|
||||
{
|
||||
this( w, x, y, z, r, g, b, 6 );
|
||||
this.regen();
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.TransformationMatrix;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.BufferUtils;
|
||||
@@ -36,9 +37,9 @@ import net.minecraft.tileentity.TileEntity;
|
||||
public class ItemRenderable<T extends TileEntity> implements Renderable<T>
|
||||
{
|
||||
|
||||
private final Function<T, Pair<ItemStack, Matrix4f>> f;
|
||||
private final Function<T, Pair<ItemStack, TransformationMatrix>> f;
|
||||
|
||||
public ItemRenderable( Function<T, Pair<ItemStack, Matrix4f>> f )
|
||||
public ItemRenderable( Function<T, Pair<ItemStack, TransformationMatrix>> f )
|
||||
{
|
||||
this.f = f;
|
||||
}
|
||||
@@ -46,16 +47,16 @@ public class ItemRenderable<T extends TileEntity> implements Renderable<T>
|
||||
@Override
|
||||
public void renderTileEntityAt(T te, float partialTicks, com.mojang.blaze3d.matrix.MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay)
|
||||
{
|
||||
Pair<ItemStack, Matrix4f> pair = this.f.apply( te );
|
||||
Pair<ItemStack, TransformationMatrix> pair = this.f.apply( te );
|
||||
if( pair != null && pair.getLeft() != null )
|
||||
{
|
||||
matrixStack.push();
|
||||
if( pair.getRight() != null )
|
||||
{
|
||||
FloatBuffer matrix = BufferUtils.createFloatBuffer( 16 );
|
||||
// FIXME pair.getRight().store( matrix );
|
||||
// FIXME matrix.flip();
|
||||
// FIXME matrixStack.( matrix );
|
||||
pair.getRight().push(matrixStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
matrixStack.push();
|
||||
}
|
||||
Minecraft.getInstance().getItemRenderer().renderItem( pair.getLeft(), ItemCameraTransforms.TransformType.GROUND, combinedLight, combinedOverlay, matrixStack, buffers );
|
||||
matrixStack.pop();
|
||||
|
||||
@@ -57,6 +57,7 @@ import appeng.decorative.solid.*;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.fluids.block.BlockFluidInterface;
|
||||
import appeng.fluids.tile.TileFluidInterface;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.hooks.DispenserBehaviorTinyTNT;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.tile.crafting.TileCraftingStorageTile;
|
||||
@@ -83,6 +84,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
import static appeng.block.AEBaseBlock.defaultProps;
|
||||
import static appeng.block.crafting.AbstractCraftingUnitBlock.CraftingUnitType;
|
||||
import static appeng.decorative.solid.BlockSkyStone.SkystoneType;
|
||||
|
||||
@@ -169,10 +171,10 @@ public final class ApiBlocks implements IBlocks
|
||||
private final IBlockDefinition cubeGenerator;
|
||||
private final IBlockDefinition energyGenerator;
|
||||
|
||||
private static final Block.Properties QUARTZ_PROPERTIES = Block.Properties.create(Material.ROCK)
|
||||
private static final Block.Properties QUARTZ_PROPERTIES = defaultProps(Material.ROCK)
|
||||
.hardnessAndResistance(3, 5);
|
||||
|
||||
private static final Block.Properties SKYSTONE_PROPERTIES = Block.Properties.create( Material.ROCK )
|
||||
private static final Block.Properties SKYSTONE_PROPERTIES = defaultProps( Material.ROCK )
|
||||
.hardnessAndResistance( 50, 150 );
|
||||
|
||||
public ApiBlocks(FeatureFactory registry)
|
||||
@@ -200,7 +202,7 @@ public final class ApiBlocks implements IBlocks
|
||||
this.chiseledQuartzBlock = deco.block( "chiseled_quartz_block", () -> new AEDecorativeBlock(QUARTZ_PROPERTIES) ).build();
|
||||
|
||||
this.quartzGlass = registry.features( AEFeature.QUARTZ_GLASS )
|
||||
.block( "quartz_glass", () -> new BlockQuartzGlass(Block.Properties.create(Material.GLASS).hardnessAndResistance(2.2F).sound(SoundType.GLASS).notSolid()) )
|
||||
.block( "quartz_glass", () -> new BlockQuartzGlass(defaultProps(Material.GLASS).notSolid()) )
|
||||
.rendering(new BlockRenderingCustomizer() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -209,7 +211,7 @@ public final class ApiBlocks implements IBlocks
|
||||
}
|
||||
})
|
||||
.build();
|
||||
this.quartzVibrantGlass = deco.block( "quartz_vibrant_glass", () -> new BlockQuartzLamp(Block.Properties.create(Material.GLASS).hardnessAndResistance(2.2F).sound(SoundType.GLASS).lightValue(15).notSolid()) )
|
||||
this.quartzVibrantGlass = deco.block( "quartz_vibrant_glass", () -> new BlockQuartzLamp(defaultProps(Material.GLASS).lightValue(15).notSolid()) )
|
||||
.addFeatures( AEFeature.DECORATIVE_LIGHTS, AEFeature.QUARTZ_GLASS )
|
||||
.rendering(new BlockRenderingCustomizer() {
|
||||
@Override
|
||||
@@ -234,7 +236,7 @@ public final class ApiBlocks implements IBlocks
|
||||
this.fluixBlock = registry.features( AEFeature.FLUIX ).block( "fluix_block", () -> new AEDecorativeBlock(QUARTZ_PROPERTIES) ).build();
|
||||
|
||||
this.skyStoneBlock = registry.features( AEFeature.SKY_STONE )
|
||||
.block( "sky_stone_block", () -> new BlockSkyStone( SkystoneType.STONE, Block.Properties.create(Material.ROCK)
|
||||
.block( "sky_stone_block", () -> new BlockSkyStone( SkystoneType.STONE, defaultProps(Material.ROCK)
|
||||
.hardnessAndResistance(50, 150)
|
||||
.harvestLevel(3) ) )
|
||||
.build();
|
||||
@@ -249,7 +251,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.addFeatures( AEFeature.SKY_STONE )
|
||||
.build();
|
||||
|
||||
Block.Properties skyStoneChestProps = Block.Properties.create(Material.ROCK)
|
||||
Block.Properties skyStoneChestProps = defaultProps(Material.ROCK)
|
||||
.hardnessAndResistance(50, 150)
|
||||
.notSolid();
|
||||
|
||||
@@ -271,17 +273,17 @@ public final class ApiBlocks implements IBlocks
|
||||
.tileEntity( skyChestTile )
|
||||
.build();
|
||||
|
||||
this.skyCompass = registry.block( "sky_compass", () -> new BlockSkyCompass(Block.Properties.create(Material.MISCELLANEOUS)) )
|
||||
this.skyCompass = registry.block( "sky_compass", () -> new BlockSkyCompass(defaultProps(Material.MISCELLANEOUS)) )
|
||||
.features( AEFeature.METEORITE_COMPASS )
|
||||
.tileEntity( registry.tileEntity("sky_compass", TileSkyCompass.class, TileSkyCompass::new)
|
||||
.rendering( new SkyCompassRendering() )
|
||||
.build() )
|
||||
.build();
|
||||
this.grindstone = registry.block( "grindstone", () -> new BlockGrinder(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.2f)) )
|
||||
this.grindstone = registry.block( "grindstone", () -> new BlockGrinder(defaultProps(Material.ROCK).hardnessAndResistance(3.2f)) )
|
||||
.features( AEFeature.GRIND_STONE )
|
||||
.tileEntity( registry.tileEntity("grindstone", TileGrinder.class, TileGrinder::new ).build() )
|
||||
.build();
|
||||
this.crank = registry.block( "crank", () -> new BlockCrank(Block.Properties.create(Material.WOOD).harvestTool(ToolType.AXE).harvestLevel(0).notSolid()) )
|
||||
this.crank = registry.block( "crank", () -> new BlockCrank(defaultProps(Material.WOOD).harvestTool(ToolType.AXE).harvestLevel(0).notSolid()) )
|
||||
.features( AEFeature.GRIND_STONE )
|
||||
.tileEntity( registry.tileEntity("crank", TileCrank.class, TileCrank::new )
|
||||
.rendering(new TileEntityRenderingCustomizer<TileCrank>() {
|
||||
@@ -293,7 +295,7 @@ public final class ApiBlocks implements IBlocks
|
||||
})
|
||||
.build() )
|
||||
.build();
|
||||
this.inscriber = registry.block( "inscriber", () -> new BlockInscriber(Block.Properties.create(Material.IRON).notSolid()) )
|
||||
this.inscriber = registry.block( "inscriber", () -> new BlockInscriber(defaultProps(Material.IRON).notSolid()) )
|
||||
.features( AEFeature.INSCRIBER )
|
||||
.tileEntity( registry.tileEntity("inscriber", TileInscriber.class, TileInscriber::new)
|
||||
.rendering(new InscriberRendering())
|
||||
@@ -325,7 +327,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.setShouldReceiveVelocityUpdates(true))
|
||||
.build();
|
||||
|
||||
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
||||
this.tinyTNT = registry.block( "tiny_tnt", () -> new BlockTinyTNT(defaultProps(Material.TNT).sound(SoundType.GROUND).hardnessAndResistance(0).notSolid()) )
|
||||
.features( AEFeature.TINY_TNT )
|
||||
.bootstrap( ( block, item ) -> (IInitComponent) () -> DispenserBlock.registerDispenseBehavior( item,
|
||||
new DispenserBehaviorTinyTNT() ) )
|
||||
@@ -425,7 +427,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.build();
|
||||
|
||||
FeatureFactory crafting = registry.features( AEFeature.CRAFTING_CPU );
|
||||
Block.Properties craftingBlockProps = Block.Properties.create(Material.IRON);
|
||||
Block.Properties craftingBlockProps = defaultProps(Material.IRON);
|
||||
this.craftingUnit = crafting.block( "crafting_unit", () -> new CraftingUnitBlock( craftingBlockProps, CraftingUnitType.UNIT ) )
|
||||
.rendering( new CraftingCubeRendering() )
|
||||
.tileEntity( craftingUnit )
|
||||
@@ -483,7 +485,7 @@ public final class ApiBlocks implements IBlocks
|
||||
})
|
||||
.build();
|
||||
|
||||
this.molecularAssembler = registry.block( "molecular_assembler", () -> new BlockMolecularAssembler(Block.Properties.create(Material.IRON).notSolid()) )
|
||||
this.molecularAssembler = registry.block( "molecular_assembler", () -> new BlockMolecularAssembler(defaultProps(Material.IRON).notSolid()) )
|
||||
.features( AEFeature.MOLECULAR_ASSEMBLER )
|
||||
.rendering(new BlockRenderingCustomizer() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@@ -605,10 +607,6 @@ public final class ApiBlocks implements IBlocks
|
||||
.build();
|
||||
}
|
||||
|
||||
private Block createQuartzOreBlock() {
|
||||
return new BlockQuartzOre(Block.Properties.create(Material.ROCK).hardnessAndResistance(3, 5));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockDefinition quartzOre()
|
||||
{
|
||||
|
||||
@@ -121,11 +121,11 @@ public final class ApiMaterials implements IMaterials
|
||||
this.registry = registry;
|
||||
|
||||
EntitySingularity.TYPE = registry.<EntitySingularity>entity("singularity", EntitySingularity::new, EntityClassification.MISC)
|
||||
.customize(builder -> builder.setTrackingRange(16).setUpdateInterval(4).setShouldReceiveVelocityUpdates(true))
|
||||
.customize(builder -> builder.size(0.2f, 0.2f).setTrackingRange(16).setUpdateInterval(4).setShouldReceiveVelocityUpdates(true))
|
||||
.build();
|
||||
|
||||
EntityChargedQuartz.TYPE = registry.<EntityChargedQuartz>entity("charged_quartz", EntityChargedQuartz::new, EntityClassification.MISC)
|
||||
.customize(builder -> builder.setTrackingRange(16).setUpdateInterval(4).setShouldReceiveVelocityUpdates(true))
|
||||
.customize(builder -> builder.size(0.2f, 0.2f).setTrackingRange(16).setUpdateInterval(4).setShouldReceiveVelocityUpdates(true))
|
||||
.build();
|
||||
|
||||
this.cell2SpatialPart = createMaterial(MaterialType.SPATIAL_2_CELL_COMPONENT );
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.block.material.Material;
|
||||
public class BlockChunkloader extends AEBaseTileBlock<TileChunkLoader> {
|
||||
|
||||
public BlockChunkloader() {
|
||||
super(Block.Properties.create(Material.IRON));
|
||||
super(defaultProps(Material.IRON));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BlockCubeGenerator extends AEBaseTileBlock<TileCubeGenerator>
|
||||
|
||||
public BlockCubeGenerator()
|
||||
{
|
||||
super(Block.Properties.create(Material.IRON) );
|
||||
super(defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BlockEnergyGenerator extends AEBaseTileBlock<TileEnergyGenerator>
|
||||
|
||||
public BlockEnergyGenerator()
|
||||
{
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BlockItemGen extends AEBaseTileBlock<TileItemGen>
|
||||
|
||||
public BlockItemGen()
|
||||
{
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BlockPhantomNode extends AEBaseTileBlock<TilePhantomNode>
|
||||
|
||||
public BlockPhantomNode()
|
||||
{
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
super( defaultProps(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -44,7 +44,7 @@ public class BlockFluidInterface extends AEBaseTileBlock<TileFluidInterface>
|
||||
{
|
||||
public BlockFluidInterface()
|
||||
{
|
||||
super(Properties.create( Material.IRON ));
|
||||
super(defaultProps( Material.IRON ));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user