reformatted all src files (#141)
This commit is contained in:
@@ -19,26 +19,22 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolQuartzAxe extends ItemAxe {
|
||||
private final AEFeature type;
|
||||
|
||||
public class ToolQuartzAxe extends ItemAxe
|
||||
{
|
||||
private final AEFeature type;
|
||||
public ToolQuartzAxe(final AEFeature type) {
|
||||
super(ToolMaterial.IRON);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ToolQuartzAxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,14 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
@@ -28,78 +36,58 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem {
|
||||
private final AEFeature type;
|
||||
|
||||
public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
{
|
||||
private final AEFeature type;
|
||||
public ToolQuartzCuttingKnife(final AEFeature type) {
|
||||
this.type = type;
|
||||
this.setMaxDamage(50);
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public ToolQuartzCuttingKnife( final AEFeature type )
|
||||
{
|
||||
this.type = type;
|
||||
this.setMaxDamage( 50 );
|
||||
this.setMaxStackSize( 1 );
|
||||
}
|
||||
@Override
|
||||
public EnumActionResult onItemUse(final EntityPlayer p, final World worldIn, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE);
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( final EntityPlayer p, final World worldIn, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(final World w, final EntityPlayer p, final EnumHand hand) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE);
|
||||
}
|
||||
p.swingArm(hand);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, p.getHeldItem(hand));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, null, AEPartLocation.INTERNAL, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||
}
|
||||
p.swingArm( hand );
|
||||
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
|
||||
}
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public ItemStack getContainerItem(final ItemStack itemStack) {
|
||||
ItemStack copy = itemStack.copy();
|
||||
copy.setItemDamage(itemStack.getItemDamage() + 1);
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem( final ItemStack itemStack )
|
||||
{
|
||||
ItemStack copy = itemStack.copy();
|
||||
copy.setItemDamage( itemStack.getItemDamage() + 1 );
|
||||
return copy;
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
@Override
|
||||
public boolean hasContainerItem(final ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContainerItem( final ItemStack stack )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject( final ItemStack is, final World world, final BlockPos pos )
|
||||
{
|
||||
return new QuartzKnifeObj( is );
|
||||
}
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject(final ItemStack is, final World world, final BlockPos pos) {
|
||||
return new QuartzKnifeObj(is);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,27 +19,23 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolQuartzHoe extends ItemHoe {
|
||||
private final AEFeature type;
|
||||
|
||||
public class ToolQuartzHoe extends ItemHoe
|
||||
{
|
||||
private final AEFeature type;
|
||||
public ToolQuartzHoe(final AEFeature type) {
|
||||
super(ToolMaterial.IRON);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ToolQuartzHoe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,26 +19,22 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolQuartzPickaxe extends ItemPickaxe {
|
||||
private final AEFeature type;
|
||||
|
||||
public class ToolQuartzPickaxe extends ItemPickaxe
|
||||
{
|
||||
private final AEFeature type;
|
||||
public ToolQuartzPickaxe(final AEFeature type) {
|
||||
super(ToolMaterial.IRON);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ToolQuartzPickaxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,26 +19,22 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolQuartzSpade extends ItemSpade {
|
||||
private final AEFeature type;
|
||||
|
||||
public class ToolQuartzSpade extends ItemSpade
|
||||
{
|
||||
private final AEFeature type;
|
||||
public ToolQuartzSpade(final AEFeature type) {
|
||||
super(ToolMaterial.IRON);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ToolQuartzSpade( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,26 +19,22 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolQuartzSword extends ItemSword {
|
||||
private final AEFeature type;
|
||||
|
||||
public class ToolQuartzSword extends ItemSword
|
||||
{
|
||||
private final AEFeature type;
|
||||
public ToolQuartzSword(AEFeature type) {
|
||||
super(ToolMaterial.IRON);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public ToolQuartzSword( AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getIsRepairable( final ItemStack a, final ItemStack b )
|
||||
{
|
||||
return Platform.canRepair( this.type, a, b );
|
||||
}
|
||||
@Override
|
||||
public boolean getIsRepairable(final ItemStack a, final ItemStack b) {
|
||||
return Platform.canRepair(this.type, a, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import cofh.api.item.IToolHammer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -32,96 +37,77 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional.Interface;
|
||||
|
||||
import cofh.api.item.IToolHammer;
|
||||
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
// TODO BC Integration
|
||||
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore )
|
||||
@Interface( iface = "cofh.api.item.IToolHammer", modid = "cofhcore" )
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolHammer /* , IToolWrench */
|
||||
{
|
||||
@Interface(iface = "cofh.api.item.IToolHammer", modid = "cofhcore")
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolHammer /* , IToolWrench */ {
|
||||
|
||||
public ToolQuartzWrench()
|
||||
{
|
||||
this.setMaxStackSize( 1 );
|
||||
this.setHarvestLevel( "wrench", 0 );
|
||||
}
|
||||
public ToolQuartzWrench() {
|
||||
this.setMaxStackSize(1);
|
||||
this.setHarvestLevel("wrench", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
{
|
||||
final Block b = world.getBlockState( pos ).getBlock();
|
||||
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
// TODO 1.10-R - if we return FAIL on client, action will not be sent to server. Fix that in all
|
||||
// Block#onItemUseFirst overrides.
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
|
||||
}
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst(final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand) {
|
||||
final Block b = world.getBlockState(pos).getBlock();
|
||||
if (b != null && !player.isSneaking() && Platform.hasPermissions(new DimensionalCoord(world, pos), player)) {
|
||||
if (Platform.isClient()) {
|
||||
// TODO 1.10-R - if we return FAIL on client, action will not be sent to server. Fix that in all
|
||||
// Block#onItemUseFirst overrides.
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
if( b.rotateBlock( world, pos, side ) )
|
||||
{
|
||||
player.swingArm( hand );
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
if (b.rotateBlock(world, pos, side)) {
|
||||
player.swingArm(hand);
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean doesSneakBypassUse(final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench( final ItemStack wrench, final EntityPlayer player, final BlockPos pos )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean canWrench(final ItemStack wrench, final EntityPlayer player, final BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// IToolHammer - start
|
||||
@Override
|
||||
public boolean isUsable( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// IToolHammer - start
|
||||
@Override
|
||||
public boolean isUsable(ItemStack item, EntityLivingBase user, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsable( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isUsable(ItemStack item, EntityLivingBase user, Entity entity) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
}
|
||||
@Override
|
||||
public void toolUsed(ItemStack item, EntityLivingBase user, BlockPos pos) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
}
|
||||
@Override
|
||||
public void toolUsed(ItemStack item, EntityLivingBase user, Entity entity) {
|
||||
}
|
||||
|
||||
// IToolHammer - end
|
||||
// IToolHammer - end
|
||||
|
||||
// TODO: BC Wrench Integration
|
||||
/*
|
||||
* @Override
|
||||
* public boolean canWrench( EntityPlayer player, int x, int y, int z )
|
||||
* {
|
||||
* return true;
|
||||
* }
|
||||
* @Override
|
||||
* public void wrenchUsed( EntityPlayer player, int x, int y, int z )
|
||||
* {
|
||||
* player.swingItem();
|
||||
* }
|
||||
*/
|
||||
// TODO: BC Wrench Integration
|
||||
/*
|
||||
* @Override
|
||||
* public boolean canWrench( EntityPlayer player, int x, int y, int z )
|
||||
* {
|
||||
* return true;
|
||||
* }
|
||||
* @Override
|
||||
* public void wrenchUsed( EntityPlayer player, int x, int y, int z )
|
||||
* {
|
||||
* player.swingItem();
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user