1.15 port
This commit is contained in:
@@ -25,17 +25,18 @@ import java.util.List;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.features.IPlayerRegistry;
|
||||
@@ -50,32 +51,32 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
{
|
||||
public ToolBiometricCard()
|
||||
{
|
||||
this.setMaxStackSize( 1 );
|
||||
super( new Properties().maxStackSize( 1 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity p, final Hand hand )
|
||||
{
|
||||
if( p.isSneaking() )
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
this.encode( p.getHeldItem( hand ), p );
|
||||
p.swingArm( hand );
|
||||
return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) );
|
||||
return ActionResult.resultSuccess( p.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
return new ActionResult<>( EnumActionResult.PASS, p.getHeldItem( hand ) );
|
||||
return ActionResult.resultPass( p.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean itemInteractionForEntity( ItemStack is, final EntityPlayer player, final EntityLivingBase target, final EnumHand hand )
|
||||
public boolean itemInteractionForEntity( ItemStack is, final PlayerEntity player, final LivingEntity target, final Hand hand )
|
||||
{
|
||||
if( target instanceof EntityPlayer && !player.isSneaking() )
|
||||
if( target instanceof PlayerEntity && !player.isShiftKeyDown() )
|
||||
{
|
||||
if( player.capabilities.isCreativeMode )
|
||||
if( player.isCreative() )
|
||||
{
|
||||
is = player.getHeldItem( hand );
|
||||
}
|
||||
this.encode( is, (EntityPlayer) target );
|
||||
this.encode( is, (PlayerEntity) target );
|
||||
player.swingArm( hand );
|
||||
return true;
|
||||
}
|
||||
@@ -83,13 +84,13 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName( final ItemStack is )
|
||||
public ITextComponent getDisplayName( final ItemStack is )
|
||||
{
|
||||
final GameProfile username = this.getProfile( is );
|
||||
return username != null ? super.getItemStackDisplayName( is ) + " - " + username.getName() : super.getItemStackDisplayName( is );
|
||||
return username != null ? super.getDisplayName( is ).appendText( " - " + username.getName() ) : super.getDisplayName( is );
|
||||
}
|
||||
|
||||
private void encode( final ItemStack is, final EntityPlayer p )
|
||||
private void encode( final ItemStack is, final PlayerEntity p )
|
||||
{
|
||||
final GameProfile username = this.getProfile( is );
|
||||
|
||||
@@ -106,27 +107,27 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
@Override
|
||||
public void setProfile( final ItemStack itemStack, final GameProfile profile )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
final CompoundNBT tag = Platform.openNbtData( itemStack );
|
||||
|
||||
if( profile != null )
|
||||
{
|
||||
final NBTTagCompound pNBT = new NBTTagCompound();
|
||||
final CompoundNBT pNBT = new CompoundNBT();
|
||||
NBTUtil.writeGameProfile( pNBT, profile );
|
||||
tag.setTag( "profile", pNBT );
|
||||
tag.put( "profile", pNBT );
|
||||
}
|
||||
else
|
||||
{
|
||||
tag.removeTag( "profile" );
|
||||
tag.remove( "profile" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getProfile( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( is );
|
||||
if( tag.hasKey( "profile" ) )
|
||||
final CompoundNBT tag = Platform.openNbtData( is );
|
||||
if( tag.contains( "profile" ) )
|
||||
{
|
||||
return NBTUtil.readGameProfileFromNBT( tag.getCompoundTag( "profile" ) );
|
||||
return NBTUtil.readGameProfile( tag.getCompound( "profile" ) );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -134,7 +135,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
@Override
|
||||
public EnumSet<SecurityPermissions> getPermissions( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( is );
|
||||
final CompoundNBT tag = Platform.openNbtData( is );
|
||||
final EnumSet<SecurityPermissions> result = EnumSet.noneOf( SecurityPermissions.class );
|
||||
|
||||
for( final SecurityPermissions sp : SecurityPermissions.values() )
|
||||
@@ -151,25 +152,25 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
@Override
|
||||
public boolean hasPermission( final ItemStack is, final SecurityPermissions permission )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( is );
|
||||
final CompoundNBT tag = Platform.openNbtData( is );
|
||||
return tag.getBoolean( permission.name() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePermission( final ItemStack itemStack, final SecurityPermissions permission )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
if( tag.hasKey( permission.name() ) )
|
||||
final CompoundNBT tag = Platform.openNbtData( itemStack );
|
||||
if( tag.contains( permission.name() ) )
|
||||
{
|
||||
tag.removeTag( permission.name() );
|
||||
tag.remove( permission.name() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPermission( final ItemStack itemStack, final SecurityPermissions permission )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( itemStack );
|
||||
tag.setBoolean( permission.name(), true );
|
||||
final CompoundNBT tag = Platform.openNbtData( itemStack );
|
||||
tag.putBoolean( permission.name(), true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,27 +180,27 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addInformation( final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
|
||||
if( perms.isEmpty() )
|
||||
{
|
||||
lines.add( GuiText.NoPermissions.getLocal() );
|
||||
lines.add( new TranslationTextComponent( GuiText.NoPermissions.getLocal() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
String msg = null;
|
||||
ITextComponent msg = null;
|
||||
|
||||
for( final SecurityPermissions sp : perms )
|
||||
{
|
||||
if( msg == null )
|
||||
{
|
||||
msg = Platform.gui_localize( sp.getUnlocalizedName() );
|
||||
msg = new TranslationTextComponent( sp.getTranslatedName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = msg + ", " + Platform.gui_localize( sp.getUnlocalizedName() );
|
||||
msg = msg.appendText( ", " ).appendSibling( new TranslationTextComponent( sp.getTranslatedName() ) );
|
||||
}
|
||||
}
|
||||
lines.add( msg );
|
||||
|
||||
@@ -4,8 +4,8 @@ package appeng.items.tools;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
@@ -19,7 +19,7 @@ public class ToolBiometricCardRendering extends ItemRenderingCustomizer
|
||||
private static final ResourceLocation MODEL = new ResourceLocation( AppEng.MOD_ID, "builtin/biometric_card" );
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.builtInModel( "models/item/builtin/biometric_card", new BiometricCardModel() );
|
||||
|
||||
@@ -22,20 +22,20 @@ package appeng.items.tools;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
@@ -60,12 +60,12 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
||||
|
||||
final NBTTagCompound data = this.getData( stack );
|
||||
final CompoundNBT data = this.getData( stack );
|
||||
if( data.hasKey( "tooltip" ) )
|
||||
{
|
||||
lines.add( I18n.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
|
||||
@@ -107,9 +107,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMemoryCardContents( final ItemStack is, final String settingsName, final NBTTagCompound data )
|
||||
public void setMemoryCardContents( final ItemStack is, final String settingsName, final CompoundNBT data )
|
||||
{
|
||||
final NBTTagCompound c = Platform.openNbtData( is );
|
||||
final CompoundNBT c = Platform.openNbtData( is );
|
||||
c.setString( "Config", settingsName );
|
||||
c.setTag( "Data", data );
|
||||
}
|
||||
@@ -117,19 +117,19 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
@Override
|
||||
public String getSettingsName( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound c = Platform.openNbtData( is );
|
||||
final CompoundNBT c = Platform.openNbtData( is );
|
||||
final String name = c.getString( "Config" );
|
||||
return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getData( final ItemStack is )
|
||||
public CompoundNBT getData( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound c = Platform.openNbtData( is );
|
||||
NBTTagCompound o = c.getCompoundTag( "Data" );
|
||||
final CompoundNBT c = Platform.openNbtData( is );
|
||||
CompoundNBT o = c.getCompoundTag( "Data" );
|
||||
if( o == null )
|
||||
{
|
||||
o = new NBTTagCompound();
|
||||
o = new CompoundNBT();
|
||||
}
|
||||
return o.copy();
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
@Override
|
||||
public AEColor[] getColorCode( ItemStack is )
|
||||
{
|
||||
final NBTTagCompound tag = this.getData( is );
|
||||
final CompoundNBT tag = this.getData( is );
|
||||
|
||||
if( tag.hasKey( "colorCode" ) )
|
||||
{
|
||||
@@ -154,7 +154,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyUser( final EntityPlayer player, final MemoryCardMessages msg )
|
||||
public void notifyUser( final PlayerEntity player, final MemoryCardMessages msg )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -183,9 +183,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz )
|
||||
public EnumActionResult onItemUse( final PlayerEntity player, final World w, final BlockPos pos, final Hand hand, final Direction side, final float hx, final float hy, final float hz )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
if( !w.isRemote )
|
||||
{
|
||||
@@ -200,9 +200,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( World w, EntityPlayer player, EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( World w, PlayerEntity player, Hand hand )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
if( !w.isRemote )
|
||||
{
|
||||
@@ -215,12 +215,12 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player )
|
||||
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockReader world, final BlockPos pos, final PlayerEntity player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private void clearCard( final EntityPlayer player, final World w, final EnumHand hand )
|
||||
private void clearCard( final PlayerEntity player, final World w, final Hand hand )
|
||||
{
|
||||
final IMemoryCard mem = (IMemoryCard) player.getHeldItem( hand ).getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
|
||||
@@ -4,8 +4,8 @@ package appeng.items.tools;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
@@ -19,7 +19,7 @@ public class ToolMemoryCardRendering extends ItemRenderingCustomizer
|
||||
private static final ResourceLocation MODEL = new ResourceLocation( AppEng.MOD_ID, "builtin/memory_card" );
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.builtInModel( "models/item/builtin/memory_card", new MemoryCardModel() );
|
||||
|
||||
@@ -20,23 +20,18 @@ package appeng.items.tools;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional.Interface;
|
||||
|
||||
import cofh.api.item.IToolHammer;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
@@ -57,10 +52,7 @@ import appeng.items.contents.NetworkToolViewer;
|
||||
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 ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, IToolHammer /* , IToolWrench */
|
||||
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench
|
||||
{
|
||||
|
||||
public ToolNetworkTool()
|
||||
@@ -77,7 +69,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity p, final Hand hand )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -93,7 +85,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
|
||||
@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 )
|
||||
public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos );
|
||||
final TileEntity te = world.getTileEntity( pos );
|
||||
@@ -108,7 +100,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
{
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
else if( player.isSneaking() )
|
||||
else if( player.isShiftKeyDown() )
|
||||
{
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
@@ -128,12 +120,12 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player )
|
||||
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockReader world, final BlockPos pos, final PlayerEntity player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, final EnumHand hand, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
public boolean serverSideToolLogic( final ItemStack is, final PlayerEntity p, final Hand hand, final World w, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( side != null )
|
||||
{
|
||||
@@ -143,7 +135,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
|
||||
final Block b = w.getBlockState( pos ).getBlock();
|
||||
if( !p.isSneaking() )
|
||||
if( !p.isShiftKeyDown() )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
if( !( te instanceof IGridHost ) )
|
||||
@@ -157,7 +149,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
}
|
||||
|
||||
if( !p.isSneaking() )
|
||||
if( !p.isShiftKeyDown() )
|
||||
{
|
||||
if( p.openContainer instanceof AEBaseContainer )
|
||||
{
|
||||
@@ -191,35 +183,8 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWrench( final ItemStack wrench, final EntityPlayer player, final BlockPos pos )
|
||||
public boolean canWrench( final ItemStack wrench, final PlayerEntity player, final 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 void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
}
|
||||
// IToolHammer - end
|
||||
|
||||
// TODO: BC WRENCH INTEGRATION
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package appeng.items.tools.powered;
|
||||
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
@@ -41,7 +41,7 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter )
|
||||
public boolean hitEntity( final ItemStack item, final LivingEntity target, final LivingEntity hitter )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 300 )
|
||||
{
|
||||
|
||||
@@ -32,22 +32,22 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockColored;
|
||||
import net.minecraft.block.BlockStainedGlass;
|
||||
import net.minecraft.block.BlockStainedGlassPane;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemSnowball;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
{
|
||||
for( final AEColor color : AEColor.VALID_COLORS )
|
||||
{
|
||||
final String dyeName = color.dye.getUnlocalizedName();
|
||||
final String dyeName = color.dye.getTranslationKey();
|
||||
final String oreDictName = "dye" + WordUtils.capitalize( dyeName );
|
||||
final int oreDictId = OreDictionary.getOreID( oreDictName );
|
||||
|
||||
@@ -104,13 +104,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ )
|
||||
public EnumActionResult onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
return this.onItemUse( p.getHeldItem( hand ), p, w, pos, hand, side, hitX, hitY, hitZ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( ItemStack is, EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ )
|
||||
public EnumActionResult onItemUse( ItemStack is, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
final Block blk = w.getBlockState( pos ).getBlock();
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
}
|
||||
|
||||
if( p.isSneaking() )
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
this.cycleColors( is, paintBall, 1 );
|
||||
}
|
||||
@@ -248,10 +248,10 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
public ItemStack getColor( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound c = is.getTagCompound();
|
||||
final CompoundNBT c = is.getTagCompound();
|
||||
if( c != null && c.hasKey( "color" ) )
|
||||
{
|
||||
final NBTTagCompound color = c.getCompoundTag( "color" );
|
||||
final CompoundNBT color = c.getCompoundTag( "color" );
|
||||
final ItemStack oldColor = new ItemStack( color );
|
||||
if( !oldColor.isEmpty() )
|
||||
{
|
||||
@@ -333,22 +333,22 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
private void setColor( final ItemStack is, final ItemStack newColor )
|
||||
{
|
||||
final NBTTagCompound data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
if( newColor.isEmpty() )
|
||||
{
|
||||
data.removeTag( "color" );
|
||||
}
|
||||
else
|
||||
{
|
||||
final NBTTagCompound color = new NBTTagCompound();
|
||||
final CompoundNBT color = new CompoundNBT();
|
||||
newColor.writeToNBT( color );
|
||||
data.setTag( "color", color );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean recolourBlock( final Block blk, final EnumFacing side, final World w, final BlockPos pos, final EnumFacing orientation, final AEColor newColor, final EntityPlayer p )
|
||||
private boolean recolourBlock( final Block blk, final Direction side, final World w, final BlockPos pos, final Direction orientation, final AEColor newColor, final PlayerEntity p )
|
||||
{
|
||||
final IBlockState state = w.getBlockState( pos );
|
||||
final BlockState state = w.getBlockState( pos );
|
||||
|
||||
if( blk instanceof BlockColored )
|
||||
{
|
||||
@@ -422,7 +422,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
@@ -5,8 +5,8 @@ package appeng.items.tools.powered;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
@@ -22,7 +22,7 @@ public class ToolColorApplicatorRendering extends ItemRenderingCustomizer
|
||||
private static final ModelResourceLocation MODEL_UNCOLORED = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "color_applicator_uncolored" ), "inventory" );
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.builtInModel( "models/item/builtin/color_applicator_colored", new ColorApplicatorModel() );
|
||||
|
||||
@@ -25,22 +25,20 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockTNT;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
@@ -90,10 +88,10 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
private static class InWorldToolOperationIngredient
|
||||
{
|
||||
private final IBlockState state;
|
||||
private final BlockState state;
|
||||
private final boolean blockOnly;
|
||||
|
||||
public InWorldToolOperationIngredient( final IBlockState state )
|
||||
public InWorldToolOperationIngredient( final BlockState state )
|
||||
{
|
||||
this.state = state;
|
||||
this.blockOnly = false;
|
||||
@@ -127,7 +125,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
}
|
||||
|
||||
private void heat( final IBlockState state, final World w, final BlockPos pos )
|
||||
private void heat( final BlockState state, final World w, final BlockPos pos )
|
||||
{
|
||||
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -151,7 +149,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canHeat( final IBlockState state )
|
||||
private boolean canHeat( final BlockState state )
|
||||
{
|
||||
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -163,7 +161,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
return r != null;
|
||||
}
|
||||
|
||||
private void cool( final IBlockState state, final World w, final BlockPos pos )
|
||||
private void cool( final BlockState state, final World w, final BlockPos pos )
|
||||
{
|
||||
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -187,7 +185,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canCool( final IBlockState state )
|
||||
private boolean canCool( final BlockState state )
|
||||
{
|
||||
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( state ) );
|
||||
|
||||
@@ -200,7 +198,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter )
|
||||
public boolean hitEntity( final ItemStack item, final LivingEntity target, final LivingEntity hitter )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
@@ -212,7 +210,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity p, final Hand hand )
|
||||
{
|
||||
final RayTraceResult target = this.rayTrace( w, p, true );
|
||||
|
||||
@@ -224,12 +222,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
if( target.typeOfHit == RayTraceResult.Type.BLOCK )
|
||||
{
|
||||
final IBlockState state = w.getBlockState( target.getBlockPos() );
|
||||
final BlockState state = w.getBlockState( target.getBlockPos() );
|
||||
if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER )
|
||||
{
|
||||
if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) )
|
||||
{
|
||||
this.onItemUse( p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F );
|
||||
this.onItemUse( p, w, target.getBlockPos(), hand, Direction.UP, 0.0F, 0.0F, 0.0F );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,13 +237,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ )
|
||||
public EnumActionResult onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
return this.onItemUse( p.getHeldItem( hand ), p, w, pos, hand, side, hitX, hitY, hitZ );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse( ItemStack item, EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ )
|
||||
public ActionResult onItemUse( ItemStack item, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
@@ -254,10 +252,10 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
final IBlockState state = w.getBlockState( pos );
|
||||
final BlockState state = w.getBlockState( pos );
|
||||
final Block blockID = state.getBlock();
|
||||
|
||||
if( p.isSneaking() )
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
if( this.canCool( state ) )
|
||||
{
|
||||
@@ -300,7 +298,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
if( !result.isEmpty() )
|
||||
{
|
||||
if( result.getItem() instanceof ItemBlock )
|
||||
if( result.getItem() instanceof BlockItem )
|
||||
{
|
||||
if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == blockID
|
||||
.getMetaFromState( state ) )
|
||||
|
||||
@@ -24,27 +24,27 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.passive.EntitySheep;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
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.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -86,7 +86,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
super( AEConfig.instance().getMatterCannonBattery() );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
@@ -102,7 +102,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final @Nullable EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity p, final @Nullable Hand hand )
|
||||
{
|
||||
if( this.getAECurrentPower( p.getHeldItem( hand ) ) > 1600 )
|
||||
{
|
||||
@@ -190,7 +190,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
|
||||
private void shootPaintBalls( final ItemStack type, final World w, final PlayerEntity p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
|
||||
{
|
||||
final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math
|
||||
.max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 );
|
||||
@@ -203,9 +203,9 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
{
|
||||
final Entity entity1 = (Entity) list.get( l );
|
||||
|
||||
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
if( !entity1.isAlive() && entity1 != p && !( entity1 instanceof ItemEntity ) )
|
||||
{
|
||||
if( entity1.isEntityAlive() )
|
||||
if( entity1.isAlive() )
|
||||
{
|
||||
// prevent killing / flying of mounts.
|
||||
if( entity1.isRidingOrBeingRiddenBy( p ) )
|
||||
@@ -279,7 +279,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
|
||||
{
|
||||
final EnumFacing side = pos.sideHit;
|
||||
final Direction side = pos.sideHit;
|
||||
final BlockPos hitPos = pos.getBlockPos().offset( side );
|
||||
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( w, hitPos ), p ) )
|
||||
@@ -306,7 +306,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
}
|
||||
|
||||
private void standardAmmo( float penetration, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
|
||||
private void standardAmmo( float penetration, final World w, final PlayerEntity p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 )
|
||||
{
|
||||
boolean hasDestroyed = true;
|
||||
while( penetration > 0 && hasDestroyed )
|
||||
@@ -326,7 +326,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) )
|
||||
{
|
||||
if( entity1.isEntityAlive() )
|
||||
if( entity1.isAlive() )
|
||||
{
|
||||
// prevent killing / flying of mounts.
|
||||
if( entity1.isRidingOrBeingRiddenBy( p ) )
|
||||
@@ -383,15 +383,15 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
if( pos.typeOfHit == RayTraceResult.Type.ENTITY )
|
||||
{
|
||||
final int dmg = (int) Math.ceil( penetration / 20.0f );
|
||||
if( pos.entityHit instanceof EntityLivingBase )
|
||||
if( pos.entityHit instanceof LivingEntity )
|
||||
{
|
||||
final EntityLivingBase el = (EntityLivingBase) pos.entityHit;
|
||||
final LivingEntity el = (LivingEntity) pos.entityHit;
|
||||
penetration -= dmg;
|
||||
el.knockBack( p, 0, -direction.x, -direction.z );
|
||||
// el.knockBack( p, 0, Vec3d.x,
|
||||
// Vec3d.z );
|
||||
el.attackEntityFrom( dmgSrc, dmg );
|
||||
if( !el.isEntityAlive() )
|
||||
if( !el.isAlive() )
|
||||
{
|
||||
hasDestroyed = true;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
else
|
||||
{
|
||||
final IBlockState bs = w.getBlockState( pos.getBlockPos() );
|
||||
final BlockState bs = w.getBlockState( pos.getBlockPos() );
|
||||
// int meta = w.getBlockMetadata(
|
||||
// pos.blockX, pos.blockY, pos.blockZ );
|
||||
|
||||
|
||||
@@ -23,15 +23,15 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -63,13 +63,13 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
|
||||
{
|
||||
Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
|
||||
return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
@@ -77,7 +77,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
@@ -22,16 +22,16 @@ package appeng.items.tools.powered;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -57,13 +57,13 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity player, final Hand hand )
|
||||
{
|
||||
AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player );
|
||||
return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public boolean isFull3D()
|
||||
{
|
||||
@@ -71,14 +71,14 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
if( stack.hasTagCompound() )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( stack );
|
||||
final CompoundNBT tag = Platform.openNbtData( stack );
|
||||
if( tag != null )
|
||||
{
|
||||
final String encKey = tag.getString( "encryptionKey" );
|
||||
@@ -106,13 +106,13 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usePower( final EntityPlayer player, final double amount, final ItemStack is )
|
||||
public boolean usePower( final PlayerEntity player, final double amount, final ItemStack is )
|
||||
{
|
||||
return this.extractAEPower( is, amount, Actionable.MODULATE ) >= amount - 0.5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPower( final EntityPlayer player, final double amt, final ItemStack is )
|
||||
public boolean hasPower( final PlayerEntity player, final double amt, final ItemStack is )
|
||||
{
|
||||
return this.getAECurrentPower( is ) >= amt;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
{
|
||||
final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) ->
|
||||
{
|
||||
final NBTTagCompound data = Platform.openNbtData( target );
|
||||
final CompoundNBT data = Platform.openNbtData( target );
|
||||
manager.writeToNBT( data );
|
||||
} );
|
||||
|
||||
@@ -137,14 +137,14 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
@Override
|
||||
public String getEncryptionKey( final ItemStack item )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( item );
|
||||
final CompoundNBT tag = Platform.openNbtData( item );
|
||||
return tag.getString( "encryptionKey" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEncryptionKey( final ItemStack item, final String encKey, final String name )
|
||||
{
|
||||
final NBTTagCompound tag = Platform.openNbtData( item );
|
||||
final CompoundNBT tag = Platform.openNbtData( item );
|
||||
tag.setString( "encryptionKey", encKey );
|
||||
tag.setString( "name", name );
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ import java.util.List;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -57,11 +57,11 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
this.powerCapacity = powerCapacity;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final NBTTagCompound tag = stack.getTagCompound();
|
||||
final CompoundNBT tag = stack.getTagCompound();
|
||||
double internalCurrentPower = 0;
|
||||
final double internalMaxPower = this.getAEMaxPower( stack );
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
super.getCheckedSubItems( creativeTab, itemStacks );
|
||||
|
||||
final ItemStack charged = new ItemStack( this, 1 );
|
||||
final NBTTagCompound tag = Platform.openNbtData( charged );
|
||||
final CompoundNBT tag = Platform.openNbtData( charged );
|
||||
tag.setDouble( CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
|
||||
tag.setDouble( MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ) );
|
||||
|
||||
@@ -129,7 +129,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
final NBTTagCompound data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
final double toAdd = Math.min( amount, required );
|
||||
|
||||
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage + toAdd );
|
||||
@@ -146,7 +146,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
if( mode == Actionable.MODULATE )
|
||||
{
|
||||
final NBTTagCompound data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
|
||||
data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage - fulfillable );
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
@Override
|
||||
public double getAECurrentPower( final ItemStack is )
|
||||
{
|
||||
final NBTTagCompound data = Platform.openNbtData( is );
|
||||
final CompoundNBT data = Platform.openNbtData( is );
|
||||
|
||||
return data.getDouble( CURRENT_POWER_NBT_KEY );
|
||||
}
|
||||
@@ -175,7 +175,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICapabilityProvider initCapabilities( ItemStack stack, NBTTagCompound nbt )
|
||||
public ICapabilityProvider initCapabilities( ItemStack stack, CompoundNBT nbt )
|
||||
{
|
||||
return new PoweredItemCapabilities( stack, this );
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
@@ -62,14 +62,14 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, @Nullable EnumFacing facing )
|
||||
public boolean hasCapability( Capability<?> capability, @Nullable Direction facing )
|
||||
{
|
||||
return capability == Capabilities.FORGE_ENERGY || capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER;
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@Override
|
||||
public <T> T getCapability( Capability<T> capability, @Nullable EnumFacing facing )
|
||||
public <T> T getCapability( Capability<T> capability, @Nullable Direction facing )
|
||||
{
|
||||
if( capability == Capabilities.FORGE_ENERGY )
|
||||
{
|
||||
|
||||
@@ -19,20 +19,23 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraft.item.AxeItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzAxe extends ItemAxe
|
||||
public class ToolQuartzAxe extends AxeItem
|
||||
{
|
||||
private final AEFeature type;
|
||||
|
||||
public ToolQuartzAxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
super( ItemTier.IRON, 6.0F, -3.1F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
}
|
||||
|
||||
@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 )
|
||||
public EnumActionResult onItemUse( final PlayerEntity p, final World worldIn, final BlockPos pos, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
@@ -60,7 +60,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final World w, final PlayerEntity p, final Hand hand )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
|
||||
@@ -19,20 +19,23 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraft.item.HoeItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzHoe extends ItemHoe
|
||||
public class ToolQuartzHoe extends HoeItem
|
||||
{
|
||||
private final AEFeature type;
|
||||
|
||||
public ToolQuartzHoe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
super( ItemTier.IRON, -1.0F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,20 +19,23 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.item.PickaxeItem;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzPickaxe extends ItemPickaxe
|
||||
public class ToolQuartzPickaxe extends PickaxeItem
|
||||
{
|
||||
private final AEFeature type;
|
||||
|
||||
public ToolQuartzPickaxe( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
super( ItemTier.IRON, 1, -2.8F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,20 +19,23 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.item.ShovelItem;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzSpade extends ItemSpade
|
||||
public class ToolQuartzSpade extends ShovelItem
|
||||
{
|
||||
private final AEFeature type;
|
||||
|
||||
public ToolQuartzSpade( final AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
super( ItemTier.IRON, 1.5F, -3.0F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,20 +19,23 @@
|
||||
package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.ItemTier;
|
||||
import net.minecraft.item.SwordItem;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class ToolQuartzSword extends ItemSword
|
||||
public class ToolQuartzSword extends SwordItem
|
||||
{
|
||||
private final AEFeature type;
|
||||
|
||||
public ToolQuartzSword( AEFeature type )
|
||||
{
|
||||
super( ToolMaterial.IRON );
|
||||
super( ItemTier.IRON, 3, -2.4F, ( new Item.Properties() ).group( ItemGroup.COMBAT ) );
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,19 +20,12 @@ package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
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;
|
||||
@@ -40,88 +33,40 @@ 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 */
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench
|
||||
{
|
||||
|
||||
public ToolQuartzWrench()
|
||||
{
|
||||
this.setMaxStackSize( 1 );
|
||||
this.setHarvestLevel( "wrench", 0 );
|
||||
super( new Properties().maxStackSize( 1 ) );
|
||||
}
|
||||
|
||||
@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 )
|
||||
public ActionResultType onItemUse( ItemUseContext context )
|
||||
{
|
||||
final Block b = world.getBlockState( pos ).getBlock();
|
||||
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
|
||||
final Block b = context.getWorld().getBlockState( context.getPos() ).getBlock();
|
||||
if( b != null && !context.getPlayer().isShiftKeyDown() && Platform.hasPermissions( new DimensionalCoord( context.getWorld(), context.getPos() ),
|
||||
context.getPlayer() ) )
|
||||
{
|
||||
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;
|
||||
return !context.getWorld().isRemote ? ActionResultType.SUCCESS : ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if( b.rotateBlock( world, pos, side ) )
|
||||
if( b.rotate( context.getWorld().getBlockState( context.getPos() ), context.getWorld(), context.getPos(), Rotation.CLOCKWISE_90 ) != null )
|
||||
{
|
||||
player.swingArm( hand );
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
context.getPlayer().swingArm( context.getHand() );
|
||||
return !context.getWorld().isRemote ? ActionResultType.SUCCESS : ActionResultType.FAIL;
|
||||
}
|
||||
}
|
||||
return EnumActionResult.PASS;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player )
|
||||
public boolean canWrench( final ItemStack wrench, final PlayerEntity 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;
|
||||
}
|
||||
|
||||
@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, Entity entity )
|
||||
{
|
||||
}
|
||||
|
||||
// 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();
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user