Ported to 1.7
This commit is contained in:
@@ -25,16 +25,14 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
setfeature( EnumSet.of( AEFeature.Security ) );
|
||||
setMaxStackSize( 1 );
|
||||
if ( Platform.isClient() )
|
||||
MinecraftForgeClient.registerItemRenderer( itemID, new ToolBiometricCardRender() );
|
||||
MinecraftForgeClient.registerItemRenderer( this, new ToolBiometricCardRender() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemDisplayName(ItemStack is)
|
||||
public String getItemStackDisplayName(ItemStack is)
|
||||
{
|
||||
String username = getUsername( is );
|
||||
return username.length() > 0 ? super.getItemDisplayName( is ) + " - " + username : super.getItemDisplayName( is );// GuiText.Encoded.getLocal()
|
||||
// //
|
||||
// );
|
||||
return username.length() > 0 ? super.getItemStackDisplayName( is ) + " - " + username : super.getItemStackDisplayName( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,10 +65,10 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
||||
private void encode(ItemStack is, EntityPlayer p)
|
||||
{
|
||||
String username = getUsername( is );
|
||||
if ( p.username.equals( username ) )
|
||||
if ( p.getCommandSenderName().equals( username ) )
|
||||
setUsername( is, "" );
|
||||
else
|
||||
setUsername( is, p.username );
|
||||
setUsername( is, p.getCommandSenderName() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
c.setString( "Config", SettingsName );
|
||||
c.setCompoundTag( "Data", data );
|
||||
c.setTag( "Data", data );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,13 +70,13 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
switch (msg)
|
||||
{
|
||||
case INVALID_MACHINE:
|
||||
player.sendChatToPlayer( PlayerMessages.InvalidMachine.get() );
|
||||
player.addChatMessage( PlayerMessages.InvalidMachine.get() );
|
||||
break;
|
||||
case SETTINGS_LOADED:
|
||||
player.sendChatToPlayer( PlayerMessages.LoadedSettings.get() );
|
||||
player.addChatMessage( PlayerMessages.LoadedSettings.get() );
|
||||
break;
|
||||
case SETTINGS_SAVED:
|
||||
player.sendChatToPlayer( PlayerMessages.SavedSettings.get() );
|
||||
player.addChatMessage( PlayerMessages.SavedSettings.get() );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
@@ -34,19 +34,18 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject(ItemStack is, World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity te = world.getBlockTileEntity( x, y, z );
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
return new NetworkToolViewer( is, (IGridHost) (te instanceof IGridHost ? te : null) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int id = world.getBlockId( x, y, z );
|
||||
if ( id > 0 && !player.isSneaking() )
|
||||
Block b = world.getBlock( x, y, z );
|
||||
if ( b != null && !player.isSneaking() )
|
||||
{
|
||||
Block b = Block.blocksList[id];
|
||||
TileEntity te = world.getBlockTileEntity( x, y, z );
|
||||
if ( b != null && !(te instanceof IGridHost) )
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
if ( !(te instanceof IGridHost) )
|
||||
{
|
||||
if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) )
|
||||
{
|
||||
@@ -69,7 +68,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
if ( p.openContainer instanceof AEBaseContainer )
|
||||
return true;
|
||||
|
||||
TileEntity te = w.getBlockTileEntity( x, y, z );
|
||||
TileEntity te = w.getTileEntity( x, y, z );
|
||||
if ( te instanceof IGridHost )
|
||||
Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS );
|
||||
else
|
||||
@@ -88,7 +87,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z)
|
||||
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ToolChargedStaff extends AEBasePoweredItem
|
||||
float dx = (float) (Platform.getRandomFloat() * target.width + target.boundingBox.minX);
|
||||
float dy = (float) (Platform.getRandomFloat() * target.height + target.boundingBox.minY);
|
||||
float dz = (float) (Platform.getRandomFloat() * target.width + target.boundingBox.minZ);
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, (new PacketLightning( dx, dy, dz )).getPacket() );
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, dx, dy, dz, 32.0, target.worldObj, new PacketLightning( dx, dy, dz ) );
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
|
||||
@@ -9,14 +9,16 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||
@@ -26,25 +28,50 @@ import appeng.util.Platform;
|
||||
public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
{
|
||||
|
||||
static private Hashtable<String, InWorldToolOperationResult> heatUp;
|
||||
static private Hashtable<String, InWorldToolOperationResult> coolDown;
|
||||
|
||||
static public void heat(int BlockID, int Metadata, World w, int x, int y, int z)
|
||||
static class Combo
|
||||
{
|
||||
InWorldToolOperationResult r = heatUp.get( BlockID + ":" + Metadata );
|
||||
|
||||
final public Block blk;
|
||||
final public int meta;
|
||||
|
||||
public Combo(Block b, int m) {
|
||||
blk = b;
|
||||
meta = m;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return blk.hashCode() ^ meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return blk == ((Combo) obj).blk && meta == ((Combo) obj).meta;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static private Hashtable<Combo, InWorldToolOperationResult> heatUp;
|
||||
static private Hashtable<Combo, InWorldToolOperationResult> coolDown;
|
||||
|
||||
static public void heat(Block BlockID, int Metadata, World w, int x, int y, int z)
|
||||
{
|
||||
InWorldToolOperationResult r = heatUp.get( new Combo( BlockID, Metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
{
|
||||
r = heatUp.get( BlockID + ":*" );
|
||||
r = heatUp.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
|
||||
if ( r.BlockItem != null )
|
||||
{
|
||||
w.setBlock( x, y, z, r.BlockItem.itemID, r.BlockItem.getItemDamage(), 3 );
|
||||
w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
w.setBlock( x, y, z, 0, 0, 3 );
|
||||
w.setBlock( x, y, z, Platform.air, 0, 3 );
|
||||
}
|
||||
|
||||
if ( r.Drops != null )
|
||||
@@ -53,34 +80,34 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
}
|
||||
}
|
||||
|
||||
static public boolean canHeat(int BlockID, int Metadata)
|
||||
static public boolean canHeat(Block BlockID, int Metadata)
|
||||
{
|
||||
InWorldToolOperationResult r = heatUp.get( BlockID + ":" + Metadata );
|
||||
InWorldToolOperationResult r = heatUp.get( new Combo( BlockID, Metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
{
|
||||
r = heatUp.get( BlockID + ":*" );
|
||||
r = heatUp.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
|
||||
return r != null;
|
||||
}
|
||||
|
||||
static public void cool(int BlockID, int Metadata, World w, int x, int y, int z)
|
||||
static public void cool(Block BlockID, int Metadata, World w, int x, int y, int z)
|
||||
{
|
||||
InWorldToolOperationResult r = coolDown.get( BlockID + ":" + Metadata );
|
||||
InWorldToolOperationResult r = coolDown.get( new Combo( BlockID, Metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
{
|
||||
r = coolDown.get( BlockID + ":*" );
|
||||
r = coolDown.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
|
||||
if ( r.BlockItem != null )
|
||||
{
|
||||
w.setBlock( x, y, z, r.BlockItem.itemID, r.BlockItem.getItemDamage(), 3 );
|
||||
w.setBlock( x, y, z, Block.getBlockFromItem( r.BlockItem.getItem() ), r.BlockItem.getItemDamage(), 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
w.setBlock( x, y, z, 0, 0, 3 );
|
||||
w.setBlock( x, y, z, Platform.air, 0, 3 );
|
||||
}
|
||||
|
||||
if ( r.Drops != null )
|
||||
@@ -89,13 +116,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
}
|
||||
}
|
||||
|
||||
static public boolean canCool(int BlockID, int Metadata)
|
||||
static public boolean canCool(Block BlockID, int Metadata)
|
||||
{
|
||||
InWorldToolOperationResult r = coolDown.get( BlockID + ":" + Metadata );
|
||||
InWorldToolOperationResult r = coolDown.get( new Combo( BlockID, Metadata ) );
|
||||
|
||||
if ( r == null )
|
||||
{
|
||||
r = coolDown.get( BlockID + ":*" );
|
||||
r = coolDown.get( new Combo( BlockID, OreDictionary.WILDCARD_VALUE ) );
|
||||
}
|
||||
|
||||
return r != null;
|
||||
@@ -106,23 +133,23 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
setfeature( EnumSet.of( AEFeature.EntropyManipulator, AEFeature.PoweredTools ) );
|
||||
maxStoredPower = Configuration.instance.manipulator_battery;
|
||||
|
||||
coolDown = new Hashtable<String, InWorldToolOperationResult>();
|
||||
coolDown.put( Block.stone.blockID + ":0", new InWorldToolOperationResult( new ItemStack( Block.cobblestone ) ) );
|
||||
coolDown.put( Block.stoneBrick.blockID + ":0", new InWorldToolOperationResult( new ItemStack( Block.stoneBrick, 1, 2 ) ) );
|
||||
coolDown.put( Block.lavaStill.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.obsidian ) ) );
|
||||
coolDown.put( Block.lavaMoving.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.obsidian ) ) );
|
||||
coolDown.put( Block.grass.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.dirt ) ) );
|
||||
coolDown = new Hashtable<Combo, InWorldToolOperationResult>();
|
||||
coolDown.put( new Combo( Blocks.stone, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.cobblestone ) ) );
|
||||
coolDown.put( new Combo( Blocks.stonebrick, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.stonebrick, 1, 2 ) ) );
|
||||
coolDown.put( new Combo( Blocks.lava, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.obsidian ) ) );
|
||||
coolDown.put( new Combo( Blocks.flowing_lava, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.obsidian ) ) );
|
||||
coolDown.put( new Combo( Blocks.grass, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.dirt ) ) );
|
||||
|
||||
List<ItemStack> snowBalls = new ArrayList();
|
||||
snowBalls.add( new ItemStack( Item.snowball ) );
|
||||
coolDown.put( Block.waterMoving.blockID + ":*", new InWorldToolOperationResult( null, snowBalls ) );
|
||||
coolDown.put( Block.waterStill.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.ice ) ) );
|
||||
snowBalls.add( new ItemStack( Items.snowball ) );
|
||||
coolDown.put( new Combo( Blocks.flowing_water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( null, snowBalls ) );
|
||||
coolDown.put( new Combo( Blocks.water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.ice ) ) );
|
||||
|
||||
heatUp = new Hashtable<String, InWorldToolOperationResult>();
|
||||
heatUp.put( Block.ice.blockID + ":0", new InWorldToolOperationResult( new ItemStack( Block.waterStill ) ) );
|
||||
heatUp.put( Block.waterMoving.blockID + ":*", new InWorldToolOperationResult() );
|
||||
heatUp.put( Block.waterStill.blockID + ":*", new InWorldToolOperationResult() );
|
||||
heatUp.put( Block.blockSnow.blockID + ":*", new InWorldToolOperationResult( new ItemStack( Block.waterStill ) ) );
|
||||
heatUp = new Hashtable<Combo, InWorldToolOperationResult>();
|
||||
heatUp.put( new Combo( Blocks.ice, 0 ), new InWorldToolOperationResult( new ItemStack( Blocks.water ) ) );
|
||||
heatUp.put( new Combo( Blocks.flowing_water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult() );
|
||||
heatUp.put( new Combo( Blocks.water, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult() );
|
||||
heatUp.put( new Combo( Blocks.snow, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.flowing_water ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,13 +173,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
return item;
|
||||
else
|
||||
{
|
||||
if ( target.typeOfHit == EnumMovingObjectType.TILE )
|
||||
if ( target.typeOfHit == MovingObjectType.BLOCK )
|
||||
{
|
||||
int x = target.blockX;
|
||||
int y = target.blockY;
|
||||
int z = target.blockZ;
|
||||
|
||||
if ( w.getBlockMaterial( x, y, z ) == Material.lava || w.getBlockMaterial( x, y, z ) == Material.water )
|
||||
if ( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
|
||||
{
|
||||
if ( w.canMineBlock( p, x, y, z ) )
|
||||
{
|
||||
@@ -173,7 +200,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
if ( !p.canPlayerEdit( x, y, z, side, item ) )
|
||||
return false;
|
||||
|
||||
int BlockID = w.getBlockId( x, y, z );
|
||||
Block BlockID = w.getBlock( x, y, z );
|
||||
int Metadata = w.getBlockMetadata( x, y, z );
|
||||
|
||||
if ( p.isSneaking() )
|
||||
@@ -207,7 +234,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
{
|
||||
if ( result.getItem() instanceof ItemBlock )
|
||||
{
|
||||
if ( ((ItemBlock) result.getItem()).getBlockID() == BlockID && result.getItem().getDamage( result ) == Metadata )
|
||||
if ( Block.getBlockFromItem( (ItemBlock) result.getItem() ) == BlockID && result.getItem().getDamage( result ) == Metadata )
|
||||
{
|
||||
canFurnaceable = false;
|
||||
}
|
||||
@@ -230,11 +257,11 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
|
||||
if ( or.BlockItem == null )
|
||||
{
|
||||
w.setBlock( x, y, z, 0, 0, 3 );
|
||||
w.setBlock( x, y, z, Platform.air, 0, 3 );
|
||||
}
|
||||
else
|
||||
{
|
||||
w.setBlock( x, y, z, or.BlockItem.itemID, or.BlockItem.getItemDamage(), 3 );
|
||||
w.setBlock( x, y, z, Block.getBlockFromItem( or.BlockItem.getItem() ), or.BlockItem.getItemDamage(), 3 );
|
||||
}
|
||||
|
||||
if ( or.Drops != null )
|
||||
@@ -258,7 +285,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||
{
|
||||
extractAEPower( item, 1600 );
|
||||
w.playSoundEffect( (double) x + 0.5D, (double) y + 0.5D, (double) z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F );
|
||||
w.setBlock( x, y, z, Block.fire.blockID );
|
||||
w.setBlock( x, y, z, Blocks.fire );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -12,9 +12,9 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import appeng.api.AEApi;
|
||||
@@ -131,9 +131,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
AxisAlignedBB bb = AxisAlignedBB
|
||||
.getAABBPool()
|
||||
.getAABB( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ), Math.min( vec3.zCoord, vec31.zCoord ),
|
||||
Math.max( vec3.xCoord, vec31.xCoord ), Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) )
|
||||
.expand( 16, 16, 16 );
|
||||
.getAABB( Math.min( vec3.xCoord, vec31.xCoord ), Math.min( vec3.yCoord, vec31.yCoord ),
|
||||
Math.min( vec3.zCoord, vec31.zCoord ), Math.max( vec3.xCoord, vec31.xCoord ),
|
||||
Math.max( vec3.yCoord, vec31.yCoord ), Math.max( vec3.zCoord, vec31.zCoord ) ).expand( 16, 16, 16 );
|
||||
|
||||
Entity entity = null;
|
||||
List list = w.getEntitiesWithinAABBExcludingEntity( p, bb );
|
||||
@@ -171,7 +171,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
Vec3 Srec = w.getWorldVec3Pool().getVecFromPool( d0, d1, d2 );
|
||||
MovingObjectPosition pos = w.rayTraceBlocks_do_do( vec3, vec31, true, false );
|
||||
MovingObjectPosition pos = w.rayTraceBlocks( vec3, vec31, true );
|
||||
if ( entity != null && pos != null && pos.hitVec.squareDistanceTo( Srec ) > Closeest )
|
||||
{
|
||||
pos = new MovingObjectPosition( entity );
|
||||
@@ -183,8 +183,8 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
|
||||
try
|
||||
{
|
||||
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, (new PacketMatterCannon( d0, d1, d2, (float) (f7 * d3), (float) (f6 * d3),
|
||||
(float) (f8 * d3), (byte) (pos == null ? 32 : pos.hitVec.squareDistanceTo( Srec ) + 1) )).getPacket() );
|
||||
CommonHelper.proxy.sendToAllNearExcept( null, d0, d1, d2, 128, w, new PacketMatterCannon( d0, d1, d2, (float) (f7 * d3),
|
||||
(float) (f6 * d3), (float) (f8 * d3), (byte) (pos == null ? 32 : pos.hitVec.squareDistanceTo( Srec ) + 1) ) );
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
@@ -197,7 +197,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
DamageSource dmgSrc = DamageSource.causePlayerDamage( p );
|
||||
dmgSrc.damageType = "masscannon";
|
||||
|
||||
if ( pos.typeOfHit == EnumMovingObjectType.ENTITY )
|
||||
if ( pos.typeOfHit == MovingObjectType.ENTITY )
|
||||
{
|
||||
int dmg = (int) Math.ceil( penitration / 20.0f );
|
||||
if ( pos.entityHit instanceof EntityLivingBase )
|
||||
@@ -221,29 +221,26 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
hasDestroyedSomething = true;
|
||||
}
|
||||
}
|
||||
else if ( pos.typeOfHit == EnumMovingObjectType.TILE )
|
||||
else if ( pos.typeOfHit == MovingObjectType.BLOCK )
|
||||
{
|
||||
if ( !Configuration.instance.isFeatureEnabled( AEFeature.MassCannonBlockDamage ) )
|
||||
penitration = 0;
|
||||
else
|
||||
{
|
||||
int bid = w.getBlockId( pos.blockX, pos.blockY, pos.blockZ );
|
||||
Block b = w.getBlock( pos.blockX, pos.blockY, pos.blockZ );
|
||||
// int meta = w.getBlockMetadata(
|
||||
// pos.blockX, pos.blockY, pos.blockZ );
|
||||
|
||||
if ( bid > 0 )
|
||||
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
|
||||
if ( hardness >= 0.0 )
|
||||
{
|
||||
Block b = Block.blocksList[bid];
|
||||
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
|
||||
if ( hardness >= 0.0 )
|
||||
if ( penitration > hardness )
|
||||
{
|
||||
if ( penitration > hardness )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
penitration -= hardness;
|
||||
penitration *= 0.60;
|
||||
w.destroyBlock( pos.blockX, pos.blockY, pos.blockZ, true );
|
||||
}
|
||||
hasDestroyedSomething = true;
|
||||
penitration -= hardness;
|
||||
penitration *= 0.60;
|
||||
w.func_147480_a( pos.blockX, pos.blockY, pos.blockZ, true );
|
||||
// w.destroyBlock( pos.blockX, pos.blockY, pos.blockZ, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,7 +252,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
else
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
p.sendChatToPlayer( PlayerMessages.AmmoDepleted.get() );
|
||||
p.addChatMessage( PlayerMessages.AmmoDepleted.get() );
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
@@ -166,7 +167,7 @@ public class AERootPoweredItem extends AEBaseItem implements IAEItemPowerStorage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(int id, CreativeTabs tab, List list)
|
||||
public void getSubItems(Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
super.getSubItems( id, tab, list );
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ThermalExpansion extends IC2 implements IEnergyContainerItem
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack is)
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, getMaxEnergyStored( is ) );
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.RF, getAEMaxPower( is ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.ItemAxe;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
@@ -22,8 +19,7 @@ public class ToolQuartzAxe extends ItemAxe implements IAEFeature
|
||||
}
|
||||
|
||||
public ToolQuartzAxe(AEFeature Type) {
|
||||
super( Configuration.instance.getItemID( ToolQuartzAxe.class, Type.name() ), EnumToolMaterial.IRON );
|
||||
MinecraftForge.setToolClass( this, "axe", EnumToolMaterial.IRON.getHarvestLevel() );
|
||||
super( ToolMaterial.IRON );
|
||||
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzAxe ), this, Type.name() );
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItemStack(ItemStack itemStack)
|
||||
public ItemStack getContainerItem(ItemStack itemStack)
|
||||
{
|
||||
itemStack.setItemDamage( itemStack.getItemDamage() + 1 );
|
||||
return itemStack;
|
||||
|
||||
@@ -2,10 +2,7 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.ItemHoe;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
@@ -22,8 +19,7 @@ public class ToolQuartzHoe extends ItemHoe implements IAEFeature
|
||||
}
|
||||
|
||||
public ToolQuartzHoe(AEFeature Type) {
|
||||
super( Configuration.instance.getItemID( ToolQuartzHoe.class, Type.name() ), EnumToolMaterial.IRON );
|
||||
MinecraftForge.setToolClass( this, "hoe", EnumToolMaterial.IRON.getHarvestLevel() );
|
||||
super( ToolMaterial.IRON );
|
||||
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzHoe ), this, Type.name() );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,7 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
@@ -22,8 +19,7 @@ public class ToolQuartzPickaxe extends ItemPickaxe implements IAEFeature
|
||||
}
|
||||
|
||||
public ToolQuartzPickaxe(AEFeature Type) {
|
||||
super( Configuration.instance.getItemID( ToolQuartzPickaxe.class, Type.name() ), EnumToolMaterial.IRON );
|
||||
MinecraftForge.setToolClass( this, "pickaxe", EnumToolMaterial.IRON.getHarvestLevel() );
|
||||
super( ToolMaterial.IRON );
|
||||
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzPickaxe ), this, Type.name() );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,7 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.ItemSpade;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
@@ -22,8 +19,7 @@ public class ToolQuartzSpade extends ItemSpade implements IAEFeature
|
||||
}
|
||||
|
||||
public ToolQuartzSpade(AEFeature Type) {
|
||||
super( Configuration.instance.getItemID( ToolQuartzSpade.class, Type.name() ), EnumToolMaterial.IRON );
|
||||
MinecraftForge.setToolClass( this, "shovel", EnumToolMaterial.IRON.getHarvestLevel() );
|
||||
super( ToolMaterial.IRON );
|
||||
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSpade ), this, Type.name() );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.EnumToolMaterial;
|
||||
import net.minecraft.item.ItemSword;
|
||||
import appeng.core.Configuration;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
@@ -21,7 +19,7 @@ public class ToolQuartzSword extends ItemSword implements IAEFeature
|
||||
}
|
||||
|
||||
public ToolQuartzSword(AEFeature Type) {
|
||||
super( Configuration.instance.getItemID( ToolQuartzSword.class, Type.name() ), EnumToolMaterial.IRON );
|
||||
super( ToolMaterial.IRON );
|
||||
feature = new AEFeatureHandler( EnumSet.of( Type, AEFeature.QuartzSword ), this, Type.name() );
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -26,24 +26,21 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
|
||||
@Override
|
||||
public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int id = world.getBlockId( x, y, z );
|
||||
if ( id > 0 && !player.isSneaking() )
|
||||
Block b = world.getBlock( x, y, z );
|
||||
if ( b != null && !player.isSneaking() )
|
||||
{
|
||||
Block b = Block.blocksList[id];
|
||||
if ( b != null )
|
||||
if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) )
|
||||
{
|
||||
if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) )
|
||||
{
|
||||
player.swingItem();
|
||||
return !world.isRemote;
|
||||
}
|
||||
player.swingItem();
|
||||
return !world.isRemote;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z)
|
||||
// public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z)
|
||||
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user