ME Tunnel + Network Tool

This commit is contained in:
AlgorithmX2
2014-01-23 10:28:12 -06:00
parent 1b77755dd6
commit dfbc8a6c79
46 changed files with 929 additions and 128 deletions
+100
View File
@@ -0,0 +1,100 @@
package appeng.items.tools;
import java.util.EnumSet;
import net.minecraft.block.Block;
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 appeng.api.implementations.IAEWrench;
import appeng.api.networking.IGridHost;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.helpers.IGuiItem;
import appeng.helpers.NetworkToolInv;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.Optional.Interface;
@Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraftAPI|core")
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, IToolWrench
{
public ToolNetworkTool() {
super( ToolNetworkTool.class, null );
setfeature( EnumSet.of( AEFeature.NetworkTool ) );
}
@Override
public Object getGuiObject(ItemStack is, World world, int x, int y, int z)
{
TileEntity te = world.getBlockTileEntity( x, y, z );
return new NetworkToolInv( 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 )
{
Block b = Block.blocksList[id];
TileEntity te = world.getBlockTileEntity( x, y, z );
if ( b != null && !(te instanceof IGridHost) )
{
if ( b.rotateBlock( world, x, y, z, ForgeDirection.getOrientation( side ) ) )
{
player.swingItem();
return !world.isRemote;
}
}
}
return false;
}
@Override
public boolean onItemUse(ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float hitx, float hity, float hitz)
{
if ( Platform.isClient() )
return false;
if ( !p.isSneaking() )
{
TileEntity te = w.getBlockTileEntity( x, y, z );
if ( te instanceof IGridHost )
Platform.openGUI( p, te, ForgeDirection.getOrientation( side ), GuiBridge.GUI_NETWORK_STATUS );
else
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_NETWORK_TOOL );
}
return false;
}
@Override
public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z)
{
return true;
}
@Override
public boolean canWrench(ItemStack is, EntityPlayer player, int x, int y, int z)
{
return true;
}
@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();
}
}
-26
View File
@@ -1,26 +0,0 @@
package appeng.items.tools.powered;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import appeng.core.features.AEFeature;
import appeng.helpers.IGuiItem;
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
public class ToolNetworkTool extends AEBasePoweredItem implements IGuiItem
{
public ToolNetworkTool() {
super( ToolNetworkTool.class, null );
setfeature( EnumSet.of( AEFeature.NetworkTool, AEFeature.PoweredTools ) );
maxStoredPower = 100000;
}
@Override
public Object getGuiObject(ItemStack is)
{
// TODO Auto-generated method stub
return null;
}
}
+1 -1
View File
@@ -147,7 +147,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
}
@Override
public Object getGuiObject(ItemStack is)
public Object getGuiObject(ItemStack is, World w, int x, int y, int z)
{
return new CellItemViewer( is );
}
+3 -2
View File
@@ -11,7 +11,9 @@ import appeng.api.implementations.IAEWrench;
import appeng.core.features.AEFeature;
import appeng.items.AEBaseItem;
import buildcraft.api.tools.IToolWrench;
import cpw.mods.fml.common.Optional.Interface;
@Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraftAPI|core")
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWrench
{
@@ -22,8 +24,7 @@ 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)
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 )