1.15 port

This commit is contained in:
yueh
2020-05-18 14:02:45 +02:00
parent 0ea86c939c
commit 16d6d55d7f
630 changed files with 4211 additions and 12664 deletions
+27 -27
View File
@@ -32,19 +32,19 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
import appeng.api.AEApi;
@@ -92,7 +92,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
this.is = is;
this.proxy = new AENetworkProxy( this, "part", is, this instanceof PartCable );
this.proxy.setValidSides( EnumSet.noneOf( EnumFacing.class ) );
this.proxy.setValidSides( EnumSet.noneOf( Direction.class ) );
}
public IPartHost getHost()
@@ -222,7 +222,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
}
@@ -234,13 +234,13 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
this.proxy.readFromNBT( data );
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
this.proxy.writeToNBT( data );
}
@@ -308,7 +308,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
@SideOnly( Side.CLIENT )
@OnlyIn( Dist.CLIENT )
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
{
@@ -333,7 +333,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public boolean isLadder( final EntityLivingBase entity )
public boolean isLadder( final LivingEntity entity )
{
return false;
}
@@ -356,7 +356,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
* @param from source of settings
* @param compound compound of source
*/
private void uploadSettings( final SettingsFrom from, final NBTTagCompound compound )
private void uploadSettings( final SettingsFrom from, final CompoundNBT compound )
{
if( compound != null )
{
@@ -393,9 +393,9 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
*
* @return compound of source
*/
private NBTTagCompound downloadSettings( final SettingsFrom from )
private CompoundNBT downloadSettings( final SettingsFrom from )
{
final NBTTagCompound output = new NBTTagCompound();
final CompoundNBT output = new CompoundNBT();
final IConfigManager cm = this.getConfigManager();
if( cm != null )
@@ -423,7 +423,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
return true;
}
private boolean useMemoryCard( final EntityPlayer player )
private boolean useMemoryCard( final PlayerEntity player )
{
final ItemStack memCardIS = player.inventory.getCurrentItem();
@@ -444,11 +444,11 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
}
final String name = is.getUnlocalizedName();
final String name = is.getTranslationKey();
if( player.isSneaking() )
if( player.isShiftKeyDown() )
{
final NBTTagCompound data = this.downloadSettings( SettingsFrom.MEMORY_CARD );
final CompoundNBT data = this.downloadSettings( SettingsFrom.MEMORY_CARD );
if( data != null )
{
memoryCard.setMemoryCardContents( memCardIS, name, data );
@@ -458,7 +458,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
else
{
final String storedName = memoryCard.getSettingsName( memCardIS );
final NBTTagCompound data = memoryCard.getData( memCardIS );
final CompoundNBT data = memoryCard.getData( memCardIS );
if( name.equals( storedName ) )
{
this.uploadSettings( SettingsFrom.MEMORY_CARD, data );
@@ -475,7 +475,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public final boolean onActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public final boolean onActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( this.useMemoryCard( player ) )
{
@@ -486,7 +486,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
}
@Override
public final boolean onShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public final boolean onShiftActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( this.useMemoryCard( player ) )
{
@@ -496,18 +496,18 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
return this.onPartShiftActivate( player, hand, pos );
}
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
return false;
}
public boolean onPartShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartShiftActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
return false;
}
@Override
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
public void onPlacement( final PlayerEntity player, final Hand hand, final ItemStack held, final AEPartLocation side )
{
this.proxy.setOwner( player );
}
@@ -22,7 +22,7 @@ package appeng.parts;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import appeng.api.parts.IPartCollisionHelper;
@@ -34,14 +34,14 @@ public class BusCollisionHelper implements IPartCollisionHelper
private final List<AxisAlignedBB> boxes;
private final EnumFacing x;
private final EnumFacing y;
private final EnumFacing z;
private final Direction x;
private final Direction y;
private final Direction z;
private final Entity entity;
private final boolean isVisual;
public BusCollisionHelper( final List<AxisAlignedBB> boxes, final EnumFacing x, final EnumFacing y, final EnumFacing z, final Entity e, final boolean visual )
public BusCollisionHelper( final List<AxisAlignedBB> boxes, final Direction x, final Direction y, final Direction z, final Entity e, final boolean visual )
{
this.boxes = boxes;
this.x = x;
@@ -60,40 +60,40 @@ public class BusCollisionHelper implements IPartCollisionHelper
switch( s )
{
case DOWN:
this.x = EnumFacing.EAST;
this.y = EnumFacing.NORTH;
this.z = EnumFacing.DOWN;
this.x = Direction.EAST;
this.y = Direction.NORTH;
this.z = Direction.DOWN;
break;
case UP:
this.x = EnumFacing.EAST;
this.y = EnumFacing.SOUTH;
this.z = EnumFacing.UP;
this.x = Direction.EAST;
this.y = Direction.SOUTH;
this.z = Direction.UP;
break;
case EAST:
this.x = EnumFacing.SOUTH;
this.y = EnumFacing.UP;
this.z = EnumFacing.EAST;
this.x = Direction.SOUTH;
this.y = Direction.UP;
this.z = Direction.EAST;
break;
case WEST:
this.x = EnumFacing.NORTH;
this.y = EnumFacing.UP;
this.z = EnumFacing.WEST;
this.x = Direction.NORTH;
this.y = Direction.UP;
this.z = Direction.WEST;
break;
case NORTH:
this.x = EnumFacing.WEST;
this.y = EnumFacing.UP;
this.z = EnumFacing.NORTH;
this.x = Direction.WEST;
this.y = Direction.UP;
this.z = Direction.NORTH;
break;
case SOUTH:
this.x = EnumFacing.EAST;
this.y = EnumFacing.UP;
this.z = EnumFacing.SOUTH;
this.x = Direction.EAST;
this.y = Direction.UP;
this.z = Direction.SOUTH;
break;
case INTERNAL:
default:
this.x = EnumFacing.EAST;
this.y = EnumFacing.UP;
this.z = EnumFacing.SOUTH;
this.x = Direction.EAST;
this.y = Direction.UP;
this.z = Direction.SOUTH;
break;
}
}
@@ -153,19 +153,19 @@ public class BusCollisionHelper implements IPartCollisionHelper
}
@Override
public EnumFacing getWorldX()
public Direction getWorldX()
{
return this.x;
}
@Override
public EnumFacing getWorldY()
public Direction getWorldY()
{
return this.y;
}
@Override
public EnumFacing getWorldZ()
public Direction getWorldZ()
{
return this.z;
}
@@ -30,20 +30,20 @@ import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.AEApi;
@@ -182,7 +182,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public AEPartLocation addPart( ItemStack is, final AEPartLocation side, final @Nullable EntityPlayer player, final @Nullable EnumHand hand )
public AEPartLocation addPart( ItemStack is, final AEPartLocation side, final @Nullable PlayerEntity player, final @Nullable Hand hand )
{
if( this.canAddPart( is, side ) )
{
@@ -328,7 +328,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public IPart getPart( final EnumFacing side )
public IPart getPart( final Direction side )
{
return this.getSide( AEPartLocation.fromFacing( side ) );
}
@@ -399,7 +399,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean isBlocked( final EnumFacing side )
public boolean isBlocked( final Direction side )
{
return this.tcb.isBlocked( side );
}
@@ -573,9 +573,9 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
if( this.getCenter() != null )
{
final EnumSet<EnumFacing> sides = EnumSet.allOf( EnumFacing.class );
final EnumSet<Direction> sides = EnumSet.allOf( Direction.class );
for( final EnumFacing s : EnumFacing.VALUES )
for( final Direction s : Direction.VALUES )
{
if( this.getPart( s ) != null || this.isBlocked( s ) )
{
@@ -772,23 +772,23 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public int isProvidingStrongPower( final EnumFacing side )
public int isProvidingStrongPower( final Direction side )
{
final IPart part = this.getPart( side );
return part != null ? part.isProvidingStrongPower() : 0;
}
@Override
public int isProvidingWeakPower( final EnumFacing side )
public int isProvidingWeakPower( final Direction side )
{
final IPart part = this.getPart( side );
return part != null ? part.isProvidingWeakPower() : 0;
}
@Override
public boolean canConnectRedstone( final EnumSet<EnumFacing> enumSet )
public boolean canConnectRedstone( final EnumSet<Direction> enumSet )
{
for( final EnumFacing dir : enumSet )
for( final Direction dir : enumSet )
{
final IPart part = this.getPart( dir );
if( part != null && part.canConnectRedstone() )
@@ -813,14 +813,14 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean activate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean activate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
final SelectedPart p = this.selectPart( pos );
if( p != null && p.part != null )
{
// forge sends activate even when sneaking in some cases (eg emtpy hand)
// if sneaking try shift activate first.
if( player.isSneaking() && p.part.onShiftActivate( player, hand, pos ) )
if( player.isShiftKeyDown() && p.part.onShiftActivate( player, hand, pos ) )
{
return true;
}
@@ -830,12 +830,12 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean clicked( EntityPlayer player, EnumHand hand, Vec3d hitVec )
public boolean clicked( PlayerEntity player, Hand hand, Vec3d hitVec )
{
final SelectedPart p = this.selectPart( hitVec );
if( p != null && p.part != null )
{
if( player.isSneaking() )
if( player.isShiftKeyDown() )
{
return p.part.onShiftClicked( player, hand, hitVec );
}
@@ -848,7 +848,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
this.hasRedstone = YesNo.UNDECIDED;
@@ -863,7 +863,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean isSolidOnSide( final EnumFacing side )
public boolean isSolidOnSide( final Direction side )
{
if( side == null )
{
@@ -883,7 +883,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean isLadder( final EntityLivingBase entity )
public boolean isLadder( final LivingEntity entity )
{
for( final AEPartLocation side : AEPartLocation.values() )
{
@@ -1016,7 +1016,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
return updateBlock;
}
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
data.setInteger( "hasRedstone", this.hasRedstone.ordinal() );
@@ -1028,10 +1028,10 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
final IPart part = this.getPart( s );
if( part != null )
{
final NBTTagCompound def = new NBTTagCompound();
final CompoundNBT def = new CompoundNBT();
part.getItemStack( PartItemStack.WORLD ).writeToNBT( def );
final NBTTagCompound extra = new NBTTagCompound();
final CompoundNBT extra = new CompoundNBT();
part.writeToNBT( extra );
data.setTag( "def:" + this.getSide( part ).ordinal(), def );
@@ -1060,7 +1060,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
throw new IllegalStateException( "Uhh Bad Part (" + part + ") on Side." );
}
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
if( data.hasKey( "hasRedstone" ) )
{
@@ -1071,8 +1071,8 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
{
AEPartLocation side = AEPartLocation.fromOrdinal( x );
final NBTTagCompound def = data.getCompoundTag( "def:" + side.ordinal() );
final NBTTagCompound extra = data.getCompoundTag( "extra:" + side.ordinal() );
final CompoundNBT def = data.getCompoundTag( "def:" + side.ordinal() );
final CompoundNBT extra = data.getCompoundTag( "extra:" + side.ordinal() );
if( def != null && extra != null )
{
IPart p = this.getPart( side );
@@ -1151,7 +1151,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
@Override
public boolean recolourBlock( final EnumFacing side, final AEColor colour, final EntityPlayer who )
public boolean recolourBlock( final Direction side, final AEColor colour, final PlayerEntity who )
{
final IPart cable = this.getPart( AEPartLocation.INTERNAL );
if( cable != null )
@@ -1186,7 +1186,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
renderState.setCoreType( CableCoreType.fromCableType( cable.getCableConnectionType() ) );
// Check each outgoing connection for the desired characteristics
for( EnumFacing facing : EnumFacing.values() )
for( Direction facing : Direction.values() )
{
// Is there a connection?
if( !cable.isConnected( facing ) )
@@ -1223,7 +1223,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
// Collect the number of channels used per side
// We have to do this even for non-smart cables since a glass cable can display a connection as smart if the
// adjacent tile requires it
for( EnumFacing facing : EnumFacing.values() )
for( Direction facing : Direction.values() )
{
int channels = cable.getCableConnectionType().isSmart() ? cable.getChannelsOnSide( facing ) : 0;
renderState.getChannelsOnSide().put( facing, channels );
@@ -1231,7 +1231,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
}
// Determine attachments and facades
for( EnumFacing facing : EnumFacing.values() )
for( Direction facing : Direction.values() )
{
final FacadeRenderState facadeState = this.getFacadeRenderState( facing );
@@ -1279,7 +1279,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
return renderState;
}
private FacadeRenderState getFacadeRenderState( EnumFacing side )
private FacadeRenderState getFacadeRenderState( Direction side )
{
// Store the "masqueraded" itemstack for the given side, if there is a facade
final IFacadePart facade = this.getFacade( side.ordinal() );
@@ -1287,7 +1287,7 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
if( facade != null )
{
final ItemStack textureItem = facade.getTextureItem();
final IBlockState blockState = facade.getBlockState();
final BlockState blockState = facade.getBlockState();
if( blockState != null && textureItem != null )
{
@@ -23,16 +23,16 @@ import java.util.EnumSet;
import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AEColor;
@@ -42,31 +42,31 @@ import appeng.client.render.cablebus.CableBusRenderState;
public interface ICableBusContainer
{
int isProvidingStrongPower( EnumFacing opposite );
int isProvidingStrongPower( Direction opposite );
int isProvidingWeakPower( EnumFacing opposite );
int isProvidingWeakPower( Direction opposite );
boolean canConnectRedstone( EnumSet<EnumFacing> of );
boolean canConnectRedstone( EnumSet<Direction> of );
void onEntityCollision( Entity e );
boolean activate( EntityPlayer player, EnumHand hand, Vec3d vecFromPool );
boolean activate( PlayerEntity player, Hand hand, Vec3d vecFromPool );
boolean clicked( EntityPlayer player, EnumHand hand, Vec3d hitVec );
boolean clicked( PlayerEntity player, Hand hand, Vec3d hitVec );
void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor );
void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor );
boolean isSolidOnSide( EnumFacing side );
boolean isSolidOnSide( Direction side );
boolean isEmpty();
SelectedPart selectPart( Vec3d v3 );
boolean recolourBlock( EnumFacing side, AEColor colour, EntityPlayer who );
boolean recolourBlock( Direction side, AEColor colour, PlayerEntity who );
boolean isLadder( EntityLivingBase entity );
boolean isLadder( LivingEntity entity );
@SideOnly( Side.CLIENT )
@OnlyIn( Dist.CLIENT )
void randomDisplayTick( World world, BlockPos pos, Random r );
int getLightValue();
@@ -23,13 +23,13 @@ import java.util.EnumSet;
import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.parts.SelectedPart;
@@ -41,19 +41,19 @@ public class NullCableBusContainer implements ICableBusContainer
{
@Override
public int isProvidingStrongPower( final EnumFacing opposite )
public int isProvidingStrongPower( final Direction opposite )
{
return 0;
}
@Override
public int isProvidingWeakPower( final EnumFacing opposite )
public int isProvidingWeakPower( final Direction opposite )
{
return 0;
}
@Override
public boolean canConnectRedstone( final EnumSet<EnumFacing> of )
public boolean canConnectRedstone( final EnumSet<Direction> of )
{
return false;
}
@@ -65,19 +65,19 @@ public class NullCableBusContainer implements ICableBusContainer
}
@Override
public boolean activate( final EntityPlayer player, final EnumHand hand, final Vec3d vecFromPool )
public boolean activate( final PlayerEntity player, final Hand hand, final Vec3d vecFromPool )
{
return false;
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
}
@Override
public boolean isSolidOnSide( final EnumFacing side )
public boolean isSolidOnSide( final Direction side )
{
return false;
}
@@ -95,13 +95,13 @@ public class NullCableBusContainer implements ICableBusContainer
}
@Override
public boolean recolourBlock( final EnumFacing side, final AEColor colour, final EntityPlayer who )
public boolean recolourBlock( final Direction side, final AEColor colour, final PlayerEntity who )
{
return false;
}
@Override
public boolean isLadder( final EntityLivingBase entity )
public boolean isLadder( final LivingEntity entity )
{
return false;
}
@@ -125,7 +125,7 @@ public class NullCableBusContainer implements ICableBusContainer
}
@Override
public boolean clicked( EntityPlayer player, EnumHand hand, Vec3d hitVec )
public boolean clicked( PlayerEntity player, Hand hand, Vec3d hitVec )
{
return false;
}
+54 -54
View File
@@ -24,26 +24,26 @@ import java.util.List;
import java.util.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import appeng.api.AEApi;
import appeng.api.definitions.IBlockDefinition;
@@ -71,18 +71,18 @@ public class PartPlacement
private final ThreadLocal<Object> placing = new ThreadLocal<>();
private boolean wasCanceled = false;
public static EnumActionResult place( final ItemStack held, final BlockPos pos, EnumFacing side, final EntityPlayer player, final EnumHand hand, final World world, PlaceType pass, final int depth )
public static ActionResult<?> place( final ItemStack held, final BlockPos pos, Direction side, final PlayerEntity player, final Hand hand, final World world, PlaceType pass, final int depth )
{
if( depth > 3 )
{
return EnumActionResult.FAIL;
return ActionResult.resultFail( null );
}
if( !held.isEmpty() && Platform.isWrench( player, held, pos ) && player.isSneaking() )
if( !held.isEmpty() && Platform.isWrench( player, held, pos ) && player.isShiftKeyDown() )
{
if( !Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
{
return EnumActionResult.FAIL;
return ActionResult.resultFail( null );
}
final Block block = world.getBlockState( pos ).getBlock();
@@ -99,13 +99,13 @@ public class PartPlacement
if( !world.isRemote )
{
final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
final RayTraceResult mop = block.collisionRayTrace( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB() );
final RayTraceResult mop = block.getRayTraceResult( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB(), mop );
if( mop != null )
{
final List<ItemStack> is = new ArrayList<>();
final SelectedPart sp = selectPart( player, host,
mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) );
mop.getHitVec().addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() ) );
if( sp.part != null )
{
@@ -137,10 +137,10 @@ public class PartPlacement
player.swingArm( hand );
NetworkHandler.instance().sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return EnumActionResult.SUCCESS;
return ActionResult.resultSuccess( null );
}
return EnumActionResult.PASS;
return ActionResult.resultFail( null );
}
TileEntity tile = world.getTileEntity( pos );
@@ -162,7 +162,7 @@ public class PartPlacement
{
if( host.getPart( AEPartLocation.INTERNAL ) == null )
{
return EnumActionResult.FAIL;
return ActionResult.resultFail( null );
}
if( host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
@@ -171,7 +171,7 @@ public class PartPlacement
{
host.markForSave();
host.markForUpdate();
if( !player.capabilities.isCreativeMode )
if( !player.isCreative() )
{
held.grow( -1 );
;
@@ -181,7 +181,7 @@ public class PartPlacement
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, held, hand ) );
}
}
return EnumActionResult.SUCCESS;
return ActionResult.resultConsume( null );
}
}
}
@@ -189,24 +189,24 @@ public class PartPlacement
{
player.swingArm( hand );
NetworkHandler.instance().sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
return EnumActionResult.SUCCESS;
return ActionResult.resultSuccess( null );
}
}
return EnumActionResult.FAIL;
return ActionResult.resultFail( null );
}
}
if( held.isEmpty() )
{
final Block block = world.getBlockState( pos ).getBlock();
if( host != null && player.isSneaking() && block != null )
if( host != null && player.isShiftKeyDown() && block != null )
{
final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
final RayTraceResult mop = block.collisionRayTrace( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB() );
final RayTraceResult mop = block.getRayTraceResult( world.getBlockState( pos ), world, pos, dir.getA(), dir.getB(), mop );
if( mop != null )
{
mop.hitVec = mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() );
mop.set = mop.hitVec.addVector( -mop.getBlockPos().getX(), -mop.getBlockPos().getY(), -mop.getBlockPos().getZ() );
final SelectedPart sPart = selectPart( player, host, mop.hitVec );
if( sPart != null && sPart.part != null )
{
@@ -216,7 +216,7 @@ public class PartPlacement
{
NetworkHandler.instance().sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
}
return EnumActionResult.SUCCESS;
return ActionResult.resultSuccess( null );
}
}
}
@@ -225,7 +225,7 @@ public class PartPlacement
if( held.isEmpty() || !( held.getItem() instanceof IPartItem ) )
{
return EnumActionResult.PASS;
return ActionResult.resultPass( null );
}
BlockPos te_pos = pos;
@@ -233,7 +233,7 @@ public class PartPlacement
final IBlockDefinition multiPart = AEApi.instance().definitions().blocks().multiPart();
if( host == null && pass == PlaceType.PLACE_ITEM )
{
EnumFacing offset = null;
Direction offset = null;
final Block blkID = world.getBlockState( pos ).getBlock();
if( blkID != null && !blkID.isReplaceable( world, pos ) )
@@ -255,13 +255,13 @@ public class PartPlacement
final Optional<ItemStack> maybeMultiPartStack = multiPart.maybeStack( 1 );
final Optional<Block> maybeMultiPartBlock = multiPart.maybeBlock();
final Optional<ItemBlock> maybeMultiPartItemBlock = multiPart.maybeItemBlock();
final Optional<BlockItem> maybeMultiPartBlockItem = multiPart.maybeBlockItem();
final boolean hostIsNotPresent = host == null;
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent() && maybeMultiPartItemBlock.isPresent();
final boolean multiPartPresent = maybeMultiPartBlock.isPresent() && maybeMultiPartStack.isPresent() && maybeMultiPartBlockItem.isPresent();
final boolean canMultiPartBePlaced = maybeMultiPartBlock.get().canPlaceBlockAt( world, te_pos );
if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartItemBlock.get()
if( hostIsNotPresent && multiPartPresent && canMultiPartBePlaced && maybeMultiPartBlockItem.get()
.placeBlockAt( maybeMultiPartStack.get(), player,
world, te_pos, side, 0.5f, 0.5f, 0.5f, maybeMultiPartBlock.get().getDefaultState() ) )
{
@@ -280,18 +280,18 @@ public class PartPlacement
{
player.swingArm( hand );
NetworkHandler.instance().sendToServer( new PacketPartPlacement( pos, side, getEyeOffset( player ), hand ) );
return EnumActionResult.SUCCESS;
return ActionResult.resultSuccess( null );
}
}
else if( host != null && !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
{
return EnumActionResult.FAIL;
return ActionResult.resultFail( null );
}
}
if( host == null )
{
return EnumActionResult.PASS;
return ActionResult.resultPass( null );
}
if( !host.canAddPart( held, AEPartLocation.fromFacing( side ) ) )
@@ -308,12 +308,12 @@ public class PartPlacement
pass == PlaceType.INTERACT_FIRST_PASS ? PlaceType.INTERACT_SECOND_PASS : PlaceType.PLACE_ITEM, depth + 1 );
}
}
return EnumActionResult.PASS;
return ActionResult.resultPass( null );
}
if( !world.isRemote )
{
final IBlockState state = world.getBlockState( pos );
final BlockState state = world.getBlockState( pos );
final LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
final RayTraceResult mop = state.getBlock().collisionRayTrace( state, world, pos, dir.getA(), dir.getB() );
@@ -324,9 +324,9 @@ public class PartPlacement
if( sp.part != null )
{
if( !player.isSneaking() && sp.part.onActivate( player, hand, mop.hitVec ) )
if( !player.isShiftKeyDown() && sp.part.onActivate( player, hand, mop.hitVec ) )
{
return EnumActionResult.FAIL;
return ActionResult.resultFail( null );
}
}
}
@@ -334,7 +334,7 @@ public class PartPlacement
final DimensionalCoord dc = host.getLocation();
if( !Platform.hasPermissions( dc, player ) )
{
return EnumActionResult.FAIL;
return ActionResult.resultFail( null );
}
final AEPartLocation mySide = host.addPart( held, AEPartLocation.fromFacing( side ), player, hand );
@@ -347,7 +347,7 @@ public class PartPlacement
world.playSound( null, pos, ss.getPlaceSound(), SoundCategory.BLOCKS, ( ss.getVolume() + 1.0F ) / 2.0F, ss.getPitch() * 0.8F );
} );
if( !player.capabilities.isCreativeMode )
if( !player.isCreative() )
{
held.grow( -1 );
if( held.getCount() == 0 )
@@ -362,10 +362,10 @@ public class PartPlacement
{
player.swingArm( hand );
}
return EnumActionResult.SUCCESS;
return ActionResult.resultSuccess( null );
}
private static float getEyeOffset( final EntityPlayer p )
private static float getEyeOffset( final PlayerEntity p )
{
if( p.world.isRemote )
{
@@ -375,7 +375,7 @@ public class PartPlacement
return getEyeHeight();
}
private static SelectedPart selectPart( final EntityPlayer player, final IPartHost host, final Vec3d pos )
private static SelectedPart selectPart( final PlayerEntity player, final IPartHost host, final Vec3d pos )
{
AppEng.proxy.updateRenderMode( player );
final SelectedPart sp = host.selectPart( pos );
@@ -404,22 +404,22 @@ public class PartPlacement
public void playerInteract( final PlayerInteractEvent event )
{
// Only handle the main hand event
if( event.getHand() != EnumHand.MAIN_HAND )
if( event.getHand() != Hand.MAIN_HAND )
{
return;
}
if( event instanceof PlayerInteractEvent.RightClickEmpty && event.getEntityPlayer().world.isRemote )
if( event instanceof PlayerInteractEvent.RightClickEmpty && event.getPlayer().world.isRemote )
{
// re-check to see if this event was already channeled, cause these two events are really stupid...
final RayTraceResult mop = Platform.rayTrace( event.getEntityPlayer(), true, false );
final Minecraft mc = Minecraft.getMinecraft();
final RayTraceResult mop = Platform.rayTrace( event.getPlayer(), true, false );
final Minecraft mc = Minecraft.getInstance();
final float f = 1.0F;
final double d0 = mc.playerController.getBlockReachDistance();
final Vec3d vec3 = mc.getRenderViewEntity().getPositionEyes( f );
final Vec3d vec3 = mc.getRenderViewEntity().getEyePosition( f );
if( mop != null && mop.hitVec.distanceTo( vec3 ) < d0 )
if( mop != null && mop.getHitVec().distanceTo( vec3 ) < d0 )
{
final World w = event.getEntity().world;
final TileEntity te = w.getTileEntity( mop.getBlockPos() );
@@ -430,19 +430,19 @@ public class PartPlacement
}
else
{
final ItemStack held = event.getEntityPlayer().getHeldItem( event.getHand() );
final ItemStack held = event.getPlayer().getHeldItem( event.getHand() );
final IItems items = AEApi.instance().definitions().items();
boolean supportedItem = items.memoryCard().isSameAs( held );
supportedItem |= items.colorApplicator().isSameAs( held );
if( event.getEntityPlayer().isSneaking() && !held.isEmpty() && supportedItem )
if( event.getPlayer().isShiftKeyDown() && !held.isEmpty() && supportedItem )
{
NetworkHandler.instance().sendToServer( new PacketClick( event.getPos(), event.getFace(), 0, 0, 0, event.getHand() ) );
}
}
}
else if( event instanceof PlayerInteractEvent.RightClickBlock && !event.getEntityPlayer().world.isRemote )
else if( event instanceof PlayerInteractEvent.RightClickBlock && !event.getPlayer().world.isRemote )
{
if( this.placing.get() != null )
{
@@ -451,9 +451,9 @@ public class PartPlacement
this.placing.set( event );
final ItemStack held = event.getEntityPlayer().getHeldItem( event.getHand() );
if( place( held, event.getPos(), event.getFace(), event.getEntityPlayer(), event.getHand(), event.getEntityPlayer().world,
PlaceType.INTERACT_FIRST_PASS, 0 ) == EnumActionResult.SUCCESS )
final ItemStack held = event.getPlayer().getHeldItem( event.getHand() );
if( place( held, event.getPos(), event.getFace(), event.getPlayer(), event.getHand(), event.getPlayer().world,
PlaceType.INTERACT_FIRST_PASS, 0 ) == ActionResult.resultSuccess( null ) )
{
event.setCanceled( true );
this.wasCanceled = true;
@@ -21,7 +21,7 @@ package appeng.parts.automation;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import appeng.api.config.Upgrades;
@@ -47,7 +47,7 @@ public class BlockUpgradeInventory extends UpgradeInventory
{
final Item encodedItem = is.getItem();
if( encodedItem instanceof ItemBlock && Block.getBlockFromItem( encodedItem ) == this.block )
if( encodedItem instanceof BlockItem && Block.getBlockFromItem( encodedItem ) == this.block )
{
max = upgrades.getSupported().get( is );
break;
@@ -3,11 +3,11 @@ package appeng.parts.automation;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import appeng.api.config.Actionable;
import appeng.api.networking.security.IActionSource;
@@ -84,8 +84,8 @@ public abstract class PartAbstractFormationPlane<T extends IAEStack<T>> extends
final BlockPos pos = te.getPos();
final EnumFacing e = bch.getWorldX();
final EnumFacing u = bch.getWorldY();
final Direction e = bch.getWorldX();
final Direction u = bch.getWorldY();
if( this.isTransitionPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.getSide() ) )
{
@@ -115,33 +115,33 @@ public abstract class PartAbstractFormationPlane<T extends IAEStack<T>> extends
public PlaneConnections getConnections()
{
final EnumFacing facingRight, facingUp;
final Direction facingRight, facingUp;
AEPartLocation location = this.getSide();
switch( location )
{
case UP:
facingRight = EnumFacing.EAST;
facingUp = EnumFacing.NORTH;
facingRight = Direction.EAST;
facingUp = Direction.NORTH;
break;
case DOWN:
facingRight = EnumFacing.WEST;
facingUp = EnumFacing.NORTH;
facingRight = Direction.WEST;
facingUp = Direction.NORTH;
break;
case NORTH:
facingRight = EnumFacing.WEST;
facingUp = EnumFacing.UP;
facingRight = Direction.WEST;
facingUp = Direction.UP;
break;
case SOUTH:
facingRight = EnumFacing.EAST;
facingUp = EnumFacing.UP;
facingRight = Direction.EAST;
facingUp = Direction.UP;
break;
case WEST:
facingRight = EnumFacing.SOUTH;
facingUp = EnumFacing.UP;
facingRight = Direction.SOUTH;
facingUp = Direction.UP;
break;
case EAST:
facingRight = EnumFacing.NORTH;
facingUp = EnumFacing.UP;
facingRight = Direction.NORTH;
facingUp = Direction.UP;
break;
default:
case INTERNAL:
@@ -182,7 +182,7 @@ public abstract class PartAbstractFormationPlane<T extends IAEStack<T>> extends
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
@@ -224,14 +224,14 @@ public abstract class PartAbstractFormationPlane<T extends IAEStack<T>> extends
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.priority = data.getInteger( "priority" );
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setInteger( "priority", this.getPriority() );
@@ -23,17 +23,19 @@ import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.BlockState;
import net.minecraft.entity.item.I
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.entity.item.EntityItem;temEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -113,8 +115,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final BlockPos pos = te.getPos();
final EnumFacing e = bch.getWorldX();
final EnumFacing u = bch.getWorldY();
final Direction e = bch.getWorldX();
final Direction u = bch.getWorldY();
if( this.isAnnihilationPlane( te.getWorld().getTileEntity( pos.offset( e.getOpposite() ) ), this.getSide() ) )
{
@@ -148,33 +150,33 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
public PlaneConnections getConnections()
{
final EnumFacing facingRight, facingUp;
final Direction facingRight, facingUp;
AEPartLocation location = this.getSide();
switch( location )
{
case UP:
facingRight = EnumFacing.EAST;
facingUp = EnumFacing.NORTH;
facingRight = Direction.EAST;
facingUp = Direction.NORTH;
break;
case DOWN:
facingRight = EnumFacing.WEST;
facingUp = EnumFacing.NORTH;
facingRight = Direction.WEST;
facingUp = Direction.NORTH;
break;
case NORTH:
facingRight = EnumFacing.WEST;
facingUp = EnumFacing.UP;
facingRight = Direction.WEST;
facingUp = Direction.UP;
break;
case SOUTH:
facingRight = EnumFacing.EAST;
facingUp = EnumFacing.UP;
facingRight = Direction.EAST;
facingUp = Direction.UP;
break;
case WEST:
facingRight = EnumFacing.SOUTH;
facingUp = EnumFacing.UP;
facingRight = Direction.SOUTH;
facingUp = Direction.UP;
break;
case EAST:
facingRight = EnumFacing.NORTH;
facingUp = EnumFacing.UP;
facingRight = Direction.NORTH;
facingUp = Direction.UP;
break;
default:
case INTERNAL:
@@ -215,7 +217,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
@@ -286,7 +288,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if( capture )
{
final boolean changed = this.storeEntityItem( (EntityItem) entity );
final boolean changed = this.storeEntityItem( (ItemEntity) entity );
if( changed )
{
@@ -308,7 +310,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
*
* @param entityItem {@link EntityItem} to store
*/
private boolean storeEntityItem( final EntityItem entityItem )
private boolean storeEntityItem( final ItemEntity entityItem )
{
if( !entityItem.isDead )
{
@@ -473,7 +475,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
*/
private boolean canHandleBlock( final WorldServer w, final BlockPos pos )
{
final IBlockState state = w.getBlockState( pos );
final BlockState state = w.getBlockState( pos );
final Material material = state.getMaterial();
final float hardness = state.getBlockHardness( w, pos );
final boolean ignoreMaterials = material == Material.AIR || material == Material.LAVA || material == Material.WATER || material.isLiquid();
@@ -496,7 +498,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
*/
protected float calculateEnergyUsage( final WorldServer w, final BlockPos pos, final List<ItemStack> items )
{
final IBlockState state = w.getBlockState( pos );
final BlockState state = w.getBlockState( pos );
final float hardness = state.getBlockHardness( w, pos );
float requiredEnergy = 1 + hardness;
@@ -22,10 +22,10 @@ package appeng.parts.automation;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
@@ -101,7 +101,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
}
@Override
public void readFromNBT( final NBTTagCompound extra )
public void readFromNBT( final CompoundNBT extra )
{
super.readFromNBT( extra );
this.craftingTracker.readFromNBT( extra );
@@ -109,7 +109,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
}
@Override
public void writeToNBT( final NBTTagCompound extra )
public void writeToNBT( final CompoundNBT extra )
{
super.writeToNBT( extra );
this.craftingTracker.writeToNBT( extra );
@@ -215,7 +215,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
@@ -25,19 +25,19 @@ import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemBlockSpecial;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemSpecial;
import net.minecraft.item.ItemFirework;
import net.minecraft.item.ItemSkull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@@ -155,7 +155,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.Config.readFromNBT( data, "config" );
@@ -163,7 +163,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
this.Config.writeToNBT( data, "config" );
@@ -194,7 +194,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
@@ -239,12 +239,12 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
if( w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ) )
{
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof ItemBlockSpecial || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item
if( placeBlock == YesNo.YES && ( i instanceof BlockItem || i instanceof BlockItemSpecial || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item
.getItemFromBlock( Blocks.REEDS ) ) )
{
final EntityPlayer player = Platform.getPlayer( (WorldServer) w );
final PlayerEntity player = Platform.getPlayer( (WorldServer) w );
Platform.configurePlayer( player, side, this.getTile() );
EnumHand hand = player.getActiveHand();
Hand hand = player.getActiveHand();
player.setHeldItem( hand, is );
maxStorage = is.getCount();
@@ -269,7 +269,7 @@ public class PartFormationPlane extends PartAbstractFormationPlane<IAEItemStack>
if( !Worked && side.yOffset == 0 )
{
Worked = i.onItemUse( player, w, tePos.offset( EnumFacing.DOWN ), hand, EnumFacing.UP, side.xOffset, side.yOffset,
Worked = i.onItemUse( player, w, tePos.offset( Direction.DOWN ), hand, Direction.UP, side.xOffset, side.yOffset,
side.zOffset ) == EnumActionResult.SUCCESS;
}
@@ -22,8 +22,8 @@ package appeng.parts.automation;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Items;
import net.minecraft.block.BlockState;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -80,7 +80,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
protected List<ItemStack> obtainBlockDrops( final WorldServer w, final BlockPos pos )
{
final FakePlayer fakePlayer = FakePlayerFactory.getMinecraft( w );
final IBlockState state = w.getBlockState( pos );
final BlockState state = w.getBlockState( pos );
if( state.getBlock().canSilkHarvest( w, pos, state, fakePlayer ) )
{
@@ -19,10 +19,10 @@
package appeng.parts.automation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
@@ -128,7 +128,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
@@ -22,12 +22,12 @@ package appeng.parts.automation;
import java.util.Collection;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
@@ -463,7 +463,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
@@ -502,7 +502,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.lastReportedValue = data.getLong( "lastReportedValue" );
@@ -512,7 +512,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setLong( "lastReportedValue", this.lastReportedValue );
@@ -22,7 +22,7 @@ package appeng.parts.automation;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
@@ -53,14 +53,14 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
}
@Override
public void readFromNBT( final net.minecraft.nbt.NBTTagCompound extra )
public void readFromNBT( final net.minecraft.nbt.CompoundNBT extra )
{
super.readFromNBT( extra );
this.getConfig().readFromNBT( extra, "config" );
}
@Override
public void writeToNBT( final net.minecraft.nbt.NBTTagCompound extra )
public void writeToNBT( final net.minecraft.nbt.CompoundNBT extra )
{
super.writeToNBT( extra );
this.getConfig().writeToNBT( extra, "config" );
@@ -78,7 +78,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
this.updateState();
if( this.lastRedstone != this.getHost().hasRedstone( this.getSide() ) )
@@ -120,7 +120,7 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
}
@Override
public void readFromNBT( final net.minecraft.nbt.NBTTagCompound extra )
public void readFromNBT( final net.minecraft.nbt.CompoundNBT extra )
{
super.readFromNBT( extra );
this.manager.readFromNBT( extra );
@@ -128,7 +128,7 @@ public abstract class PartUpgradeable extends PartBasicState implements IAEAppEn
}
@Override
public void writeToNBT( final net.minecraft.nbt.NBTTagCompound extra )
public void writeToNBT( final net.minecraft.nbt.CompoundNBT extra )
{
super.writeToNBT( extra );
this.manager.writeToNBT( extra );
@@ -27,14 +27,14 @@ import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import appeng.client.render.cablebus.CubeBuilder;
@@ -72,7 +72,7 @@ public class PlaneBakedModel implements IBakedModel
}
@Override
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
public List<BakedQuad> getQuads( @Nullable BlockState state, @Nullable Direction side, long rand )
{
if( side == null )
{
@@ -19,10 +19,10 @@
package appeng.parts.automation;
import net.minecraft.init.Items;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.Upgrades;
@@ -135,7 +135,7 @@ public abstract class UpgradeInventory extends AppEngInternalInventory implement
}
@Override
public void readFromNBT( final NBTTagCompound target )
public void readFromNBT( final CompoundNBT target )
{
super.readFromNBT( target );
this.updateUpgradeInfo();
@@ -26,16 +26,16 @@ import java.util.Random;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.networking.IGridNode;
@@ -108,13 +108,13 @@ public class PartCableAnchor implements IPart
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
}
@@ -126,13 +126,13 @@ public class PartCableAnchor implements IPart
}
@Override
public boolean isLadder( final EntityLivingBase entity )
public boolean isLadder( final LivingEntity entity )
{
return this.mySide.yOffset == 0 && ( entity.collidedHorizontally || !entity.onGround );
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
}
@@ -199,13 +199,13 @@ public class PartCableAnchor implements IPart
}
@Override
public boolean onActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
return false;
}
@Override
public boolean onShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onShiftActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
return false;
}
@@ -229,7 +229,7 @@ public class PartCableAnchor implements IPart
}
@Override
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
public void onPlacement( final PlayerEntity player, final Hand hand, final ItemStack held, final AEPartLocation side )
{
}
@@ -24,13 +24,13 @@ import java.util.List;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.capabilities.Capability;
@@ -127,14 +127,14 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.duality.readFromNBT( data );
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
this.duality.writeToNBT( data );
@@ -172,7 +172,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public boolean onPartActivate( final EntityPlayer p, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity p, final Hand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
@@ -218,7 +218,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public EnumSet<EnumFacing> getTargets()
public EnumSet<Direction> getTargets()
{
return EnumSet.of( this.getSide().getFacing() );
}
@@ -23,9 +23,9 @@ import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import appeng.api.AEApi;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
@@ -151,7 +151,7 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
@@ -160,14 +160,14 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.priority = data.getInteger( "priority" );
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setInteger( "priority", this.priority );
@@ -23,16 +23,16 @@ import java.util.Collections;
import java.util.List;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@@ -190,7 +190,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.Config.readFromNBT( data, "config" );
@@ -198,7 +198,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
this.Config.writeToNBT( data, "config" );
@@ -284,7 +284,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
@@ -310,7 +310,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( Platform.isServer() )
{
@@ -375,7 +375,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
private IMEInventory<IAEItemStack> getInventoryWrapper( TileEntity target )
{
EnumFacing targetSide = this.getSide().getFacing().getOpposite();
Direction targetSide = this.getSide().getFacing().getOpposite();
// Prioritize a handler to directly link to another ME network
IStorageMonitorableAccessor accessor = target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide );
@@ -413,7 +413,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
return 0;
}
final EnumFacing targetSide = this.getSide().getFacing().getOpposite();
final Direction targetSide = this.getSide().getFacing().getOpposite();
if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) )
{
@@ -21,14 +21,14 @@ package appeng.parts.misc;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnectionException;
@@ -109,7 +109,7 @@ public class PartToggleBus extends PartBasicState
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
final boolean oldHasRedstone = this.hasRedstone;
this.hasRedstone = this.getHost().hasRedstone( this.getSide() );
@@ -122,14 +122,14 @@ public class PartToggleBus extends PartBasicState
}
@Override
public void readFromNBT( final NBTTagCompound extra )
public void readFromNBT( final CompoundNBT extra )
{
super.readFromNBT( extra );
this.getOuterProxy().readFromNBT( extra );
}
@Override
public void writeToNBT( final NBTTagCompound extra )
public void writeToNBT( final CompoundNBT extra )
{
super.writeToNBT( extra );
this.getOuterProxy().writeToNBT( extra );
@@ -171,7 +171,7 @@ public class PartToggleBus extends PartBasicState
}
@Override
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
public void onPlacement( final PlayerEntity player, final Hand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, hand, held, side );
this.getOuterProxy().setOwner( player );
@@ -26,10 +26,10 @@ import com.google.common.collect.ImmutableSet;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
@@ -108,7 +108,7 @@ public class PartCable extends AEBasePart implements IPartCable
}
@Override
public boolean changeColor( final AEColor newColor, final EntityPlayer who )
public boolean changeColor( final AEColor newColor, final PlayerEntity who )
{
if( this.getCableColor() != newColor )
{
@@ -164,13 +164,13 @@ public class PartCable extends AEBasePart implements IPartCable
}
@Override
public void setValidSides( final EnumSet<EnumFacing> sides )
public void setValidSides( final EnumSet<Direction> sides )
{
this.getProxy().setValidSides( sides );
}
@Override
public boolean isConnected( final EnumFacing side )
public boolean isConnected( final Direction side )
{
return this.getConnections().contains( AEPartLocation.fromFacing( side ) );
}
@@ -267,7 +267,7 @@ public class PartCable extends AEBasePart implements IPartCable
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
@@ -292,10 +292,10 @@ public class PartCable extends AEBasePart implements IPartCable
public void writeToStream( final ByteBuf data ) throws IOException
{
int flags = 0;
boolean[] writeSide = new boolean[EnumFacing.values().length];
int[] channelsPerSide = new int[EnumFacing.values().length];
boolean[] writeSide = new boolean[Direction.values().length];
int[] channelsPerSide = new int[Direction.values().length];
for( EnumFacing thisSide : EnumFacing.values() )
for( Direction thisSide : Direction.values() )
{
final IPart part = this.getHost().getPart( thisSide );
if( part != null )
@@ -409,7 +409,7 @@ public class PartCable extends AEBasePart implements IPartCable
return this.channelsOnSide[i];
}
public int getChannelsOnSide( EnumFacing side )
public int getChannelsOnSide( Direction side )
{
if( !this.powered )
{
@@ -23,11 +23,11 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import appeng.api.config.Actionable;
@@ -78,14 +78,14 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public void readFromNBT( final NBTTagCompound extra )
public void readFromNBT( final CompoundNBT extra )
{
super.readFromNBT( extra );
this.outerProxy.readFromNBT( extra );
}
@Override
public void writeToNBT( final NBTTagCompound extra )
public void writeToNBT( final CompoundNBT extra )
{
super.writeToNBT( extra );
this.outerProxy.writeToNBT( extra );
@@ -125,7 +125,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
}
@Override
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
public void onPlacement( final PlayerEntity player, final Hand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, hand, held, side );
this.outerProxy.setOwner( player );
@@ -28,7 +28,7 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -77,7 +77,7 @@ public class PartP2PFluids extends PartP2PTunnel<PartP2PFluids> implements IFlui
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
this.cachedTank = null;
@@ -1,287 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.parts.p2p;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ic2.api.energy.prefab.BasicSinkSource;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergyEmitter;
import appeng.api.config.PowerUnits;
import appeng.api.parts.IPartModel;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.me.cache.helpers.TunnelCollection;
import appeng.util.Platform;
public class PartP2PIC2Power extends PartP2PTunnel<PartP2PIC2Power>
{
private static final String TAG_BUFFERED_ENERGY_1 = "bufferedEnergy1";
private static final String TAG_BUFFERED_ENERGY_2 = "bufferedEnergy2";
private static final String TAG_BUFFERED_VOLTAGE_1 = "outputPacket1";
private static final String TAG_BUFFERED_VOLTAGE_2 = "outputPacket2";
private static final P2PModels MODELS = new P2PModels( "part/p2p/p2p_tunnel_ic2" );
// Buffer the energy + voltage for two IC2 ENET packets
private double bufferedEnergy1;
private double bufferedVoltage1;
private double bufferedEnergy2;
private double bufferedVoltage2;
private BasicSinkSource sinkSource;
public PartP2PIC2Power( ItemStack is )
{
super( is );
}
@Override
public void readFromNBT( NBTTagCompound tag )
{
super.readFromNBT( tag );
this.bufferedEnergy1 = tag.getDouble( TAG_BUFFERED_ENERGY_1 );
this.bufferedEnergy2 = tag.getDouble( TAG_BUFFERED_ENERGY_2 );
this.bufferedVoltage1 = tag.getDouble( TAG_BUFFERED_VOLTAGE_1 );
this.bufferedVoltage2 = tag.getDouble( TAG_BUFFERED_VOLTAGE_2 );
}
@Override
public void writeToNBT( NBTTagCompound tag )
{
super.writeToNBT( tag );
tag.setDouble( TAG_BUFFERED_ENERGY_1, this.bufferedEnergy1 );
tag.setDouble( TAG_BUFFERED_ENERGY_2, this.bufferedEnergy2 );
tag.setDouble( TAG_BUFFERED_VOLTAGE_1, this.bufferedVoltage1 );
tag.setDouble( TAG_BUFFERED_VOLTAGE_2, this.bufferedVoltage2 );
}
@Override
public void onTunnelConfigChange()
{
this.updateSinkSource();
this.getHost().partChanged();
}
@Override
public void onTunnelNetworkChange()
{
this.updateSinkSource();
this.getHost().notifyNeighbors();
}
@Override
public void removeFromWorld()
{
super.removeFromWorld();
this.invalidateSinkSource();
}
@Override
public void addToWorld()
{
super.addToWorld();
this.updateSinkSource();
}
@Override
public IPartModel getStaticModels()
{
return MODELS.getModel( this.isPowered(), this.isActive() );
}
@PartModels
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
private void updateSinkSource()
{
if( this.sinkSource == null )
{
this.sinkSource = new SinkSource( this.getHost().getTile().getWorld(), this.getHost().getLocation().getPos(), 2048, 4, 4 );
}
this.sinkSource.update();
}
private void invalidateSinkSource()
{
if( this.sinkSource != null )
{
this.sinkSource.invalidate();
}
}
private class SinkSource extends BasicSinkSource
{
SinkSource( World world, BlockPos pos, int i, int j, int k )
{
super( world, pos, i, j, k );
}
@Override
public boolean emitsEnergyTo( IEnergyAcceptor receiver, EnumFacing side )
{
return PartP2PIC2Power.this.isOutput() && side == PartP2PIC2Power.this.getSide().getFacing();
}
@Override
public boolean acceptsEnergyFrom( IEnergyEmitter emitter, EnumFacing side )
{
return !PartP2PIC2Power.this.isOutput() && side == PartP2PIC2Power.this.getSide().getFacing();
}
@Override
public double getDemandedEnergy()
{
if( PartP2PIC2Power.this.isOutput() )
{
return 0;
}
try
{
for( PartP2PIC2Power t : PartP2PIC2Power.this.getOutputs() )
{
if( t.bufferedEnergy1 <= 0.0001 || t.bufferedEnergy2 <= 0.0001 )
{
return 2048;
}
}
}
catch( GridAccessException e )
{
return 0;
}
return 0;
}
@Override
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
{
TunnelCollection<PartP2PIC2Power> outs;
try
{
outs = PartP2PIC2Power.this.getOutputs();
}
catch( GridAccessException e )
{
return amount;
}
if( outs.isEmpty() )
{
return amount;
}
List<PartP2PIC2Power> options = new ArrayList<>();
for( PartP2PIC2Power o : outs )
{
if( o.bufferedEnergy1 <= 0.01 )
{
options.add( o );
}
}
if( options.isEmpty() )
{
for( PartP2PIC2Power o : outs )
{
if( o.bufferedEnergy2 <= 0.01 )
{
options.add( o );
}
}
}
if( options.isEmpty() )
{
for( PartP2PIC2Power o : outs )
{
options.add( o );
}
}
if( options.isEmpty() )
{
return amount;
}
PartP2PIC2Power x = Platform.pickRandom( options );
if( x != null && x.bufferedEnergy1 <= 0.001 )
{
PartP2PIC2Power.this.queueTunnelDrain( PowerUnits.EU, amount );
x.bufferedEnergy1 = amount;
x.bufferedVoltage1 = voltage;
return 0;
}
if( x != null && x.bufferedEnergy2 <= 0.001 )
{
PartP2PIC2Power.this.queueTunnelDrain( PowerUnits.EU, amount );
x.bufferedEnergy2 = amount;
x.bufferedVoltage2 = voltage;
return 0;
}
return amount;
}
@Override
public double getOfferedEnergy()
{
if( PartP2PIC2Power.this.isOutput() )
{
return PartP2PIC2Power.this.bufferedEnergy1;
}
return 0;
}
@Override
public void drawEnergy( double amount )
{
PartP2PIC2Power.this.bufferedEnergy1 -= amount;
if( PartP2PIC2Power.this.bufferedEnergy1 < 0.001 )
{
PartP2PIC2Power.this.bufferedEnergy1 = PartP2PIC2Power.this.bufferedEnergy2;
PartP2PIC2Power.this.bufferedEnergy2 = 0;
PartP2PIC2Power.this.bufferedVoltage1 = PartP2PIC2Power.this.bufferedVoltage2;
PartP2PIC2Power.this.bufferedVoltage2 = 0;
}
}
}
}
@@ -24,9 +24,9 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@@ -71,7 +71,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
this.cachedInv = null;
final PartP2PItems input = this.getInput();
@@ -129,7 +129,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IItemHa
this.partVisited = true;
if( this.getProxy().isActive() )
{
final EnumFacing facing = this.getSide().getFacing();
final Direction facing = this.getSide().getFacing();
final TileEntity te = this.getTile().getWorld().getTileEntity( this.getTile().getPos().offset( facing ) );
if( te != null && te.hasCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite() ) )
@@ -25,10 +25,10 @@ import java.util.List;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.networking.IGridNode;
@@ -108,7 +108,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
final TileEntity te = this.getTile();
final World w = te.getWorld();
final int newLevel = w.getLightFromNeighbors( te.getPos().offset( this.getSide().getFacing() ) );
final int newLevel = w.getLight( te.getPos().offset( this.getSide().getFacing() ) );
if( this.lastValue != newLevel && this.getProxy().isActive() )
{
@@ -130,7 +130,7 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
if( this.isOutput() && pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
@@ -165,24 +165,24 @@ public class PartP2PLight extends PartP2PTunnel<PartP2PLight> implements IGridTi
if( this.opacity < 0 )
{
final TileEntity te = this.getTile();
this.opacity = 255 - te.getWorld().getBlockLightOpacity( te.getPos().offset( this.getSide().getFacing() ) );
this.opacity = 255 - te.getWorld().getLight( te.getPos().offset( this.getSide().getFacing() ) );
}
return (int) ( emit * ( this.opacity / 255.0f ) );
}
@Override
public void readFromNBT( final NBTTagCompound tag )
public void readFromNBT( final CompoundNBT tag )
{
super.readFromNBT( tag );
this.lastValue = tag.getInteger( "lastValue" );
this.lastValue = tag.getInt( "lastValue" );
}
@Override
public void writeToNBT( final NBTTagCompound tag )
public void writeToNBT( final CompoundNBT tag )
{
super.writeToNBT( tag );
tag.setInteger( "lastValue", this.lastValue );
tag.putInt( "lastValue", this.lastValue );
}
@Override
@@ -1,194 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.parts.p2p;
// import javax.annotation.Nullable;
//
// 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 li.cil.oc.api.API;
// import li.cil.oc.api.Items;
// import li.cil.oc.api.Network;
// import li.cil.oc.api.network.Environment;
// 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.events.MENetworkBootingStatusChange;
// import appeng.api.networking.events.MENetworkChannelsChanged;
// import appeng.api.networking.events.MENetworkEventSubscribe;
// import appeng.api.networking.events.MENetworkPowerStatusChange;
// import appeng.integration.IntegrationRegistry;
// import appeng.integration.IntegrationType;
// import appeng.coremod.annotations.Integration.Interface;
// import appeng.coremod.annotations.Integration.InterfaceList;
//
//
// @InterfaceList( value = { @Interface( iface = "li.cil.oc.api.network.Environment", iname =
// IntegrationType.OpenComputers ), @Interface( iface = "li.cil.oc.api.network.SidedEnvironment", iname =
// IntegrationType.OpenComputers ) } )
// public final class PartP2POpenComputers extends PartP2PTunnel<PartP2POpenComputers> implements Environment,
// SidedEnvironment
// {
// @Nullable
// private final Node node;
//
// public PartP2POpenComputers( final ItemStack is )
// {
// super( is );
//
// if( !IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.OpenComputers ) )
// {
// throw new RuntimeException( "OpenComputers is not installed!" );
// }
//
// // Avoid NPE when called in pre-init phase (part population).
// if( API.network != null )
// {
// this.node = Network.newNode( this, Visibility.None ).create();
// }
// else
// {
// this.node = null; // to satisfy final
// }
// }
//
// @MENetworkEventSubscribe
// public void changeStateA( final MENetworkBootingStatusChange bs )
// {
// this.updateConnections();
// }
//
// @MENetworkEventSubscribe
// public void changeStateB( final MENetworkChannelsChanged bs )
// {
// this.updateConnections();
// }
//
// @MENetworkEventSubscribe
// public void changeStateC( final MENetworkPowerStatusChange bs )
// {
// this.updateConnections();
// }
//
// @Override
// @SideOnly( Side.CLIENT )
// public IIcon getTypeTexture()
// {
// return Items.get( "adapter" ).block().getBlockTextureFromSide( 2 );
// }
//
// @Override
// public void removeFromWorld()
// {
// super.removeFromWorld();
// if( this.node != null )
// {
// this.node.remove();
// }
// }
//
// @Override
// public void onTunnelNetworkChange()
// {
// this.updateConnections();
// }
//
// @Override
// public void readFromNBT( final NBTTagCompound data )
// {
// super.readFromNBT( data );
// if( this.node != null )
// {
// this.node.load( data );
// }
// }
//
// @Override
// public void writeToNBT( final NBTTagCompound data )
// {
// super.writeToNBT( data );
// if( this.node != null )
// {
// this.node.save( data );
// }
// }
//
// private void updateConnections()
// {
// if( this.getProxy().isPowered() && this.getProxy().isActive() )
// {
// // Make sure we're connected to existing OC nodes in the world.
// Network.joinOrCreateNetwork( this.getTile() );
//
// if( this.isOutput() && this.getInput() != null && this.node != null )
// {
// Network.joinOrCreateNetwork( this.getInput().getTile() );
// this.node.connect( this.getInput().node() );
// }
// }
// else if( this.node != null )
// {
// this.node.remove();
// }
// }
//
// @Nullable
// @Override
// public Node node()
// {
// return this.node;
// }
//
// @Override
// public void onConnect( final Node node )
// {
// }
//
// @Override
// public void onDisconnect( final Node node )
// {
// }
//
// @Override
// public void onMessage( final Message message )
// {
// }
//
// @Nullable
// @Override
// public Node sidedNode( final ForgeDirection side )
// {
// return side == this.getSide() ? this.node : null;
// }
//
// @Override
// public boolean canConnect( final ForgeDirection side )
// {
// return side == this.getSide();
// }
// }
@@ -22,13 +22,13 @@ package appeng.parts.p2p;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRedstoneWire;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.block.RedstoneWireBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import appeng.api.networking.events.MENetworkBootingStatusChange;
@@ -105,7 +105,7 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
Platform.notifyBlocksOfNeighbors( world, this.getTile().getPos() );
// and this cause sometimes it can go thought walls.
for( final EnumFacing face : EnumFacing.VALUES )
for( final Direction face : Direction.values() )
{
Platform.notifyBlocksOfNeighbors( world, this.getTile().getPos().offset( face ) );
}
@@ -124,17 +124,17 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
}
@Override
public void readFromNBT( final NBTTagCompound tag )
public void readFromNBT( final CompoundNBT tag )
{
super.readFromNBT( tag );
this.power = tag.getInteger( "power" );
this.power = tag.getInt( "power" );
}
@Override
public void writeToNBT( final NBTTagCompound tag )
public void writeToNBT( final CompoundNBT tag )
{
super.writeToNBT( tag );
tag.setInteger( "power", this.power );
tag.putInt( "power", this.power );
}
@Override
@@ -149,20 +149,20 @@ public class PartP2PRedstone extends PartP2PTunnel<PartP2PRedstone>
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
if( !this.isOutput() )
{
final BlockPos target = this.getTile().getPos().offset( this.getSide().getFacing() );
final IBlockState state = this.getTile().getWorld().getBlockState( target );
final BlockState state = this.getTile().getWorld().getBlockState( target );
final Block b = state.getBlock();
if( b != null && !this.isOutput() )
{
EnumFacing srcSide = this.getSide().getFacing();
if( b instanceof BlockRedstoneWire )
Direction srcSide = this.getSide().getFacing();
if( b instanceof RedstoneWireBlock )
{
srcSide = EnumFacing.UP;
srcSide = Direction.UP;
}
this.power = b.getWeakPower( state, this.getTile().getWorld(), target, srcSide );
@@ -26,10 +26,10 @@ import java.util.Optional;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Vec3d;
import appeng.api.AEApi;
@@ -134,7 +134,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.setOutput( data.getBoolean( "output" ) );
@@ -142,11 +142,11 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setBoolean( "output", this.isOutput() );
data.setShort( "freq", this.getFrequency() );
data.putBoolean( "output", this.isOutput() );
data.putShort( "freq", this.getFrequency() );
}
@Override
@@ -178,14 +178,14 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( Platform.isClient() )
{
return true;
}
if( hand == EnumHand.OFF_HAND )
if( hand == Hand.OFF_HAND )
{
return false;
}
@@ -199,9 +199,9 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
if( !is.isEmpty() && is.getItem() instanceof IMemoryCard )
{
final IMemoryCard mc = (IMemoryCard) is.getItem();
final NBTTagCompound data = mc.getData( is );
final CompoundNBT data = mc.getData( is );
final ItemStack newType = new ItemStack( data );
final ItemStack newType = ItemStack.read( data );
final short freq = data.getShort( "freq" );
if( !newType.isEmpty() )
@@ -325,7 +325,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
@Override
public boolean onPartShiftActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartShiftActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
final ItemStack is = player.inventory.getCurrentItem();
if( !is.isEmpty() && is.getItem() instanceof IMemoryCard )
@@ -336,7 +336,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
}
final IMemoryCard mc = (IMemoryCard) is.getItem();
final NBTTagCompound data = mc.getData( is );
final CompoundNBT data = mc.getData( is );
final short storedFrequency = data.getShort( "freq" );
short newFreq = this.getFrequency();
@@ -362,10 +362,10 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
this.onTunnelConfigChange();
final ItemStack p2pItem = this.getItemStack( PartItemStack.WRENCH );
final String type = p2pItem.getUnlocalizedName();
final String type = p2pItem.getTranslationKey();
p2pItem.writeToNBT( data );
data.setShort( "freq", this.getFrequency() );
p2pItem.write( data );
data.putShort( "freq", this.getFrequency() );
final AEColor[] colors = Platform.p2p().toColors( this.getFrequency() );
final int[] colorCode = new int[] {
@@ -373,7 +373,7 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
colors[2].ordinal(), colors[2].ordinal(), colors[3].ordinal(), colors[3].ordinal(),
};
data.setIntArray( "colorCode", colorCode );
data.putIntArray( "colorCode", colorCode );
mc.setMemoryCardContents( is, type + ".name", data );
if( needsNewFrequency )
@@ -24,11 +24,11 @@ import java.util.EnumSet;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import appeng.api.AEApi;
import appeng.api.exceptions.FailedConnectionException;
@@ -73,14 +73,14 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public void readFromNBT( final NBTTagCompound extra )
public void readFromNBT( final CompoundNBT extra )
{
super.readFromNBT( extra );
this.outerProxy.readFromNBT( extra );
}
@Override
public void writeToNBT( final NBTTagCompound extra )
public void writeToNBT( final CompoundNBT extra )
{
super.writeToNBT( extra );
this.outerProxy.writeToNBT( extra );
@@ -137,7 +137,7 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
}
@Override
public void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
public void onPlacement( final PlayerEntity player, final Hand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, hand, held, side );
this.outerProxy.setOwner( player );
@@ -24,15 +24,15 @@ import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.AEApi;
import appeng.api.implementations.parts.IPartStorageMonitor;
@@ -82,24 +82,24 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.isLocked = data.getBoolean( "isLocked" );
final NBTTagCompound myItem = data.getCompoundTag( "configuredItem" );
final CompoundNBT myItem = data.getCompoundTag( "configuredItem" );
this.configuredItem = AEItemStack.fromNBT( myItem );
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setBoolean( "isLocked", this.isLocked );
final NBTTagCompound myItem = new NBTTagCompound();
final CompoundNBT myItem = new CompoundNBT();
if( this.configuredItem != null )
{
this.configuredItem.writeToNBT( myItem );
@@ -145,7 +145,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( Platform.isClient() )
{
@@ -179,7 +179,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
}
@Override
public boolean onPartShiftActivate( EntityPlayer player, EnumHand hand, Vec3d pos )
public boolean onPartShiftActivate( PlayerEntity player, Hand hand, Vec3d pos )
{
if( Platform.isClient() )
{
@@ -251,7 +251,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
}
@Override
@SideOnly( Side.CLIENT )
@OnlyIn( Dist.CLIENT )
public void renderDynamic( double x, double y, double z, float partialTicks, int destroyStage )
{
@@ -270,7 +270,7 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
GlStateManager.pushMatrix();
GlStateManager.translate( x + 0.5, y + 0.5, z + 0.5 );
EnumFacing facing = this.getSide().getFacing();
Direction facing = this.getSide().getFacing();
TesrRenderHelper.moveToFace( facing );
TesrRenderHelper.rotateToFace( facing, this.getSpin() );
@@ -23,15 +23,15 @@ import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IBlockReader;
import appeng.api.implementations.IPowerChannelState;
import appeng.api.implementations.parts.IPartMonitor;
@@ -115,7 +115,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
}
@Override
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor )
{
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
{
@@ -125,14 +125,14 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.spin = data.getByte( "spin" );
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setByte( "spin", this.getSpin() );
@@ -195,7 +195,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
final TileEntity te = this.getTile();
@@ -236,7 +236,7 @@ public abstract class AbstractPartReporting extends AEBasePart implements IPartM
}
@Override
public final void onPlacement( final EntityPlayer player, final EnumHand hand, final ItemStack held, final AEPartLocation side )
public final void onPlacement( final PlayerEntity player, final Hand hand, final ItemStack held, final AEPartLocation side )
{
super.onPlacement( player, hand, held, side );
@@ -21,10 +21,10 @@ package appeng.parts.reporting;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumHand;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.items.IItemHandler;
@@ -95,7 +95,7 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.cm.readFromNBT( data );
@@ -103,7 +103,7 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
this.cm.writeToNBT( data );
@@ -111,7 +111,7 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( !super.onPartActivate( player, hand, pos ) )
{
@@ -123,7 +123,7 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
return true;
}
public GuiBridge getGui( final EntityPlayer player )
public GuiBridge getGui( final PlayerEntity player )
{
return GuiBridge.GUI_ME;
}
@@ -22,10 +22,10 @@ package appeng.parts.reporting;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.items.IItemHandler;
@@ -74,7 +74,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
@Override
public boolean onPartActivate( EntityPlayer player, EnumHand hand, Vec3d pos )
public boolean onPartActivate( PlayerEntity player, Hand hand, Vec3d pos )
{
if( Platform.isClient() )
{
@@ -121,7 +121,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
@Override
public boolean onClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
public boolean onClicked( PlayerEntity player, Hand hand, Vec3d pos )
{
if( Platform.isClient() )
{
@@ -147,7 +147,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
@Override
public boolean onShiftClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
public boolean onShiftClicked( PlayerEntity player, Hand hand, Vec3d pos )
{
if( Platform.isClient() )
{
@@ -172,7 +172,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
return true;
}
private void insertItem( final EntityPlayer player, final EnumHand hand, final boolean allItems )
private void insertItem( final PlayerEntity player, final Hand hand, final boolean allItems )
{
try
{
@@ -219,7 +219,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
}
}
private void extractItem( final EntityPlayer player, int count )
private void extractItem( final PlayerEntity player, int count )
{
final IAEItemStack input = this.getDisplayed();
if( input != null )
@@ -21,9 +21,9 @@ package appeng.parts.reporting;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.IItemHandler;
@@ -71,21 +71,21 @@ public class PartCraftingTerminal extends AbstractPartTerminal
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.craftingGrid.readFromNBT( data, "craftingGrid" );
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
this.craftingGrid.writeToNBT( data, "craftingGrid" );
}
@Override
public GuiBridge getGui( final EntityPlayer p )
public GuiBridge getGui( final PlayerEntity p )
{
int x = (int) p.posX;
int y = (int) p.posY;
@@ -19,9 +19,9 @@
package appeng.parts.reporting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.Vec3d;
@@ -51,7 +51,7 @@ public class PartInterfaceTerminal extends AbstractPartDisplay
}
@Override
public boolean onPartActivate( final EntityPlayer player, final EnumHand hand, final Vec3d pos )
public boolean onPartActivate( final PlayerEntity player, final Hand hand, final Vec3d pos )
{
if( !super.onPartActivate( player, hand, pos ) )
{
@@ -21,9 +21,9 @@ package appeng.parts.reporting;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.items.IItemHandler;
@@ -78,7 +78,7 @@ public class PartPatternTerminal extends AbstractPartTerminal
}
@Override
public void readFromNBT( final NBTTagCompound data )
public void readFromNBT( final CompoundNBT data )
{
super.readFromNBT( data );
this.setCraftingRecipe( data.getBoolean( "craftingMode" ) );
@@ -89,7 +89,7 @@ public class PartPatternTerminal extends AbstractPartTerminal
}
@Override
public void writeToNBT( final NBTTagCompound data )
public void writeToNBT( final CompoundNBT data )
{
super.writeToNBT( data );
data.setBoolean( "craftingMode", this.craftingMode );
@@ -100,7 +100,7 @@ public class PartPatternTerminal extends AbstractPartTerminal
}
@Override
public GuiBridge getGui( final EntityPlayer p )
public GuiBridge getGui( final PlayerEntity p )
{
int x = (int) p.posX;
int y = (int) p.posY;