Lots of compile fixes

This commit is contained in:
Sebastian Hartte
2020-06-04 03:02:48 +02:00
parent 6eb2a9504a
commit 237463dd94
241 changed files with 3438 additions and 3474 deletions
@@ -0,0 +1,99 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.block.crafting;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.BooleanProperty;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.tile.crafting.TileCraftingTile;
public abstract class AbstractCraftingUnitBlock<T extends TileCraftingTile> extends AEBaseTileBlock<T>
{
public static final BooleanProperty FORMED = BooleanProperty.create( "formed" );
public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
public final CraftingUnitType type;
public AbstractCraftingUnitBlock(Block.Properties props, final CraftingUnitType type )
{
super( props );
this.type = type;
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(POWERED);
builder.add(FORMED);
}
@Override
public void neighborChanged( final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos, boolean isMoving )
{
final TileCraftingTile cp = this.getTileEntity( worldIn, pos );
if( cp != null )
{
cp.updateMultiBlock();
}
}
@Override
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving)
{
final TileCraftingTile cp = this.getTileEntity( w, pos );
if( cp != null )
{
cp.breakCluster();
}
super.onReplaced( state, w, pos, newState, isMoving );
}
@Override
public ActionResultType onBlockActivated(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockRayTraceResult hit) {
final TileCraftingTile tg = this.getTileEntity( w, pos );
if( tg != null && !p.isCrouching() && tg.isFormed() && tg.isActive() )
{
if ( !w.isRemote() )
{
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
}
return ActionResultType.SUCCESS;
}
return super.onBlockActivated(state, w, pos, p, hand, hit);
}
public enum CraftingUnitType
{
UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
}
}
@@ -19,72 +19,12 @@
package appeng.block.crafting;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.block.BlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.util.AEColor;
import appeng.client.UnlistedProperty;
import appeng.tile.crafting.TileCraftingMonitorTile;
public class BlockCraftingMonitor extends BlockCraftingUnit
public class BlockCraftingMonitor extends AbstractCraftingUnitBlock<TileCraftingMonitorTile>
{
public static final UnlistedProperty<AEColor> COLOR = new UnlistedProperty<>( "color", AEColor.class );
public BlockCraftingMonitor()
public BlockCraftingMonitor(Properties props)
{
super( CraftingUnitType.MONITOR );
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
STATE,
COLOR,
FORWARD,
UP
} );
}
@Override
public IExtendedBlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
{
AEColor color = AEColor.TRANSPARENT;
Direction forward = Direction.NORTH;
Direction up = Direction.UP;
TileCraftingMonitorTile te = this.getTileEntity( world, pos );
if( te != null )
{
color = te.getColor();
forward = te.getForward();
up = te.getUp();
}
return super.getExtendedState( state, world, pos )
.with( COLOR, color )
.with( FORWARD, forward )
.with( UP, up );
}
@Override
@OnlyIn( Dist.CLIENT )
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> itemStacks)
{
itemStacks.add( new ItemStack( this, 1, 0 ) );
super( props, CraftingUnitType.MONITOR );
}
}
@@ -19,12 +19,13 @@
package appeng.block.crafting;
public class BlockCraftingStorage extends BlockCraftingUnit
import appeng.tile.crafting.TileCraftingStorageTile;
public class BlockCraftingStorage extends AbstractCraftingUnitBlock<TileCraftingStorageTile>
{
public BlockCraftingStorage( final CraftingUnitType type )
{
super( type );
public BlockCraftingStorage(Properties props, CraftingUnitType type) {
super(props, type);
}
}
@@ -1,167 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.block.crafting;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.BooleanProperty;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.IProperty;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
import appeng.client.render.crafting.CraftingCubeState;
import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
public class BlockCraftingUnit extends AEBaseTileBlock
{
public static final BooleanProperty FORMED = BooleanProperty.create( "formed" );
public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
public static final UnlistedProperty<CraftingCubeState> STATE = new UnlistedProperty<>( "state", CraftingCubeState.class );
public final CraftingUnitType type;
public BlockCraftingUnit( final CraftingUnitType type )
{
super( Material.IRON );
this.type = type;
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED, FORMED };
}
@Override
public IExtendedBlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
{
EnumSet<Direction> connections = EnumSet.noneOf( Direction.class );
for( Direction facing : Direction.values() )
{
if( this.isConnected( world, pos, facing ) )
{
connections.add( facing );
}
}
IExtendedBlockState extState = (IExtendedBlockState) state;
return extState.with( STATE, new CraftingCubeState( connections ) );
}
private boolean isConnected( IBlockReader world, BlockPos pos, Direction side )
{
BlockPos adjacentPos = pos.offset( side );
return world.getBlockState( adjacentPos ).getBlock() instanceof BlockCraftingUnit;
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { STATE } );
}
@Override
public BlockState getStateFromMeta( final int meta )
{
return this.getDefaultState().with( POWERED, ( meta & 1 ) == 1 ).with( FORMED, ( meta & 2 ) == 2 );
}
@Override
public int getMetaFromState( final BlockState state )
{
boolean p = state.getValue( POWERED );
boolean f = state.getValue( FORMED );
return ( p ? 1 : 0 ) | ( f ? 2 : 0 );
}
@Override
public void neighborChanged( final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos, boolean isMoving )
{
final TileCraftingTile cp = this.getTileEntity( worldIn, pos );
if( cp != null )
{
cp.updateMultiBlock();
}
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving)
{
final TileCraftingTile cp = this.getTileEntity( w, pos );
if( cp != null )
{
cp.breakCluster();
}
super.onReplaced( state, w, pos, newState, isMoving );
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity p, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
{
final TileCraftingTile tg = this.getTileEntity( w, pos );
if( tg != null && !p.isCrouching() && tg.isFormed() && tg.isActive() )
{
if( Platform.isClient() )
{
return true;
}
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
return true;
}
return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
}
public enum CraftingUnitType
{
UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
}
}
@@ -19,93 +19,62 @@
package appeng.block.crafting;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.BooleanProperty;
import appeng.block.AEBaseTileBlock;
import appeng.tile.crafting.TileMolecularAssembler;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileMolecularAssembler;
import appeng.util.Platform;
public class BlockMolecularAssembler extends AEBaseTileBlock
public class BlockMolecularAssembler extends AEBaseTileBlock<TileMolecularAssembler>
{
public static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
public BlockMolecularAssembler()
public BlockMolecularAssembler(Block.Properties props)
{
super( Material.IRON );
this.setOpaque( false );
this.lightOpacity = 1;
super( props );
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED };
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder);
builder.add(POWERED);
}
@Override
public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
{
boolean powered = false;
TileMolecularAssembler te = this.getTileEntity( worldIn, pos );
if( te != null )
{
powered = te.isPowered();
}
return super.getActualState( state, worldIn, pos ).with( POWERED, powered );
}
/**
* NOTE: This is only used to determine how to render an item being held in hand.
* For determining block rendering, the method below is used (canRenderInLayer).
*/
@OnlyIn( Dist.CLIENT )
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@OnlyIn( Dist.CLIENT )
@Override
public boolean canRenderInLayer( BlockState state, BlockRenderLayer layer )
{
return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
}
// FIXME: This apparently was used to update block states purely client-side... this wont work anymore :|
// FIXME @Override
// FIXME public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
// FIXME {
// FIXME boolean powered = false;
// FIXME TileMolecularAssembler te = this.getTileEntity( worldIn, pos );
// FIXME if( te != null )
// FIXME {
// FIXME powered = te.isPowered();
// FIXME }
// FIXME
// FIXME return super.getActualState( state, worldIn, pos ).with( POWERED, powered );
// FIXME }
@Override
public boolean isFullCube( BlockState state )
{
return false;
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity p, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
{
public ActionResultType onBlockActivated(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockRayTraceResult hit) {
final TileMolecularAssembler tg = this.getTileEntity( w, pos );
if( tg != null && !p.isCrouching() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
return true;
if (!tg.isRemote()) {
// FIXME Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_MAC);
}
return ActionResultType.SUCCESS;
}
return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
return super.onBlockActivated(state, w, pos, p, hand, hit);
}
}
@@ -0,0 +1,32 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.block.crafting;
import appeng.tile.crafting.TileCraftingTile;
public class CraftingUnitBlock extends AbstractCraftingUnitBlock<TileCraftingTile>
{
public CraftingUnitBlock(Properties props, CraftingUnitType type) {
super(props, type);
}
}
@@ -19,6 +19,7 @@
package appeng.block.crafting;
import appeng.core.Api;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -30,9 +31,8 @@ import appeng.api.features.AEFeature;
public class ItemCraftingStorage extends AEBaseBlockItem
{
public ItemCraftingStorage( final Block id )
{
super( id );
public ItemCraftingStorage(Block id, Properties props) {
super(id, props);
}
@Override
@@ -32,7 +32,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
@@ -32,7 +32,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCondenser;
import appeng.util.Platform;
@@ -19,66 +19,44 @@
package appeng.block.misc;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import appeng.block.AEBaseTileBlock;
import appeng.tile.misc.TileInscriber;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.BlockRenderType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInscriber;
import appeng.util.Platform;
import javax.annotation.Nullable;
public class BlockInscriber extends AEBaseTileBlock<TileInscriber> {
public class BlockInscriber extends AEBaseTileBlock
{
public BlockInscriber(Properties props) {
super(props);
}
public BlockInscriber()
{
super( Material.IRON );
@Override
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
return 2; // FIXME validate this. a) possibly not required because of getShape b) value range. was 2 in 1.10
}
this.setLightOpacity( 2 );
this.setFullSize( this.setOpaque( false ) );
}
@Override
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
if (!p.isCrouching()) {
final TileInscriber tg = this.getTileEntity(w, pos);
if (tg != null) {
if (!tg.isRemote()) {
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_INSCRIBER );
}
return ActionResultType.SUCCESS;
}
}
return ActionResultType.PASS;
@Override
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
{
if( p.isCrouching() )
{
return ActionResultType.PASS;
}
}
final TileInscriber tg = this.getTileEntity( w, pos );
if( tg != null )
{
if( Platform.isServer() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INSCRIBER );
}
return ActionResultType.SUCCESS;
}
return ActionResultType.PASS;
}
@Override
public BlockRenderType getRenderType( BlockState state )
{
return BlockRenderType.MODEL;
}
@Override
public String getTranslationKey( final ItemStack is )
{
return super.getTranslationKey( is );
}
}
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.BooleanProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -38,7 +38,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
@@ -26,7 +26,7 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.BooleanProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.properties.DirectionProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
@@ -71,7 +71,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override
public int getMetaFromState( final BlockState state )
{
return state.getValue( FACING ).ordinal();
return state.get( FACING ).ordinal();
}
@Override
@@ -24,7 +24,7 @@ import java.util.Random;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.BooleanProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Direction;
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.BooleanProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -37,7 +37,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileSecurityStation;
import appeng.util.Platform;
@@ -19,9 +19,6 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -33,15 +30,19 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.item.Items;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvents;
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.Explosion;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
@@ -50,27 +51,24 @@ import appeng.helpers.ICustomCollision;
import net.minecraft.world.server.ServerWorld;
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
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()
{
super( Material.TNT );
this.boundingBox = new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
this.setLightOpacity( 2 );
this.setFullSize( false );
this.setOpaque( false );
this.setSoundType( SoundType.GROUND );
this.setHardness( 0F );
super( Properties.create(Material.TNT).hardnessAndResistance(0).sound(SoundType.GROUND).notSolid() );
}
@Override
public boolean isFullCube( BlockState state )
{
return false;
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
return 2; // FIXME: Validate that this is the correct value range
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return SHAPE;
}
@Override
@@ -80,7 +78,9 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
this.startFuse( w, pos, player );
w.removeBlock(pos, false);
heldItem.damageItem( 1, player );
heldItem.damageItem( 1, player, p -> {
p.sendBreakAnimation(hand);
} ); // FIXME Check if onBroken is equivalent
return ActionResultType.SUCCESS;
}
else
@@ -103,7 +103,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
@Override
public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving )
{
if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
if( world.getRedstonePowerFromNeighbors( pos ) > 0 )
{
this.startFuse( world, pos, null );
world.removeBlock(pos, false);
@@ -111,11 +111,10 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
}
@Override
public void onBlockAdded( final World w, final BlockPos pos, final BlockState state )
{
super.onBlockAdded( w, pos, state );
public void onBlockAdded(BlockState state, World w, BlockPos pos, BlockState oldState, boolean isMoving) {
super.onBlockAdded( state, w, pos, oldState, isMoving );
if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
if( w.getRedstonePowerFromNeighbors( pos ) > 0 )
{
this.startFuse( w, pos, null );
w.removeBlock(pos, false);
@@ -166,15 +165,4 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
}
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
return Collections.singletonList( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
out.add( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
}
@@ -25,7 +25,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.BooleanProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
@@ -41,7 +41,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.AEConfig;
import appeng.core.sync.GuiBridge;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
@@ -2,23 +2,21 @@
package appeng.block.misc;
import appeng.bootstrap.*;
import appeng.tile.misc.TileInscriber;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.tesr.InscriberTESR;
public class InscriberRendering extends BlockRenderingCustomizer
public class InscriberRendering extends TileEntityRenderingCustomizer<TileInscriber>
{
@OnlyIn( Dist.CLIENT )
@Override
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.tileEntityRenderer( new InscriberTESR() );
public void customize(TileEntityRendering<TileInscriber> rendering) {
rendering.tileEntityRenderer( InscriberTESR::new );
}
}
@@ -38,9 +38,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
import net.minecraft.item.DyeColor;
import net.minecraft.state.IProperty;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
@@ -48,12 +47,13 @@ import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.*;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.Vec3d;
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 net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -87,7 +87,7 @@ import appeng.tile.networking.TileCableBusTESR;
import appeng.util.Platform;
public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implements IAEFacade */
{
public static final UnlistedProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new UnlistedProperty<>( "cable_bus_render_state", CableBusRenderState.class );
@@ -409,12 +409,11 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
}
@Override
public boolean recolorBlock( final World world, final BlockPos pos, final Direction side, final EnumDyeColor color )
{
return this.recolorBlock( world, pos, side, color, null );
public boolean recolorBlock(BlockState state, IWorld world, BlockPos pos, Direction side, DyeColor color) {
return recolorBlock(world, pos, side, color, null);
}
public boolean recolorBlock( final World world, final BlockPos pos, final Direction side, final EnumDyeColor color, final PlayerEntity who )
public boolean recolorBlock(final IBlockReader world, final BlockPos pos, final Direction side, final DyeColor color, final PlayerEntity who )
{
try
{
@@ -497,4 +496,40 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
super( worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state );
}
}
@Override
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
// FIXME: this has to be cached, optimized, fixed in all kinds of ways
TileCableBus te = getTileEntity(w, pos);
VoxelShape result = VoxelShapes.empty();
if (te != null) {
for (final AxisAlignedBB bx : te.getCableBus().getSelectedBoundingBoxesFromPool(false, true, context.getEntity(), true)) {
result = VoxelShapes.or(
result,
VoxelShapes.create(new AxisAlignedBB(bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ))
);
}
}
return result;
}
@Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
// FIXME: this has to be cached, optimized, fixed in all kinds of ways
TileCableBus te = getTileEntity(w, pos);
VoxelShape result = VoxelShapes.empty();
if (te != null) {
for (final AxisAlignedBB bx : te.getCableBus().getSelectedBoundingBoxesFromPool(false, true, context.getEntity(), false)) {
result = VoxelShapes.or(
result,
VoxelShapes.create(new AxisAlignedBB(bx.minX, bx.minY, bx.minZ, bx.maxX, bx.maxY, bx.maxZ))
);
}
}
return result;
}
}
@@ -156,7 +156,7 @@ public class BlockController extends AEBaseTileBlock
@Override
public int getMetaFromState( final BlockState state )
{
return state.getValue( CONTROLLER_STATE ).ordinal();
return state.get( CONTROLLER_STATE ).ordinal();
}
@Override
@@ -41,7 +41,7 @@ public class BlockEnergyCell extends AEBaseTileBlock
@Override
public int getMetaFromState( final BlockState state )
{
return state.getValue( ENERGY_STORAGE );
return state.get( ENERGY_STORAGE );
}
@Override
@@ -38,7 +38,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
@@ -22,7 +22,7 @@ package appeng.block.qnb;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.BooleanProperty;
import net.minecraft.state.BooleanProperty;
import net.minecraft.block.BlockStateContainer;
import net.minecraft.block.BlockState;
import net.minecraft.util.BlockRenderLayer;
@@ -39,7 +39,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.client.EffectType;
import appeng.core.AppEng;
import appeng.core.sync.GuiBridge;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform;
@@ -34,7 +34,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
@@ -38,7 +38,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.localization.PlayerMessages;
import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileChest;
import appeng.util.Platform;
@@ -40,7 +40,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileDrive;
import appeng.util.Platform;
@@ -34,7 +34,7 @@ import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;