2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
2015-06-08 01:41:35 +02:00
|
|
|
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
2014-11-14 12:02:52 +01:00
|
|
|
*
|
|
|
|
* 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>.
|
|
|
|
*/
|
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
package appeng.items.tools.quartz;
|
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
|
2013-12-27 23:59:59 +01:00
|
|
|
import java.util.EnumSet;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2015-06-16 02:44:59 +02:00
|
|
|
import net.minecraft.util.BlockPos;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
2013-12-27 23:59:59 +01:00
|
|
|
import net.minecraft.world.World;
|
2014-01-23 20:02:48 +01:00
|
|
|
import appeng.api.implementations.items.IAEWrench;
|
2014-08-29 05:32:53 +02:00
|
|
|
import appeng.api.util.DimensionalCoord;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.core.features.AEFeature;
|
2015-08-06 16:01:56 +02:00
|
|
|
import appeng.integration.IntegrationType;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.items.AEBaseItem;
|
2014-04-01 05:24:28 +02:00
|
|
|
import appeng.util.Platform;
|
2013-12-27 23:59:59 +01:00
|
|
|
|
2015-06-16 02:44:59 +02:00
|
|
|
import com.google.common.base.Optional;
|
|
|
|
|
2015-06-08 01:41:35 +02:00
|
|
|
// TODO BC Integration
|
2015-08-06 16:01:56 +02:00
|
|
|
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore )
|
|
|
|
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /*, IToolWrench */
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
|
2014-11-18 16:47:30 +01:00
|
|
|
public ToolQuartzWrench( AEFeature type )
|
|
|
|
{
|
2015-01-03 02:53:14 +01:00
|
|
|
super( Optional.of( type.name() ) );
|
2014-09-30 15:16:33 +02:00
|
|
|
|
|
|
|
this.setFeature( EnumSet.of( type, AEFeature.QuartzWrench ) );
|
|
|
|
this.setMaxStackSize( 1 );
|
|
|
|
this.setHarvestLevel( "wrench", 0 );
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-06-16 02:44:59 +02:00
|
|
|
public boolean onItemUseFirst(
|
|
|
|
ItemStack stack,
|
|
|
|
EntityPlayer player,
|
|
|
|
World world,
|
|
|
|
BlockPos pos,
|
|
|
|
EnumFacing side,
|
|
|
|
float hitX,
|
|
|
|
float hitY,
|
|
|
|
float hitZ )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2015-06-16 02:44:59 +02:00
|
|
|
Block b = world.getBlockState( pos ).getBlock();
|
|
|
|
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
if( Platform.isClient() )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-09-06 08:26:17 +02:00
|
|
|
return !world.isRemote;
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-08-29 05:32:53 +02:00
|
|
|
|
2015-06-16 02:44:59 +02:00
|
|
|
if( b.rotateBlock( world, pos, side ) )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2015-06-16 02:44:59 +02:00
|
|
|
b.onNeighborBlockChange( world, pos, Platform.AIR_BLOCK.getDefaultState(), Platform.AIR_BLOCK );
|
2014-02-09 02:34:52 +01:00
|
|
|
player.swingItem();
|
|
|
|
return !world.isRemote;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-06-16 02:44:59 +02:00
|
|
|
public boolean doesSneakBypassUse(
|
|
|
|
World world,
|
|
|
|
BlockPos pos,
|
|
|
|
EntityPlayer player )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-06-16 02:44:59 +02:00
|
|
|
public boolean canWrench(
|
|
|
|
ItemStack wrench,
|
|
|
|
EntityPlayer player,
|
|
|
|
BlockPos pos )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-16 02:44:59 +02:00
|
|
|
// TODO: BC Wrench Integration
|
|
|
|
/*
|
2013-12-27 23:59:59 +01:00
|
|
|
@Override
|
2014-11-18 16:47:30 +01:00
|
|
|
public boolean canWrench( EntityPlayer player, int x, int y, int z )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-11-18 16:47:30 +01:00
|
|
|
public void wrenchUsed( EntityPlayer player, int x, int y, int z )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
player.swingItem();
|
|
|
|
}
|
2015-06-16 02:44:59 +02:00
|
|
|
*/
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|