Most of the 1.8 Port.
This commit is contained in:
@@ -21,17 +21,15 @@ package appeng.parts.p2p;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
@@ -57,7 +55,7 @@ public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power> implements i
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getTypeTexture()
|
||||
public TextureAtlasSprite getTypeTexture()
|
||||
{
|
||||
return Blocks.diamond_block.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
|
||||
@@ -23,21 +23,13 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityChest;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.api.transport.IPipeConnection;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -47,22 +39,17 @@ import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.abstraction.IBC;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.tile.inventory.AppEngNullInventory;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
import appeng.transformer.annotations.Integration.Method;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.WrapperBCPipe;
|
||||
import appeng.util.inv.WrapperChainedInventory;
|
||||
import appeng.util.inv.WrapperMCISidedInventory;
|
||||
|
||||
|
||||
@Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BC" )
|
||||
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeConnection, ISidedInventory, IGridTickable
|
||||
// TODO: BUILD CRAFT INTEGRATION
|
||||
// @Interface( iface = "buildcraft.api.transport.IPipeConnection", iname = "BC" ) IPipeConnection
|
||||
public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements ISidedInventory, IGridTickable
|
||||
{
|
||||
|
||||
final LinkedList<IInventory> which = new LinkedList<IInventory>();
|
||||
@@ -132,7 +119,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
|
||||
if( this.proxy.isActive() )
|
||||
{
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( side.getFacing() ) );
|
||||
|
||||
if( this.which.contains( this ) )
|
||||
{
|
||||
@@ -141,6 +128,8 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
|
||||
this.which.add( this );
|
||||
|
||||
/*
|
||||
// TODO: BUILD CRAFT INTEGRATION
|
||||
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
|
||||
{
|
||||
IBC buildcraft = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
|
||||
@@ -150,7 +139,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
{
|
||||
try
|
||||
{
|
||||
output = new WrapperBCPipe( te, this.side.getOpposite() );
|
||||
output = new WrapperBCPipe( te, this.side.getFacing().getOpposite() );
|
||||
}
|
||||
catch( Throwable ignore )
|
||||
{
|
||||
@@ -158,7 +147,8 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* if ( AppEng.INSTANCE.isIntegrationEnabled( "TE" ) ) { ITE thermal = (ITE) AppEng.INSTANCE.getIntegration(
|
||||
* "TE" ); if ( thermal != null ) { if ( thermal.isPipe( te, side.getOpposite() ) ) { try { output = new
|
||||
@@ -173,7 +163,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
else if( te instanceof ISidedInventory )
|
||||
{
|
||||
output = new WrapperMCISidedInventory( (ISidedInventory) te, this.side.getOpposite() );
|
||||
output = new WrapperMCISidedInventory( (ISidedInventory) te, this.side.getFacing().getOpposite() );
|
||||
}
|
||||
else if( te instanceof IInventory )
|
||||
{
|
||||
@@ -252,13 +242,6 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getTypeTexture()
|
||||
{
|
||||
return Blocks.hopper.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
@@ -283,7 +266,8 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide( int var1 )
|
||||
public int[] getSlotsForFace(
|
||||
EnumFacing side )
|
||||
{
|
||||
int[] slots = new int[this.getSizeInventory()];
|
||||
for( int x = 0; x < this.getSizeInventory(); x++ )
|
||||
@@ -324,13 +308,13 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
public String getName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -354,12 +338,12 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
public void openInventory(EntityPlayer p)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
public void closeInventory(EntityPlayer p)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -370,13 +354,13 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int i, ItemStack itemstack, int j )
|
||||
public boolean canInsertItem( int i, ItemStack itemstack, EnumFacing j )
|
||||
{
|
||||
return this.getDestination().isItemValidForSlot( i, itemstack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int i, ItemStack itemstack, int j )
|
||||
public boolean canExtractItem( int i, ItemStack itemstack, EnumFacing j )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -386,10 +370,46 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
|
||||
return 2.0f;
|
||||
}
|
||||
|
||||
@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()
|
||||
{
|
||||
// probobly not...
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChatComponent getDisplayName()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO: BUILD CRAFT INTEGRATION
|
||||
@Override
|
||||
@Method( iname = "BC" )
|
||||
public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
|
||||
public ConnectOverride overridePipeConnection( PipeType type, AEPartLocation with )
|
||||
{
|
||||
return this.side == with && type == PipeType.ITEM ? ConnectOverride.CONNECT : ConnectOverride.DEFAULT;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -19,20 +19,14 @@
|
||||
package appeng.parts.p2p;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
@@ -92,9 +86,9 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
}
|
||||
|
||||
TileEntity te = this.getTile();
|
||||
World w = te.getWorldObj();
|
||||
World w = te.getWorld();
|
||||
|
||||
int newLevel = w.getBlockLightValue( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
|
||||
int newLevel = w.getLight( te.getPos().offset( side.getFacing() ) );
|
||||
|
||||
if( this.lastValue != newLevel && this.proxy.isActive() )
|
||||
{
|
||||
@@ -150,19 +144,12 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
|
||||
if( this.opacity < 0 )
|
||||
{
|
||||
TileEntity te = this.getTile();
|
||||
this.opacity = 255 - te.getWorldObj().getBlockLightOpacity( te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
|
||||
this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( side.getFacing() ) );
|
||||
}
|
||||
|
||||
return (int) ( emit * ( this.opacity / 255.0f ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getTypeTexture()
|
||||
{
|
||||
return Blocks.quartz_block.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( NBTTagCompound tag )
|
||||
{
|
||||
|
||||
@@ -24,19 +24,13 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.me.GridAccessException;
|
||||
|
||||
|
||||
@@ -59,13 +53,6 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
return 2.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getTypeTexture()
|
||||
{
|
||||
return Blocks.lapis_block.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTunnelNetworkChange()
|
||||
{
|
||||
@@ -87,7 +74,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill( ForgeDirection from, FluidStack resource, boolean doFill )
|
||||
public int fill( EnumFacing from, FluidStack resource, boolean doFill )
|
||||
{
|
||||
Stack<PartP2PLiquids> stack = this.getDepth();
|
||||
|
||||
@@ -111,7 +98,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
IFluidHandler tank = l.getTarget();
|
||||
if( tank != null )
|
||||
{
|
||||
l.tmpUsed = tank.fill( l.side.getOpposite(), resource.copy(), false );
|
||||
l.tmpUsed = tank.fill( l.side.getFacing().getOpposite(), resource.copy(), false );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -166,7 +153,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
IFluidHandler tank = l.getTarget();
|
||||
if( tank != null )
|
||||
{
|
||||
l.tmpUsed = tank.fill( l.side.getOpposite(), insert.copy(), true );
|
||||
l.tmpUsed = tank.fill( l.side.getFacing().getOpposite(), insert.copy(), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -208,7 +195,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
IFluidHandler handler = l.getTarget();
|
||||
if( handler != null )
|
||||
{
|
||||
if( handler.canFill( l.side.getOpposite(), input ) )
|
||||
if( handler.canFill( l.side.getFacing().getOpposite(), input ) )
|
||||
{
|
||||
outs.add( l );
|
||||
}
|
||||
@@ -235,7 +222,7 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
return this.cachedTank;
|
||||
}
|
||||
|
||||
TileEntity te = this.tile.getWorldObj().getTileEntity( this.tile.xCoord + this.side.offsetX, this.tile.yCoord + this.side.offsetY, this.tile.zCoord + this.side.offsetZ );
|
||||
TileEntity te = this.tile.getWorld().getTileEntity( this.tile.getPos().offset( side.getFacing() ) );
|
||||
if( te instanceof IFluidHandler )
|
||||
{
|
||||
return this.cachedTank = (IFluidHandler) te;
|
||||
@@ -245,33 +232,33 @@ public class PartP2PLiquids extends PartP2PTunnel<PartP2PLiquids> implements IFl
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain( ForgeDirection from, FluidStack resource, boolean doDrain )
|
||||
public FluidStack drain( EnumFacing from, FluidStack resource, boolean doDrain )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain( ForgeDirection from, int maxDrain, boolean doDrain )
|
||||
public FluidStack drain( EnumFacing from, int maxDrain, boolean doDrain )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill( ForgeDirection from, Fluid fluid )
|
||||
public boolean canFill( EnumFacing from, Fluid fluid )
|
||||
{
|
||||
return !this.output && from == this.side && !this.getOutputs( fluid ).isEmpty();
|
||||
return !this.output && from == this.side.getFacing() && !this.getOutputs( fluid ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain( ForgeDirection from, Fluid fluid )
|
||||
public boolean canDrain( EnumFacing from, Fluid fluid )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo( ForgeDirection from )
|
||||
public FluidTankInfo[] getTankInfo( EnumFacing from )
|
||||
{
|
||||
if( from == this.side )
|
||||
if( from == this.side.getFacing() )
|
||||
{
|
||||
return this.getTank();
|
||||
}
|
||||
|
||||
@@ -20,16 +20,14 @@ package appeng.parts.p2p;
|
||||
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import li.cil.oc.api.API;
|
||||
import li.cil.oc.api.Items;
|
||||
import li.cil.oc.api.Network;
|
||||
@@ -38,11 +36,11 @@ import li.cil.oc.api.network.Message;
|
||||
import li.cil.oc.api.network.Node;
|
||||
import li.cil.oc.api.network.SidedEnvironment;
|
||||
import li.cil.oc.api.network.Visibility;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.hooks.TickHandler;
|
||||
@@ -85,7 +83,7 @@ public final class PartP2POpenComputers extends PartP2PTunnel<PartP2POpenCompute
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTypeTexture()
|
||||
public TextureAtlasSprite getTypeTexture()
|
||||
{
|
||||
return Items.get( "adapter" ).block().getBlockTextureFromSide( 2 );
|
||||
}
|
||||
@@ -149,7 +147,7 @@ public final class PartP2POpenComputers extends PartP2PTunnel<PartP2POpenCompute
|
||||
{
|
||||
if ( this.node() != null ) // Client side doesn't have nodes.
|
||||
{
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.updateCallback );
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.updateCallback );
|
||||
}
|
||||
|
||||
return TickRateModulation.SLEEP;
|
||||
|
||||
@@ -21,18 +21,15 @@ package appeng.parts.p2p;
|
||||
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.util.ForgeDirection;
|
||||
import appeng.integration.modules.helpers.NullRFHandler;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.transformer.annotations.Integration.Interface;
|
||||
@@ -58,7 +55,7 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getTypeTexture()
|
||||
public TextureAtlasSprite getTypeTexture()
|
||||
{
|
||||
return Blocks.iron_block.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
@@ -169,7 +166,7 @@ public final class PartP2PRFPower extends PartP2PTunnel<PartP2PRFPower> implemen
|
||||
if( !this.cachedTarget )
|
||||
{
|
||||
TileEntity self = this.getTile();
|
||||
TileEntity te = self.getWorldObj().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
|
||||
TileEntity te = self.getWorld().getTileEntity( self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
|
||||
this.outputTarget = te instanceof IEnergyReceiver ? (IEnergyReceiver) te : null;
|
||||
this.cachedTarget = true;
|
||||
}
|
||||
|
||||
@@ -21,15 +21,12 @@ package appeng.parts.p2p;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRedstoneWire;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
@@ -89,21 +86,13 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
|
||||
public void notifyNeighbors()
|
||||
{
|
||||
World worldObj = this.tile.getWorldObj();
|
||||
World worldObj = this.tile.getWorld();
|
||||
|
||||
int xCoord = this.tile.xCoord;
|
||||
int yCoord = this.tile.yCoord;
|
||||
int zCoord = this.tile.zCoord;
|
||||
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( worldObj,tile.getPos());
|
||||
|
||||
// and this cause sometimes it can go thought walls.
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord - 1, yCoord, zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord - 1, zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord - 1 );
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord, zCoord + 1 );
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord, yCoord + 1, zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( worldObj, xCoord + 1, yCoord, zCoord );
|
||||
for ( EnumFacing face : EnumFacing.VALUES )
|
||||
Platform.notifyBlocksOfNeighbors( worldObj,tile.getPos().offset( face ) );
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
@@ -118,13 +107,6 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
this.setNetworkReady();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getTypeTexture()
|
||||
{
|
||||
return Blocks.redstone_block.getBlockTextureFromSide( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( NBTTagCompound tag )
|
||||
{
|
||||
@@ -155,20 +137,20 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
|
||||
{
|
||||
if( !this.output )
|
||||
{
|
||||
int x = this.tile.xCoord + this.side.offsetX;
|
||||
int y = this.tile.yCoord + this.side.offsetY;
|
||||
int z = this.tile.zCoord + this.side.offsetZ;
|
||||
BlockPos target = tile.getPos().offset( side.getFacing() );
|
||||
|
||||
Block b = this.tile.getWorldObj().getBlock( x, y, z );
|
||||
IBlockState state = this.tile.getWorld().getBlockState( target );
|
||||
Block b = state.getBlock();
|
||||
if( b != null && !this.output )
|
||||
{
|
||||
int srcSide = this.side.ordinal();
|
||||
EnumFacing srcSide = this.side.getFacing();
|
||||
if( b instanceof BlockRedstoneWire )
|
||||
{
|
||||
srcSide = 1;
|
||||
srcSide = EnumFacing.UP;
|
||||
}
|
||||
this.power = b.isProvidingStrongPower( this.tile.getWorldObj(), x, y, z, srcSide );
|
||||
this.power = Math.max( this.power, b.isProvidingWeakPower( this.tile.getWorldObj(), x, y, z, srcSide ) );
|
||||
|
||||
this.power = b.isProvidingStrongPower( this.tile.getWorld(), target,state, srcSide );
|
||||
this.power = Math.max( this.power, b.isProvidingWeakPower( this.tile.getWorld(), target, state, srcSide ) );
|
||||
this.sendToOutput( this.power );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -22,21 +22,16 @@ package appeng.parts.p2p;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
@@ -50,7 +45,10 @@ import appeng.api.parts.IPartCollisionHelper;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.render.IRenderHelper;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.IAESprite;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.P2PCache;
|
||||
@@ -58,6 +56,8 @@ import appeng.me.cache.helpers.TunnelCollection;
|
||||
import appeng.parts.PartBasicState;
|
||||
import appeng.util.Platform;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
|
||||
public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
|
||||
{
|
||||
@@ -123,62 +123,62 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderInventory( IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
rh.setTexture( this.getTypeTexture() );
|
||||
rh.setTexture( this.getTypeTexture(renderer) );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), this.is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( is ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param renderer
|
||||
* @return If enabled it returns the icon of an AE quartz block, else vanilla quartz block icon
|
||||
*/
|
||||
protected IIcon getTypeTexture()
|
||||
protected IAESprite getTypeTexture(IRenderHelper renderer )
|
||||
{
|
||||
final Optional<Block> maybeBlock = AEApi.instance().definitions().blocks().quartz().maybeBlock();
|
||||
if( maybeBlock.isPresent() )
|
||||
{
|
||||
return maybeBlock.get().getIcon( 0, 0 );
|
||||
return renderer.getIcon( new ItemStack(maybeBlock.get()) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return Blocks.quartz_block.getIcon( 0, 0 );
|
||||
return renderer.getIcon( new ItemStack(Blocks.quartz_block) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||
public void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer )
|
||||
{
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( this.getTypeTexture() );
|
||||
rh.setTexture( this.getTypeTexture(renderer) );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), this.is.getIconIndex(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.BlockP2PTunnel2.getIcon(), renderer.getIcon( is ), CableBusTextures.PartTunnelSides.getIcon(), CableBusTextures.PartTunnelSides.getIcon() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setBounds( 3, 3, 13, 13, 13, 14 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.BlockP2PTunnel3.getIcon() );
|
||||
|
||||
rh.setBounds( 6, 5, 12, 10, 11, 13 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setBounds( 5, 6, 12, 11, 10, 13 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights( pos, rh, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,7 +251,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
if( testPart instanceof PartP2PTunnel )
|
||||
{
|
||||
this.getHost().removePart( this.side, true );
|
||||
ForgeDirection dir = this.getHost().addPart( newType, this.side, player );
|
||||
AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
|
||||
IPart newBus = this.getHost().getPart( dir );
|
||||
|
||||
if( newBus instanceof PartP2PTunnel )
|
||||
@@ -294,27 +294,31 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case RF_POWER:
|
||||
for( ItemStack stack : parts.p2PTunnelRF().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
break;
|
||||
|
||||
*/
|
||||
|
||||
case FLUID:
|
||||
for( ItemStack stack : parts.p2PTunnelLiquids().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/*
|
||||
case IC2_POWER:
|
||||
for( ItemStack stack : parts.p2PTunnelEU().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
break;
|
||||
|
||||
*/
|
||||
|
||||
case ITEM:
|
||||
for( ItemStack stack : parts.p2PTunnelItems().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
@@ -335,14 +339,16 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
newType = stack;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/*
|
||||
case COMPUTER_MESSAGE:
|
||||
for( ItemStack stack : parts.p2PTunnelOpenComputers().maybeStack( 1 ).asSet() )
|
||||
{
|
||||
newType = stack;
|
||||
}
|
||||
break;
|
||||
|
||||
*/
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -353,7 +359,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
long myFreq = this.freq;
|
||||
|
||||
this.getHost().removePart( this.side, false );
|
||||
ForgeDirection dir = this.getHost().addPart( newType, this.side, player );
|
||||
AEPartLocation dir = this.getHost().addPart( newType, this.side, player );
|
||||
IPart newBus = this.getHost().getPart( dir );
|
||||
|
||||
if( newBus instanceof PartP2PTunnel )
|
||||
@@ -373,7 +379,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
}
|
||||
|
||||
Platform.notifyBlocksOfNeighbors( this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( this.tile.getWorld(), this.tile.getPos() );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -434,9 +440,9 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public IIcon getBreakingTexture()
|
||||
public TextureAtlasSprite getBreakingTexture( IRenderHelper renderer )
|
||||
{
|
||||
return CableBusTextures.BlockP2PTunnel2.getIcon();
|
||||
return CableBusTextures.BlockP2PTunnel2.getIcon().getAtlas();
|
||||
}
|
||||
|
||||
protected void queueTunnelDrain( PowerUnits unit, double f )
|
||||
|
||||
@@ -27,8 +27,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.FailedConnection;
|
||||
import appeng.api.networking.GridFlags;
|
||||
@@ -38,6 +36,7 @@ import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.hooks.TickHandler;
|
||||
@@ -92,7 +91,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType( ForgeDirection dir )
|
||||
public AECableType getCableConnectionType( AEPartLocation dir )
|
||||
{
|
||||
return AECableType.DENSE;
|
||||
}
|
||||
@@ -112,10 +111,10 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile )
|
||||
public void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile )
|
||||
{
|
||||
super.setPartHostInfo( side, host, tile );
|
||||
this.outerProxy.setValidSides( EnumSet.of( side ) );
|
||||
this.outerProxy.setValidSides( EnumSet.of( side.getFacing() ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,7 +124,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side )
|
||||
public void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side )
|
||||
{
|
||||
super.onPlacement( player, held, side );
|
||||
this.outerProxy.setOwner( player );
|
||||
@@ -148,19 +147,19 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
if( !this.proxy.getEnergy().isNetworkPowered() )
|
||||
{
|
||||
this.connection.markDestroy();
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.connection );
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( this.proxy.isActive() )
|
||||
{
|
||||
this.connection.markCreate();
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.connection );
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.connection.markDestroy();
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorldObj(), this.connection );
|
||||
TickHandler.INSTANCE.addCallable( this.tile.getWorld(), this.connection );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +232,9 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
|
||||
{
|
||||
final TileEntity start = this.getTile();
|
||||
final TileEntity end = me.getTile();
|
||||
AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]", start.xCoord, start.yCoord, start.zCoord, end.xCoord, end.yCoord, end.zCoord );
|
||||
AELog.warning( "Failed to establish a ME P2P Tunnel between the tunnels at [x=%d, y=%d, z=%d] and [x=%d, y=%d, z=%d]",
|
||||
start.getPos().getX(), start.getPos().getY(), start.getPos().getZ(),
|
||||
end.getPos().getX(), end.getPos().getY(), end.getPos().getZ() );
|
||||
// :(
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user