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
@@ -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 )
{