More stuff ingame and showing up.
This commit is contained in:
@@ -19,9 +19,6 @@
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -30,16 +27,13 @@ import net.minecraft.state.IProperty;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapePart;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
@@ -56,7 +50,6 @@ public abstract class AEBaseBlock extends Block
|
||||
|
||||
private boolean isOpaque = true;
|
||||
private boolean isFullSize = true;
|
||||
private boolean hasSubtypes = false;
|
||||
private boolean isInventory = false;
|
||||
|
||||
protected VoxelShape boundingBox = VoxelShapes.fullCube();
|
||||
@@ -316,9 +309,9 @@ public abstract class AEBaseBlock extends Block
|
||||
return new Direction[0];
|
||||
}
|
||||
|
||||
public boolean onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
return false;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
public final Direction mapRotation(final IOrientable ori, final Direction dir )
|
||||
@@ -408,7 +401,7 @@ public abstract class AEBaseBlock extends Block
|
||||
|
||||
}
|
||||
|
||||
protected IOrientable getOrientable( final IWorldReader w, final BlockPos pos )
|
||||
protected IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
if( this instanceof IOrientableBlock )
|
||||
{
|
||||
@@ -448,16 +441,6 @@ public abstract class AEBaseBlock extends Block
|
||||
return isOpaque;
|
||||
}
|
||||
|
||||
protected boolean hasSubtypes()
|
||||
{
|
||||
return this.hasSubtypes;
|
||||
}
|
||||
|
||||
protected void setHasSubtypes( final boolean hasSubtypes )
|
||||
{
|
||||
this.hasSubtypes = hasSubtypes;
|
||||
}
|
||||
|
||||
protected boolean isFullSize()
|
||||
{
|
||||
return this.isFullSize;
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public class AEBaseBlockItem extends BlockItem
|
||||
{
|
||||
|
||||
private final AEBaseBlock blockType;
|
||||
|
||||
public AEBaseBlockItem(final Block id, Item.Properties props )
|
||||
{
|
||||
super( id, props );
|
||||
this.blockType = (AEBaseBlock) id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public final void addInformation( final ItemStack itemStack, final World world, final List<ITextComponent> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation(final ItemStack itemStack, final World world, final List<ITextComponent> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey( final ItemStack is )
|
||||
{
|
||||
return this.blockType.getTranslationKey();
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public boolean placeBlock( final ItemStack stack, final PlayerEntity player, final World w, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final BlockState newState )
|
||||
// {
|
||||
// Direction up = null;
|
||||
// Direction forward = null;
|
||||
//
|
||||
// if( this.blockType instanceof AEBaseTileBlock )
|
||||
// {
|
||||
// if( this.blockType instanceof BlockLightDetector )
|
||||
// {
|
||||
// up = side;
|
||||
// if( up == Direction.UP || up == Direction.DOWN )
|
||||
// {
|
||||
// forward = Direction.SOUTH;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// forward = Direction.UP;
|
||||
// }
|
||||
// }
|
||||
// else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
|
||||
// {
|
||||
// forward = side;
|
||||
// if( forward == Direction.UP || forward == Direction.DOWN )
|
||||
// {
|
||||
// up = Direction.SOUTH;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// up = Direction.UP;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// up = Direction.UP;
|
||||
//
|
||||
// final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
//
|
||||
// switch( rotation )
|
||||
// {
|
||||
// default:
|
||||
// case 0:
|
||||
// forward = Direction.SOUTH;
|
||||
// break;
|
||||
// case 1:
|
||||
// forward = Direction.WEST;
|
||||
// break;
|
||||
// case 2:
|
||||
// forward = Direction.NORTH;
|
||||
// break;
|
||||
// case 3:
|
||||
// forward = Direction.EAST;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if( player.rotationPitch > 65 )
|
||||
// {
|
||||
// up = forward.getOpposite();
|
||||
// forward = Direction.UP;
|
||||
// }
|
||||
// else if( player.rotationPitch < -65 )
|
||||
// {
|
||||
// up = forward.getOpposite();
|
||||
// forward = Direction.DOWN;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// IOrientable ori = null;
|
||||
// if( this.blockType instanceof IOrientableBlock )
|
||||
// {
|
||||
// ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
|
||||
// up = side;
|
||||
// forward = Direction.SOUTH;
|
||||
// if( up.getYOffset() == 0 )
|
||||
// {
|
||||
// forward = Direction.UP;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if( !this.blockType.isValidOrientation( w, pos, forward, up ) )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if( super.placeBlock( stack, player, w, pos, side, hitX, hitY, hitZ, newState ) )
|
||||
// {
|
||||
// if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
|
||||
// {
|
||||
// final AEBaseTile tile = ( (AEBaseTileBlock) this.blockType ).getTileEntity( w, pos );
|
||||
// ori = tile;
|
||||
//
|
||||
// if( tile == null )
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
|
||||
// {
|
||||
// ori.setOrientation( forward, up );
|
||||
// }
|
||||
//
|
||||
// if( tile instanceof IGridProxyable )
|
||||
// {
|
||||
// ( (IGridProxyable) tile ).getProxy().setOwner( player );
|
||||
// }
|
||||
//
|
||||
// tile.onPlacement( stack, player, side );
|
||||
// }
|
||||
// else if( this.blockType instanceof IOrientableBlock )
|
||||
// {
|
||||
// ori.setOrientation( forward, up );
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
@@ -1,211 +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;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.misc.BlockLightDetector;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class AEBaseBlockItem extends BlockItem
|
||||
{
|
||||
|
||||
private final AEBaseBlock blockType;
|
||||
|
||||
public AEBaseBlockItem( final Block id )
|
||||
{
|
||||
super( id );
|
||||
this.blockType = (AEBaseBlock) id;
|
||||
this.hasSubtypes = this.blockType.hasSubtypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata( final int dmg )
|
||||
{
|
||||
if( this.hasSubtypes )
|
||||
{
|
||||
return dmg;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public final void addInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey( final ItemStack is )
|
||||
{
|
||||
return this.blockType.getTranslationKey( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt( final ItemStack stack, final PlayerEntity player, final World w, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final BlockState newState )
|
||||
{
|
||||
Direction up = null;
|
||||
Direction forward = null;
|
||||
|
||||
if( this.blockType instanceof AEBaseTileBlock )
|
||||
{
|
||||
if( this.blockType instanceof BlockLightDetector )
|
||||
{
|
||||
up = side;
|
||||
if( up == Direction.UP || up == Direction.DOWN )
|
||||
{
|
||||
forward = Direction.SOUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
forward = Direction.UP;
|
||||
}
|
||||
}
|
||||
else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
|
||||
{
|
||||
forward = side;
|
||||
if( forward == Direction.UP || forward == Direction.DOWN )
|
||||
{
|
||||
up = Direction.SOUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
up = Direction.UP;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
up = Direction.UP;
|
||||
|
||||
final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
|
||||
switch( rotation )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
forward = Direction.SOUTH;
|
||||
break;
|
||||
case 1:
|
||||
forward = Direction.WEST;
|
||||
break;
|
||||
case 2:
|
||||
forward = Direction.NORTH;
|
||||
break;
|
||||
case 3:
|
||||
forward = Direction.EAST;
|
||||
break;
|
||||
}
|
||||
|
||||
if( player.rotationPitch > 65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.UP;
|
||||
}
|
||||
else if( player.rotationPitch < -65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IOrientable ori = null;
|
||||
if( this.blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
|
||||
up = side;
|
||||
forward = Direction.SOUTH;
|
||||
if( up.getYOffset() == 0 )
|
||||
{
|
||||
forward = Direction.UP;
|
||||
}
|
||||
}
|
||||
|
||||
if( !this.blockType.isValidOrientation( w, pos, forward, up ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( super.placeBlockAt( stack, player, w, pos, side, hitX, hitY, hitZ, newState ) )
|
||||
{
|
||||
if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
|
||||
{
|
||||
final AEBaseTile tile = ( (AEBaseTileBlock) this.blockType ).getTileEntity( w, pos );
|
||||
ori = tile;
|
||||
|
||||
if( tile == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
|
||||
{
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
if( tile instanceof IGridProxyable )
|
||||
{
|
||||
( (IGridProxyable) tile ).getProxy().setOwner( player );
|
||||
}
|
||||
|
||||
tile.onPlacement( stack, player, side );
|
||||
}
|
||||
else if( this.blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -43,14 +44,13 @@ import appeng.util.Platform;
|
||||
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage
|
||||
{
|
||||
|
||||
public AEBaseBlockItemChargeable( final Block id )
|
||||
{
|
||||
super( id );
|
||||
public AEBaseBlockItemChargeable(Block id, Properties props) {
|
||||
super(id, props);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addCheckedInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
double internalCurrentPower = 0;
|
||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
||||
|
||||
@@ -29,14 +29,13 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -46,9 +45,6 @@ import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
@@ -56,12 +52,9 @@ import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
|
||||
@@ -72,46 +65,45 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
@Nonnull
|
||||
private Class<? extends AEBaseTile> tileEntityType;
|
||||
|
||||
public AEBaseTileBlock( final Material mat )
|
||||
public AEBaseTileBlock( final Block.Properties props )
|
||||
{
|
||||
super( mat );
|
||||
super( props );
|
||||
}
|
||||
|
||||
public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
||||
public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
||||
// FIXME
|
||||
// public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
||||
// public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
// A subclass may decide it doesn't want extended block state for whatever reason
|
||||
if( !( state instanceof IExtendedBlockState ) )
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
AEBaseTile tile = this.getTileEntity( world, pos );
|
||||
if( tile == null )
|
||||
{
|
||||
return state; // No info available
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||
// FIXME
|
||||
// // A subclass may decide it doesn't want extended block state for whatever reason
|
||||
// if( !( state instanceof IExtendedBlockState ) )
|
||||
// {
|
||||
// return state;
|
||||
// }
|
||||
//
|
||||
// AEBaseTile tile = this.getTileEntity( world, pos );
|
||||
// if( tile == null )
|
||||
// {
|
||||
// return state; // No info available
|
||||
// }
|
||||
//
|
||||
// IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
// return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||
FORWARD,
|
||||
UP
|
||||
} );
|
||||
}
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
|
||||
@Override
|
||||
public int getMetaFromState( BlockState state )
|
||||
{
|
||||
return 0;
|
||||
// TODO: Rendering stuff
|
||||
|
||||
// return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||
// FORWARD,
|
||||
// UP
|
||||
// } );
|
||||
}
|
||||
|
||||
// TODO : Was this change needed?
|
||||
@@ -183,8 +175,8 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
|
||||
{
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
|
||||
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||
if( te != null )
|
||||
{
|
||||
@@ -203,19 +195,19 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
|
||||
// super will remove the TE, as it is not an instance of BlockContainer
|
||||
super.breakBlock( w, pos, state );
|
||||
super.onReplaced( state, w, pos, newState, isMoving );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Direction[] getValidRotations( final World w, final BlockPos pos )
|
||||
public Direction[] getValidRotations(BlockState state, IBlockReader world, BlockPos pos)
|
||||
{
|
||||
final AEBaseTile obj = this.getTileEntity( w, pos );
|
||||
final AEBaseTile obj = this.getTileEntity( world, pos );
|
||||
if( obj != null && obj.canBeRotated() )
|
||||
{
|
||||
return Direction.values();
|
||||
}
|
||||
|
||||
return super.getValidRotations( w, pos );
|
||||
return super.getValidRotations( state, world, pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -271,7 +263,8 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
final TileEntity te = this.getTileEntity( w, pos );
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
( (AEBaseTile) w.getTileEntity( pos ) ).setName( is.getDisplayName() );
|
||||
// FIXME: Check if this will make it translated
|
||||
( (AEBaseTile) w.getTileEntity( pos ) ).setName( is.getDisplayName().getString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,27 +277,22 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
{
|
||||
heldItem = player.getHeldItem( hand );
|
||||
|
||||
if( Platform.isWrench( player, heldItem, pos ) && player.isShiftKeyDown() )
|
||||
if( Platform.isWrench( player, heldItem, pos ) && player.isCrouching() )
|
||||
{
|
||||
final BlockState blockState = world.getBlockState( pos );
|
||||
final Block block = blockState.getBlock();
|
||||
|
||||
if( block == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||
|
||||
if( tile == null )
|
||||
{
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// FIXME if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||
// {
|
||||
// return ActionResultType.FAIL;
|
||||
// }
|
||||
|
||||
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
|
||||
final ItemStack op = new ItemStack( this );
|
||||
@@ -321,29 +309,29 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
}
|
||||
|
||||
if( block.removedByPlayer( blockState, world, pos, player, false ) )
|
||||
if( block.removedByPlayer( blockState, world, pos, player, false, world.getFluidState(pos) ) )
|
||||
{
|
||||
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
|
||||
Platform.spawnDrops( world, pos, itemsToDrop );
|
||||
world.setBlockToAir( pos );
|
||||
world.removeBlock(pos, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
|
||||
if( heldItem.getItem() instanceof IMemoryCard /* FIXME && !( this instanceof BlockCableBus ) */ )
|
||||
{
|
||||
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
|
||||
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
|
||||
|
||||
if( tileEntity == null )
|
||||
{
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
final String name = this.getTranslationKey();
|
||||
|
||||
if( player.isShiftKeyDown() )
|
||||
if( player.isCrouching() )
|
||||
{
|
||||
final CompoundNBT data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
|
||||
if( data != null )
|
||||
@@ -368,21 +356,21 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return this.onActivated( world, pos, player, hand, player.getHeldItem( hand ), facing, hitX, hitY, hitZ );
|
||||
return this.onActivated( world, pos, player, hand, player.getHeldItem( hand ), hit );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
public IOrientable getOrientable(final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
return this.getTileEntity( w, pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
||||
public ICustomCollision getCustomCollision( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||
if( te instanceof ICustomCollision )
|
||||
|
||||
@@ -1,51 +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;
|
||||
|
||||
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockReader>
|
||||
{
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "ba";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( final IBlockReader value )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IBlockReader> getType()
|
||||
{
|
||||
return IBlockReader.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( final IBlockReader value )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
{
|
||||
final TileCraftingTile cp = this.getTileEntity( w, pos );
|
||||
if( cp != null )
|
||||
@@ -138,7 +138,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
cp.breakCluster();
|
||||
}
|
||||
|
||||
super.breakBlock( w, pos, state );
|
||||
super.onReplaced( state, w, pos, newState, isMoving );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,10 +29,12 @@ import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.Direction;
|
||||
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 net.minecraftforge.common.util.FakePlayer;
|
||||
@@ -57,7 +59,7 @@ public class BlockCrank extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player instanceof FakePlayer || player == null )
|
||||
{
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
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.api.util.AEPartLocation;
|
||||
@@ -47,12 +48,12 @@ public class BlockGrinder extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
final TileGrinder tg = this.getTileEntity( w, pos );
|
||||
if( tg != null && !p.isShiftKeyDown() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_GRINDER );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_GRINDER );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
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.api.util.AEPartLocation;
|
||||
@@ -45,7 +46,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -57,7 +58,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CELL_WORKBENCH );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CELL_WORKBENCH );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -71,7 +73,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
@@ -92,7 +94,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
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.api.util.AEPartLocation;
|
||||
@@ -45,7 +46,7 @@ public class BlockCondenser extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
@@ -57,7 +58,7 @@ public class BlockCondenser extends AEBaseTileBlock
|
||||
final TileCondenser tc = this.getTileEntity( w, pos );
|
||||
if( tc != null && !player.isShiftKeyDown() )
|
||||
{
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CONDENSER );
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CONDENSER );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,11 @@ import net.minecraft.block.material.Material;
|
||||
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.EnumBlockRenderType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -50,7 +51,7 @@ public class BlockInscriber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -62,7 +63,7 @@ public class BlockInscriber extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INSCRIBER );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INSCRIBER );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,11 @@ import net.minecraft.block.properties.PropertyBool;
|
||||
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.Direction;
|
||||
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;
|
||||
|
||||
@@ -73,7 +75,7 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -85,7 +87,7 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INTERFACE );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INTERFACE );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
public void animateTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
{
|
||||
// cancel out lightning
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -27,10 +27,11 @@ import net.minecraft.block.properties.PropertyBool;
|
||||
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.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
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;
|
||||
|
||||
@@ -80,7 +81,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -95,7 +96,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_SECURITY );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SECURITY );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -31,21 +31,23 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
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.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
||||
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
@@ -72,18 +74,18 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL )
|
||||
{
|
||||
this.startFuse( w, pos, player );
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
heldItem.damageItem( 1, player );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.onActivated( w, pos, player, hand, heldItem, side, hitX, hitY, hitZ );
|
||||
return super.onActivated( w, pos, player, hand, heldItem, hit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||
{
|
||||
this.startFuse( world, pos, null );
|
||||
world.setBlockToAir( pos );
|
||||
world.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,21 +118,31 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||
{
|
||||
this.startFuse( w, pos, null );
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalk( final World w, final BlockPos pos, final Entity entity )
|
||||
{
|
||||
if( entity instanceof EntityArrow && !w.isRemote )
|
||||
if( entity instanceof AbstractArrowEntity && !w.isRemote )
|
||||
{
|
||||
final EntityArrow entityarrow = (EntityArrow) entity;
|
||||
final AbstractArrowEntity entityarrow = (AbstractArrowEntity) entity;
|
||||
|
||||
if( entityarrow.isBurning() )
|
||||
{
|
||||
this.startFuse( w, pos, entityarrow.shootingEntity instanceof LivingEntity ? (LivingEntity) entityarrow.shootingEntity : null );
|
||||
w.setBlockToAir( pos );
|
||||
LivingEntity igniter = null;
|
||||
// Check if the shooter still exists
|
||||
if (w instanceof ServerWorld) {
|
||||
ServerWorld serverWorld = (ServerWorld) w;
|
||||
Entity shooter = serverWorld.getEntityByUuid(entityarrow.shootingEntity);
|
||||
if (shooter instanceof LivingEntity) {
|
||||
igniter = (LivingEntity) shooter;
|
||||
}
|
||||
|
||||
}
|
||||
this.startFuse( w, pos, igniter );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,12 @@ import net.minecraft.block.properties.PropertyBool;
|
||||
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.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -75,7 +77,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
@@ -87,7 +89,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
final TileVibrationChamber tc = this.getTileEntity( w, pos );
|
||||
if( tc != null && !player.isShiftKeyDown() )
|
||||
{
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -96,7 +98,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -43,11 +43,13 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
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.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -130,9 +132,9 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
public void animateTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
{
|
||||
this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
|
||||
this.cb( worldIn, pos ).animateTick( worldIn, pos, rand );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -401,7 +403,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
return this.cb( w, pos ).activate( player, hand, new Vec3d( hitX, hitY, hitZ ) );
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,15 +111,14 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
|
||||
{
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||
if( bridge != null )
|
||||
{
|
||||
bridge.breakCluster();
|
||||
}
|
||||
|
||||
super.breakBlock( w, pos, state );
|
||||
super.onReplaced( state, w, pos, newState, isMoving );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,10 +29,11 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
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.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -53,7 +54,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random rand )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random rand )
|
||||
{
|
||||
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||
if( bridge != null )
|
||||
@@ -69,7 +70,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -81,7 +82,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_QNB );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_QNB );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,10 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
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.api.util.AEPartLocation;
|
||||
@@ -57,7 +58,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -69,7 +70,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_SPATIAL_IO_PORT );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SPATIAL_IO_PORT );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,10 +27,11 @@ import net.minecraft.block.properties.PropertyEnum;
|
||||
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.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
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;
|
||||
|
||||
@@ -90,7 +91,7 @@ public class BlockChest extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
final TileChest tg = this.getTileEntity( w, pos );
|
||||
if( tg != null && !p.isShiftKeyDown() )
|
||||
@@ -100,9 +101,9 @@ public class BlockChest extends AEBaseTileBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
if( side != tg.getUp() )
|
||||
if( hit != tg.getUp() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CHEST );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CHEST );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -26,10 +26,11 @@ import net.minecraft.block.BlockStateContainer;
|
||||
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.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
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 net.minecraftforge.common.property.ExtendedBlockState;
|
||||
@@ -79,7 +80,7 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -91,7 +92,7 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_DRIVE );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_DRIVE );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,10 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
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.api.util.AEPartLocation;
|
||||
@@ -57,7 +58,7 @@ public class BlockIOPort extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -69,7 +70,7 @@ public class BlockIOPort extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_IOPORT );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_IOPORT );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,13 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
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.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -75,11 +77,11 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing( side ), GuiBridge.GUI_SKYCHEST );
|
||||
Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing(hit), GuiBridge.GUI_SKYCHEST );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user