Port to 1.11

This commit is contained in:
yueh
2016-12-08 12:42:00 +01:00
parent 589730bfad
commit ed9e6dd21c
262 changed files with 4027 additions and 3954 deletions
+3 -2
View File
@@ -25,6 +25,7 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
public abstract class AEBaseItem extends Item
@@ -51,7 +52,7 @@ public abstract class AEBaseItem extends Item
@Override
@SuppressWarnings( "unchecked" )
public final void getSubItems( final Item sameItem, final CreativeTabs creativeTab, final List itemStacks )
public final void getSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
this.getCheckedSubItems( sameItem, creativeTab, itemStacks );
}
@@ -67,7 +68,7 @@ public abstract class AEBaseItem extends Item
super.addInformation( stack, player, lines, displayMoreInfo );
}
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
super.getSubItems( sameItem, creativeTab, itemStacks );
}
@@ -104,9 +104,9 @@ public class NetworkToolViewer implements INetworkTool
}
@Override
public boolean isUseableByPlayer( final EntityPlayer entityplayer )
public boolean isUsableByPlayer( final EntityPlayer entityplayer )
{
return this.inv.isUseableByPlayer( entityplayer );
return this.inv.isUsableByPlayer( entityplayer );
}
@Override
@@ -168,4 +168,10 @@ public class NetworkToolViewer implements INetworkTool
{
return this.inv.getDisplayName();
}
@Override
public boolean isEmpty()
{
return false;
}
}
@@ -45,6 +45,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -257,7 +258,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
}
@Override
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
final List<MaterialType> types = Arrays.asList( MaterialType.values() );
Collections.sort( types, new Comparator<MaterialType>()
@@ -280,7 +281,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
}
@Override
public EnumActionResult onItemUseFirst( final ItemStack is, 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 EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
if( player.isSneaking() )
{
@@ -300,29 +301,29 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
upgrades = ( (ISegmentedInventory) te ).getInventoryByName( "upgrades" );
}
if( upgrades != null && is != null && is.getItem() instanceof IUpgradeModule )
if( upgrades != null && player.getHeldItemMainhand() != null && player.getHeldItemMainhand().getItem() instanceof IUpgradeModule )
{
final IUpgradeModule um = (IUpgradeModule) is.getItem();
final Upgrades u = um.getType( is );
final IUpgradeModule um = (IUpgradeModule) player.getHeldItemMainhand().getItem();
final Upgrades u = um.getType( player.getHeldItemMainhand() );
if( u != null )
{
final InventoryAdaptor ad = InventoryAdaptor.getAdaptor( upgrades, EnumFacing.UP );
if( ad != null )
{
if( player.worldObj.isRemote )
if( player.world.isRemote )
{
return EnumActionResult.PASS;
}
player.inventory.setInventorySlotContents( player.inventory.currentItem, ad.addItems( is ) );
player.inventory.setInventorySlotContents( player.inventory.currentItem, ad.addItems( player.getHeldItemMainhand() ) );
return EnumActionResult.SUCCESS;
}
}
}
}
return super.onItemUseFirst( is, player, world, pos, side, hitX, hitY, hitZ, hand );
return super.onItemUseFirst( player, world, pos, side, hitX, hitY, hitZ, hand );
}
@Override
@@ -144,7 +144,8 @@ public enum MaterialType
this( metaValue, modelName, features );
this.droppedEntity = c;
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, this.droppedEntity.getSimpleName(),
EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
true );
}
@@ -153,7 +154,8 @@ public enum MaterialType
this( metaValue, modelName, features );
this.oreName = oreDictionary;
this.droppedEntity = c;
EntityRegistry.registerModEntity( this.droppedEntity, this.droppedEntity.getSimpleName(), EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
EntityRegistry.registerModEntity( new ResourceLocation( this.droppedEntity.getName() ), this.droppedEntity, this.droppedEntity.getSimpleName(),
EntityIds.get( this.droppedEntity ), AppEng.instance(), 16, 4,
true );
}
@@ -32,6 +32,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.EntityRegistry;
@@ -62,7 +64,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
{
this.setHasSubtypes( true );
EntityRegistry.registerModEntity( EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true );
EntityRegistry.registerModEntity( new ResourceLocation( EntityGrowingCrystal.class.getName() ), EntityGrowingCrystal.class, EntityGrowingCrystal.class.getSimpleName(), EntityIds.get( EntityGrowingCrystal.class ), AppEng.instance(), 16, 4, true );
}
@Nullable
@@ -109,7 +111,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
{
final int newDamage = getProgress( is ) + 1;
final IMaterials materials = AEApi.instance().definitions().materials();
final int size = is.stackSize;
final int size = is.getCount();
if( newDamage == CERTUS + SINGLE_OFFSET )
{
@@ -237,7 +239,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
}
@Override
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
// lvl 0
itemStacks.add( newStyle( new ItemStack( this, 1, CERTUS ) ) );
@@ -38,7 +38,7 @@ import appeng.api.AEApi;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import appeng.helpers.PatternHelper;
import appeng.items.AEBaseItem;
@@ -56,17 +56,17 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack stack, final World w, final EntityPlayer player, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{
this.clearPattern( stack, player );
this.clearPattern( player.getHeldItemMainhand(), player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, stack );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItemMainhand() );
}
@Override
public EnumActionResult onItemUseFirst( final ItemStack stack, 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 EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
return this.clearPattern( stack, player ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
return this.clearPattern( player.getHeldItemMainhand(), player ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}
private boolean clearPattern( final ItemStack stack, final EntityPlayer player )
@@ -80,7 +80,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
final InventoryPlayer inv = player.inventory;
ItemStack is = AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.stackSize ).orElse( null );
ItemStack is = AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.getCount() ).orElse( null );
if( is != null )
{
for( int s = 0; s < player.inventory.getSizeInventory(); s++ )
@@ -100,7 +100,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
@Override
public void addCheckedInformation( final ItemStack stack, final EntityPlayer player, final List<String> lines, final boolean displayMoreInfo )
{
final ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
final ICraftingPatternDetails details = this.getPatternForItem( stack, player.world );
if( details == null )
{
@@ -172,7 +172,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
return out;
}
final World w = CommonHelper.proxy.getWorld();
final World w = AppEng.proxy.getWorld();
if( w == null )
{
return null;
@@ -19,11 +19,10 @@
package appeng.items.misc;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import appeng.api.util.AEColor;
import appeng.core.localization.GuiText;
@@ -68,7 +67,7 @@ public class ItemPaintBall extends AEBaseItem
}
@Override
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
for( final AEColor c : AEColor.values() )
{
@@ -38,6 +38,7 @@ import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -69,9 +70,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
public EnumActionResult onItemUseFirst( final ItemStack is, 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 EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, world );
return AEApi.instance().partHelper().placeBus( player.getHeldItemMainhand(), pos, side, player, hand, world );
}
@Override
@@ -94,7 +95,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
@Override
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
this.calculateSubTypes();
itemStacks.addAll( this.subTypes );
@@ -116,7 +117,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
continue;
}
final List<ItemStack> tmpList = new ArrayList<ItemStack>( 100 );
final NonNullList<ItemStack> tmpList = NonNullList.create();
b.getSubBlocks( item, b.getCreativeTabToDisplayOn(), tmpList );
for( final ItemStack l : tmpList )
{
@@ -336,6 +337,6 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
}
Block blk = blockState.getBlock();
return blk.canRenderInLayer( BlockRenderLayer.TRANSLUCENT );
return blk.canRenderInLayer( blockState, BlockRenderLayer.TRANSLUCENT );
}
}
@@ -41,6 +41,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -152,14 +153,14 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
}
@Override
public EnumActionResult onItemUse( final ItemStack is, final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( this.getTypeByStack( is ) == PartType.InvalidType )
if( this.getTypeByStack( player.getHeldItemMainhand() ) == PartType.InvalidType )
{
return EnumActionResult.FAIL;
}
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, w );
return AEApi.instance().partHelper().placeBus( player.getHeldItemMainhand(), pos, side, player, hand, w );
}
@Override
@@ -195,7 +196,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
}
@Override
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
final List<Entry<Integer, PartTypeWithVariant>> types = new ArrayList<Entry<Integer, PartTypeWithVariant>>( this.registered.entrySet() );
Collections.sort( types, REGISTERED_COMPARATOR );
+19 -21
View File
@@ -59,10 +59,8 @@ import appeng.parts.networking.PartCableGlass;
import appeng.parts.networking.PartCableSmart;
import appeng.parts.networking.PartDenseCable;
import appeng.parts.networking.PartQuartzFiber;
import appeng.parts.p2p.PartP2PIC2Power;
import appeng.parts.p2p.PartP2PItems;
import appeng.parts.p2p.PartP2PLight;
import appeng.parts.p2p.PartP2PLiquids;
import appeng.parts.p2p.PartP2PRedstone;
import appeng.parts.p2p.PartP2PTunnelME;
import appeng.parts.reporting.PartConversionMonitor;
@@ -226,25 +224,25 @@ public enum PartType
}
},
P2PTunnelLiquids( 463, "p2p_tunnel_liquids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIQUIDS ), EnumSet
.noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel )
{
@Override
String getUnlocalizedName()
{
return "P2PTunnel";
}
},
P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
.of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
{
@Override
String getUnlocalizedName()
{
return "P2PTunnel";
}
},
// P2PTunnelLiquids( 463, "p2p_tunnel_liquids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIQUIDS ), EnumSet
// .noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel )
// {
// @Override
// String getUnlocalizedName()
// {
// return "P2PTunnel";
// }
// },
//
// P2PTunnelEU( 465, "p2p_tunnel_ic2", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_EU ), EnumSet
// .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel )
// {
// @Override
// String getUnlocalizedName()
// {
// return "P2PTunnel";
// }
// },
// P2PTunnelRF( 466, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelRF ), EnumSet.of( IntegrationType.RF ),
// PartP2PRFPower.class, GuiText.RFTunnel ),
@@ -214,10 +214,10 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack stack, final World world, final EntityPlayer player, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World world, final EntityPlayer player, final EnumHand hand )
{
this.disassembleDrive( stack, world, player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, stack );
this.disassembleDrive( player.getHeldItemMainhand(), world, player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItemMainhand() );
}
private boolean disassembleDrive( final ItemStack stack, final World world, final EntityPlayer player )
@@ -281,9 +281,9 @@ public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCe
}
@Override
public EnumActionResult onItemUseFirst( final ItemStack stack, 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 EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
return this.disassembleDrive( stack, world, player ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
return this.disassembleDrive( player.getHeldItemMainhand(), world, player ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
}
@Override
@@ -51,16 +51,16 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack is, final World w, final EntityPlayer p, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
{
if( p.isSneaking() )
{
this.encode( is, p );
this.encode( p.getHeldItemMainhand(), p );
p.swingArm( hand );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, is );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
return new ActionResult<ItemStack>( EnumActionResult.PASS, is );
return new ActionResult<ItemStack>( EnumActionResult.PASS, p.getHeldItemMainhand() );
}
@Override
@@ -124,34 +124,34 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
switch( msg )
{
case SETTINGS_CLEARED:
player.addChatMessage( PlayerMessages.SettingCleared.get() );
player.sendMessage( PlayerMessages.SettingCleared.get() );
break;
case INVALID_MACHINE:
player.addChatMessage( PlayerMessages.InvalidMachine.get() );
player.sendMessage( PlayerMessages.InvalidMachine.get() );
break;
case SETTINGS_LOADED:
player.addChatMessage( PlayerMessages.LoadedSettings.get() );
player.sendMessage( PlayerMessages.LoadedSettings.get() );
break;
case SETTINGS_SAVED:
player.addChatMessage( PlayerMessages.SavedSettings.get() );
player.sendMessage( PlayerMessages.SavedSettings.get() );
break;
default:
}
}
@Override
public EnumActionResult onItemUse( final ItemStack is, 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 EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz )
{
if( player.isSneaking() && !w.isRemote )
{
final IMemoryCard mem = (IMemoryCard) is.getItem();
final IMemoryCard mem = (IMemoryCard) player.getHeldItemMainhand().getItem();
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
is.setTagCompound( null );
player.getHeldItemMainhand().setTagCompound( null );
return EnumActionResult.SUCCESS;
}
else
{
return super.onItemUse( is, player, w, pos, hand, side, hx, hy, hz );
return super.onItemUse( player, w, pos, hand, side, hx, hy, hz );
}
}
@@ -42,8 +42,8 @@ import appeng.api.parts.SelectedPart;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.INetworkToolAgent;
import appeng.client.ClientHelper;
import appeng.container.AEBaseContainer;
import appeng.core.AppEng;
import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
@@ -71,30 +71,30 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack it, final World w, final EntityPlayer p, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
{
if( Platform.isClient() )
{
final RayTraceResult mop = ClientHelper.proxy.getRTR();
final RayTraceResult mop = AppEng.proxy.getRTR();
if( mop == null )
{
this.onItemUseFirst( it, p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
this.onItemUseFirst( p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
}
else
{
if( w.getBlockState( mop.getBlockPos() ).getBlock().isAir( w.getBlockState( mop.getBlockPos() ), w, mop.getBlockPos() ) )
{
this.onItemUseFirst( it, p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
this.onItemUseFirst( p, w, new BlockPos( 0, 0, 0 ), null, 0, 0, 0, hand ); // eh?
}
}
}
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, it );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
@Override
public EnumActionResult onItemUseFirst( final ItemStack stack, 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 EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos );
final TileEntity te = world.getTileEntity( pos );
@@ -151,7 +151,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
{
if( b.rotateBlock( w, pos, side ) )
{
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK );
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), w, pos, Platform.AIR_BLOCK, null );
p.swingArm( hand );
return !w.isRemote;
}
@@ -180,7 +180,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
}
else
{
b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, is, side, hitX, hitY, hitZ );
b.onBlockActivated( w, pos, w.getBlockState( pos ), p, hand, side, hitX, hitY, hitZ );
}
}
else
@@ -25,9 +25,9 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.math.AxisAlignedBB;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.core.sync.packets.PacketLightning;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
import appeng.server.ServerHelper;
import appeng.util.Platform;
@@ -53,10 +53,10 @@ public class ToolChargedStaff extends AEBasePoweredItem
final float dx = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minX );
final float dy = (float) ( Platform.getRandomFloat() * target.height + entityBoundingBox.minY );
final float dz = (float) ( Platform.getRandomFloat() * target.width + entityBoundingBox.minZ );
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) );
AppEng.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.world, new PacketLightning( dx, dy, dz ) );
}
}
target.attackEntityFrom( DamageSource.magic, 6 );
target.attackEntityFrom( DamageSource.MAGIC, 6 );
return true;
}
@@ -118,7 +118,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( option != null )
{
paintBall = option.getItemStack();
paintBall.stackSize = 1;
paintBall.setCount( 1 );
}
else
{
@@ -242,7 +242,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
if( c != null && c.hasKey( "color" ) )
{
final NBTTagCompound color = c.getCompoundTag( "color" );
final ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
final ItemStack oldColor = new ItemStack( color );
if( oldColor != null )
{
return oldColor;
@@ -209,13 +209,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand )
{
final RayTraceResult target = this.rayTrace( w, p, true );
if( target == null )
{
return new ActionResult<ItemStack>( EnumActionResult.FAIL, item );
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItemMainhand() );
}
else
{
@@ -226,13 +226,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
{
if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) )
{
this.onItemUse( item, p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F );
this.onItemUse( p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F );
}
}
}
}
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
@Override
@@ -61,7 +61,7 @@ import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.CommonHelper;
import appeng.core.AppEng;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
@@ -106,19 +106,19 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final @Nullable EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer p, final @Nullable EnumHand hand )
{
if( this.getAECurrentPower( item ) > 1600 )
if( this.getAECurrentPower( p.getHeldItemMainhand() ) > 1600 )
{
int shots = 1;
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( item );
final CellUpgrades cu = (CellUpgrades) this.getUpgradesInventory( p.getHeldItemMainhand() );
if( cu != null )
{
shots += cu.getInstalledUpgrades( Upgrades.SPEED );
}
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( item, null, StorageChannel.ITEMS );
final IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( p.getHeldItemMainhand(), null, StorageChannel.ITEMS );
if( inv != null )
{
final IItemList itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
@@ -128,25 +128,25 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
shots = Math.min( shots, (int) aeAmmo.getStackSize() );
for( int sh = 0; sh < shots; sh++ )
{
this.extractAEPower( item, 1600 );
this.extractAEPower( p.getHeldItemMainhand(), 1600 );
if( Platform.isClient() )
{
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
aeAmmo.setStackSize( 1 );
final ItemStack ammo = ( (IAEItemStack) aeAmmo ).getItemStack();
if( ammo == null )
{
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
ammo.stackSize = 1;
ammo.setCount( 1 );
aeAmmo = inv.extractItems( aeAmmo, Actionable.MODULATE, new PlayerSource( p, null ) );
if( aeAmmo == null )
{
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
final LookDirection dir = Platform.getPlayerRay( p, p.getEyeHeight() );
@@ -168,7 +168,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
{
this.shootPaintBalls( type, w, p, Vec3d, Vec3d1, direction, d0, d1, d2 );
}
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
else
{
@@ -180,13 +180,13 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
{
if( Platform.isServer() )
{
p.addChatMessage( PlayerMessages.AmmoDepleted.get() );
p.sendMessage( PlayerMessages.AmmoDepleted.get() );
}
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
}
}
return new ActionResult<ItemStack>( EnumActionResult.FAIL, item );
return new ActionResult<ItemStack>( EnumActionResult.FAIL, p.getHeldItemMainhand() );
}
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 )
@@ -244,7 +244,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
try
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch( final Exception err )
{
@@ -361,7 +361,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell
try
{
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
AppEng.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) direction.xCoord, (float) direction.yCoord, (float) direction.zCoord, (byte) ( pos == null ? 32 : pos.hitVec.squareDistanceTo( vec ) + 1 ) ) );
}
catch( final Exception err )
{
@@ -64,10 +64,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer player, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{
Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItemMainhand() );
}
@SideOnly( Side.CLIENT )
@@ -56,10 +56,10 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer player, final EnumHand hand )
public ActionResult<ItemStack> onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand )
{
AEApi.instance().registries().wireless().openWirelessTerminalGui( item, w, player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, item );
AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItemMainhand(), w, player );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, player.getHeldItemMainhand() );
}
@SideOnly( Side.CLIENT )
@@ -27,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.NonNullList;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import appeng.api.config.AccessRestriction;
@@ -75,7 +76,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
}
@Override
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final List<ItemStack> itemStacks )
protected void getCheckedSubItems( final Item sameItem, final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
{
super.getCheckedSubItems( sameItem, creativeTab, itemStacks );
@@ -1,125 +1,125 @@
/*
* 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.items.tools.powered.powersink;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import ic2.api.item.IElectricItemManager;
import ic2.api.item.ISpecialElectricItem;
import appeng.api.config.PowerUnits;
import appeng.coremod.annotations.Integration.Interface;
import appeng.coremod.annotations.Integration.InterfaceList;
import appeng.coremod.annotations.Integration.Method;
import appeng.integration.IntegrationType;
@InterfaceList( value = {
@Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ),
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 )
} )
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
{
public IC2( double powerCapacity )
{
super( powerCapacity );
}
@Override
public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
{
double addedAmt = amount;
double limit = this.getTransferLimit( is );
if( !ignoreTransferLimit && amount > limit )
{
addedAmt = limit;
}
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
}
@Override
public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
{
return 0;
}
@Override
public double getCharge( ItemStack is )
{
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
}
@Override
public boolean canUse( ItemStack is, double amount )
{
return this.getCharge( is ) > amount;
}
@Override
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
{
if( this.canUse( is, amount ) )
{
// use the power..
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
return true;
}
return false;
}
@Override
public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
{
// wtf?
}
@Override
public String getToolTip( ItemStack itemStack )
{
return null;
}
@Override
public double getMaxCharge( ItemStack itemStack )
{
return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
}
@Override
public int getTier( ItemStack itemStack )
{
return 1;
}
private double getTransferLimit( ItemStack itemStack )
{
return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
}
@Override
@Method( iname = IntegrationType.IC2 )
public IElectricItemManager getManager( ItemStack itemStack )
{
return this;
}
}
///*
// * 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.items.tools.powered.powersink;
//
//
//import net.minecraft.entity.EntityLivingBase;
//import net.minecraft.item.ItemStack;
//
//import ic2.api.item.IElectricItemManager;
//import ic2.api.item.ISpecialElectricItem;
//
//import appeng.api.config.PowerUnits;
//import appeng.coremod.annotations.Integration.Interface;
//import appeng.coremod.annotations.Integration.InterfaceList;
//import appeng.coremod.annotations.Integration.Method;
//import appeng.integration.IntegrationType;
//
//
//@InterfaceList( value = {
// @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ),
// @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 )
//} )
//public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
//{
// public IC2( double powerCapacity )
// {
// super( powerCapacity );
// }
//
// @Override
// public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
// {
// double addedAmt = amount;
// double limit = this.getTransferLimit( is );
//
// if( !ignoreTransferLimit && amount > limit )
// {
// addedAmt = limit;
// }
//
// return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
// }
//
// @Override
// public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
// {
// return 0;
// }
//
// @Override
// public double getCharge( ItemStack is )
// {
// return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
// }
//
// @Override
// public boolean canUse( ItemStack is, double amount )
// {
// return this.getCharge( is ) > amount;
// }
//
// @Override
// public boolean use( ItemStack is, double amount, EntityLivingBase entity )
// {
// if( this.canUse( is, amount ) )
// {
// // use the power..
// this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
// return true;
// }
// return false;
// }
//
// @Override
// public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
// {
// // wtf?
// }
//
// @Override
// public String getToolTip( ItemStack itemStack )
// {
// return null;
// }
//
// @Override
// public double getMaxCharge( ItemStack itemStack )
// {
// return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
// }
//
// @Override
// public int getTier( ItemStack itemStack )
// {
// return 1;
// }
//
// private double getTransferLimit( ItemStack itemStack )
// {
// return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
// }
//
// @Override
// @Method( iname = IntegrationType.IC2 )
// public IElectricItemManager getManager( ItemStack itemStack )
// {
// return this;
// }
//}
@@ -29,7 +29,7 @@ import appeng.integration.IntegrationType;
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem )
public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem
public abstract class RedstoneFlux extends AERootPoweredItem implements IEnergyContainerItem
{
public RedstoneFlux( final double powerCapacity )
{
@@ -50,7 +50,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
}
@Override
public EnumActionResult onItemUse( final ItemStack stack, 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 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() )
{
@@ -60,14 +60,14 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
}
@Override
public ActionResult<ItemStack> onItemRightClick( final ItemStack it, final World w, final EntityPlayer p, final EnumHand hand )
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<ItemStack>( EnumActionResult.SUCCESS, it );
return new ActionResult<ItemStack>( EnumActionResult.SUCCESS, p.getHeldItemMainhand() );
}
@Override
@@ -47,7 +47,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool
}
@Override
public EnumActionResult onItemUseFirst( final ItemStack stack, 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 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 ) )
@@ -60,7 +60,7 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool
if( b.rotateBlock( world, pos, side ) )
{
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), world, pos, Platform.AIR_BLOCK );
b.neighborChanged( Platform.AIR_BLOCK.getDefaultState(), world, pos, Platform.AIR_BLOCK, pos );
player.swingArm( hand );
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}