Most of the 1.8 Port.
This commit is contained in:
@@ -23,12 +23,10 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -51,9 +49,4 @@ public class BlockChunkloader extends AEBaseTileBlock implements LoadingCallback
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons( IIconRegister iconRegistry )
|
||||
{
|
||||
this.registerNoIcons();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ package appeng.debug;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
@@ -39,11 +39,18 @@ public class BlockCubeGenerator extends AEBaseTileBlock
|
||||
this.setTileEntity( TileCubeGenerator.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onActivated(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
EntityPlayer player,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
TileCubeGenerator tcg = this.getTileEntity( w, x, y, z );
|
||||
TileCubeGenerator tcg = this.getTileEntity( w, pos );
|
||||
if( tcg != null )
|
||||
{
|
||||
tcg.click( player );
|
||||
@@ -51,10 +58,5 @@ public class BlockCubeGenerator extends AEBaseTileBlock
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons( IIconRegister iconRegistry )
|
||||
{
|
||||
this.registerNoIcons();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.debug;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
@@ -37,10 +35,5 @@ public class BlockItemGen extends AEBaseTileBlock
|
||||
this.setTileEntity( TileItemGen.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons( IIconRegister iconRegistry )
|
||||
{
|
||||
this.registerNoIcons();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,10 +22,10 @@ package appeng.debug;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
|
||||
@@ -41,16 +41,18 @@ public class BlockPhantomNode extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onActivated(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
EntityPlayer player,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
TilePhantomNode tpn = this.getTileEntity( w, x, y, z );
|
||||
TilePhantomNode tpn = this.getTileEntity( w, pos );
|
||||
tpn.triggerCrashMode();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons( IIconRegister iconRegistry )
|
||||
{
|
||||
this.registerNoIcons();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,14 +23,13 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -39,7 +38,7 @@ import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class TileChunkLoader extends AEBaseTile
|
||||
public class TileChunkLoader extends AEBaseTile implements IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
boolean requestTicket = true;
|
||||
@@ -79,7 +78,7 @@ public class TileChunkLoader extends AEBaseTile
|
||||
}
|
||||
|
||||
AELog.info( "New Ticket " + this.ct.toString() );
|
||||
ForgeChunkManager.forceChunk( this.ct, new ChunkCoordIntPair( this.xCoord >> 4, this.zCoord >> 4 ) );
|
||||
ForgeChunkManager.forceChunk( this.ct, new ChunkCoordIntPair( this.pos.getX() >> 4, this.pos.getZ() >> 4 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,9 +22,10 @@ package appeng.debug;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.TileEvent;
|
||||
@@ -32,7 +33,7 @@ import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class TileCubeGenerator extends AEBaseTile
|
||||
public class TileCubeGenerator extends AEBaseTile implements IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
int size = 3;
|
||||
@@ -64,10 +65,10 @@ public class TileCubeGenerator extends AEBaseTile
|
||||
|
||||
void spawn()
|
||||
{
|
||||
this.worldObj.setBlock( this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK, 0, 3 );
|
||||
this.worldObj.setBlockToAir( pos );
|
||||
|
||||
Item i = this.is.getItem();
|
||||
int side = ForgeDirection.UP.ordinal();
|
||||
EnumFacing side = EnumFacing.UP;
|
||||
|
||||
int half = (int) Math.floor( this.size / 2 );
|
||||
|
||||
@@ -77,7 +78,8 @@ public class TileCubeGenerator extends AEBaseTile
|
||||
{
|
||||
for( int z = -half; z < half; z++ )
|
||||
{
|
||||
i.onItemUse( this.is.copy(), this.who, this.worldObj, x + this.xCoord, y + this.yCoord - 1, z + this.zCoord, side, 0.5f, 0.0f, 0.5f );
|
||||
BlockPos p = pos.add( x, y-1, z );
|
||||
i.onItemUse( this.is.copy(), this.who, this.worldObj, p, side, 0.5f, 0.0f, 0.5f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
@@ -104,13 +104,13 @@ public class TileItemGen extends AEBaseTile implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -128,20 +128,55 @@ public class TileItemGen extends AEBaseTile implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
public void openInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
public void closeInventory(
|
||||
EntityPlayer player )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int i, ItemStack itemstack )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent getDisplayName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getField(
|
||||
int id )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setField(
|
||||
int id,
|
||||
int value )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFieldCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,9 @@ package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TilePhantomNode extends AENetworkTile
|
||||
boolean crashMode = false;
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( ForgeDirection dir )
|
||||
public IGridNode getGridNode( AEPartLocation dir )
|
||||
{
|
||||
if( !this.crashMode )
|
||||
{
|
||||
@@ -59,7 +59,7 @@ public class TilePhantomNode extends AENetworkTile
|
||||
if( this.proxy != null )
|
||||
{
|
||||
this.crashMode = true;
|
||||
this.proxy.setValidSides( EnumSet.allOf( ForgeDirection.class ) );
|
||||
this.proxy.setValidSides( EnumSet.allOf( EnumFacing.class ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -41,6 +41,7 @@ import appeng.api.networking.pathing.IPathingGrid;
|
||||
import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -60,7 +61,15 @@ public class ToolDebugCard extends AEBaseItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -83,11 +92,11 @@ public class ToolDebugCard extends AEBaseItem
|
||||
}
|
||||
else
|
||||
{
|
||||
TileEntity te = world.getTileEntity( x, y, z );
|
||||
TileEntity te = world.getTileEntity( pos );
|
||||
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
GridNode node = (GridNode) ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
|
||||
GridNode node = (GridNode) ( (IGridHost) te ).getGridNode( AEPartLocation.fromFacing( side ) );
|
||||
if( node != null )
|
||||
{
|
||||
Grid g = node.getInternalGrid();
|
||||
@@ -173,7 +182,7 @@ public class ToolDebugCard extends AEBaseItem
|
||||
|
||||
if( te instanceof IPartHost )
|
||||
{
|
||||
IPart center = ( (IPartHost) te ).getPart( ForgeDirection.UNKNOWN );
|
||||
IPart center = ( (IPartHost) te ).getPart( AEPartLocation.INTERNAL );
|
||||
( (IPartHost) te ).markForUpdate();
|
||||
if( center != null )
|
||||
{
|
||||
@@ -181,8 +190,8 @@ public class ToolDebugCard extends AEBaseItem
|
||||
this.outputMsg( player, "Node Channels: " + n.usedChannels() );
|
||||
for( IGridConnection gc : n.getConnections() )
|
||||
{
|
||||
ForgeDirection fd = gc.getDirection( n );
|
||||
if( fd != ForgeDirection.UNKNOWN )
|
||||
AEPartLocation fd = gc.getDirection( n );
|
||||
if( fd != AEPartLocation.INTERNAL )
|
||||
{
|
||||
this.outputMsg( player, fd.toString() + ": " + gc.getUsedChannels() );
|
||||
}
|
||||
@@ -197,7 +206,7 @@ public class ToolDebugCard extends AEBaseItem
|
||||
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
IGridNode node = ( (IGridHost) te ).getGridNode( ForgeDirection.getOrientation( side ) );
|
||||
IGridNode node = ( (IGridHost) te ).getGridNode( AEPartLocation.fromFacing( side ) );
|
||||
if( node != null && node.getGrid() != null )
|
||||
{
|
||||
IEnergyGrid eg = node.getGrid().getCache( IEnergyGrid.class );
|
||||
|
||||
@@ -19,19 +19,16 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.client.texture.MissingIcon;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -47,49 +44,49 @@ public class ToolEraser extends AEBaseItem
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerIcons( IIconRegister par1IconRegister )
|
||||
{
|
||||
this.itemIcon = new MissingIcon( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Block blk = world.getBlock( x, y, z );
|
||||
int meta = world.getBlockMetadata( x, y, z );
|
||||
IBlockState state = world.getBlockState( pos );
|
||||
|
||||
int blocks = 0;
|
||||
List<WorldCoord> next = new LinkedList<WorldCoord>();
|
||||
next.add( new WorldCoord( x, y, z ) );
|
||||
List<BlockPos> next = new LinkedList<BlockPos>();
|
||||
next.add( pos );
|
||||
|
||||
while( blocks < BLOCK_ERASE_LIMIT && !next.isEmpty() )
|
||||
{
|
||||
List<WorldCoord> c = next;
|
||||
next = new LinkedList<WorldCoord>();
|
||||
List<BlockPos> c = next;
|
||||
next = new LinkedList<BlockPos>();
|
||||
|
||||
for( WorldCoord wc : c )
|
||||
for( BlockPos wc : c )
|
||||
{
|
||||
Block c_blk = world.getBlock( wc.x, wc.y, wc.z );
|
||||
int c_meta = world.getBlockMetadata( wc.x, wc.y, wc.z );
|
||||
IBlockState c_state = world.getBlockState( wc );
|
||||
|
||||
if( c_blk == blk && c_meta == meta )
|
||||
if( state == c_state )
|
||||
{
|
||||
blocks++;
|
||||
world.setBlock( wc.x, wc.y, wc.z, Platform.AIR_BLOCK );
|
||||
world.setBlockToAir( wc );
|
||||
|
||||
this.wrappedAdd( world, wc.x + 1, wc.y, wc.z, next );
|
||||
this.wrappedAdd( world, wc.x - 1, wc.y, wc.z, next );
|
||||
this.wrappedAdd( world, wc.x, wc.y + 1, wc.z, next );
|
||||
this.wrappedAdd( world, wc.x, wc.y - 1, wc.z, next );
|
||||
this.wrappedAdd( world, wc.x, wc.y, wc.z + 1, next );
|
||||
this.wrappedAdd( world, wc.x, wc.y, wc.z - 1, next );
|
||||
next.add( wc.add( 1, 0, 0 ) );
|
||||
next.add( wc.add( -1, 0, 0 ) );
|
||||
next.add( wc.add( 0, 1, 0 ) );
|
||||
next.add( wc.add( 0, -1, 0 ) );
|
||||
next.add( wc.add( 0, 0, 1 ) );
|
||||
next.add( wc.add( 0, 0, -1 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,9 +95,4 @@ public class ToolEraser extends AEBaseItem
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void wrappedAdd( World world, int i, int y, int z, Collection<WorldCoord> next )
|
||||
{
|
||||
next.add( new WorldCoord( i, y, z ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,13 +21,12 @@ package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.client.texture.MissingIcon;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
@@ -43,13 +42,15 @@ public class ToolMeteoritePlacer extends AEBaseItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons( IIconRegister par1IconRegister )
|
||||
{
|
||||
this.itemIcon = new MissingIcon( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -57,7 +58,7 @@ public class ToolMeteoritePlacer extends AEBaseItem
|
||||
}
|
||||
|
||||
MeteoritePlacer mp = new MeteoritePlacer();
|
||||
boolean worked = mp.spawnMeteorite( new StandardWorld( world ), x, y, z );
|
||||
boolean worked = mp.spawnMeteorite( new StandardWorld( world ), pos.getX(),pos.getY(),pos.getZ() );
|
||||
|
||||
if( !worked )
|
||||
{
|
||||
|
||||
@@ -22,20 +22,22 @@ package appeng.debug;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
@@ -48,25 +50,37 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
{
|
||||
this.setFeature( EnumSet.of( AEFeature.UnsupportedDeveloperTools, AEFeature.Creative ) );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUseFirst( ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ )
|
||||
public boolean onItemUseFirst(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
BlockPos pos,
|
||||
EnumFacing side,
|
||||
float hitX,
|
||||
float hitY,
|
||||
float hitZ )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
if( world.getTileEntity( x, y, z ) instanceof IGridHost )
|
||||
if( world.getTileEntity( pos ) instanceof IGridHost )
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger( "x", x );
|
||||
tag.setInteger( "y", y );
|
||||
tag.setInteger( "z", z );
|
||||
tag.setInteger( "side", side );
|
||||
tag.setInteger( "dimid", world.provider.dimensionId );
|
||||
tag.setInteger( "side", side.ordinal() );
|
||||
tag.setInteger( "dimid", world.provider.getDimensionId() );
|
||||
stack.setTagCompound( tag );
|
||||
}
|
||||
else
|
||||
@@ -86,13 +100,13 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
int dimid = ish.getInteger( "dimid" );
|
||||
World src_w = DimensionManager.getWorld( dimid );
|
||||
|
||||
TileEntity te = src_w.getTileEntity( src_x, src_y, src_z );
|
||||
TileEntity te = src_w.getTileEntity( new BlockPos( src_x, src_y, src_z ) );
|
||||
if( te instanceof IGridHost )
|
||||
{
|
||||
IGridHost gh = (IGridHost) te;
|
||||
ForgeDirection sideOff = ForgeDirection.getOrientation( src_side );
|
||||
ForgeDirection currentSideOff = ForgeDirection.getOrientation( side );
|
||||
IGridNode n = gh.getGridNode( sideOff );
|
||||
EnumFacing sideOff = EnumFacing.VALUES[src_side];
|
||||
EnumFacing currentSideOff = side;
|
||||
IGridNode n = gh.getGridNode( AEPartLocation.fromFacing( sideOff ) );
|
||||
if( n != null )
|
||||
{
|
||||
IGrid g = n.getGrid();
|
||||
@@ -104,9 +118,9 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
DimensionalCoord min = sc.getMin();
|
||||
DimensionalCoord max = sc.getMax();
|
||||
|
||||
x += currentSideOff.offsetX;
|
||||
y += currentSideOff.offsetY;
|
||||
z += currentSideOff.offsetZ;
|
||||
x += currentSideOff.getFrontOffsetX();
|
||||
y += currentSideOff.getFrontOffsetY();
|
||||
z += currentSideOff.getFrontOffsetZ();
|
||||
|
||||
int min_x = min.x;
|
||||
int min_y = min.y;
|
||||
@@ -126,20 +140,22 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
{
|
||||
for( int k = 1; k < scale_z; k++ )
|
||||
{
|
||||
Block blk = src_w.getBlock( min_x + i, min_y + j, min_z + k );
|
||||
int meta = src_w.getBlockMetadata( min_x + i, min_y + j, min_z + k );
|
||||
world.setBlock( i + rel_x, j + rel_y, k + rel_z, blk, meta, 4 );
|
||||
|
||||
if( blk != null && blk.hasTileEntity( meta ) )
|
||||
BlockPos p = new BlockPos( min_x + i, min_y + j, min_z + k );
|
||||
BlockPos d = new BlockPos( i + rel_x, j + rel_y, k + rel_z );
|
||||
IBlockState state = src_w.getBlockState( p );
|
||||
Block blk = state.getBlock();
|
||||
|
||||
world.setBlockState( d, state );
|
||||
if( blk != null && blk.hasTileEntity( state ) )
|
||||
{
|
||||
TileEntity ote = src_w.getTileEntity( min_x + i, min_y + j, min_z + k );
|
||||
TileEntity nte = blk.createTileEntity( world, meta );
|
||||
TileEntity ote = src_w.getTileEntity( p );
|
||||
TileEntity nte = blk.createTileEntity( world, state );
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
ote.writeToNBT( data );
|
||||
nte.readFromNBT( (NBTTagCompound) data.copy() );
|
||||
world.setTileEntity( i + rel_x, j + rel_y, k + rel_z, nte );
|
||||
world.setTileEntity( d, nte );
|
||||
}
|
||||
world.markBlockForUpdate( i + rel_x, j + rel_y, k + rel_z );
|
||||
world.markBlockForUpdate( d );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user