diff --git a/src/api/java/appeng/api/config/SecurityPermissions.java b/src/api/java/appeng/api/config/SecurityPermissions.java index c3e69062a..8275a48f7 100644 --- a/src/api/java/appeng/api/config/SecurityPermissions.java +++ b/src/api/java/appeng/api/config/SecurityPermissions.java @@ -57,15 +57,15 @@ public enum SecurityPermissions */ SECURITY; - private final String unlocalizedName = "gui.appliedenergistics2.security." + this.name().toLowerCase(); + private final String translationKey = "gui.appliedenergistics2.security." + this.name().toLowerCase(); - public String getUnlocalizedName() + public String getTranslatedName() { - return this.unlocalizedName + ".name"; + return this.translationKey + ".name"; } - public String getUnlocalizedTip() + public String getTranslatedTip() { - return this.unlocalizedName + ".tip"; + return this.translationKey + ".tip"; } } diff --git a/src/api/java/appeng/api/definitions/IBlockDefinition.java b/src/api/java/appeng/api/definitions/IBlockDefinition.java index 237d83b0c..b1d2cde04 100644 --- a/src/api/java/appeng/api/definitions/IBlockDefinition.java +++ b/src/api/java/appeng/api/definitions/IBlockDefinition.java @@ -37,7 +37,7 @@ public interface IBlockDefinition extends IItemDefinition /** * @return the {@link ItemBlock} implementation if applicable */ - Optional maybeItemBlock(); + Optional maybeBlockItem(); /** * Compare Block with world. diff --git a/src/api/java/appeng/api/parts/IFacadePart.java b/src/api/java/appeng/api/parts/IFacadePart.java index 737a6385a..7e991169c 100644 --- a/src/api/java/appeng/api/parts/IFacadePart.java +++ b/src/api/java/appeng/api/parts/IFacadePart.java @@ -60,8 +60,6 @@ public interface IFacadePart Item getItem(); - int getItemDamage(); - boolean notAEFacade(); boolean isTransparent(); diff --git a/src/api/java/appeng/api/parts/IPartHelper.java b/src/api/java/appeng/api/parts/IPartHelper.java index 4e8cc1769..ffe9a7c58 100644 --- a/src/api/java/appeng/api/parts/IPartHelper.java +++ b/src/api/java/appeng/api/parts/IPartHelper.java @@ -35,33 +35,6 @@ import net.minecraft.world.World; public interface IPartHelper { - /** - * Register a new layer with the part layer system, this allows you to write an in between between tile entities and - * parts. - * - * AE By Default includes, - * - * 1. ISidedInventory ( and by extension IInventory. ) - * - * 2. IFluidHandler Forge Fluids - * - * 3. IPowerEmitter BC Power output. - * - * 4. IPowerReceptor BC Power input. - * - * 5. IEnergySink IC2 Power input. - * - * 6. IEnergySource IC2 Power output. - * - * 7. IPipeConnection BC Pipe Connections - * - * As long as a valid layer is registered for a interface you can simply implement that interface on a part get - * implement it. - * - * @return true on success, false on failure, usually a error will be logged as well. - */ - boolean registerNewLayer( String string, String layerInterface ); - /** * use in use item, to try and place a IBusItem * diff --git a/src/api/java/appeng/api/storage/data/IAEItemStack.java b/src/api/java/appeng/api/storage/data/IAEItemStack.java index f0e983c97..cdda428c4 100644 --- a/src/api/java/appeng/api/storage/data/IAEItemStack.java +++ b/src/api/java/appeng/api/storage/data/IAEItemStack.java @@ -83,11 +83,6 @@ public interface IAEItemStack extends IAEStack */ int getItemDamage(); - /** - * Compare the Ore Dictionary ID for this to another item. - */ - boolean sameOre( IAEItemStack is ); - /** * compare the item/damage/nbt of the stack. * @@ -108,7 +103,7 @@ public interface IAEItemStack extends IAEStack /** * DO NOT MODIFY THIS STACK! NEVER. If you think about it .. DON'T - * + * * @return definition stack */ ItemStack getDefinition(); diff --git a/src/api/java/appeng/api/storage/data/IAEStack.java b/src/api/java/appeng/api/storage/data/IAEStack.java index 68d8daa1a..1f6707fd2 100644 --- a/src/api/java/appeng/api/storage/data/IAEStack.java +++ b/src/api/java/appeng/api/storage/data/IAEStack.java @@ -26,10 +26,9 @@ package appeng.api.storage.data; import java.io.IOException; -import io.netty.buffer.ByteBuf; - import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import appeng.api.config.FuzzyMode; import appeng.api.storage.IStorageChannel; @@ -165,7 +164,7 @@ public interface IAEStack> * * @throws IOException */ - void writeToPacket( ByteBuf data ) throws IOException; + void writeToPacket( PacketBuffer data ) throws IOException; /** * Clone the Item / Fluid Stack diff --git a/src/main/java/appeng/block/AEBaseBlock.java b/src/main/java/appeng/block/AEBaseBlock.java index e7fb5b15c..b98b5ea84 100644 --- a/src/main/java/appeng/block/AEBaseBlock.java +++ b/src/main/java/appeng/block/AEBaseBlock.java @@ -25,26 +25,26 @@ import java.util.List; import javax.annotation.Nullable; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockStateContainer; import net.minecraft.client.Minecraft; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.state.IProperty; +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.RayTraceResult; 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.util.IOrientable; import appeng.api.util.IOrientableBlock; @@ -101,20 +101,20 @@ public abstract class AEBaseBlock extends Block } @Override - public final boolean isNormalCube( IBlockState state ) + public final boolean isNormalCube( BlockState state ) { return this.isFullSize() && this.isOpaque(); } @Override - public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos ) + public AxisAlignedBB getBoundingBox( BlockState state, IBlockReader source, BlockPos pos ) { return this.boundingBox; } @SuppressWarnings( "deprecation" ) @Override - public void addCollisionBoxToList( final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, @Nullable final Entity e, boolean p_185477_7_ ) + public void addCollisionBoxToList( final BlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, @Nullable final Entity e, boolean p_185477_7_ ) { final ICustomCollision collisionHandler = this.getCustomCollision( w, pos ); @@ -139,8 +139,8 @@ public abstract class AEBaseBlock extends Block @SuppressWarnings( "deprecation" ) @Override - @SideOnly( Side.CLIENT ) - public AxisAlignedBB getSelectedBoundingBox( IBlockState state, final World w, final BlockPos pos ) + @OnlyIn( Dist.CLIENT ) + public AxisAlignedBB getSelectedBoundingBox( BlockState state, final World w, final BlockPos pos ) { final ICustomCollision collisionHandler = this.getCustomCollision( w, pos ); @@ -148,10 +148,10 @@ public abstract class AEBaseBlock extends Block { if( Platform.isClient() ) { - final EntityPlayer player = Minecraft.getMinecraft().player; + final PlayerEntity player = Minecraft.getInstance().player; final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) ); - final Iterable bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().player, true ); + final Iterable bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getInstance().player, true ); AxisAlignedBB br = null; double lastDist = 0; @@ -225,14 +225,14 @@ public abstract class AEBaseBlock extends Block } @Override - public final boolean isOpaqueCube( IBlockState state ) + public final boolean isOpaqueCube( BlockState state ) { return this.isOpaque(); } @SuppressWarnings( "deprecation" ) @Override - public RayTraceResult collisionRayTrace( final IBlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b ) + public RayTraceResult collisionRayTrace( final BlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b ) { final ICustomCollision collisionHandler = this.getCustomCollision( w, pos ); @@ -279,25 +279,25 @@ public abstract class AEBaseBlock extends Block } @Override - public boolean hasComparatorInputOverride( IBlockState state ) + public boolean hasComparatorInputOverride( BlockState state ) { return this.isInventory(); } @Override - public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos ) + public int getComparatorInputOverride( BlockState state, final World worldIn, final BlockPos pos ) { return 0; } @Override - public final boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos ) + public final boolean isNormalCube( BlockState state, final IBlockReader world, final BlockPos pos ) { return this.isFullSize(); } @Override - public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis ) + public boolean rotateBlock( final World w, final BlockPos pos, final Direction axis ) { final IOrientable rotatable = this.getOrientable( w, pos ); @@ -310,8 +310,8 @@ public abstract class AEBaseBlock extends Block } else { - EnumFacing forward = rotatable.getForward(); - EnumFacing up = rotatable.getUp(); + Direction forward = rotatable.getForward(); + Direction up = rotatable.getUp(); for( int rs = 0; rs < 4; rs++ ) { @@ -331,24 +331,24 @@ public abstract class AEBaseBlock extends Block } @Override - public EnumFacing[] getValidRotations( final World w, final BlockPos pos ) + public Direction[] getValidRotations( final World w, final BlockPos pos ) { - return new EnumFacing[0]; + return new Direction[0]; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void addInformation( final ItemStack is, final World world, final List lines, final ITooltipFlag advancedItemTooltips ) { } - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { return false; } - public final EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir ) + public final Direction mapRotation( final IOrientable ori, final Direction dir ) { // case DOWN: return bottomIcon; // case UP: return blockIcon; @@ -357,8 +357,8 @@ public abstract class AEBaseBlock extends Block // case WEST: return sideIcon; // case EAST: return sideIcon; - final EnumFacing forward = ori.getForward(); - final EnumFacing up = ori.getUp(); + final Direction forward = ori.getForward(); + final Direction up = ori.getUp(); if( forward == null || up == null ) { @@ -369,8 +369,8 @@ public abstract class AEBaseBlock extends Block final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ(); final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX(); - EnumFacing west = null; - for( final EnumFacing dx : EnumFacing.VALUES ) + Direction west = null; + for( final Direction dx : Direction.VALUES ) { if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z ) { @@ -385,29 +385,29 @@ public abstract class AEBaseBlock extends Block if( dir == forward ) { - return EnumFacing.SOUTH; + return Direction.SOUTH; } if( dir == forward.getOpposite() ) { - return EnumFacing.NORTH; + return Direction.NORTH; } if( dir == up ) { - return EnumFacing.UP; + return Direction.UP; } if( dir == up.getOpposite() ) { - return EnumFacing.DOWN; + return Direction.DOWN; } if( dir == west ) { - return EnumFacing.WEST; + return Direction.WEST; } if( dir == west.getOpposite() ) { - return EnumFacing.EAST; + return Direction.EAST; } return null; @@ -420,9 +420,9 @@ public abstract class AEBaseBlock extends Block return this.getClass().getSimpleName() + "[" + regName + "]"; } - protected String getUnlocalizedName( final ItemStack is ) + protected String getTranslationKey( final ItemStack is ) { - return this.getUnlocalizedName(); + return this.getTranslationKey(); } protected boolean hasCustomRotation() @@ -430,12 +430,12 @@ public abstract class AEBaseBlock extends Block return false; } - protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis ) + protected void customRotateBlock( final IOrientable rotatable, final Direction axis ) { } - protected IOrientable getOrientable( final IBlockAccess w, final BlockPos pos ) + protected IOrientable getOrientable( final IBlockReader w, final BlockPos pos ) { if( this instanceof IOrientableBlock ) { @@ -445,7 +445,7 @@ public abstract class AEBaseBlock extends Block return null; } - protected boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up ) + protected boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) { return true; } diff --git a/src/main/java/appeng/block/AEBaseItemBlock.java b/src/main/java/appeng/block/AEBaseItemBlock.java index 8062cd01d..670ede7fd 100644 --- a/src/main/java/appeng/block/AEBaseItemBlock.java +++ b/src/main/java/appeng/block/AEBaseItemBlock.java @@ -22,17 +22,17 @@ package appeng.block; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.util.ITooltipFlag; -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.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; 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.util.IOrientable; import appeng.api.util.IOrientableBlock; @@ -43,12 +43,12 @@ import appeng.me.helpers.IGridProxyable; import appeng.tile.AEBaseTile; -public class AEBaseItemBlock extends ItemBlock +public class AEBaseBlockItem extends BlockItem { private final AEBaseBlock blockType; - public AEBaseItemBlock( final Block id ) + public AEBaseBlockItem( final Block id ) { super( id ); this.blockType = (AEBaseBlock) id; @@ -66,13 +66,13 @@ public class AEBaseItemBlock extends ItemBlock } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public final void addInformation( final ItemStack itemStack, final World world, final List toolTip, final ITooltipFlag advancedTooltips ) { this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack itemStack, final World world, final List toolTip, final ITooltipFlag advancedTooltips ) { this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips ); @@ -85,46 +85,46 @@ public class AEBaseItemBlock extends ItemBlock } @Override - public String getUnlocalizedName( final ItemStack is ) + public String getTranslationKey( final ItemStack is ) { - return this.blockType.getUnlocalizedName( is ); + return this.blockType.getTranslationKey( is ); } @Override - public boolean placeBlockAt( final ItemStack stack, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final IBlockState newState ) + public boolean placeBlockAt( final ItemStack stack, final PlayerEntity player, final World w, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final BlockState newState ) { - EnumFacing up = null; - EnumFacing forward = null; + Direction up = null; + Direction forward = null; if( this.blockType instanceof AEBaseTileBlock ) { if( this.blockType instanceof BlockLightDetector ) { up = side; - if( up == EnumFacing.UP || up == EnumFacing.DOWN ) + if( up == Direction.UP || up == Direction.DOWN ) { - forward = EnumFacing.SOUTH; + forward = Direction.SOUTH; } else { - forward = EnumFacing.UP; + forward = Direction.UP; } } else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass ) { forward = side; - if( forward == EnumFacing.UP || forward == EnumFacing.DOWN ) + if( forward == Direction.UP || forward == Direction.DOWN ) { - up = EnumFacing.SOUTH; + up = Direction.SOUTH; } else { - up = EnumFacing.UP; + up = Direction.UP; } } else { - up = EnumFacing.UP; + up = Direction.UP; final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 ); @@ -132,28 +132,28 @@ public class AEBaseItemBlock extends ItemBlock { default: case 0: - forward = EnumFacing.SOUTH; + forward = Direction.SOUTH; break; case 1: - forward = EnumFacing.WEST; + forward = Direction.WEST; break; case 2: - forward = EnumFacing.NORTH; + forward = Direction.NORTH; break; case 3: - forward = EnumFacing.EAST; + forward = Direction.EAST; break; } if( player.rotationPitch > 65 ) { up = forward.getOpposite(); - forward = EnumFacing.UP; + forward = Direction.UP; } else if( player.rotationPitch < -65 ) { up = forward.getOpposite(); - forward = EnumFacing.DOWN; + forward = Direction.DOWN; } } } @@ -163,10 +163,10 @@ public class AEBaseItemBlock extends ItemBlock { ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos ); up = side; - forward = EnumFacing.SOUTH; + forward = Direction.SOUTH; if( up.getFrontOffsetY() == 0 ) { - forward = EnumFacing.UP; + forward = Direction.UP; } } diff --git a/src/main/java/appeng/block/AEBaseItemBlockChargeable.java b/src/main/java/appeng/block/AEBaseItemBlockChargeable.java index 2b9a16797..b82c5e9b7 100644 --- a/src/main/java/appeng/block/AEBaseItemBlockChargeable.java +++ b/src/main/java/appeng/block/AEBaseItemBlockChargeable.java @@ -25,10 +25,10 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; 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.config.AccessRestriction; import appeng.api.config.Actionable; @@ -40,19 +40,19 @@ import appeng.core.localization.GuiText; import appeng.util.Platform; -public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage +public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage { - public AEBaseItemBlockChargeable( final Block id ) + public AEBaseBlockItemChargeable( final Block id ) { super( id ); } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { - final NBTTagCompound tag = stack.getTagCompound(); + final CompoundNBT tag = stack.getTagCompound(); double internalCurrentPower = 0; final double internalMaxPower = this.getMaxEnergyCapacity(); @@ -143,13 +143,13 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte private double getInternal( final ItemStack is ) { - final NBTTagCompound nbt = Platform.openNbtData( is ); + final CompoundNBT nbt = Platform.openNbtData( is ); return nbt.getDouble( "internalCurrentPower" ); } private void setInternal( final ItemStack is, final double amt ) { - final NBTTagCompound nbt = Platform.openNbtData( is ); + final CompoundNBT nbt = Platform.openNbtData( is ); nbt.setDouble( "internalCurrentPower", amt ); } } diff --git a/src/main/java/appeng/block/AEBaseTileBlock.java b/src/main/java/appeng/block/AEBaseTileBlock.java index 0f19c57bf..9665094f2 100644 --- a/src/main/java/appeng/block/AEBaseTileBlock.java +++ b/src/main/java/appeng/block/AEBaseTileBlock.java @@ -28,20 +28,23 @@ import javax.annotation.Nullable; import com.google.common.collect.Lists; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.BlockStateContainer; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumDyeColor; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.DyeColor; 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.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorld; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -78,7 +81,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity public static final UnlistedDirection UP = new UnlistedDirection( "up" ); @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { // A subclass may decide it doesn't want extended block state for whatever reason if( !( state instanceof IExtendedBlockState ) ) @@ -106,7 +109,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public int getMetaFromState( IBlockState state ) + public int getMetaFromState( BlockState state ) { return 0; } @@ -119,7 +122,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public boolean hasTileEntity( IBlockState state ) + public boolean hasTileEntity( BlockState state ) { return this.hasBlockTileEntity(); } @@ -135,13 +138,13 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Nullable - public T getTileEntity( final IBlockAccess w, final int x, final int y, final int z ) + public T getTileEntity( final IBlockReader w, final int x, final int y, final int z ) { return this.getTileEntity( w, new BlockPos( x, y, z ) ); } @Nullable - public T getTileEntity( final IBlockAccess w, final BlockPos pos ) + public T getTileEntity( final IBlockReader w, final BlockPos pos ) { if( !this.hasBlockTileEntity() ) { @@ -158,7 +161,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public final TileEntity createNewTileEntity( final World var1, final int var2 ) + public final TileEntity createTileEntity( BlockState state, IBlockReader world ) { if( this.hasBlockTileEntity() ) { @@ -180,7 +183,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public void breakBlock( final World w, final BlockPos pos, final IBlockState state ) + public void breakBlock( final World w, final BlockPos pos, final BlockState state ) { final AEBaseTile te = this.getTileEntity( w, pos ); if( te != null ) @@ -204,19 +207,19 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public final EnumFacing[] getValidRotations( final World w, final BlockPos pos ) + public final Direction[] getValidRotations( final World w, final BlockPos pos ) { final AEBaseTile obj = this.getTileEntity( w, pos ); if( obj != null && obj.canBeRotated() ) { - return EnumFacing.VALUES; + return Direction.values(); } return super.getValidRotations( w, pos ); } @Override - public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color ) + public boolean recolorBlock( BlockState state, final IWorld world, final BlockPos pos, final Direction side, final DyeColor color ) { final TileEntity te = this.getTileEntity( world, pos ); @@ -224,7 +227,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity { final IColorableTile ct = (IColorableTile) te; final AEColor c = ct.getColor(); - final AEColor newColor = AEColor.values()[color.getMetadata()]; + final AEColor newColor = AEColor.values()[color.ordinal()]; if( c != newColor ) { @@ -234,11 +237,11 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity return false; } - return super.recolorBlock( world, pos, side, color ); + return super.recolorBlock( state, world, pos, side, color ); } @Override - public int getComparatorInputOverride( IBlockState state, final World w, final BlockPos pos ) + public int getComparatorInputOverride( BlockState state, final World w, final BlockPos pos ) { final TileEntity te = this.getTileEntity( w, pos ); if( te instanceof AEBaseInvTile ) @@ -253,7 +256,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public boolean eventReceived( final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam ) + public boolean eventReceived( final BlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam ) { super.eventReceived( state, worldIn, pos, eventID, eventParam ); final TileEntity tileentity = worldIn.getTileEntity( pos ); @@ -261,7 +264,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public void onBlockPlacedBy( final World w, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack is ) + public void onBlockPlacedBy( final World w, final BlockPos pos, final BlockState state, final LivingEntity placer, final ItemStack is ) { if( is.hasDisplayName() ) { @@ -274,16 +277,16 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ ) + public ActionResultType onBlockActivated( BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit ) { ItemStack heldItem; if( player != null && !player.getHeldItem( hand ).isEmpty() ) { heldItem = player.getHeldItem( hand ); - if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() ) + if( Platform.isWrench( player, heldItem, pos ) && player.isShiftKeyDown() ) { - final IBlockState blockState = world.getBlockState( pos ); + final BlockState blockState = world.getBlockState( pos ); final Block block = blockState.getBlock(); if( block == null ) @@ -310,10 +313,10 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity { if( Platform.itemComparisons().isEqualItemType( ol, op ) ) { - final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM ); + final CompoundNBT tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM ); if( tag != null ) { - ol.setTagCompound( tag ); + ol.setTag( tag ); } } } @@ -338,11 +341,11 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity return false; } - final String name = this.getUnlocalizedName(); + final String name = this.getTranslationKey(); - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { - final NBTTagCompound data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD ); + final CompoundNBT data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD ); if( data != null ) { memoryCard.setMemoryCardContents( heldItem, name, data ); @@ -352,9 +355,9 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity else { final String savedName = memoryCard.getSettingsName( heldItem ); - final NBTTagCompound data = memoryCard.getData( heldItem ); + final CompoundNBT data = memoryCard.getData( heldItem ); - if( this.getUnlocalizedName().equals( savedName ) ) + if( this.getTranslationKey().equals( savedName ) ) { tileEntity.uploadSettings( SettingsFrom.MEMORY_CARD, data ); memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED ); @@ -373,7 +376,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity } @Override - public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos ) + public IOrientable getOrientable( final IBlockReader w, final BlockPos pos ) { return this.getTileEntity( w, pos ); } diff --git a/src/main/java/appeng/block/UnlistedBlockAccess.java b/src/main/java/appeng/block/UnlistedBlockAccess.java index 80eee4c7f..4f12f3d09 100644 --- a/src/main/java/appeng/block/UnlistedBlockAccess.java +++ b/src/main/java/appeng/block/UnlistedBlockAccess.java @@ -19,11 +19,11 @@ package appeng.block; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraftforge.common.property.IUnlistedProperty; -public final class UnlistedBlockAccess implements IUnlistedProperty +public final class UnlistedBlockAccess implements IUnlistedProperty { @Override public String getName() @@ -32,19 +32,19 @@ public final class UnlistedBlockAccess implements IUnlistedProperty getType() + public Class getType() { - return IBlockAccess.class; + return IBlockReader.class; } @Override - public String valueToString( final IBlockAccess value ) + public String valueToString( final IBlockReader value ) { return null; } diff --git a/src/main/java/appeng/block/UnlistedDirection.java b/src/main/java/appeng/block/UnlistedDirection.java index 3e4639d80..6ac95c216 100644 --- a/src/main/java/appeng/block/UnlistedDirection.java +++ b/src/main/java/appeng/block/UnlistedDirection.java @@ -19,11 +19,11 @@ package appeng.block; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.common.property.IUnlistedProperty; -public class UnlistedDirection implements IUnlistedProperty +public class UnlistedDirection implements IUnlistedProperty { private final String name; @@ -40,19 +40,19 @@ public class UnlistedDirection implements IUnlistedProperty } @Override - public boolean isValid( EnumFacing value ) + public boolean isValid( Direction value ) { return value != null; } @Override - public Class getType() + public Class getType() { - return EnumFacing.class; + return Direction.class; } @Override - public String valueToString( EnumFacing value ) + public String valueToString( Direction value ) { return value.getName(); } diff --git a/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java b/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java index a237a0af6..c0c55cfdd 100644 --- a/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java +++ b/src/main/java/appeng/block/crafting/BlockCraftingMonitor.java @@ -19,19 +19,19 @@ package appeng.block.crafting; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; -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.util.AEColor; import appeng.client.UnlistedProperty; @@ -60,11 +60,11 @@ public class BlockCraftingMonitor extends BlockCraftingUnit } @Override - public IExtendedBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public IExtendedBlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { AEColor color = AEColor.TRANSPARENT; - EnumFacing forward = EnumFacing.NORTH; - EnumFacing up = EnumFacing.UP; + Direction forward = Direction.NORTH; + Direction up = Direction.UP; TileCraftingMonitorTile te = this.getTileEntity( world, pos ); if( te != null ) @@ -81,7 +81,7 @@ public class BlockCraftingMonitor extends BlockCraftingUnit } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void getSubBlocks( final CreativeTabs tabs, final NonNullList itemStacks ) { itemStacks.add( new ItemStack( this, 1, 0 ) ); diff --git a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java b/src/main/java/appeng/block/crafting/BlockCraftingUnit.java index 0cb8ce7f7..9176d2416 100644 --- a/src/main/java/appeng/block/crafting/BlockCraftingUnit.java +++ b/src/main/java/appeng/block/crafting/BlockCraftingUnit.java @@ -22,17 +22,17 @@ package appeng.block.crafting; import java.util.EnumSet; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.BlockStateContainer; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.state.IProperty; import net.minecraft.util.BlockRenderLayer; -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.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -69,12 +69,12 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public IExtendedBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public IExtendedBlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { - EnumSet connections = EnumSet.noneOf( EnumFacing.class ); + EnumSet connections = EnumSet.noneOf( Direction.class ); - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { if( this.isConnected( world, pos, facing ) ) { @@ -87,7 +87,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock return extState.withProperty( STATE, new CraftingCubeState( connections ) ); } - private boolean isConnected( IBlockAccess world, BlockPos pos, EnumFacing side ) + private boolean isConnected( IBlockReader world, BlockPos pos, Direction side ) { BlockPos adjacentPos = pos.offset( side ); return world.getBlockState( adjacentPos ).getBlock() instanceof BlockCraftingUnit; @@ -100,13 +100,13 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public IBlockState getStateFromMeta( final int meta ) + public BlockState getStateFromMeta( final int meta ) { return this.getDefaultState().withProperty( POWERED, ( meta & 1 ) == 1 ).withProperty( FORMED, ( meta & 2 ) == 2 ); } @Override - public int getMetaFromState( final IBlockState state ) + public int getMetaFromState( final BlockState state ) { boolean p = state.getValue( POWERED ); boolean f = state.getValue( FORMED ); @@ -114,7 +114,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public void neighborChanged( final IBlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos ) + public void neighborChanged( final BlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos ) { final TileCraftingTile cp = this.getTileEntity( worldIn, pos ); if( cp != null ) @@ -130,7 +130,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public void breakBlock( final World w, final BlockPos pos, final IBlockState state ) + public void breakBlock( final World w, final BlockPos pos, final BlockState state ) { final TileCraftingTile cp = this.getTileEntity( w, pos ); if( cp != null ) @@ -142,11 +142,11 @@ public class BlockCraftingUnit extends AEBaseTileBlock } @Override - public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity p, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ ) { final TileCraftingTile tg = this.getTileEntity( w, pos ); - if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() ) + if( tg != null && !p.isShiftKeyDown() && tg.isFormed() && tg.isActive() ) { if( Platform.isClient() ) { diff --git a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java index 7412e83a0..4d23c32e2 100644 --- a/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java +++ b/src/main/java/appeng/block/crafting/BlockMolecularAssembler.java @@ -22,16 +22,16 @@ package appeng.block.crafting; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.BlockRenderLayer; -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.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.util.AEPartLocation; import appeng.block.AEBaseTileBlock; @@ -60,7 +60,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos ) { boolean powered = false; TileMolecularAssembler te = this.getTileEntity( worldIn, pos ); @@ -76,31 +76,31 @@ public class BlockMolecularAssembler extends AEBaseTileBlock * NOTE: This is only used to determine how to render an item being held in hand. * For determining block rendering, the method below is used (canRenderInLayer). */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override - public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer ) + public boolean canRenderInLayer( BlockState state, BlockRenderLayer layer ) { return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT; } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } @Override - public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity p, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ ) { final TileMolecularAssembler tg = this.getTileEntity( w, pos ); - if( tg != null && !p.isSneaking() ) + if( tg != null && !p.isShiftKeyDown() ) { Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC ); return true; diff --git a/src/main/java/appeng/block/crafting/ItemCraftingStorage.java b/src/main/java/appeng/block/crafting/ItemCraftingStorage.java index b242147b5..a58def29e 100644 --- a/src/main/java/appeng/block/crafting/ItemCraftingStorage.java +++ b/src/main/java/appeng/block/crafting/ItemCraftingStorage.java @@ -23,12 +23,12 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import appeng.api.AEApi; -import appeng.block.AEBaseItemBlock; +import appeng.block.AEBaseBlockItem; import appeng.core.AEConfig; import appeng.core.features.AEFeature; -public class ItemCraftingStorage extends AEBaseItemBlock +public class ItemCraftingStorage extends AEBaseBlockItem { public ItemCraftingStorage( final Block id ) diff --git a/src/main/java/appeng/block/grindstone/BlockCrank.java b/src/main/java/appeng/block/grindstone/BlockCrank.java index 000134704..cfdbee781 100644 --- a/src/main/java/appeng/block/grindstone/BlockCrank.java +++ b/src/main/java/appeng/block/grindstone/BlockCrank.java @@ -24,16 +24,16 @@ import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; -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.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; @@ -57,7 +57,7 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { if( player instanceof FakePlayer || player == null ) { @@ -84,16 +84,16 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public void onBlockPlacedBy( final World world, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack stack ) + public void onBlockPlacedBy( final World world, final BlockPos pos, final BlockState state, final LivingEntity placer, final ItemStack stack ) { final AEBaseTile tile = this.getTileEntity( world, pos ); if( tile != null ) { - final EnumFacing mnt = this.findCrankable( world, pos ); - EnumFacing forward = EnumFacing.UP; - if( mnt == EnumFacing.UP || mnt == EnumFacing.DOWN ) + final Direction mnt = this.findCrankable( world, pos ); + Direction forward = Direction.UP; + if( mnt == Direction.UP || mnt == Direction.DOWN ) { - forward = EnumFacing.SOUTH; + forward = Direction.SOUTH; } tile.setOrientation( forward, mnt.getOpposite() ); } @@ -104,15 +104,15 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up ) + public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) { final TileEntity te = w.getTileEntity( pos ); return !( te instanceof TileCrank ) || this.isCrankable( w, pos, up.getOpposite() ); } - private EnumFacing findCrankable( final World world, final BlockPos pos ) + private Direction findCrankable( final World world, final BlockPos pos ) { - for( final EnumFacing dir : EnumFacing.VALUES ) + for( final Direction dir : Direction.VALUES ) { if( this.isCrankable( world, pos, dir ) ) { @@ -122,7 +122,7 @@ public class BlockCrank extends AEBaseTileBlock return null; } - private boolean isCrankable( final World world, final BlockPos pos, final EnumFacing offset ) + private boolean isCrankable( final World world, final BlockPos pos, final Direction offset ) { final BlockPos o = pos.offset( offset ); final TileEntity te = world.getTileEntity( o ); @@ -131,13 +131,13 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public EnumBlockRenderType getRenderType( IBlockState state ) + public EnumBlockRenderType getRenderType( BlockState state ) { return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final AEBaseTile tile = this.getTileEntity( world, pos ); @@ -161,19 +161,19 @@ public class BlockCrank extends AEBaseTileBlock } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } @Override - public boolean canPlaceTorchOnTop( IBlockState state, IBlockAccess world, BlockPos pos ) + public boolean canPlaceTorchOnTop( BlockState state, IBlockReader world, BlockPos pos ) { return false; } @Override - public BlockFaceShape getBlockFaceShape( IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face ) + public BlockFaceShape getBlockFaceShape( IBlockReader worldIn, BlockState state, BlockPos pos, Direction face ) { return BlockFaceShape.UNDEFINED; } diff --git a/src/main/java/appeng/block/grindstone/BlockGrinder.java b/src/main/java/appeng/block/grindstone/BlockGrinder.java index f494ac9db..6d9cde456 100644 --- a/src/main/java/appeng/block/grindstone/BlockGrinder.java +++ b/src/main/java/appeng/block/grindstone/BlockGrinder.java @@ -22,10 +22,10 @@ package appeng.block.grindstone; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -47,10 +47,10 @@ public class BlockGrinder extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { final TileGrinder tg = this.getTileEntity( w, pos ); - if( tg != null && !p.isSneaking() ) + if( tg != null && !p.isShiftKeyDown() ) { Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_GRINDER ); return true; diff --git a/src/main/java/appeng/block/grindstone/CrankRendering.java b/src/main/java/appeng/block/grindstone/CrankRendering.java index 569b6fa7c..21e45e12b 100644 --- a/src/main/java/appeng/block/grindstone/CrankRendering.java +++ b/src/main/java/appeng/block/grindstone/CrankRendering.java @@ -19,8 +19,8 @@ package appeng.block.grindstone; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -32,7 +32,7 @@ public class CrankRendering extends BlockRenderingCustomizer { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.tesr( new CrankTESR() ); diff --git a/src/main/java/appeng/block/misc/BlockCellWorkbench.java b/src/main/java/appeng/block/misc/BlockCellWorkbench.java index 8e2046631..74cd559bc 100644 --- a/src/main/java/appeng/block/misc/BlockCellWorkbench.java +++ b/src/main/java/appeng/block/misc/BlockCellWorkbench.java @@ -22,10 +22,10 @@ package appeng.block.misc; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -45,9 +45,9 @@ public class BlockCellWorkbench extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } diff --git a/src/main/java/appeng/block/misc/BlockCharger.java b/src/main/java/appeng/block/misc/BlockCharger.java index 82755d98a..5975758df 100644 --- a/src/main/java/appeng/block/misc/BlockCharger.java +++ b/src/main/java/appeng/block/misc/BlockCharger.java @@ -27,23 +27,23 @@ import javax.annotation.Nullable; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import org.lwjgl.util.vector.Matrix4f; -import org.lwjgl.util.vector.Vector3f; +import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.Matrix4f; +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.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.AEApi; import appeng.api.util.AEAxisAlignedBB; @@ -71,9 +71,9 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { return false; } @@ -91,8 +91,8 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision } @Override - @SideOnly( Side.CLIENT ) - public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r ) + @OnlyIn( Dist.CLIENT ) + public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r ) { if( !AEConfig.instance().isEnableEffects() ) { @@ -121,7 +121,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision { final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos .getZ(), 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } } @@ -135,8 +135,8 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision if( tile != null ) { final double twoPixels = 2.0 / 16.0; - final EnumFacing up = tile.getUp(); - final EnumFacing forward = tile.getForward(); + final Direction up = tile.getUp(); + final Direction forward = tile.getForward(); final AEAxisAlignedBB bb = new AEAxisAlignedBB( twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels ); if( up.getFrontOffsetX() != 0 ) @@ -190,13 +190,13 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) ); } - @SideOnly( Side.CLIENT ) - public static TileEntitySpecialRenderer createTesr() + @OnlyIn( Dist.CLIENT ) + public static TileEntityRenderer createTesr() { return new ModularTESR<>( new ItemRenderable<>( BlockCharger::getRenderedItem ) ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private static Pair getRenderedItem( TileCharger tile ) { Matrix4f transform = new Matrix4f(); diff --git a/src/main/java/appeng/block/misc/BlockCondenser.java b/src/main/java/appeng/block/misc/BlockCondenser.java index d4b094a06..c99bfb366 100644 --- a/src/main/java/appeng/block/misc/BlockCondenser.java +++ b/src/main/java/appeng/block/misc/BlockCondenser.java @@ -22,10 +22,10 @@ package appeng.block.misc; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -45,9 +45,9 @@ public class BlockCondenser extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { return false; } @@ -55,7 +55,7 @@ public class BlockCondenser extends AEBaseTileBlock if( Platform.isServer() ) { final TileCondenser tc = this.getTileEntity( w, pos ); - if( tc != null && !player.isSneaking() ) + if( tc != null && !player.isShiftKeyDown() ) { Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CONDENSER ); return true; diff --git a/src/main/java/appeng/block/misc/BlockInscriber.java b/src/main/java/appeng/block/misc/BlockInscriber.java index f5f950c20..cd9b314ee 100644 --- a/src/main/java/appeng/block/misc/BlockInscriber.java +++ b/src/main/java/appeng/block/misc/BlockInscriber.java @@ -22,12 +22,12 @@ package appeng.block.misc; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumBlockRenderType; -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.world.World; @@ -50,9 +50,9 @@ public class BlockInscriber extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } @@ -70,14 +70,14 @@ public class BlockInscriber extends AEBaseTileBlock } @Override - public EnumBlockRenderType getRenderType( IBlockState state ) + public EnumBlockRenderType getRenderType( BlockState state ) { return EnumBlockRenderType.MODEL; } @Override - public String getUnlocalizedName( final ItemStack is ) + public String getTranslationKey( final ItemStack is ) { - return super.getUnlocalizedName( is ); + return super.getTranslationKey( is ); } } diff --git a/src/main/java/appeng/block/misc/BlockInterface.java b/src/main/java/appeng/block/misc/BlockInterface.java index 879e3586a..70a4cb337 100644 --- a/src/main/java/appeng/block/misc/BlockInterface.java +++ b/src/main/java/appeng/block/misc/BlockInterface.java @@ -24,13 +24,13 @@ import javax.annotation.Nullable; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import appeng.api.util.AEPartLocation; @@ -58,7 +58,7 @@ public class BlockInterface extends AEBaseTileBlock } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos ) { // Determine whether the interface is omni-directional or not TileInterface te = this.getTileEntity( world, pos ); @@ -73,9 +73,9 @@ public class BlockInterface extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } @@ -99,7 +99,7 @@ public class BlockInterface extends AEBaseTileBlock } @Override - protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis ) + protected void customRotateBlock( final IOrientable rotatable, final Direction axis ) { if( rotatable instanceof TileInterface ) { diff --git a/src/main/java/appeng/block/misc/BlockLightDetector.java b/src/main/java/appeng/block/misc/BlockLightDetector.java index d4fcf6c2f..58dd484ad 100644 --- a/src/main/java/appeng/block/misc/BlockLightDetector.java +++ b/src/main/java/appeng/block/misc/BlockLightDetector.java @@ -28,16 +28,16 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.util.BlockRenderLayer; -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.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.util.IOrientable; import appeng.api.util.IOrientableBlock; @@ -60,22 +60,22 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl { super( Material.CIRCUITS ); - this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) ); + this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, Direction.UP ).withProperty( ODD, false ) ); this.setLightOpacity( 0 ); this.setFullSize( false ); this.setOpaque( false ); } @Override - public int getMetaFromState( final IBlockState state ) + public int getMetaFromState( final BlockState state ) { return state.getValue( FACING ).ordinal(); } @Override - public IBlockState getStateFromMeta( final int meta ) + public BlockState getStateFromMeta( final int meta ) { - EnumFacing facing = EnumFacing.values()[meta]; + Direction facing = Direction.values()[meta]; return this.getDefaultState().withProperty( FACING, facing ); } @@ -86,7 +86,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public int getWeakPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side ) + public int getWeakPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side ) { if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() ) { @@ -97,7 +97,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public void onNeighborChange( final IBlockAccess world, final BlockPos pos, final BlockPos neighbor ) + public void onNeighborChange( final IBlockReader world, final BlockPos pos, final BlockPos neighbor ) { super.onNeighborChange( world, pos, neighbor ); @@ -109,18 +109,18 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public void randomDisplayTick( final IBlockState state, final World worldIn, final BlockPos pos, final Random rand ) + public void randomDisplayTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand ) { // cancel out lightning } @Override - public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up ) + public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) { return this.canPlaceAt( w, pos, up.getOpposite() ); } - private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir ) + private boolean canPlaceAt( final World w, final BlockPos pos, final Direction dir ) { return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false ); } @@ -128,7 +128,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl @Override public Iterable getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b ) { - final EnumFacing up = this.getOrientable( w, pos ).getUp(); + final Direction up = this.getOrientable( w, pos ).getUp(); final double xOff = -0.3 * up.getFrontOffsetX(); final double yOff = -0.3 * up.getFrontOffsetY(); final double zOff = -0.3 * up.getFrontOffsetZ(); @@ -147,9 +147,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final EnumFacing up = this.getOrientable( world, pos ).getUp(); + final Direction up = this.getOrientable( world, pos ).getUp(); if( !this.canPlaceAt( world, pos, up.getOpposite() ) ) { this.dropTorch( world, pos ); @@ -158,7 +158,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl private void dropTorch( final World w, final BlockPos pos ) { - final IBlockState prev = w.getBlockState( pos ); + final BlockState prev = w.getBlockState( pos ); w.destroyBlock( pos, true ); w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 ); } @@ -166,7 +166,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl @Override public boolean canPlaceBlockAt( final World w, final BlockPos pos ) { - for( final EnumFacing dir : EnumFacing.VALUES ) + for( final Direction dir : Direction.VALUES ) { if( this.canPlaceAt( w, pos, dir ) ) { @@ -183,20 +183,20 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } @Override - public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos ) + public IOrientable getOrientable( final IBlockReader w, final BlockPos pos ) { return new MetaRotation( w, pos, FACING ); } diff --git a/src/main/java/appeng/block/misc/BlockQuartzFixture.java b/src/main/java/appeng/block/misc/BlockQuartzFixture.java index 0ea0d171b..3421fdbf1 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzFixture.java +++ b/src/main/java/appeng/block/misc/BlockQuartzFixture.java @@ -28,17 +28,17 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.BlockRenderLayer; -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.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.util.IOrientable; import appeng.api.util.IOrientableBlock; @@ -63,7 +63,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, { super( Material.CIRCUITS ); - this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) ); + this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, Direction.UP ).withProperty( ODD, false ) ); this.setLightLevel( 0.9375F ); this.setLightOpacity( 0 ); this.setFullSize( false ); @@ -74,7 +74,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, * Sets the "ODD" property of the block state according to the placement of the block. */ @Override - public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos ) { boolean oddPlacement = ( ( pos.getX() + pos.getY() + pos.getZ() ) % 2 ) != 0; @@ -83,15 +83,15 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, } @Override - public int getMetaFromState( final IBlockState state ) + public int getMetaFromState( final BlockState state ) { return state.getValue( FACING ).ordinal(); } @Override - public IBlockState getStateFromMeta( final int meta ) + public BlockState getStateFromMeta( final int meta ) { - EnumFacing facing = EnumFacing.values()[meta]; + Direction facing = Direction.values()[meta]; return this.getDefaultState().withProperty( FACING, facing ); } @@ -102,12 +102,12 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, } @Override - public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up ) + public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) { return this.canPlaceAt( w, pos, up.getOpposite() ); } - private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir ) + private boolean canPlaceAt( final World w, final BlockPos pos, final Direction dir ) { final BlockPos test = pos.offset( dir ); return w.isSideSolid( test, dir.getOpposite(), false ); @@ -116,7 +116,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, @Override public Iterable getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity e, final boolean isVisual ) { - final EnumFacing up = this.getOrientable( w, pos ).getUp(); + final Direction up = this.getOrientable( w, pos ).getUp(); final double xOff = -0.3 * up.getFrontOffsetX(); final double yOff = -0.3 * up.getFrontOffsetY(); final double zOff = -0.3 * up.getFrontOffsetZ(); @@ -134,8 +134,8 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, } @Override - @SideOnly( Side.CLIENT ) - public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r ) + @OnlyIn( Dist.CLIENT ) + public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r ) { if( !AEConfig.instance().isEnableEffects() ) { @@ -147,7 +147,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, return; } - final EnumFacing up = this.getOrientable( w, pos ).getUp(); + final Direction up = this.getOrientable( w, pos ).getUp(); final double xOff = -0.3 * up.getFrontOffsetX(); final double yOff = -0.3 * up.getFrontOffsetY(); final double zOff = -0.3 * up.getFrontOffsetZ(); @@ -157,15 +157,15 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, { final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { - final EnumFacing up = this.getOrientable( world, pos ).getUp(); + final Direction up = this.getOrientable( world, pos ).getUp(); if( !this.canPlaceAt( world, pos, up.getOpposite() ) ) { this.dropTorch( world, pos ); @@ -174,7 +174,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, private void dropTorch( final World w, final BlockPos pos ) { - final IBlockState prev = w.getBlockState( pos ); + final BlockState prev = w.getBlockState( pos ); w.destroyBlock( pos, true ); w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 ); } @@ -182,7 +182,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, @Override public boolean canPlaceBlockAt( final World w, final BlockPos pos ) { - for( final EnumFacing dir : EnumFacing.VALUES ) + for( final Direction dir : Direction.VALUES ) { if( this.canPlaceAt( w, pos, dir ) ) { @@ -199,7 +199,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, } @Override - public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos ) + public IOrientable getOrientable( final IBlockReader w, final BlockPos pos ) { return new MetaRotation( w, pos, FACING ); } @@ -211,13 +211,13 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; diff --git a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java index c732a3ed0..35fbb2c13 100644 --- a/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java +++ b/src/main/java/appeng/block/misc/BlockQuartzGrowthAccelerator.java @@ -25,14 +25,14 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -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.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.util.IOrientableBlock; import appeng.block.AEBaseTileBlock; @@ -56,7 +56,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos ) { TileQuartzGrowthAccelerator te = this.getTileEntity( world, pos ); boolean powered = te != null && te.isPowered(); @@ -71,9 +71,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr return new IProperty[] { POWERED }; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override - public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r ) + public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r ) { if( !AEConfig.instance().isEnableEffects() ) { @@ -87,9 +87,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr final double d0 = r.nextFloat() - 0.5F; final double d1 = r.nextFloat() - 0.5F; - final EnumFacing up = cga.getUp(); - final EnumFacing forward = cga.getForward(); - final EnumFacing west = Platform.crossProduct( forward, up ); + final Direction up = cga.getUp(); + final Direction forward = cga.getForward(); + final Direction west = Platform.crossProduct( forward, up ); double rx = 0.5 + pos.getX(); double ry = 0.5 + pos.getY(); @@ -149,7 +149,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr rz += dz * forward.getFrontOffsetZ(); final LightningFX fx = new LightningFX( w, rx, ry, rz, 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } diff --git a/src/main/java/appeng/block/misc/BlockSecurityStation.java b/src/main/java/appeng/block/misc/BlockSecurityStation.java index 4b26e2648..43879d064 100644 --- a/src/main/java/appeng/block/misc/BlockSecurityStation.java +++ b/src/main/java/appeng/block/misc/BlockSecurityStation.java @@ -24,14 +24,14 @@ import javax.annotation.Nullable; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; -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.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import appeng.api.util.AEPartLocation; @@ -66,7 +66,7 @@ public class BlockSecurityStation extends AEBaseTileBlock } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos ) { boolean powered = false; TileSecurityStation te = this.getTileEntity( world, pos ); @@ -80,9 +80,9 @@ public class BlockSecurityStation extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } diff --git a/src/main/java/appeng/block/misc/BlockSkyCompass.java b/src/main/java/appeng/block/misc/BlockSkyCompass.java index 9c941b4bc..3b004a72b 100644 --- a/src/main/java/appeng/block/misc/BlockSkyCompass.java +++ b/src/main/java/appeng/block/misc/BlockSkyCompass.java @@ -24,11 +24,11 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.util.EnumBlockRenderType; -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.World; @@ -62,7 +62,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision } @Override - public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up ) + public boolean isValidOrientation( final World w, final BlockPos pos, final Direction forward, final Direction up ) { final TileSkyCompass sc = this.getTileEntity( w, pos ); if( sc != null ) @@ -72,16 +72,16 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision return this.canPlaceAt( w, pos, forward.getOpposite() ); } - private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir ) + private boolean canPlaceAt( final World w, final BlockPos pos, final Direction dir ) { return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false ); } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final TileSkyCompass sc = this.getTileEntity( world, pos ); - final EnumFacing forward = sc.getForward(); + final Direction forward = sc.getForward(); if( !this.canPlaceAt( world, pos, forward.getOpposite() ) ) { this.dropTorch( world, pos ); @@ -90,7 +90,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision private void dropTorch( final World w, final BlockPos pos ) { - final IBlockState prev = w.getBlockState( pos ); + final BlockState prev = w.getBlockState( pos ); w.destroyBlock( pos, true ); w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 ); } @@ -98,7 +98,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision @Override public boolean canPlaceBlockAt( final World w, final BlockPos pos ) { - for( final EnumFacing dir : EnumFacing.VALUES ) + for( final Direction dir : Direction.VALUES ) { if( this.canPlaceAt( w, pos, dir ) ) { @@ -114,7 +114,7 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision final TileSkyCompass tile = this.getTileEntity( w, pos ); if( tile != null ) { - final EnumFacing forward = tile.getForward(); + final Direction forward = tile.getForward(); double minX = 0; double minY = 0; @@ -177,13 +177,13 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision } @Override - public EnumBlockRenderType getRenderType( IBlockState state ) + public EnumBlockRenderType getRenderType( BlockState state ) { return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Override - public boolean isFullBlock( IBlockState state ) + public boolean isFullBlock( BlockState state ) { return false; } diff --git a/src/main/java/appeng/block/misc/BlockTinyTNT.java b/src/main/java/appeng/block/misc/BlockTinyTNT.java index c7cfa272a..33f5e53d7 100644 --- a/src/main/java/appeng/block/misc/BlockTinyTNT.java +++ b/src/main/java/appeng/block/misc/BlockTinyTNT.java @@ -27,16 +27,16 @@ import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -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.entity.projectile.EntityArrow; -import net.minecraft.init.Items; +import net.minecraft.item.Items; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -66,13 +66,13 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { if( heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL ) { @@ -87,7 +87,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision } } - public void startFuse( final World w, final BlockPos pos, final EntityLivingBase igniter ) + public void startFuse( final World w, final BlockPos pos, final LivingEntity igniter ) { if( !w.isRemote ) { @@ -99,7 +99,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { if( world.isBlockIndirectlyGettingPowered( pos ) > 0 ) { @@ -109,7 +109,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision } @Override - public void onBlockAdded( final World w, final BlockPos pos, final IBlockState state ) + public void onBlockAdded( final World w, final BlockPos pos, final BlockState state ) { super.onBlockAdded( w, pos, state ); @@ -129,7 +129,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision if( entityarrow.isBurning() ) { - this.startFuse( w, pos, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null ); + this.startFuse( w, pos, entityarrow.shootingEntity instanceof LivingEntity ? (LivingEntity) entityarrow.shootingEntity : null ); w.setBlockToAir( pos ); } } diff --git a/src/main/java/appeng/block/misc/BlockVibrationChamber.java b/src/main/java/appeng/block/misc/BlockVibrationChamber.java index 94c80c84d..802c2335e 100644 --- a/src/main/java/appeng/block/misc/BlockVibrationChamber.java +++ b/src/main/java/appeng/block/misc/BlockVibrationChamber.java @@ -26,14 +26,14 @@ import javax.annotation.Nullable; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import appeng.api.util.AEPartLocation; @@ -59,7 +59,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos ) { TileVibrationChamber te = this.getTileEntity( world, pos ); boolean active = te != null && te.isOn; @@ -75,9 +75,9 @@ public final class BlockVibrationChamber extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { return false; } @@ -85,7 +85,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock if( Platform.isServer() ) { final TileVibrationChamber tc = this.getTileEntity( w, pos ); - if( tc != null && !player.isSneaking() ) + if( tc != null && !player.isShiftKeyDown() ) { Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_VIBRATION_CHAMBER ); return true; @@ -96,7 +96,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock } @Override - public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r ) + public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r ) { if( !AEConfig.instance().isEnableEffects() ) { @@ -113,8 +113,8 @@ public final class BlockVibrationChamber extends AEBaseTileBlock float f2 = pos.getY() + 0.5F; float f3 = pos.getZ() + 0.5F; - final EnumFacing forward = tc.getForward(); - final EnumFacing up = tc.getUp(); + final Direction forward = tc.getForward(); + final Direction up = tc.getUp(); final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY(); final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ(); diff --git a/src/main/java/appeng/block/misc/InscriberRendering.java b/src/main/java/appeng/block/misc/InscriberRendering.java index 4f5702b35..7fe6f3435 100644 --- a/src/main/java/appeng/block/misc/InscriberRendering.java +++ b/src/main/java/appeng/block/misc/InscriberRendering.java @@ -2,8 +2,8 @@ package appeng.block.misc; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -14,7 +14,7 @@ import appeng.client.render.tesr.InscriberTESR; public class InscriberRendering extends BlockRenderingCustomizer { - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { diff --git a/src/main/java/appeng/block/misc/SecurityStationRendering.java b/src/main/java/appeng/block/misc/SecurityStationRendering.java index da41210b0..672446611 100644 --- a/src/main/java/appeng/block/misc/SecurityStationRendering.java +++ b/src/main/java/appeng/block/misc/SecurityStationRendering.java @@ -19,8 +19,8 @@ package appeng.block.misc; -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.util.AEColor; import appeng.bootstrap.BlockRenderingCustomizer; @@ -34,7 +34,7 @@ public class SecurityStationRendering extends BlockRenderingCustomizer { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.blockColor( ColorableTileBlockColor.INSTANCE ); diff --git a/src/main/java/appeng/block/misc/SkyCompassRendering.java b/src/main/java/appeng/block/misc/SkyCompassRendering.java index 2bbe1905f..f90281e76 100644 --- a/src/main/java/appeng/block/misc/SkyCompassRendering.java +++ b/src/main/java/appeng/block/misc/SkyCompassRendering.java @@ -20,8 +20,8 @@ package appeng.block.misc; import net.minecraft.client.renderer.block.model.ModelResourceLocation; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -36,7 +36,7 @@ public class SkyCompassRendering extends BlockRenderingCustomizer private static final ModelResourceLocation ITEM_MODEL = new ModelResourceLocation( "appliedenergistics2:sky_compass", "normal" ); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.tesr( new SkyCompassTESR() ); diff --git a/src/main/java/appeng/block/networking/BlockCableBus.java b/src/main/java/appeng/block/networking/BlockCableBus.java index ccb53d72c..dcd30ac2d 100644 --- a/src/main/java/appeng/block/networking/BlockCableBus.java +++ b/src/main/java/appeng/block/networking/BlockCableBus.java @@ -26,40 +26,40 @@ import java.util.Random; import javax.annotation.Nullable; import net.minecraft.block.Block; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; +import net.minecraft.block.BlockStateContainer; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.client.particle.ParticleDigging; import net.minecraft.client.particle.ParticleManager; -import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.creativetab.CreativeTabs; 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.EnumDyeColor; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.state.IProperty; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult.Type; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import appeng.api.parts.IFacadeContainer; import appeng.api.parts.IFacadePart; @@ -71,7 +71,6 @@ import appeng.block.AEBaseTileBlock; import appeng.client.UnlistedProperty; import appeng.client.render.cablebus.CableBusBakedModel; import appeng.client.render.cablebus.CableBusRenderState; -import appeng.core.Api; import appeng.core.AppEng; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketClick; @@ -110,7 +109,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } @@ -122,7 +121,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { CableBusRenderState renderState = this.cb( world, pos ).getRenderState(); renderState.setWorld( world ); @@ -131,25 +130,25 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public void randomDisplayTick( final IBlockState state, final World worldIn, final BlockPos pos, final Random rand ) + public void randomDisplayTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand ) { this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand ); } @Override - public void onNeighborChange( final IBlockAccess w, final BlockPos pos, final BlockPos neighbor ) + public void onNeighborChange( final IBlockReader w, final BlockPos pos, final BlockPos neighbor ) { this.cb( w, pos ).onNeighborChanged( w, pos, neighbor ); } @Override - public Item getItemDropped( final IBlockState state, final Random rand, final int fortune ) + public Item getItemDropped( final BlockState state, final Random rand, final int fortune ) { return null; } @Override - public int getWeakPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side ) + public int getWeakPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side ) { return this.cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO: // IS @@ -157,19 +156,19 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public boolean canProvidePower( final IBlockState state ) + public boolean canProvidePower( final BlockState state ) { return true; } @Override - public void onEntityCollidedWithBlock( final World w, final BlockPos pos, final IBlockState state, final Entity entityIn ) + public void onEntityCollidedWithBlock( final World w, final BlockPos pos, final BlockState state, final Entity entityIn ) { this.cb( w, pos ).onEntityCollision( entityIn ); } @Override - public int getStrongPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side ) + public int getStrongPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side ) { return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO: // IS @@ -177,7 +176,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public int getLightValue( final IBlockState state, final IBlockAccess world, final BlockPos pos ) + public int getLightValue( final BlockState state, final IBlockReader world, final BlockPos pos ) { if( state.getBlock() != this ) { @@ -187,25 +186,25 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public boolean isLadder( final IBlockState state, final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity ) + public boolean isLadder( final BlockState state, final IBlockReader world, final BlockPos pos, final LivingEntity entity ) { return this.cb( world, pos ).isLadder( entity ); } @Override - public boolean isSideSolid( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side ) + public boolean isSideSolid( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side ) { return this.cb( w, pos ).isSolidOnSide( side ); } @Override - public boolean isReplaceable( final IBlockAccess w, final BlockPos pos ) + public boolean isReplaceable( final IBlockReader w, final BlockPos pos ) { return this.cb( w, pos ).isEmpty(); } @Override - public boolean removedByPlayer( final IBlockState state, final World world, final BlockPos pos, final EntityPlayer player, final boolean willHarvest ) + public boolean removedByPlayer( final BlockState state, final World world, final BlockPos pos, final PlayerEntity player, final boolean willHarvest ) { if( player.capabilities.isCreativeMode ) { @@ -220,18 +219,18 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public boolean canConnectRedstone( final IBlockState state, final IBlockAccess w, final BlockPos pos, EnumFacing side ) + public boolean canConnectRedstone( final BlockState state, final IBlockReader w, final BlockPos pos, Direction side ) { if( side == null ) { - side = EnumFacing.UP; + side = Direction.UP; } return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) ); } @Override - public ItemStack getPickBlock( final IBlockState state, final RayTraceResult target, final World world, final BlockPos pos, final EntityPlayer player ) + public ItemStack getPickBlock( final BlockState state, final RayTraceResult target, final World world, final BlockPos pos, final PlayerEntity player ) { final Vec3d v3 = target.hitVec.subtract( pos.getX(), pos.getY(), pos.getZ() ); final SelectedPart sp = this.cb( world, pos ).selectPart( v3 ); @@ -249,8 +248,8 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - @SideOnly( Side.CLIENT ) - public boolean addHitEffects( final IBlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer ) + @OnlyIn( Dist.CLIENT ) + public boolean addHitEffects( final BlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer ) { // Half the particle rate. Since we're spawning concentrated on a specific spot, @@ -263,7 +262,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade ICableBusContainer cb = this.cb( world, target.getBlockPos() ); // Our built-in model has the actual baked sprites we need - IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( this.getDefaultState() ); + IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState( this.getDefaultState() ); // We cannot add the effect if we don't have the model if( !( model instanceof CableBusBakedModel ) ) @@ -292,13 +291,13 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public boolean addDestroyEffects( final World world, final BlockPos pos, final ParticleManager effectRenderer ) { ICableBusContainer cb = this.cb( world, pos ); // Our built-in model has the actual baked sprites we need - IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( this.getDefaultState() ); + IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState( this.getDefaultState() ); // We cannot add the effect if we dont have the model if( !( model instanceof CableBusBakedModel ) ) @@ -341,7 +340,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { if( Platform.isServer() ) { @@ -349,7 +348,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } } - private ICableBusContainer cb( final IBlockAccess w, final BlockPos pos ) + private ICableBusContainer cb( final IBlockReader w, final BlockPos pos ) { final TileEntity te = w.getTileEntity( pos ); ICableBusContainer out = null; @@ -363,7 +362,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Nullable - private IFacadeContainer fc( final IBlockAccess w, final BlockPos pos ) + private IFacadeContainer fc( final IBlockReader w, final BlockPos pos ) { final TileEntity te = w.getTileEntity( pos ); IFacadeContainer out = null; @@ -377,43 +376,43 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - public void onBlockClicked( World worldIn, BlockPos pos, EntityPlayer playerIn ) + public void onBlockClicked( World worldIn, BlockPos pos, PlayerEntity playerIn ) { if( Platform.isClient() ) { - final RayTraceResult rtr = Minecraft.getMinecraft().objectMouseOver; + final RayTraceResult rtr = Minecraft.getInstance().objectMouseOver; if( rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals( rtr.getBlockPos() ) ) { final Vec3d hitVec = rtr.hitVec.subtract( new Vec3d( pos ) ); - if( this.cb( worldIn, pos ).clicked( playerIn, EnumHand.MAIN_HAND, hitVec ) ) + if( this.cb( worldIn, pos ).clicked( playerIn, Hand.MAIN_HAND, hitVec ) ) { NetworkHandler.instance() .sendToServer( - new PacketClick( pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, EnumHand.MAIN_HAND, true ) ); + new PacketClick( pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, Hand.MAIN_HAND, true ) ); } } } } - public void onBlockClickPacket( World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, Vec3d hitVec ) + public void onBlockClickPacket( World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Vec3d hitVec ) { this.cb( worldIn, pos ).clicked( playerIn, hand, hitVec ); } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { return this.cb( w, pos ).activate( player, hand, new Vec3d( hitX, hitY, hitZ ) ); } @Override - public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color ) + public boolean recolorBlock( final World world, final BlockPos pos, final Direction side, final EnumDyeColor color ) { return this.recolorBlock( world, pos, side, color, null ); } - public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color, final EntityPlayer who ) + public boolean recolorBlock( final World world, final BlockPos pos, final Direction side, final EnumDyeColor color, final PlayerEntity who ) { try { @@ -426,7 +425,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void getSubBlocks( final CreativeTabs tabs, final NonNullList itemStacks ) { // do nothing @@ -434,7 +433,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade public void setupTile() { - noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class ); + noTesrTile = TileCableBus.class; this.setTileEntity( noTesrTile ); GameRegistry.registerTileEntity( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus" ); @@ -445,22 +444,22 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private static void setupTesr() { - tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class ); + tesrTile = TileCableBusTESR.class; GameRegistry.registerTileEntity( tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus" ); ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() ); } @Override - public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer ) + public boolean canRenderInLayer( BlockState state, BlockRenderLayer layer ) { return true; } @Override - public IBlockState getFacadeState( IBlockAccess world, BlockPos pos, EnumFacing side ) + public BlockState getFacadeState( IBlockReader world, BlockPos pos, Direction side ) { if( side != null ) { @@ -488,10 +487,10 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade } // Helper to get access to the protected constructor - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private static class DestroyFX extends ParticleDigging { - DestroyFX( World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state ) + DestroyFX( World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, BlockState state ) { super( worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state ); } diff --git a/src/main/java/appeng/block/networking/BlockController.java b/src/main/java/appeng/block/networking/BlockController.java index d13515d3a..5585be57e 100644 --- a/src/main/java/appeng/block/networking/BlockController.java +++ b/src/main/java/appeng/block/networking/BlockController.java @@ -23,12 +23,12 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import appeng.block.AEBaseTileBlock; @@ -98,7 +98,7 @@ public class BlockController extends AEBaseTileBlock * get a rudimentary connected texture feel for the controller based on how it is placed. */ @Override - public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos ) { // Only used for columns, really @@ -148,19 +148,19 @@ public class BlockController extends AEBaseTileBlock } @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { return state; } @Override - public int getMetaFromState( final IBlockState state ) + public int getMetaFromState( final BlockState state ) { return state.getValue( CONTROLLER_STATE ).ordinal(); } @Override - public IBlockState getStateFromMeta( final int meta ) + public BlockState getStateFromMeta( final int meta ) { ControllerBlockState state = ControllerBlockState.values()[meta]; return this.getDefaultState().withProperty( CONTROLLER_STATE, state ); @@ -173,7 +173,7 @@ public class BlockController extends AEBaseTileBlock } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final TileController tc = this.getTileEntity( world, pos ); if( tc != null ) diff --git a/src/main/java/appeng/block/networking/BlockEnergyCell.java b/src/main/java/appeng/block/networking/BlockEnergyCell.java index a4e13b026..df9a4a96f 100644 --- a/src/main/java/appeng/block/networking/BlockEnergyCell.java +++ b/src/main/java/appeng/block/networking/BlockEnergyCell.java @@ -21,13 +21,13 @@ package appeng.block.networking; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.NonNullList; -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.block.AEBaseTileBlock; import appeng.helpers.AEGlassMaterial; @@ -40,13 +40,13 @@ public class BlockEnergyCell extends AEBaseTileBlock public static final PropertyInteger ENERGY_STORAGE = PropertyInteger.create( "fullness", 0, 7 ); @Override - public int getMetaFromState( final IBlockState state ) + public int getMetaFromState( final BlockState state ) { return state.getValue( ENERGY_STORAGE ); } @Override - public IBlockState getStateFromMeta( final int meta ) + public BlockState getStateFromMeta( final int meta ) { return this.getDefaultState().withProperty( ENERGY_STORAGE, Math.min( 7, Math.max( 0, meta ) ) ); } @@ -57,13 +57,13 @@ public class BlockEnergyCell extends AEBaseTileBlock } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void getSubBlocks( final CreativeTabs tabs, final NonNullList itemStacks ) { super.getSubBlocks( tabs, itemStacks ); final ItemStack charged = new ItemStack( this, 1 ); - final NBTTagCompound tag = Platform.openNbtData( charged ); + final CompoundNBT tag = Platform.openNbtData( charged ); tag.setDouble( "internalCurrentPower", this.getMaxPower() ); tag.setDouble( "internalMaxPower", this.getMaxPower() ); diff --git a/src/main/java/appeng/block/networking/BlockEnergyCellRendering.java b/src/main/java/appeng/block/networking/BlockEnergyCellRendering.java index 90cdd1d50..c7a0ff494 100644 --- a/src/main/java/appeng/block/networking/BlockEnergyCellRendering.java +++ b/src/main/java/appeng/block/networking/BlockEnergyCellRendering.java @@ -24,7 +24,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import appeng.api.implementations.items.IAEItemPowerStorage; -import appeng.block.AEBaseItemBlockChargeable; +import appeng.block.AEBaseBlockItemChargeable; import appeng.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; import appeng.bootstrap.IItemRendering; @@ -71,7 +71,7 @@ public class BlockEnergyCellRendering extends BlockRenderingCustomizer return 0; } - AEBaseItemBlockChargeable itemChargeable = (AEBaseItemBlockChargeable) is.getItem(); + AEBaseBlockItemChargeable itemChargeable = (AEBaseBlockItemChargeable) is.getItem(); double curPower = itemChargeable.getAECurrentPower( is ); double maxPower = itemChargeable.getAEMaxPower( is ); diff --git a/src/main/java/appeng/block/networking/BlockWireless.java b/src/main/java/appeng/block/networking/BlockWireless.java index 92be630d3..b9eadabef 100644 --- a/src/main/java/appeng/block/networking/BlockWireless.java +++ b/src/main/java/appeng/block/networking/BlockWireless.java @@ -24,16 +24,16 @@ import java.util.List; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.IStringSerializable; 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 appeng.api.util.AEPartLocation; @@ -79,7 +79,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos ) { State teState = State.OFF; @@ -107,11 +107,11 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision } @Override - public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity player, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ ) { final TileWireless tg = this.getTileEntity( w, pos ); - if( tg != null && !player.isSneaking() ) + if( tg != null && !player.isShiftKeyDown() ) { if( Platform.isServer() ) { @@ -129,7 +129,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision final TileWireless tile = this.getTileEntity( w, pos ); if( tile != null ) { - final EnumFacing forward = tile.getForward(); + final Direction forward = tile.getForward(); double minX = 0; double minY = 0; @@ -191,7 +191,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision final TileWireless tile = this.getTileEntity( w, pos ); if( tile != null ) { - final EnumFacing forward = tile.getForward(); + final Direction forward = tile.getForward(); double minX = 0; double minY = 0; @@ -251,7 +251,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } diff --git a/src/main/java/appeng/block/networking/CableBusColor.java b/src/main/java/appeng/block/networking/CableBusColor.java index beff3fbe3..9afd18c7c 100644 --- a/src/main/java/appeng/block/networking/CableBusColor.java +++ b/src/main/java/appeng/block/networking/CableBusColor.java @@ -19,13 +19,13 @@ package appeng.block.networking; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraftforge.common.property.IExtendedBlockState; -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.util.AEColor; import appeng.client.render.cablebus.CableBusRenderState; @@ -34,12 +34,12 @@ import appeng.client.render.cablebus.CableBusRenderState; /** * Exposes the cable bus color as tint indices 0 (dark variant), 1 (medium variant) and 2 (bright variant). */ -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class CableBusColor implements IBlockColor { @Override - public int colorMultiplier( IBlockState state, IBlockAccess worldIn, BlockPos pos, int color ) + public int colorMultiplier( BlockState state, IBlockReader worldIn, BlockPos pos, int color ) { AEColor busColor = AEColor.TRANSPARENT; diff --git a/src/main/java/appeng/block/networking/CableBusRendering.java b/src/main/java/appeng/block/networking/CableBusRendering.java index faea932a9..8c26800a9 100644 --- a/src/main/java/appeng/block/networking/CableBusRendering.java +++ b/src/main/java/appeng/block/networking/CableBusRendering.java @@ -19,8 +19,8 @@ package appeng.block.networking; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -42,7 +42,7 @@ public class CableBusRendering extends BlockRenderingCustomizer } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.builtInModel( "models/block/builtin/cable_bus", new CableBusModel( this.partModels ) ); diff --git a/src/main/java/appeng/block/networking/WirelessRendering.java b/src/main/java/appeng/block/networking/WirelessRendering.java index cca9f4ea0..704b6899c 100644 --- a/src/main/java/appeng/block/networking/WirelessRendering.java +++ b/src/main/java/appeng/block/networking/WirelessRendering.java @@ -2,8 +2,8 @@ package appeng.block.networking; -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.util.AEColor; import appeng.bootstrap.BlockRenderingCustomizer; @@ -15,7 +15,7 @@ import appeng.client.render.StaticBlockColor; public class WirelessRendering extends BlockRenderingCustomizer { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.blockColor( new StaticBlockColor( AEColor.TRANSPARENT ) ); diff --git a/src/main/java/appeng/block/paint/BlockPaint.java b/src/main/java/appeng/block/paint/BlockPaint.java index be0af2a8d..2c087db91 100644 --- a/src/main/java/appeng/block/paint/BlockPaint.java +++ b/src/main/java/appeng/block/paint/BlockPaint.java @@ -27,8 +27,8 @@ import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.MaterialLiquid; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -36,13 +36,13 @@ import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.NonNullList; 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.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; -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.block.AEBaseTileBlock; import appeng.helpers.Splotch; @@ -71,7 +71,7 @@ public class BlockPaint extends AEBaseTileBlock } @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { IExtendedBlockState extState = (IExtendedBlockState) state; @@ -93,26 +93,26 @@ public class BlockPaint extends AEBaseTileBlock } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void getSubBlocks( final CreativeTabs tabs, final NonNullList itemStacks ) { // do nothing } @Override - public AxisAlignedBB getCollisionBoundingBox( IBlockState blockState, IBlockAccess worldIn, BlockPos pos ) + public AxisAlignedBB getCollisionBoundingBox( BlockState blockState, IBlockReader worldIn, BlockPos pos ) { return null; } @Override - public boolean canCollideCheck( final IBlockState state, final boolean hitIfLiquid ) + public boolean canCollideCheck( final BlockState state, final boolean hitIfLiquid ) { return false; } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final TilePaint tp = this.getTileEntity( world, pos ); @@ -123,13 +123,13 @@ public class BlockPaint extends AEBaseTileBlock } @Override - public Item getItemDropped( final IBlockState state, final Random rand, final int fortune ) + public Item getItemDropped( final BlockState state, final Random rand, final int fortune ) { return null; } @Override - public void dropBlockAsItemWithChance( final World worldIn, final BlockPos pos, final IBlockState state, final float chance, final int fortune ) + public void dropBlockAsItemWithChance( final World worldIn, final BlockPos pos, final BlockState state, final float chance, final int fortune ) { } @@ -144,7 +144,7 @@ public class BlockPaint extends AEBaseTileBlock } @Override - public int getLightValue( final IBlockState state, final IBlockAccess w, final BlockPos pos ) + public int getLightValue( final BlockState state, final IBlockReader w, final BlockPos pos ) { final TilePaint tp = this.getTileEntity( w, pos ); @@ -157,13 +157,13 @@ public class BlockPaint extends AEBaseTileBlock } @Override - public boolean isAir( final IBlockState state, final IBlockAccess world, final BlockPos pos ) + public boolean isAir( final BlockState state, final IBlockReader world, final BlockPos pos ) { return true; } @Override - public boolean isReplaceable( final IBlockAccess worldIn, final BlockPos pos ) + public boolean isReplaceable( final IBlockReader worldIn, final BlockPos pos ) { return true; } diff --git a/src/main/java/appeng/block/paint/PaintBakedModel.java b/src/main/java/appeng/block/paint/PaintBakedModel.java index da133ab25..3a972c7d7 100644 --- a/src/main/java/appeng/block/paint/PaintBakedModel.java +++ b/src/main/java/appeng/block/paint/PaintBakedModel.java @@ -11,14 +11,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 net.minecraft.util.ResourceLocation; import net.minecraftforge.common.property.IExtendedBlockState; @@ -54,7 +54,7 @@ class PaintBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { if( side != null ) { @@ -117,34 +117,34 @@ class PaintBakedModel implements IBakedModel { case UP: offset = 1.0f - offset; - builder.addQuad( EnumFacing.DOWN, pos_x - buffer, offset, pos_y - buffer, + builder.addQuad( Direction.DOWN, pos_x - buffer, offset, pos_y - buffer, pos_x + buffer, offset, pos_y + buffer ); break; case DOWN: - builder.addQuad( EnumFacing.UP, pos_x - buffer, offset, pos_y - buffer, + builder.addQuad( Direction.UP, pos_x - buffer, offset, pos_y - buffer, pos_x + buffer, offset, pos_y + buffer ); break; case EAST: offset = 1.0f - offset; - builder.addQuad( EnumFacing.WEST, offset, pos_x - buffer, pos_y - buffer, + builder.addQuad( Direction.WEST, offset, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer, pos_y + buffer ); break; case WEST: - builder.addQuad( EnumFacing.EAST, offset, pos_x - buffer, pos_y - buffer, + builder.addQuad( Direction.EAST, offset, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer, pos_y + buffer ); break; case SOUTH: offset = 1.0f - offset; - builder.addQuad( EnumFacing.NORTH, pos_x - buffer, pos_y - buffer, offset, + builder.addQuad( Direction.NORTH, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer, pos_y + buffer, offset ); break; case NORTH: - builder.addQuad( EnumFacing.SOUTH, pos_x - buffer, pos_y - buffer, offset, + builder.addQuad( Direction.SOUTH, pos_x - buffer, pos_y - buffer, offset, pos_x + buffer, pos_y + buffer, offset ); break; diff --git a/src/main/java/appeng/block/paint/PaintRendering.java b/src/main/java/appeng/block/paint/PaintRendering.java index 192116b53..01066bd7e 100644 --- a/src/main/java/appeng/block/paint/PaintRendering.java +++ b/src/main/java/appeng/block/paint/PaintRendering.java @@ -2,8 +2,8 @@ package appeng.block.paint; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -14,7 +14,7 @@ public class PaintRendering extends BlockRenderingCustomizer { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.builtInModel( "models/block/paint", new PaintModel() ); diff --git a/src/main/java/appeng/block/qnb/BlockQuantumBase.java b/src/main/java/appeng/block/qnb/BlockQuantumBase.java index 311f4501d..7e9ac633e 100644 --- a/src/main/java/appeng/block/qnb/BlockQuantumBase.java +++ b/src/main/java/appeng/block/qnb/BlockQuantumBase.java @@ -23,12 +23,12 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; import net.minecraft.util.BlockRenderLayer; 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.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -69,7 +69,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto } @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { IExtendedBlockState extState = (IExtendedBlockState) state; @@ -84,7 +84,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos ) { TileQuantumBridge bridge = this.getTileEntity( worldIn, pos ); if( bridge != null ) @@ -101,7 +101,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final TileQuantumBridge bridge = this.getTileEntity( world, pos ); if( bridge != null ) @@ -111,7 +111,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto } @Override - public void breakBlock( final World w, final BlockPos pos, final IBlockState state ) + public void breakBlock( final World w, final BlockPos pos, final BlockState state ) { final TileQuantumBridge bridge = this.getTileEntity( w, pos ); if( bridge != null ) @@ -123,7 +123,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } diff --git a/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java b/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java index 0072f1728..48712082a 100644 --- a/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java +++ b/src/main/java/appeng/block/qnb/BlockQuantumLinkChamber.java @@ -25,12 +25,12 @@ import java.util.Random; import javax.annotation.Nullable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -53,7 +53,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase } @Override - public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random rand ) + public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random rand ) { final TileQuantumBridge bridge = this.getTileEntity( w, pos ); if( bridge != null ) @@ -69,9 +69,9 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } diff --git a/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java b/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java index 39f290cae..0419a0d68 100644 --- a/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java +++ b/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java @@ -12,14 +12,14 @@ import javax.annotation.Nullable; import com.google.common.collect.ImmutableList; import net.minecraft.block.Block; -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 net.minecraft.util.ResourceLocation; import net.minecraftforge.common.property.IExtendedBlockState; @@ -74,7 +74,7 @@ class QnbFormedBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { // Get the correct base model if( !( state instanceof IExtendedBlockState ) ) @@ -88,13 +88,13 @@ class QnbFormedBakedModel implements IBakedModel return this.getQuads( formedState, state, side, rand ); } - private List getQuads( QnbFormedState formedState, IBlockState state, EnumFacing side, long rand ) + private List getQuads( QnbFormedState formedState, BlockState state, Direction side, long rand ) { CubeBuilder builder = new CubeBuilder( this.vertexFormat ); if( state.getBlock() == this.linkBlock ) { - Set sides = formedState.getAdjacentQuantumBridges(); + Set sides = formedState.getAdjacentQuantumBridges(); this.renderCableAt( builder, 0.11f * 16, this.glassCableTexture, 0.141f * 16, sides ); @@ -116,7 +116,7 @@ class QnbFormedBakedModel implements IBakedModel { builder.setTexture( this.lightCornerTexture ); builder.setRenderFullBright( true ); - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { // Offset the face by a slight amount so that it is drawn over the already drawn ring texture // (avoids z-fighting) @@ -145,7 +145,7 @@ class QnbFormedBakedModel implements IBakedModel { builder.setTexture( this.lightTexture ); builder.setRenderFullBright( true ); - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { // Offset the face by a slight amount so that it is drawn over the already drawn ring texture // (avoids z-fighting) @@ -165,36 +165,36 @@ class QnbFormedBakedModel implements IBakedModel return builder.getOutput(); } - private void renderCableAt( CubeBuilder builder, float thickness, TextureAtlasSprite texture, float pull, Set connections ) + private void renderCableAt( CubeBuilder builder, float thickness, TextureAtlasSprite texture, float pull, Set connections ) { builder.setTexture( texture ); - if( connections.contains( EnumFacing.WEST ) ) + if( connections.contains( Direction.WEST ) ) { builder.addCube( 0, 8 - thickness, 8 - thickness, 8 - thickness - pull, 8 + thickness, 8 + thickness ); } - if( connections.contains( EnumFacing.EAST ) ) + if( connections.contains( Direction.EAST ) ) { builder.addCube( 8 + thickness + pull, 8 - thickness, 8 - thickness, 16, 8 + thickness, 8 + thickness ); } - if( connections.contains( EnumFacing.NORTH ) ) + if( connections.contains( Direction.NORTH ) ) { builder.addCube( 8 - thickness, 8 - thickness, 0, 8 + thickness, 8 + thickness, 8 - thickness - pull ); } - if( connections.contains( EnumFacing.SOUTH ) ) + if( connections.contains( Direction.SOUTH ) ) { builder.addCube( 8 - thickness, 8 - thickness, 8 + thickness + pull, 8 + thickness, 8 + thickness, 16 ); } - if( connections.contains( EnumFacing.DOWN ) ) + if( connections.contains( Direction.DOWN ) ) { builder.addCube( 8 - thickness, 0, 8 - thickness, 8 + thickness, 8 - thickness - pull, 8 + thickness ); } - if( connections.contains( EnumFacing.UP ) ) + if( connections.contains( Direction.UP ) ) { builder.addCube( 8 - thickness, 8 + thickness + pull, 8 - thickness, 8 + thickness, 16, 8 + thickness ); } diff --git a/src/main/java/appeng/block/qnb/QnbFormedState.java b/src/main/java/appeng/block/qnb/QnbFormedState.java index 43664dcff..991254cb2 100644 --- a/src/main/java/appeng/block/qnb/QnbFormedState.java +++ b/src/main/java/appeng/block/qnb/QnbFormedState.java @@ -4,26 +4,26 @@ package appeng.block.qnb; import java.util.Set; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; public class QnbFormedState { - private final Set adjacentQuantumBridges; + private final Set adjacentQuantumBridges; private final boolean corner; private final boolean powered; - public QnbFormedState( Set adjacentQuantumBridges, boolean corner, boolean powered ) + public QnbFormedState( Set adjacentQuantumBridges, boolean corner, boolean powered ) { this.adjacentQuantumBridges = adjacentQuantumBridges; this.corner = corner; this.powered = powered; } - public Set getAdjacentQuantumBridges() + public Set getAdjacentQuantumBridges() { return this.adjacentQuantumBridges; } diff --git a/src/main/java/appeng/block/qnb/QuantumBridgeRendering.java b/src/main/java/appeng/block/qnb/QuantumBridgeRendering.java index 2dd02823e..399238626 100644 --- a/src/main/java/appeng/block/qnb/QuantumBridgeRendering.java +++ b/src/main/java/appeng/block/qnb/QuantumBridgeRendering.java @@ -2,8 +2,8 @@ package appeng.block.qnb; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -14,7 +14,7 @@ public class QuantumBridgeRendering extends BlockRenderingCustomizer { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.builtInModel( "models/block/qnb/qnb_formed", new QnbFormedModel() ); diff --git a/src/main/java/appeng/block/spatial/BlockMatrixFrame.java b/src/main/java/appeng/block/spatial/BlockMatrixFrame.java index 876611f28..557a1df4f 100644 --- a/src/main/java/appeng/block/spatial/BlockMatrixFrame.java +++ b/src/main/java/appeng/block/spatial/BlockMatrixFrame.java @@ -23,7 +23,7 @@ import java.util.Arrays; import java.util.List; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; @@ -31,10 +31,10 @@ import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; -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.block.AEBaseBlock; import appeng.helpers.ICustomCollision; @@ -53,7 +53,7 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void getSubBlocks( final CreativeTabs tabs, final NonNullList itemStacks ) { // do nothing @@ -85,7 +85,7 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision } @Override - public boolean canEntityDestroy( final IBlockState state, final IBlockAccess world, final BlockPos pos, final Entity entity ) + public boolean canEntityDestroy( final BlockState state, final IBlockReader world, final BlockPos pos, final Entity entity ) { return false; } diff --git a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java index 0199a3b3e..0e19e24c0 100644 --- a/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java +++ b/src/main/java/appeng/block/spatial/BlockSpatialIOPort.java @@ -23,11 +23,11 @@ import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -47,7 +47,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final TileSpatialIOPort te = this.getTileEntity( world, pos ); if( te != null ) @@ -57,9 +57,9 @@ public class BlockSpatialIOPort extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } diff --git a/src/main/java/appeng/block/spatial/BlockSpatialPylon.java b/src/main/java/appeng/block/spatial/BlockSpatialPylon.java index ae465ebea..ddeb29a1a 100644 --- a/src/main/java/appeng/block/spatial/BlockSpatialPylon.java +++ b/src/main/java/appeng/block/spatial/BlockSpatialPylon.java @@ -20,11 +20,11 @@ package appeng.block.spatial; import net.minecraft.block.Block; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -53,7 +53,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock } @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { IExtendedBlockState extState = (IExtendedBlockState) state; @@ -61,7 +61,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final TileSpatialPylon tsp = this.getTileEntity( world, pos ); if( tsp != null ) @@ -71,7 +71,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock } @Override - public int getLightValue( final IBlockState state, final IBlockAccess w, final BlockPos pos ) + public int getLightValue( final BlockState state, final IBlockReader w, final BlockPos pos ) { final TileSpatialPylon tsp = this.getTileEntity( w, pos ); if( tsp != null ) @@ -81,7 +81,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock return super.getLightValue( state, w, pos ); } - private int getDisplayState( IBlockAccess world, BlockPos pos ) + private int getDisplayState( IBlockReader world, BlockPos pos ) { TileSpatialPylon te = this.getTileEntity( world, pos ); diff --git a/src/main/java/appeng/block/storage/BlockChest.java b/src/main/java/appeng/block/storage/BlockChest.java index 8ce89a037..c328d7d3f 100644 --- a/src/main/java/appeng/block/storage/BlockChest.java +++ b/src/main/java/appeng/block/storage/BlockChest.java @@ -24,14 +24,14 @@ import javax.annotation.Nullable; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; -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.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import appeng.api.util.AEPartLocation; @@ -66,7 +66,7 @@ public class BlockChest extends AEBaseTileBlock } @Override - public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos ) + public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos ) { DriveSlotState slotState = DriveSlotState.EMPTY; @@ -90,10 +90,10 @@ public class BlockChest extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { final TileChest tg = this.getTileEntity( w, pos ); - if( tg != null && !p.isSneaking() ) + if( tg != null && !p.isShiftKeyDown() ) { if( Platform.isClient() ) { diff --git a/src/main/java/appeng/block/storage/BlockDrive.java b/src/main/java/appeng/block/storage/BlockDrive.java index 58cd93e05..95b356e32 100644 --- a/src/main/java/appeng/block/storage/BlockDrive.java +++ b/src/main/java/appeng/block/storage/BlockDrive.java @@ -22,15 +22,15 @@ package appeng.block.storage; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; -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.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; @@ -71,7 +71,7 @@ public class BlockDrive extends AEBaseTileBlock } @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { TileDrive te = this.getTileEntity( world, pos ); IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos ); @@ -79,9 +79,9 @@ public class BlockDrive extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } diff --git a/src/main/java/appeng/block/storage/BlockIOPort.java b/src/main/java/appeng/block/storage/BlockIOPort.java index 36b4f15b7..1fc2a2385 100644 --- a/src/main/java/appeng/block/storage/BlockIOPort.java +++ b/src/main/java/appeng/block/storage/BlockIOPort.java @@ -23,11 +23,11 @@ import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -47,7 +47,7 @@ public class BlockIOPort extends AEBaseTileBlock } @Override - public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) + public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos ) { final TileIOPort te = this.getTileEntity( world, pos ); if( te != null ) @@ -57,9 +57,9 @@ public class BlockIOPort extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } diff --git a/src/main/java/appeng/block/storage/BlockSkyChest.java b/src/main/java/appeng/block/storage/BlockSkyChest.java index 3289176ec..9f7697c1c 100644 --- a/src/main/java/appeng/block/storage/BlockSkyChest.java +++ b/src/main/java/appeng/block/storage/BlockSkyChest.java @@ -25,13 +25,13 @@ import java.util.List; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumBlockRenderType; -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.world.World; @@ -69,13 +69,13 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision } @Override - public EnumBlockRenderType getRenderType( IBlockState state ) + public EnumBlockRenderType getRenderType( BlockState state ) { return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { if( Platform.isServer() ) { @@ -104,7 +104,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision private AxisAlignedBB computeAABB( final World w, final BlockPos pos ) { final TileSkyChest sk = this.getTileEntity( w, pos ); - EnumFacing o = EnumFacing.UP; + Direction o = Direction.UP; if( sk != null ) { diff --git a/src/main/java/appeng/block/storage/ChestRendering.java b/src/main/java/appeng/block/storage/ChestRendering.java index 1e3334781..5a3004a36 100644 --- a/src/main/java/appeng/block/storage/ChestRendering.java +++ b/src/main/java/appeng/block/storage/ChestRendering.java @@ -19,8 +19,8 @@ package appeng.block.storage; -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.util.AEColor; import appeng.bootstrap.BlockRenderingCustomizer; @@ -34,7 +34,7 @@ public class ChestRendering extends BlockRenderingCustomizer { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { // I checked, the ME chest doesn't keep its color in item form diff --git a/src/main/java/appeng/block/storage/SkyChestRenderingCustomizer.java b/src/main/java/appeng/block/storage/SkyChestRenderingCustomizer.java index 59ec68cf9..f1f372862 100644 --- a/src/main/java/appeng/block/storage/SkyChestRenderingCustomizer.java +++ b/src/main/java/appeng/block/storage/SkyChestRenderingCustomizer.java @@ -20,8 +20,8 @@ package appeng.block.storage; import net.minecraft.client.renderer.block.model.ModelResourceLocation; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -39,7 +39,7 @@ public class SkyChestRenderingCustomizer extends BlockRenderingCustomizer this.type = type; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { diff --git a/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java b/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java index 629c1df49..95dc00b8e 100644 --- a/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java +++ b/src/main/java/appeng/bootstrap/BlockDefinitionBuilder.java @@ -30,17 +30,17 @@ import java.util.function.Supplier; import javax.annotation.Nullable; import net.minecraft.block.Block; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.model.ModelResourceLocation; +import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; -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.definitions.IBlockDefinition; import appeng.block.AEBaseBlock; -import appeng.block.AEBaseItemBlock; +import appeng.block.AEBaseBlockItem; import appeng.block.AEBaseTileBlock; import appeng.bootstrap.components.IBlockRegistrationComponent; import appeng.bootstrap.components.IItemRegistrationComponent; @@ -71,18 +71,18 @@ class BlockDefinitionBuilder implements IBlockBuilder private final EnumSet features = EnumSet.noneOf( AEFeature.class ); - private CreativeTabs creativeTab = CreativeTab.instance; + private ItemGroup itemGroup = CreativeTab.instance; private TileEntityDefinition tileEntityDefinition; private boolean disableItem = false; - private Function itemFactory; + private Function itemFactory; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private BlockRendering blockRendering; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private ItemRendering itemRendering; BlockDefinitionBuilder( FeatureFactory factory, String id, Supplier blockSupplier ) @@ -144,7 +144,7 @@ class BlockDefinitionBuilder implements IBlockBuilder this.rendering( new BlockRenderingCustomizer() { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { ModelResourceLocation model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, BlockDefinitionBuilder.this.registryName ), "inventory" ); @@ -156,7 +156,7 @@ class BlockDefinitionBuilder implements IBlockBuilder } @Override - public IBlockBuilder item( Function factory ) + public IBlockBuilder item( Function factory ) { this.itemFactory = factory; return this; @@ -169,7 +169,7 @@ class BlockDefinitionBuilder implements IBlockBuilder return this; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private void customizeForClient( BlockRenderingCustomizer callback ) { callback.customize( this.blockRendering, this.itemRendering ); @@ -187,9 +187,8 @@ class BlockDefinitionBuilder implements IBlockBuilder // Create block and matching item, and set factory name of both Block block = this.blockSupplier.get(); block.setRegistryName( AppEng.MOD_ID, this.registryName ); - block.setUnlocalizedName( "appliedenergistics2." + this.registryName ); - ItemBlock item = this.constructItemFromBlock( block ); + BlockItem item = this.constructItemFromBlock( block ); if( item != null ) { item.setRegistryName( AppEng.MOD_ID, this.registryName ); @@ -202,8 +201,6 @@ class BlockDefinitionBuilder implements IBlockBuilder this.factory.addBootstrapComponent( (IItemRegistrationComponent) ( side, registry ) -> registry.register( item ) ); } - block.setCreativeTab( this.creativeTab ); - // Register all extra handlers this.bootstrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( block, item ) ) ); @@ -241,7 +238,7 @@ class BlockDefinitionBuilder implements IBlockBuilder { AEBaseTile.registerTileItem( this.tileEntityDefinition == null ? ( (AEBaseTileBlock) block ).getTileEntityClass() : this.tileEntityDefinition.getTileEntityClass(), - new BlockStackSrc( block, 0, ActivityState.Enabled ) ); + new BlockStackSrc( block, ActivityState.Enabled ) ); } ); if( this.tileEntityDefinition != null ) @@ -258,7 +255,7 @@ class BlockDefinitionBuilder implements IBlockBuilder } @Nullable - private ItemBlock constructItemFromBlock( Block block ) + private BlockItem constructItemFromBlock( Block block ) { if( this.disableItem ) { @@ -271,11 +268,11 @@ class BlockDefinitionBuilder implements IBlockBuilder } else if( block instanceof AEBaseBlock ) { - return new AEBaseItemBlock( block ); + return new AEBaseBlockItem( block ); } else { - return new ItemBlock( block ); + return new BlockItem( block, null ); } } } diff --git a/src/main/java/appeng/bootstrap/BlockRendering.java b/src/main/java/appeng/bootstrap/BlockRendering.java index 70a0c5778..2b3fb2e9c 100644 --- a/src/main/java/appeng/bootstrap/BlockRendering.java +++ b/src/main/java/appeng/bootstrap/BlockRendering.java @@ -30,8 +30,8 @@ import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraftforge.client.model.IModel; -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.block.AEBaseTileBlock; import appeng.bootstrap.components.BlockColorComponent; @@ -43,30 +43,30 @@ import appeng.client.render.model.AutoRotatingModel; class BlockRendering implements IBlockRendering { - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private BiFunction modelCustomizer; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private IBlockColor blockColor; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private TileEntitySpecialRenderer tesr; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private IStateMapper stateMapper; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private Map builtInModels = new HashMap<>(); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public IBlockRendering modelCustomizer( BiFunction customizer ) { this.modelCustomizer = customizer; return this; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public IBlockRendering blockColor( IBlockColor blockColor ) { @@ -74,7 +74,7 @@ class BlockRendering implements IBlockRendering return this; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public IBlockRendering tesr( TileEntitySpecialRenderer tesr ) { @@ -89,7 +89,7 @@ class BlockRendering implements IBlockRendering return this; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public IBlockRendering stateMapper( IStateMapper mapper ) { diff --git a/src/main/java/appeng/bootstrap/BlockRenderingCustomizer.java b/src/main/java/appeng/bootstrap/BlockRenderingCustomizer.java index 40e306bc2..4d1c69030 100644 --- a/src/main/java/appeng/bootstrap/BlockRenderingCustomizer.java +++ b/src/main/java/appeng/bootstrap/BlockRenderingCustomizer.java @@ -19,19 +19,19 @@ package appeng.bootstrap; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * A callback that allows the rendering of a block to be customized. Sadly this class is required and no lambdas can be * used - * due to them not being able to be annotated with @SideOnly(CLIENT). + * due to them not being able to be annotated with @OnlyIn(CLIENT). */ public abstract class BlockRenderingCustomizer { - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public abstract void customize( IBlockRendering rendering, IItemRendering itemRendering ); } diff --git a/src/main/java/appeng/bootstrap/FeatureFactory.java b/src/main/java/appeng/bootstrap/FeatureFactory.java index bce43cfaa..fb307a042 100644 --- a/src/main/java/appeng/bootstrap/FeatureFactory.java +++ b/src/main/java/appeng/bootstrap/FeatureFactory.java @@ -30,12 +30,12 @@ import java.util.function.BiFunction; import java.util.function.Supplier; import net.minecraft.block.Block; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.IUnbakedModel; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.item.Item; -import net.minecraftforge.client.model.IModel; -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.definitions.IItemDefinition; import appeng.api.util.AEColor; @@ -57,10 +57,10 @@ public class FeatureFactory private final Map, List> bootstrapComponents; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private ModelOverrideComponent modelOverrideComponent; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private BuiltInModelComponent builtInModelComponent; public final TileEntityComponent tileEntityComponent; @@ -115,7 +115,7 @@ public class FeatureFactory { final ActivityState state = ActivityState.from( target.isEnabled() ); - definition.add( color, new ItemStackSrc( targetItem, offset + color.ordinal(), state ) ); + definition.add( color, new ItemStackSrc( targetItem, state ) ); } } ); @@ -139,13 +139,13 @@ public class FeatureFactory this.bootstrapComponents.computeIfAbsent( eventType, c -> new ArrayList() ).add( component ); } - @SideOnly( Side.CLIENT ) - void addBuiltInModel( String path, IModel model ) + @OnlyIn( Dist.CLIENT ) + void addBuiltInModel( String path, IUnbakedModel model ) { this.builtInModelComponent.addModel( path, model ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) void addModelOverride( String resourcePath, BiFunction customizer ) { this.modelOverrideComponent.addOverride( resourcePath, customizer ); diff --git a/src/main/java/appeng/bootstrap/IBlockBuilder.java b/src/main/java/appeng/bootstrap/IBlockBuilder.java index 1b75d8526..f1d3f39de 100644 --- a/src/main/java/appeng/bootstrap/IBlockBuilder.java +++ b/src/main/java/appeng/bootstrap/IBlockBuilder.java @@ -23,8 +23,8 @@ import java.util.function.BiFunction; import java.util.function.Function; import net.minecraft.block.Block; +import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; import appeng.api.definitions.IBlockDefinition; import appeng.bootstrap.definitions.TileEntityDefinition; @@ -54,7 +54,7 @@ public interface IBlockBuilder */ IBlockBuilder useCustomItemModel(); - IBlockBuilder item( Function factory ); + IBlockBuilder item( Function factory ); T build(); } diff --git a/src/main/java/appeng/bootstrap/IBlockRendering.java b/src/main/java/appeng/bootstrap/IBlockRendering.java index 50caf9836..755ba5b0b 100644 --- a/src/main/java/appeng/bootstrap/IBlockRendering.java +++ b/src/main/java/appeng/bootstrap/IBlockRendering.java @@ -21,14 +21,13 @@ package appeng.bootstrap; import java.util.function.BiFunction; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.color.IBlockColor; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraftforge.client.model.IModel; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.IUnbakedModel; +import net.minecraft.client.renderer.model.ModelResourceLocation; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** @@ -37,22 +36,22 @@ import net.minecraftforge.fml.relauncher.SideOnly; public interface IBlockRendering { - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IBlockRendering modelCustomizer( BiFunction customizer ); - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IBlockRendering blockColor( IBlockColor blockColor ); - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IBlockRendering stateMapper( IStateMapper mapper ); - @SideOnly( Side.CLIENT ) - IBlockRendering tesr( TileEntitySpecialRenderer tesr ); + @OnlyIn( Dist.CLIENT ) + IBlockRendering tesr( TileEntityRenderer ter ); /** * Registers a built-in model under the given resource path. */ - @SideOnly( Side.CLIENT ) - IBlockRendering builtInModel( String name, IModel model ); + @OnlyIn( Dist.CLIENT ) + IBlockRendering builtInModel( String name, IUnbakedModel model ); } diff --git a/src/main/java/appeng/bootstrap/IItemBuilder.java b/src/main/java/appeng/bootstrap/IItemBuilder.java index 4e787ce26..393f37505 100644 --- a/src/main/java/appeng/bootstrap/IItemBuilder.java +++ b/src/main/java/appeng/bootstrap/IItemBuilder.java @@ -22,9 +22,9 @@ package appeng.bootstrap; import java.util.function.Function; import java.util.function.Supplier; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.dispenser.IDispenseItemBehavior; import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import appeng.core.features.AEFeature; import appeng.core.features.ItemDefinition; @@ -42,14 +42,14 @@ public interface IItemBuilder IItemBuilder addFeatures( AEFeature... features ); - IItemBuilder creativeTab( CreativeTabs tab ); + IItemBuilder itemGroup( ItemGroup tab ); IItemBuilder rendering( ItemRenderingCustomizer callback ); /** * Registers a custom dispenser behavior for this item. */ - IItemBuilder dispenserBehavior( Supplier behavior ); + IItemBuilder dispenserBehavior( Supplier behavior ); ItemDefinition build(); } diff --git a/src/main/java/appeng/bootstrap/IItemRendering.java b/src/main/java/appeng/bootstrap/IItemRendering.java index 2e81b23bb..2b8351955 100644 --- a/src/main/java/appeng/bootstrap/IItemRendering.java +++ b/src/main/java/appeng/bootstrap/IItemRendering.java @@ -23,12 +23,12 @@ import java.util.Arrays; import java.util.Collection; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.IModel; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; /** @@ -42,31 +42,31 @@ public interface IItemRendering * item model to be used for rendering by inspecting the item stack (i.e. for NBT data). * Please */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IItemRendering meshDefinition( ItemMeshDefinition meshDefinition ); /** * Registers an item model for meta=0, see {@link #model(int, ModelResourceLocation)}. */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) default IItemRendering model( ModelResourceLocation model ) { - return model( 0, model ); + return this.model( 0, model ); } /** * Registers an item model for a given meta. */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IItemRendering model( int meta, ModelResourceLocation model ); /** * Convenient override for {@link #variants(Collection)}. */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) default IItemRendering variants( ResourceLocation... resources ) { - return variants( Arrays.asList( resources ) ); + return this.variants( Arrays.asList( resources ) ); } /** @@ -76,20 +76,20 @@ public interface IItemRendering * * Models registered via {@link #model(int, ModelResourceLocation)} are automatically added here. */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IItemRendering variants( Collection resources ); /** * Registers a custom item color definition that inspects an item stack and tint and * returns a color multiplier. */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IItemRendering color( IItemColor itemColor ); /** * Registers a built-in model under the given resource path. */ - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) IItemRendering builtInModel( String name, IModel model ); } diff --git a/src/main/java/appeng/bootstrap/IModelRegistry.java b/src/main/java/appeng/bootstrap/IModelRegistry.java index 15f114944..78dc72a4c 100644 --- a/src/main/java/appeng/bootstrap/IModelRegistry.java +++ b/src/main/java/appeng/bootstrap/IModelRegistry.java @@ -20,9 +20,7 @@ package appeng.bootstrap; import net.minecraft.block.Block; -import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.renderer.block.statemap.IStateMapper; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/appeng/bootstrap/ItemDefinitionBuilder.java b/src/main/java/appeng/bootstrap/ItemDefinitionBuilder.java index 39b469815..3386a92fb 100644 --- a/src/main/java/appeng/bootstrap/ItemDefinitionBuilder.java +++ b/src/main/java/appeng/bootstrap/ItemDefinitionBuilder.java @@ -26,12 +26,12 @@ import java.util.List; import java.util.function.Function; import java.util.function.Supplier; -import net.minecraft.block.BlockDispenser; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.dispenser.IBehaviorDispenseItem; +import net.minecraft.block.DispenserBlock; +import net.minecraft.dispenser.IDispenseItemBehavior; import net.minecraft.item.Item; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.item.ItemGroup; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import appeng.bootstrap.components.IItemRegistrationComponent; import appeng.bootstrap.components.IPostInitComponent; @@ -56,12 +56,12 @@ class ItemDefinitionBuilder implements IItemBuilder private final List> boostrapComponents = new ArrayList<>(); - private Supplier dispenserBehaviorSupplier; + private Supplier dispenserBehaviorSupplier; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private ItemRendering itemRendering; - private CreativeTabs creativeTab = CreativeTab.instance; + private ItemGroup itemGroup = CreativeTab.instance; ItemDefinitionBuilder( FeatureFactory factory, String registryName, Supplier itemSupplier ) { @@ -97,9 +97,9 @@ class ItemDefinitionBuilder implements IItemBuilder } @Override - public IItemBuilder creativeTab( CreativeTabs tab ) + public IItemBuilder itemGroup( ItemGroup itemGroup ) { - this.creativeTab = tab; + this.itemGroup = itemGroup; return this; } @@ -115,13 +115,13 @@ class ItemDefinitionBuilder implements IItemBuilder } @Override - public IItemBuilder dispenserBehavior( Supplier behavior ) + public IItemBuilder dispenserBehavior( Supplier behavior ) { this.dispenserBehaviorSupplier = behavior; return this; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private void customizeForClient( ItemRenderingCustomizer callback ) { callback.customize( this.itemRendering ); @@ -140,9 +140,6 @@ class ItemDefinitionBuilder implements IItemBuilder ItemDefinition definition = new ItemDefinition( this.registryName, item ); - item.setUnlocalizedName( "appliedenergistics2." + this.registryName ); - item.setCreativeTab( this.creativeTab ); - // Register all extra handlers this.boostrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( item ) ) ); @@ -151,8 +148,8 @@ class ItemDefinitionBuilder implements IItemBuilder { this.factory.addBootstrapComponent( (IPostInitComponent) side -> { - IBehaviorDispenseItem behavior = this.dispenserBehaviorSupplier.get(); - BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, behavior ); + IDispenseItemBehavior behavior = this.dispenserBehaviorSupplier.get(); + DispenserBlock.registerDispenseBehavior( item, behavior ); } ); } diff --git a/src/main/java/appeng/bootstrap/ItemRendering.java b/src/main/java/appeng/bootstrap/ItemRendering.java index 4f34a5cd3..621357769 100644 --- a/src/main/java/appeng/bootstrap/ItemRendering.java +++ b/src/main/java/appeng/bootstrap/ItemRendering.java @@ -29,17 +29,17 @@ import java.util.Set; import com.google.common.collect.ImmutableMap; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; import net.minecraft.client.renderer.color.IItemColor; +import net.minecraft.client.renderer.model.ModelResourceLocation; +import net.minecraft.item.BlockItem; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.IModel; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import appeng.bootstrap.components.ItemColorComponent; import appeng.bootstrap.components.ItemMeshDefinitionComponent; @@ -50,23 +50,23 @@ import appeng.bootstrap.components.ItemVariantsComponent; class ItemRendering implements IItemRendering { - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private IItemColor itemColor; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private ItemMeshDefinition itemMeshDefinition; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private Map itemModels = new HashMap<>(); - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private Set variants = new HashSet<>(); - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private Map builtInModels = new HashMap<>(); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public IItemRendering meshDefinition( ItemMeshDefinition meshDefinition ) { this.itemMeshDefinition = meshDefinition; @@ -74,7 +74,7 @@ class ItemRendering implements IItemRendering } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public IItemRendering model( int meta, ModelResourceLocation model ) { this.itemModels.put( meta, model ); @@ -89,7 +89,7 @@ class ItemRendering implements IItemRendering } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public IItemRendering color( IItemColor itemColor ) { this.itemColor = itemColor; @@ -123,9 +123,9 @@ class ItemRendering implements IItemRendering ModelResourceLocation model; // For block items, the default will try to use the default state of the associated block - if( item instanceof ItemBlock ) + if( item instanceof BlockItem ) { - Block block = ( (ItemBlock) item ).getBlock(); + Block block = ( (BlockItem) item ).getBlock(); // We can only do this once the blocks are actually registered... StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() ); @@ -169,7 +169,7 @@ class ItemRendering implements IItemRendering } @Override - protected ModelResourceLocation getModelResourceLocation( IBlockState state ) + protected ModelResourceLocation getModelResourceLocation( BlockState state ) { return new ModelResourceLocation( this.registryName, this.getPropertyString( state.getProperties() ) ); } diff --git a/src/main/java/appeng/bootstrap/ItemRenderingCustomizer.java b/src/main/java/appeng/bootstrap/ItemRenderingCustomizer.java index 56335d3b5..bc820802b 100644 --- a/src/main/java/appeng/bootstrap/ItemRenderingCustomizer.java +++ b/src/main/java/appeng/bootstrap/ItemRenderingCustomizer.java @@ -19,18 +19,18 @@ package appeng.bootstrap; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; /** * A callback that allows the rendering of a item to be customized. Sadly this class is required and no lambdas can be * used - * due to them not being able to be annotated with @SideOnly(CLIENT). + * due to them not being able to be annotated with @OnlyIn(CLIENT). */ public abstract class ItemRenderingCustomizer { - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public abstract void customize( IItemRendering rendering ); } diff --git a/src/main/java/appeng/bootstrap/components/BlockColorComponent.java b/src/main/java/appeng/bootstrap/components/BlockColorComponent.java index 9a69afcb0..61b2306ee 100644 --- a/src/main/java/appeng/bootstrap/components/BlockColorComponent.java +++ b/src/main/java/appeng/bootstrap/components/BlockColorComponent.java @@ -22,7 +22,7 @@ package appeng.bootstrap.components; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.color.IBlockColor; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; public class BlockColorComponent implements IInitComponent @@ -39,9 +39,9 @@ public class BlockColorComponent implements IInitComponent } @Override - public void initialize( Side side ) + public void initialize( Dist dist ) { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( this.blockColor, this.block ); + Minecraft.getInstance().getBlockColors().register( this.blockColor, this.block ); } } diff --git a/src/main/java/appeng/bootstrap/components/BuiltInModelComponent.java b/src/main/java/appeng/bootstrap/components/BuiltInModelComponent.java index acca358a7..09ec13b15 100644 --- a/src/main/java/appeng/bootstrap/components/BuiltInModelComponent.java +++ b/src/main/java/appeng/bootstrap/components/BuiltInModelComponent.java @@ -24,30 +24,30 @@ import java.util.Map; import com.google.common.base.Preconditions; -import net.minecraftforge.client.model.IModel; +import net.minecraft.client.renderer.model.IUnbakedModel; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.ModelLoaderRegistry; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import appeng.client.render.model.BuiltInModelLoader; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class BuiltInModelComponent implements IPreInitComponent { - private final Map builtInModels = new HashMap<>(); + private final Map builtInModels = new HashMap<>(); private boolean hasInitialized = false; - public void addModel( String path, IModel model ) + public void addModel( String path, IUnbakedModel model ) { Preconditions.checkState( !this.hasInitialized ); this.builtInModels.put( path, model ); } @Override - public void preInitialize( Side side ) + public void preInitialize( Dist dist ) { this.hasInitialized = true; diff --git a/src/main/java/appeng/bootstrap/components/IBlockRegistrationComponent.java b/src/main/java/appeng/bootstrap/components/IBlockRegistrationComponent.java index d53f2f1aa..fabf01b25 100644 --- a/src/main/java/appeng/bootstrap/components/IBlockRegistrationComponent.java +++ b/src/main/java/appeng/bootstrap/components/IBlockRegistrationComponent.java @@ -3,7 +3,7 @@ package appeng.bootstrap.components; import net.minecraft.block.Block; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.registries.IForgeRegistry; import appeng.bootstrap.IBootstrapComponent; @@ -12,5 +12,5 @@ import appeng.bootstrap.IBootstrapComponent; @FunctionalInterface public interface IBlockRegistrationComponent extends IBootstrapComponent { - void blockRegistration( Side side, IForgeRegistry blockRegistry ); + void blockRegistration( Dist dist, IForgeRegistry blockRegistry ); } diff --git a/src/main/java/appeng/bootstrap/components/IEntityRegistrationComponent.java b/src/main/java/appeng/bootstrap/components/IEntityRegistrationComponent.java index 9fe17b436..166725c7d 100644 --- a/src/main/java/appeng/bootstrap/components/IEntityRegistrationComponent.java +++ b/src/main/java/appeng/bootstrap/components/IEntityRegistrationComponent.java @@ -2,7 +2,8 @@ package appeng.bootstrap.components; -import net.minecraftforge.fml.common.registry.EntityEntry; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; import net.minecraftforge.registries.IForgeRegistry; import appeng.bootstrap.IBootstrapComponent; @@ -11,5 +12,5 @@ import appeng.bootstrap.IBootstrapComponent; @FunctionalInterface public interface IEntityRegistrationComponent extends IBootstrapComponent { - void entityRegistration( IForgeRegistry entityRegistry ); + void entityRegistration( IForgeRegistry> entityRegistry ); } diff --git a/src/main/java/appeng/bootstrap/components/IInitComponent.java b/src/main/java/appeng/bootstrap/components/IInitComponent.java index f6f4dc233..178a82963 100644 --- a/src/main/java/appeng/bootstrap/components/IInitComponent.java +++ b/src/main/java/appeng/bootstrap/components/IInitComponent.java @@ -19,7 +19,7 @@ package appeng.bootstrap.components; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IBootstrapComponent; @@ -27,5 +27,5 @@ import appeng.bootstrap.IBootstrapComponent; @FunctionalInterface public interface IInitComponent extends IBootstrapComponent { - void initialize( Side side ); + void initialize( Dist dist ); } diff --git a/src/main/java/appeng/bootstrap/components/IItemRegistrationComponent.java b/src/main/java/appeng/bootstrap/components/IItemRegistrationComponent.java index bcbd548df..05921badd 100644 --- a/src/main/java/appeng/bootstrap/components/IItemRegistrationComponent.java +++ b/src/main/java/appeng/bootstrap/components/IItemRegistrationComponent.java @@ -3,7 +3,7 @@ package appeng.bootstrap.components; import net.minecraft.item.Item; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.registries.IForgeRegistry; import appeng.bootstrap.IBootstrapComponent; @@ -12,5 +12,5 @@ import appeng.bootstrap.IBootstrapComponent; @FunctionalInterface public interface IItemRegistrationComponent extends IBootstrapComponent { - void itemRegistration( Side side, IForgeRegistry itemRegistry ); + void itemRegistration( Dist dist, IForgeRegistry itemRegistry ); } diff --git a/src/main/java/appeng/bootstrap/components/IModelRegistrationComponent.java b/src/main/java/appeng/bootstrap/components/IModelRegistrationComponent.java index 5b1ea9cab..92dc19370 100644 --- a/src/main/java/appeng/bootstrap/components/IModelRegistrationComponent.java +++ b/src/main/java/appeng/bootstrap/components/IModelRegistrationComponent.java @@ -19,7 +19,7 @@ package appeng.bootstrap.components; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IBootstrapComponent; import appeng.bootstrap.IModelRegistry; @@ -32,5 +32,5 @@ import appeng.bootstrap.IModelRegistry; @FunctionalInterface public interface IModelRegistrationComponent extends IBootstrapComponent { - void modelRegistration( Side side, IModelRegistry registry ); + void modelRegistration( Dist dist, IModelRegistry registry ); } diff --git a/src/main/java/appeng/bootstrap/components/IOreDictComponent.java b/src/main/java/appeng/bootstrap/components/IOreDictComponent.java deleted file mode 100644 index cfb704e79..000000000 --- a/src/main/java/appeng/bootstrap/components/IOreDictComponent.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.bootstrap.components; - - -import net.minecraftforge.fml.relauncher.Side; - -import appeng.bootstrap.IBootstrapComponent; - - -@FunctionalInterface -public interface IOreDictComponent extends IBootstrapComponent -{ - void oreRegistration( Side side ); -} diff --git a/src/main/java/appeng/bootstrap/components/IPostInitComponent.java b/src/main/java/appeng/bootstrap/components/IPostInitComponent.java index 3c779d3f8..29459fef5 100644 --- a/src/main/java/appeng/bootstrap/components/IPostInitComponent.java +++ b/src/main/java/appeng/bootstrap/components/IPostInitComponent.java @@ -19,7 +19,7 @@ package appeng.bootstrap.components; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IBootstrapComponent; @@ -27,5 +27,5 @@ import appeng.bootstrap.IBootstrapComponent; @FunctionalInterface public interface IPostInitComponent extends IBootstrapComponent { - void postInitialize( Side side ); + void postInitialize( Dist dist ); } diff --git a/src/main/java/appeng/bootstrap/components/IPreInitComponent.java b/src/main/java/appeng/bootstrap/components/IPreInitComponent.java index 390756d78..ea4285c19 100644 --- a/src/main/java/appeng/bootstrap/components/IPreInitComponent.java +++ b/src/main/java/appeng/bootstrap/components/IPreInitComponent.java @@ -19,7 +19,7 @@ package appeng.bootstrap.components; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IBootstrapComponent; @@ -27,5 +27,5 @@ import appeng.bootstrap.IBootstrapComponent; @FunctionalInterface public interface IPreInitComponent extends IBootstrapComponent { - void preInitialize( Side side ); + void preInitialize( Dist dist ); } diff --git a/src/main/java/appeng/bootstrap/components/IRecipeRegistrationComponent.java b/src/main/java/appeng/bootstrap/components/IRecipeRegistrationComponent.java index 5d6763d8b..583d1af3d 100644 --- a/src/main/java/appeng/bootstrap/components/IRecipeRegistrationComponent.java +++ b/src/main/java/appeng/bootstrap/components/IRecipeRegistrationComponent.java @@ -3,7 +3,7 @@ package appeng.bootstrap.components; import net.minecraft.item.crafting.IRecipe; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.registries.IForgeRegistry; import appeng.bootstrap.IBootstrapComponent; @@ -12,5 +12,5 @@ import appeng.bootstrap.IBootstrapComponent; @FunctionalInterface public interface IRecipeRegistrationComponent extends IBootstrapComponent { - void recipeRegistration( Side side, IForgeRegistry recipeRegistry ); + void recipeRegistration( Dist dist, IForgeRegistry recipeRegistry ); } diff --git a/src/main/java/appeng/bootstrap/components/ItemColorComponent.java b/src/main/java/appeng/bootstrap/components/ItemColorComponent.java index 6ec871511..83e506c76 100644 --- a/src/main/java/appeng/bootstrap/components/ItemColorComponent.java +++ b/src/main/java/appeng/bootstrap/components/ItemColorComponent.java @@ -22,7 +22,7 @@ package appeng.bootstrap.components; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.item.Item; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; public class ItemColorComponent implements IInitComponent @@ -39,8 +39,8 @@ public class ItemColorComponent implements IInitComponent } @Override - public void initialize( Side side ) + public void initialize( Dist dist ) { - Minecraft.getMinecraft().getItemColors().registerItemColorHandler( this.itemColor, this.item ); + Minecraft.getInstance().getItemColors().register( this.itemColor, this.item ); } } diff --git a/src/main/java/appeng/bootstrap/components/ItemMeshDefinitionComponent.java b/src/main/java/appeng/bootstrap/components/ItemMeshDefinitionComponent.java index 55de5887c..94848134a 100644 --- a/src/main/java/appeng/bootstrap/components/ItemMeshDefinitionComponent.java +++ b/src/main/java/appeng/bootstrap/components/ItemMeshDefinitionComponent.java @@ -23,7 +23,7 @@ import javax.annotation.Nonnull; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.item.Item; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IModelRegistry; @@ -46,7 +46,7 @@ public class ItemMeshDefinitionComponent implements IModelRegistrationComponent } @Override - public void modelRegistration( Side side, IModelRegistry registry ) + public void modelRegistration( Dist dist, IModelRegistry registry ) { registry.setCustomMeshDefinition( this.item, this.meshDefinition ); } diff --git a/src/main/java/appeng/bootstrap/components/ItemModelComponent.java b/src/main/java/appeng/bootstrap/components/ItemModelComponent.java index a7ec341da..d9bce58fb 100644 --- a/src/main/java/appeng/bootstrap/components/ItemModelComponent.java +++ b/src/main/java/appeng/bootstrap/components/ItemModelComponent.java @@ -23,9 +23,9 @@ import java.util.Map; import javax.annotation.Nonnull; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.item.Item; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IModelRegistry; @@ -48,7 +48,7 @@ public class ItemModelComponent implements IModelRegistrationComponent } @Override - public void modelRegistration( Side side, IModelRegistry registry ) + public void modelRegistration( Dist dist, IModelRegistry registry ) { this.modelsByMeta.forEach( ( meta, model ) -> { diff --git a/src/main/java/appeng/bootstrap/components/ItemVariantsComponent.java b/src/main/java/appeng/bootstrap/components/ItemVariantsComponent.java index bf4e5c80d..f2421b0c7 100644 --- a/src/main/java/appeng/bootstrap/components/ItemVariantsComponent.java +++ b/src/main/java/appeng/bootstrap/components/ItemVariantsComponent.java @@ -23,7 +23,7 @@ import java.util.Collection; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IModelRegistry; @@ -42,7 +42,7 @@ public class ItemVariantsComponent implements IModelRegistrationComponent } @Override - public void modelRegistration( Side side, IModelRegistry registry ) + public void modelRegistration( Dist dist, IModelRegistry registry ) { ResourceLocation[] resourceArr = this.resources.toArray( new ResourceLocation[0] ); registry.registerItemVariants( this.item, resourceArr ); diff --git a/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java b/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java index 215ccc2cb..cb9f97186 100644 --- a/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java +++ b/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java @@ -26,15 +26,15 @@ import java.util.function.BiFunction; import com.google.common.collect.Sets; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.util.registry.IRegistry; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.ModelLoaderRegistry; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.eventbus.api.SubscribeEvent; import appeng.core.AppEng; @@ -53,7 +53,7 @@ public class ModelOverrideComponent implements IPreInitComponent } @Override - public void preInitialize( Side side ) + public void preInitialize( Dist dist ) { MinecraftForge.EVENT_BUS.register( this ); } diff --git a/src/main/java/appeng/bootstrap/components/StateMapperComponent.java b/src/main/java/appeng/bootstrap/components/StateMapperComponent.java index cd44242e6..63a7cd6f0 100644 --- a/src/main/java/appeng/bootstrap/components/StateMapperComponent.java +++ b/src/main/java/appeng/bootstrap/components/StateMapperComponent.java @@ -24,7 +24,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; import appeng.bootstrap.IModelRegistry; @@ -46,12 +46,12 @@ public class StateMapperComponent implements IModelRegistrationComponent } @Override - public void modelRegistration( Side side, IModelRegistry registry ) + public void modelRegistration( Dist dist, IModelRegistry registry ) { registry.setCustomStateMapper( this.block, this.stateMapper ); if( this.stateMapper instanceof IResourceManagerReloadListener ) { - ( (IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager() ) + ( (IReloadableResourceManager) Minecraft.getInstance().getResourceManager() ) .registerReloadListener( (IResourceManagerReloadListener) this.stateMapper ); } } diff --git a/src/main/java/appeng/bootstrap/components/TesrComponent.java b/src/main/java/appeng/bootstrap/components/TesrComponent.java index 03c6b5670..b69c121d3 100644 --- a/src/main/java/appeng/bootstrap/components/TesrComponent.java +++ b/src/main/java/appeng/bootstrap/components/TesrComponent.java @@ -19,9 +19,13 @@ package appeng.bootstrap.components; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import java.util.function.Function; + +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.tileentity.TileEntityType; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.client.registry.ClientRegistry; -import net.minecraftforge.fml.relauncher.Side; import appeng.tile.AEBaseTile; @@ -31,24 +35,23 @@ import appeng.tile.AEBaseTile; * * @param */ -// public class TesrComponent implements ModelRegComponent public class TesrComponent implements IPreInitComponent { - private final Class tileEntityClass; + private final TileEntityType tileEntityClass; - private final TileEntitySpecialRenderer tesr; + private final Function> ter; - public TesrComponent( Class tileEntityClass, TileEntitySpecialRenderer tesr ) + public TesrComponent( TileEntityType tileEntityClass, Function> ter ) { this.tileEntityClass = tileEntityClass; - this.tesr = tesr; + this.ter = ter; } @Override - // public void modelReg( Side side ) - public void preInitialize( Side side ) + // public void modelReg( Dist dist ) + public void preInitialize( Dist dist ) { - ClientRegistry.bindTileEntitySpecialRenderer( this.tileEntityClass, this.tesr ); + ClientRegistry.bindTileEntityRenderer( this.tileEntityClass, this.ter ); } } diff --git a/src/main/java/appeng/bootstrap/components/TileEntityComponent.java b/src/main/java/appeng/bootstrap/components/TileEntityComponent.java index 0d847bf72..dc270b220 100644 --- a/src/main/java/appeng/bootstrap/components/TileEntityComponent.java +++ b/src/main/java/appeng/bootstrap/components/TileEntityComponent.java @@ -5,8 +5,8 @@ package appeng.bootstrap.components; import java.util.ArrayList; import java.util.List; +import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.Side; import appeng.bootstrap.definitions.TileEntityDefinition; import appeng.core.AppEng; @@ -32,7 +32,7 @@ public class TileEntityComponent implements IPreInitComponent } @Override - public void preInitialize( Side side ) + public void preInitialize( Dist dist ) { for( TileEntityDefinition tileEntityDefinition : this.tileEntityDefinitions ) { diff --git a/src/main/java/appeng/capabilities/Capabilities.java b/src/main/java/appeng/capabilities/Capabilities.java index e0786555a..293803b19 100644 --- a/src/main/java/appeng/capabilities/Capabilities.java +++ b/src/main/java/appeng/capabilities/Capabilities.java @@ -19,10 +19,8 @@ package appeng.capabilities; -import net.darkhax.tesla.api.ITeslaConsumer; -import net.darkhax.tesla.api.ITeslaHolder; -import net.minecraft.nbt.NBTBase; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.INBT; +import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; @@ -30,8 +28,6 @@ import net.minecraftforge.energy.IEnergyStorage; import appeng.api.storage.ISpatialDimension; import appeng.api.storage.IStorageMonitorableAccessor; -import appeng.integration.IntegrationRegistry; -import appeng.integration.IntegrationType; /** @@ -48,10 +44,6 @@ public final class Capabilities public static Capability SPATIAL_DIMENSION; - public static Capability TESLA_CONSUMER; - - public static Capability TESLA_HOLDER; - public static Capability FORGE_ENERGY; /** @@ -75,24 +67,6 @@ public final class Capabilities SPATIAL_DIMENSION = cap; } - @CapabilityInject( ITeslaConsumer.class ) - private static void capITeslaConsumerRegistered( Capability cap ) - { - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.TESLA ) ) - { - TESLA_CONSUMER = cap; - } - } - - @CapabilityInject( ITeslaHolder.class ) - private static void capITeslaHolderRegistered( Capability cap ) - { - if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.TESLA ) ) - { - TESLA_HOLDER = cap; - } - } - @CapabilityInject( IEnergyStorage.class ) private static void capIEnergyStorageRegistered( Capability cap ) { @@ -105,13 +79,13 @@ public final class Capabilities return new Capability.IStorage() { @Override - public NBTBase writeNBT( Capability capability, T instance, EnumFacing side ) + public INBT writeNBT( Capability capability, T instance, Direction side ) { return null; } @Override - public void readNBT( Capability capability, T instance, EnumFacing side, NBTBase nbt ) + public void readNBT( Capability capability, T instance, Direction side, INBT nbt ) { } diff --git a/src/main/java/appeng/client/ClientHelper.java b/src/main/java/appeng/client/ClientHelper.java index 2731555fb..f9c656536 100644 --- a/src/main/java/appeng/client/ClientHelper.java +++ b/src/main/java/appeng/client/ClientHelper.java @@ -28,10 +28,10 @@ import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.settings.KeyBinding; -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.tileentity.TileEntity; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; @@ -111,7 +111,7 @@ public class ClientHelper extends ServerHelper { if( Platform.isClient() ) { - return Minecraft.getMinecraft().world; + return Minecraft.getInstance().world; } else { @@ -126,12 +126,12 @@ public class ClientHelper extends ServerHelper } @Override - public List getPlayers() + public List getPlayers() { if( Platform.isClient() ) { - final List o = new ArrayList<>(); - o.add( Minecraft.getMinecraft().player ); + final List o = new ArrayList<>(); + o.add( Minecraft.getInstance().player ); return o; } else @@ -173,7 +173,7 @@ public class ClientHelper extends ServerHelper @Override public boolean shouldAddParticles( final Random r ) { - final int setting = Minecraft.getMinecraft().gameSettings.particleSetting; + final int setting = Minecraft.getInstance().gameSettings.particleSetting; if( setting == 2 ) { return false; @@ -188,7 +188,7 @@ public class ClientHelper extends ServerHelper @Override public RayTraceResult getRTR() { - return Minecraft.getMinecraft().objectMouseOver; + return Minecraft.getInstance().objectMouseOver; } @Override @@ -204,8 +204,8 @@ public class ClientHelper extends ServerHelper return super.getRenderMode(); } - final Minecraft mc = Minecraft.getMinecraft(); - final EntityPlayer player = mc.player; + final Minecraft mc = Minecraft.getInstance(); + final PlayerEntity player = mc.player; return this.renderModeForPlayer( player ); } @@ -213,13 +213,13 @@ public class ClientHelper extends ServerHelper @Override public void triggerUpdates() { - final Minecraft mc = Minecraft.getMinecraft(); + final Minecraft mc = Minecraft.getInstance(); if( mc == null || mc.player == null || mc.world == null ) { return; } - final EntityPlayer player = mc.player; + final PlayerEntity player = mc.player; final int x = (int) player.posX; final int y = (int) player.posY; @@ -250,7 +250,7 @@ public class ClientHelper extends ServerHelper final PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o; final AssemblerFX fx = new AssemblerFX( world, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } private void spawnVibrant( final World w, final double x, final double y, final double z ) @@ -262,7 +262,7 @@ public class ClientHelper extends ServerHelper final double d2 = ( Platform.getRandomFloat() - 0.5F ) * 0.26D; final VibrantFX fx = new VibrantFX( w, x + d0, y + d1, z + d2, 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } @@ -278,7 +278,7 @@ public class ClientHelper extends ServerHelper fx.setMotionY( -y * 0.2f ); fx.setMotionZ( -z * 0.2f ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } private void spawnEnergy( final World w, final double posX, final double posY, final double posZ ) @@ -293,19 +293,19 @@ public class ClientHelper extends ServerHelper fx.setMotionY( -y * 0.1f ); fx.setMotionZ( -z * 0.1f ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } private void spawnLightning( final World world, final double posX, final double posY, final double posZ ) { final LightningFX fx = new LightningFX( world, posX, posY + 0.3f, posZ, 0.0f, 0.0f, 0.0f ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } private void spawnLightningArc( final World world, final double posX, final double posY, final double posZ, final Vec3d second ) { final LightningFX fx = new LightningArcFX( world, posX, posY, posZ, second.x, second.y, second.z, 0.0f, 0.0f, 0.0f ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } @SubscribeEvent @@ -316,12 +316,12 @@ public class ClientHelper extends ServerHelper return; } - final Minecraft mc = Minecraft.getMinecraft(); - final EntityPlayer player = mc.player; - if( player.isSneaking() ) + final Minecraft mc = Minecraft.getInstance(); + final PlayerEntity player = mc.player; + if( player.isShiftKeyDown() ) { - final boolean mainHand = player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem; - final boolean offHand = player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem; + final boolean mainHand = player.getHeldItem( Hand.MAIN_HAND ).getItem() instanceof IMouseWheelItem; + final boolean offHand = player.getHeldItem( Hand.OFF_HAND ).getItem() instanceof IMouseWheelItem; if( mainHand || offHand ) { diff --git a/src/main/java/appeng/client/gui/AEBaseGui.java b/src/main/java/appeng/client/gui/AEBaseGui.java index 3576e306f..f240a40f1 100644 --- a/src/main/java/appeng/client/gui/AEBaseGui.java +++ b/src/main/java/appeng/client/gui/AEBaseGui.java @@ -49,7 +49,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -385,7 +385,7 @@ public abstract class AEBaseGui extends GuiContainer @Override protected void handleMouseClick( final Slot slot, final int slotIdx, final int mouseButton, final ClickType clickType ) { - final EntityPlayer player = Minecraft.getMinecraft().player; + final PlayerEntity player = Minecraft.getInstance().player; if( slot instanceof SlotFake ) { @@ -793,8 +793,8 @@ public abstract class AEBaseGui extends GuiContainer GlStateManager.disableLighting(); GlStateManager.disableBlend(); final Fluid fluid = fs.getFluid(); - Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); - final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() ); + Minecraft.getInstance().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE ); + final TextureAtlasSprite sprite = Minecraft.getInstance().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() ); // Set color for dynamic fluids // Convert int color to RGB diff --git a/src/main/java/appeng/client/gui/Size1Slot.java b/src/main/java/appeng/client/gui/Size1Slot.java index c969651a4..e84ae5c10 100644 --- a/src/main/java/appeng/client/gui/Size1Slot.java +++ b/src/main/java/appeng/client/gui/Size1Slot.java @@ -6,13 +6,13 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -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.SlotItemHandler; @@ -72,34 +72,34 @@ class Size1Slot extends SlotItemHandler @Override @Nullable - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public String getSlotTexture() { return this.delegate.getSlotTexture(); } @Override - public boolean canTakeStack( EntityPlayer playerIn ) + public boolean canTakeStack( PlayerEntity playerIn ) { return this.delegate.canTakeStack( playerIn ); } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public boolean isEnabled() { return this.delegate.isEnabled(); } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public ResourceLocation getBackgroundLocation() { return this.delegate.getBackgroundLocation(); } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public TextureAtlasSprite getBackgroundSprite() { return this.delegate.getBackgroundSprite(); diff --git a/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java b/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java index 80aa32481..a53446aa5 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCellWorkbench.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -53,9 +53,9 @@ public class GuiCellWorkbench extends GuiUpgradeable private GuiImgButton partition; private GuiToggleButton copyMode; - public GuiCellWorkbench( final InventoryPlayer inventoryPlayer, final TileCellWorkbench te ) + public GuiCellWorkbench( final PlayerInventory PlayerInventory, final TileCellWorkbench te ) { - super( new ContainerCellWorkbench( inventoryPlayer, te ) ); + super( new ContainerCellWorkbench( PlayerInventory, te ) ); this.workbench = (ContainerCellWorkbench) this.inventorySlots; this.ySize = 251; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiChest.java b/src/main/java/appeng/client/gui/implementations/GuiChest.java index 2c7c5e45b..ad61ac67b 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiChest.java +++ b/src/main/java/appeng/client/gui/implementations/GuiChest.java @@ -22,7 +22,7 @@ package appeng.client.gui.implementations; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.client.gui.widgets.GuiTabButton; @@ -39,9 +39,9 @@ public class GuiChest extends AEBaseGui private GuiTabButton priority; - public GuiChest( final InventoryPlayer inventoryPlayer, final TileChest te ) + public GuiChest( final PlayerInventory PlayerInventory, final TileChest te ) { - super( new ContainerChest( inventoryPlayer, te ) ); + super( new ContainerChest( PlayerInventory, te ) ); this.ySize = 166; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiCondenser.java b/src/main/java/appeng/client/gui/implementations/GuiCondenser.java index 0d087f7b1..c1da5aa56 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCondenser.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCondenser.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.Settings; import appeng.client.gui.AEBaseGui; @@ -45,9 +45,9 @@ public class GuiCondenser extends AEBaseGui private GuiProgressBar pb; private GuiImgButton mode; - public GuiCondenser( final InventoryPlayer inventoryPlayer, final TileCondenser te ) + public GuiCondenser( final PlayerInventory PlayerInventory, final TileCondenser te ) { - super( new ContainerCondenser( inventoryPlayer, te ) ); + super( new ContainerCondenser( PlayerInventory, te ) ); this.cvc = (ContainerCondenser) this.inventorySlots; this.ySize = 197; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java index 5babd6e4f..0869ae471 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java @@ -22,7 +22,7 @@ package appeng.client.gui.implementations; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -66,9 +66,9 @@ public class GuiCraftAmount extends AEBaseGui private GuiBridge originalGui; @Reflected - public GuiCraftAmount( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiCraftAmount( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - super( new ContainerCraftAmount( inventoryPlayer, te ) ); + super( new ContainerCraftAmount( PlayerInventory, te ) ); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java index 9eb962ae5..88d8e108d 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftConfirm.java @@ -31,7 +31,7 @@ import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -74,9 +74,9 @@ public class GuiCraftConfirm extends AEBaseGui private GuiButton selectCPU; private int tooltip = -1; - public GuiCraftConfirm( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiCraftConfirm( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - super( new ContainerCraftConfirm( inventoryPlayer, te ) ); + super( new ContainerCraftConfirm( PlayerInventory, te ) ); this.xSize = 238; this.ySize = 206; diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java index f51a7a9a4..cf8fc2689 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingCPU.java @@ -31,7 +31,7 @@ import org.apache.commons.lang3.time.DurationFormatUtils; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -92,9 +92,9 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource private GuiButton cancel; private int tooltip = -1; - public GuiCraftingCPU( final InventoryPlayer inventoryPlayer, final Object te ) + public GuiCraftingCPU( final PlayerInventory PlayerInventory, final Object te ) { - this( new ContainerCraftingCPU( inventoryPlayer, te ) ); + this( new ContainerCraftingCPU( PlayerInventory, te ) ); } protected GuiCraftingCPU( final ContainerCraftingCPU container ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java index b6257522b..954e8ee87 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingStatus.java @@ -28,7 +28,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -59,9 +59,9 @@ public class GuiCraftingStatus extends GuiCraftingCPU private GuiBridge originalGui; private ItemStack myIcon = ItemStack.EMPTY; - public GuiCraftingStatus( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiCraftingStatus( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - super( new ContainerCraftingStatus( inventoryPlayer, te ) ); + super( new ContainerCraftingStatus( PlayerInventory, te ) ); this.status = (ContainerCraftingStatus) this.inventorySlots; final Object target = this.status.getTarget(); diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java index a609cafe0..01161a6e7 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftingTerm.java @@ -20,7 +20,7 @@ package appeng.client.gui.implementations; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; @@ -41,9 +41,9 @@ public class GuiCraftingTerm extends GuiMEMonitorable private GuiImgButton clearBtn; - public GuiCraftingTerm( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiCraftingTerm( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) ); + super( PlayerInventory, te, new ContainerCraftingTerm( PlayerInventory, te ) ); this.setReservedSpace( 73 ); } diff --git a/src/main/java/appeng/client/gui/implementations/GuiDrive.java b/src/main/java/appeng/client/gui/implementations/GuiDrive.java index 6e332e567..29c474ca7 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiDrive.java +++ b/src/main/java/appeng/client/gui/implementations/GuiDrive.java @@ -22,7 +22,7 @@ package appeng.client.gui.implementations; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.client.gui.widgets.GuiTabButton; @@ -39,9 +39,9 @@ public class GuiDrive extends AEBaseGui private GuiTabButton priority; - public GuiDrive( final InventoryPlayer inventoryPlayer, final TileDrive te ) + public GuiDrive( final PlayerInventory PlayerInventory, final TileDrive te ) { - super( new ContainerDrive( inventoryPlayer, te ) ); + super( new ContainerDrive( PlayerInventory, te ) ); this.ySize = 199; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java index 8b8646be3..32293dc56 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java +++ b/src/main/java/appeng/client/gui/implementations/GuiFormationPlane.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.FuzzyMode; import appeng.api.config.Settings; @@ -46,9 +46,9 @@ public class GuiFormationPlane extends GuiUpgradeable private GuiTabButton priority; private GuiImgButton placeMode; - public GuiFormationPlane( final InventoryPlayer inventoryPlayer, final PartFormationPlane te ) + public GuiFormationPlane( final PlayerInventory PlayerInventory, final PartFormationPlane te ) { - super( new ContainerFormationPlane( inventoryPlayer, te ) ); + super( new ContainerFormationPlane( PlayerInventory, te ) ); this.ySize = 251; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiGrinder.java b/src/main/java/appeng/client/gui/implementations/GuiGrinder.java index 2fc12b54e..8734fce62 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiGrinder.java +++ b/src/main/java/appeng/client/gui/implementations/GuiGrinder.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerGrinder; @@ -30,9 +30,9 @@ import appeng.tile.grindstone.TileGrinder; public class GuiGrinder extends AEBaseGui { - public GuiGrinder( final InventoryPlayer inventoryPlayer, final TileGrinder te ) + public GuiGrinder( final PlayerInventory PlayerInventory, final TileGrinder te ) { - super( new ContainerGrinder( inventoryPlayer, te ) ); + super( new ContainerGrinder( PlayerInventory, te ) ); this.ySize = 176; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiIOPort.java b/src/main/java/appeng/client/gui/implementations/GuiIOPort.java index fa63b7e54..a81bc7736 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiIOPort.java +++ b/src/main/java/appeng/client/gui/implementations/GuiIOPort.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.AEApi; import appeng.api.config.FullnessMode; @@ -46,9 +46,9 @@ public class GuiIOPort extends GuiUpgradeable private GuiImgButton fullMode; private GuiImgButton operationMode; - public GuiIOPort( final InventoryPlayer inventoryPlayer, final TileIOPort te ) + public GuiIOPort( final PlayerInventory PlayerInventory, final TileIOPort te ) { - super( new ContainerIOPort( inventoryPlayer, te ) ); + super( new ContainerIOPort( PlayerInventory, te ) ); this.ySize = 166; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInscriber.java b/src/main/java/appeng/client/gui/implementations/GuiInscriber.java index 2c6dfc018..7e60db325 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInscriber.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInscriber.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.client.gui.widgets.GuiProgressBar; @@ -36,9 +36,9 @@ public class GuiInscriber extends AEBaseGui private final ContainerInscriber cvc; private GuiProgressBar pb; - public GuiInscriber( final InventoryPlayer inventoryPlayer, final TileInscriber te ) + public GuiInscriber( final PlayerInventory PlayerInventory, final TileInscriber te ) { - super( new ContainerInscriber( inventoryPlayer, te ) ); + super( new ContainerInscriber( PlayerInventory, te ) ); this.cvc = (ContainerInscriber) this.inventorySlots; this.ySize = 176; this.xSize = this.hasToolbox() ? 246 : 211; diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterface.java b/src/main/java/appeng/client/gui/implementations/GuiInterface.java index d479901d2..a894e4d26 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterface.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterface.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.Settings; import appeng.api.config.YesNo; @@ -47,9 +47,9 @@ public class GuiInterface extends GuiUpgradeable private GuiImgButton BlockMode; private GuiToggleButton interfaceMode; - public GuiInterface( final InventoryPlayer inventoryPlayer, final IInterfaceHost te ) + public GuiInterface( final PlayerInventory PlayerInventory, final IInterfaceHost te ) { - super( new ContainerInterface( inventoryPlayer, te ) ); + super( new ContainerInterface( PlayerInventory, te ) ); this.ySize = 211; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java index b5d3903e8..29c472f57 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java @@ -32,10 +32,10 @@ import java.util.WeakHashMap; import com.google.common.collect.HashMultimap; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTTagList; import appeng.api.AEApi; @@ -69,9 +69,9 @@ public class GuiInterfaceTerminal extends AEBaseGui private boolean refreshList = false; private MEGuiTextField searchField; - public GuiInterfaceTerminal( final InventoryPlayer inventoryPlayer, final PartInterfaceTerminal te ) + public GuiInterfaceTerminal( final PlayerInventory PlayerInventory, final PartInterfaceTerminal te ) { - super( new ContainerInterfaceTerminal( inventoryPlayer, te ) ); + super( new ContainerInterfaceTerminal( PlayerInventory, te ) ); final GuiScrollbar scrollbar = new GuiScrollbar(); this.setScrollBar( scrollbar ); @@ -209,7 +209,7 @@ public class GuiInterfaceTerminal extends AEBaseGui } } - public void postUpdate( final NBTTagCompound in ) + public void postUpdate( final CompoundNBT in ) { if( in.getBoolean( "clear" ) ) { @@ -225,7 +225,7 @@ public class GuiInterfaceTerminal extends AEBaseGui try { final long id = Long.parseLong( key.substring( 1 ), Character.MAX_RADIX ); - final NBTTagCompound invData = in.getCompoundTag( key ); + final CompoundNBT invData = in.getCompoundTag( key ); final ClientDCInternalInv current = this.getById( id, invData.getLong( "sortBy" ), invData.getString( "un" ) ); for( int x = 0; x < current.getInventory().getSlots(); x++ ) @@ -331,7 +331,7 @@ public class GuiInterfaceTerminal extends AEBaseGui return false; } - final NBTTagCompound encodedValue = itemStack.getTagCompound(); + final CompoundNBT encodedValue = itemStack.getTagCompound(); if( encodedValue == null ) { diff --git a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java index cdd60a4a6..356562066 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java +++ b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.FuzzyMode; import appeng.api.config.LevelType; @@ -61,9 +61,9 @@ public class GuiLevelEmitter extends GuiUpgradeable private GuiImgButton levelMode; private GuiImgButton craftingMode; - public GuiLevelEmitter( final InventoryPlayer inventoryPlayer, final PartLevelEmitter te ) + public GuiLevelEmitter( final PlayerInventory PlayerInventory, final PartLevelEmitter te ) { - super( new ContainerLevelEmitter( inventoryPlayer, te ) ); + super( new ContainerLevelEmitter( PlayerInventory, te ) ); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiMAC.java b/src/main/java/appeng/client/gui/implementations/GuiMAC.java index 3e58982d8..47143ce7e 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMAC.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMAC.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.RedstoneMode; import appeng.api.config.Settings; @@ -37,9 +37,9 @@ public class GuiMAC extends GuiUpgradeable private final ContainerMAC container; private GuiProgressBar pb; - public GuiMAC( final InventoryPlayer inventoryPlayer, final TileMolecularAssembler te ) + public GuiMAC( final PlayerInventory PlayerInventory, final TileMolecularAssembler te ) { - super( new ContainerMAC( inventoryPlayer, te ) ); + super( new ContainerMAC( PlayerInventory, te ) ); this.ySize = 197; this.container = (ContainerMAC) this.inventorySlots; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java index 97611d1d2..dd9c3485d 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java @@ -26,7 +26,7 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -101,12 +101,12 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi private int currentMouseX = 0; private int currentMouseY = 0; - public GuiMEMonitorable( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiMEMonitorable( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - this( inventoryPlayer, te, new ContainerMEMonitorable( inventoryPlayer, te ) ); + this( PlayerInventory, te, new ContainerMEMonitorable( PlayerInventory, te ) ); } - public GuiMEMonitorable( final InventoryPlayer inventoryPlayer, final ITerminalHost te, final ContainerMEMonitorable c ) + public GuiMEMonitorable( final PlayerInventory PlayerInventory, final ITerminalHost te, final ContainerMEMonitorable c ) { super( c ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java b/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java index b43afef93..c246f9fdb 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEPortableCell.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.implementations.guiobjects.IPortableCell; import appeng.container.implementations.ContainerMEPortableCell; @@ -28,9 +28,9 @@ import appeng.container.implementations.ContainerMEPortableCell; public class GuiMEPortableCell extends GuiMEMonitorable { - public GuiMEPortableCell( final InventoryPlayer inventoryPlayer, final IPortableCell te ) + public GuiMEPortableCell( final PlayerInventory PlayerInventory, final IPortableCell te ) { - super( inventoryPlayer, te, new ContainerMEPortableCell( inventoryPlayer, te ) ); + super( PlayerInventory, te, new ContainerMEPortableCell( PlayerInventory, te ) ); } int defaultGetMaxRows() diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java index 809870f32..2230aab44 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkStatus.java @@ -27,7 +27,7 @@ import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -57,9 +57,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource private GuiImgButton units; private int tooltip = -1; - public GuiNetworkStatus( final InventoryPlayer inventoryPlayer, final INetworkTool te ) + public GuiNetworkStatus( final PlayerInventory PlayerInventory, final INetworkTool te ) { - super( new ContainerNetworkStatus( inventoryPlayer, te ) ); + super( new ContainerNetworkStatus( PlayerInventory, te ) ); final GuiScrollbar scrollbar = new GuiScrollbar(); this.setScrollBar( scrollbar ); diff --git a/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java b/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java index 9c3d726a0..660674896 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java +++ b/src/main/java/appeng/client/gui/implementations/GuiNetworkTool.java @@ -22,7 +22,7 @@ package appeng.client.gui.implementations; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.implementations.guiobjects.INetworkTool; import appeng.client.gui.AEBaseGui; @@ -39,9 +39,9 @@ public class GuiNetworkTool extends AEBaseGui private GuiToggleButton tFacades; - public GuiNetworkTool( final InventoryPlayer inventoryPlayer, final INetworkTool te ) + public GuiNetworkTool( final PlayerInventory PlayerInventory, final INetworkTool te ) { - super( new ContainerNetworkTool( inventoryPlayer, te ) ); + super( new ContainerNetworkTool( PlayerInventory, te ) ); this.ySize = 166; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java index 1bcee7ae8..31e97f446 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPatternTerm.java @@ -22,8 +22,8 @@ package appeng.client.gui.implementations; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Blocks; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import appeng.api.config.ActionItems; @@ -61,9 +61,9 @@ public class GuiPatternTerm extends GuiMEMonitorable private GuiImgButton encodeBtn; private GuiImgButton clearBtn; - public GuiPatternTerm( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiPatternTerm( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) ); + super( PlayerInventory, te, new ContainerPatternTerm( PlayerInventory, te ) ); this.container = (ContainerPatternTerm) this.inventorySlots; this.setReservedSpace( 81 ); } diff --git a/src/main/java/appeng/client/gui/implementations/GuiPriority.java b/src/main/java/appeng/client/gui/implementations/GuiPriority.java index 801069240..b4a425e66 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPriority.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPriority.java @@ -22,7 +22,7 @@ package appeng.client.gui.implementations; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import appeng.client.gui.AEBaseGui; @@ -56,9 +56,9 @@ public class GuiPriority extends AEBaseGui private GuiBridge OriginalGui; - public GuiPriority( final InventoryPlayer inventoryPlayer, final IPriorityHost te ) + public GuiPriority( final PlayerInventory PlayerInventory, final IPriorityHost te ) { - super( new ContainerPriority( inventoryPlayer, te ) ); + super( new ContainerPriority( PlayerInventory, te ) ); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiQNB.java b/src/main/java/appeng/client/gui/implementations/GuiQNB.java index d029c16a7..1638bfee7 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiQNB.java +++ b/src/main/java/appeng/client/gui/implementations/GuiQNB.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerQNB; @@ -30,9 +30,9 @@ import appeng.tile.qnb.TileQuantumBridge; public class GuiQNB extends AEBaseGui { - public GuiQNB( final InventoryPlayer inventoryPlayer, final TileQuantumBridge te ) + public GuiQNB( final PlayerInventory PlayerInventory, final TileQuantumBridge te ) { - super( new ContainerQNB( inventoryPlayer, te ) ); + super( new ContainerQNB( PlayerInventory, te ) ); this.ySize = 166; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java index 6468b6017..5829f4d94 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java +++ b/src/main/java/appeng/client/gui/implementations/GuiQuartzKnife.java @@ -22,7 +22,7 @@ package appeng.client.gui.implementations; import java.io.IOException; import net.minecraft.client.gui.GuiTextField; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerQuartzKnife; @@ -38,9 +38,9 @@ public class GuiQuartzKnife extends AEBaseGui private GuiTextField name; - public GuiQuartzKnife( final InventoryPlayer inventoryPlayer, final QuartzKnifeObj te ) + public GuiQuartzKnife( final PlayerInventory PlayerInventory, final QuartzKnifeObj te ) { - super( new ContainerQuartzKnife( inventoryPlayer, te ) ); + super( new ContainerQuartzKnife( PlayerInventory, te ) ); this.ySize = 184; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java b/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java index b2b2904a4..ce3f39888 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSecurityStation.java @@ -21,7 +21,7 @@ package appeng.client.gui.implementations; import java.io.IOException; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.SecurityPermissions; import appeng.api.config.SortOrder; @@ -43,9 +43,9 @@ public class GuiSecurityStation extends GuiMEMonitorable private GuiToggleButton build; private GuiToggleButton security; - public GuiSecurityStation( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiSecurityStation( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - super( inventoryPlayer, te, new ContainerSecurityStation( inventoryPlayer, te ) ); + super( PlayerInventory, te, new ContainerSecurityStation( PlayerInventory, te ) ); this.setCustomSortOrder( false ); this.setReservedSpace( 33 ); @@ -102,19 +102,19 @@ public class GuiSecurityStation extends GuiMEMonitorable final int top = this.guiTop + this.ySize - 116; this.buttonList.add( this.inject = new GuiToggleButton( this.guiLeft + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT - .getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) ); + .getTranslationKey(), SecurityPermissions.INJECT.getUnlocalizedTip() ) ); this.buttonList.add( this.extract = new GuiToggleButton( this.guiLeft + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1, SecurityPermissions.EXTRACT - .getUnlocalizedName(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) ); + .getTranslationKey(), SecurityPermissions.EXTRACT.getUnlocalizedTip() ) ); this.buttonList.add( this.craft = new GuiToggleButton( this.guiLeft + 56 + 18 * 2, top, 11 * 16 + 2, 12 * 16 + 2, SecurityPermissions.CRAFT - .getUnlocalizedName(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) ); + .getTranslationKey(), SecurityPermissions.CRAFT.getUnlocalizedTip() ) ); this.buttonList.add( this.build = new GuiToggleButton( this.guiLeft + 56 + 18 * 3, top, 11 * 16 + 3, 12 * 16 + 3, SecurityPermissions.BUILD - .getUnlocalizedName(), SecurityPermissions.BUILD.getUnlocalizedTip() ) ); + .getTranslationKey(), SecurityPermissions.BUILD.getUnlocalizedTip() ) ); this.buttonList.add( this.security = new GuiToggleButton( this.guiLeft + 56 + 18 * 4, top, 11 * 16 + 4, 12 * 16 + 4, SecurityPermissions.SECURITY - .getUnlocalizedName(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) ); + .getTranslationKey(), SecurityPermissions.SECURITY.getUnlocalizedTip() ) ); } @Override diff --git a/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java b/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java index 9ef1dccd7..21547202a 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSkyChest.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.container.implementations.ContainerSkyChest; @@ -31,9 +31,9 @@ import appeng.tile.storage.TileSkyChest; public class GuiSkyChest extends AEBaseGui { - public GuiSkyChest( final InventoryPlayer inventoryPlayer, final TileSkyChest te ) + public GuiSkyChest( final PlayerInventory PlayerInventory, final TileSkyChest te ) { - super( new ContainerSkyChest( inventoryPlayer, te ) ); + super( new ContainerSkyChest( PlayerInventory, te ) ); this.ySize = 195; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java b/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java index 7aadaae46..afc8e6772 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java +++ b/src/main/java/appeng/client/gui/implementations/GuiSpatialIOPort.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.Settings; import appeng.client.gui.AEBaseGui; @@ -42,9 +42,9 @@ public class GuiSpatialIOPort extends AEBaseGui private final ContainerSpatialIOPort container; private GuiImgButton units; - public GuiSpatialIOPort( final InventoryPlayer inventoryPlayer, final TileSpatialIOPort te ) + public GuiSpatialIOPort( final PlayerInventory PlayerInventory, final TileSpatialIOPort te ) { - super( new ContainerSpatialIOPort( inventoryPlayer, te ) ); + super( new ContainerSpatialIOPort( PlayerInventory, te ) ); this.ySize = 199; this.container = (ContainerSpatialIOPort) this.inventorySlots; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java index 1b64e5c44..e2cb6b07f 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiStorageBus.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.AccessRestriction; import appeng.api.config.ActionItems; @@ -53,9 +53,9 @@ public class GuiStorageBus extends GuiUpgradeable private GuiImgButton partition; private GuiImgButton clear; - public GuiStorageBus( final InventoryPlayer inventoryPlayer, final PartStorageBus te ) + public GuiStorageBus( final PlayerInventory PlayerInventory, final PartStorageBus te ) { - super( new ContainerStorageBus( inventoryPlayer, te ) ); + super( new ContainerStorageBus( PlayerInventory, te ) ); this.ySize = 251; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java b/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java index c2cff22d3..e1bfcdb68 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiUpgradeable.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.FuzzyMode; import appeng.api.config.RedstoneMode; @@ -54,9 +54,9 @@ public class GuiUpgradeable extends AEBaseGui protected GuiImgButton craftMode; protected GuiImgButton schedulingMode; - public GuiUpgradeable( final InventoryPlayer inventoryPlayer, final IUpgradeableHost te ) + public GuiUpgradeable( final PlayerInventory PlayerInventory, final IUpgradeableHost te ) { - this( new ContainerUpgradeable( inventoryPlayer, te ) ); + this( new ContainerUpgradeable( PlayerInventory, te ) ); } public GuiUpgradeable( final ContainerUpgradeable te ) diff --git a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java index d2ff0b793..693b97201 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java +++ b/src/main/java/appeng/client/gui/implementations/GuiVibrationChamber.java @@ -20,7 +20,7 @@ package appeng.client.gui.implementations; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.AEBaseGui; import appeng.client.gui.widgets.GuiProgressBar; @@ -36,9 +36,9 @@ public class GuiVibrationChamber extends AEBaseGui private final ContainerVibrationChamber cvc; private GuiProgressBar pb; - public GuiVibrationChamber( final InventoryPlayer inventoryPlayer, final TileVibrationChamber te ) + public GuiVibrationChamber( final PlayerInventory PlayerInventory, final TileVibrationChamber te ) { - super( new ContainerVibrationChamber( inventoryPlayer, te ) ); + super( new ContainerVibrationChamber( PlayerInventory, te ) ); this.cvc = (ContainerVibrationChamber) this.inventorySlots; this.ySize = 166; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiWireless.java b/src/main/java/appeng/client/gui/implementations/GuiWireless.java index 3af6043ba..9a2530eb0 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiWireless.java +++ b/src/main/java/appeng/client/gui/implementations/GuiWireless.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.Settings; import appeng.client.gui.AEBaseGui; @@ -41,9 +41,9 @@ public class GuiWireless extends AEBaseGui private GuiImgButton units; - public GuiWireless( final InventoryPlayer inventoryPlayer, final TileWireless te ) + public GuiWireless( final PlayerInventory PlayerInventory, final TileWireless te ) { - super( new ContainerWireless( inventoryPlayer, te ) ); + super( new ContainerWireless( PlayerInventory, te ) ); this.ySize = 166; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java b/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java index f5dba6c05..79d77ca9b 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java +++ b/src/main/java/appeng/client/gui/implementations/GuiWirelessTerm.java @@ -19,7 +19,7 @@ package appeng.client.gui.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.implementations.guiobjects.IPortableCell; @@ -27,9 +27,9 @@ import appeng.api.implementations.guiobjects.IPortableCell; public class GuiWirelessTerm extends GuiMEPortableCell { - public GuiWirelessTerm( final InventoryPlayer inventoryPlayer, final IPortableCell te ) + public GuiWirelessTerm( final PlayerInventory PlayerInventory, final IPortableCell te ) { - super( inventoryPlayer, te ); + super( PlayerInventory, te ); } @Override diff --git a/src/main/java/appeng/client/gui/widgets/GuiCustomSlot.java b/src/main/java/appeng/client/gui/widgets/GuiCustomSlot.java index c8b2fa392..1e532227f 100644 --- a/src/main/java/appeng/client/gui/widgets/GuiCustomSlot.java +++ b/src/main/java/appeng/client/gui/widgets/GuiCustomSlot.java @@ -4,7 +4,7 @@ package appeng.client.gui.widgets; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -26,7 +26,7 @@ public abstract class GuiCustomSlot extends Gui implements ITooltip return this.id; } - public boolean canClick( final EntityPlayer player ) + public boolean canClick( final PlayerEntity player ) { return true; } diff --git a/src/main/java/appeng/client/me/SlotDisconnected.java b/src/main/java/appeng/client/me/SlotDisconnected.java index fdc283d45..9b6eec179 100644 --- a/src/main/java/appeng/client/me/SlotDisconnected.java +++ b/src/main/java/appeng/client/me/SlotDisconnected.java @@ -19,7 +19,7 @@ package appeng.client.me; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -52,7 +52,7 @@ public class SlotDisconnected extends AppEngSlot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/client/me/SlotFluidME.java b/src/main/java/appeng/client/me/SlotFluidME.java index 866648d9c..7426371a8 100644 --- a/src/main/java/appeng/client/me/SlotFluidME.java +++ b/src/main/java/appeng/client/me/SlotFluidME.java @@ -21,7 +21,7 @@ package appeng.client.me; import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.items.SlotItemHandler; @@ -105,7 +105,7 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/client/me/SlotME.java b/src/main/java/appeng/client/me/SlotME.java index 1be6fdb5d..0b6bad807 100644 --- a/src/main/java/appeng/client/me/SlotME.java +++ b/src/main/java/appeng/client/me/SlotME.java @@ -19,7 +19,7 @@ package appeng.client.me; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.items.SlotItemHandler; @@ -98,7 +98,7 @@ public class SlotME extends SlotItemHandler } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/client/render/ColorableTileBlockColor.java b/src/main/java/appeng/client/render/ColorableTileBlockColor.java index 8aad8a03a..24ee91a01 100644 --- a/src/main/java/appeng/client/render/ColorableTileBlockColor.java +++ b/src/main/java/appeng/client/render/ColorableTileBlockColor.java @@ -21,11 +21,11 @@ package appeng.client.render; import javax.annotation.Nullable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import appeng.api.implementations.tiles.IColorableTile; import appeng.api.util.AEColor; @@ -40,7 +40,7 @@ public class ColorableTileBlockColor implements IBlockColor public static final ColorableTileBlockColor INSTANCE = new ColorableTileBlockColor(); @Override - public int colorMultiplier( IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex ) + public int colorMultiplier( BlockState state, @Nullable IBlockReader worldIn, @Nullable BlockPos pos, int tintIndex ) { AEColor color = AEColor.TRANSPARENT; // Default to a neutral color diff --git a/src/main/java/appeng/client/render/DummyFluidBakedModel.java b/src/main/java/appeng/client/render/DummyFluidBakedModel.java index abd1ffd5a..c858ee1f3 100644 --- a/src/main/java/appeng/client/render/DummyFluidBakedModel.java +++ b/src/main/java/appeng/client/render/DummyFluidBakedModel.java @@ -25,12 +25,12 @@ 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.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; /** @@ -48,7 +48,7 @@ public class DummyFluidBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { return this.quads; } diff --git a/src/main/java/appeng/client/render/DummyFluidDispatcherBakedModel.java b/src/main/java/appeng/client/render/DummyFluidDispatcherBakedModel.java index 33af2ef31..37b6b85d6 100644 --- a/src/main/java/appeng/client/render/DummyFluidDispatcherBakedModel.java +++ b/src/main/java/appeng/client/render/DummyFluidDispatcherBakedModel.java @@ -28,15 +28,15 @@ 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.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.client.model.ItemLayerModel; @@ -66,7 +66,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel // This is never used. See the item override list below. @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { return Collections.emptyList(); } @@ -89,7 +89,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel return new ItemOverrideList( Collections.emptyList() ) { @Override - public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) + public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, LivingEntity entity ) { if( !( stack.getItem() instanceof FluidDummyItem ) ) { diff --git a/src/main/java/appeng/client/render/FacadeBakedItemModel.java b/src/main/java/appeng/client/render/FacadeBakedItemModel.java index c22f128ea..0638fb341 100644 --- a/src/main/java/appeng/client/render/FacadeBakedItemModel.java +++ b/src/main/java/appeng/client/render/FacadeBakedItemModel.java @@ -25,12 +25,12 @@ import java.util.List; import javax.annotation.Nullable; -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.ItemOverrideList; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.client.render.cablebus.FacadeBuilder; @@ -55,7 +55,7 @@ public class FacadeBakedItemModel extends DelegateBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { if( side != null ) { @@ -64,7 +64,7 @@ public class FacadeBakedItemModel extends DelegateBakedModel if( quads == null ) { quads = new ArrayList<>(); - quads.addAll( this.facadeBuilder.buildFacadeItemQuads( this.textureStack, EnumFacing.NORTH ) ); + quads.addAll( this.facadeBuilder.buildFacadeItemQuads( this.textureStack, Direction.NORTH ) ); quads.addAll( this.getBaseModel().getQuads( state, side, rand ) ); quads = Collections.unmodifiableList( quads ); } diff --git a/src/main/java/appeng/client/render/FacadeDispatcherBakedModel.java b/src/main/java/appeng/client/render/FacadeDispatcherBakedModel.java index 893e84405..15f412e1e 100644 --- a/src/main/java/appeng/client/render/FacadeDispatcherBakedModel.java +++ b/src/main/java/appeng/client/render/FacadeDispatcherBakedModel.java @@ -27,14 +27,14 @@ import javax.annotation.Nullable; import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -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.ItemOverrideList; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.world.World; import appeng.client.render.cablebus.FacadeBuilder; @@ -61,7 +61,7 @@ public class FacadeDispatcherBakedModel extends DelegateBakedModel // This is never used. See the item override list below. @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { return Collections.emptyList(); } @@ -84,7 +84,7 @@ public class FacadeDispatcherBakedModel extends DelegateBakedModel return new ItemOverrideList( Collections.emptyList() ) { @Override - public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) + public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, LivingEntity entity ) { if( !( stack.getItem() instanceof ItemFacade ) ) { diff --git a/src/main/java/appeng/client/render/FacingToRotation.java b/src/main/java/appeng/client/render/FacingToRotation.java index e5a732829..2a89cae7c 100644 --- a/src/main/java/appeng/client/render/FacingToRotation.java +++ b/src/main/java/appeng/client/render/FacingToRotation.java @@ -23,7 +23,7 @@ import javax.vecmath.Matrix4f; import javax.vecmath.Vector3f; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.common.model.TRSRTransformation; @@ -102,14 +102,14 @@ public enum FacingToRotation GlStateManager.rotate( this.rot.z, 0, 0, 1 ); } - public EnumFacing rotate( EnumFacing facing ) + public Direction rotate( Direction facing ) { return TRSRTransformation.rotate( this.mat, facing ); } - public EnumFacing resultingRotate( EnumFacing facing ) + public Direction resultingRotate( Direction facing ) { - for( EnumFacing face : EnumFacing.values() ) + for( Direction face : Direction.values() ) { if( this.rotate( face ) == facing ) { @@ -119,7 +119,7 @@ public enum FacingToRotation return null; } - public static FacingToRotation get( EnumFacing forward, EnumFacing up ) + public static FacingToRotation get( Direction forward, Direction up ) { return values()[forward.ordinal() * 6 + up.ordinal()]; } diff --git a/src/main/java/appeng/client/render/StaticBlockColor.java b/src/main/java/appeng/client/render/StaticBlockColor.java index 366f9dd17..b842f8c1f 100644 --- a/src/main/java/appeng/client/render/StaticBlockColor.java +++ b/src/main/java/appeng/client/render/StaticBlockColor.java @@ -21,10 +21,10 @@ package appeng.client.render; import javax.annotation.Nullable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import appeng.api.util.AEColor; @@ -43,7 +43,7 @@ public class StaticBlockColor implements IBlockColor } @Override - public int colorMultiplier( IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex ) + public int colorMultiplier( BlockState state, @Nullable IBlockReader worldIn, @Nullable BlockPos pos, int tintIndex ) { return this.color.getVariantByTintIndex( tintIndex ); } diff --git a/src/main/java/appeng/client/render/TesrRenderHelper.java b/src/main/java/appeng/client/render/TesrRenderHelper.java index 9d20cafe0..1aef1baad 100644 --- a/src/main/java/appeng/client/render/TesrRenderHelper.java +++ b/src/main/java/appeng/client/render/TesrRenderHelper.java @@ -25,7 +25,7 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderItem; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.storage.data.IAEItemStack; import appeng.util.IWideReadableNumberConverter; @@ -44,7 +44,7 @@ public class TesrRenderHelper * Move the current coordinate system to the center of the given block face, assuming that the origin is currently * at the center of a block. */ - public static void moveToFace( EnumFacing face ) + public static void moveToFace( Direction face ) { GlStateManager.translate( face.getFrontOffsetX() * 0.50, face.getFrontOffsetY() * 0.50, face.getFrontOffsetZ() * 0.50 ); } @@ -54,7 +54,7 @@ public class TesrRenderHelper * the given face as if it was * a 2D canvas. */ - public static void rotateToFace( EnumFacing face, byte spin ) + public static void rotateToFace( Direction face, byte spin ) { switch( face ) { @@ -112,7 +112,7 @@ public class TesrRenderHelper // Position the item icon at the top middle of the panel GlStateManager.translate( -8, -11, 0 ); - RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); + RenderItem renderItem = Minecraft.getInstance().getRenderItem(); renderItem.renderItemAndEffectIntoGUI( itemStack, 0, 0 ); GlStateManager.popMatrix(); @@ -134,7 +134,7 @@ public class TesrRenderHelper final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize ); // Render the item count - final FontRenderer fr = Minecraft.getMinecraft().fontRenderer; + final FontRenderer fr = Minecraft.getInstance().fontRenderer; final int width = fr.getStringWidth( renderedStackSize ); GlStateManager.translate( 0.0f, spacing, 0 ); GlStateManager.scale( 1.0f / 62.0f, 1.0f / 62.0f, 1.0f / 62.0f ); diff --git a/src/main/java/appeng/client/render/cablebus/CableBuilder.java b/src/main/java/appeng/client/render/cablebus/CableBuilder.java index 0090c61d1..ea3f8e9a2 100644 --- a/src/main/java/appeng/client/render/cablebus/CableBuilder.java +++ b/src/main/java/appeng/client/render/cablebus/CableBuilder.java @@ -26,10 +26,10 @@ import java.util.EnumSet; import java.util.List; import java.util.function.Function; -import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.model.BakedQuad; 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 net.minecraft.util.ResourceLocation; import appeng.api.util.AECableType; @@ -159,7 +159,7 @@ class CableBuilder } } - public void addGlassConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List quadsOut ) + public void addGlassConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List quadsOut ) { CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut ); @@ -201,7 +201,7 @@ class CableBuilder } } - public void addStraightGlassConnection( EnumFacing facing, AEColor cableColor, List quadsOut ) + public void addStraightGlassConnection( Direction facing, AEColor cableColor, List quadsOut ) { CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut ); @@ -229,7 +229,7 @@ class CableBuilder } } - public void addConstrainedGlassConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List quadsOut ) + public void addConstrainedGlassConnection( Direction facing, AEColor cableColor, int distanceFromEdge, List quadsOut ) { // Glass connections reach only 6 voxels from the edge @@ -266,7 +266,7 @@ class CableBuilder } } - public void addCoveredConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List quadsOut ) + public void addCoveredConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List quadsOut ) { CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut ); @@ -286,7 +286,7 @@ class CableBuilder addCoveredCableSizedCube( facing, cubeBuilder ); } - public void addStraightCoveredConnection( EnumFacing facing, AEColor cableColor, List quadsOut ) + public void addStraightCoveredConnection( Direction facing, AEColor cableColor, List quadsOut ) { CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut ); @@ -299,35 +299,35 @@ class CableBuilder } - private static void setStraightCableUVs( CubeBuilder cubeBuilder, EnumFacing facing, int x, int y ) + private static void setStraightCableUVs( CubeBuilder cubeBuilder, Direction facing, int x, int y ) { switch( facing ) { case DOWN: case UP: - cubeBuilder.setCustomUv( EnumFacing.NORTH, x, 0, y, x ); - cubeBuilder.setCustomUv( EnumFacing.EAST, x, 0, y, x ); - cubeBuilder.setCustomUv( EnumFacing.SOUTH, x, 0, y, x ); - cubeBuilder.setCustomUv( EnumFacing.WEST, x, 0, y, x ); + cubeBuilder.setCustomUv( Direction.NORTH, x, 0, y, x ); + cubeBuilder.setCustomUv( Direction.EAST, x, 0, y, x ); + cubeBuilder.setCustomUv( Direction.SOUTH, x, 0, y, x ); + cubeBuilder.setCustomUv( Direction.WEST, x, 0, y, x ); break; case EAST: case WEST: - cubeBuilder.setCustomUv( EnumFacing.UP, 0, x, x, y ); - cubeBuilder.setCustomUv( EnumFacing.DOWN, 0, x, x, y ); - cubeBuilder.setCustomUv( EnumFacing.NORTH, 0, x, x, y ); - cubeBuilder.setCustomUv( EnumFacing.SOUTH, 0, x, x, y ); + cubeBuilder.setCustomUv( Direction.UP, 0, x, x, y ); + cubeBuilder.setCustomUv( Direction.DOWN, 0, x, x, y ); + cubeBuilder.setCustomUv( Direction.NORTH, 0, x, x, y ); + cubeBuilder.setCustomUv( Direction.SOUTH, 0, x, x, y ); break; case NORTH: case SOUTH: - cubeBuilder.setCustomUv( EnumFacing.UP, x, 0, y, x ); - cubeBuilder.setCustomUv( EnumFacing.DOWN, x, 0, y, x ); - cubeBuilder.setCustomUv( EnumFacing.EAST, 0, x, x, y ); - cubeBuilder.setCustomUv( EnumFacing.WEST, 0, x, x, y ); + cubeBuilder.setCustomUv( Direction.UP, x, 0, y, x ); + cubeBuilder.setCustomUv( Direction.DOWN, x, 0, y, x ); + cubeBuilder.setCustomUv( Direction.EAST, 0, x, x, y ); + cubeBuilder.setCustomUv( Direction.WEST, 0, x, x, y ); break; } } - public void addConstrainedCoveredConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List quadsOut ) + public void addConstrainedCoveredConnection( Direction facing, AEColor cableColor, int distanceFromEdge, List quadsOut ) { // The core of a covered cable reaches up to 5 voxels from the block edge, so // drawing a connection can only occur from there onwards @@ -345,7 +345,7 @@ class CableBuilder } - public void addSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List quadsOut ) + public void addSmartConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List quadsOut ) { if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS ) { @@ -399,7 +399,7 @@ class CableBuilder addCoveredCableSizedCube( facing, cubeBuilder ); } - public void addStraightSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List quadsOut ) + public void addStraightSmartConnection( Direction facing, AEColor cableColor, int channels, List quadsOut ) { CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut ); @@ -425,7 +425,7 @@ class CableBuilder addStraightCoveredCableSizedCube( facing, cubeBuilder ); } - public void addConstrainedSmartConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, int channels, List quadsOut ) + public void addConstrainedSmartConnection( Direction facing, AEColor cableColor, int distanceFromEdge, int channels, List quadsOut ) { // Same as with covered cables, the smart cable's core extends up to 5 voxels away from the edge. // Drawing a connection to any point before that point is fruitless @@ -456,7 +456,7 @@ class CableBuilder addCoveredCableSizedCube( facing, distanceFromEdge, cubeBuilder ); } - public void addDenseCoveredConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List quadsOut ) + public void addDenseCoveredConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, List quadsOut ) { // Dense cables only render their connections as dense if the adjacent blocks actually wants that if( connectionType == AECableType.COVERED || connectionType == AECableType.SMART || connectionType == AECableType.GLASS ) @@ -480,7 +480,7 @@ class CableBuilder cubeBuilder.setTexture( texture ); } - public void addDenseSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List quadsOut ) + public void addDenseSmartConnection( Direction facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List quadsOut ) { // Dense cables only render their connections as dense if the adjacent blocks actually wants that if( connectionType == AECableType.SMART ) @@ -532,7 +532,7 @@ class CableBuilder } - public void addStraightDenseCoveredConnection( EnumFacing facing, AEColor cableColor, List quadsOut ) + public void addStraightDenseCoveredConnection( Direction facing, AEColor cableColor, List quadsOut ) { CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut ); @@ -544,7 +544,7 @@ class CableBuilder addStraightDenseCableSizedCube( facing, cubeBuilder ); } - public void addStraightDenseSmartConnection( EnumFacing facing, AEColor cableColor, int channels, List quadsOut ) + public void addStraightDenseSmartConnection( Direction facing, AEColor cableColor, int channels, List quadsOut ) { CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut ); @@ -573,7 +573,7 @@ class CableBuilder addStraightDenseCableSizedCube( facing, cubeBuilder ); } - private static void addDenseCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder ) + private static void addDenseCableSizedCube( Direction facing, CubeBuilder cubeBuilder ) { switch( facing ) { @@ -600,31 +600,31 @@ class CableBuilder // Adds a cube to the given cube builder that has the size of a dense cable connection and spans the entire block // for the given direction - private static void addStraightDenseCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder ) + private static void addStraightDenseCableSizedCube( Direction facing, CubeBuilder cubeBuilder ) { switch( facing ) { case DOWN: case UP: - cubeBuilder.setUvRotation( EnumFacing.EAST, 3 ); + cubeBuilder.setUvRotation( Direction.EAST, 3 ); cubeBuilder.addCube( 3, 0, 3, 13, 16, 13 ); - cubeBuilder.setUvRotation( EnumFacing.EAST, 0 ); + cubeBuilder.setUvRotation( Direction.EAST, 0 ); break; case EAST: case WEST: - cubeBuilder.setUvRotation( EnumFacing.SOUTH, 3 ); - cubeBuilder.setUvRotation( EnumFacing.NORTH, 3 ); + cubeBuilder.setUvRotation( Direction.SOUTH, 3 ); + cubeBuilder.setUvRotation( Direction.NORTH, 3 ); cubeBuilder.addCube( 0, 3, 3, 16, 13, 13 ); - cubeBuilder.setUvRotation( EnumFacing.SOUTH, 0 ); - cubeBuilder.setUvRotation( EnumFacing.NORTH, 0 ); + cubeBuilder.setUvRotation( Direction.SOUTH, 0 ); + cubeBuilder.setUvRotation( Direction.NORTH, 0 ); break; case NORTH: case SOUTH: - cubeBuilder.setUvRotation( EnumFacing.EAST, 3 ); - cubeBuilder.setUvRotation( EnumFacing.WEST, 3 ); + cubeBuilder.setUvRotation( Direction.EAST, 3 ); + cubeBuilder.setUvRotation( Direction.WEST, 3 ); cubeBuilder.addCube( 3, 3, 0, 13, 13, 16 ); - cubeBuilder.setUvRotation( EnumFacing.EAST, 0 ); - cubeBuilder.setUvRotation( EnumFacing.WEST, 0 ); + cubeBuilder.setUvRotation( Direction.EAST, 0 ); + cubeBuilder.setUvRotation( Direction.WEST, 0 ); break; } @@ -632,7 +632,7 @@ class CableBuilder // Adds a cube to the given cube builder that has the size of a covered cable connection from the core of the cable // to the given face - private static void addCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder ) + private static void addCoveredCableSizedCube( Direction facing, CubeBuilder cubeBuilder ) { switch( facing ) { @@ -659,36 +659,36 @@ class CableBuilder // Adds a cube to the given cube builder that has the size of a covered cable connection and spans the entire block // for the given direction - private static void addStraightCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder ) + private static void addStraightCoveredCableSizedCube( Direction facing, CubeBuilder cubeBuilder ) { switch( facing ) { case DOWN: case UP: - cubeBuilder.setUvRotation( EnumFacing.EAST, 3 ); + cubeBuilder.setUvRotation( Direction.EAST, 3 ); cubeBuilder.addCube( 5, 0, 5, 11, 16, 11 ); - cubeBuilder.setUvRotation( EnumFacing.EAST, 0 ); + cubeBuilder.setUvRotation( Direction.EAST, 0 ); break; case EAST: case WEST: - cubeBuilder.setUvRotation( EnumFacing.SOUTH, 3 ); - cubeBuilder.setUvRotation( EnumFacing.NORTH, 3 ); + cubeBuilder.setUvRotation( Direction.SOUTH, 3 ); + cubeBuilder.setUvRotation( Direction.NORTH, 3 ); cubeBuilder.addCube( 0, 5, 5, 16, 11, 11 ); - cubeBuilder.setUvRotation( EnumFacing.SOUTH, 0 ); - cubeBuilder.setUvRotation( EnumFacing.NORTH, 0 ); + cubeBuilder.setUvRotation( Direction.SOUTH, 0 ); + cubeBuilder.setUvRotation( Direction.NORTH, 0 ); break; case NORTH: case SOUTH: - cubeBuilder.setUvRotation( EnumFacing.EAST, 3 ); - cubeBuilder.setUvRotation( EnumFacing.WEST, 3 ); + cubeBuilder.setUvRotation( Direction.EAST, 3 ); + cubeBuilder.setUvRotation( Direction.WEST, 3 ); cubeBuilder.addCube( 5, 5, 0, 11, 11, 16 ); - cubeBuilder.setUvRotation( EnumFacing.EAST, 0 ); - cubeBuilder.setUvRotation( EnumFacing.WEST, 0 ); + cubeBuilder.setUvRotation( Direction.EAST, 0 ); + cubeBuilder.setUvRotation( Direction.WEST, 0 ); break; } } - private static void addCoveredCableSizedCube( EnumFacing facing, int distanceFromEdge, CubeBuilder cubeBuilder ) + private static void addCoveredCableSizedCube( Direction facing, int distanceFromEdge, CubeBuilder cubeBuilder ) { switch( facing ) { @@ -719,7 +719,7 @@ class CableBuilder * that do not want to be connected to using a glass cable connection. This applies to most machines (interfaces, * etc.) */ - private void addBigCoveredCableSizedCube( EnumFacing facing, CubeBuilder cubeBuilder ) + private void addBigCoveredCableSizedCube( Direction facing, CubeBuilder cubeBuilder ) { switch( facing ) { diff --git a/src/main/java/appeng/client/render/cablebus/CableBusBakedModel.java b/src/main/java/appeng/client/render/cablebus/CableBusBakedModel.java index 82c8cf40c..ae36f8c1f 100644 --- a/src/main/java/appeng/client/render/cablebus/CableBusBakedModel.java +++ b/src/main/java/appeng/client/render/cablebus/CableBusBakedModel.java @@ -30,16 +30,16 @@ import java.util.Map.Entry; import javax.annotation.Nullable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.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.model.BakedQuad; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.property.IExtendedBlockState; @@ -64,7 +64,7 @@ public class CableBusBakedModel implements IBakedModel private final TextureAtlasSprite particleTexture; - private final TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks(); + private final TextureMap textureMap = Minecraft.getInstance().getTextureMapBlocks(); CableBusBakedModel( CableBuilder cableBuilder, FacadeBuilder facadeBuilder, Map partModels, TextureAtlasSprite particleTexture ) { @@ -75,7 +75,7 @@ public class CableBusBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { CableBusRenderState renderState = getRenderingState( state ); @@ -104,7 +104,7 @@ public class CableBusBakedModel implements IBakedModel quads.addAll( cableModel ); // Then handle attachments - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { final IPartModel partModel = renderState.getAttachments().get( facing ); if( partModel == null ) @@ -133,7 +133,7 @@ public class CableBusBakedModel implements IBakedModel // Rotate quads accordingly QuadRotator rotator = new QuadRotator(); - partQuads = rotator.rotateQuads( partQuads, facing, EnumFacing.UP ); + partQuads = rotator.rotateQuads( partQuads, facing, Direction.UP ); quads.addAll( partQuads ); } @@ -145,16 +145,16 @@ public class CableBusBakedModel implements IBakedModel } // Determines whether a cable is connected to exactly two sides that are opposite each other - private static boolean isStraightLine( AECableType cableType, EnumMap sides ) + private static boolean isStraightLine( AECableType cableType, EnumMap sides ) { - final Iterator> it = sides.entrySet().iterator(); + final Iterator> it = sides.entrySet().iterator(); if( !it.hasNext() ) { return false; // No connections } - final Entry nextConnection = it.next(); - final EnumFacing firstSide = nextConnection.getKey(); + final Entry nextConnection = it.next(); + final Direction firstSide = nextConnection.getKey(); final AECableType firstType = nextConnection.getValue(); if( !it.hasNext() ) @@ -184,14 +184,14 @@ public class CableBusBakedModel implements IBakedModel } AEColor cableColor = renderState.getCableColor(); - EnumMap connectionTypes = renderState.getConnectionTypes(); + EnumMap connectionTypes = renderState.getConnectionTypes(); // If the connection is straight, no busses are attached, and no covered core has been forced (in case of glass // cables), then render the cable as a simplified straight line. boolean noAttachments = !renderState.getAttachments().values().stream().anyMatch( IPartModel::requireCableConnection ); if( noAttachments && isStraightLine( cableType, connectionTypes ) ) { - EnumFacing facing = connectionTypes.keySet().iterator().next(); + Direction facing = connectionTypes.keySet().iterator().next(); switch( cableType ) { @@ -220,8 +220,8 @@ public class CableBusBakedModel implements IBakedModel this.cableBuilder.addCableCore( renderState.getCoreType(), cableColor, quadsOut ); // Render all internal connections to attachments - EnumMap attachmentConnections = renderState.getAttachmentConnections(); - for( EnumFacing facing : attachmentConnections.keySet() ) + EnumMap attachmentConnections = renderState.getAttachmentConnections(); + for( Direction facing : attachmentConnections.keySet() ) { int distance = attachmentConnections.get( facing ); int channels = renderState.getChannelsOnSide().get( facing ); @@ -247,9 +247,9 @@ public class CableBusBakedModel implements IBakedModel } // Render all outgoing connections using the appropriate type - for( final Entry connection : connectionTypes.entrySet() ) + for( final Entry connection : connectionTypes.entrySet() ) { - final EnumFacing facing = connection.getKey(); + final Direction facing = connection.getKey(); final AECableType connectionType = connection.getValue(); final boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing ); final int channels = renderState.getChannelsOnSide().get( facing ); @@ -293,7 +293,7 @@ public class CableBusBakedModel implements IBakedModel } // If no core is present, just use the first part that comes into play - for( EnumFacing side : renderState.getAttachments().keySet() ) + for( Direction side : renderState.getAttachments().keySet() ) { IPartModel partModel = renderState.getAttachments().get( side ); @@ -320,7 +320,7 @@ public class CableBusBakedModel implements IBakedModel return result; } - private static CableBusRenderState getRenderingState( IBlockState state ) + private static CableBusRenderState getRenderingState( BlockState state ) { if( state == null || !( state instanceof IExtendedBlockState ) ) { diff --git a/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java b/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java index 28e2f8bf4..0ef0c1e07 100644 --- a/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java +++ b/src/main/java/appeng/client/render/cablebus/CableBusRenderState.java @@ -26,10 +26,10 @@ import java.util.EnumSet; import java.util.List; import java.util.Objects; -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 appeng.api.parts.IPartModel; import appeng.api.util.AECableType; @@ -52,28 +52,28 @@ public class CableBusRenderState private AEColor cableColor = AEColor.TRANSPARENT; // Describes the outgoing connections of this cable bus to other blocks, and how they should be rendered - private EnumMap connectionTypes = new EnumMap<>( EnumFacing.class ); + private EnumMap connectionTypes = new EnumMap<>( Direction.class ); // Indicate on which sides signified by connectionTypes above, there is another cable bus. If a side is connected, // but it is absent from this // set, then it means that there is a Grid host, but not a cable bus on that side (i.e. an interface, a controller, // etc.) - private EnumSet cableBusAdjacent = EnumSet.noneOf( EnumFacing.class ); + private EnumSet cableBusAdjacent = EnumSet.noneOf( Direction.class ); // Specifies the number of channels used for the connection to a given side. Only contains entries if // connections contains a corresponding entry. - private EnumMap channelsOnSide = new EnumMap<>( EnumFacing.class ); + private EnumMap channelsOnSide = new EnumMap<>( Direction.class ); - private EnumMap attachments = new EnumMap<>( EnumFacing.class ); + private EnumMap attachments = new EnumMap<>( Direction.class ); // For each attachment, this contains the distance from the edge until which a cable connection should be drawn - private EnumMap attachmentConnections = new EnumMap<>( EnumFacing.class ); + private EnumMap attachmentConnections = new EnumMap<>( Direction.class ); // Contains the facade to use for each side that has a facade attached - private EnumMap facades = new EnumMap<>( EnumFacing.class ); + private EnumMap facades = new EnumMap<>( Direction.class ); // Used for Facades. - private WeakReference world; + private WeakReference world; private BlockPos pos; // Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This @@ -81,7 +81,7 @@ public class CableBusRenderState // facades on this cable bus private List boundingBoxes = new ArrayList<>(); - private EnumMap partFlags = new EnumMap<>( EnumFacing.class ); + private EnumMap partFlags = new EnumMap<>( Direction.class ); public CableCoreType getCoreType() { @@ -113,57 +113,57 @@ public class CableBusRenderState this.cableColor = cableColor; } - public EnumMap getChannelsOnSide() + public EnumMap getChannelsOnSide() { return this.channelsOnSide; } - public EnumMap getConnectionTypes() + public EnumMap getConnectionTypes() { return this.connectionTypes; } - public void setConnectionTypes( EnumMap connectionTypes ) + public void setConnectionTypes( EnumMap connectionTypes ) { this.connectionTypes = connectionTypes; } - public void setChannelsOnSide( EnumMap channelsOnSide ) + public void setChannelsOnSide( EnumMap channelsOnSide ) { this.channelsOnSide = channelsOnSide; } - public EnumSet getCableBusAdjacent() + public EnumSet getCableBusAdjacent() { return this.cableBusAdjacent; } - public void setCableBusAdjacent( EnumSet cableBusAdjacent ) + public void setCableBusAdjacent( EnumSet cableBusAdjacent ) { this.cableBusAdjacent = cableBusAdjacent; } - public EnumMap getAttachments() + public EnumMap getAttachments() { return this.attachments; } - public EnumMap getAttachmentConnections() + public EnumMap getAttachmentConnections() { return this.attachmentConnections; } - public EnumMap getFacades() + public EnumMap getFacades() { return this.facades; } - public IBlockAccess getWorld() + public IBlockReader getWorld() { return this.world.get(); } - public void setWorld( IBlockAccess world ) + public void setWorld( IBlockReader world ) { this.world = new WeakReference<>( world ); } @@ -183,7 +183,7 @@ public class CableBusRenderState return this.boundingBoxes; } - public EnumMap getPartFlags() + public EnumMap getPartFlags() { return this.partFlags; } diff --git a/src/main/java/appeng/client/render/cablebus/CubeBuilder.java b/src/main/java/appeng/client/render/cablebus/CubeBuilder.java index 3d229dcc9..64bd6415e 100644 --- a/src/main/java/appeng/client/render/cablebus/CubeBuilder.java +++ b/src/main/java/appeng/client/render/cablebus/CubeBuilder.java @@ -24,16 +24,15 @@ import java.util.EnumMap; import java.util.EnumSet; import java.util.List; -import javax.vecmath.Vector4f; - import com.google.common.base.Preconditions; -import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.Vector4f; +import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import appeng.client.render.VertexFormats; @@ -49,13 +48,13 @@ public class CubeBuilder private final List output; - private final EnumMap textures = new EnumMap<>( EnumFacing.class ); + private final EnumMap textures = new EnumMap<>( Direction.class ); - private EnumSet drawFaces = EnumSet.allOf( EnumFacing.class ); + private EnumSet drawFaces = EnumSet.allOf( Direction.class ); - private final EnumMap customUv = new EnumMap<>( EnumFacing.class ); + private final EnumMap customUv = new EnumMap<>( Direction.class ); - private byte[] uvRotations = new byte[EnumFacing.values().length]; + private byte[] uvRotations = new byte[Direction.values().length]; private int color = 0xFFFFFFFF; @@ -92,7 +91,7 @@ public class CubeBuilder this.format = VertexFormats.getFormatWithLightMap( this.format ); } - for( EnumFacing face : this.drawFaces ) + for( Direction face : this.drawFaces ) { this.putFace( face, x1, y1, z1, x2, y2, z2 ); } @@ -104,7 +103,7 @@ public class CubeBuilder } } - public void addQuad( EnumFacing face, float x1, float y1, float z1, float x2, float y2, float z2 ) + public void addQuad( Direction face, float x1, float y1, float z1, float x2, float y2, float z2 ) { // If brightness is forced to specific values, extend the vertex format to contain the multi-texturing lightmap // offset @@ -136,7 +135,7 @@ public class CubeBuilder float v2; } - private void putFace( EnumFacing face, float x1, float y1, float z1, float x2, float y2, float z2 ) + private void putFace( Direction face, float x1, float y1, float z1, float x2, float y2, float z2 ) { TextureAtlasSprite texture = this.textures.get( face ); @@ -210,7 +209,7 @@ public class CubeBuilder this.output.add( builder.build() ); } - private UvVector getDefaultUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 ) + private UvVector getDefaultUv( Direction face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 ) { UvVector uv = new UvVector(); @@ -258,7 +257,7 @@ public class CubeBuilder return uv; } - private UvVector getStandardUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 ) + private UvVector getStandardUv( Direction face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 ) { UvVector uv = new UvVector(); switch( face ) @@ -304,7 +303,7 @@ public class CubeBuilder } // uv.u1, uv.v1 - private void putVertexTL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv ) + private void putVertexTL( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv ) { float u, v; @@ -333,7 +332,7 @@ public class CubeBuilder } // uv.u2, uv.v1 - private void putVertexTR( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv ) + private void putVertexTR( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv ) { float u, v; @@ -361,7 +360,7 @@ public class CubeBuilder } // uv.u2, uv.v2 - private void putVertexBR( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv ) + private void putVertexBR( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv ) { float u; @@ -392,7 +391,7 @@ public class CubeBuilder } // uv.u1, uv.v2 - private void putVertexBL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv ) + private void putVertexBL( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, UvVector uv ) { float u; @@ -422,7 +421,7 @@ public class CubeBuilder this.putVertex( builder, face, x, y, z, u, v ); } - private void putVertex( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, float u, float v ) + private void putVertex( UnpackedBakedQuad.Builder builder, Direction face, float x, float y, float z, float u, float v ) { VertexFormat format = builder.getVertexFormat(); @@ -468,7 +467,7 @@ public class CubeBuilder public void setTexture( TextureAtlasSprite texture ) { - for( EnumFacing face : EnumFacing.values() ) + for( Direction face : Direction.values() ) { this.textures.put( face, texture ); } @@ -476,20 +475,20 @@ public class CubeBuilder public void setTextures( TextureAtlasSprite up, TextureAtlasSprite down, TextureAtlasSprite north, TextureAtlasSprite south, TextureAtlasSprite east, TextureAtlasSprite west ) { - this.textures.put( EnumFacing.UP, up ); - this.textures.put( EnumFacing.DOWN, down ); - this.textures.put( EnumFacing.NORTH, north ); - this.textures.put( EnumFacing.SOUTH, south ); - this.textures.put( EnumFacing.EAST, east ); - this.textures.put( EnumFacing.WEST, west ); + this.textures.put( Direction.UP, up ); + this.textures.put( Direction.DOWN, down ); + this.textures.put( Direction.NORTH, north ); + this.textures.put( Direction.SOUTH, south ); + this.textures.put( Direction.EAST, east ); + this.textures.put( Direction.WEST, west ); } - public void setTexture( EnumFacing facing, TextureAtlasSprite sprite ) + public void setTexture( Direction facing, TextureAtlasSprite sprite ) { this.textures.put( facing, sprite ); } - public void setDrawFaces( EnumSet drawFaces ) + public void setDrawFaces( EnumSet drawFaces ) { this.drawFaces = drawFaces; } @@ -517,12 +516,12 @@ public class CubeBuilder this.renderFullBright = renderFullBright; } - public void setCustomUv( EnumFacing facing, float u1, float v1, float u2, float v2 ) + public void setCustomUv( Direction facing, float u1, float v1, float u2, float v2 ) { this.customUv.put( facing, new Vector4f( u1, v1, u2, v2 ) ); } - public void setUvRotation( EnumFacing facing, int rotation ) + public void setUvRotation( Direction facing, int rotation ) { if( rotation == 2 ) { diff --git a/src/main/java/appeng/client/render/cablebus/FacadeBlockAccess.java b/src/main/java/appeng/client/render/cablebus/FacadeBlockAccess.java index 733f038ef..9cedfbe79 100644 --- a/src/main/java/appeng/client/render/cablebus/FacadeBlockAccess.java +++ b/src/main/java/appeng/client/render/cablebus/FacadeBlockAccess.java @@ -21,30 +21,30 @@ package appeng.client.render.cablebus; import javax.annotation.Nullable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; 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.minecraft.world.WorldType; import net.minecraft.world.biome.Biome; /** * This is used to retrieve the ExtendedState of a block for facade rendering. - * It fakes the block at BlockPos provided as the IBlockState provided. + * It fakes the block at BlockPos provided as the BlockState provided. * * @author covers1624 */ -public class FacadeBlockAccess implements IBlockAccess +public class FacadeBlockAccess implements IBlockReader { - private final IBlockAccess world; + private final IBlockReader world; private final BlockPos pos; - private final EnumFacing side; - private final IBlockState state; + private final Direction side; + private final BlockState state; - public FacadeBlockAccess( IBlockAccess world, BlockPos pos, EnumFacing side, IBlockState state ) + public FacadeBlockAccess( IBlockReader world, BlockPos pos, Direction side, BlockState state ) { this.world = world; this.pos = pos; @@ -66,7 +66,7 @@ public class FacadeBlockAccess implements IBlockAccess } @Override - public IBlockState getBlockState( BlockPos pos ) + public BlockState getBlockState( BlockPos pos ) { if( this.pos == pos ) { @@ -78,7 +78,7 @@ public class FacadeBlockAccess implements IBlockAccess @Override public boolean isAirBlock( BlockPos pos ) { - IBlockState state = this.getBlockState( pos ); + BlockState state = this.getBlockState( pos ); return state.getBlock().isAir( state, this.world, pos ); } @@ -89,7 +89,7 @@ public class FacadeBlockAccess implements IBlockAccess } @Override - public int getStrongPower( BlockPos pos, EnumFacing direction ) + public int getStrongPower( BlockPos pos, Direction direction ) { return this.world.getStrongPower( pos, direction ); } @@ -101,7 +101,7 @@ public class FacadeBlockAccess implements IBlockAccess } @Override - public boolean isSideSolid( BlockPos pos, EnumFacing side, boolean _default ) + public boolean isSideSolid( BlockPos pos, Direction side, boolean _default ) { if( pos.getX() < -30000000 || pos.getZ() < -30000000 || pos.getX() >= 30000000 || pos.getZ() >= 30000000 ) { diff --git a/src/main/java/appeng/client/render/cablebus/FacadeBuilder.java b/src/main/java/appeng/client/render/cablebus/FacadeBuilder.java index 34218e970..2e7431f16 100644 --- a/src/main/java/appeng/client/render/cablebus/FacadeBuilder.java +++ b/src/main/java/appeng/client/render/cablebus/FacadeBuilder.java @@ -29,20 +29,20 @@ import java.util.function.Function; import javax.annotation.Nullable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraftforge.client.ForgeHooksClient; import appeng.api.AEApi; @@ -110,17 +110,17 @@ public class FacadeBuilder BakedPipeline pipeline = this.pipelines.get(); Quad collectorQuad = this.collectors.get(); boolean transparent = AEApi.instance().partHelper().getCableRenderMode().transparentFacades; - Map facadeStates = renderState.getFacades(); + Map facadeStates = renderState.getFacades(); List partBoxes = renderState.getBoundingBoxes(); - Set sidesWithParts = renderState.getAttachments().keySet(); - IBlockAccess parentWorld = renderState.getWorld(); + Set sidesWithParts = renderState.getAttachments().keySet(); + IBlockReader parentWorld = renderState.getWorld(); BlockPos pos = renderState.getPos(); - BlockColors blockColors = Minecraft.getMinecraft().getBlockColors(); + BlockColors blockColors = Minecraft.getInstance().getBlockColors(); boolean thinFacades = isUseThinFacades( partBoxes ); - for( Entry entry : facadeStates.entrySet() ) + for( Entry entry : facadeStates.entrySet() ) { - EnumFacing side = entry.getKey(); + Direction side = entry.getKey(); int sideIndex = side.ordinal(); FacadeRenderState facadeRenderState = entry.getValue(); boolean renderStilt = !sidesWithParts.contains( side ); @@ -130,7 +130,7 @@ public class FacadeBuilder { IBakedModel partModel = modelLookup.apply( part ); QuadRotator rotator = new QuadRotator(); - quads.addAll( rotator.rotateQuads( gatherQuads( partModel, null, rand ), side, EnumFacing.UP ) ); + quads.addAll( rotator.rotateQuads( gatherQuads( partModel, null, rand ), side, Direction.UP ) ); } } // If we are forcing transparency and this isn't the Translucent layer. @@ -139,7 +139,7 @@ public class FacadeBuilder continue; } - IBlockState blockState = facadeRenderState.getSourceBlock(); + BlockState blockState = facadeRenderState.getSourceBlock(); // If we aren't forcing transparency let the block decide if it should render. if( !transparent && layer != null ) { @@ -156,7 +156,7 @@ public class FacadeBuilder { double offset = thinFacades ? THIN_THICKNESS : THICK_THICKNESS; AEAxisAlignedBB tmpBB = null; - for( EnumFacing face : EnumFacing.VALUES ) + for( Direction face : Direction.VALUES ) { // Only faces that aren't on our axis if( face.getAxis() != side.getAxis() ) @@ -202,9 +202,9 @@ public class FacadeBuilder AEAxisAlignedBB cutOutBox = getCutOutBox( facadeBox, partBoxes ); List holeStrips = getBoxes( facadeBox, cutOutBox, side.getAxis() ); - IBlockAccess facadeAccess = new FacadeBlockAccess( parentWorld, pos, side, blockState ); + IBlockReader facadeAccess = new FacadeBlockAccess( parentWorld, pos, side, blockState ); - BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); try { @@ -261,9 +261,9 @@ public class FacadeBuilder // calculate the side mask. int facadeMask = 0; - for( Entry ent : facadeStates.entrySet() ) + for( Entry ent : facadeStates.entrySet() ) { - EnumFacing s = ent.getKey(); + Direction s = ent.getKey(); if( s.getAxis() != side.getAxis() ) { FacadeRenderState otherState = ent.getValue(); @@ -324,10 +324,10 @@ public class FacadeBuilder * * @return The model. */ - public List buildFacadeItemQuads( ItemStack textureItem, EnumFacing side ) + public List buildFacadeItemQuads( ItemStack textureItem, Direction side ) { List facadeQuads = new ArrayList<>(); - IBakedModel model = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides( textureItem, null, null ); + IBakedModel model = Minecraft.getInstance().getRenderItem().getItemModelWithOverrides( textureItem, null, null ); List modelQuads = gatherQuads( model, null, 0 ); BakedPipeline pipeline = this.pipelines.get(); @@ -348,7 +348,7 @@ public class FacadeBuilder // If we have a tint index, setup the tinter and enable it. if( quad.hasTintIndex() ) { - tinter.setTint( Minecraft.getMinecraft().getItemColors().colorMultiplier( textureItem, quad.getTintIndex() ) ); + tinter.setTint( Minecraft.getInstance().getItemColors().colorMultiplier( textureItem, quad.getTintIndex() ) ); pipeline.enableElement( "tinter" ); } // Disable elements we don't need for items. @@ -370,10 +370,10 @@ public class FacadeBuilder } // Helper to gather all quads from a model into a list. - private static List gatherQuads( IBakedModel model, IBlockState state, long rand ) + private static List gatherQuads( IBakedModel model, BlockState state, long rand ) { List modelQuads = new ArrayList<>(); - for( EnumFacing face : EnumFacing.VALUES ) + for( Direction face : Direction.VALUES ) { modelQuads.addAll( model.getQuads( state, face, rand ) ); } diff --git a/src/main/java/appeng/client/render/cablebus/FacadeRenderState.java b/src/main/java/appeng/client/render/cablebus/FacadeRenderState.java index 82fb75f48..d5b2df16a 100644 --- a/src/main/java/appeng/client/render/cablebus/FacadeRenderState.java +++ b/src/main/java/appeng/client/render/cablebus/FacadeRenderState.java @@ -2,7 +2,7 @@ package appeng.client.render.cablebus; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; /** @@ -12,17 +12,17 @@ public class FacadeRenderState { // The block state to use for rendering this facade - private final IBlockState sourceBlock; + private final BlockState sourceBlock; private final boolean transparent; - public FacadeRenderState( IBlockState sourceBlock, boolean transparent ) + public FacadeRenderState( BlockState sourceBlock, boolean transparent ) { this.sourceBlock = sourceBlock; this.transparent = transparent; } - public IBlockState getSourceBlock() + public BlockState getSourceBlock() { return this.sourceBlock; } diff --git a/src/main/java/appeng/client/render/cablebus/P2PTunnelFrequencyBakedModel.java b/src/main/java/appeng/client/render/cablebus/P2PTunnelFrequencyBakedModel.java index c264ea2a6..228f910eb 100644 --- a/src/main/java/appeng/client/render/cablebus/P2PTunnelFrequencyBakedModel.java +++ b/src/main/java/appeng/client/render/cablebus/P2PTunnelFrequencyBakedModel.java @@ -9,13 +9,13 @@ import java.util.concurrent.ExecutionException; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -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.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.api.parts.IPartBakedModel; import appeng.api.util.AEColor; @@ -66,7 +66,7 @@ public class P2PTunnelFrequencyBakedModel implements IBakedModel, IPartBakedMode } @Override - public List getQuads( IBlockState state, EnumFacing side, long rand ) + public List getQuads( BlockState state, Direction side, long rand ) { if( side != null ) { diff --git a/src/main/java/appeng/client/render/cablebus/QuadRotator.java b/src/main/java/appeng/client/render/cablebus/QuadRotator.java index 69de80d7a..7b0b17f92 100644 --- a/src/main/java/appeng/client/render/cablebus/QuadRotator.java +++ b/src/main/java/appeng/client/render/cablebus/QuadRotator.java @@ -26,10 +26,10 @@ import javax.vecmath.Matrix4f; import javax.vecmath.Point3f; import javax.vecmath.Vector3f; -import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.model.BakedQuad; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.client.render.FacingToRotation; import appeng.core.AELog; @@ -42,9 +42,9 @@ import appeng.core.AELog; public class QuadRotator { - public List rotateQuads( List quads, EnumFacing newForward, EnumFacing newUp ) + public List rotateQuads( List quads, Direction newForward, Direction newUp ) { - if( newForward == EnumFacing.NORTH && newUp == EnumFacing.UP ) + if( newForward == Direction.NORTH && newUp == Direction.UP ) { return quads; // This is the default orientation } @@ -59,18 +59,18 @@ public class QuadRotator return result; } - private BakedQuad rotateQuad( BakedQuad quad, EnumFacing forward, EnumFacing up ) + private BakedQuad rotateQuad( BakedQuad quad, Direction forward, Direction up ) { // Sanitize forward/up if( forward.getAxis() == up.getAxis() ) { - if( up.getAxis() == EnumFacing.Axis.Y ) + if( up.getAxis() == Direction.Axis.Y ) { - up = EnumFacing.NORTH; + up = Direction.NORTH; } else { - up = EnumFacing.UP; + up = Direction.UP; } } @@ -149,7 +149,7 @@ public class QuadRotator } } - EnumFacing newFace = rotation.rotate( quad.getFace() ); + Direction newFace = rotation.rotate( quad.getFace() ); return new BakedQuad( newData, quad.getTintIndex(), newFace, quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat() ); } diff --git a/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java b/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java index 2aa1c661a..456a1ea2c 100644 --- a/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java +++ b/src/main/java/appeng/client/render/crafting/CraftingCubeBakedModel.java @@ -26,14 +26,14 @@ import java.util.List; import javax.annotation.Nullable; -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 net.minecraftforge.common.property.IExtendedBlockState; import appeng.block.crafting.BlockCraftingUnit; @@ -65,7 +65,7 @@ abstract class CraftingCubeBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { if( side == null ) @@ -73,7 +73,7 @@ abstract class CraftingCubeBakedModel implements IBakedModel return Collections.emptyList(); // No generic quads for this model } - EnumSet connections = getConnections( state ); + EnumSet connections = getConnections( state ); List quads = new ArrayList<>(); CubeBuilder builder = new CubeBuilder( this.format, quads ); @@ -84,14 +84,14 @@ abstract class CraftingCubeBakedModel implements IBakedModel this.addRing( builder, side, connections ); // Calculate the bounds of the "inner" block that is framed by the border drawn above - float x2 = connections.contains( EnumFacing.EAST ) ? 16 : 13.01f; - float x1 = connections.contains( EnumFacing.WEST ) ? 0 : 2.99f; + float x2 = connections.contains( Direction.EAST ) ? 16 : 13.01f; + float x1 = connections.contains( Direction.WEST ) ? 0 : 2.99f; - float y2 = connections.contains( EnumFacing.UP ) ? 16 : 13.01f; - float y1 = connections.contains( EnumFacing.DOWN ) ? 0 : 2.99f; + float y2 = connections.contains( Direction.UP ) ? 16 : 13.01f; + float y1 = connections.contains( Direction.DOWN ) ? 0 : 2.99f; - float z2 = connections.contains( EnumFacing.SOUTH ) ? 16 : 13.01f; - float z1 = connections.contains( EnumFacing.NORTH ) ? 0 : 2.99f; + float z2 = connections.contains( Direction.SOUTH ) ? 16 : 13.01f; + float z1 = connections.contains( Direction.NORTH ) ? 0 : 2.99f; // On the axis of the side that we're currently drawing, extend the dimensions // out to the outer face of the block @@ -119,21 +119,21 @@ abstract class CraftingCubeBakedModel implements IBakedModel return quads; } - private void addRing( CubeBuilder builder, @Nullable EnumFacing side, EnumSet connections ) + private void addRing( CubeBuilder builder, @Nullable Direction side, EnumSet connections ) { // Fill in the corners builder.setTexture( this.ringCorner ); - this.addCornerCap( builder, connections, side, EnumFacing.UP, EnumFacing.EAST, EnumFacing.NORTH ); - this.addCornerCap( builder, connections, side, EnumFacing.UP, EnumFacing.EAST, EnumFacing.SOUTH ); - this.addCornerCap( builder, connections, side, EnumFacing.UP, EnumFacing.WEST, EnumFacing.NORTH ); - this.addCornerCap( builder, connections, side, EnumFacing.UP, EnumFacing.WEST, EnumFacing.SOUTH ); - this.addCornerCap( builder, connections, side, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.NORTH ); - this.addCornerCap( builder, connections, side, EnumFacing.DOWN, EnumFacing.EAST, EnumFacing.SOUTH ); - this.addCornerCap( builder, connections, side, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.NORTH ); - this.addCornerCap( builder, connections, side, EnumFacing.DOWN, EnumFacing.WEST, EnumFacing.SOUTH ); + this.addCornerCap( builder, connections, side, Direction.UP, Direction.EAST, Direction.NORTH ); + this.addCornerCap( builder, connections, side, Direction.UP, Direction.EAST, Direction.SOUTH ); + this.addCornerCap( builder, connections, side, Direction.UP, Direction.WEST, Direction.NORTH ); + this.addCornerCap( builder, connections, side, Direction.UP, Direction.WEST, Direction.SOUTH ); + this.addCornerCap( builder, connections, side, Direction.DOWN, Direction.EAST, Direction.NORTH ); + this.addCornerCap( builder, connections, side, Direction.DOWN, Direction.EAST, Direction.SOUTH ); + this.addCornerCap( builder, connections, side, Direction.DOWN, Direction.WEST, Direction.NORTH ); + this.addCornerCap( builder, connections, side, Direction.DOWN, Direction.WEST, Direction.SOUTH ); // Fill in the remaining stripes of the face - for( EnumFacing a : EnumFacing.values() ) + for( Direction a : Direction.values() ) { if( a == side || a == side.getOpposite() ) { @@ -141,11 +141,11 @@ abstract class CraftingCubeBakedModel implements IBakedModel } // Select the horizontal or vertical ring texture depending on which side we're filling in - if( ( side.getAxis() != EnumFacing.Axis.Y ) && ( a == EnumFacing.NORTH || a == EnumFacing.EAST || a == EnumFacing.WEST || a == EnumFacing.SOUTH ) ) + if( ( side.getAxis() != Direction.Axis.Y ) && ( a == Direction.NORTH || a == Direction.EAST || a == Direction.WEST || a == Direction.SOUTH ) ) { builder.setTexture( this.ringVer ); } - else if( side.getAxis() == EnumFacing.Axis.Y && ( a == EnumFacing.EAST || a == EnumFacing.WEST ) ) + else if( side.getAxis() == Direction.Axis.Y && ( a == Direction.EAST || a == Direction.WEST ) ) { builder.setTexture( this.ringVer ); } @@ -194,8 +194,8 @@ abstract class CraftingCubeBakedModel implements IBakedModel // drawn in those directions. Since a corner is drawn if the three touching faces dont have adjacent // crafting cube blocks, we'd have to check for a, side, and the perpendicular direction. But in this // block, we've already checked for side (due to face culling) and a (see above). - EnumFacing perpendicular = a.rotateAround( side.getAxis() ); - for( EnumFacing cornerCandidate : EnumSet.of( perpendicular, perpendicular.getOpposite() ) ) + Direction perpendicular = a.rotateAround( side.getAxis() ); + for( Direction cornerCandidate : EnumSet.of( perpendicular, perpendicular.getOpposite() ) ) { if( !connections.contains( cornerCandidate ) ) { @@ -232,7 +232,7 @@ abstract class CraftingCubeBakedModel implements IBakedModel /** * Adds a 3x3x3 corner cap to the cube builder if there are no adjacent crafting cubes on that corner. */ - private void addCornerCap( CubeBuilder builder, EnumSet connections, EnumFacing side, EnumFacing down, EnumFacing west, EnumFacing north ) + private void addCornerCap( CubeBuilder builder, EnumSet connections, Direction side, Direction down, Direction west, Direction north ) { if( connections.contains( down ) || connections.contains( west ) || connections.contains( north ) ) { @@ -245,35 +245,35 @@ abstract class CraftingCubeBakedModel implements IBakedModel return; } - float x1 = ( west == EnumFacing.WEST ? 0 : 13 ); - float y1 = ( down == EnumFacing.DOWN ? 0 : 13 ); - float z1 = ( north == EnumFacing.NORTH ? 0 : 13 ); - float x2 = ( west == EnumFacing.WEST ? 3 : 16 ); - float y2 = ( down == EnumFacing.DOWN ? 3 : 16 ); - float z2 = ( north == EnumFacing.NORTH ? 3 : 16 ); + float x1 = ( west == Direction.WEST ? 0 : 13 ); + float y1 = ( down == Direction.DOWN ? 0 : 13 ); + float z1 = ( north == Direction.NORTH ? 0 : 13 ); + float x2 = ( west == Direction.WEST ? 3 : 16 ); + float y2 = ( down == Direction.DOWN ? 3 : 16 ); + float z2 = ( north == Direction.NORTH ? 3 : 16 ); builder.addCube( x1, y1, z1, x2, y2, z2 ); } // Retrieve the cube connection state from the block state // If none is present, just assume there are no adjacent crafting cube blocks - private static EnumSet getConnections( @Nullable IBlockState state ) + private static EnumSet getConnections( @Nullable BlockState state ) { if( !( state instanceof IExtendedBlockState ) ) { - return EnumSet.noneOf( EnumFacing.class ); + return EnumSet.noneOf( Direction.class ); } IExtendedBlockState extState = (IExtendedBlockState) state; CraftingCubeState cubeState = extState.getValue( BlockCraftingUnit.STATE ); if( cubeState == null ) { - return EnumSet.noneOf( EnumFacing.class ); + return EnumSet.noneOf( Direction.class ); } return cubeState.getConnections(); } - protected abstract void addInnerCube( EnumFacing facing, IBlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ); + protected abstract void addInnerCube( Direction facing, BlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ); @Override public boolean isAmbientOcclusion() diff --git a/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java b/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java index 17f540271..67f0c8692 100644 --- a/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java +++ b/src/main/java/appeng/client/render/crafting/CraftingCubeRendering.java @@ -23,11 +23,11 @@ import java.util.HashMap; import java.util.Map; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; -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.block.crafting.BlockCraftingUnit; import appeng.bootstrap.BlockRenderingCustomizer; @@ -53,7 +53,7 @@ public class CraftingCubeRendering extends BlockRenderingCustomizer } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { ResourceLocation baseName = new ResourceLocation( AppEng.MOD_ID, this.registryName ); @@ -82,10 +82,10 @@ public class CraftingCubeRendering extends BlockRenderingCustomizer } - private Map mapState( Block block, ModelResourceLocation defaultModel, ModelResourceLocation formedModel ) + private Map mapState( Block block, ModelResourceLocation defaultModel, ModelResourceLocation formedModel ) { - Map result = new HashMap<>(); - for( IBlockState state : block.getBlockState().getValidStates() ) + Map result = new HashMap<>(); + for( BlockState state : block.getBlockState().getValidStates() ) { if( state.getValue( BlockCraftingUnit.FORMED ) ) { diff --git a/src/main/java/appeng/client/render/crafting/CraftingCubeState.java b/src/main/java/appeng/client/render/crafting/CraftingCubeState.java index fec1f8c9d..8e1e89031 100644 --- a/src/main/java/appeng/client/render/crafting/CraftingCubeState.java +++ b/src/main/java/appeng/client/render/crafting/CraftingCubeState.java @@ -21,7 +21,7 @@ package appeng.client.render.crafting; import java.util.EnumSet; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; /** @@ -31,14 +31,14 @@ public final class CraftingCubeState { // Contains information on which sides of the block are connected to other parts of a formed crafting cube - private final EnumSet connections; + private final EnumSet connections; - public CraftingCubeState( EnumSet connections ) + public CraftingCubeState( EnumSet connections ) { this.connections = connections; } - public EnumSet getConnections() + public EnumSet getConnections() { return this.connections; } diff --git a/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java b/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java index 3c3336702..ecc6c37d0 100644 --- a/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java +++ b/src/main/java/appeng/client/render/crafting/CraftingMonitorTESR.java @@ -21,9 +21,9 @@ package appeng.client.render.crafting; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.util.EnumFacing; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.util.Direction; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import appeng.api.storage.data.IAEItemStack; import appeng.client.render.TesrRenderHelper; @@ -33,7 +33,7 @@ import appeng.tile.crafting.TileCraftingMonitorTile; /** * Renders the item currently being crafted */ -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class CraftingMonitorTESR extends TileEntitySpecialRenderer { @@ -45,7 +45,7 @@ public class CraftingMonitorTESR extends TileEntitySpecialRenderer getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { return this.baseModel.getQuads( state, side, rand ); } @@ -157,7 +157,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { // This may be called for items on the ground, in which case we will always fall back to the pattern return ItemEncodedPatternBakedModel.this.baseModel.getQuads( state, side, rand ); @@ -220,7 +220,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel } @Override - public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) + public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, LivingEntity entity ) { boolean shiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT ); if( shiftHeld ) @@ -229,7 +229,7 @@ class ItemEncodedPatternBakedModel implements IBakedModel ItemStack output = iep.getOutput( stack ); if( !output.isEmpty() ) { - IBakedModel realModel = Minecraft.getMinecraft().getRenderItem().getItemModelMesher().getItemModel( output ); + IBakedModel realModel = Minecraft.getInstance().getRenderItem().getItemModelMesher().getItemModel( output ); // Give the item model a chance to handle the overrides as well realModel = realModel.getOverrides().handleItemState( realModel, output, world, entity ); return new ShiftHoldingModelWrapper( realModel ); diff --git a/src/main/java/appeng/client/render/crafting/ItemEncodedPatternRendering.java b/src/main/java/appeng/client/render/crafting/ItemEncodedPatternRendering.java index e7ed4997a..812c09f07 100644 --- a/src/main/java/appeng/client/render/crafting/ItemEncodedPatternRendering.java +++ b/src/main/java/appeng/client/render/crafting/ItemEncodedPatternRendering.java @@ -4,8 +4,8 @@ package appeng.client.render.crafting; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; -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.bootstrap.IItemRendering; import appeng.bootstrap.ItemRenderingCustomizer; @@ -18,7 +18,7 @@ public class ItemEncodedPatternRendering extends ItemRenderingCustomizer private static final ResourceLocation MODEL = new ResourceLocation( AppEng.MOD_ID, "builtin/encoded_pattern" ); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IItemRendering rendering ) { rendering.builtInModel( "models/item/builtin/encoded_pattern", new ItemEncodedPatternModel() ); diff --git a/src/main/java/appeng/client/render/crafting/LightBakedModel.java b/src/main/java/appeng/client/render/crafting/LightBakedModel.java index 7c7774607..7b9c861ed 100644 --- a/src/main/java/appeng/client/render/crafting/LightBakedModel.java +++ b/src/main/java/appeng/client/render/crafting/LightBakedModel.java @@ -19,10 +19,10 @@ package appeng.client.render.crafting; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; 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.block.crafting.BlockCraftingUnit; import appeng.client.render.cablebus.CubeBuilder; @@ -47,7 +47,7 @@ class LightBakedModel extends CraftingCubeBakedModel } @Override - protected void addInnerCube( EnumFacing facing, IBlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ) + protected void addInnerCube( Direction facing, BlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ) { builder.setTexture( this.baseTexture ); builder.addCube( x1, y1, z1, x2, y2, z2 ); diff --git a/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java b/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java index 00785c7e0..4374d825d 100644 --- a/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java +++ b/src/main/java/appeng/client/render/crafting/MonitorBakedModel.java @@ -19,10 +19,10 @@ package appeng.client.render.crafting; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; 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 net.minecraftforge.common.property.IExtendedBlockState; import appeng.api.util.AEColor; @@ -61,9 +61,9 @@ class MonitorBakedModel extends CraftingCubeBakedModel } @Override - protected void addInnerCube( EnumFacing side, IBlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ) + protected void addInnerCube( Direction side, BlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ) { - EnumFacing forward = getForward( state ); + Direction forward = getForward( state ); // For sides other than the front, use the chassis texture if( side != forward ) @@ -96,7 +96,7 @@ class MonitorBakedModel extends CraftingCubeBakedModel } - private static AEColor getColor( IBlockState state ) + private static AEColor getColor( BlockState state ) { if( state instanceof IExtendedBlockState ) { @@ -111,18 +111,18 @@ class MonitorBakedModel extends CraftingCubeBakedModel return AEColor.TRANSPARENT; } - private static EnumFacing getForward( IBlockState state ) + private static Direction getForward( BlockState state ) { if( state instanceof IExtendedBlockState ) { IExtendedBlockState extState = (IExtendedBlockState) state; - EnumFacing forward = extState.getValue( BlockCraftingMonitor.FORWARD ); + Direction forward = extState.getValue( BlockCraftingMonitor.FORWARD ); if( forward != null ) { return forward; } } - return EnumFacing.NORTH; + return Direction.NORTH; } } diff --git a/src/main/java/appeng/client/render/crafting/UnitBakedModel.java b/src/main/java/appeng/client/render/crafting/UnitBakedModel.java index b85e10f7f..2cc751e80 100644 --- a/src/main/java/appeng/client/render/crafting/UnitBakedModel.java +++ b/src/main/java/appeng/client/render/crafting/UnitBakedModel.java @@ -19,10 +19,10 @@ package appeng.client.render.crafting; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; 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; @@ -42,7 +42,7 @@ class UnitBakedModel extends CraftingCubeBakedModel } @Override - protected void addInnerCube( EnumFacing facing, IBlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ) + protected void addInnerCube( Direction facing, BlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 ) { builder.setTexture( this.unitTexture ); builder.addCube( x1, y1, z1, x2, y2, z2 ); diff --git a/src/main/java/appeng/client/render/effects/CraftingFx.java b/src/main/java/appeng/client/render/effects/CraftingFx.java index 2d69d5881..3c6ffbc55 100644 --- a/src/main/java/appeng/client/render/effects/CraftingFx.java +++ b/src/main/java/appeng/client/render/effects/CraftingFx.java @@ -26,14 +26,14 @@ import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.util.math.MathHelper; 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.util.AEPartLocation; import appeng.client.render.textures.ParticleTextures; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class CraftingFx extends ParticleBreaking { diff --git a/src/main/java/appeng/client/render/effects/EnergyFx.java b/src/main/java/appeng/client/render/effects/EnergyFx.java index bc0b78132..88f63dac1 100644 --- a/src/main/java/appeng/client/render/effects/EnergyFx.java +++ b/src/main/java/appeng/client/render/effects/EnergyFx.java @@ -26,14 +26,14 @@ import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.util.math.MathHelper; 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.util.AEPartLocation; import appeng.client.render.textures.ParticleTextures; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class EnergyFx extends ParticleBreaking { diff --git a/src/main/java/appeng/client/render/effects/LightningFX.java b/src/main/java/appeng/client/render/effects/LightningFX.java index 97afced65..29f2cf204 100644 --- a/src/main/java/appeng/client/render/effects/LightningFX.java +++ b/src/main/java/appeng/client/render/effects/LightningFX.java @@ -25,7 +25,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -125,7 +125,7 @@ public class LightningFX extends Particle double oy = 0; double oz = 0; - final EntityPlayer p = Minecraft.getMinecraft().player; + final PlayerEntity p = Minecraft.getInstance().player; double offX = -rZ; double offY = MathHelper.cos( (float) ( Math.PI / 2.0f + p.rotationPitch * 0.017453292F ) ); double offZ = rX; diff --git a/src/main/java/appeng/client/render/effects/VibrantFX.java b/src/main/java/appeng/client/render/effects/VibrantFX.java index 7730b326c..f20567306 100644 --- a/src/main/java/appeng/client/render/effects/VibrantFX.java +++ b/src/main/java/appeng/client/render/effects/VibrantFX.java @@ -21,11 +21,11 @@ package appeng.client.render.effects; import net.minecraft.client.particle.Particle; 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; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class VibrantFX extends Particle { diff --git a/src/main/java/appeng/client/render/model/AutoRotatingCacheKey.java b/src/main/java/appeng/client/render/model/AutoRotatingCacheKey.java index 45ab4a532..8df9d0b0e 100644 --- a/src/main/java/appeng/client/render/model/AutoRotatingCacheKey.java +++ b/src/main/java/appeng/client/render/model/AutoRotatingCacheKey.java @@ -19,8 +19,8 @@ package appeng.client.render.model; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; +import net.minecraft.block.BlockState; +import net.minecraft.util.Direction; /** @@ -28,12 +28,12 @@ import net.minecraft.util.EnumFacing; */ final class AutoRotatingCacheKey { - private final IBlockState blockState; - private final EnumFacing forward; - private final EnumFacing up; - private final EnumFacing side; + private final BlockState blockState; + private final Direction forward; + private final Direction up; + private final Direction side; - AutoRotatingCacheKey( IBlockState blockState, EnumFacing forward, EnumFacing up, EnumFacing side ) + AutoRotatingCacheKey( BlockState blockState, Direction forward, Direction up, Direction side ) { this.blockState = blockState; this.forward = forward; @@ -41,22 +41,22 @@ final class AutoRotatingCacheKey this.side = side; } - public IBlockState getBlockState() + public BlockState getBlockState() { return this.blockState; } - public EnumFacing getForward() + public Direction getForward() { return this.forward; } - public EnumFacing getUp() + public Direction getUp() { return this.up; } - public EnumFacing getSide() + public Direction getSide() { return this.side; } diff --git a/src/main/java/appeng/client/render/model/AutoRotatingModel.java b/src/main/java/appeng/client/render/model/AutoRotatingModel.java index ce98fa1cc..0012e1547 100644 --- a/src/main/java/appeng/client/render/model/AutoRotatingModel.java +++ b/src/main/java/appeng/client/render/model/AutoRotatingModel.java @@ -30,15 +30,15 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; -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.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.Vec3i; import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer; @@ -69,7 +69,7 @@ public class AutoRotatingModel implements IBakedModel } ); } - private List getRotatedModel( IBlockState state, EnumFacing side, EnumFacing forward, EnumFacing up ) + private List getRotatedModel( BlockState state, Direction side, Direction forward, Direction up ) { FacingToRotation f2r = FacingToRotation.get( forward, up ); List original = AutoRotatingModel.this.parent.getQuads( state, f2r.resultingRotate( side ), 0 ); @@ -143,7 +143,7 @@ public class AutoRotatingModel implements IBakedModel } @Override - public List getQuads( IBlockState state, EnumFacing side, long rand ) + public List getQuads( BlockState state, Direction side, long rand ) { if( !( state instanceof IExtendedBlockState ) ) { @@ -152,8 +152,8 @@ public class AutoRotatingModel implements IBakedModel IExtendedBlockState extState = (IExtendedBlockState) state; - EnumFacing forward = extState.getValue( AEBaseTileBlock.FORWARD ); - EnumFacing up = extState.getValue( AEBaseTileBlock.UP ); + Direction forward = extState.getValue( AEBaseTileBlock.FORWARD ); + Direction up = extState.getValue( AEBaseTileBlock.UP ); if( forward == null || up == null ) { @@ -177,9 +177,9 @@ public class AutoRotatingModel implements IBakedModel public static class VertexRotator extends QuadGatheringTransformer { private final FacingToRotation f2r; - private final EnumFacing face; + private final Direction face; - public VertexRotator( FacingToRotation f2r, EnumFacing face ) + public VertexRotator( FacingToRotation f2r, Direction face ) { this.f2r = f2r; this.face = face; @@ -317,7 +317,7 @@ public class AutoRotatingModel implements IBakedModel } @Override - public void setQuadOrientation( EnumFacing orientation ) + public void setQuadOrientation( Direction orientation ) { this.parent.setQuadOrientation( orientation ); } diff --git a/src/main/java/appeng/client/render/model/BiometricCardBakedModel.java b/src/main/java/appeng/client/render/model/BiometricCardBakedModel.java index b9e4a1979..3b875fea4 100644 --- a/src/main/java/appeng/client/render/model/BiometricCardBakedModel.java +++ b/src/main/java/appeng/client/render/model/BiometricCardBakedModel.java @@ -17,16 +17,16 @@ import com.mojang.authlib.GameProfile; import org.apache.commons.lang3.tuple.Pair; -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.entity.EntityLivingBase; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.world.World; import net.minecraftforge.common.model.TRSRTransformation; @@ -74,7 +74,7 @@ class BiometricCardBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { List quads = this.baseModel.getQuads( state, side, rand ); @@ -171,7 +171,7 @@ class BiometricCardBakedModel implements IBakedModel return new ItemOverrideList( Collections.emptyList() ) { @Override - public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) + public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, LivingEntity entity ) { String username = ""; if( stack.getItem() instanceof IBiometricCard ) diff --git a/src/main/java/appeng/client/render/model/BuiltInModelLoader.java b/src/main/java/appeng/client/render/model/BuiltInModelLoader.java index 1dc76da83..f9c0aae48 100644 --- a/src/main/java/appeng/client/render/model/BuiltInModelLoader.java +++ b/src/main/java/appeng/client/render/model/BuiltInModelLoader.java @@ -23,8 +23,8 @@ import java.util.Map; import com.google.common.collect.ImmutableMap; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; +import net.minecraft.resources.IResourceManager; +import net.minecraft.resources.IResourceManagerReloadListener; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ICustomModelLoader; import net.minecraftforge.client.model.IModel; diff --git a/src/main/java/appeng/client/render/model/ColorApplicatorBakedModel.java b/src/main/java/appeng/client/render/model/ColorApplicatorBakedModel.java index 3657a9025..6456ddc0b 100644 --- a/src/main/java/appeng/client/render/model/ColorApplicatorBakedModel.java +++ b/src/main/java/appeng/client/render/model/ColorApplicatorBakedModel.java @@ -13,13 +13,13 @@ import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.tuple.Pair; -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.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.client.model.PerspectiveMapWrapper; import net.minecraftforge.common.model.TRSRTransformation; @@ -31,7 +31,7 @@ class ColorApplicatorBakedModel implements IBakedModel private final ImmutableMap transforms; - private final EnumMap> quadsBySide; + private final EnumMap> quadsBySide; private final List generalQuads; @@ -42,14 +42,14 @@ class ColorApplicatorBakedModel implements IBakedModel // Put the tint indices in... Since this is an item model, we are ignoring rand this.generalQuads = this.fixQuadTint( null, texDark, texMedium, texBright ); - this.quadsBySide = new EnumMap<>( EnumFacing.class ); - for( EnumFacing facing : EnumFacing.values() ) + this.quadsBySide = new EnumMap<>( Direction.class ); + for( Direction facing : Direction.values() ) { this.quadsBySide.put( facing, this.fixQuadTint( facing, texDark, texMedium, texBright ) ); } } - private List fixQuadTint( EnumFacing facing, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright ) + private List fixQuadTint( Direction facing, TextureAtlasSprite texDark, TextureAtlasSprite texMedium, TextureAtlasSprite texBright ) { List quads = this.baseModel.getQuads( null, facing, 0 ); List result = new ArrayList<>( quads.size() ); @@ -84,7 +84,7 @@ class ColorApplicatorBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { if( side == null ) { diff --git a/src/main/java/appeng/client/render/model/DriveBakedModel.java b/src/main/java/appeng/client/render/model/DriveBakedModel.java index 085ecac3f..bf1eb6474 100644 --- a/src/main/java/appeng/client/render/model/DriveBakedModel.java +++ b/src/main/java/appeng/client/render/model/DriveBakedModel.java @@ -24,16 +24,16 @@ import java.util.List; import java.util.Map; import javax.annotation.Nullable; -import javax.vecmath.Matrix4f; -import javax.vecmath.Vector3f; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.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.block.BlockState; +import net.minecraft.client.renderer.Matrix4f; +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.renderer.model.BakedQuad; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.common.property.IExtendedBlockState; @@ -54,7 +54,7 @@ public class DriveBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { List result = new ArrayList<>(); diff --git a/src/main/java/appeng/client/render/model/GlassBakedModel.java b/src/main/java/appeng/client/render/model/GlassBakedModel.java index 72b0fdcbc..a939958f6 100644 --- a/src/main/java/appeng/client/render/model/GlassBakedModel.java +++ b/src/main/java/appeng/client/render/model/GlassBakedModel.java @@ -30,14 +30,14 @@ import javax.annotation.Nullable; import com.google.common.base.Strings; -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 net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; @@ -98,7 +98,7 @@ class GlassBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { if( !( state instanceof IExtendedBlockState ) || side == null ) { @@ -160,28 +160,28 @@ class GlassBakedModel implements IBakedModel /** * Creates the bitmask that indicates, in which directions (in terms of u,v space) a border should be drawn. */ - private static int makeBitmask( GlassState state, EnumFacing side ) + private static int makeBitmask( GlassState state, Direction side ) { switch( side ) { case DOWN: - return makeBitmask( state, EnumFacing.SOUTH, EnumFacing.EAST, EnumFacing.NORTH, EnumFacing.WEST ); + return makeBitmask( state, Direction.SOUTH, Direction.EAST, Direction.NORTH, Direction.WEST ); case UP: - return makeBitmask( state, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.NORTH, EnumFacing.EAST ); + return makeBitmask( state, Direction.SOUTH, Direction.WEST, Direction.NORTH, Direction.EAST ); case NORTH: - return makeBitmask( state, EnumFacing.UP, EnumFacing.WEST, EnumFacing.DOWN, EnumFacing.EAST ); + return makeBitmask( state, Direction.UP, Direction.WEST, Direction.DOWN, Direction.EAST ); case SOUTH: - return makeBitmask( state, EnumFacing.UP, EnumFacing.EAST, EnumFacing.DOWN, EnumFacing.WEST ); + return makeBitmask( state, Direction.UP, Direction.EAST, Direction.DOWN, Direction.WEST ); case WEST: - return makeBitmask( state, EnumFacing.UP, EnumFacing.SOUTH, EnumFacing.DOWN, EnumFacing.NORTH ); + return makeBitmask( state, Direction.UP, Direction.SOUTH, Direction.DOWN, Direction.NORTH ); case EAST: - return makeBitmask( state, EnumFacing.UP, EnumFacing.NORTH, EnumFacing.DOWN, EnumFacing.SOUTH ); + return makeBitmask( state, Direction.UP, Direction.NORTH, Direction.DOWN, Direction.SOUTH ); default: throw new IllegalArgumentException( "Unsupported side!" ); } } - private static int makeBitmask( GlassState state, EnumFacing up, EnumFacing right, EnumFacing down, EnumFacing left ) + private static int makeBitmask( GlassState state, Direction up, Direction right, Direction down, Direction left ) { int bitmask = 0; @@ -205,12 +205,12 @@ class GlassBakedModel implements IBakedModel return bitmask; } - private BakedQuad createQuad( EnumFacing side, List corners, TextureAtlasSprite sprite, float uOffset, float vOffset ) + private BakedQuad createQuad( Direction side, List corners, TextureAtlasSprite sprite, float uOffset, float vOffset ) { return this.createQuad( side, corners.get( 0 ), corners.get( 1 ), corners.get( 2 ), corners.get( 3 ), sprite, uOffset, vOffset ); } - private BakedQuad createQuad( EnumFacing side, Vec3d c1, Vec3d c2, Vec3d c3, Vec3d c4, TextureAtlasSprite sprite, float uOffset, float vOffset ) + private BakedQuad createQuad( Direction side, Vec3d c1, Vec3d c2, Vec3d c3, Vec3d c4, TextureAtlasSprite sprite, float uOffset, float vOffset ) { Vec3d normal = new Vec3d( side.getDirectionVec() ); diff --git a/src/main/java/appeng/client/render/model/MatrixVertexTransformer.java b/src/main/java/appeng/client/render/model/MatrixVertexTransformer.java index 961b3c103..087bc8081 100644 --- a/src/main/java/appeng/client/render/model/MatrixVertexTransformer.java +++ b/src/main/java/appeng/client/render/model/MatrixVertexTransformer.java @@ -25,7 +25,7 @@ import javax.vecmath.Vector4f; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer; @@ -76,7 +76,7 @@ final class MatrixVertexTransformer extends QuadGatheringTransformer } @Override - public void setQuadOrientation( EnumFacing orientation ) + public void setQuadOrientation( Direction orientation ) { this.parent.setQuadOrientation( orientation ); } diff --git a/src/main/java/appeng/client/render/model/MemoryCardBakedModel.java b/src/main/java/appeng/client/render/model/MemoryCardBakedModel.java index ebe8cbed5..8d62a4a2c 100644 --- a/src/main/java/appeng/client/render/model/MemoryCardBakedModel.java +++ b/src/main/java/appeng/client/render/model/MemoryCardBakedModel.java @@ -17,16 +17,16 @@ import com.google.common.collect.ImmutableList; import org.apache.commons.lang3.tuple.Pair; -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.entity.EntityLivingBase; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.world.World; import net.minecraftforge.common.model.TRSRTransformation; @@ -78,7 +78,7 @@ class MemoryCardBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { List quads = this.baseModel.getQuads( state, side, rand ); @@ -150,7 +150,7 @@ class MemoryCardBakedModel implements IBakedModel return new ItemOverrideList( Collections.emptyList() ) { @Override - public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) + public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, LivingEntity entity ) { try { diff --git a/src/main/java/appeng/client/render/model/RenderHelper.java b/src/main/java/appeng/client/render/model/RenderHelper.java index dd40e77e2..c768e65f2 100644 --- a/src/main/java/appeng/client/render/model/RenderHelper.java +++ b/src/main/java/appeng/client/render/model/RenderHelper.java @@ -25,7 +25,7 @@ import java.util.List; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.Vec3d; @@ -33,27 +33,27 @@ import net.minecraft.util.math.Vec3d; final class RenderHelper { - private static EnumMap> cornersForFacing = generateCornersForFacings(); + private static EnumMap> cornersForFacing = generateCornersForFacings(); private RenderHelper() { } - static List getFaceCorners( EnumFacing side ) + static List getFaceCorners( Direction side ) { return cornersForFacing.get( side ); } - private static EnumMap> generateCornersForFacings() + private static EnumMap> generateCornersForFacings() { - EnumMap> result = new EnumMap<>( EnumFacing.class ); + EnumMap> result = new EnumMap<>( Direction.class ); - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { List corners; - float offset = ( facing.getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ) ? 0 : 1; + float offset = ( facing.getAxisDirection() == Direction.AxisDirection.NEGATIVE ) ? 0 : 1; switch( facing.getAxis() ) { @@ -69,7 +69,7 @@ final class RenderHelper break; } - if( facing.getAxisDirection() == EnumFacing.AxisDirection.NEGATIVE ) + if( facing.getAxisDirection() == Direction.AxisDirection.NEGATIVE ) { corners = Lists.reverse( corners ); } @@ -80,7 +80,7 @@ final class RenderHelper return result; } - private static Vec3d adjust( Vec3d vec, EnumFacing.Axis axis, double delta ) + private static Vec3d adjust( Vec3d vec, Direction.Axis axis, double delta ) { switch( axis ) { diff --git a/src/main/java/appeng/client/render/model/SkyCompassBakedModel.java b/src/main/java/appeng/client/render/model/SkyCompassBakedModel.java index 04676c512..cb38d948b 100644 --- a/src/main/java/appeng/client/render/model/SkyCompassBakedModel.java +++ b/src/main/java/appeng/client/render/model/SkyCompassBakedModel.java @@ -25,19 +25,19 @@ import java.util.List; import javax.annotation.Nullable; import javax.vecmath.AxisAngle4f; -import javax.vecmath.Matrix4f; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.renderer.block.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.block.BlockState; +import net.minecraft.client.entity.PlayerEntitySP; +import net.minecraft.client.renderer.Matrix4f; +import net.minecraft.client.renderer.model.BakedQuad; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -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.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; @@ -68,7 +68,7 @@ public class SkyCompassBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { float rotation = 0; // Get rotation from the special block state @@ -159,11 +159,11 @@ public class SkyCompassBakedModel implements IBakedModel { @Override - public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity ) + public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, LivingEntity entity ) { - if( world != null && entity instanceof EntityPlayerSP ) + if( world != null && entity instanceof PlayerEntitySP ) { - EntityPlayer player = (EntityPlayer) entity; + PlayerEntity player = (PlayerEntity) entity; float offRads = (float) ( player.rotationYaw / 180.0f * (float) Math.PI + Math.PI ); diff --git a/src/main/java/appeng/client/render/model/UVLModelLoader.java b/src/main/java/appeng/client/render/model/UVLModelLoader.java index f9f8397a4..23eb3484d 100644 --- a/src/main/java/appeng/client/render/model/UVLModelLoader.java +++ b/src/main/java/appeng/client/render/model/UVLModelLoader.java @@ -48,27 +48,26 @@ import com.google.gson.JsonParseException; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import org.lwjgl.util.vector.Vector3f; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.BlockFaceUV; -import net.minecraft.client.renderer.block.model.BlockPart; -import net.minecraft.client.renderer.block.model.BlockPartFace; -import net.minecraft.client.renderer.block.model.BlockPartRotation; -import net.minecraft.client.renderer.block.model.FaceBakery; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemOverride; -import net.minecraft.client.renderer.block.model.ItemTransformVec3f; -import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.Vector3f; import net.minecraft.client.renderer.block.model.ModelBlock; +import net.minecraft.client.renderer.model.BakedQuad; +import net.minecraft.client.renderer.model.BlockFaceUV; +import net.minecraft.client.renderer.model.BlockPart; +import net.minecraft.client.renderer.model.BlockPartFace; +import net.minecraft.client.renderer.model.BlockPartRotation; +import net.minecraft.client.renderer.model.FaceBakery; +import net.minecraft.client.renderer.model.IBakedModel; +import net.minecraft.client.renderer.model.ItemCameraTransforms; +import net.minecraft.client.renderer.model.ItemOverride; +import net.minecraft.client.renderer.model.ItemTransformVec3f; +import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.IResource; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.JsonUtils; +import net.minecraft.resources.IResource; +import net.minecraft.resources.IResourceManager; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ICustomModelLoader; import net.minecraftforge.client.model.IModel; @@ -191,7 +190,7 @@ public enum UVLModelLoader implements ICustomModelLoader modelPath = modelPath.substring( "models/".length() ); } - try( InputStreamReader io = new InputStreamReader( Minecraft.getMinecraft() + try( InputStreamReader io = new InputStreamReader( Minecraft.getInstance() .getResourceManager() .getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) ) .getInputStream() ) ) @@ -246,7 +245,7 @@ public enum UVLModelLoader implements ICustomModelLoader { String s = modelLocation.getResourcePath(); - iresource = Minecraft.getMinecraft() + iresource = Minecraft.getInstance() .getResourceManager() .getResource( new ResourceLocation( modelLocation.getResourceDomain(), "models/" + modelPath + ".json" ) ); @@ -304,11 +303,11 @@ public enum UVLModelLoader implements ICustomModelLoader public BlockPartFace deserialize( JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_ ) throws JsonParseException { JsonObject jsonobject = p_deserialize_1_.getAsJsonObject(); - EnumFacing enumfacing = this.parseCullFace( jsonobject ); + Direction Direction = this.parseCullFace( jsonobject ); int i = this.parseTintIndex( jsonobject ); String s = this.parseTexture( jsonobject ); BlockFaceUV blockfaceuv = (BlockFaceUV) p_deserialize_3_.deserialize( jsonobject, BlockFaceUV.class ); - BlockPartFace blockFace = new BlockPartFace( enumfacing, i, s, blockfaceuv ); + BlockPartFace blockFace = new BlockPartFace( Direction, i, s, blockfaceuv ); UVLModelWrapper.this.uvlightmap.put( blockFace, this.parseUVL( jsonobject ) ); return blockFace; } @@ -324,10 +323,10 @@ public enum UVLModelLoader implements ICustomModelLoader } @Nullable - private EnumFacing parseCullFace( JsonObject object ) + private Direction parseCullFace( JsonObject object ) { String s = JsonUtils.getString( object, "cullface", "" ); - return EnumFacing.byName( s ); + return Direction.byName( s ); } protected Pair parseUVL( JsonObject object ) @@ -345,7 +344,7 @@ public enum UVLModelLoader implements ICustomModelLoader { @Override - public BakedQuad makeBakedQuad( Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade ) + public BakedQuad makeBakedQuad( Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, Direction facing, ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade ) { BakedQuad quad = super.makeBakedQuad( posFrom, posTo, face, sprite, facing, modelRotationIn, partRotation, uvLocked, shade ); @@ -354,7 +353,7 @@ public enum UVLModelLoader implements ICustomModelLoader { VertexFormat newFormat = VertexFormats.getFormatWithLightMap( quad.getFormat() ); UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( newFormat ); - VertexLighterFlat trans = new VertexLighterFlat( Minecraft.getMinecraft().getBlockColors() ) + VertexLighterFlat trans = new VertexLighterFlat( Minecraft.getInstance().getBlockColors() ) { @Override diff --git a/src/main/java/appeng/client/render/renderable/ItemRenderable.java b/src/main/java/appeng/client/render/renderable/ItemRenderable.java index 6a0ffa2b0..a0a004b49 100644 --- a/src/main/java/appeng/client/render/renderable/ItemRenderable.java +++ b/src/main/java/appeng/client/render/renderable/ItemRenderable.java @@ -58,7 +58,7 @@ public class ItemRenderable implements Renderable matrix.flip(); GlStateManager.multMatrix( matrix ); } - Minecraft.getMinecraft().getRenderItem().renderItem( pair.getLeft(), TransformType.GROUND ); + Minecraft.getInstance().getRenderItem().renderItem( pair.getLeft(), TransformType.GROUND ); GlStateManager.popMatrix(); } } diff --git a/src/main/java/appeng/client/render/spatial/SpatialPylonBakedModel.java b/src/main/java/appeng/client/render/spatial/SpatialPylonBakedModel.java index 8f37f299e..eb40dbe0b 100644 --- a/src/main/java/appeng/client/render/spatial/SpatialPylonBakedModel.java +++ b/src/main/java/appeng/client/render/spatial/SpatialPylonBakedModel.java @@ -26,14 +26,14 @@ import javax.annotation.Nullable; import com.google.common.collect.ImmutableMap; -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 net.minecraftforge.common.property.IExtendedBlockState; import appeng.block.spatial.BlockSpatialPylon; @@ -58,7 +58,7 @@ class SpatialPylonBakedModel implements IBakedModel } @Override - public List getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { int flags = this.getFlags( state ); @@ -66,75 +66,75 @@ class SpatialPylonBakedModel implements IBakedModel if( flags != 0 ) { - EnumFacing ori = null; + Direction ori = null; int displayAxis = flags & TileSpatialPylon.DISPLAY_Z; if( displayAxis == TileSpatialPylon.DISPLAY_X ) { - ori = EnumFacing.EAST; + ori = Direction.EAST; if( ( flags & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX ) { - builder.setUvRotation( EnumFacing.SOUTH, 1 ); - builder.setUvRotation( EnumFacing.NORTH, 1 ); - builder.setUvRotation( EnumFacing.UP, 2 ); - builder.setUvRotation( EnumFacing.DOWN, 2 ); + builder.setUvRotation( Direction.SOUTH, 1 ); + builder.setUvRotation( Direction.NORTH, 1 ); + builder.setUvRotation( Direction.UP, 2 ); + builder.setUvRotation( Direction.DOWN, 2 ); } else if( ( flags & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MIN ) { - builder.setUvRotation( EnumFacing.SOUTH, 2 ); - builder.setUvRotation( EnumFacing.NORTH, 2 ); - builder.setUvRotation( EnumFacing.UP, 1 ); - builder.setUvRotation( EnumFacing.DOWN, 1 ); + builder.setUvRotation( Direction.SOUTH, 2 ); + builder.setUvRotation( Direction.NORTH, 2 ); + builder.setUvRotation( Direction.UP, 1 ); + builder.setUvRotation( Direction.DOWN, 1 ); } else { - builder.setUvRotation( EnumFacing.SOUTH, 1 ); - builder.setUvRotation( EnumFacing.NORTH, 1 ); - builder.setUvRotation( EnumFacing.UP, 1 ); - builder.setUvRotation( EnumFacing.DOWN, 1 ); + builder.setUvRotation( Direction.SOUTH, 1 ); + builder.setUvRotation( Direction.NORTH, 1 ); + builder.setUvRotation( Direction.UP, 1 ); + builder.setUvRotation( Direction.DOWN, 1 ); } } else if( displayAxis == TileSpatialPylon.DISPLAY_Y ) { - ori = EnumFacing.UP; + ori = Direction.UP; if( ( flags & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX ) { - builder.setUvRotation( EnumFacing.NORTH, 3 ); - builder.setUvRotation( EnumFacing.SOUTH, 3 ); - builder.setUvRotation( EnumFacing.EAST, 3 ); - builder.setUvRotation( EnumFacing.WEST, 3 ); + builder.setUvRotation( Direction.NORTH, 3 ); + builder.setUvRotation( Direction.SOUTH, 3 ); + builder.setUvRotation( Direction.EAST, 3 ); + builder.setUvRotation( Direction.WEST, 3 ); } } else if( displayAxis == TileSpatialPylon.DISPLAY_Z ) { - ori = EnumFacing.NORTH; + ori = Direction.NORTH; if( ( flags & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MAX ) { - builder.setUvRotation( EnumFacing.EAST, 2 ); - builder.setUvRotation( EnumFacing.WEST, 1 ); + builder.setUvRotation( Direction.EAST, 2 ); + builder.setUvRotation( Direction.WEST, 1 ); } else if( ( flags & TileSpatialPylon.DISPLAY_MIDDLE ) == TileSpatialPylon.DISPLAY_END_MIN ) { - builder.setUvRotation( EnumFacing.EAST, 1 ); - builder.setUvRotation( EnumFacing.WEST, 2 ); - builder.setUvRotation( EnumFacing.UP, 3 ); - builder.setUvRotation( EnumFacing.DOWN, 3 ); + builder.setUvRotation( Direction.EAST, 1 ); + builder.setUvRotation( Direction.WEST, 2 ); + builder.setUvRotation( Direction.UP, 3 ); + builder.setUvRotation( Direction.DOWN, 3 ); } else { - builder.setUvRotation( EnumFacing.EAST, 1 ); - builder.setUvRotation( EnumFacing.WEST, 2 ); + builder.setUvRotation( Direction.EAST, 1 ); + builder.setUvRotation( Direction.WEST, 2 ); } } - builder.setTextures( this.textures.get( getTextureTypeFromSideOutside( flags, ori, EnumFacing.UP ) ), - this.textures.get( getTextureTypeFromSideOutside( flags, ori, EnumFacing.DOWN ) ), - this.textures.get( getTextureTypeFromSideOutside( flags, ori, EnumFacing.NORTH ) ), - this.textures.get( getTextureTypeFromSideOutside( flags, ori, EnumFacing.SOUTH ) ), - this.textures.get( getTextureTypeFromSideOutside( flags, ori, EnumFacing.EAST ) ), - this.textures.get( getTextureTypeFromSideOutside( flags, ori, EnumFacing.WEST ) ) ); + builder.setTextures( this.textures.get( getTextureTypeFromSideOutside( flags, ori, Direction.UP ) ), + this.textures.get( getTextureTypeFromSideOutside( flags, ori, Direction.DOWN ) ), + this.textures.get( getTextureTypeFromSideOutside( flags, ori, Direction.NORTH ) ), + this.textures.get( getTextureTypeFromSideOutside( flags, ori, Direction.SOUTH ) ), + this.textures.get( getTextureTypeFromSideOutside( flags, ori, Direction.EAST ) ), + this.textures.get( getTextureTypeFromSideOutside( flags, ori, Direction.WEST ) ) ); builder.addCube( 0, 0, 0, 16, 16, 16 ); if( ( flags & TileSpatialPylon.DISPLAY_POWERED_ENABLED ) == TileSpatialPylon.DISPLAY_POWERED_ENABLED ) @@ -142,12 +142,12 @@ class SpatialPylonBakedModel implements IBakedModel builder.setRenderFullBright( true ); } - builder.setTextures( this.textures.get( getTextureTypeFromSideInside( flags, ori, EnumFacing.UP ) ), - this.textures.get( getTextureTypeFromSideInside( flags, ori, EnumFacing.DOWN ) ), - this.textures.get( getTextureTypeFromSideInside( flags, ori, EnumFacing.NORTH ) ), - this.textures.get( getTextureTypeFromSideInside( flags, ori, EnumFacing.SOUTH ) ), - this.textures.get( getTextureTypeFromSideInside( flags, ori, EnumFacing.EAST ) ), - this.textures.get( getTextureTypeFromSideInside( flags, ori, EnumFacing.WEST ) ) ); + builder.setTextures( this.textures.get( getTextureTypeFromSideInside( flags, ori, Direction.UP ) ), + this.textures.get( getTextureTypeFromSideInside( flags, ori, Direction.DOWN ) ), + this.textures.get( getTextureTypeFromSideInside( flags, ori, Direction.NORTH ) ), + this.textures.get( getTextureTypeFromSideInside( flags, ori, Direction.SOUTH ) ), + this.textures.get( getTextureTypeFromSideInside( flags, ori, Direction.EAST ) ), + this.textures.get( getTextureTypeFromSideInside( flags, ori, Direction.WEST ) ) ); builder.addCube( 0, 0, 0, 16, 16, 16 ); } else @@ -162,7 +162,7 @@ class SpatialPylonBakedModel implements IBakedModel return builder.getOutput(); } - private int getFlags( IBlockState state ) + private int getFlags( BlockState state ) { if( !( state instanceof IExtendedBlockState ) ) { @@ -174,7 +174,7 @@ class SpatialPylonBakedModel implements IBakedModel return extState.getValue( BlockSpatialPylon.STATE ); } - private static SpatialPylonTextureType getTextureTypeFromSideOutside( int flags, EnumFacing ori, EnumFacing dir ) + private static SpatialPylonTextureType getTextureTypeFromSideOutside( int flags, Direction ori, Direction dir ) { if( ori == dir || ori.getOpposite() == dir ) { @@ -197,7 +197,7 @@ class SpatialPylonBakedModel implements IBakedModel return SpatialPylonTextureType.BASE; } - private static SpatialPylonTextureType getTextureTypeFromSideInside( int flags, EnumFacing ori, EnumFacing dir ) + private static SpatialPylonTextureType getTextureTypeFromSideInside( int flags, Direction ori, Direction dir ) { final boolean good = ( flags & TileSpatialPylon.DISPLAY_ENABLED ) == TileSpatialPylon.DISPLAY_ENABLED; diff --git a/src/main/java/appeng/client/render/spatial/SpatialPylonRendering.java b/src/main/java/appeng/client/render/spatial/SpatialPylonRendering.java index 9a417eb9f..dd97a2d21 100644 --- a/src/main/java/appeng/client/render/spatial/SpatialPylonRendering.java +++ b/src/main/java/appeng/client/render/spatial/SpatialPylonRendering.java @@ -24,11 +24,11 @@ import java.util.Map; import com.google.common.collect.ImmutableMap; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; -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.bootstrap.BlockRenderingCustomizer; import appeng.bootstrap.IBlockRendering; @@ -42,14 +42,14 @@ public class SpatialPylonRendering extends BlockRenderingCustomizer private static final ResourceLocation MODEL_ID = new ResourceLocation( AppEng.MOD_ID, "models/blocks/spatial_pylon/builtin" ); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.builtInModel( MODEL_ID.getResourcePath(), new SpatialPylonModel() ); rendering.stateMapper( this::mapState ); } - private Map mapState( Block block ) + private Map mapState( Block block ) { return ImmutableMap.of( block.getDefaultState(), new ModelResourceLocation( MODEL_ID, "normal" ) ); } diff --git a/src/main/java/appeng/client/render/tesr/CrankTESR.java b/src/main/java/appeng/client/render/tesr/CrankTESR.java index aa1f3c337..69175678d 100644 --- a/src/main/java/appeng/client/render/tesr/CrankTESR.java +++ b/src/main/java/appeng/client/render/tesr/CrankTESR.java @@ -21,7 +21,7 @@ package appeng.client.render.tesr; import org.lwjgl.opengl.GL11; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BufferBuilder; @@ -32,8 +32,8 @@ import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -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.client.render.FacingToRotation; import appeng.tile.grindstone.TileCrank; @@ -43,7 +43,7 @@ import appeng.tile.grindstone.TileCrank; * This FastTESR only handles the animated model of the turning crank. When the crank is at rest, it is rendered using a * normal model. */ -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class CrankTESR extends TileEntitySpecialRenderer { @@ -67,9 +67,9 @@ public class CrankTESR extends TileEntitySpecialRenderer GlStateManager.shadeModel( GL11.GL_FLAT ); } - IBlockState blockState = te.getWorld().getBlockState( te.getPos() ); + BlockState blockState = te.getWorld().getBlockState( te.getPos() ); - BlockRendererDispatcher dispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); IBakedModel model = dispatcher.getModelForState( blockState ); BufferBuilder buffer = tessellator.getBuffer(); diff --git a/src/main/java/appeng/client/render/tesr/InscriberTESR.java b/src/main/java/appeng/client/render/tesr/InscriberTESR.java index a3dec5998..85659e222 100644 --- a/src/main/java/appeng/client/render/tesr/InscriberTESR.java +++ b/src/main/java/appeng/client/render/tesr/InscriberTESR.java @@ -14,7 +14,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.item.ItemBlock; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.TextureStitchEvent; @@ -56,7 +56,7 @@ public final class InscriberTESR extends TileEntitySpecialRenderer extends TileEntitySpecialRenderer +@OnlyIn( Dist.CLIENT ) +public class ModularTESR extends TileEntityRenderer { private final Renderable[] renderables; - public ModularTESR( Renderable... renderables ) + public ModularTESR( TileEntityRendererDispatcher rendererDispatcherIn, Renderable... renderables ) { + super( rendererDispatcherIn ); this.renderables = renderables; } @Override - public void render( T te, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_ ) + public void render( T te, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn ) { GlStateManager.pushMatrix(); GlStateManager.translate( x, y, z ); @@ -56,19 +60,4 @@ public class ModularTESR extends TileEntitySpecialRenderer GlStateManager.popMatrix(); } - @Override - public void renderTileEntityFast( T te, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_, BufferBuilder buffer ) - { - GlStateManager.pushMatrix(); - GlStateManager.translate( x, y, z ); - GlStateManager.translate( 0.5, 0.5, 0.5 ); - FacingToRotation.get( te.getForward(), te.getUp() ).glRotateCurrentMat(); - GlStateManager.translate( -0.5, -0.5, -0.5 ); - for( Renderable renderable : this.renderables ) - { - renderable.renderTileEntityFast( te, x, y, z, partialTicks, destroyStage, buffer ); - } - GlStateManager.popMatrix(); - } - } \ No newline at end of file diff --git a/src/main/java/appeng/client/render/tesr/SkyChestTESR.java b/src/main/java/appeng/client/render/tesr/SkyChestTESR.java index 616e2475b..d0fae310b 100644 --- a/src/main/java/appeng/client/render/tesr/SkyChestTESR.java +++ b/src/main/java/appeng/client/render/tesr/SkyChestTESR.java @@ -23,10 +23,10 @@ import net.minecraft.block.Block; import net.minecraft.client.model.ModelChest; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; -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.block.storage.BlockSkyChest; import appeng.block.storage.BlockSkyChest.SkyChestType; @@ -35,7 +35,7 @@ import appeng.core.AppEng; import appeng.tile.storage.TileSkyChest; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class SkyChestTESR extends TileEntitySpecialRenderer { @@ -84,23 +84,23 @@ public class SkyChestTESR extends TileEntitySpecialRenderer { GlStateManager.translate( 0.5F, 0.5F, 0.5F ); // In the vanilla chest model, north and south are flipped - EnumFacing forward = te.getForward(); - EnumFacing up = te.getUp(); - if( forward == EnumFacing.SOUTH ) + Direction forward = te.getForward(); + Direction up = te.getUp(); + if( forward == Direction.SOUTH ) { - forward = EnumFacing.NORTH; + forward = Direction.NORTH; } - else if( forward == EnumFacing.NORTH ) + else if( forward == Direction.NORTH ) { - forward = EnumFacing.SOUTH; + forward = Direction.SOUTH; } - if( up == EnumFacing.SOUTH ) + if( up == Direction.SOUTH ) { - up = EnumFacing.NORTH; + up = Direction.NORTH; } - else if( up == EnumFacing.NORTH ) + else if( up == Direction.NORTH ) { - up = EnumFacing.SOUTH; + up = Direction.SOUTH; } FacingToRotation.get( forward, up ).glRotateCurrentMat(); GlStateManager.translate( -0.5F, -0.5F, -0.5F ); diff --git a/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java b/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java index e2a45cade..26956cbda 100644 --- a/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java +++ b/src/main/java/appeng/client/render/tesr/SkyCompassTESR.java @@ -19,20 +19,20 @@ package appeng.client.render.tesr; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.block.model.IBakedModel; -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.client.MinecraftForgeClient; import net.minecraftforge.client.model.animation.FastTESR; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.Properties; -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.block.AEBaseTileBlock; import appeng.block.misc.BlockSkyCompass; @@ -40,7 +40,7 @@ import appeng.client.render.model.SkyCompassBakedModel; import appeng.tile.misc.TileSkyCompass; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class SkyCompassTESR extends FastTESR { @@ -57,12 +57,12 @@ public class SkyCompassTESR extends FastTESR if( blockRenderer == null ) { - blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); + blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher(); } BlockPos pos = te.getPos(); - IBlockAccess world = MinecraftForgeClient.getRegionRenderCache( te.getWorld(), pos ); - IBlockState state = world.getBlockState( pos ); + IBlockReader world = MinecraftForgeClient.getRegionRenderCache( te.getWorld(), pos ); + BlockState state = world.getBlockState( pos ); if( state.getPropertyKeys().contains( Properties.StaticProperty ) ) { state = state.withProperty( Properties.StaticProperty, false ); @@ -76,13 +76,13 @@ public class SkyCompassTESR extends FastTESR exState = exState.withProperty( BlockSkyCompass.ROTATION, getRotation( te ) ); // Flip forward/up for rendering, the base model is facing up without any rotation - EnumFacing forward = exState.getValue( AEBaseTileBlock.FORWARD ); - EnumFacing up = exState.getValue( AEBaseTileBlock.UP ); + Direction forward = exState.getValue( AEBaseTileBlock.FORWARD ); + Direction up = exState.getValue( AEBaseTileBlock.UP ); // This ensures the needle isn't flipped by the model rotator. Since the model is symmetrical, this should // not affect the appearance - if( forward == EnumFacing.UP || forward == EnumFacing.DOWN ) + if( forward == Direction.UP || forward == Direction.DOWN ) { - up = EnumFacing.NORTH; + up = Direction.NORTH; } exState = exState.withProperty( AEBaseTileBlock.FORWARD, up ) .withProperty( AEBaseTileBlock.UP, forward ); @@ -97,7 +97,7 @@ public class SkyCompassTESR extends FastTESR { float rotation; - if( skyCompass.getForward() == EnumFacing.UP || skyCompass.getForward() == EnumFacing.DOWN ) + if( skyCompass.getForward() == Direction.UP || skyCompass.getForward() == Direction.DOWN ) { rotation = SkyCompassBakedModel.getAnimatedRotation( skyCompass.getPos(), false ); } @@ -106,7 +106,7 @@ public class SkyCompassTESR extends FastTESR rotation = SkyCompassBakedModel.getAnimatedRotation( null, false ); } - if( skyCompass.getForward() == EnumFacing.DOWN ) + if( skyCompass.getForward() == Direction.DOWN ) { rotation = flipidiy( rotation ); } diff --git a/src/main/java/appeng/container/AEBaseContainer.java b/src/main/java/appeng/container/AEBaseContainer.java index 3b54c17b2..3c193bee5 100644 --- a/src/main/java/appeng/container/AEBaseContainer.java +++ b/src/main/java/appeng/container/AEBaseContainer.java @@ -26,13 +26,12 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IContainerListener; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.IContainerListener; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.items.IItemHandler; @@ -81,7 +80,7 @@ import appeng.util.item.AEItemStack; public abstract class AEBaseContainer extends Container { - private final InventoryPlayer invPlayer; + private final PlayerInventory invPlayer; private final IActionSource mySrc; private final HashSet locked = new HashSet<>(); private final TileEntity tileEntity; @@ -97,12 +96,12 @@ public abstract class AEBaseContainer extends Container private int ticksSinceCheck = 900; private IAEItemStack clientRequestedTargetItem = null; - public AEBaseContainer( final InventoryPlayer ip, final TileEntity myTile, final IPart myPart ) + public AEBaseContainer( final PlayerInventory ip, final TileEntity myTile, final IPart myPart ) { this( ip, myTile, myPart, null ); } - public AEBaseContainer( final InventoryPlayer ip, final TileEntity myTile, final IPart myPart, final IGuiItemObject gio ) + public AEBaseContainer( final PlayerInventory ip, final TileEntity myTile, final IPart myPart, final IGuiItemObject gio ) { this.invPlayer = ip; this.tileEntity = myTile; @@ -151,7 +150,7 @@ public abstract class AEBaseContainer extends Container } } - public AEBaseContainer( final InventoryPlayer ip, final Object anchor ) + public AEBaseContainer( final PlayerInventory ip, final Object anchor ) { this.invPlayer = ip; this.tileEntity = anchor instanceof TileEntity ? (TileEntity) anchor : null; @@ -237,7 +236,7 @@ public abstract class AEBaseContainer extends Container } final ISecurityGrid sg = g.getCache( ISecurityGrid.class ); - if( sg.hasPermission( this.getInventoryPlayer().player, perm ) ) + if( sg.hasPermission( this.getPlayerInventory().player, perm ) ) { return true; } @@ -270,9 +269,9 @@ public abstract class AEBaseContainer extends Container return null; } - public InventoryPlayer getPlayerInv() + public PlayerInventory getPlayerInv() { - return this.getInventoryPlayer(); + return this.getPlayerInventory(); } public TileEntity getTileEntity() @@ -299,9 +298,9 @@ public abstract class AEBaseContainer extends Container } } - protected void bindPlayerInventory( final InventoryPlayer inventoryPlayer, final int offsetX, final int offsetY ) + protected void bindPlayerInventory( final PlayerInventory PlayerInventory, final int offsetX, final int offsetY ) { - IItemHandler ih = new PlayerInvWrapper( inventoryPlayer ); + IItemHandler ih = new PlayerInvWrapper( PlayerInventory ); // bind player inventory for( int i = 0; i < 3; i++ ) @@ -373,7 +372,7 @@ public abstract class AEBaseContainer extends Container } @Override - public ItemStack transferStackInSlot( final EntityPlayer p, final int idx ) + public ItemStack transferStackInSlot( final PlayerEntity p, final int idx ) { if( Platform.isClient() ) { @@ -635,13 +634,13 @@ public abstract class AEBaseContainer extends Container } @Override - public boolean canInteractWith( final EntityPlayer entityplayer ) + public boolean canInteractWith( final PlayerEntity PlayerEntity ) { if( this.isValidContainer() ) { if( this.tileEntity instanceof IInventory ) { - return ( (IInventory) this.tileEntity ).isUsableByPlayer( entityplayer ); + return ( (IInventory) this.tileEntity ).isUsableByPlayer( PlayerEntity ); } return true; } @@ -654,7 +653,7 @@ public abstract class AEBaseContainer extends Container return ( (AppEngSlot) s ).isDraggable(); } - public void doAction( final EntityPlayerMP player, final InventoryAction action, final int slot, final long id ) + public void doAction( final PlayerEntityMP player, final InventoryAction action, final int slot, final long id ) { if( slot >= 0 && slot < this.inventorySlots.size() ) { @@ -1012,7 +1011,7 @@ public abstract class AEBaseContainer extends Container } } - protected void updateHeld( final EntityPlayerMP p ) + protected void updateHeld( final PlayerEntityMP p ) { if( Platform.isServer() ) { @@ -1099,7 +1098,7 @@ public abstract class AEBaseContainer extends Container { NetworkHandler.instance() .sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ), - (EntityPlayerMP) this.getInventoryPlayer().player ); + (PlayerEntityMP) this.getPlayerInventory().player ); } catch( final IOException e ) { @@ -1133,12 +1132,12 @@ public abstract class AEBaseContainer extends Container // can take? - if( !isA.isEmpty() && !a.canTakeStack( this.getInventoryPlayer().player ) ) + if( !isA.isEmpty() && !a.canTakeStack( this.getPlayerInventory().player ) ) { return; } - if( !isB.isEmpty() && !b.canTakeStack( this.getInventoryPlayer().player ) ) + if( !isB.isEmpty() && !b.canTakeStack( this.getPlayerInventory().player ) ) { return; } @@ -1226,7 +1225,7 @@ public abstract class AEBaseContainer extends Container this.customName = customName; } - public InventoryPlayer getInventoryPlayer() + public PlayerInventory getPlayerInventory() { return this.invPlayer; } diff --git a/src/main/java/appeng/container/ContainerNull.java b/src/main/java/appeng/container/ContainerNull.java index 8e94d3caf..2c4aae645 100644 --- a/src/main/java/appeng/container/ContainerNull.java +++ b/src/main/java/appeng/container/ContainerNull.java @@ -19,8 +19,8 @@ package appeng.container; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.container.Container; /* @@ -29,8 +29,13 @@ import net.minecraft.inventory.Container; public class ContainerNull extends Container { + public ContainerNull() + { + super( null, 0 ); + } + @Override - public boolean canInteractWith( final EntityPlayer entityplayer ) + public boolean canInteractWith( final PlayerEntity PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/container/guisync/SyncData.java b/src/main/java/appeng/container/guisync/SyncData.java index 13b903f72..f0457381a 100644 --- a/src/main/java/appeng/container/guisync/SyncData.java +++ b/src/main/java/appeng/container/guisync/SyncData.java @@ -23,7 +23,7 @@ import java.io.IOException; import java.lang.reflect.Field; import java.util.EnumSet; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.inventory.IContainerListener; import appeng.container.AEBaseContainer; @@ -86,9 +86,9 @@ public class SyncData { if( val instanceof String ) { - if( o instanceof EntityPlayerMP ) + if( o instanceof PlayerEntityMP ) { - NetworkHandler.instance().sendTo( new PacketValueConfig( "SyncDat." + this.channel, (String) val ), (EntityPlayerMP) o ); + NetworkHandler.instance().sendTo( new PacketValueConfig( "SyncDat." + this.channel, (String) val ), (PlayerEntityMP) o ); } } else if( this.field.getType().isEnum() ) @@ -97,9 +97,9 @@ public class SyncData } else if( val instanceof Long || val.getClass() == long.class ) { - if( o instanceof EntityPlayerMP ) + if( o instanceof PlayerEntityMP ) { - NetworkHandler.instance().sendTo( new PacketProgressBar( this.channel, (Long) val ), (EntityPlayerMP) o ); + NetworkHandler.instance().sendTo( new PacketProgressBar( this.channel, (Long) val ), (PlayerEntityMP) o ); } } else if( val instanceof Boolean || val.getClass() == boolean.class ) diff --git a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java index dbc45bff8..927d9e94a 100644 --- a/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java +++ b/src/main/java/appeng/container/implementations/ContainerCellWorkbench.java @@ -21,8 +21,8 @@ package appeng.container.implementations; import java.util.Iterator; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -59,7 +59,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable private ItemStack prevStack = ItemStack.EMPTY; private int lastUpgrades = 0; - public ContainerCellWorkbench( final InventoryPlayer ip, final TileCellWorkbench te ) + public ContainerCellWorkbench( final PlayerInventory ip, final TileCellWorkbench te ) { super( ip, te ); this.workBench = te; @@ -119,7 +119,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable final int iSLot = zz * 8 + z; this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this - .getInventoryPlayer() ) ); + .getPlayerInventory() ) ); } } /* @@ -164,9 +164,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable } } - if( listener instanceof EntityPlayerMP ) + if( listener instanceof PlayerEntityMP ) { - ( (EntityPlayerMP) listener ).isChangingQuantityOnly = false; + ( (PlayerEntityMP) listener ).isChangingQuantityOnly = false; } } } diff --git a/src/main/java/appeng/container/implementations/ContainerChest.java b/src/main/java/appeng/container/implementations/ContainerChest.java index 5659071da..5cfe180e8 100644 --- a/src/main/java/appeng/container/implementations/ContainerChest.java +++ b/src/main/java/appeng/container/implementations/ContainerChest.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.container.AEBaseContainer; import appeng.container.slot.SlotRestrictedInput; @@ -31,13 +31,13 @@ public class ContainerChest extends AEBaseContainer private final TileChest chest; - public ContainerChest( final InventoryPlayer ip, final TileChest chest ) + public ContainerChest( final PlayerInventory ip, final TileChest chest ) { super( ip, chest, null ); this.chest = chest; this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest.getInternalInventory(), 1, 80, 37, this - .getInventoryPlayer() ) ); + .getPlayerInventory() ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } diff --git a/src/main/java/appeng/container/implementations/ContainerCondenser.java b/src/main/java/appeng/container/implementations/ContainerCondenser.java index 44c19eee9..c268d02c8 100644 --- a/src/main/java/appeng/container/implementations/ContainerCondenser.java +++ b/src/main/java/appeng/container/implementations/ContainerCondenser.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.IItemHandler; import appeng.api.config.CondenserOutput; @@ -44,7 +44,7 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv @GuiSync( 2 ) public CondenserOutput output = CondenserOutput.TRASH; - public ContainerCondenser( final InventoryPlayer ip, final TileCondenser condenser ) + public ContainerCondenser( final PlayerInventory ip, final TileCondenser condenser ) { super( ip, condenser, null ); this.condenser = condenser; diff --git a/src/main/java/appeng/container/implementations/ContainerCraftAmount.java b/src/main/java/appeng/container/implementations/ContainerCraftAmount.java index a0bc41207..b0a69b7ba 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftAmount.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftAmount.java @@ -21,7 +21,7 @@ package appeng.container.implementations; import javax.annotation.Nonnull; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Slot; import net.minecraft.world.World; @@ -43,7 +43,7 @@ public class ContainerCraftAmount extends AEBaseContainer private final Slot craftingItem; private IAEItemStack itemToCreate; - public ContainerCraftAmount( final InventoryPlayer ip, final ITerminalHost te ) + public ContainerCraftAmount( final PlayerInventory ip, final ITerminalHost te ) { super( ip, te ); diff --git a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java index bd8b42dd5..5fd6c81e7 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java @@ -28,9 +28,9 @@ import javax.annotation.Nonnull; import com.google.common.collect.ImmutableSet; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.text.TextComponentString; @@ -89,7 +89,7 @@ public class ContainerCraftConfirm extends AEBaseContainer @GuiSync( 7 ) public String myName = ""; - public ContainerCraftConfirm( final InventoryPlayer ip, final ITerminalHost te ) + public ContainerCraftConfirm( final PlayerInventory ip, final ITerminalHost te ) { super( ip, te ); } @@ -261,13 +261,13 @@ public class ContainerCraftConfirm extends AEBaseContainer for( final Object g : this.listeners ) { - if( g instanceof EntityPlayer ) + if( g instanceof PlayerEntity ) { - NetworkHandler.instance().sendTo( a, (EntityPlayerMP) g ); - NetworkHandler.instance().sendTo( b, (EntityPlayerMP) g ); + NetworkHandler.instance().sendTo( a, (PlayerEntityMP) g ); + NetworkHandler.instance().sendTo( b, (PlayerEntityMP) g ); if( c != null ) { - NetworkHandler.instance().sendTo( c, (EntityPlayerMP) g ); + NetworkHandler.instance().sendTo( c, (PlayerEntityMP) g ); } } } @@ -354,7 +354,7 @@ public class ContainerCraftConfirm extends AEBaseContainer if( g != null && originalGui != null && this.getOpenContext() != null ) { final TileEntity te = this.getOpenContext().getTile(); - Platform.openGUI( this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui ); + Platform.openGUI( this.getPlayerInventory().player, te, this.getOpenContext().getSide(), originalGui ); } } } @@ -376,9 +376,9 @@ public class ContainerCraftConfirm extends AEBaseContainer } @Override - public void onContainerClosed( final EntityPlayer par1EntityPlayer ) + public void onContainerClosed( final PlayerEntity par1PlayerEntity ) { - super.onContainerClosed( par1EntityPlayer ); + super.onContainerClosed( par1PlayerEntity ); if( this.getJob() != null ) { this.getJob().cancel( true ); diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java b/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java index c79a1399d..78a229856 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingCPU.java @@ -21,9 +21,9 @@ package appeng.container.implementations; import java.io.IOException; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import appeng.api.AEApi; @@ -61,7 +61,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH @GuiSync( 0 ) public long eta = -1; - public ContainerCraftingCPU( final InventoryPlayer ip, final Object te ) + public ContainerCraftingCPU( final PlayerInventory ip, final Object te ) { super( ip, te ); final IActionHost host = (IActionHost) ( te instanceof IActionHost ? te : null ); @@ -96,11 +96,11 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH for( final Object g : this.listeners ) { - if( g instanceof EntityPlayer ) + if( g instanceof PlayerEntity ) { try { - NetworkHandler.instance().sendTo( new PacketValueConfig( "CraftingStatus", "Clear" ), (EntityPlayerMP) g ); + NetworkHandler.instance().sendTo( new PacketValueConfig( "CraftingStatus", "Clear" ), (PlayerEntityMP) g ); } catch( final IOException e ) { @@ -147,7 +147,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH } @Override - public void onContainerClosed( final EntityPlayer player ) + public void onContainerClosed( final PlayerEntity player ) { super.onContainerClosed( player ); if( this.getMonitor() != null ) @@ -187,21 +187,21 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH for( final Object g : this.listeners ) { - if( g instanceof EntityPlayer ) + if( g instanceof PlayerEntity ) { if( !a.isEmpty() ) { - NetworkHandler.instance().sendTo( a, (EntityPlayerMP) g ); + NetworkHandler.instance().sendTo( a, (PlayerEntityMP) g ); } if( !b.isEmpty() ) { - NetworkHandler.instance().sendTo( b, (EntityPlayerMP) g ); + NetworkHandler.instance().sendTo( b, (PlayerEntityMP) g ); } if( !c.isEmpty() ) { - NetworkHandler.instance().sendTo( c, (EntityPlayerMP) g ); + NetworkHandler.instance().sendTo( c, (PlayerEntityMP) g ); } } } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java index c534a16d5..632296311 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java @@ -25,7 +25,7 @@ import java.util.List; import com.google.common.collect.ImmutableSet; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.networking.crafting.ICraftingCPU; import appeng.api.networking.crafting.ICraftingGrid; @@ -45,7 +45,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU @GuiSync( 7 ) public String myName = ""; - public ContainerCraftingStatus( final InventoryPlayer ip, final ITerminalHost te ) + public ContainerCraftingStatus( final PlayerInventory ip, final ITerminalHost te ) { super( ip, te ); } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java index 850aa9c1c..3857e29be 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingTerm.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; @@ -49,7 +49,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE private final SlotCraftingTerm outputSlot; private IRecipe currentRecipe; - public ContainerCraftingTerm( final InventoryPlayer ip, final ITerminalHost monitorable ) + public ContainerCraftingTerm( final PlayerInventory ip, final ITerminalHost monitorable ) { super( ip, monitorable, false ); this.ct = (PartCraftingTerminal) monitorable; @@ -121,7 +121,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE { if( name.equals( "player" ) ) { - return new PlayerInvWrapper( this.getInventoryPlayer() ); + return new PlayerInvWrapper( this.getPlayerInventory() ); } return this.ct.getInventoryByName( name ); } diff --git a/src/main/java/appeng/container/implementations/ContainerDrive.java b/src/main/java/appeng/container/implementations/ContainerDrive.java index d6d77f373..854fc1bc7 100644 --- a/src/main/java/appeng/container/implementations/ContainerDrive.java +++ b/src/main/java/appeng/container/implementations/ContainerDrive.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.container.AEBaseContainer; import appeng.container.slot.SlotRestrictedInput; @@ -29,7 +29,7 @@ import appeng.tile.storage.TileDrive; public class ContainerDrive extends AEBaseContainer { - public ContainerDrive( final InventoryPlayer ip, final TileDrive drive ) + public ContainerDrive( final PlayerInventory ip, final TileDrive drive ) { super( ip, drive, null ); @@ -38,7 +38,7 @@ public class ContainerDrive extends AEBaseContainer for( int x = 0; x < 2; x++ ) { this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive - .getInternalInventory(), x + y * 2, 71 + x * 18, 14 + y * 18, this.getInventoryPlayer() ) ); + .getInternalInventory(), x + y * 2, 71 + x * 18, 14 + y * 18, this.getPlayerInventory() ) ); } } diff --git a/src/main/java/appeng/container/implementations/ContainerFormationPlane.java b/src/main/java/appeng/container/implementations/ContainerFormationPlane.java index b884251b6..a10cd6364 100644 --- a/src/main/java/appeng/container/implementations/ContainerFormationPlane.java +++ b/src/main/java/appeng/container/implementations/ContainerFormationPlane.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.IItemHandler; import appeng.api.config.FuzzyMode; @@ -41,7 +41,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable @GuiSync( 6 ) public YesNo placeMode; - public ContainerFormationPlane( final InventoryPlayer ip, final PartFormationPlane te ) + public ContainerFormationPlane( final PlayerInventory ip, final PartFormationPlane te ) { super( ip, te ); } @@ -75,19 +75,19 @@ public class ContainerFormationPlane extends ContainerUpgradeable } final IItemHandler upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getPlayerInventory() ) ) .setNotDraggable() ); } diff --git a/src/main/java/appeng/container/implementations/ContainerGrinder.java b/src/main/java/appeng/container/implementations/ContainerGrinder.java index 051d19428..8d5589d20 100644 --- a/src/main/java/appeng/container/implementations/ContainerGrinder.java +++ b/src/main/java/appeng/container/implementations/ContainerGrinder.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.IItemHandler; import appeng.container.AEBaseContainer; @@ -32,15 +32,15 @@ import appeng.tile.grindstone.TileGrinder; public class ContainerGrinder extends AEBaseContainer { - public ContainerGrinder( final InventoryPlayer ip, final TileGrinder grinder ) + public ContainerGrinder( final PlayerInventory ip, final TileGrinder grinder ) { super( ip, grinder, null ); IItemHandler inv = grinder.getInternalInventory(); - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, inv, 0, 12, 17, this.getInventoryPlayer() ) ); - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, inv, 1, 12 + 18, 17, this.getInventoryPlayer() ) ); - this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, inv, 2, 12 + 36, 17, this.getInventoryPlayer() ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, inv, 0, 12, 17, this.getPlayerInventory() ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, inv, 1, 12 + 18, 17, this.getPlayerInventory() ) ); + this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, inv, 2, 12 + 36, 17, this.getPlayerInventory() ) ); this.addSlotToContainer( new SlotInaccessible( inv, 6, 80, 40 ) ); diff --git a/src/main/java/appeng/container/implementations/ContainerIOPort.java b/src/main/java/appeng/container/implementations/ContainerIOPort.java index f0a69e514..dc7c91454 100644 --- a/src/main/java/appeng/container/implementations/ContainerIOPort.java +++ b/src/main/java/appeng/container/implementations/ContainerIOPort.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.IItemHandler; import appeng.api.config.FullnessMode; @@ -42,7 +42,7 @@ public class ContainerIOPort extends ContainerUpgradeable @GuiSync( 3 ) public OperationMode opMode = OperationMode.EMPTY; - public ContainerIOPort( final InventoryPlayer ip, final TileIOPort te ) + public ContainerIOPort( final PlayerInventory ip, final TileIOPort te ) { super( ip, te ); } @@ -67,7 +67,7 @@ public class ContainerIOPort extends ContainerUpgradeable { this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this - .getInventoryPlayer() ) ); + .getPlayerInventory() ) ); } } @@ -83,13 +83,13 @@ public class ContainerIOPort extends ContainerUpgradeable } final IItemHandler upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); } diff --git a/src/main/java/appeng/container/implementations/ContainerInscriber.java b/src/main/java/appeng/container/implementations/ContainerInscriber.java index 231ca2990..467bf678a 100644 --- a/src/main/java/appeng/container/implementations/ContainerInscriber.java +++ b/src/main/java/appeng/container/implementations/ContainerInscriber.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -56,7 +56,7 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres @GuiSync( 3 ) public int processingTime = -1; - public ContainerInscriber( final InventoryPlayer ip, final TileInscriber te ) + public ContainerInscriber( final PlayerInventory ip, final TileInscriber te ) { super( ip, te ); this.ti = te; @@ -64,11 +64,11 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres IItemHandler inv = te.getInternalInventory(); this.addSlotToContainer( - this.top = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, inv, 0, 45, 16, this.getInventoryPlayer() ) ); + this.top = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, inv, 0, 45, 16, this.getPlayerInventory() ) ); this.addSlotToContainer( - this.bottom = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, inv, 1, 45, 62, this.getInventoryPlayer() ) ); + this.bottom = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, inv, 1, 45, 62, this.getPlayerInventory() ) ); this.addSlotToContainer( - this.middle = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT, inv, 2, 63, 39, this.getInventoryPlayer() ) ); + this.middle = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT, inv, 2, 63, 39, this.getPlayerInventory() ) ); this.addSlotToContainer( new SlotOutput( inv, 3, 113, 40, -1 ) ); } diff --git a/src/main/java/appeng/container/implementations/ContainerInterface.java b/src/main/java/appeng/container/implementations/ContainerInterface.java index 98d11e194..5c32a44f7 100644 --- a/src/main/java/appeng/container/implementations/ContainerInterface.java +++ b/src/main/java/appeng/container/implementations/ContainerInterface.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.SecurityPermissions; import appeng.api.config.Settings; @@ -44,7 +44,7 @@ public class ContainerInterface extends ContainerUpgradeable @GuiSync( 4 ) public YesNo iTermMode = YesNo.YES; - public ContainerInterface( final InventoryPlayer ip, final IInterfaceHost te ) + public ContainerInterface( final PlayerInventory ip, final IInterfaceHost te ) { super( ip, te.getInterfaceDuality().getHost() ); @@ -53,7 +53,7 @@ public class ContainerInterface extends ContainerUpgradeable for( int x = 0; x < DualityInterface.NUMBER_OF_PATTERN_SLOTS; x++ ) { this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality - .getPatterns(), x, 8 + 18 * x, 90 + 7, this.getInventoryPlayer() ) ); + .getPatterns(), x, 8 + 18 * x, 90 + 7, this.getPlayerInventory() ) ); } for( int x = 0; x < DualityInterface.NUMBER_OF_CONFIG_SLOTS; x++ ) diff --git a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java index ea970dd75..bb30a11ae 100644 --- a/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java +++ b/src/main/java/appeng/container/implementations/ContainerInterfaceTerminal.java @@ -24,10 +24,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.IItemHandler; import appeng.api.config.Settings; @@ -67,9 +67,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer private final Map diList = new HashMap<>(); private final Map byId = new HashMap<>(); private IGrid grid; - private NBTTagCompound data = new NBTTagCompound(); + private CompoundNBT data = new CompoundNBT(); - public ContainerInterfaceTerminal( final InventoryPlayer ip, final PartInterfaceTerminal anchor ) + public ContainerInterfaceTerminal( final PlayerInventory ip, final PartInterfaceTerminal anchor ) { super( ip, anchor ); @@ -188,19 +188,19 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer { try { - NetworkHandler.instance().sendTo( new PacketCompressedNBT( this.data ), (EntityPlayerMP) this.getPlayerInv().player ); + NetworkHandler.instance().sendTo( new PacketCompressedNBT( this.data ), (PlayerEntityMP) this.getPlayerInv().player ); } catch( final IOException e ) { // :P } - this.data = new NBTTagCompound(); + this.data = new CompoundNBT(); } } @Override - public void doAction( final EntityPlayerMP player, final InventoryAction action, final int slot, final long id ) + public void doAction( final PlayerEntityMP player, final InventoryAction action, final int slot, final long id ) { final InvTracker inv = this.byId.get( id ); if( inv != null ) @@ -311,7 +311,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer } } - private void regenList( final NBTTagCompound data ) + private void regenList( final CompoundNBT data ) { this.byId.clear(); this.diList.clear(); @@ -369,10 +369,10 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer return !ItemStack.areItemStacksEqual( a, b ); } - private void addItems( final NBTTagCompound data, final InvTracker inv, final int offset, final int length ) + private void addItems( final CompoundNBT data, final InvTracker inv, final int offset, final int length ) { final String name = '=' + Long.toString( inv.which, Character.MAX_RADIX ); - final NBTTagCompound tag = data.getCompoundTag( name ); + final CompoundNBT tag = data.getCompoundTag( name ); if( tag.hasNoTags() ) { @@ -382,7 +382,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer for( int x = 0; x < length; x++ ) { - final NBTTagCompound itemNBT = new NBTTagCompound(); + final CompoundNBT itemNBT = new CompoundNBT(); final ItemStack is = inv.server.getStackInSlot( x + offset ); diff --git a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java index 93903bbcd..4ba28463f 100644 --- a/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java +++ b/src/main/java/appeng/container/implementations/ContainerLevelEmitter.java @@ -20,10 +20,10 @@ package appeng.container.implementations; import net.minecraft.client.gui.GuiTextField; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; import appeng.api.config.FuzzyMode; @@ -44,7 +44,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable private final PartLevelEmitter lvlEmitter; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private GuiTextField textField; @GuiSync( 2 ) public LevelType lvType; @@ -53,20 +53,20 @@ public class ContainerLevelEmitter extends ContainerUpgradeable @GuiSync( 4 ) public YesNo cmType; - public ContainerLevelEmitter( final InventoryPlayer ip, final PartLevelEmitter te ) + public ContainerLevelEmitter( final PlayerInventory ip, final PartLevelEmitter te ) { super( ip, te ); this.lvlEmitter = te; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void setTextField( final GuiTextField level ) { this.textField = level; this.textField.setText( String.valueOf( this.EmitterValue ) ); } - public void setLevel( final long l, final EntityPlayer player ) + public void setLevel( final long l, final PlayerEntity player ) { this.lvlEmitter.setReportingValue( l ); this.EmitterValue = l; @@ -79,25 +79,25 @@ public class ContainerLevelEmitter extends ContainerUpgradeable if( this.availableUpgrades() > 0 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); } if( this.availableUpgrades() > 1 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); } if( this.availableUpgrades() > 2 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); } if( this.availableUpgrades() > 3 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getPlayerInventory() ) ) .setNotDraggable() ); } diff --git a/src/main/java/appeng/container/implementations/ContainerMAC.java b/src/main/java/appeng/container/implementations/ContainerMAC.java index 25fe1d9f5..1a558456e 100644 --- a/src/main/java/appeng/container/implementations/ContainerMAC.java +++ b/src/main/java/appeng/container/implementations/ContainerMAC.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; @@ -46,7 +46,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi @GuiSync( 4 ) public int craftProgress = 0; - public ContainerMAC( final InventoryPlayer ip, final TileMolecularAssembler te ) + public ContainerMAC( final PlayerInventory ip, final TileMolecularAssembler te ) { super( ip, te ); this.tma = te; @@ -103,26 +103,26 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi offY = 16; this.addSlotToContainer( - new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, this.getInventoryPlayer() ) ); + new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, this.getPlayerInventory() ) ); this.addSlotToContainer( new SlotOutput( mac, 9, offX, offY + 32, -1 ) ); offX = 122; offY = 17; final IItemHandler upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getPlayerInventory() ) ) .setNotDraggable() ); } diff --git a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java index b38646169..e62625432 100644 --- a/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java +++ b/src/main/java/appeng/container/implementations/ContainerMEMonitorable.java @@ -24,9 +24,9 @@ import java.nio.BufferOverflowException; import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -89,12 +89,12 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa private IConfigManager serverCM; private IGridNode networkNode; - public ContainerMEMonitorable( final InventoryPlayer ip, final ITerminalHost monitorable ) + public ContainerMEMonitorable( final PlayerInventory ip, final ITerminalHost monitorable ) { this( ip, monitorable, true ); } - protected ContainerMEMonitorable( final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory ) + protected ContainerMEMonitorable( final PlayerInventory ip, final ITerminalHost monitorable, final boolean bindInventory ) { super( ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null ); @@ -167,7 +167,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa for( int y = 0; y < 5; y++ ) { this.cellView[y] = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.VIEW_CELL, ( (IViewCellStorage) monitorable ) - .getViewCellStorage(), y, 206, y * 18 + 8, this.getInventoryPlayer() ); + .getViewCellStorage(), y, 206, y * 18 + 8, this.getPlayerInventory() ); this.cellView[y].setAllowEdit( this.canAccessViewCells ); this.addSlotToContainer( this.cellView[y] ); } @@ -204,11 +204,11 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa this.clientCM.putSetting( set, sideLocal ); for( final IContainerListener crafter : this.listeners ) { - if( crafter instanceof EntityPlayerMP ) + if( crafter instanceof PlayerEntityMP ) { try { - NetworkHandler.instance().sendTo( new PacketValueConfig( set.name(), sideLocal.name() ), (EntityPlayerMP) crafter ); + NetworkHandler.instance().sendTo( new PacketValueConfig( set.name(), sideLocal.name() ), (PlayerEntityMP) crafter ); } catch( final IOException e ) { @@ -247,9 +247,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa for( final Object c : this.listeners ) { - if( c instanceof EntityPlayer ) + if( c instanceof PlayerEntity ) { - NetworkHandler.instance().sendTo( piu, (EntityPlayerMP) c ); + NetworkHandler.instance().sendTo( piu, (PlayerEntityMP) c ); } } } @@ -330,7 +330,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa private void queueInventory( final IContainerListener c ) { - if( Platform.isServer() && c instanceof EntityPlayer && this.monitor != null ) + if( Platform.isServer() && c instanceof PlayerEntity && this.monitor != null ) { try { @@ -345,14 +345,14 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa } catch( final BufferOverflowException boe ) { - NetworkHandler.instance().sendTo( piu, (EntityPlayerMP) c ); + NetworkHandler.instance().sendTo( piu, (PlayerEntityMP) c ); piu = new PacketMEInventoryUpdate(); piu.appendItem( send ); } } - NetworkHandler.instance().sendTo( piu, (EntityPlayerMP) c ); + NetworkHandler.instance().sendTo( piu, (PlayerEntityMP) c ); } catch( final IOException e ) { @@ -373,7 +373,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa } @Override - public void onContainerClosed( final EntityPlayer player ) + public void onContainerClosed( final PlayerEntity player ) { super.onContainerClosed( player ); if( this.monitor != null ) diff --git a/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java b/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java index c5948f0f5..de4abed4a 100644 --- a/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java +++ b/src/main/java/appeng/container/implementations/ContainerMEPortableCell.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import appeng.api.config.Actionable; @@ -37,7 +37,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable private int ticks = 0; private final int slot; - public ContainerMEPortableCell( final InventoryPlayer ip, final IPortableCell monitorable ) + public ContainerMEPortableCell( final PlayerInventory ip, final IPortableCell monitorable ) { super( ip, monitorable, false ); if( monitorable instanceof IInventorySlotAware ) diff --git a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java index f188debd0..d22c74388 100644 --- a/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java +++ b/src/main/java/appeng/container/implementations/ContainerNetworkStatus.java @@ -21,9 +21,9 @@ package appeng.container.implementations; import java.io.IOException; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -59,7 +59,7 @@ public class ContainerNetworkStatus extends AEBaseContainer private IGrid network; private int delay = 40; - public ContainerNetworkStatus( final InventoryPlayer ip, final INetworkTool te ) + public ContainerNetworkStatus( final PlayerInventory ip, final INetworkTool te ) { super( ip, null, null ); final IGridHost host = te.getGridHost(); @@ -136,9 +136,9 @@ public class ContainerNetworkStatus extends AEBaseContainer for( final Object c : this.listeners ) { - if( c instanceof EntityPlayer ) + if( c instanceof PlayerEntity ) { - NetworkHandler.instance().sendTo( piu, (EntityPlayerMP) c ); + NetworkHandler.instance().sendTo( piu, (PlayerEntityMP) c ); } } } diff --git a/src/main/java/appeng/container/implementations/ContainerNetworkTool.java b/src/main/java/appeng/container/implementations/ContainerNetworkTool.java index 7004d7809..fc7486a9d 100644 --- a/src/main/java/appeng/container/implementations/ContainerNetworkTool.java +++ b/src/main/java/appeng/container/implementations/ContainerNetworkTool.java @@ -19,9 +19,9 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.implementations.guiobjects.INetworkTool; import appeng.container.AEBaseContainer; @@ -38,7 +38,7 @@ public class ContainerNetworkTool extends AEBaseContainer @GuiSync( 1 ) public boolean facadeMode; - public ContainerNetworkTool( final InventoryPlayer ip, final INetworkTool te ) + public ContainerNetworkTool( final PlayerInventory ip, final INetworkTool te ) { super( ip, null, null ); this.toolInv = te; @@ -50,7 +50,7 @@ public class ContainerNetworkTool extends AEBaseContainer for( int x = 0; x < 3; x++ ) { this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te - .getInventory(), y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.getInventoryPlayer() ) ) ); + .getInventory(), y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.getPlayerInventory() ) ) ); } } @@ -59,7 +59,7 @@ public class ContainerNetworkTool extends AEBaseContainer public void toggleFacadeMode() { - final NBTTagCompound data = Platform.openNbtData( this.toolInv.getItemStack() ); + final CompoundNBT data = Platform.openNbtData( this.toolInv.getItemStack() ); data.setBoolean( "hideFacades", !data.getBoolean( "hideFacades" ) ); this.detectAndSendChanges(); } @@ -90,7 +90,7 @@ public class ContainerNetworkTool extends AEBaseContainer if( this.isValidContainer() ) { - final NBTTagCompound data = Platform.openNbtData( currentItem ); + final CompoundNBT data = Platform.openNbtData( currentItem ); this.setFacadeMode( data.getBoolean( "hideFacades" ) ); } diff --git a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java index 8f94368c5..b5bd4904b 100644 --- a/src/main/java/appeng/container/implementations/ContainerPatternTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerPatternTerm.java @@ -23,9 +23,9 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import net.minecraft.inventory.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; @@ -35,7 +35,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; import net.minecraftforge.items.IItemHandler; @@ -90,7 +90,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA @GuiSync( 96 ) public boolean substitute = false; - public ContainerPatternTerm( final InventoryPlayer ip, final ITerminalHost monitorable ) + public ContainerPatternTerm( final PlayerInventory ip, final ITerminalHost monitorable ) { super( ip, monitorable, false ); this.patternTerminal = (PartPatternTerminal) monitorable; @@ -121,10 +121,10 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this - .getInventoryPlayer() ) ); + .getPlayerInventory() ) ); this.addSlotToContainer( this.patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, this - .getInventoryPlayer() ) ); + .getPlayerInventory() ) ); this.patternSlotOUT.setStackLimit( 1 ); @@ -246,7 +246,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA } // encode the slot. - final NBTTagCompound encodedValue = new NBTTagCompound(); + final CompoundNBT encodedValue = new CompoundNBT(); final NBTTagList tagIn = new NBTTagList(); final NBTTagList tagOut = new NBTTagList(); @@ -344,7 +344,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA private NBTBase createItemTag( final ItemStack i ) { - final NBTTagCompound c = new NBTTagCompound(); + final CompoundNBT c = new CompoundNBT(); if( !i.isEmpty() ) { @@ -390,14 +390,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA } final IAEItemStack extracted = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), out, this.getActionSource() ); - final EntityPlayer p = this.getPlayerInv().player; + final PlayerEntity p = this.getPlayerInv().player; if( extracted != null ) { inv.addItems( extracted.createItemStack() ); - if( p instanceof EntityPlayerMP ) + if( p instanceof PlayerEntityMP ) { - this.updateHeld( (EntityPlayerMP) p ); + this.updateHeld( (PlayerEntityMP) p ); } this.detectAndSendChanges(); return; @@ -455,9 +455,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA } inv.addItems( is ); - if( p instanceof EntityPlayerMP ) + if( p instanceof PlayerEntityMP ) { - this.updateHeld( (EntityPlayerMP) p ); + this.updateHeld( (PlayerEntityMP) p ); } this.detectAndSendChanges(); } @@ -519,9 +519,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA listener.sendSlotContents( this, slot.slotNumber, slot.getStack() ); } } - if( listener instanceof EntityPlayerMP ) + if( listener instanceof PlayerEntityMP ) { - ( (EntityPlayerMP) listener ).isChangingQuantityOnly = false; + ( (PlayerEntityMP) listener ).isChangingQuantityOnly = false; } } this.detectAndSendChanges(); @@ -554,7 +554,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA { if( name.equals( "player" ) ) { - return new PlayerInvWrapper( this.getInventoryPlayer() ); + return new PlayerInvWrapper( this.getPlayerInventory() ); } return this.getPatternTerminal().getInventoryByName( name ); } diff --git a/src/main/java/appeng/container/implementations/ContainerPriority.java b/src/main/java/appeng/container/implementations/ContainerPriority.java index e9d9112cc..9f0b5fdba 100644 --- a/src/main/java/appeng/container/implementations/ContainerPriority.java +++ b/src/main/java/appeng/container/implementations/ContainerPriority.java @@ -20,11 +20,11 @@ package appeng.container.implementations; import net.minecraft.client.gui.GuiTextField; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.tileentity.TileEntity; -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.config.SecurityPermissions; import appeng.api.parts.IPart; @@ -39,25 +39,25 @@ public class ContainerPriority extends AEBaseContainer private final IPriorityHost priHost; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private GuiTextField textField; @GuiSync( 2 ) public long PriorityValue = -1; - public ContainerPriority( final InventoryPlayer ip, final IPriorityHost te ) + public ContainerPriority( final PlayerInventory ip, final IPriorityHost te ) { super( ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) ); this.priHost = te; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void setTextField( final GuiTextField level ) { this.textField = level; this.textField.setText( String.valueOf( this.PriorityValue ) ); } - public void setPriority( final int newValue, final EntityPlayer player ) + public void setPriority( final int newValue, final PlayerEntity player ) { this.priHost.setPriority( newValue ); this.PriorityValue = newValue; diff --git a/src/main/java/appeng/container/implementations/ContainerQNB.java b/src/main/java/appeng/container/implementations/ContainerQNB.java index 876740ad1..5baa95601 100644 --- a/src/main/java/appeng/container/implementations/ContainerQNB.java +++ b/src/main/java/appeng/container/implementations/ContainerQNB.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.container.AEBaseContainer; import appeng.container.slot.SlotRestrictedInput; @@ -29,12 +29,12 @@ import appeng.tile.qnb.TileQuantumBridge; public class ContainerQNB extends AEBaseContainer { - public ContainerQNB( final InventoryPlayer ip, final TileQuantumBridge quantumBridge ) + public ContainerQNB( final PlayerInventory ip, final TileQuantumBridge quantumBridge ) { super( ip, quantumBridge, null ); this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge - .getInternalInventory(), 0, 80, 37, this.getInventoryPlayer() ) ).setStackLimit( 1 ) ); + .getInternalInventory(), 0, 80, 37, this.getPlayerInventory() ) ).setStackLimit( 1 ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } diff --git a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java index 85a64bd56..4d603c1da 100644 --- a/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java +++ b/src/main/java/appeng/container/implementations/ContainerQuartzKnife.java @@ -21,10 +21,10 @@ package appeng.container.implementations; import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.items.IItemHandler; @@ -46,7 +46,7 @@ public class ContainerQuartzKnife extends AEBaseContainer private final IItemHandler inSlot = new AppEngInternalInventory( null, 1, 1 ); private String myName = ""; - public ContainerQuartzKnife( final InventoryPlayer ip, final QuartzKnifeObj te ) + public ContainerQuartzKnife( final PlayerInventory ip, final QuartzKnifeObj te ) { super( ip, null, null ); this.toolInv = te; @@ -92,11 +92,11 @@ public class ContainerQuartzKnife extends AEBaseContainer } @Override - public void onContainerClosed( final EntityPlayer par1EntityPlayer ) + public void onContainerClosed( final PlayerEntity par1PlayerEntity ) { if( this.inSlot.getStackInSlot( 0 ) != null ) { - par1EntityPlayer.dropItem( this.inSlot.getStackInSlot( 0 ), false ); + par1PlayerEntity.dropItem( this.inSlot.getStackInSlot( 0 ), false ); } } @@ -123,7 +123,7 @@ public class ContainerQuartzKnife extends AEBaseContainer { return AEApi.instance().definitions().materials().namePress().maybeStack( 1 ).map( namePressStack -> { - final NBTTagCompound compound = Platform.openNbtData( namePressStack ); + final CompoundNBT compound = Platform.openNbtData( namePressStack ); compound.setString( "InscribeName", ContainerQuartzKnife.this.myName ); return namePressStack; diff --git a/src/main/java/appeng/container/implementations/ContainerSecurityStation.java b/src/main/java/appeng/container/implementations/ContainerSecurityStation.java index 158d6d4df..cc32e1c15 100644 --- a/src/main/java/appeng/container/implementations/ContainerSecurityStation.java +++ b/src/main/java/appeng/container/implementations/ContainerSecurityStation.java @@ -19,8 +19,8 @@ package appeng.container.implementations; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -54,7 +54,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements @GuiSync( 0 ) public int permissionMode = 0; - public ContainerSecurityStation( final InventoryPlayer ip, final ITerminalHost monitorable ) + public ContainerSecurityStation( final PlayerInventory ip, final ITerminalHost monitorable ) { super( ip, monitorable, false ); @@ -70,7 +70,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements this.bindPlayerInventory( ip, 0, 0 ); } - public void toggleSetting( final String value, final EntityPlayer player ) + public void toggleSetting( final String value, final PlayerEntity player ) { try { @@ -120,7 +120,7 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements } @Override - public void onContainerClosed( final EntityPlayer player ) + public void onContainerClosed( final PlayerEntity player ) { super.onContainerClosed( player ); diff --git a/src/main/java/appeng/container/implementations/ContainerSkyChest.java b/src/main/java/appeng/container/implementations/ContainerSkyChest.java index 9c838f346..411a3acd4 100644 --- a/src/main/java/appeng/container/implementations/ContainerSkyChest.java +++ b/src/main/java/appeng/container/implementations/ContainerSkyChest.java @@ -19,8 +19,8 @@ package appeng.container.implementations; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import appeng.container.AEBaseContainer; import appeng.container.slot.SlotNormal; @@ -32,7 +32,7 @@ public class ContainerSkyChest extends AEBaseContainer private final TileSkyChest chest; - public ContainerSkyChest( final InventoryPlayer ip, final TileSkyChest chest ) + public ContainerSkyChest( final PlayerInventory ip, final TileSkyChest chest ) { super( ip, chest, null ); this.chest = chest; @@ -51,9 +51,9 @@ public class ContainerSkyChest extends AEBaseContainer } @Override - public void onContainerClosed( final EntityPlayer par1EntityPlayer ) + public void onContainerClosed( final PlayerEntity par1PlayerEntity ) { - super.onContainerClosed( par1EntityPlayer ); - this.chest.closeInventory( par1EntityPlayer ); + super.onContainerClosed( par1PlayerEntity ); + this.chest.closeInventory( par1PlayerEntity ); } } diff --git a/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java b/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java index 0926e1c4b..70a268195 100644 --- a/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java +++ b/src/main/java/appeng/container/implementations/ContainerSpatialIOPort.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.SecurityPermissions; import appeng.api.networking.IGrid; @@ -56,7 +56,7 @@ public class ContainerSpatialIOPort extends AEBaseContainer @GuiSync( 33 ) public int zSize; - public ContainerSpatialIOPort( final InventoryPlayer ip, final TileSpatialIOPort spatialIOPort ) + public ContainerSpatialIOPort( final PlayerInventory ip, final TileSpatialIOPort spatialIOPort ) { super( ip, spatialIOPort, null ); @@ -66,7 +66,7 @@ public class ContainerSpatialIOPort extends AEBaseContainer } this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort - .getInternalInventory(), 0, 52, 48, this.getInventoryPlayer() ) ); + .getInternalInventory(), 0, 52, 48, this.getPlayerInventory() ) ); this.addSlotToContainer( new SlotOutput( spatialIOPort.getInternalInventory(), 1, 113, 48, SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS.IIcon ) ); diff --git a/src/main/java/appeng/container/implementations/ContainerStorageBus.java b/src/main/java/appeng/container/implementations/ContainerStorageBus.java index 5c6965a6a..da276db6e 100644 --- a/src/main/java/appeng/container/implementations/ContainerStorageBus.java +++ b/src/main/java/appeng/container/implementations/ContainerStorageBus.java @@ -21,7 +21,7 @@ package appeng.container.implementations; import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -57,7 +57,7 @@ public class ContainerStorageBus extends ContainerUpgradeable @GuiSync( 4 ) public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY; - public ContainerStorageBus( final InventoryPlayer ip, final PartStorageBus te ) + public ContainerStorageBus( final PlayerInventory ip, final PartStorageBus te ) { super( ip, te ); this.storageBus = te; @@ -92,19 +92,19 @@ public class ContainerStorageBus extends ContainerUpgradeable } final IItemHandler upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getPlayerInventory() ) ) .setNotDraggable() ); } diff --git a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java index e286904e4..4dd63b566 100644 --- a/src/main/java/appeng/container/implementations/ContainerUpgradeable.java +++ b/src/main/java/appeng/container/implementations/ContainerUpgradeable.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -66,7 +66,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl private int tbSlot; private NetworkToolViewer tbInventory; - public ContainerUpgradeable( final InventoryPlayer ip, final IUpgradeableHost te ) + public ContainerUpgradeable( final PlayerInventory ip, final IUpgradeableHost te ) { super( ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) ); this.upgradeable = te; @@ -114,7 +114,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl for( int u = 0; u < 3; u++ ) { this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.tbInventory - .getInternalInventory(), u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18, this.getInventoryPlayer() ) ).setPlayerSide() ); + .getInternalInventory(), u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18, this.getPlayerInventory() ) ).setPlayerSide() ); } } } @@ -163,25 +163,25 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl if( this.availableUpgrades() > 0 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); } if( this.availableUpgrades() > 1 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); } if( this.availableUpgrades() > 2 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); } if( this.availableUpgrades() > 3 ) { this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getPlayerInventory() ) ) .setNotDraggable() ); } } diff --git a/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java b/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java index 30c51ac98..13427691d 100644 --- a/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java +++ b/src/main/java/appeng/container/implementations/ContainerVibrationChamber.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.container.AEBaseContainer; import appeng.container.guisync.GuiSync; @@ -37,13 +37,13 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr @GuiSync( 1 ) public int remainingBurnTime = 0; - public ContainerVibrationChamber( final InventoryPlayer ip, final TileVibrationChamber vibrationChamber ) + public ContainerVibrationChamber( final PlayerInventory ip, final TileVibrationChamber vibrationChamber ) { super( ip, vibrationChamber, null ); this.vibrationChamber = vibrationChamber; this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber.getInternalInventory(), 0, 80, 37, this - .getInventoryPlayer() ) ); + .getPlayerInventory() ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } diff --git a/src/main/java/appeng/container/implementations/ContainerWireless.java b/src/main/java/appeng/container/implementations/ContainerWireless.java index babe4d180..06297654f 100644 --- a/src/main/java/appeng/container/implementations/ContainerWireless.java +++ b/src/main/java/appeng/container/implementations/ContainerWireless.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.container.AEBaseContainer; import appeng.container.guisync.GuiSync; @@ -38,13 +38,13 @@ public class ContainerWireless extends AEBaseContainer @GuiSync( 2 ) public long drain = 0; - public ContainerWireless( final InventoryPlayer ip, final TileWireless te ) + public ContainerWireless( final PlayerInventory ip, final TileWireless te ) { super( ip, te, null ); this.wirelessTerminal = te; this.addSlotToContainer( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal - .getInternalInventory(), 0, 80, 47, this.getInventoryPlayer() ) ); + .getInternalInventory(), 0, 80, 47, this.getPlayerInventory() ) ); this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 ); } diff --git a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java index ee97cdc99..83b7a0c28 100644 --- a/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java +++ b/src/main/java/appeng/container/implementations/ContainerWirelessTerm.java @@ -19,7 +19,7 @@ package appeng.container.implementations; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.core.AEConfig; import appeng.core.localization.PlayerMessages; @@ -32,7 +32,7 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell private final WirelessTerminalGuiObject wirelessTerminalGUIObject; - public ContainerWirelessTerm( final InventoryPlayer ip, final WirelessTerminalGuiObject gui ) + public ContainerWirelessTerm( final PlayerInventory ip, final WirelessTerminalGuiObject gui ) { super( ip, gui ); this.wirelessTerminalGUIObject = gui; diff --git a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java index b0e93cdff..19681086d 100644 --- a/src/main/java/appeng/container/slot/AppEngCraftingSlot.java +++ b/src/main/java/appeng/container/slot/AppEngCraftingSlot.java @@ -19,7 +19,7 @@ package appeng.container.slot; -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.item.crafting.CraftingManager; @@ -42,17 +42,17 @@ public class AppEngCraftingSlot extends AppEngSlot /** * The player that is using the GUI where this slot resides. */ - private final EntityPlayer thePlayer; + private final PlayerEntity thePlayer; /** * The number of items that have been crafted so far. Gets passed to ItemStack.onCrafting before being reset. */ private int amountCrafted; - public AppEngCraftingSlot( final EntityPlayer par1EntityPlayer, final IItemHandler par2IInventory, final IItemHandler par3IInventory, final int par4, final int par5, final int par6 ) + public AppEngCraftingSlot( final PlayerEntity par1PlayerEntity, final IItemHandler par2IInventory, final IItemHandler par3IInventory, final int par4, final int par5, final int par6 ) { super( par3IInventory, par4, par5, par6 ); - this.thePlayer = par1EntityPlayer; + this.thePlayer = par1PlayerEntity; this.craftMatrix = par2IInventory; } @@ -138,7 +138,7 @@ public class AppEngCraftingSlot extends AppEngSlot } @Override - public ItemStack onTake( final EntityPlayer playerIn, final ItemStack stack ) + public ItemStack onTake( final PlayerEntity playerIn, final ItemStack stack ) { net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent( playerIn, stack, new WrapperInvItemHandler( this.craftMatrix ) ); this.onCrafting( stack ); diff --git a/src/main/java/appeng/container/slot/AppEngSlot.java b/src/main/java/appeng/container/slot/AppEngSlot.java index 4992a31d4..15255109a 100644 --- a/src/main/java/appeng/container/slot/AppEngSlot.java +++ b/src/main/java/appeng/container/slot/AppEngSlot.java @@ -21,13 +21,13 @@ package appeng.container.slot; import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryBasic; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -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.container.AEBaseContainer; @@ -153,7 +153,7 @@ public class AppEngSlot extends Slot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { if( this.isSlotEnabled() ) { @@ -176,7 +176,7 @@ public class AppEngSlot extends Slot } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public boolean isEnabled() { return this.isSlotEnabled(); diff --git a/src/main/java/appeng/container/slot/NullSlot.java b/src/main/java/appeng/container/slot/NullSlot.java index e489b8385..772252fbd 100644 --- a/src/main/java/appeng/container/slot/NullSlot.java +++ b/src/main/java/appeng/container/slot/NullSlot.java @@ -21,7 +21,7 @@ package appeng.container.slot; import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -42,7 +42,7 @@ public class NullSlot extends Slot } @Override - public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) + public ItemStack onTake( final PlayerEntity par1PlayerEntity, final ItemStack par2ItemStack ) { return par2ItemStack; } @@ -91,7 +91,7 @@ public class NullSlot extends Slot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java b/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java index c82406bd6..548bab895 100644 --- a/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java +++ b/src/main/java/appeng/container/slot/OptionalSlotRestrictedInput.java @@ -19,7 +19,7 @@ package appeng.container.slot; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.IItemHandler; @@ -29,7 +29,7 @@ public class OptionalSlotRestrictedInput extends SlotRestrictedInput private final int groupNum; private final IOptionalSlotHost host; - public OptionalSlotRestrictedInput( final PlacableItemType valid, final IItemHandler i, final IOptionalSlotHost host, final int slotIndex, final int x, final int y, final int grpNum, final InventoryPlayer invPlayer ) + public OptionalSlotRestrictedInput( final PlacableItemType valid, final IItemHandler i, final IOptionalSlotHost host, final int slotIndex, final int x, final int y, final int grpNum, final PlayerInventory invPlayer ) { super( valid, i, slotIndex, x, y, invPlayer ); this.groupNum = grpNum; diff --git a/src/main/java/appeng/container/slot/SlotCraftingTerm.java b/src/main/java/appeng/container/slot/SlotCraftingTerm.java index e072e13d5..ddd85490a 100644 --- a/src/main/java/appeng/container/slot/SlotCraftingTerm.java +++ b/src/main/java/appeng/container/slot/SlotCraftingTerm.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -68,7 +68,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot private final IStorageMonitorable storage; private final IContainerCraftingPacket container; - public SlotCraftingTerm( final EntityPlayer player, final IActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IContainerCraftingPacket ccp ) + public SlotCraftingTerm( final PlayerEntity player, final IActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IContainerCraftingPacket ccp ) { super( player, cMatrix, output, 0, x, y ); this.energySrc = energySrc; @@ -85,18 +85,18 @@ public class SlotCraftingTerm extends AppEngCraftingSlot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } @Override - public ItemStack onTake( final EntityPlayer p, final ItemStack is ) + public ItemStack onTake( final PlayerEntity p, final ItemStack is ) { return is; } - public void doClick( final InventoryAction action, final EntityPlayer who ) + public void doClick( final InventoryAction action, final PlayerEntity who ) { if( this.getStack().isEmpty() ) { @@ -199,7 +199,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot return maxTimesToCraft; } - private ItemStack craftItem( final EntityPlayer p, final ItemStack request, final IMEMonitor inv, final IItemList all ) + private ItemStack craftItem( final PlayerEntity p, final ItemStack request, final IMEMonitor inv, final IItemList all ) { // update crafting matrix... ItemStack is = this.getStack(); @@ -281,17 +281,17 @@ public class SlotCraftingTerm extends AppEngCraftingSlot return ItemStack.EMPTY; } - private boolean preCraft( final EntityPlayer p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) + private boolean preCraft( final PlayerEntity p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) { return true; } - private void makeItem( final EntityPlayer p, final ItemStack is ) + private void makeItem( final PlayerEntity p, final ItemStack is ) { super.onTake( p, is ); } - private void postCraft( final EntityPlayer p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) + private void postCraft( final PlayerEntity p, final IMEMonitor inv, final ItemStack[] set, final ItemStack result ) { final List drops = new ArrayList<>(); diff --git a/src/main/java/appeng/container/slot/SlotDisabled.java b/src/main/java/appeng/container/slot/SlotDisabled.java index c57c086f6..46c37b1eb 100644 --- a/src/main/java/appeng/container/slot/SlotDisabled.java +++ b/src/main/java/appeng/container/slot/SlotDisabled.java @@ -19,7 +19,7 @@ package appeng.container.slot; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -39,7 +39,7 @@ public class SlotDisabled extends AppEngSlot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/container/slot/SlotFake.java b/src/main/java/appeng/container/slot/SlotFake.java index 8abe0d2e9..e6c8c0002 100644 --- a/src/main/java/appeng/container/slot/SlotFake.java +++ b/src/main/java/appeng/container/slot/SlotFake.java @@ -19,7 +19,7 @@ package appeng.container.slot; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -33,7 +33,7 @@ public class SlotFake extends AppEngSlot } @Override - public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack ) + public ItemStack onTake( final PlayerEntity par1PlayerEntity, final ItemStack par2ItemStack ) { return par2ItemStack; } @@ -62,7 +62,7 @@ public class SlotFake extends AppEngSlot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/container/slot/SlotInaccessible.java b/src/main/java/appeng/container/slot/SlotInaccessible.java index e509f8ee2..3776ade38 100644 --- a/src/main/java/appeng/container/slot/SlotInaccessible.java +++ b/src/main/java/appeng/container/slot/SlotInaccessible.java @@ -19,7 +19,7 @@ package appeng.container.slot; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -48,7 +48,7 @@ public class SlotInaccessible extends AppEngSlot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return false; } diff --git a/src/main/java/appeng/container/slot/SlotPatternTerm.java b/src/main/java/appeng/container/slot/SlotPatternTerm.java index bdd6b60da..d4749057f 100644 --- a/src/main/java/appeng/container/slot/SlotPatternTerm.java +++ b/src/main/java/appeng/container/slot/SlotPatternTerm.java @@ -21,7 +21,7 @@ package appeng.container.slot; import java.io.IOException; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -41,7 +41,7 @@ public class SlotPatternTerm extends SlotCraftingTerm private final int groupNum; private final IOptionalSlotHost host; - public SlotPatternTerm( final EntityPlayer player, final IActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber, final IContainerCraftingPacket c ) + public SlotPatternTerm( final PlayerEntity player, final IActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IItemHandler cMatrix, final IItemHandler secondMatrix, final IItemHandler output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber, final IContainerCraftingPacket c ) { super( player, mySrc, energySrc, storage, cMatrix, secondMatrix, output, x, y, c ); diff --git a/src/main/java/appeng/container/slot/SlotRestrictedInput.java b/src/main/java/appeng/container/slot/SlotRestrictedInput.java index 420552dd2..3013020db 100644 --- a/src/main/java/appeng/container/slot/SlotRestrictedInput.java +++ b/src/main/java/appeng/container/slot/SlotRestrictedInput.java @@ -19,9 +19,9 @@ package appeng.container.slot; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.init.Items; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.item.Items; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityFurnace; @@ -55,11 +55,11 @@ public class SlotRestrictedInput extends AppEngSlot { private final PlacableItemType which; - private final InventoryPlayer p; + private final PlayerInventory p; private boolean allowEdit = true; private int stackLimit = -1; - public SlotRestrictedInput( final PlacableItemType valid, final IItemHandler i, final int slotIndex, final int x, final int y, final InventoryPlayer p ) + public SlotRestrictedInput( final PlacableItemType valid, final IItemHandler i, final int slotIndex, final int x, final int y, final PlayerInventory p ) { super( i, slotIndex, x, y ); this.which = valid; @@ -234,7 +234,7 @@ public class SlotRestrictedInput extends AppEngSlot } @Override - public boolean canTakeStack( final EntityPlayer par1EntityPlayer ) + public boolean canTakeStack( final PlayerEntity par1PlayerEntity ) { return this.isAllowEdit(); } diff --git a/src/main/java/appeng/core/CommonHelper.java b/src/main/java/appeng/core/CommonHelper.java index bb0322af9..e9b87189b 100644 --- a/src/main/java/appeng/core/CommonHelper.java +++ b/src/main/java/appeng/core/CommonHelper.java @@ -24,7 +24,7 @@ import java.util.Random; import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; @@ -47,9 +47,9 @@ public abstract class CommonHelper public abstract void bindTileEntitySpecialRenderer( Class tile, AEBaseBlock blk ); - public abstract List getPlayers(); + public abstract List getPlayers(); - public abstract void sendToAllNearExcept( EntityPlayer p, double x, double y, double z, double dist, World w, AppEngPacket packet ); + public abstract void sendToAllNearExcept( PlayerEntity p, double x, double y, double z, double dist, World w, AppEngPacket packet ); public abstract void spawnEffect( EffectType effect, World world, double posX, double posY, double posZ, Object extra ); @@ -63,7 +63,7 @@ public abstract class CommonHelper public abstract void triggerUpdates(); - public abstract void updateRenderMode( EntityPlayer player ); + public abstract void updateRenderMode( PlayerEntity player ); public abstract boolean isKeyPressed( @Nonnull final ActionKey key ); diff --git a/src/main/java/appeng/core/CreativeTab.java b/src/main/java/appeng/core/CreativeTab.java index 34fd4a036..0f676b647 100644 --- a/src/main/java/appeng/core/CreativeTab.java +++ b/src/main/java/appeng/core/CreativeTab.java @@ -21,8 +21,7 @@ package appeng.core; import java.util.Optional; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -33,49 +32,45 @@ import appeng.api.definitions.IItems; import appeng.api.definitions.IMaterials; -public final class CreativeTab extends CreativeTabs +public final class CreativeTab { - public static CreativeTab instance = null; - - public CreativeTab() - { - super( "appliedenergistics2" ); - } + public static ItemGroup instance = null; static void init() { - instance = new CreativeTab(); - } - - @Override - public ItemStack getTabIconItem() - { - return this.getIconItemStack(); - } - - @Override - public ItemStack getIconItemStack() - { - final IDefinitions definitions = AEApi.instance().definitions(); - final IBlocks blocks = definitions.blocks(); - final IItems items = definitions.items(); - final IMaterials materials = definitions.materials(); - - return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluixBlock(), items.cell1k(), items.networkTool(), - materials.fluixCrystal(), materials.certusQuartzCrystal(), materials.skyDust() ); - } - - private ItemStack findFirst( final IItemDefinition... choices ) - { - for( final IItemDefinition definition : choices ) + instance = new ItemGroup( 11, "appliedenergistics2" ) { - Optional maybeIs = definition.maybeStack( 1 ); - if( maybeIs.isPresent() ) - { - return maybeIs.get(); - } - } - return new ItemStack( Blocks.CHEST ); + @Override + public ItemStack createIcon() + { + return this.getIconItemStack(); + } + + private ItemStack getIconItemStack() + { + final IDefinitions definitions = AEApi.instance().definitions(); + final IBlocks blocks = definitions.blocks(); + final IItems items = definitions.items(); + final IMaterials materials = definitions.materials(); + + return this.findFirst( blocks.controller(), blocks.chest(), blocks.cellWorkbench(), blocks.fluixBlock(), items.cell1k(), items.networkTool(), + materials.fluixCrystal(), materials.certusQuartzCrystal(), materials.skyDust() ); + } + + private ItemStack findFirst( final IItemDefinition... choices ) + { + for( final IItemDefinition definition : choices ) + { + Optional maybeIs = definition.maybeStack( 1 ); + if( maybeIs.isPresent() ) + { + return maybeIs.get(); + } + } + + return new ItemStack( net.minecraft.block.Blocks.CHEST ); + } + }; } } \ No newline at end of file diff --git a/src/main/java/appeng/core/CreativeTabFacade.java b/src/main/java/appeng/core/CreativeTabFacade.java index a8dd45fec..ab59c5fd6 100644 --- a/src/main/java/appeng/core/CreativeTabFacade.java +++ b/src/main/java/appeng/core/CreativeTabFacade.java @@ -21,8 +21,8 @@ package appeng.core; import java.util.Optional; +import net.minecraft.block.Blocks; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index 20f4dd98a..f25b97fb8 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -34,30 +34,25 @@ import net.minecraft.advancements.ICriterionInstance; import net.minecraft.advancements.ICriterionTrigger; import net.minecraft.block.Block; import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.IStateMapper; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.DimensionType; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; +import net.minecraft.world.dimension.DimensionType; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.EntityEntry; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.ReflectionHelper; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.registries.IForgeRegistry; import appeng.api.config.Upgrades; @@ -84,7 +79,6 @@ import appeng.bootstrap.components.IEntityRegistrationComponent; import appeng.bootstrap.components.IInitComponent; import appeng.bootstrap.components.IItemRegistrationComponent; import appeng.bootstrap.components.IModelRegistrationComponent; -import appeng.bootstrap.components.IOreDictComponent; import appeng.bootstrap.components.IPostInitComponent; import appeng.bootstrap.components.IPreInitComponent; import appeng.bootstrap.components.IRecipeRegistrationComponent; @@ -102,10 +96,7 @@ import appeng.core.stats.Stats; import appeng.core.worlddata.SpatialDimensionManager; import appeng.fluids.registries.BasicFluidCellGuiHandler; import appeng.hooks.TickHandler; -import appeng.items.materials.ItemMaterial; import appeng.items.parts.ItemFacade; -import appeng.items.parts.ItemPart; -import appeng.loot.ChestLoot; import appeng.me.cache.CraftingGridCache; import appeng.me.cache.EnergyGridCache; import appeng.me.cache.GridStorageCache; @@ -222,11 +213,6 @@ final class Registration MinecraftForge.EVENT_BUS.register( new PartPlacement() ); - if( AEConfig.instance().isFeatureEnabled( AEFeature.CHEST_LOOT ) ) - { - MinecraftForge.EVENT_BUS.register( new ChestLoot() ); - } - final IGridCacheRegistry gcr = registries.gridCache(); gcr.registerGridCache( ITickManager.class, TickManagerCache.class ); gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class ); @@ -262,13 +248,13 @@ final class Registration } @SubscribeEvent - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void modelRegistryEvent( ModelRegistryEvent event ) { final ApiDefinitions definitions = Api.INSTANCE.definitions(); final IModelRegistry registry = new ModelLoaderWrapper(); - final Side side = FMLCommonHandler.instance().getEffectiveSide(); - definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( side, registry ) ); + final Dist dist = FMLEnvironment.dist; + definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( dist, registry ) ); } @SubscribeEvent @@ -276,8 +262,8 @@ final class Registration { final IForgeRegistry registry = event.getRegistry(); final ApiDefinitions definitions = Api.INSTANCE.definitions(); - final Side side = FMLCommonHandler.instance().getEffectiveSide(); - definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( side, registry ) ); + final Dist dist = FMLEnvironment.dist; + definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( dist, registry ) ); } @SubscribeEvent @@ -285,12 +271,8 @@ final class Registration { final IForgeRegistry registry = event.getRegistry(); final ApiDefinitions definitions = Api.INSTANCE.definitions(); - final Side side = FMLCommonHandler.instance().getEffectiveSide(); - definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( side, registry ) ); - // register oredicts - definitions.getRegistry().getBootstrapComponents( IOreDictComponent.class ).forEachRemaining( b -> b.oreRegistration( side ) ); - ItemMaterial.instance.registerOredicts(); - ItemPart.instance.registerOreDicts(); + final Dist dist = FMLEnvironment.dist; + definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( dist, registry ) ); } @SubscribeEvent @@ -300,7 +282,7 @@ final class Registration final Api api = Api.INSTANCE; final ApiDefinitions definitions = api.definitions(); - final Side side = FMLCommonHandler.instance().getEffectiveSide(); + final Dist dist = FMLCommonHandler.instance().getEffectiveSide(); if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) ) { @@ -474,32 +456,30 @@ final class Registration /* * You can't move bed rock. */ - mr.blacklistBlock( net.minecraft.init.Blocks.BEDROCK ); + mr.blacklistBlock( net.minecraft.block.Blocks.BEDROCK ); /* * White List Vanilla... */ - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBanner.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBeacon.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityBrewingStand.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityChest.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityCommandBlock.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityComparator.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDaylightDetector.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDispenser.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityDropper.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnchantmentTable.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEnderChest.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityEndPortal.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFlowerPot.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityFurnace.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityHopper.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityMobSpawner.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityNote.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityPiston.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntityShulkerBox.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySign.class ); - mr.whiteListTileEntity( net.minecraft.tileentity.TileEntitySkull.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.BannerTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.BeaconTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.BrewingStandTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.ChestTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.CommandBlockTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.ComparatorTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.DaylightDetectorTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.DispenserTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.DropperTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.EnchantingTableTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.EnderChestTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.EndPortalTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.FurnaceTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.HopperTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.MobSpawnerTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.PistonTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.ShulkerBoxTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.SignTileEntity.class ); + mr.whiteListTileEntity( net.minecraft.tileentity.SkullTileEntity.class ); /* * Whitelist AE2 diff --git a/src/main/java/appeng/core/api/ApiPart.java b/src/main/java/appeng/core/api/ApiPart.java index 1805edec1..7c87af888 100644 --- a/src/main/java/appeng/core/api/ApiPart.java +++ b/src/main/java/appeng/core/api/ApiPart.java @@ -19,316 +19,25 @@ package appeng.core.api; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableList; - -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.commons.Remapper; -import org.objectweb.asm.commons.RemappingClassAdapter; -import org.objectweb.asm.tree.AbstractInsnNode; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodInsnNode; -import org.objectweb.asm.tree.MethodNode; - -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.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.math.BlockPos; import net.minecraft.world.World; import appeng.api.parts.CableRenderMode; import appeng.api.parts.IPartHelper; -import appeng.api.parts.LayerBase; -import appeng.core.AELog; import appeng.core.AppEng; import appeng.parts.PartPlacement; -import appeng.tile.AEBaseTile; -import appeng.tile.networking.TileCableBus; public class ApiPart implements IPartHelper { - private final LoadingCache> cache = CacheBuilder.newBuilder() - .build( new CacheLoader>() - { - @Override - public Class load( CacheKey key ) throws Exception - { - return ApiPart.this.generateCombinedClass( key ); - } - } ); - - private final Map, String> interfaces2Layer = new HashMap<>(); - private final List desc = new ArrayList<>(); - - /** - * Conceptually this method will build a new class hierarchy that is rooted at the given base class, and includes a - * chain of all registered layers. - *

- * To accomplish this, it takes the first registered layer, replaces it's inheritance from LayerBase with an - * inheritance from the given baseClass, - * and uses the resulting class as the parent class for the next registered layer, for which it repeats this - * process. This process is then repeated - * until a class hierarchy of all layers is formed. While janking out the inheritance from LayerBase, it'll make - * also sure that calls to that - * classes method will instead be forwarded to the superclass that was inserted as part of the described process. - *

- * Example: If layers A and B are registered, and TileCableBus is passed in as the baseClass, a synthetic class - * A_B_TileCableBus should be returned, - * which has A_B_TileCableBus -extends-> B_TileCableBus -extends-> TileCableBus as it's class hierarchy, where - * A_B_TileCableBus has been generated - * from A, and B_TileCableBus has been generated from B. - */ - public Class getCombinedInstance( final Class baseClass ) - { - if( this.desc.isEmpty() ) - { - // No layers registered... - return baseClass; - } - - return this.cache.getUnchecked( new CacheKey( baseClass, this.desc ) ); - } - - private Class generateCombinedClass( CacheKey cacheKey ) - { - final Class parentClass; - - // Get the list of interfaces that still need to be implemented beyond the current one - List remainingInterfaces = cacheKey.getInterfaces().subList( 1, cacheKey.getInterfaces().size() ); - - // We are not at the root of the class hierarchy yet - if( !remainingInterfaces.isEmpty() ) - { - CacheKey parentKey = new CacheKey( cacheKey.getBaseClass(), remainingInterfaces ); - parentClass = this.cache.getUnchecked( parentKey ); - } - else - { - parentClass = cacheKey.getBaseClass(); - } - - // Which interface should be implemented in this layer? - String interfaceName = cacheKey.getInterfaces().get( 0 ); - - try - { - // This is the particular interface that this layer was registered for. Loading the class may fail if i.e. - // an API is broken or not present - // and in this case, the layer will be skipped! - Class interfaceClass = Class.forName( interfaceName ); - String layerImpl = this.interfaces2Layer.get( interfaceClass ); - - return this.getClassByDesc( parentClass, layerImpl ); - } - catch( final Throwable t ) - { - AELog.warn( "Error loading " + interfaceName ); - AELog.debug( t ); - return parentClass; - } - - } - - @SuppressWarnings( "unchecked" ) - private Class getClassByDesc( Class baseClass, final String next ) - { - final ClassWriter cw = new ClassWriter( ClassWriter.COMPUTE_MAXS ); - final ClassNode n = this.getReader( next ); - final String originalName = n.name; - - try - { - n.name = n.name + '_' + baseClass.getSimpleName(); - n.superName = baseClass.getName().replace( '.', '/' ); - } - catch( final Throwable t ) - { - AELog.debug( t ); - } - - for( final MethodNode mn : n.methods ) - { - final Iterator i = mn.instructions.iterator(); - while( i.hasNext() ) - { - this.processNode( i.next(), n.superName ); - } - } - - final DefaultPackageClassNameRemapper remapper = new DefaultPackageClassNameRemapper(); - remapper.inputOutput.put( "appeng/api/parts/LayerBase", n.superName ); - remapper.inputOutput.put( originalName, n.name ); - n.accept( new RemappingClassAdapter( cw, remapper ) ); - // n.accept( cw ); - - // n.accept( new TraceClassVisitor( new PrintWriter( System.out ) ) ); - final byte[] byteArray = cw.toByteArray(); - final int size = byteArray.length; - final Class clazz = this.loadClass( n.name.replace( "/", "." ), byteArray ); - - try - { - final Object fish = clazz.newInstance(); - - boolean hasError = false; - - if( !baseClass.isInstance( fish ) ) - { - hasError = true; - AELog.error( "Error, Expected layer to implement " + baseClass + " did not." ); - } - - if( fish instanceof LayerBase ) - { - hasError = true; - AELog.error( "Error, Expected layer to NOT implement LayerBase but it DID." ); - } - - if( !( fish instanceof TileCableBus ) ) - { - hasError = true; - AELog.error( "Error, Expected layer to implement TileCableBus did not." ); - } - - if( !( fish instanceof TileEntity ) ) - { - hasError = true; - AELog.error( "Error, Expected layer to implement TileEntity did not." ); - } - - if( !hasError ) - { - AELog.info( "Layer: " + n.name + " loaded successfully - " + size + " bytes" ); - } - } - catch( final Throwable t ) - { - AELog.error( "Layer: " + n.name + " Failed." ); - AELog.debug( t ); - } - - return clazz; - } - - private ClassNode getReader( final String name ) - { - final String path = '/' + name.replace( ".", "/" ) + ".class"; - final InputStream is = this.getClass().getResourceAsStream( path ); - try - { - final ClassReader cr = new ClassReader( is ); - - final ClassNode cn = new ClassNode(); - cr.accept( cn, ClassReader.EXPAND_FRAMES ); - - return cn; - } - catch( final IOException e ) - { - throw new IllegalStateException( "Error loading " + name, e ); - } - } - - private void processNode( final AbstractInsnNode next, final String nePar ) - { - if( next instanceof MethodInsnNode ) - { - final MethodInsnNode min = (MethodInsnNode) next; - if( min.owner.equals( "appeng/api/parts/LayerBase" ) ) - { - min.owner = nePar; - } - } - } - - private Class loadClass( final String name, byte[] b ) - { - // override classDefine (as it is protected) and define the class. - Class clazz = null; - try - { - final ClassLoader loader = this.getClass().getClassLoader();// ClassLoader.getSystemClassLoader(); - final Class root = ClassLoader.class; - final Class cls = loader.getClass(); - final Method defineClassMethod = root.getDeclaredMethod( "defineClass", String.class, byte[].class, int.class, int.class ); - final Method runTransformersMethod = cls.getDeclaredMethod( "runTransformers", String.class, String.class, byte[].class ); - - runTransformersMethod.setAccessible( true ); - defineClassMethod.setAccessible( true ); - try - { - final Object[] argsA = { - name, - name, - b - }; - b = (byte[]) runTransformersMethod.invoke( loader, argsA ); - - final Object[] args = { - name, - b, - 0, - b.length - }; - clazz = (Class) defineClassMethod.invoke( loader, args ); - } - finally - { - runTransformersMethod.setAccessible( false ); - defineClassMethod.setAccessible( false ); - } - } - catch( final Exception e ) - { - AELog.debug( e ); - throw new IllegalStateException( "Unable to manage part API.", e ); - } - return clazz; - } - @Override - public boolean registerNewLayer( final String layer, final String layerInterface ) - { - try - { - final Class layerInterfaceClass = Class.forName( layerInterface ); - if( this.interfaces2Layer.get( layerInterfaceClass ) == null ) - { - this.interfaces2Layer.put( layerInterfaceClass, layer ); - this.desc.add( layerInterface ); - return true; - } - else - { - AELog.info( "Layer " + layer + " not registered, " + layerInterface + " already has a layer." ); - } - } - catch( final Throwable ignored ) - { - } - - return false; - } - - @Override - public EnumActionResult placeBus( final ItemStack is, final BlockPos pos, final EnumFacing side, final EntityPlayer player, final EnumHand hand, final World w ) + public ActionResult placeBus( final ItemStack is, final BlockPos pos, final Direction side, final PlayerEntity player, final Hand hand, final World w ) { return PartPlacement.place( is, pos, side, player, hand, w, PartPlacement.PlaceType.PLACE_ITEM, 0 ); } @@ -338,69 +47,4 @@ public class ApiPart implements IPartHelper { return AppEng.proxy.getRenderMode(); } - - private static class DefaultPackageClassNameRemapper extends Remapper - { - - private final HashMap inputOutput = new HashMap<>(); - - @Override - public String map( final String typeName ) - { - final String o = this.inputOutput.get( typeName ); - if( o == null ) - { - return typeName; - } - return o; - } - } - - private static class CacheKey - { - private final Class baseClass; - - private final List interfaces; - - private CacheKey( Class baseClass, List interfaces ) - { - this.baseClass = baseClass; - this.interfaces = ImmutableList.copyOf( interfaces ); - } - - private Class getBaseClass() - { - return this.baseClass; - } - - private List getInterfaces() - { - return this.interfaces; - } - - @Override - public boolean equals( Object o ) - { - if( this == o ) - { - return true; - } - if( o == null || this.getClass() != o.getClass() ) - { - return false; - } - - CacheKey cacheKey = (CacheKey) o; - - return this.baseClass.equals( cacheKey.baseClass ) && this.interfaces.equals( cacheKey.interfaces ); - } - - @Override - public int hashCode() - { - int result = this.baseClass.hashCode(); - result = 31 * result + this.interfaces.hashCode(); - return result; - } - } } diff --git a/src/main/java/appeng/core/api/ApiStorage.java b/src/main/java/appeng/core/api/ApiStorage.java index 3fa4b90c8..2a03abdd2 100644 --- a/src/main/java/appeng/core/api/ApiStorage.java +++ b/src/main/java/appeng/core/api/ApiStorage.java @@ -30,7 +30,8 @@ import com.google.common.collect.MutableClassToInstanceMap; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidUtil; @@ -100,7 +101,7 @@ public class ApiStorage implements IStorageHelper } @Override - public ICraftingLink loadCraftingLink( final NBTTagCompound data, final ICraftingRequester req ) + public ICraftingLink loadCraftingLink( final CompoundNBT data, final ICraftingRequester req ) { Preconditions.checkNotNull( data ); Preconditions.checkNotNull( req ); @@ -154,7 +155,7 @@ public class ApiStorage implements IStorageHelper } @Override - public IAEItemStack createFromNBT( NBTTagCompound nbt ) + public IAEItemStack createFromNBT( CompoundNBT nbt ) { Preconditions.checkNotNull( nbt ); return AEItemStack.fromNBT( nbt ); @@ -224,11 +225,10 @@ public class ApiStorage implements IStorageHelper } @Override - public IAEFluidStack createFromNBT( NBTTagCompound nbt ) + public IAEFluidStack createFromNBT( CompoundNBT nbt ) { Preconditions.checkNotNull( nbt ); return AEFluidStack.fromNBT( nbt ); } } - } diff --git a/src/main/java/appeng/core/api/IIMCProcessor.java b/src/main/java/appeng/core/api/IIMCProcessor.java index 84ddcf2bb..77e41ac02 100644 --- a/src/main/java/appeng/core/api/IIMCProcessor.java +++ b/src/main/java/appeng/core/api/IIMCProcessor.java @@ -18,9 +18,7 @@ package appeng.core.api; - -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; - +import net.minecraftforge.fml.InterModComms.IMCMessage; public interface IIMCProcessor { diff --git a/src/main/java/appeng/core/api/definitions/ApiBlocks.java b/src/main/java/appeng/core/api/definitions/ApiBlocks.java index b5eefa65b..ed4356ae5 100644 --- a/src/main/java/appeng/core/api/definitions/ApiBlocks.java +++ b/src/main/java/appeng/core/api/definitions/ApiBlocks.java @@ -23,22 +23,20 @@ import com.google.common.base.Verify; import net.minecraft.block.Block; import net.minecraft.block.BlockDispenser; -import net.minecraft.block.BlockSlab; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.ItemBlock; +import net.minecraft.block.SlabBlock; +import net.minecraft.client.renderer.model.ModelResourceLocation; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemSlab; -import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.common.registry.EntityEntryBuilder; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import net.minecraftforge.oredict.OreDictionary; import appeng.api.definitions.IBlockDefinition; import appeng.api.definitions.IBlocks; import appeng.api.definitions.IItemDefinition; import appeng.api.definitions.ITileDefinition; -import appeng.block.AEBaseItemBlockChargeable; +import appeng.block.AEBaseBlockItemChargeable; import appeng.block.crafting.BlockCraftingMonitor; import appeng.block.crafting.BlockCraftingStorage; import appeng.block.crafting.BlockCraftingUnit; @@ -95,7 +93,6 @@ import appeng.bootstrap.FeatureFactory; import appeng.bootstrap.IBlockRendering; import appeng.bootstrap.IItemRendering; import appeng.bootstrap.components.IEntityRegistrationComponent; -import appeng.bootstrap.components.IOreDictComponent; import appeng.bootstrap.components.IPostInitComponent; import appeng.bootstrap.components.IPreInitComponent; import appeng.bootstrap.definitions.TileEntityDefinition; @@ -117,6 +114,7 @@ import appeng.debug.TileEnergyGenerator; import appeng.debug.TileItemGen; import appeng.debug.TilePhantomNode; import appeng.decorative.slab.BlockSlabCommon; +import appeng.decorative.slab.CommonSlabBlock; import appeng.decorative.solid.BlockChargedQuartzOre; import appeng.decorative.solid.BlockChiseledQuartz; import appeng.decorative.solid.BlockFluix; @@ -252,16 +250,10 @@ public final class ApiBlocks implements IBlocks // this.quartzOre = new BlockDefinition( "ore.quartz", new OreQuartz() ); this.quartzOre = registry.block( "quartz_ore", BlockQuartzOre::new ) .features( AEFeature.CERTUS_ORE ) - .bootstrap( ( block, item ) -> (IOreDictComponent) side -> OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ) ) .build(); this.quartzOreCharged = registry.block( "charged_quartz_ore", BlockChargedQuartzOre::new ) .features( AEFeature.CERTUS_ORE, AEFeature.CHARGED_CERTUS_ORE ) .useCustomItemModel() - .bootstrap( ( block, item ) -> (IOreDictComponent) side -> - { - OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( block ) ); - OreDictionary.registerOre( "oreChargedCertusQuartz", new ItemStack( block ) ); - } ) .build(); this.matrixFrame = registry.block( "matrix_frame", BlockMatrixFrame::new ).features( AEFeature.SPATIAL_IO ).build(); @@ -276,7 +268,7 @@ public final class ApiBlocks implements IBlocks .rendering( new BlockRenderingCustomizer() { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.builtInModel( "models/block/builtin/quartz_glass", new GlassModel() ); @@ -349,7 +341,7 @@ public final class ApiBlocks implements IBlocks .rendering( new BlockRenderingCustomizer() { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.tesr( BlockCharger.createTesr() ); @@ -448,13 +440,13 @@ public final class ApiBlocks implements IBlocks .build(); this.energyCell = registry.block( "energy_cell", BlockEnergyCell::new ) .features( AEFeature.ENERGY_CELLS ) - .item( AEBaseItemBlockChargeable::new ) + .item( AEBaseBlockItemChargeable::new ) .tileEntity( new TileEntityDefinition( TileEnergyCell.class ) ) .rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "energy_cell" ) ) ) .build(); this.energyCellDense = registry.block( "dense_energy_cell", BlockDenseEnergyCell::new ) .features( AEFeature.ENERGY_CELLS, AEFeature.DENSE_ENERGY_CELLS ) - .item( AEBaseItemBlockChargeable::new ) + .item( AEBaseBlockItemChargeable::new ) .tileEntity( new TileEntityDefinition( TileDenseEnergyCell.class ) ) .rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "dense_energy_cell" ) ) ) .build(); @@ -591,17 +583,17 @@ public final class ApiBlocks implements IBlocks return new BlockDefinition( slabId, null, null ); } - BlockSlab slabBlock = (BlockSlab) slabDef.maybeBlock().get(); + SlabBlock slabBlock = (SlabBlock) slabDef.maybeBlock().get(); // Reigster the double slab variant as well - IBlockDefinition doubleSlabDef = registry.block( doubleSlabId, () -> new BlockSlabCommon.Double( slabBlock, block ) ) + IBlockDefinition doubleSlabDef = registry.block( doubleSlabId, () -> new CommonSlabBlock.Double( slabBlock, block ) ) .features( AEFeature.DECORATIVE_BLOCKS ) .disableItem() .build(); Verify.verify( doubleSlabDef.maybeBlock().isPresent() ); - BlockSlab doubleSlabBlock = (BlockSlab) doubleSlabDef.maybeBlock().get(); + SlabBlock doubleSlabBlock = (SlabBlock) doubleSlabDef.maybeBlock().get(); // Make the slab item IItemDefinition itemDef = registry.item( slabId, () -> new ItemSlab( slabBlock, slabBlock, doubleSlabBlock ) ) @@ -611,7 +603,7 @@ public final class ApiBlocks implements IBlocks Verify.verify( itemDef.maybeItem().isPresent() ); // Return a new composite block definition that combines the single slab block with the slab item - return new BlockDefinition( slabId, slabBlock, (ItemBlock) itemDef.maybeItem().get() ); + return new BlockDefinition( slabId, slabBlock, (BlockItem) itemDef.maybeItem().get() ); } private static IBlockDefinition makeStairs( String registryName, FeatureFactory registry, IBlockDefinition block ) @@ -621,7 +613,7 @@ public final class ApiBlocks implements IBlocks .rendering( new BlockRenderingCustomizer() { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { ModelResourceLocation model = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, registryName ), "facing=east,half=bottom,shape=straight" ); diff --git a/src/main/java/appeng/core/api/definitions/ApiMaterials.java b/src/main/java/appeng/core/api/definitions/ApiMaterials.java index 292848510..31cb865e6 100644 --- a/src/main/java/appeng/core/api/definitions/ApiMaterials.java +++ b/src/main/java/appeng/core/api/definitions/ApiMaterials.java @@ -24,8 +24,8 @@ import java.util.stream.Collectors; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.registry.EntityEntryBuilder; -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.definitions.IItemDefinition; import appeng.api.definitions.IMaterials; @@ -129,7 +129,7 @@ public final class ApiMaterials implements IMaterials .rendering( new ItemRenderingCustomizer() { @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IItemRendering rendering ) { rendering.meshDefinition( is -> materials.getTypeByStack( is ).getModel() ); diff --git a/src/main/java/appeng/core/api/imc/IMCBlackListSpatial.java b/src/main/java/appeng/core/api/imc/IMCBlackListSpatial.java deleted file mode 100644 index 984d7bed4..000000000 --- a/src/main/java/appeng/core/api/imc/IMCBlackListSpatial.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.core.api.imc; - - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; - -import appeng.api.AEApi; -import appeng.core.AELog; -import appeng.core.api.IIMCProcessor; - - -public class IMCBlackListSpatial implements IIMCProcessor -{ - - @Override - public void process( final IMCMessage m ) - { - - final ItemStack is = m.getItemStackValue(); - if( !is.isEmpty() ) - { - final Block blk = Block.getBlockFromItem( is.getItem() ); - if( blk != Blocks.AIR ) - { - AEApi.instance().registries().movable().blacklistBlock( blk ); - return; - } - } - - AELog.info( "Bad Block blacklisted by " + m.getSender() ); - } -} diff --git a/src/main/java/appeng/core/api/imc/IMCGrinder.java b/src/main/java/appeng/core/api/imc/IMCGrinder.java deleted file mode 100644 index 69a327647..000000000 --- a/src/main/java/appeng/core/api/imc/IMCGrinder.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -/* Example: - - NBTTagCompound msg = new NBTTagCompound(); - NBTTagCompound in = new NBTTagCompound(); - NBTTagCompound out = new NBTTagCompound(); - - new ItemStack( Blocks.iron_ore ).writeToNBT( in ); - new ItemStack( Items.iron_ingot ).writeToNBT( out ); - msg.setTag( "in", in ); - msg.setTag( "out", out ); - msg.setInteger( "turns", 8 ); - - FMLInterModComms.sendMessage( "appliedenergistics2", "add-grindable", msg ); - - -- or -- - - NBTTagCompound msg = new NBTTagCompound(); - NBTTagCompound in = new NBTTagCompound(); - NBTTagCompound out = new NBTTagCompound(); - NBTTagCompound optional = new NBTTagCompound(); - - new ItemStack( Blocks.iron_ore ).writeToNBT( in ); - new ItemStack( Items.iron_ingot ).writeToNBT( out ); - new ItemStack( Blocks.gravel ).writeToNBT( optional ); - msg.setTag( "in", in ); - msg.setTag( "out", out ); - msg.setTag( "optional", optional ); - msg.setFloat( "chance", 0.5 ); - msg.setInteger( "turns", 8 ); - - FMLInterModComms.sendMessage( "appliedenergistics2", "add-grindable", msg ); - - */ - -package appeng.core.api.imc; - - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; - -import appeng.api.AEApi; -import appeng.api.features.IGrinderRecipe; -import appeng.api.features.IGrinderRecipeBuilder; -import appeng.api.features.IGrinderRegistry; -import appeng.core.api.IIMCProcessor; - - -public class IMCGrinder implements IIMCProcessor -{ - @Override - public void process( final IMCMessage m ) - { - final NBTTagCompound msg = m.getNBTValue(); - final NBTTagCompound inTag = (NBTTagCompound) msg.getTag( "in" ); - final NBTTagCompound outTag = (NBTTagCompound) msg.getTag( "out" ); - - final ItemStack in = new ItemStack( inTag ); - final ItemStack out = new ItemStack( outTag ); - - final int turns = msg.getInteger( "turns" ); - - if( in.isEmpty() ) - { - throw new IllegalStateException( "invalid input" ); - } - - if( out.isEmpty() ) - { - throw new IllegalStateException( "invalid output" ); - } - - if( msg.hasKey( "optional" ) ) - { - final NBTTagCompound optionalTag = (NBTTagCompound) msg.getTag( "optional" ); - final ItemStack optional = new ItemStack( optionalTag ); - - if( optional.isEmpty() ) - { - throw new IllegalStateException( "invalid optional" ); - } - - final float chance = msg.getFloat( "chance" ); - final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder(); - final IGrinderRecipeBuilder builder = grinderRegistry.builder(); - final IGrinderRecipe grinderRecipe = builder.withInput( in ) - .withOutput( out ) - .withFirstOptional( optional, chance ) - .withTurns( turns ) - .build(); - - grinderRegistry.addRecipe( grinderRecipe ); - } - else - { - final IGrinderRegistry grinderRegistry = AEApi.instance().registries().grinder(); - final IGrinderRecipeBuilder builder = grinderRegistry.builder(); - final IGrinderRecipe grinderRecipe = builder.withInput( in ) - .withOutput( out ) - .withTurns( turns ) - .build(); - - grinderRegistry.addRecipe( grinderRecipe ); - } - } -} diff --git a/src/main/java/appeng/core/api/imc/IMCMatterCannon.java b/src/main/java/appeng/core/api/imc/IMCMatterCannon.java deleted file mode 100644 index cf81d9d47..000000000 --- a/src/main/java/appeng/core/api/imc/IMCMatterCannon.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -/* Example: - - NBTTagCompound msg = new NBTTagCompound(); - NBTTagCompound item = new NBTTagCompound(); - - new ItemStack( Blocks.anvil ).writeToNBT( item ); - msg.setTag( "item", item ); - msg.setDouble( "weight", 32.0 ); - - FMLInterModComms.sendMessage( "appliedenergistics2", "add-mattercannon-ammo", msg ); - - */ - -package appeng.core.api.imc; - - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; - -import appeng.api.AEApi; -import appeng.core.api.IIMCProcessor; - - -public class IMCMatterCannon implements IIMCProcessor -{ - - @Override - public void process( final IMCMessage m ) - { - final NBTTagCompound msg = m.getNBTValue(); - final NBTTagCompound item = (NBTTagCompound) msg.getTag( "item" ); - - final ItemStack ammo = new ItemStack( item ); - final double weight = msg.getDouble( "weight" ); - - if( ammo.isEmpty() ) - { - throw new IllegalStateException( "invalid item in message " + m ); - } - - AEApi.instance().registries().matterCannon().registerAmmo( ammo, weight ); - } -} diff --git a/src/main/java/appeng/core/api/imc/IMCP2PAttunement.java b/src/main/java/appeng/core/api/imc/IMCP2PAttunement.java deleted file mode 100644 index 870a71d43..000000000 --- a/src/main/java/appeng/core/api/imc/IMCP2PAttunement.java +++ /dev/null @@ -1,71 +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 . - */ - -/* Example: - - FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-me", new ItemStack( myBlockOrItem ) ); - FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-bc-power", new ItemStack( myBlockOrItem ) ); - FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-ic2-power", new ItemStack( myBlockOrItem ) ); - FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-redstone", new ItemStack( myBlockOrItem ) ); - FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-fluid", new ItemStack( myBlockOrItem ) ); - FMLInterModComms.sendMessage( "appliedenergistics2", "add-p2p-attunement-item", new ItemStack( myBlockOrItem ) ); - - */ - -package appeng.core.api.imc; - - -import java.util.Arrays; -import java.util.Locale; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; - -import appeng.api.AEApi; -import appeng.api.config.TunnelType; -import appeng.core.api.IIMCProcessor; - - -public class IMCP2PAttunement implements IIMCProcessor -{ - - @Override - public void process( final IMCMessage m ) - { - final String key = m.key.substring( "add-p2p-attunement-".length() ).replace( '-', '_' ).toUpperCase( Locale.ENGLISH ); - - final TunnelType type = TunnelType.valueOf( key ); - - if( type != null ) - { - final ItemStack is = m.getItemStackValue(); - if( !is.isEmpty() ) - { - AEApi.instance().registries().p2pTunnel().addNewAttunement( is, type ); - } - else - { - throw new IllegalStateException( "invalid item in message " + m ); - } - } - else - { - throw new IllegalStateException( "invalid type in message " + m + " is not contained in " + Arrays.toString( TunnelType.values() ) ); - } - } -} diff --git a/src/main/java/appeng/core/api/imc/IMCSpatial.java b/src/main/java/appeng/core/api/imc/IMCSpatial.java deleted file mode 100644 index 1a5cf0c31..000000000 --- a/src/main/java/appeng/core/api/imc/IMCSpatial.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -/* Example: - - FMLInterModComms.sendMessage( "appliedenergistics2", "whitelist-spatial", "mymod.tileentities.MyTileEntity" ); - - */ - -package appeng.core.api.imc; - - -import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage; - -import appeng.api.AEApi; -import appeng.core.AELog; -import appeng.core.api.IIMCProcessor; - - -public class IMCSpatial implements IIMCProcessor -{ - - @Override - public void process( final IMCMessage m ) - { - - try - { - final Class classInstance = Class.forName( m.getStringValue() ); - AEApi.instance().registries().movable().whiteListTileEntity( classInstance ); - } - catch( final ClassNotFoundException e ) - { - AELog.info( "Bad Class Registered: " + m.getStringValue() + " by " + m.getSender() ); - } - } -} diff --git a/src/main/java/appeng/core/features/BlockDefinition.java b/src/main/java/appeng/core/features/BlockDefinition.java index d08d1bf3b..d6afd55f8 100644 --- a/src/main/java/appeng/core/features/BlockDefinition.java +++ b/src/main/java/appeng/core/features/BlockDefinition.java @@ -24,10 +24,10 @@ import java.util.Optional; import com.google.common.base.Preconditions; import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import appeng.api.definitions.IBlockDefinition; @@ -36,7 +36,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition { private final Optional block; - public BlockDefinition( String registryName, Block block, ItemBlock item ) + public BlockDefinition( String registryName, Block block, BlockItem item ) { super( registryName, item ); this.block = Optional.ofNullable( block ); @@ -49,9 +49,9 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition } @Override - public final Optional maybeItemBlock() + public Optional maybeBlockItem() { - return this.block.map( ItemBlock::new ); + return this.block.map( BlockItem::new ); } @Override @@ -63,7 +63,7 @@ public class BlockDefinition extends ItemDefinition implements IBlockDefinition } @Override - public final boolean isSameAs( final IBlockAccess world, final BlockPos pos ) + public final boolean isSameAs( final IBlockReader world, final BlockPos pos ) { return this.block.isPresent() && world.getBlockState( pos ).getBlock() == this.block.get(); } diff --git a/src/main/java/appeng/core/features/BlockStackSrc.java b/src/main/java/appeng/core/features/BlockStackSrc.java index 60f1279fe..63077f114 100644 --- a/src/main/java/appeng/core/features/BlockStackSrc.java +++ b/src/main/java/appeng/core/features/BlockStackSrc.java @@ -32,18 +32,15 @@ public class BlockStackSrc implements IStackSrc { private final Block block; - private final int damage; private final boolean enabled; - public BlockStackSrc( final Block block, final int damage, final ActivityState state ) + public BlockStackSrc( final Block block, final ActivityState state ) { Preconditions.checkNotNull( block ); - Preconditions.checkArgument( damage >= 0 ); Preconditions.checkNotNull( state ); Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled ); this.block = block; - this.damage = damage; this.enabled = state == ActivityState.Enabled; } @@ -51,7 +48,7 @@ public class BlockStackSrc implements IStackSrc @Override public ItemStack stack( final int i ) { - return new ItemStack( this.block, i, this.damage ); + return new ItemStack( this.block, i ); } @Override @@ -60,12 +57,6 @@ public class BlockStackSrc implements IStackSrc return null; } - @Override - public int getDamage() - { - return this.damage; - } - @Override public boolean isEnabled() { diff --git a/src/main/java/appeng/core/features/ColoredItemDefinition.java b/src/main/java/appeng/core/features/ColoredItemDefinition.java index 61d5cf876..db24a3288 100644 --- a/src/main/java/appeng/core/features/ColoredItemDefinition.java +++ b/src/main/java/appeng/core/features/ColoredItemDefinition.java @@ -97,6 +97,6 @@ public final class ColoredItemDefinition implements AEColoredItemDefinition return false; } - return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.getDamage(); + return comparableItem.getItem() == is.getItem(); } } diff --git a/src/main/java/appeng/core/features/DamagedItemDefinition.java b/src/main/java/appeng/core/features/DamagedItemDefinition.java index d025927ac..d2c24497e 100644 --- a/src/main/java/appeng/core/features/DamagedItemDefinition.java +++ b/src/main/java/appeng/core/features/DamagedItemDefinition.java @@ -84,7 +84,7 @@ public final class DamagedItemDefinition implements IItemDefinition return false; } - return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem() && comparableStack.getItemDamage() == this.source.get().getDamage(); + return this.isEnabled() && comparableStack.getItem() == this.source.get().getItem(); } } diff --git a/src/main/java/appeng/core/features/IStackSrc.java b/src/main/java/appeng/core/features/IStackSrc.java index cc7e1aa24..88ad1d214 100644 --- a/src/main/java/appeng/core/features/IStackSrc.java +++ b/src/main/java/appeng/core/features/IStackSrc.java @@ -30,7 +30,5 @@ public interface IStackSrc Item getItem(); - int getDamage(); - boolean isEnabled(); } diff --git a/src/main/java/appeng/core/features/ItemStackSrc.java b/src/main/java/appeng/core/features/ItemStackSrc.java index c263d40d1..49c8d3e46 100644 --- a/src/main/java/appeng/core/features/ItemStackSrc.java +++ b/src/main/java/appeng/core/features/ItemStackSrc.java @@ -31,18 +31,15 @@ public class ItemStackSrc implements IStackSrc { private final Item item; - private final int damage; private final boolean enabled; - public ItemStackSrc( final Item item, final int damage, final ActivityState state ) + public ItemStackSrc( final Item item, final ActivityState state ) { Preconditions.checkNotNull( item ); - Preconditions.checkArgument( damage >= 0 ); Preconditions.checkNotNull( state ); Preconditions.checkArgument( state == ActivityState.Enabled || state == ActivityState.Disabled ); this.item = item; - this.damage = damage; this.enabled = state == ActivityState.Enabled; } @@ -50,7 +47,7 @@ public class ItemStackSrc implements IStackSrc @Override public ItemStack stack( final int i ) { - return new ItemStack( this.item, i, this.damage ); + return new ItemStack( this.item, i ); } @Override @@ -59,12 +56,6 @@ public class ItemStackSrc implements IStackSrc return this.item; } - @Override - public int getDamage() - { - return this.damage; - } - @Override public boolean isEnabled() { diff --git a/src/main/java/appeng/core/features/MaterialStackSrc.java b/src/main/java/appeng/core/features/MaterialStackSrc.java index 294211f52..82e663998 100644 --- a/src/main/java/appeng/core/features/MaterialStackSrc.java +++ b/src/main/java/appeng/core/features/MaterialStackSrc.java @@ -52,12 +52,6 @@ public class MaterialStackSrc implements IStackSrc return this.src.getItemInstance(); } - @Override - public int getDamage() - { - return this.src.getDamageValue(); - } - @Override public boolean isEnabled() { diff --git a/src/main/java/appeng/core/features/TileDefinition.java b/src/main/java/appeng/core/features/TileDefinition.java index 50d803707..e0ca2fb35 100644 --- a/src/main/java/appeng/core/features/TileDefinition.java +++ b/src/main/java/appeng/core/features/TileDefinition.java @@ -23,7 +23,7 @@ import java.util.Optional; import javax.annotation.Nonnull; -import net.minecraft.item.ItemBlock; +import net.minecraft.item.BlockItem; import net.minecraft.tileentity.TileEntity; import appeng.api.definitions.ITileDefinition; @@ -35,7 +35,7 @@ public final class TileDefinition extends BlockDefinition implements ITileDefini private final Optional block; - public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, ItemBlock item ) + public TileDefinition( @Nonnull String registryName, AEBaseTileBlock block, BlockItem item ) { super( registryName, block, item ); this.block = Optional.ofNullable( block ); diff --git a/src/main/java/appeng/core/features/registries/LocatableRegistry.java b/src/main/java/appeng/core/features/registries/LocatableRegistry.java index c82244643..2e36eb9ef 100644 --- a/src/main/java/appeng/core/features/registries/LocatableRegistry.java +++ b/src/main/java/appeng/core/features/registries/LocatableRegistry.java @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.Map; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import appeng.api.events.LocatableEventAnnounce; import appeng.api.events.LocatableEventAnnounce.LocatableEvent; diff --git a/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java b/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java index 24e0ce52b..d7cba63ba 100644 --- a/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java +++ b/src/main/java/appeng/core/features/registries/MatterCannonAmmoRegistry.java @@ -21,8 +21,8 @@ package appeng.core.features.registries; import java.util.HashMap; -import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import appeng.api.features.IMatterCannonAmmoRegistry; import appeng.recipes.ores.IOreListener; diff --git a/src/main/java/appeng/core/features/registries/MovableTileRegistry.java b/src/main/java/appeng/core/features/registries/MovableTileRegistry.java index e0359c0cc..c23229364 100644 --- a/src/main/java/appeng/core/features/registries/MovableTileRegistry.java +++ b/src/main/java/appeng/core/features/registries/MovableTileRegistry.java @@ -81,7 +81,7 @@ public class MovableTileRegistry implements IMovableRegistry ( (IMovableTile) te ).prepareToMove(); } - te.invalidate(); + te.remove(); return true; } diff --git a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java index 8d3d1100d..9ec42b6bd 100644 --- a/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java +++ b/src/main/java/appeng/core/features/registries/P2PTunnelRegistry.java @@ -26,14 +26,13 @@ import java.util.Map.Entry; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.block.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.item.Items; +import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; -import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; import appeng.api.config.TunnelType; @@ -99,15 +98,11 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry this.addNewAttunement( new ItemStack( Items.REDSTONE ), TunnelType.REDSTONE ); this.addNewAttunement( new ItemStack( Items.REPEATER ), TunnelType.REDSTONE ); this.addNewAttunement( new ItemStack( Blocks.REDSTONE_LAMP ), TunnelType.REDSTONE ); - this.addNewAttunement( new ItemStack( Blocks.UNPOWERED_COMPARATOR ), TunnelType.REDSTONE ); - this.addNewAttunement( new ItemStack( Blocks.POWERED_COMPARATOR ), TunnelType.REDSTONE ); - this.addNewAttunement( new ItemStack( Blocks.POWERED_REPEATER ), TunnelType.REDSTONE ); - this.addNewAttunement( new ItemStack( Blocks.UNPOWERED_REPEATER ), TunnelType.REDSTONE ); + this.addNewAttunement( new ItemStack( Blocks.COMPARATOR ), TunnelType.REDSTONE ); this.addNewAttunement( new ItemStack( Blocks.DAYLIGHT_DETECTOR ), TunnelType.REDSTONE ); this.addNewAttunement( new ItemStack( Blocks.REDSTONE_WIRE ), TunnelType.REDSTONE ); this.addNewAttunement( new ItemStack( Blocks.REDSTONE_BLOCK ), TunnelType.REDSTONE ); this.addNewAttunement( new ItemStack( Blocks.LEVER ), TunnelType.REDSTONE ); - this.addNewAttunement( this.getModItem( "enderio", "itemredstoneconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.REDSTONE ); /** * attune based on lots of random item related stuff @@ -124,7 +119,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry this.addNewAttunement( new ItemStack( Blocks.TRAPPED_CHEST ), TunnelType.ITEM ); this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 0 ), TunnelType.ITEM ); this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 9 ), TunnelType.ITEM ); - this.addNewAttunement( this.getModItem( "enderio", "itemitemconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.ITEM ); this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 0 ), TunnelType.ITEM ); // itemduct this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_32", 1 ), TunnelType.ITEM ); // itemduct // (opaque) @@ -144,8 +138,6 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry this.addNewAttunement( this.getModItem( "mekanism", "machineblock2", 11 ), TunnelType.FLUID ); this.addNewAttunement( this.getModItem( "mekanism", "parttransmitter", 4 ), TunnelType.FLUID ); this.addNewAttunement( this.getModItem( "extrautilities", "extractor_base", 6 ), TunnelType.FLUID ); - this.addNewAttunement( this.getModItem( "extrautilities", "drum", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID ); - this.addNewAttunement( this.getModItem( "enderio", "itemliquidconduit", OreDictionary.WILDCARD_VALUE ), TunnelType.FLUID ); this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 0 ), TunnelType.FLUID ); // fluiduct this.addNewAttunement( this.getModItem( "thermaldynamics", "duct_16", 1 ), TunnelType.FLUID ); // fluiduct // (opaque) @@ -228,7 +220,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry { final ItemStack is = entry.getKey(); - if( is.getItem() == trigger.getItem() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) + if( is.getItem() == trigger.getItem() ) { return entry.getValue(); } @@ -240,11 +232,11 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry } // Next, check if the Item you're holding supports any registered capability - for( EnumFacing face : EnumFacing.VALUES ) + for( Direction face : Direction.values() ) { for( Entry, TunnelType> entry : this.capTunnels.entrySet() ) { - if( trigger.hasCapability( entry.getKey(), face ) ) + if( trigger.getCapability( entry.getKey(), face ).isPresent() ) { return entry.getValue(); } @@ -254,7 +246,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry // Use the mod id as last option. for( final Entry entry : this.modIdTunnels.entrySet() ) { - if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals( entry.getKey() ) ) + if( trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getNamespace().equals( entry.getKey() ) ) { return entry.getValue(); } @@ -275,7 +267,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry return ItemStack.EMPTY; } - final ItemStack myItemStack = new ItemStack( item, 1, meta ); + final ItemStack myItemStack = new ItemStack( item, 1 ); return myItemStack; } diff --git a/src/main/java/appeng/core/features/registries/PlayerRegistry.java b/src/main/java/appeng/core/features/registries/PlayerRegistry.java index c4f663e64..14822e4ca 100644 --- a/src/main/java/appeng/core/features/registries/PlayerRegistry.java +++ b/src/main/java/appeng/core/features/registries/PlayerRegistry.java @@ -23,7 +23,7 @@ import javax.annotation.Nullable; import com.mojang.authlib.GameProfile; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.api.features.IPlayerRegistry; import appeng.core.worlddata.WorldData; @@ -44,14 +44,14 @@ public class PlayerRegistry implements IPlayerRegistry } @Override - public int getID( final EntityPlayer player ) + public int getID( final PlayerEntity player ) { return this.getID( player.getGameProfile() ); } @Nullable @Override - public EntityPlayer findPlayer( final int playerID ) + public PlayerEntity findPlayer( final int playerID ) { return WorldData.instance().playerData().getPlayerFromID( playerID ); } diff --git a/src/main/java/appeng/core/features/registries/WirelessRegistry.java b/src/main/java/appeng/core/features/registries/WirelessRegistry.java index 3a32ea3a9..743b81183 100644 --- a/src/main/java/appeng/core/features/registries/WirelessRegistry.java +++ b/src/main/java/appeng/core/features/registries/WirelessRegistry.java @@ -22,9 +22,9 @@ package appeng.core.features.registries; import java.util.ArrayList; import java.util.List; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.IBlockReader; import appeng.api.AEApi; import appeng.api.features.ILocatable; @@ -80,7 +80,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry } @Override - public void openWirelessTerminalGui( final ItemStack item, final World w, final EntityPlayer player ) + public void openWirelessTerminalGui( ItemStack item, IBlockReader world, PlayerEntity player ) { if( Platform.isClient() ) { diff --git a/src/main/java/appeng/core/features/registries/WorldGenRegistry.java b/src/main/java/appeng/core/features/registries/WorldGenRegistry.java index 3425cd442..2d9475a7b 100644 --- a/src/main/java/appeng/core/features/registries/WorldGenRegistry.java +++ b/src/main/java/appeng/core/features/registries/WorldGenRegistry.java @@ -22,7 +22,7 @@ package appeng.core.features.registries; import java.util.HashSet; import net.minecraft.world.World; -import net.minecraft.world.WorldProvider; +import net.minecraft.world.dimension.Dimension; import appeng.api.features.IWorldGen; @@ -45,7 +45,7 @@ public final class WorldGenRegistry implements IWorldGen } @Override - public void disableWorldGenForProviderID( final WorldGenType type, final Class provider ) + public void disableWorldGenForProviderID( WorldGenType type, Class provider ) { if( type == null ) { @@ -95,9 +95,9 @@ public final class WorldGenRegistry implements IWorldGen throw new IllegalArgumentException( "Bad Provider Passed" ); } - final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.provider.getClass() ); - final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.provider.getDimension() ); - final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.provider.getDimension() ); + final boolean isBadProvider = this.types[type.ordinal()].badProviders.contains( w.dimension.getClass() ); + final boolean isBadDimension = this.types[type.ordinal()].badDimensions.contains( w.dimension.getDimension() ); + final boolean isGoodDimension = this.types[type.ordinal()].enabledDimensions.contains( w.dimension.getDimension() ); if( isBadProvider || isBadDimension ) { @@ -115,7 +115,7 @@ public final class WorldGenRegistry implements IWorldGen private static class TypeSet { - final HashSet> badProviders = new HashSet<>(); + final HashSet> badProviders = new HashSet<>(); final HashSet badDimensions = new HashSet<>(); final HashSet enabledDimensions = new HashSet<>(); } diff --git a/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java b/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java index bdb7e595c..80bf54bc5 100644 --- a/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java +++ b/src/main/java/appeng/core/features/registries/cell/BasicItemCellGuiHandler.java @@ -2,7 +2,7 @@ package appeng.core.features.registries.cell; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -28,7 +28,7 @@ public class BasicItemCellGuiHandler implements ICellGuiHandler } @Override - public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan ) + public void openChestGui( final PlayerEntity player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan ) { Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_ME ); } diff --git a/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java b/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java index 9977f6c73..31d31056e 100644 --- a/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java +++ b/src/main/java/appeng/core/features/registries/grinder/GrinderRecipeManager.java @@ -29,10 +29,10 @@ import javax.annotation.Nonnull; import com.google.common.base.Preconditions; import com.google.common.collect.Maps; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.block.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import appeng.api.features.IGrinderRecipe; import appeng.api.features.IGrinderRecipeBuilder; @@ -67,9 +67,9 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene this.addDustRatio( "Coal", 1 ); this.addOre( "Coal", new ItemStack( Items.COAL ) ); - this.addOre( "Charcoal", new ItemStack( Items.COAL, 1, 1 ) ); + this.addOre( "Charcoal", new ItemStack( Items.COAL, 1 ) ); - this.addOre( "NetherQuartz", new ItemStack( Blocks.QUARTZ_ORE ) ); + this.addOre( "NetherQuartz", new ItemStack( Blocks.NETHER_QUARTZ_ORE ) ); this.addIngot( "NetherQuartz", new ItemStack( Items.QUARTZ ) ); this.addOre( "Gold", new ItemStack( Blocks.GOLD_ORE ) ); @@ -138,7 +138,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene return null; } - this.log( "Recipe for '%1$s' found '%2$s'", input.getUnlocalizedName(), Platform.getItemDisplayName( recipe.getOutput() ) ); + this.log( "Recipe for '%1$s' found '%2$s'", input.getTranslationKey(), Platform.getItemDisplayName( recipe.getOutput() ) ); return recipe; } @@ -344,7 +344,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene private static class CacheKey { private final Item item; - private final int damage; CacheKey( ItemStack input ) { @@ -352,7 +351,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene Preconditions.checkNotNull( input.getItem() ); this.item = input.getItem(); - this.damage = input.getItemDamage(); } @Override @@ -360,7 +358,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene { final int prime = 31; int result = 1; - result = prime * result + this.damage; result = prime * result + ( ( this.item == null ) ? 0 : this.item.hashCode() ); return result; } @@ -379,11 +376,6 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene CacheKey other = (CacheKey) obj; - if( this.damage != other.damage ) - { - return false; - } - if( this.item == null ) { if( other.item != null ) diff --git a/src/main/java/appeng/core/localization/ButtonToolTips.java b/src/main/java/appeng/core/localization/ButtonToolTips.java index 2ea884d82..eccb1eb67 100644 --- a/src/main/java/appeng/core/localization/ButtonToolTips.java +++ b/src/main/java/appeng/core/localization/ButtonToolTips.java @@ -19,7 +19,7 @@ package appeng.core.localization; -import net.minecraft.util.text.translation.I18n; +import net.minecraft.client.resources.I18n; public enum ButtonToolTips @@ -164,10 +164,10 @@ public enum ButtonToolTips public String getLocal() { - return I18n.translateToLocal( this.getUnlocalized() ); + return I18n.format( this.getTranslationKey() ); } - public String getUnlocalized() + public String getTranslationKey() { return this.root + '.' + this.toString(); } diff --git a/src/main/java/appeng/core/localization/GuiText.java b/src/main/java/appeng/core/localization/GuiText.java index 3f7eb2d06..2fd8674a2 100644 --- a/src/main/java/appeng/core/localization/GuiText.java +++ b/src/main/java/appeng/core/localization/GuiText.java @@ -19,7 +19,7 @@ package appeng.core.localization; -import net.minecraft.util.text.translation.I18n; +import net.minecraft.client.resources.I18n; public enum GuiText @@ -212,10 +212,10 @@ public enum GuiText public String getLocal() { - return I18n.translateToLocal( this.getUnlocalized() ); + return I18n.format( this.getTranslationKey() ); } - public String getUnlocalized() + public String getTranslationKey() { return this.root + '.' + this.toString(); } diff --git a/src/main/java/appeng/core/localization/PlayerMessages.java b/src/main/java/appeng/core/localization/PlayerMessages.java index 6a177d658..4ec946301 100644 --- a/src/main/java/appeng/core/localization/PlayerMessages.java +++ b/src/main/java/appeng/core/localization/PlayerMessages.java @@ -20,7 +20,7 @@ package appeng.core.localization; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TranslationTextComponent; public enum PlayerMessages @@ -45,10 +45,10 @@ public enum PlayerMessages public ITextComponent get() { - return new TextComponentTranslation( this.getName() ); + return new TranslationTextComponent( this.getTranslationKey() ); } - String getName() + String getTranslationKey() { return "chat.appliedenergistics2." + this.toString(); } diff --git a/src/main/java/appeng/core/localization/WailaText.java b/src/main/java/appeng/core/localization/WailaText.java index c5378abcf..4ae723c27 100644 --- a/src/main/java/appeng/core/localization/WailaText.java +++ b/src/main/java/appeng/core/localization/WailaText.java @@ -19,7 +19,7 @@ package appeng.core.localization; -import net.minecraft.util.text.translation.I18n; +import net.minecraft.client.resources.I18n; public enum WailaText @@ -56,10 +56,10 @@ public enum WailaText public String getLocal() { - return I18n.translateToLocal( this.getUnlocalized() ); + return I18n.format( this.getTranslationKey() ); } - public String getUnlocalized() + public String getTranslationKey() { return this.root + '.' + this.toString(); } diff --git a/src/main/java/appeng/core/stats/AppEngAdvancementTrigger.java b/src/main/java/appeng/core/stats/AppEngAdvancementTrigger.java index 73c212891..4dfaa60df 100644 --- a/src/main/java/appeng/core/stats/AppEngAdvancementTrigger.java +++ b/src/main/java/appeng/core/stats/AppEngAdvancementTrigger.java @@ -31,8 +31,8 @@ import com.google.gson.JsonObject; import net.minecraft.advancements.ICriterionTrigger; import net.minecraft.advancements.PlayerAdvancements; -import net.minecraft.advancements.critereon.AbstractCriterionInstance; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.advancements.criterion.CriterionInstance; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ResourceLocation; import appeng.core.AppEng; @@ -98,7 +98,7 @@ public class AppEngAdvancementTrigger implements ICriterionTrigger> list = null; diff --git a/src/main/java/appeng/core/stats/IAdvancementTrigger.java b/src/main/java/appeng/core/stats/IAdvancementTrigger.java index e5563f3ec..9842aa503 100644 --- a/src/main/java/appeng/core/stats/IAdvancementTrigger.java +++ b/src/main/java/appeng/core/stats/IAdvancementTrigger.java @@ -19,11 +19,11 @@ package appeng.core.stats; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; @FunctionalInterface public interface IAdvancementTrigger { - void trigger( EntityPlayerMP parPlayer ); + void trigger( PlayerEntity parPlayer ); } diff --git a/src/main/java/appeng/core/stats/Stats.java b/src/main/java/appeng/core/stats/Stats.java index 12b0193b8..2e5ce1a24 100644 --- a/src/main/java/appeng/core/stats/Stats.java +++ b/src/main/java/appeng/core/stats/Stats.java @@ -19,7 +19,7 @@ package appeng.core.stats; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.stats.StatBasic; import net.minecraft.util.text.TextComponentTranslation; @@ -42,7 +42,7 @@ public enum Stats { } - public void addToPlayer( final EntityPlayer player, final int howMany ) + public void addToPlayer( final PlayerEntity player, final int howMany ) { player.addStat( this.stat, howMany ); } diff --git a/src/main/java/appeng/core/sync/AppEngPacket.java b/src/main/java/appeng/core/sync/AppEngPacket.java index 6bbb52e16..0c1f0a9e9 100644 --- a/src/main/java/appeng/core/sync/AppEngPacket.java +++ b/src/main/java/appeng/core/sync/AppEngPacket.java @@ -24,7 +24,7 @@ import java.io.IOException; import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.INetHandler; import net.minecraft.network.Packet; import net.minecraft.network.PacketBuffer; @@ -42,7 +42,7 @@ public abstract class AppEngPacket implements Packet private PacketBuffer p; private PacketCallState caller; - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a server side handler." ); } @@ -52,7 +52,7 @@ public abstract class AppEngPacket implements Packet return AppEngPacketHandlerBase.PacketTypes.getID( this.getClass() ).ordinal(); } - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { throw new UnsupportedOperationException( "This packet ( " + this.getPacketID() + " does not implement a client side handler." ); } diff --git a/src/main/java/appeng/core/sync/GuiBridge.java b/src/main/java/appeng/core/sync/GuiBridge.java index 8cecd7f45..b402ccb6b 100644 --- a/src/main/java/appeng/core/sync/GuiBridge.java +++ b/src/main/java/appeng/core/sync/GuiBridge.java @@ -21,8 +21,8 @@ package appeng.core.sync; import java.lang.reflect.Constructor; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; @@ -264,7 +264,7 @@ public enum GuiBridge implements IGuiHandler } @Override - public Object getServerGuiElement( final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z ) + public Object getServerGuiElement( final int ordinal, final PlayerEntity player, final World w, final int x, final int y, final int z ) { final AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 ); final GuiBridge ID = values()[ordinal >> 4]; @@ -309,7 +309,7 @@ public enum GuiBridge implements IGuiHandler return new ContainerNull(); } - private Object getGuiObject( final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z ) + private Object getGuiObject( final ItemStack it, final PlayerEntity player, final World w, final int x, final int y, final int z ) { if( !it.isEmpty() ) { @@ -354,7 +354,7 @@ public enum GuiBridge implements IGuiHandler return newContainer; } - public Object ConstructContainer( final InventoryPlayer inventory, final AEPartLocation side, final Object tE ) + public Object ConstructContainer( final PlayerInventory inventory, final AEPartLocation side, final Object tE ) { try { @@ -380,7 +380,7 @@ public enum GuiBridge implements IGuiHandler } } - private Constructor findConstructor( final Constructor[] c, final InventoryPlayer inventory, final Object tE ) + private Constructor findConstructor( final Constructor[] c, final PlayerInventory inventory, final Object tE ) { for( final Constructor con : c ) { @@ -407,7 +407,7 @@ public enum GuiBridge implements IGuiHandler } @Override - public Object getClientGuiElement( final int ordinal, final EntityPlayer player, final World w, final int x, final int y, final int z ) + public Object getClientGuiElement( final int ordinal, final PlayerEntity player, final World w, final int x, final int y, final int z ) { final AEPartLocation side = AEPartLocation.fromOrdinal( ordinal & 0x07 ); final GuiBridge ID = values()[ordinal >> 4]; @@ -452,7 +452,7 @@ public enum GuiBridge implements IGuiHandler return new GuiNull( new ContainerNull() ); } - public Object ConstructGui( final InventoryPlayer inventory, final AEPartLocation side, final Object tE ) + public Object ConstructGui( final PlayerInventory inventory, final AEPartLocation side, final Object tE ) { try { @@ -478,7 +478,7 @@ public enum GuiBridge implements IGuiHandler } } - public boolean hasPermissions( final TileEntity te, final int x, final int y, final int z, final AEPartLocation side, final EntityPlayer player ) + public boolean hasPermissions( final TileEntity te, final int x, final int y, final int z, final AEPartLocation side, final PlayerEntity player ) { final World w = player.getEntityWorld(); final BlockPos pos = new BlockPos( x, y, z ); @@ -522,7 +522,7 @@ public enum GuiBridge implements IGuiHandler return false; } - private boolean securityCheck( final Object te, final EntityPlayer player ) + private boolean securityCheck( final Object te, final PlayerEntity player ) { if( te instanceof IActionHost && this.requiredPermission != null ) { diff --git a/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java b/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java index 193440e46..af07fdc99 100644 --- a/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java +++ b/src/main/java/appeng/core/sync/network/AppEngClientPacketHandler.java @@ -24,7 +24,7 @@ import java.lang.reflect.InvocationTargetException; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.INetHandler; import net.minecraft.network.PacketThreadUtil; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; @@ -39,7 +39,7 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement { @Override - public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final EntityPlayer player ) + public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final PlayerEntity player ) { final ByteBuf stream = packet.payload(); @@ -54,12 +54,12 @@ public class AppEngClientPacketHandler extends AppEngPacketHandlerBase implement @Override public void call( final AppEngPacket appEngPacket ) { - appEngPacket.clientPacketData( manager, appEngPacket, Minecraft.getMinecraft().player ); + appEngPacket.clientPacketData( manager, appEngPacket, Minecraft.getInstance().player ); } }; pack.setCallParam( callState ); - PacketThreadUtil.checkThreadAndEnqueue( pack, handler, Minecraft.getMinecraft() ); + PacketThreadUtil.checkThreadAndEnqueue( pack, handler, Minecraft.getInstance() ); callState.call( pack ); } catch( final InstantiationException e ) diff --git a/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java b/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java index a7546bd6f..9c18c1ce0 100644 --- a/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java +++ b/src/main/java/appeng/core/sync/network/AppEngServerPacketHandler.java @@ -23,8 +23,8 @@ import java.lang.reflect.InvocationTargetException; import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.network.INetHandler; import net.minecraft.network.PacketThreadUtil; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; @@ -39,7 +39,7 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp { @Override - public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final EntityPlayer player ) + public void onPacketData( final INetworkInfo manager, final INetHandler handler, final FMLProxyPacket packet, final PlayerEntity player ) { final ByteBuf stream = packet.payload(); @@ -59,7 +59,7 @@ public final class AppEngServerPacketHandler extends AppEngPacketHandlerBase imp }; pack.setCallParam( callState ); - PacketThreadUtil.checkThreadAndEnqueue( pack, handler, ( (EntityPlayerMP) player ).getServer() ); + PacketThreadUtil.checkThreadAndEnqueue( pack, handler, ( (PlayerEntityMP) player ).getServer() ); callState.call( pack ); } catch( final InstantiationException e ) diff --git a/src/main/java/appeng/core/sync/network/IPacketHandler.java b/src/main/java/appeng/core/sync/network/IPacketHandler.java index be5cf3972..428dfa53a 100644 --- a/src/main/java/appeng/core/sync/network/IPacketHandler.java +++ b/src/main/java/appeng/core/sync/network/IPacketHandler.java @@ -19,7 +19,7 @@ package appeng.core.sync.network; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.network.INetHandler; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; @@ -27,6 +27,6 @@ import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; public interface IPacketHandler { - void onPacketData( INetworkInfo manager, INetHandler handler, FMLProxyPacket packet, EntityPlayer player ); + void onPacketData( INetworkInfo manager, INetHandler handler, FMLProxyPacket packet, PlayerEntity player ); } diff --git a/src/main/java/appeng/core/sync/network/NetworkHandler.java b/src/main/java/appeng/core/sync/network/NetworkHandler.java index d714fbe03..1b773d0cb 100644 --- a/src/main/java/appeng/core/sync/network/NetworkHandler.java +++ b/src/main/java/appeng/core/sync/network/NetworkHandler.java @@ -19,7 +19,7 @@ package appeng.core.sync.network; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.network.NetHandlerPlayServer; import net.minecraft.network.ThreadQuickExitException; import net.minecraftforge.fml.common.FMLCommonHandler; @@ -129,7 +129,7 @@ public class NetworkHandler this.ec.sendToAll( message.getProxy() ); } - public void sendTo( final AppEngPacket message, final EntityPlayerMP player ) + public void sendTo( final AppEngPacket message, final PlayerEntityMP player ) { this.ec.sendTo( message.getProxy(), player ); } diff --git a/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java b/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java index c4993e557..40a6506c4 100644 --- a/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java +++ b/src/main/java/appeng/core/sync/packets/PacketAssemblerAnimation.java @@ -24,10 +24,10 @@ import java.io.IOException; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.math.BlockPos; -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.storage.data.IAEItemStack; import appeng.client.EffectType; @@ -74,8 +74,8 @@ public class PacketAssemblerAnimation extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { final double d0 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D); final double d1 = 0.5d;// + ((double) (Platform.getRandomFloat() - 0.5F) * 0.26D); diff --git a/src/main/java/appeng/core/sync/packets/PacketClick.java b/src/main/java/appeng/core/sync/packets/PacketClick.java index 286f5cac8..dcac011ba 100644 --- a/src/main/java/appeng/core/sync/packets/PacketClick.java +++ b/src/main/java/appeng/core/sync/packets/PacketClick.java @@ -23,10 +23,10 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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; @@ -48,11 +48,11 @@ public class PacketClick extends AppEngPacket private final int x; private final int y; private final int z; - private EnumFacing side; + private Direction side; private final float hitX; private final float hitY; private final float hitZ; - private EnumHand hand; + private Hand hand; private final boolean leftClick; // automatic. @@ -64,7 +64,7 @@ public class PacketClick extends AppEngPacket byte side = stream.readByte(); if( side != -1 ) { - this.side = EnumFacing.values()[side]; + this.side = Direction.values()[side]; } else { @@ -73,17 +73,17 @@ public class PacketClick extends AppEngPacket this.hitX = stream.readFloat(); this.hitY = stream.readFloat(); this.hitZ = stream.readFloat(); - this.hand = EnumHand.values()[stream.readByte()]; + this.hand = Hand.values()[stream.readByte()]; this.leftClick = stream.readBoolean(); } // api - public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public PacketClick( final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { this( pos, side, hitX, hitY, hitZ, hand, false ); } - public PacketClick( final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand, boolean leftClick ) + public PacketClick( final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand, boolean leftClick ) { final ByteBuf data = Unpooled.buffer(); @@ -110,7 +110,7 @@ public class PacketClick extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { final ItemStack is = player.inventory.getCurrentItem(); final IItems items = AEApi.instance().definitions().items(); diff --git a/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java b/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java index 1e913e44b..5d8880f06 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java +++ b/src/main/java/appeng/core/sync/packets/PacketCompassRequest.java @@ -22,8 +22,8 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import appeng.api.util.DimensionalCoord; import appeng.core.sync.AppEngPacket; @@ -41,7 +41,7 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba final int cz; final int cdy; - private EntityPlayer talkBackTo; + private PlayerEntity talkBackTo; // automatic. public PacketCompassRequest( final ByteBuf stream ) @@ -70,11 +70,11 @@ public class PacketCompassRequest extends AppEngPacket implements ICompassCallba @Override public void calculatedDirection( final boolean hasResult, final boolean spin, final double radians, final double dist ) { - NetworkHandler.instance().sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (EntityPlayerMP) this.talkBackTo ); + NetworkHandler.instance().sendTo( new PacketCompassResponse( this, hasResult, spin, radians ), (PlayerEntityMP) this.talkBackTo ); } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { this.talkBackTo = player; diff --git a/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java b/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java index 4f90ae417..03a2da12e 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java +++ b/src/main/java/appeng/core/sync/packets/PacketCompassResponse.java @@ -22,7 +22,7 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.core.sync.AppEngPacket; import appeng.core.sync.network.INetworkInfo; @@ -71,7 +71,7 @@ public class PacketCompassResponse extends AppEngPacket } @Override - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { CompassManager.INSTANCE.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr ); } diff --git a/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java b/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java index 5a547555b..0ce0eb55f 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java +++ b/src/main/java/appeng/core/sync/packets/PacketCompressedNBT.java @@ -32,11 +32,11 @@ import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.nbt.CompoundNBT; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import appeng.client.gui.implementations.GuiInterfaceTerminal; import appeng.core.sync.AppEngPacket; @@ -47,7 +47,7 @@ public class PacketCompressedNBT extends AppEngPacket { // input. - private final NBTTagCompound in; + private final CompoundNBT in; // output... private final ByteBuf data; private final GZIPOutputStream compressFrame; @@ -79,7 +79,7 @@ public class PacketCompressedNBT extends AppEngPacket } // api - public PacketCompressedNBT( final NBTTagCompound din ) throws IOException + public PacketCompressedNBT( final CompoundNBT din ) throws IOException { this.data = Unpooled.buffer( 2048 ); @@ -104,10 +104,10 @@ public class PacketCompressedNBT extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { - final GuiScreen gs = Minecraft.getMinecraft().currentScreen; + final GuiScreen gs = Minecraft.getInstance().currentScreen; if( gs instanceof GuiInterfaceTerminal ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketConfigButton.java b/src/main/java/appeng/core/sync/packets/PacketConfigButton.java index 421107535..85476cea1 100644 --- a/src/main/java/appeng/core/sync/packets/PacketConfigButton.java +++ b/src/main/java/appeng/core/sync/packets/PacketConfigButton.java @@ -22,8 +22,8 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import appeng.api.config.Settings; import appeng.api.util.IConfigManager; @@ -64,9 +64,9 @@ public final class PacketConfigButton extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { - final EntityPlayerMP sender = (EntityPlayerMP) player; + final PlayerEntityMP sender = (PlayerEntityMP) player; if( sender.openContainer instanceof AEBaseContainer ) { final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer; diff --git a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java index 5f867a442..0d4fbe0a6 100644 --- a/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java +++ b/src/main/java/appeng/core/sync/packets/PacketCraftRequest.java @@ -24,7 +24,7 @@ import java.util.concurrent.Future; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tileentity.TileEntity; import appeng.api.networking.IGrid; @@ -70,7 +70,7 @@ public class PacketCraftRequest extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { if( player.openContainer instanceof ContainerCraftAmount ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketFluidSlot.java b/src/main/java/appeng/core/sync/packets/PacketFluidSlot.java index 3816fa702..ba646c16f 100644 --- a/src/main/java/appeng/core/sync/packets/PacketFluidSlot.java +++ b/src/main/java/appeng/core/sync/packets/PacketFluidSlot.java @@ -25,9 +25,9 @@ import java.util.Map; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.fml.common.network.ByteBufUtils; import appeng.api.storage.data.IAEFluidStack; @@ -44,7 +44,7 @@ public class PacketFluidSlot extends AppEngPacket public PacketFluidSlot( final ByteBuf stream ) { this.list = new HashMap<>(); - NBTTagCompound tag = ByteBufUtils.readTag( stream ); + CompoundNBT tag = ByteBufUtils.readTag( stream ); for( final String key : tag.getKeySet() ) { @@ -56,10 +56,10 @@ public class PacketFluidSlot extends AppEngPacket public PacketFluidSlot( final Map list ) { this.list = list; - final NBTTagCompound sendTag = new NBTTagCompound(); + final CompoundNBT sendTag = new CompoundNBT(); for( Map.Entry fs : list.entrySet() ) { - final NBTTagCompound tag = new NBTTagCompound(); + final CompoundNBT tag = new CompoundNBT(); if( fs.getValue() != null ) { fs.getValue().writeToNBT( tag ); @@ -74,7 +74,7 @@ public class PacketFluidSlot extends AppEngPacket } @Override - public void clientPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void clientPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { final Container c = player.openContainer; if( c instanceof IFluidSyncContainer ) @@ -84,7 +84,7 @@ public class PacketFluidSlot extends AppEngPacket } @Override - public void serverPacketData( INetworkInfo manager, AppEngPacket packet, EntityPlayer player ) + public void serverPacketData( INetworkInfo manager, AppEngPacket packet, PlayerEntity player ) { final Container c = player.openContainer; if( c instanceof IFluidSyncContainer ) diff --git a/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java b/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java index 0bb0dc71f..64165aeec 100644 --- a/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java +++ b/src/main/java/appeng/core/sync/packets/PacketInventoryAction.java @@ -24,8 +24,8 @@ import java.io.IOException; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -121,9 +121,9 @@ public class PacketInventoryAction extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { - final EntityPlayerMP sender = (EntityPlayerMP) player; + final PlayerEntityMP sender = (PlayerEntityMP) player; if( sender.openContainer instanceof AEBaseContainer ) { final AEBaseContainer baseContainer = (AEBaseContainer) sender.openContainer; @@ -158,7 +158,7 @@ public class PacketInventoryAction extends AppEngPacket } @Override - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { if( this.action == InventoryAction.UPDATE_HAND ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java b/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java index 85f765145..2e80af8bf 100644 --- a/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java +++ b/src/main/java/appeng/core/sync/packets/PacketJEIRecipe.java @@ -27,12 +27,12 @@ import java.io.IOException; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.items.IItemHandler; @@ -70,7 +70,7 @@ public class PacketJEIRecipe extends AppEngPacket { final ByteArrayInputStream bytes = this.getPacketByteArray( stream ); bytes.skip( stream.readerIndex() ); - final NBTTagCompound comp = CompressedStreamTools.readCompressed( bytes ); + final CompoundNBT comp = CompressedStreamTools.readCompressed( bytes ); if( comp != null ) { this.recipe = new ItemStack[9][]; @@ -90,7 +90,7 @@ public class PacketJEIRecipe extends AppEngPacket } // api - public PacketJEIRecipe( final NBTTagCompound recipe ) throws IOException + public PacketJEIRecipe( final CompoundNBT recipe ) throws IOException { final ByteBuf data = Unpooled.buffer(); @@ -106,9 +106,9 @@ public class PacketJEIRecipe extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { - final EntityPlayerMP pmp = (EntityPlayerMP) player; + final PlayerEntityMP pmp = (PlayerEntityMP) player; final Container con = pmp.openContainer; if( !( con instanceof IContainerCraftingPacket ) ) diff --git a/src/main/java/appeng/core/sync/packets/PacketLightning.java b/src/main/java/appeng/core/sync/packets/PacketLightning.java index 40a46c102..e5f579f82 100644 --- a/src/main/java/appeng/core/sync/packets/PacketLightning.java +++ b/src/main/java/appeng/core/sync/packets/PacketLightning.java @@ -23,9 +23,9 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import appeng.client.render.effects.LightningFX; import appeng.core.AEConfig; @@ -68,15 +68,15 @@ public class PacketLightning extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { try { if( Platform.isClient() && AEConfig.instance().isEnableEffects() ) { final LightningFX fx = new LightningFX( AppEng.proxy.getWorld(), this.x, this.y, this.z, 0.0f, 0.0f, 0.0f ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } catch( final Exception ignored ) diff --git a/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java b/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java index 3e1638631..68ddad123 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java +++ b/src/main/java/appeng/core/sync/packets/PacketMEFluidInventoryUpdate.java @@ -35,10 +35,10 @@ import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; -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.storage.data.IAEFluidStack; import appeng.core.AELog; @@ -148,10 +148,10 @@ public class PacketMEFluidInventoryUpdate extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { - final GuiScreen gs = Minecraft.getMinecraft().currentScreen; + final GuiScreen gs = Minecraft.getInstance().currentScreen; if( gs instanceof GuiFluidTerminal ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java b/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java index 9ac3f9131..e9c0758c3 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java +++ b/src/main/java/appeng/core/sync/packets/PacketMEInventoryUpdate.java @@ -35,10 +35,10 @@ import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.fml.common.network.internal.FMLProxyPacket; -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.storage.data.IAEItemStack; import appeng.client.gui.implementations.GuiCraftConfirm; @@ -146,10 +146,10 @@ public class PacketMEInventoryUpdate extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { - final GuiScreen gs = Minecraft.getMinecraft().currentScreen; + final GuiScreen gs = Minecraft.getInstance().currentScreen; if( gs instanceof GuiCraftConfirm ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java index f6c6169cd..bc1ff59dd 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java +++ b/src/main/java/appeng/core/sync/packets/PacketMatterCannon.java @@ -23,12 +23,12 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; -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.world.World; import net.minecraftforge.fml.client.FMLClientHandler; -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.client.render.effects.MatterCannonFX; import appeng.core.sync.AppEngPacket; @@ -87,8 +87,8 @@ public class PacketMatterCannon extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { try { @@ -98,7 +98,7 @@ public class PacketMatterCannon extends AppEngPacket { final MatterCannonFX fx = new MatterCannonFX( world, this.x + this.dx * a, this.y + this.dy * a, this.z + this.dz * a, Items.DIAMOND ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } catch( final Exception ignored ) diff --git a/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java b/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java index 829a59e81..2d95812d9 100644 --- a/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java +++ b/src/main/java/appeng/core/sync/packets/PacketMockExplosion.java @@ -22,11 +22,11 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.EnumParticleTypes; 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.core.AppEng; import appeng.core.sync.AppEngPacket; @@ -66,8 +66,8 @@ public class PacketMockExplosion extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { final World world = AppEng.proxy.getWorld(); world.spawnParticle( EnumParticleTypes.EXPLOSION_LARGE, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D, new int[0] ); diff --git a/src/main/java/appeng/core/sync/packets/PacketPaintedEntity.java b/src/main/java/appeng/core/sync/packets/PacketPaintedEntity.java index 15a32cf1b..7b89746a9 100644 --- a/src/main/java/appeng/core/sync/packets/PacketPaintedEntity.java +++ b/src/main/java/appeng/core/sync/packets/PacketPaintedEntity.java @@ -22,7 +22,7 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.api.util.AEColor; import appeng.core.sync.AppEngPacket; @@ -61,7 +61,7 @@ public class PacketPaintedEntity extends AppEngPacket } @Override - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { final PlayerColor pc = new PlayerColor( this.entityId, this.myColor, this.ticks ); TickHandler.INSTANCE.getPlayerColors().put( this.entityId, pc ); diff --git a/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java b/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java index 98c27bd67..1d550592e 100644 --- a/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java +++ b/src/main/java/appeng/core/sync/packets/PacketPartPlacement.java @@ -22,10 +22,10 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import appeng.core.AppEng; @@ -42,7 +42,7 @@ public class PacketPartPlacement extends AppEngPacket private int z; private int face; private float eyeHeight; - private EnumHand hand; + private Hand hand; // automatic. public PacketPartPlacement( final ByteBuf stream ) @@ -52,11 +52,11 @@ public class PacketPartPlacement extends AppEngPacket this.z = stream.readInt(); this.face = stream.readByte(); this.eyeHeight = stream.readFloat(); - this.hand = EnumHand.values()[stream.readByte()]; + this.hand = Hand.values()[stream.readByte()]; } // api - public PacketPartPlacement( final BlockPos pos, final EnumFacing face, final float eyeHeight, final EnumHand hand ) + public PacketPartPlacement( final BlockPos pos, final Direction face, final float eyeHeight, final Hand hand ) { final ByteBuf data = Unpooled.buffer(); @@ -72,12 +72,12 @@ public class PacketPartPlacement extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { - final EntityPlayerMP sender = (EntityPlayerMP) player; + final PlayerEntityMP sender = (PlayerEntityMP) player; AppEng.proxy.updateRenderMode( sender ); PartPlacement.setEyeHeight( this.eyeHeight ); - PartPlacement.place( sender.getHeldItem( this.hand ), new BlockPos( this.x, this.y, this.z ), EnumFacing.VALUES[this.face], sender, this.hand, + PartPlacement.place( sender.getHeldItem( this.hand ), new BlockPos( this.x, this.y, this.z ), Direction.VALUES[this.face], sender, this.hand, sender.world, PartPlacement.PlaceType.INTERACT_FIRST_PASS, 0 ); AppEng.proxy.updateRenderMode( null ); diff --git a/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java b/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java index 483def08b..cb3fc6390 100644 --- a/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java +++ b/src/main/java/appeng/core/sync/packets/PacketPatternSlot.java @@ -24,8 +24,8 @@ import java.io.IOException; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraftforge.items.IItemHandler; import appeng.api.AEApi; @@ -109,9 +109,9 @@ public class PacketPatternSlot extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { - final EntityPlayerMP sender = (EntityPlayerMP) player; + final PlayerEntityMP sender = (PlayerEntityMP) player; if( sender.openContainer instanceof ContainerPatternTerm ) { final ContainerPatternTerm patternTerminal = (ContainerPatternTerm) sender.openContainer; diff --git a/src/main/java/appeng/core/sync/packets/PacketProgressBar.java b/src/main/java/appeng/core/sync/packets/PacketProgressBar.java index 11f85a2ba..e498d77c8 100644 --- a/src/main/java/appeng/core/sync/packets/PacketProgressBar.java +++ b/src/main/java/appeng/core/sync/packets/PacketProgressBar.java @@ -22,7 +22,7 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import appeng.container.AEBaseContainer; @@ -59,7 +59,7 @@ public class PacketProgressBar extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { final Container c = player.openContainer; if( c instanceof AEBaseContainer ) @@ -69,7 +69,7 @@ public class PacketProgressBar extends AppEngPacket } @Override - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { final Container c = player.openContainer; if( c instanceof AEBaseContainer ) diff --git a/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java b/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java index f84f3e56d..636759c55 100644 --- a/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java +++ b/src/main/java/appeng/core/sync/packets/PacketSwapSlots.java @@ -22,7 +22,7 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.container.AEBaseContainer; import appeng.core.sync.AppEngPacket; @@ -55,7 +55,7 @@ public class PacketSwapSlots extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { if( player != null && player.openContainer instanceof AEBaseContainer ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java b/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java index 1910df48e..7fbc67427 100644 --- a/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java +++ b/src/main/java/appeng/core/sync/packets/PacketSwitchGuis.java @@ -22,7 +22,7 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import net.minecraft.tileentity.TileEntity; @@ -59,7 +59,7 @@ public class PacketSwitchGuis extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { final Container c = player.openContainer; if( c instanceof AEBaseContainer ) diff --git a/src/main/java/appeng/core/sync/packets/PacketTargetFluidStack.java b/src/main/java/appeng/core/sync/packets/PacketTargetFluidStack.java index 017e18338..a6fd9681c 100644 --- a/src/main/java/appeng/core/sync/packets/PacketTargetFluidStack.java +++ b/src/main/java/appeng/core/sync/packets/PacketTargetFluidStack.java @@ -22,7 +22,7 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.core.AELog; import appeng.core.sync.AppEngPacket; @@ -84,7 +84,7 @@ public class PacketTargetFluidStack extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { if( player.openContainer instanceof ContainerFluidTerminal ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketTargetItemStack.java b/src/main/java/appeng/core/sync/packets/PacketTargetItemStack.java index c6834f244..bb6e5ef14 100644 --- a/src/main/java/appeng/core/sync/packets/PacketTargetItemStack.java +++ b/src/main/java/appeng/core/sync/packets/PacketTargetItemStack.java @@ -22,7 +22,7 @@ package appeng.core.sync.packets; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.container.AEBaseContainer; import appeng.core.AELog; @@ -79,7 +79,7 @@ public class PacketTargetItemStack extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { if( player.openContainer instanceof AEBaseContainer ) { diff --git a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java index 41ef1f13e..ef617e11d 100644 --- a/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java +++ b/src/main/java/appeng/core/sync/packets/PacketTransitionEffect.java @@ -25,13 +25,13 @@ import io.netty.buffer.Unpooled; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; -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.util.SoundCategory; import net.minecraft.util.math.BlockPos; 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.util.AEPartLocation; import appeng.client.render.effects.EnergyFx; @@ -82,8 +82,8 @@ public class PacketTransitionEffect extends AppEngPacket } @Override - @SideOnly( Side.CLIENT ) - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + @OnlyIn( Dist.CLIENT ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { final World world = AppEng.proxy.getWorld(); @@ -105,7 +105,7 @@ public class PacketTransitionEffect extends AppEngPacket fx.setMotionY( -0.1f * this.d.yOffset ); fx.setMotionZ( -0.1f * this.d.zOffset ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } @@ -113,7 +113,7 @@ public class PacketTransitionEffect extends AppEngPacket { final Block block = world.getBlockState( new BlockPos( (int) this.x, (int) this.y, (int) this.z ) ).getBlock(); - Minecraft.getMinecraft() + Minecraft.getInstance() .getSoundHandler() .playSound( new PositionedSoundRecord( block.getSoundType() .getBreakSound(), SoundCategory.BLOCKS, ( block.getSoundType().getVolume() + 1.0F ) / 2.0F, block.getSoundType() diff --git a/src/main/java/appeng/core/sync/packets/PacketValueConfig.java b/src/main/java/appeng/core/sync/packets/PacketValueConfig.java index 4bbb70772..083d46a9d 100644 --- a/src/main/java/appeng/core/sync/packets/PacketValueConfig.java +++ b/src/main/java/appeng/core/sync/packets/PacketValueConfig.java @@ -29,10 +29,10 @@ import io.netty.buffer.Unpooled; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import appeng.api.config.FuzzyMode; import appeng.api.config.Settings; @@ -95,22 +95,22 @@ public class PacketValueConfig extends AppEngPacket } @Override - public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final EntityPlayer player ) + public void serverPacketData( final INetworkInfo manager, final AppEngPacket packet, final PlayerEntity player ) { final Container c = player.openContainer; - if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ) - .getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( EnumHand.OFF_HAND ) - .isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem ) ) ) + if( this.Name.equals( "Item" ) && ( ( !player.getHeldItem( Hand.MAIN_HAND ).isEmpty() && player.getHeldItem( Hand.MAIN_HAND ) + .getItem() instanceof IMouseWheelItem ) || ( !player.getHeldItem( Hand.OFF_HAND ) + .isEmpty() && player.getHeldItem( Hand.OFF_HAND ).getItem() instanceof IMouseWheelItem ) ) ) { - final EnumHand hand; - if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem ) + final Hand hand; + if( !player.getHeldItem( Hand.MAIN_HAND ).isEmpty() && player.getHeldItem( Hand.MAIN_HAND ).getItem() instanceof IMouseWheelItem ) { - hand = EnumHand.MAIN_HAND; + hand = Hand.MAIN_HAND; } - else if( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem ) + else if( !player.getHeldItem( Hand.OFF_HAND ).isEmpty() && player.getHeldItem( Hand.OFF_HAND ).getItem() instanceof IMouseWheelItem ) { - hand = EnumHand.OFF_HAND; + hand = Hand.OFF_HAND; } else { @@ -270,7 +270,7 @@ public class PacketValueConfig extends AppEngPacket } @Override - public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player ) + public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final PlayerEntity player ) { final Container c = player.openContainer; @@ -284,7 +284,7 @@ public class PacketValueConfig extends AppEngPacket } else if( this.Name.equals( "CraftingStatus" ) && this.Value.equals( "Clear" ) ) { - final GuiScreen gs = Minecraft.getMinecraft().currentScreen; + final GuiScreen gs = Minecraft.getInstance().currentScreen; if( gs instanceof GuiCraftingCPU ) { ( (GuiCraftingCPU) gs ).clearItems(); diff --git a/src/main/java/appeng/core/worlddata/IWorldPlayerData.java b/src/main/java/appeng/core/worlddata/IWorldPlayerData.java index 7d0f09bc1..6bece8a54 100644 --- a/src/main/java/appeng/core/worlddata/IWorldPlayerData.java +++ b/src/main/java/appeng/core/worlddata/IWorldPlayerData.java @@ -23,7 +23,7 @@ import javax.annotation.Nullable; import com.mojang.authlib.GameProfile; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; /** @@ -34,7 +34,7 @@ import net.minecraft.entity.player.EntityPlayer; public interface IWorldPlayerData { @Nullable - EntityPlayer getPlayerFromID( int playerID ); + PlayerEntity getPlayerFromID( int playerID ); int getPlayerID( GameProfile profile ); } diff --git a/src/main/java/appeng/core/worlddata/IWorldSpawnData.java b/src/main/java/appeng/core/worlddata/IWorldSpawnData.java index adfd67245..2f20fa862 100644 --- a/src/main/java/appeng/core/worlddata/IWorldSpawnData.java +++ b/src/main/java/appeng/core/worlddata/IWorldSpawnData.java @@ -21,7 +21,8 @@ package appeng.core.worlddata; import java.util.Collection; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.world.dimension.Dimension; /** @@ -31,11 +32,11 @@ import net.minecraft.nbt.NBTTagCompound; */ public interface IWorldSpawnData { - void setGenerated( int dim, int chunkX, int chunkZ ); + void setGenerated( Dimension dim, int chunkX, int chunkZ ); - boolean hasGenerated( int dim, int chunkX, int chunkZ ); + boolean hasGenerated( Dimension dim, int chunkX, int chunkZ ); - boolean addNearByMeteorites( int dim, int chunkX, int chunkZ, NBTTagCompound newData ); + boolean addNearByMeteorites( Dimension dim, int chunkX, int chunkZ, CompoundNBT newData ); - Collection getNearByMeteorites( int dim, int chunkX, int chunkZ ); + Collection getNearByMeteorites( Dimension dim, int chunkX, int chunkZ ); } diff --git a/src/main/java/appeng/core/worlddata/PlayerData.java b/src/main/java/appeng/core/worlddata/PlayerData.java index c576bd3e4..c976aee16 100644 --- a/src/main/java/appeng/core/worlddata/PlayerData.java +++ b/src/main/java/appeng/core/worlddata/PlayerData.java @@ -28,7 +28,7 @@ import javax.annotation.Nullable; import com.google.common.base.Preconditions; import com.mojang.authlib.GameProfile; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; @@ -68,14 +68,14 @@ final class PlayerData implements IWorldPlayerData, IOnWorldStartable, IOnWorldS @Nullable @Override - public EntityPlayer getPlayerFromID( final int playerID ) + public PlayerEntity getPlayerFromID( final int playerID ) { final Optional maybe = this.playerMapping.get( playerID ); if( maybe.isPresent() ) { final UUID uuid = maybe.get(); - for( final EntityPlayer player : AppEng.proxy.getPlayers() ) + for( final PlayerEntity player : AppEng.proxy.getPlayers() ) { if( player.getUniqueID().equals( uuid ) ) { diff --git a/src/main/java/appeng/core/worlddata/SpatialDimensionManager.java b/src/main/java/appeng/core/worlddata/SpatialDimensionManager.java index b55296036..41886456c 100644 --- a/src/main/java/appeng/core/worlddata/SpatialDimensionManager.java +++ b/src/main/java/appeng/core/worlddata/SpatialDimensionManager.java @@ -22,9 +22,9 @@ package appeng.core.worlddata; import java.util.HashMap; import java.util.Map; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; @@ -35,7 +35,7 @@ import appeng.api.storage.ISpatialDimension; import appeng.capabilities.Capabilities; -public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySerializable +public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySerializable { private static final String NBT_SPATIAL_DATA_KEY = "spatial_data"; private static final String NBT_SPATIAL_ID_KEY = "id"; @@ -119,13 +119,13 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe } @Override - public boolean hasCapability( Capability capability, EnumFacing facing ) + public boolean hasCapability( Capability capability, Direction facing ) { return capability == Capabilities.SPATIAL_DIMENSION; } @Override - public T getCapability( Capability capability, EnumFacing facing ) + public T getCapability( Capability capability, Direction facing ) { if( capability == Capabilities.SPATIAL_DIMENSION ) { @@ -135,14 +135,14 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe } @Override - public NBTTagCompound serializeNBT() + public CompoundNBT serializeNBT() { - final NBTTagCompound ret = new NBTTagCompound(); + final CompoundNBT ret = new CompoundNBT(); final NBTTagList list = new NBTTagList(); for( Map.Entry entry : this.spatialData.entrySet() ) { - final NBTTagCompound nbt = entry.getValue().serializeNBT(); + final CompoundNBT nbt = entry.getValue().serializeNBT(); nbt.setInteger( NBT_SPATIAL_ID_KEY, entry.getKey() ); list.appendTag( nbt ); } @@ -151,7 +151,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe } @Override - public void deserializeNBT( NBTTagCompound nbt ) + public void deserializeNBT( CompoundNBT nbt ) { if( nbt.hasKey( NBT_SPATIAL_DATA_KEY ) ) { @@ -160,7 +160,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe this.spatialData.clear(); for( int i = 0; i < list.tagCount(); ++i ) { - final NBTTagCompound entry = list.getCompoundTagAt( i ); + final CompoundNBT entry = list.getCompoundTagAt( i ); final StorageCellData data = new StorageCellData(); final int id = entry.getInteger( NBT_SPATIAL_ID_KEY ); data.deserializeNBT( entry ); @@ -214,7 +214,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe // TODO reset chunks? } - private static class StorageCellData implements INBTSerializable + private static class StorageCellData implements INBTSerializable { private static final String NBT_OWNER_KEY = "owner"; private static final String NBT_DIM_X_KEY = "dim_x"; @@ -225,9 +225,9 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe public int owner; @Override - public NBTTagCompound serializeNBT() + public CompoundNBT serializeNBT() { - NBTTagCompound nbt = new NBTTagCompound(); + CompoundNBT nbt = new CompoundNBT(); nbt.setInteger( NBT_DIM_X_KEY, this.contentDimension.getX() ); nbt.setInteger( NBT_DIM_Y_KEY, this.contentDimension.getY() ); nbt.setInteger( NBT_DIM_Z_KEY, this.contentDimension.getZ() ); @@ -236,7 +236,7 @@ public class SpatialDimensionManager implements ISpatialDimension, ICapabilitySe } @Override - public void deserializeNBT( NBTTagCompound nbt ) + public void deserializeNBT( CompoundNBT nbt ) { this.contentDimension = new BlockPos( nbt.getInteger( NBT_DIM_X_KEY ), nbt.getInteger( NBT_DIM_Y_KEY ), nbt.getInteger( NBT_DIM_Z_KEY ) ); this.owner = nbt.getInteger( NBT_OWNER_KEY ); diff --git a/src/main/java/appeng/core/worlddata/SpawnData.java b/src/main/java/appeng/core/worlddata/SpawnData.java index f0f35bbe4..0abad9ec9 100644 --- a/src/main/java/appeng/core/worlddata/SpawnData.java +++ b/src/main/java/appeng/core/worlddata/SpawnData.java @@ -30,8 +30,8 @@ import javax.annotation.Nonnull; import com.google.common.base.Preconditions; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; import appeng.core.AELog; @@ -57,11 +57,11 @@ final class SpawnData implements IWorldSpawnData } @Override - public void setGenerated( final int dim, final int chunkX, final int chunkZ ) + public void setGenerated( final Dimension dim, final int chunkX, final int chunkZ ) { synchronized( SpawnData.class ) { - final NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ ); + final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ ); // edit. data.setBoolean( chunkX + "," + chunkZ, true ); @@ -71,21 +71,21 @@ final class SpawnData implements IWorldSpawnData } @Override - public boolean hasGenerated( final int dim, final int chunkX, final int chunkZ ) + public boolean hasGenerated( final Dimension dim, final int chunkX, final int chunkZ ) { synchronized( SpawnData.class ) { - final NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ ); + final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ ); return data.getBoolean( chunkX + "," + chunkZ ); } } @Override - public boolean addNearByMeteorites( final int dim, final int chunkX, final int chunkZ, final NBTTagCompound newData ) + public boolean addNearByMeteorites( final Dimension dim, final int chunkX, final int chunkZ, final CompoundNBT newData ) { synchronized( SpawnData.class ) { - final NBTTagCompound data = this.loadSpawnData( dim, chunkX, chunkZ ); + final CompoundNBT data = this.loadSpawnData( dim, chunkX, chunkZ ); // edit. final int size = data.getInteger( "num" ); @@ -99,9 +99,9 @@ final class SpawnData implements IWorldSpawnData } @Override - public Collection getNearByMeteorites( final int dim, final int chunkX, final int chunkZ ) + public Collection getNearByMeteorites( final int Dimension, final int chunkX, final int chunkZ ) { - final Collection ll = new ArrayList<>(); + final Collection ll = new ArrayList<>(); synchronized( SpawnData.class ) { @@ -112,7 +112,7 @@ final class SpawnData implements IWorldSpawnData final int cx = x + ( chunkX >> 4 ); final int cz = z + ( chunkZ >> 4 ); - final NBTTagCompound data = this.loadSpawnData( dim, cx << 4, cz << 4 ); + final CompoundNBT data = this.loadSpawnData( dim, cx << 4, cz << 4 ); if( data != null ) { @@ -130,14 +130,14 @@ final class SpawnData implements IWorldSpawnData return ll; } - private NBTTagCompound loadSpawnData( final int dim, final int chunkX, final int chunkZ ) + private CompoundNBT loadSpawnData( final int dim, final int chunkX, final int chunkZ ) { if( !Thread.holdsLock( SpawnData.class ) ) { throw new IllegalStateException( "Invalid Request" ); } - NBTTagCompound data = null; + CompoundNBT data = null; final String fileName = this.encoder.encode( dim, chunkX, chunkZ ); final File file = new File( this.spawnDirectory, fileName ); @@ -152,7 +152,7 @@ final class SpawnData implements IWorldSpawnData } catch( final Throwable e ) { - data = new NBTTagCompound(); + data = new CompoundNBT(); AELog.debug( e ); } finally @@ -172,13 +172,13 @@ final class SpawnData implements IWorldSpawnData } else { - data = new NBTTagCompound(); + data = new CompoundNBT(); } return data; } - private void writeSpawnData( final int dim, final int chunkX, final int chunkZ, final NBTTagCompound data ) + private void writeSpawnData( final int dim, final int chunkX, final int chunkZ, final CompoundNBT data ) { if( !Thread.holdsLock( SpawnData.class ) ) { diff --git a/src/main/java/appeng/crafting/CraftBranchFailure.java b/src/main/java/appeng/crafting/CraftBranchFailure.java index c04916783..090c445c1 100644 --- a/src/main/java/appeng/crafting/CraftBranchFailure.java +++ b/src/main/java/appeng/crafting/CraftBranchFailure.java @@ -31,7 +31,7 @@ public class CraftBranchFailure extends Exception public CraftBranchFailure( final IAEItemStack what, final long howMany ) { - super( "Failed: " + what.getItem().getUnlocalizedName() + " x " + howMany ); + super( "Failed: " + what.getItem().getRegistryName() + " x " + howMany ); this.missing = what.copy(); this.missing.setStackSize( howMany ); } diff --git a/src/main/java/appeng/crafting/CraftingJob.java b/src/main/java/appeng/crafting/CraftingJob.java index 8755f824b..abe751200 100644 --- a/src/main/java/appeng/crafting/CraftingJob.java +++ b/src/main/java/appeng/crafting/CraftingJob.java @@ -24,8 +24,8 @@ import java.util.concurrent.TimeUnit; import com.google.common.base.Stopwatch; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.world.World; import appeng.api.AEApi; @@ -108,7 +108,7 @@ public class CraftingJob implements Runnable, ICraftingJob return this.availableCheck.extractItems( available, Actionable.MODULATE, this.actionSrc ); } - public void writeToNBT( final NBTTagCompound out ) + public void writeToNBT( final CompoundNBT out ) { } @@ -377,7 +377,7 @@ public class CraftingJob implements Runnable, ICraftingJob if( this.actionSrc.player().isPresent() ) { - final EntityPlayer player = this.actionSrc.player().get(); + final PlayerEntity player = this.actionSrc.player().get(); actionSource = player.toString(); } diff --git a/src/main/java/appeng/crafting/CraftingLink.java b/src/main/java/appeng/crafting/CraftingLink.java index 56fb5d500..5810364b3 100644 --- a/src/main/java/appeng/crafting/CraftingLink.java +++ b/src/main/java/appeng/crafting/CraftingLink.java @@ -19,7 +19,7 @@ package appeng.crafting; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.config.Actionable; import appeng.api.networking.crafting.ICraftingCPU; @@ -39,14 +39,14 @@ public class CraftingLink implements ICraftingLink private boolean done = false; private CraftingLinkNexus tie; - public CraftingLink( final NBTTagCompound data, final ICraftingRequester req ) + public CraftingLink( final CompoundNBT data, final ICraftingRequester req ) { this.CraftID = data.getString( "CraftID" ); this.setCanceled( data.getBoolean( "canceled" ) ); this.setDone( data.getBoolean( "done" ) ); this.standalone = data.getBoolean( "standalone" ); - if( !data.hasKey( "req" ) || !data.getBoolean( "req" ) ) + if( !data.contains( "req" ) || !data.getBoolean( "req" ) ) { throw new IllegalStateException( "Invalid Crafting Link for Object" ); } @@ -55,14 +55,14 @@ public class CraftingLink implements ICraftingLink this.cpu = null; } - public CraftingLink( final NBTTagCompound data, final ICraftingCPU cpu ) + public CraftingLink( final CompoundNBT data, final ICraftingCPU cpu ) { this.CraftID = data.getString( "CraftID" ); this.setCanceled( data.getBoolean( "canceled" ) ); this.setDone( data.getBoolean( "done" ) ); this.standalone = data.getBoolean( "standalone" ); - if( !data.hasKey( "req" ) || data.getBoolean( "req" ) ) + if( !data.contains( "req" ) || data.getBoolean( "req" ) ) { throw new IllegalStateException( "Invalid Crafting Link for Object" ); } @@ -138,13 +138,13 @@ public class CraftingLink implements ICraftingLink } @Override - public void writeToNBT( final NBTTagCompound tag ) + public void writeToNBT( final CompoundNBT tag ) { - tag.setString( "CraftID", this.CraftID ); - tag.setBoolean( "canceled", this.isCanceled() ); - tag.setBoolean( "done", this.isDone() ); - tag.setBoolean( "standalone", this.standalone ); - tag.setBoolean( "req", this.getRequester() != null ); + tag.putString( "CraftID", this.CraftID ); + tag.putBoolean( "canceled", this.isCanceled() ); + tag.putBoolean( "done", this.isDone() ); + tag.putBoolean( "standalone", this.standalone ); + tag.putBoolean( "req", this.getRequester() != null ); } @Override diff --git a/src/main/java/appeng/crafting/CraftingTreeProcess.java b/src/main/java/appeng/crafting/CraftingTreeProcess.java index 7f0c2936b..704f27e9f 100644 --- a/src/main/java/appeng/crafting/CraftingTreeProcess.java +++ b/src/main/java/appeng/crafting/CraftingTreeProcess.java @@ -23,11 +23,11 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.inventory.CraftingInventory; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.fml.hooks.BasicEventHooks; import appeng.api.AEApi; import appeng.api.config.Actionable; @@ -70,14 +70,14 @@ public class CraftingTreeProcess { final IAEItemStack[] list = details.getInputs(); - final InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 ); + final CraftingInventory ic = new CraftingInventory( new ContainerNull(), 3, 3 ); final IAEItemStack[] is = details.getInputs(); for( int x = 0; x < ic.getSizeInventory(); x++ ) { ic.setInventorySlotContents( x, is[x] == null ? ItemStack.EMPTY : is[x].createItemStack() ); } - FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) world ), details.getOutput( ic, world ), ic ); + BasicEventHooks.firePlayerCraftingEvent( Platform.getPlayer( (ServerWorld) world ), details.getOutput( ic, world ), ic ); for( int x = 0; x < ic.getSizeInventory(); x++ ) { @@ -191,7 +191,7 @@ public class CraftingTreeProcess if( this.fullSimulation ) { - final InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 ); + final CraftingInventory ic = new CraftingInventory( new ContainerNull(), 3, 3 ); for( final Entry entry : this.nodes.entrySet() ) { @@ -201,7 +201,7 @@ public class CraftingTreeProcess ic.setInventorySlotContents( entry.getKey().getSlot(), stack.createItemStack() ); } - FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) this.world ), this.details.getOutput( ic, this.world ), ic ); + BasicEventHooks.firePlayerCraftingEvent( Platform.getPlayer( (ServerWorld) this.world ), this.details.getOutput( ic, this.world ), ic ); for( int x = 0; x < ic.getSizeInventory(); x++ ) { diff --git a/src/main/java/appeng/debug/BlockCubeGenerator.java b/src/main/java/appeng/debug/BlockCubeGenerator.java index bd0583b7e..b682a6f2a 100644 --- a/src/main/java/appeng/debug/BlockCubeGenerator.java +++ b/src/main/java/appeng/debug/BlockCubeGenerator.java @@ -22,10 +22,10 @@ package appeng.debug; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -41,7 +41,7 @@ public class BlockCubeGenerator extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { final TileCubeGenerator tcg = this.getTileEntity( w, pos ); if( tcg != null ) diff --git a/src/main/java/appeng/debug/BlockPhantomNode.java b/src/main/java/appeng/debug/BlockPhantomNode.java index 88a8a14b6..4a1482503 100644 --- a/src/main/java/appeng/debug/BlockPhantomNode.java +++ b/src/main/java/appeng/debug/BlockPhantomNode.java @@ -22,10 +22,10 @@ package appeng.debug; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.world.World; @@ -41,7 +41,7 @@ public class BlockPhantomNode extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { final TilePhantomNode tpn = this.getTileEntity( w, pos ); tpn.triggerCrashMode(); diff --git a/src/main/java/appeng/debug/TileChunkLoader.java b/src/main/java/appeng/debug/TileChunkLoader.java index 0fcb5e7c2..58cccd1ba 100644 --- a/src/main/java/appeng/debug/TileChunkLoader.java +++ b/src/main/java/appeng/debug/TileChunkLoader.java @@ -21,7 +21,7 @@ package appeng.debug; import java.util.List; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.server.MinecraftServer; import net.minecraft.util.ITickable; import net.minecraft.util.math.ChunkPos; @@ -67,8 +67,8 @@ public class TileChunkLoader extends AEBaseTile implements ITickable final MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if( server != null ) { - final List pl = server.getPlayerList().getPlayers(); - for( final EntityPlayerMP p : pl ) + final List pl = server.getPlayerList().getPlayers(); + for( final PlayerEntityMP p : pl ) { p.sendMessage( new TextComponentString( "Can't chunk load.." ) ); } diff --git a/src/main/java/appeng/debug/TileCubeGenerator.java b/src/main/java/appeng/debug/TileCubeGenerator.java index 23b6b1816..38563372a 100644 --- a/src/main/java/appeng/debug/TileCubeGenerator.java +++ b/src/main/java/appeng/debug/TileCubeGenerator.java @@ -19,11 +19,11 @@ package appeng.debug; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; @@ -39,7 +39,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable private int size = 3; private ItemStack is = ItemStack.EMPTY; private int countdown = 20 * 10; - private EntityPlayer who = null; + private PlayerEntity who = null; @Override public void update() @@ -50,7 +50,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable if( this.countdown % 20 == 0 ) { - for( final EntityPlayer e : AppEng.proxy.getPlayers() ) + for( final PlayerEntity e : AppEng.proxy.getPlayers() ) { e.sendMessage( new TextComponentString( "Spawning in... " + ( this.countdown / 20 ) ) ); } @@ -68,7 +68,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable this.world.setBlockToAir( this.pos ); final Item i = this.is.getItem(); - final EnumFacing side = EnumFacing.UP; + final Direction side = Direction.UP; final int half = (int) Math.floor( this.size / 2 ); @@ -79,13 +79,13 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable for( int z = -half; z < half; z++ ) { final BlockPos p = this.pos.add( x, y - 1, z ); - i.onItemUse( this.who, this.world, p, EnumHand.MAIN_HAND, side, 0.5f, 0.0f, 0.5f ); + i.onItemUse( this.who, this.world, p, Hand.MAIN_HAND, side, 0.5f, 0.0f, 0.5f ); } } } } - void click( final EntityPlayer player ) + void click( final PlayerEntity player ) { if( Platform.isServer() ) { @@ -96,7 +96,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable { this.is = ItemStack.EMPTY; - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { this.size--; } diff --git a/src/main/java/appeng/debug/TileEnergyGenerator.java b/src/main/java/appeng/debug/TileEnergyGenerator.java index ce78a78fc..44227ca2d 100644 --- a/src/main/java/appeng/debug/TileEnergyGenerator.java +++ b/src/main/java/appeng/debug/TileEnergyGenerator.java @@ -26,7 +26,7 @@ import javax.annotation.Nullable; import com.google.common.math.IntMath; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.CapabilityEnergy; @@ -47,9 +47,9 @@ public class TileEnergyGenerator extends AEBaseTile implements ITickable, IEnerg public void update() { int tier = 1; - final EnumSet validEnergyReceivers = EnumSet.noneOf( EnumFacing.class ); + final EnumSet validEnergyReceivers = EnumSet.noneOf( Direction.class ); - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) ); @@ -67,7 +67,7 @@ public class TileEnergyGenerator extends AEBaseTile implements ITickable, IEnerg final int energyToInsert = IntMath.pow( BASE_ENERGY, tier ); - for( EnumFacing facing : validEnergyReceivers ) + for( Direction facing : validEnergyReceivers ) { final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) ); final IEnergyStorage cap = te.getCapability( CapabilityEnergy.ENERGY, facing.getOpposite() ); @@ -81,7 +81,7 @@ public class TileEnergyGenerator extends AEBaseTile implements ITickable, IEnerg } @Override - public boolean hasCapability( Capability capability, @Nullable EnumFacing facing ) + public boolean hasCapability( Capability capability, @Nullable Direction facing ) { if( capability == CapabilityEnergy.ENERGY ) { @@ -92,7 +92,7 @@ public class TileEnergyGenerator extends AEBaseTile implements ITickable, IEnerg @Override @Nullable - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { if( capability == CapabilityEnergy.ENERGY ) { diff --git a/src/main/java/appeng/debug/TileItemGen.java b/src/main/java/appeng/debug/TileItemGen.java index 92819aedb..915704b6e 100644 --- a/src/main/java/appeng/debug/TileItemGen.java +++ b/src/main/java/appeng/debug/TileItemGen.java @@ -25,10 +25,10 @@ import java.util.Queue; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.init.Items; +import net.minecraft.item.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.NonNullList; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; @@ -72,7 +72,7 @@ public class TileItemGen extends AEBaseTile } @Override - public boolean hasCapability( Capability capability, @Nullable EnumFacing facing ) + public boolean hasCapability( Capability capability, @Nullable Direction facing ) { if( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability ) { @@ -83,7 +83,7 @@ public class TileItemGen extends AEBaseTile @Override @Nullable - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { if( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY == capability ) { diff --git a/src/main/java/appeng/debug/TilePhantomNode.java b/src/main/java/appeng/debug/TilePhantomNode.java index 2e84c2fd6..13854a935 100644 --- a/src/main/java/appeng/debug/TilePhantomNode.java +++ b/src/main/java/appeng/debug/TilePhantomNode.java @@ -21,7 +21,7 @@ package appeng.debug; import java.util.EnumSet; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.networking.IGridNode; import appeng.api.util.AEPartLocation; @@ -60,7 +60,7 @@ public class TilePhantomNode extends AENetworkTile if( this.proxy != null ) { this.crashMode = true; - this.proxy.setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.proxy.setValidSides( EnumSet.allOf( Direction.class ) ); } } } diff --git a/src/main/java/appeng/debug/ToolDebugCard.java b/src/main/java/appeng/debug/ToolDebugCard.java index 57c8e4767..92f95dd06 100644 --- a/src/main/java/appeng/debug/ToolDebugCard.java +++ b/src/main/java/appeng/debug/ToolDebugCard.java @@ -23,11 +23,11 @@ import java.util.HashSet; import java.util.Set; import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; 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.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; @@ -56,14 +56,14 @@ import appeng.util.Platform; public class ToolDebugCard extends AEBaseItem { @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { if( Platform.isClient() ) { return EnumActionResult.PASS; } - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { int grids = 0; int totalNodes = 0; diff --git a/src/main/java/appeng/debug/ToolEraser.java b/src/main/java/appeng/debug/ToolEraser.java index 4d4f29f1b..8ac40d7d1 100644 --- a/src/main/java/appeng/debug/ToolEraser.java +++ b/src/main/java/appeng/debug/ToolEraser.java @@ -22,11 +22,11 @@ package appeng.debug; import java.util.ArrayList; import java.util.List; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; 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.BlockPos; import net.minecraft.world.World; @@ -41,14 +41,14 @@ public class ToolEraser extends AEBaseItem private static final int BLOCK_ERASE_LIMIT = 90000; @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { if( Platform.isClient() ) { return EnumActionResult.PASS; } - final IBlockState state = world.getBlockState( pos ); + final BlockState state = world.getBlockState( pos ); List next = new ArrayList<>(); next.add( pos ); @@ -61,7 +61,7 @@ public class ToolEraser extends AEBaseItem for( final BlockPos wc : c ) { - final IBlockState c_state = world.getBlockState( wc ); + final BlockState c_state = world.getBlockState( wc ); if( state == c_state ) { diff --git a/src/main/java/appeng/debug/ToolMeteoritePlacer.java b/src/main/java/appeng/debug/ToolMeteoritePlacer.java index af7dbecf2..a6a593211 100644 --- a/src/main/java/appeng/debug/ToolMeteoritePlacer.java +++ b/src/main/java/appeng/debug/ToolMeteoritePlacer.java @@ -19,10 +19,10 @@ package appeng.debug; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; 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.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; @@ -36,7 +36,7 @@ import appeng.worldgen.meteorite.StandardWorld; public class ToolMeteoritePlacer extends AEBaseItem { @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { if( Platform.isClient() ) { diff --git a/src/main/java/appeng/debug/ToolReplicatorCard.java b/src/main/java/appeng/debug/ToolReplicatorCard.java index 9b1f834ec..5c187761e 100644 --- a/src/main/java/appeng/debug/ToolReplicatorCard.java +++ b/src/main/java/appeng/debug/ToolReplicatorCard.java @@ -20,14 +20,14 @@ package appeng.debug; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.player.PlayerEntity; +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.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; @@ -46,7 +46,7 @@ import appeng.util.Platform; public class ToolReplicatorCard extends AEBaseItem { @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { if( Platform.isClient() ) { @@ -57,11 +57,11 @@ public class ToolReplicatorCard extends AEBaseItem int y = pos.getY(); int z = pos.getZ(); - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { if( world.getTileEntity( pos ) instanceof IGridHost ) { - final NBTTagCompound tag = new NBTTagCompound(); + final CompoundNBT tag = new CompoundNBT(); tag.setInteger( "x", x ); tag.setInteger( "y", y ); tag.setInteger( "z", z ); @@ -76,7 +76,7 @@ public class ToolReplicatorCard extends AEBaseItem } else { - final NBTTagCompound ish = player.getHeldItem( hand ).getTagCompound(); + final CompoundNBT ish = player.getHeldItem( hand ).getTagCompound(); if( ish != null ) { final int src_x = ish.getInteger( "x" ); @@ -90,8 +90,8 @@ public class ToolReplicatorCard extends AEBaseItem if( te instanceof IGridHost ) { final IGridHost gh = (IGridHost) te; - final EnumFacing sideOff = EnumFacing.VALUES[src_side]; - final EnumFacing currentSideOff = side; + final Direction sideOff = Direction.VALUES[src_side]; + final Direction currentSideOff = side; final IGridNode n = gh.getGridNode( AEPartLocation.fromFacing( sideOff ) ); if( n != null ) { @@ -128,16 +128,16 @@ public class ToolReplicatorCard extends AEBaseItem { final BlockPos p = new BlockPos( min_x + i, min_y + j, min_z + k ); final BlockPos d = new BlockPos( i + rel_x, j + rel_y, k + rel_z ); - final IBlockState state = src_w.getBlockState( p ); + final BlockState state = src_w.getBlockState( p ); final Block blk = state.getBlock(); - final IBlockState prev = world.getBlockState( d ); + final BlockState prev = world.getBlockState( d ); world.setBlockState( d, state ); if( blk != null && blk.hasTileEntity( state ) ) { final TileEntity ote = src_w.getTileEntity( p ); final TileEntity nte = blk.createTileEntity( world, state ); - final NBTTagCompound data = new NBTTagCompound(); + final CompoundNBT data = new CompoundNBT(); ote.writeToNBT( data ); nte.readFromNBT( data.copy() ); world.setTileEntity( d, nte ); diff --git a/src/main/java/appeng/block/AEBaseStairBlock.java b/src/main/java/appeng/decorative/AEBaseStairBlock.java similarity index 84% rename from src/main/java/appeng/block/AEBaseStairBlock.java rename to src/main/java/appeng/decorative/AEBaseStairBlock.java index b426dd23b..d8710b926 100644 --- a/src/main/java/appeng/block/AEBaseStairBlock.java +++ b/src/main/java/appeng/decorative/AEBaseStairBlock.java @@ -16,16 +16,16 @@ * along with Applied Energistics 2. If not, see . */ -package appeng.block; +package appeng.decorative; import com.google.common.base.Preconditions; import net.minecraft.block.Block; -import net.minecraft.block.BlockStairs; +import net.minecraft.block.StairsBlock; -public abstract class AEBaseStairBlock extends BlockStairs +public abstract class AEBaseStairBlock extends StairsBlock { protected AEBaseStairBlock( final Block block, final String type ) @@ -33,8 +33,8 @@ public abstract class AEBaseStairBlock extends BlockStairs super( block.getDefaultState() ); Preconditions.checkNotNull( block ); - Preconditions.checkNotNull( block.getUnlocalizedName() ); - Preconditions.checkArgument( block.getUnlocalizedName().length() > 0 ); + Preconditions.checkNotNull( block.getTranslationKey() ); + Preconditions.checkArgument( block.getTranslationKey().length() > 0 ); this.setUnlocalizedName( "stair." + type ); this.setLightOpacity( 0 ); diff --git a/src/main/java/appeng/block/AEDecorativeBlock.java b/src/main/java/appeng/decorative/AEDecorativeBlock.java similarity index 94% rename from src/main/java/appeng/block/AEDecorativeBlock.java rename to src/main/java/appeng/decorative/AEDecorativeBlock.java index 3a554d71d..43e3c3abc 100644 --- a/src/main/java/appeng/block/AEDecorativeBlock.java +++ b/src/main/java/appeng/decorative/AEDecorativeBlock.java @@ -16,11 +16,13 @@ * along with Applied Energistics 2. If not, see . */ -package appeng.block; +package appeng.decorative; import net.minecraft.block.material.Material; +import appeng.block.AEBaseBlock; + public abstract class AEDecorativeBlock extends AEBaseBlock { diff --git a/src/main/java/appeng/decorative/slab/BlockSlabCommon.java b/src/main/java/appeng/decorative/slab/CommonSlabBlock.java similarity index 61% rename from src/main/java/appeng/decorative/slab/BlockSlabCommon.java rename to src/main/java/appeng/decorative/slab/CommonSlabBlock.java index 56d3e5035..20c3c79ee 100644 --- a/src/main/java/appeng/decorative/slab/BlockSlabCommon.java +++ b/src/main/java/appeng/decorative/slab/CommonSlabBlock.java @@ -8,37 +8,35 @@ import javax.annotation.Nullable; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.SlabBlock; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.state.IProperty; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public abstract class BlockSlabCommon extends BlockSlab +public abstract class CommonSlabBlock extends SlabBlock { - static final PropertyEnum VARIANT = PropertyEnum.create( "variant", Variant.class ); - - private BlockSlabCommon( Block block ) + private CommonSlabBlock( Block block ) { super( block.getMaterial( block.getDefaultState() ) ); this.setHardness( block.getBlockHardness( block.getDefaultState(), null, null ) ); this.setResistance( block.getExplosionResistance( null ) * 5.0F / 3.0F ); - IBlockState iblockstate = this.blockState.getBaseState(); + BlockState BlockState = this.blockState.getBaseState(); if( !this.isDouble() ) { - iblockstate = iblockstate.withProperty( HALF, BlockSlab.EnumBlockHalf.BOTTOM ); + BlockState = BlockState.withProperty( HALF, BlockSlab.EnumBlockHalf.BOTTOM ); } - this.setDefaultState( iblockstate.withProperty( VARIANT, Variant.DEFAULT ) ); + this.setDefaultState( BlockState.withProperty( VARIANT, Variant.DEFAULT ) ); this.setCreativeTab( CreativeTabs.BUILDING_BLOCKS ); this.useNeighborBrightness = true; } @@ -47,23 +45,23 @@ public abstract class BlockSlabCommon extends BlockSlab * Convert the given metadata into a BlockState for this Block */ @Override - public IBlockState getStateFromMeta( int meta ) + public BlockState getStateFromMeta( int meta ) { - IBlockState iblockstate = this.getDefaultState().withProperty( VARIANT, Variant.DEFAULT ); + BlockState BlockState = this.getDefaultState().withProperty( VARIANT, Variant.DEFAULT ); if( !this.isDouble() ) { - iblockstate = iblockstate.withProperty( HALF, ( meta & 8 ) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP ); + BlockState = BlockState.withProperty( HALF, ( meta & 8 ) == 0 ? BlockSlab.EnumBlockHalf.BOTTOM : BlockSlab.EnumBlockHalf.TOP ); } - return iblockstate; + return BlockState; } /** * Convert the BlockState into the correct metadata value */ @Override - public int getMetaFromState( IBlockState state ) + public int getMetaFromState( BlockState state ) { int i = 0; @@ -83,21 +81,21 @@ public abstract class BlockSlabCommon extends BlockSlab @Override @Nullable - public Item getItemDropped( IBlockState state, Random rand, int fortune ) + public Item getItemDropped( BlockState state, Random rand, int fortune ) { return Item.getItemFromBlock( this ); } @Override - public ItemStack getItem( World worldIn, BlockPos pos, IBlockState state ) + public ItemStack getItem( World worldIn, BlockPos pos, BlockState state ) { return new ItemStack( this, 1, 0 ); } @Override - public String getUnlocalizedName( int meta ) + public String getTranslationKey( int meta ) { - return this.getUnlocalizedName(); + return this.getTranslationKey(); } @Override @@ -112,7 +110,7 @@ public abstract class BlockSlabCommon extends BlockSlab return Variant.DEFAULT; } - public static class Double extends BlockSlabCommon + public static class Double extends CommonSlabBlock { private final Block halfSlabBlock; @@ -131,20 +129,20 @@ public abstract class BlockSlabCommon extends BlockSlab @Override @Nullable - public Item getItemDropped( IBlockState state, Random rand, int fortune ) + public Item getItemDropped( BlockState state, Random rand, int fortune ) { return Item.getItemFromBlock( this.halfSlabBlock ); } @Override - public ItemStack getItem( World worldIn, BlockPos pos, IBlockState state ) + public ItemStack getItem( World worldIn, BlockPos pos, BlockState state ) { return new ItemStack( this.halfSlabBlock, 1, 0 ); } } - public static class Half extends BlockSlabCommon + public static class Half extends CommonSlabBlock { public Half( Block block ) diff --git a/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java b/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java index c697e43e0..4acaf95fb 100644 --- a/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java +++ b/src/main/java/appeng/decorative/solid/BlockChargedQuartzOre.java @@ -21,16 +21,16 @@ package appeng.decorative.solid; import java.util.Random; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; 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.AEApi; import appeng.api.exceptions.MissingDefinitionException; @@ -42,7 +42,7 @@ import appeng.core.AppEng; public class BlockChargedQuartzOre extends BlockQuartzOre { @Override - public Item getItemDropped( final IBlockState state, final Random rand, final int fortune ) + public Item getItemDropped( final BlockState state, final Random rand, final int fortune ) { return AEApi.instance() .definitions() @@ -53,7 +53,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre } @Override - public int damageDropped( final IBlockState state ) + public int damageDropped( final BlockState state ) { return AEApi.instance() .definitions() @@ -65,7 +65,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre } @Override - public ItemStack getPickBlock( IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player ) + public ItemStack getPickBlock( BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player ) { return AEApi.instance() .definitions() @@ -76,8 +76,8 @@ public class BlockChargedQuartzOre extends BlockQuartzOre } @Override - @SideOnly( Side.CLIENT ) - public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r ) + @OnlyIn( Dist.CLIENT ) + public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r ) { if( !AEConfig.instance().isEnableEffects() ) { @@ -116,7 +116,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre if( AppEng.proxy.shouldAddParticles( r ) ) { final ChargedOreFX fx = new ChargedOreFX( w, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } } diff --git a/src/main/java/appeng/decorative/solid/BlockChiseledQuartz.java b/src/main/java/appeng/decorative/solid/BlockChiseledQuartz.java index 23860df01..0fc08c7ab 100644 --- a/src/main/java/appeng/decorative/solid/BlockChiseledQuartz.java +++ b/src/main/java/appeng/decorative/solid/BlockChiseledQuartz.java @@ -21,7 +21,7 @@ package appeng.decorative.solid; import net.minecraft.block.material.Material; -import appeng.block.AEDecorativeBlock; +import appeng.decorative.AEDecorativeBlock; public final class BlockChiseledQuartz extends AEDecorativeBlock diff --git a/src/main/java/appeng/decorative/solid/BlockFluix.java b/src/main/java/appeng/decorative/solid/BlockFluix.java index bf063ed0c..ecf4ab982 100644 --- a/src/main/java/appeng/decorative/solid/BlockFluix.java +++ b/src/main/java/appeng/decorative/solid/BlockFluix.java @@ -21,7 +21,7 @@ package appeng.decorative.solid; import net.minecraft.block.material.Material; -import appeng.block.AEDecorativeBlock; +import appeng.decorative.AEDecorativeBlock; public final class BlockFluix extends AEDecorativeBlock diff --git a/src/main/java/appeng/decorative/solid/BlockQuartz.java b/src/main/java/appeng/decorative/solid/BlockQuartz.java index aab29e92d..71c31bc30 100644 --- a/src/main/java/appeng/decorative/solid/BlockQuartz.java +++ b/src/main/java/appeng/decorative/solid/BlockQuartz.java @@ -21,7 +21,7 @@ package appeng.decorative.solid; import net.minecraft.block.material.Material; -import appeng.block.AEDecorativeBlock; +import appeng.decorative.AEDecorativeBlock; public final class BlockQuartz extends AEDecorativeBlock diff --git a/src/main/java/appeng/decorative/solid/BlockQuartzGlass.java b/src/main/java/appeng/decorative/solid/BlockQuartzGlass.java index e1e959f6e..b8f8d9ba1 100644 --- a/src/main/java/appeng/decorative/solid/BlockQuartzGlass.java +++ b/src/main/java/appeng/decorative/solid/BlockQuartzGlass.java @@ -23,12 +23,11 @@ import java.util.EnumSet; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; +import net.minecraft.block.BlockStateContainer; +import net.minecraft.block.BlockState; +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.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; @@ -59,12 +58,12 @@ public class BlockQuartzGlass extends AEBaseBlock } @Override - public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos ) + public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos ) { - EnumSet flushWith = EnumSet.noneOf( EnumFacing.class ); + EnumSet flushWith = EnumSet.noneOf( Direction.class ); // Test every direction for another glass block - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { if( isGlassBlock( world, pos, facing ) ) { @@ -79,7 +78,7 @@ public class BlockQuartzGlass extends AEBaseBlock return extState.withProperty( GLASS_STATE, glassState ); } - private static boolean isGlassBlock( IBlockAccess world, BlockPos pos, EnumFacing facing ) + private static boolean isGlassBlock( IBlockReader world, BlockPos pos, Direction facing ) { return world.getBlockState( pos.offset( facing ) ).getBlock() instanceof BlockQuartzGlass; } @@ -91,7 +90,7 @@ public class BlockQuartzGlass extends AEBaseBlock } @Override - public boolean shouldSideBeRendered( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side ) + public boolean shouldSideBeRendered( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side ) { BlockPos adjacentPos = pos.offset( side ); @@ -109,7 +108,7 @@ public class BlockQuartzGlass extends AEBaseBlock } @Override - public boolean isFullCube( IBlockState state ) + public boolean isFullCube( BlockState state ) { return false; } diff --git a/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java b/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java index 5c13093f5..42dfac145 100644 --- a/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java +++ b/src/main/java/appeng/decorative/solid/BlockQuartzLamp.java @@ -21,12 +21,12 @@ package appeng.decorative.solid; import java.util.Random; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.util.math.BlockPos; 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.client.render.effects.VibrantFX; import appeng.core.AEConfig; @@ -42,8 +42,8 @@ public class BlockQuartzLamp extends BlockQuartzGlass } @Override - @SideOnly( Side.CLIENT ) - public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r ) + @OnlyIn( Dist.CLIENT ) + public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r ) { if( !AEConfig.instance().isEnableEffects() ) { @@ -58,7 +58,7 @@ public class BlockQuartzLamp extends BlockQuartzGlass final VibrantFX fx = new VibrantFX( w, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D ); - Minecraft.getMinecraft().effectRenderer.addEffect( fx ); + Minecraft.getInstance().effectRenderer.addEffect( fx ); } } } diff --git a/src/main/java/appeng/decorative/solid/BlockQuartzOre.java b/src/main/java/appeng/decorative/solid/BlockQuartzOre.java index b4e631ad5..3fbe688f0 100644 --- a/src/main/java/appeng/decorative/solid/BlockQuartzOre.java +++ b/src/main/java/appeng/decorative/solid/BlockQuartzOre.java @@ -22,12 +22,12 @@ package appeng.decorative.solid; import java.util.Random; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.item.Item; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import appeng.api.AEApi; @@ -51,7 +51,7 @@ public class BlockQuartzOre extends AEBaseBlock } @Override - public int quantityDropped( IBlockState state, int fortune, Random rand ) + public int quantityDropped( BlockState state, int fortune, Random rand ) { if( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( null, rand, fortune ) ) { @@ -77,7 +77,7 @@ public class BlockQuartzOre extends AEBaseBlock } @Override - public int getExpDrop( IBlockState state, IBlockAccess world, BlockPos pos, int fortune ) + public int getExpDrop( BlockState state, IBlockReader world, BlockPos pos, int fortune ) { Random rand = world instanceof World ? ( (World) world ).rand : new Random(); @@ -89,7 +89,7 @@ public class BlockQuartzOre extends AEBaseBlock } @Override - public Item getItemDropped( final IBlockState state, final Random rand, final int fortune ) + public Item getItemDropped( final BlockState state, final Random rand, final int fortune ) { return AEApi.instance() .definitions() @@ -100,7 +100,7 @@ public class BlockQuartzOre extends AEBaseBlock } @Override - public int damageDropped( final IBlockState state ) + public int damageDropped( final BlockState state ) { return AEApi.instance() .definitions() diff --git a/src/main/java/appeng/decorative/solid/BlockQuartzPillar.java b/src/main/java/appeng/decorative/solid/BlockQuartzPillar.java index 479c9e6c2..3caef9c81 100644 --- a/src/main/java/appeng/decorative/solid/BlockQuartzPillar.java +++ b/src/main/java/appeng/decorative/solid/BlockQuartzPillar.java @@ -20,12 +20,12 @@ package appeng.decorative.solid; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyEnum; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; +import net.minecraft.state.EnumProperty; +import net.minecraft.state.IProperty; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import appeng.api.util.IOrientable; import appeng.api.util.IOrientableBlock; @@ -35,33 +35,20 @@ import appeng.helpers.MetaRotation; public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock { - public static final PropertyEnum AXIS_ORIENTATION = PropertyEnum.create( "axis", EnumFacing.Axis.class ); + public static final EnumProperty AXIS = BlockStateProperties.AXIS; public BlockQuartzPillar() { super( Material.ROCK ); + // The upwards facing pillar is the default (i.e. for the item model) - this.setDefaultState( this.getDefaultState().withProperty( AXIS_ORIENTATION, EnumFacing.Axis.Y ) ); - } - - @Override - public int getMetaFromState( final IBlockState state ) - { - return state.getValue( AXIS_ORIENTATION ).ordinal(); - } - - @Override - public IBlockState getStateFromMeta( final int meta ) - { - // Simply use the ordinal here - EnumFacing.Axis axis = EnumFacing.Axis.values()[meta]; - return this.getDefaultState().withProperty( AXIS_ORIENTATION, axis ); + this.setDefaultState( this.getDefaultState().with( AXIS, Direction.Axis.Y ) ); } @Override protected IProperty[] getAEStates() { - return new IProperty[] { AXIS_ORIENTATION }; + return new IProperty[] { AXIS }; } @Override @@ -71,7 +58,7 @@ public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock } @Override - public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos ) + public IOrientable getOrientable( final IBlockReader w, final BlockPos pos ) { return new MetaRotation( w, pos, null ); } diff --git a/src/main/java/appeng/decorative/solid/BlockSkyStone.java b/src/main/java/appeng/decorative/solid/BlockSkyStone.java index aee4b76b3..ee8cdaca6 100644 --- a/src/main/java/appeng/decorative/solid/BlockSkyStone.java +++ b/src/main/java/appeng/decorative/solid/BlockSkyStone.java @@ -20,7 +20,7 @@ package appeng.decorative.solid; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; @@ -59,14 +59,14 @@ public class BlockSkyStone extends AEBaseBlock @SubscribeEvent public void breakFaster( final PlayerEvent.BreakSpeed event ) { - if( event.getState().getBlock() == this && event.getEntityPlayer() != null ) + if( event.getState().getBlock() == this && event.getPlayerEntity() != null ) { - final ItemStack is = event.getEntityPlayer().getItemStackFromSlot( EntityEquipmentSlot.MAINHAND ); + final ItemStack is = event.getPlayerEntity().getItemStackFromSlot( EntityEquipmentSlot.MAINHAND ); int level = -1; if( !is.isEmpty() ) { - level = is.getItem().getHarvestLevel( is, "pickaxe", event.getEntityPlayer(), event.getState() ); + level = is.getItem().getHarvestLevel( is, "pickaxe", event.getPlayerEntity(), event.getState() ); } if( this.type != SkystoneType.STONE || level >= 3 || event.getOriginalSpeed() > BREAK_SPEAK_THRESHOLD ) @@ -77,7 +77,7 @@ public class BlockSkyStone extends AEBaseBlock } @Override - public void onBlockAdded( final World w, final BlockPos pos, final IBlockState state ) + public void onBlockAdded( final World w, final BlockPos pos, final BlockState state ) { super.onBlockAdded( w, pos, state ); if( Platform.isServer() ) @@ -87,7 +87,7 @@ public class BlockSkyStone extends AEBaseBlock } @Override - public void breakBlock( final World w, final BlockPos pos, final IBlockState state ) + public void breakBlock( final World w, final BlockPos pos, final BlockState state ) { super.breakBlock( w, pos, state ); diff --git a/src/main/java/appeng/decorative/solid/GlassState.java b/src/main/java/appeng/decorative/solid/GlassState.java index 11a4d93c9..15c213d85 100644 --- a/src/main/java/appeng/decorative/solid/GlassState.java +++ b/src/main/java/appeng/decorative/solid/GlassState.java @@ -21,7 +21,7 @@ package appeng.decorative.solid; import java.util.EnumSet; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; /** @@ -35,9 +35,9 @@ public final class GlassState private final int y; private final int z; - private final EnumSet flushWith = EnumSet.noneOf( EnumFacing.class ); + private final EnumSet flushWith = EnumSet.noneOf( Direction.class ); - public GlassState( int x, int y, int z, EnumSet flushWith ) + public GlassState( int x, int y, int z, EnumSet flushWith ) { this.x = x; this.y = y; @@ -60,7 +60,7 @@ public final class GlassState return this.z; } - public boolean isFlushWith( EnumFacing side ) + public boolean isFlushWith( Direction side ) { return this.flushWith.contains( side ); } diff --git a/src/main/java/appeng/decorative/stair/BlockStairCommon.java b/src/main/java/appeng/decorative/stair/BlockStairCommon.java index 976424662..ed34524d1 100644 --- a/src/main/java/appeng/decorative/stair/BlockStairCommon.java +++ b/src/main/java/appeng/decorative/stair/BlockStairCommon.java @@ -21,7 +21,7 @@ package appeng.decorative.stair; import net.minecraft.block.Block; -import appeng.block.AEBaseStairBlock; +import appeng.decorative.AEBaseStairBlock; public class BlockStairCommon extends AEBaseStairBlock diff --git a/src/main/java/appeng/entity/AEBaseEntityItem.java b/src/main/java/appeng/entity/AEBaseEntityItem.java index 7223e3cd1..563506a85 100644 --- a/src/main/java/appeng/entity/AEBaseEntityItem.java +++ b/src/main/java/appeng/entity/AEBaseEntityItem.java @@ -22,18 +22,14 @@ package appeng.entity; import java.util.List; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; -public abstract class AEBaseEntityItem extends EntityItem +public abstract class AEBaseEntityItem extends ItemEntity { - public AEBaseEntityItem( final World world ) - { - super( world ); - } public AEBaseEntityItem( final World world, final double x, final double y, final double z, final ItemStack stack ) { diff --git a/src/main/java/appeng/entity/EntityChargedQuartz.java b/src/main/java/appeng/entity/EntityChargedQuartz.java index 50f69befe..f724d4c32 100644 --- a/src/main/java/appeng/entity/EntityChargedQuartz.java +++ b/src/main/java/appeng/entity/EntityChargedQuartz.java @@ -21,12 +21,12 @@ package appeng.entity; import java.util.List; +import net.minecraft.block.BlockState; 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.Items; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -38,7 +38,6 @@ import appeng.client.EffectType; import appeng.core.AEConfig; import appeng.core.AppEng; import appeng.core.features.AEFeature; -import appeng.helpers.Reflected; import appeng.util.Platform; @@ -48,40 +47,34 @@ public final class EntityChargedQuartz extends AEBaseEntityItem private int delay = 0; private int transformTime = 0; - @Reflected - public EntityChargedQuartz( final World w ) - { - super( w ); - } - public EntityChargedQuartz( final World w, final double x, final double y, final double z, final ItemStack is ) { super( w, x, y, z, is ); } @Override - public void onUpdate() + public void tick() { - super.onUpdate(); + super.tick(); - if( this.isDead || !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) ) + if( this.removed || !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) ) { return; } if( Platform.isClient() && this.delay > 30 && AEConfig.instance().isEnableEffects() ) { - AppEng.proxy.spawnEffect( EffectType.Lightning, this.world, this.posX, this.posY, this.posZ, null ); + AppEng.proxy.spawnEffect( EffectType.Lightning, this.world, this.getPosX(), this.getPosY(), this.getPosZ(), null ); this.delay = 0; } this.delay++; - final int j = MathHelper.floor( this.posX ); - final int i = MathHelper.floor( ( this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY ) / 2.0D ); - final int k = MathHelper.floor( this.posZ ); + final int j = MathHelper.floor( this.getPosX() ); + final int i = MathHelper.floor( ( this.getBoundingBox().minY + this.getBoundingBox().maxY ) / 2.0D ); + final int k = MathHelper.floor( this.getPosZ() ); - IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) ); + BlockState state = this.world.getBlockState( new BlockPos( j, i, k ) ); final Material mat = state.getMaterial(); if( Platform.isServer() && mat.isLiquid() ) @@ -108,27 +101,28 @@ public final class EntityChargedQuartz extends AEBaseEntityItem if( materials.certusQuartzCrystalCharged().isSameAs( item ) ) { - final AxisAlignedBB region = new AxisAlignedBB( this.posX - 1, this.posY - 1, this.posZ - 1, this.posX + 1, this.posY + 1, this.posZ + 1 ); + final AxisAlignedBB region = new AxisAlignedBB( this.getPosX() - 1, this.getPosY() - 1, this + .getPosZ() - 1, this.getPosX() + 1, this.getPosY() + 1, this.getPosZ() + 1 ); final List l = this.getCheckedEntitiesWithinAABBExcludingEntity( region ); - EntityItem redstone = null; - EntityItem netherQuartz = null; + ItemEntity redstone = null; + ItemEntity netherQuartz = null; for( final Entity e : l ) { - if( e instanceof EntityItem && !e.isDead ) + if( e instanceof ItemEntity && !e.removed ) { - final ItemStack other = ( (EntityItem) e ).getItem(); + final ItemStack other = ( (ItemEntity) e ).getItem(); if( !other.isEmpty() ) { if( ItemStack.areItemsEqual( other, new ItemStack( Items.REDSTONE ) ) ) { - redstone = (EntityItem) e; + redstone = (ItemEntity) e; } if( ItemStack.areItemsEqual( other, new ItemStack( Items.QUARTZ ) ) ) { - netherQuartz = (EntityItem) e; + netherQuartz = (ItemEntity) e; } } } @@ -142,24 +136,24 @@ public final class EntityChargedQuartz extends AEBaseEntityItem if( this.getItem().getCount() <= 0 ) { - this.setDead(); + this.remove(); } if( redstone.getItem().getCount() <= 0 ) { - redstone.setDead(); + redstone.remove(); } if( netherQuartz.getItem().getCount() <= 0 ) { - netherQuartz.setDead(); + netherQuartz.remove(); } materials.fluixCrystal().maybeStack( 2 ).ifPresent( is -> { - final EntityItem entity = new EntityItem( this.world, this.posX, this.posY, this.posZ, is ); + final ItemEntity entity = new ItemEntity( this.world, this.getPosX(), this.getPosY(), this.getPosZ(), is ); - this.world.spawnEntity( entity ); + this.world.addEntity( entity ); } ); return true; diff --git a/src/main/java/appeng/entity/EntityFloatingItem.java b/src/main/java/appeng/entity/EntityFloatingItem.java index 70be7c6ab..da585a26d 100644 --- a/src/main/java/appeng/entity/EntityFloatingItem.java +++ b/src/main/java/appeng/entity/EntityFloatingItem.java @@ -19,12 +19,12 @@ package appeng.entity; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public final class EntityFloatingItem extends EntityItem +public final class EntityFloatingItem extends ItemEntity { private final ICanDie parent; @@ -34,8 +34,7 @@ public final class EntityFloatingItem extends EntityItem public EntityFloatingItem( final ICanDie parent, final World world, final double x, final double y, final double z, final ItemStack stack ) { super( world, x, y, z, stack ); - this.motionX = this.motionY = this.motionZ = 0.0d; - this.hoverStart = 0.5f; + this.setMotion( 0, 0, 0 ); this.rotationYaw = 0; this.parent = parent; } @@ -43,16 +42,16 @@ public final class EntityFloatingItem extends EntityItem // public boolean isEntityAlive() @Override - public void onUpdate() + public void tick() { - if( !this.isDead && this.parent.isDead() ) + if( !this.removed && this.parent.isDead() ) { - this.setDead(); + this.remove(); } if( this.superDeath > 100 ) { - this.setDead(); + this.remove(); } this.superDeath++; @@ -64,7 +63,7 @@ public final class EntityFloatingItem extends EntityItem this.progress = progress; if( this.progress > 0.99 ) { - this.setDead(); + this.remove(); } } diff --git a/src/main/java/appeng/entity/EntityGrowingCrystal.java b/src/main/java/appeng/entity/EntityGrowingCrystal.java index 3b3bf13c5..f6b6404e3 100644 --- a/src/main/java/appeng/entity/EntityGrowingCrystal.java +++ b/src/main/java/appeng/entity/EntityGrowingCrystal.java @@ -19,9 +19,9 @@ package appeng.entity; +import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -38,16 +38,11 @@ import appeng.core.features.AEFeature; import appeng.util.Platform; -public final class EntityGrowingCrystal extends EntityItem +public final class EntityGrowingCrystal extends ItemEntity { private int progress_1000 = 0; - public EntityGrowingCrystal( final World w ) - { - super( w ); - } - public EntityGrowingCrystal( final World w, final double x, final double y, final double z, final ItemStack is ) { super( w, x, y, z, is ); @@ -55,9 +50,9 @@ public final class EntityGrowingCrystal extends EntityItem } @Override - public void onUpdate() + public void tick() { - super.onUpdate(); + super.tick(); if( !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_PURIFICATION ) ) { @@ -69,11 +64,11 @@ public final class EntityGrowingCrystal extends EntityItem if( gc instanceof IGrowableCrystal ) // if it changes this just stops being an issue... { - final int j = MathHelper.floor( this.posX ); - final int i = MathHelper.floor( ( this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY ) / 2.0D ); - final int k = MathHelper.floor( this.posZ ); + final int j = MathHelper.floor( this.getPosX() ); + final int i = MathHelper.floor( ( this.getBoundingBox().minY + this.getBoundingBox().maxY ) / 2.0D ); + final int k = MathHelper.floor( this.getPosZ() ); - final IBlockState state = this.world.getBlockState( new BlockPos( j, i, k ) ); + final BlockState state = this.world.getBlockState( new BlockPos( j, i, k ) ); final Material mat = state.getMaterial(); final IGrowableCrystal cry = (IGrowableCrystal) is.getItem(); @@ -135,7 +130,7 @@ public final class EntityGrowingCrystal extends EntityItem if( this.progress_1000 >= len ) { this.progress_1000 = 0; - AppEng.proxy.spawnEffect( EffectType.Vibrant, this.world, this.posX, this.posY + 0.2, this.posZ, null ); + AppEng.proxy.spawnEffect( EffectType.Vibrant, this.world, this.getPosX(), this.getPosY() + 0.2, this.getPosZ(), null ); } } else diff --git a/src/main/java/appeng/entity/EntitySingularity.java b/src/main/java/appeng/entity/EntitySingularity.java index 6b66224c4..02e94d963 100644 --- a/src/main/java/appeng/entity/EntitySingularity.java +++ b/src/main/java/appeng/entity/EntitySingularity.java @@ -23,13 +23,12 @@ import java.util.Date; import java.util.List; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.DamageSource; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; import appeng.api.definitions.IMaterials; @@ -85,38 +84,18 @@ public final class EntitySingularity extends AEBaseEntityItem if( materials.singularity().isSameAs( item ) ) { - final AxisAlignedBB region = new AxisAlignedBB( this.posX - 4, this.posY - 4, this.posZ - 4, this.posX + 4, this.posY + 4, this.posZ + 4 ); + final AxisAlignedBB region = new AxisAlignedBB( this.getPosX() - 4, this.getPosY() - 4, this.getPosZ() - 4, this.getPosX() + 4, this + .getPosY() + 4, this.getPosZ() + 4 ); final List l = this.getCheckedEntitiesWithinAABBExcludingEntity( region ); for( final Entity e : l ) { - if( e instanceof EntityItem ) + if( e instanceof ItemEntity ) { - final ItemStack other = ( (EntityItem) e ).getItem(); + final ItemStack other = ( (ItemEntity) e ).getItem(); if( !other.isEmpty() ) { boolean matches = false; - for( final ItemStack is : OreDictionary.getOres( "dustEnder" ) ) - { - if( OreDictionary.itemMatches( other, is, false ) ) - { - matches = true; - break; - } - } - - // check... other name. - if( !matches ) - { - for( final ItemStack is : OreDictionary.getOres( "dustEnderPearl" ) ) - { - if( OreDictionary.itemMatches( other, is, false ) ) - { - matches = true; - break; - } - } - } if( matches ) { @@ -126,24 +105,25 @@ public final class EntitySingularity extends AEBaseEntityItem ; if( other.getCount() == 0 ) { - e.setDead(); + e.remove(); } materials.qESingularity().maybeStack( 2 ).ifPresent( singularityStack -> { - final NBTTagCompound cmp = Platform.openNbtData( singularityStack ); - cmp.setLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 ); + final CompoundNBT cmp = Platform.openNbtData( singularityStack ); + cmp.putLong( "freq", ( new Date() ).getTime() * 100 + ( randTickSeed ) % 100 ); randTickSeed++; item.grow( -1 ); - final EntitySingularity entity = new EntitySingularity( this.world, this.posX, this.posY, this.posZ, singularityStack ); - this.world.spawnEntity( entity ); + final EntitySingularity entity = new EntitySingularity( this.world, this.getPosX(), this.getPosY(), this + .getPosZ(), singularityStack ); + this.world.addEntity( entity ); } ); } if( item.getCount() <= 0 ) { - this.setDead(); + this.remove(); } } } diff --git a/src/main/java/appeng/entity/EntityTinyTNTPrimed.java b/src/main/java/appeng/entity/EntityTinyTNTPrimed.java index 383721296..ea7ee3fb3 100644 --- a/src/main/java/appeng/entity/EntityTinyTNTPrimed.java +++ b/src/main/java/appeng/entity/EntityTinyTNTPrimed.java @@ -21,23 +21,24 @@ package appeng.entity; import java.util.List; -import io.netty.buffer.ByteBuf; - import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; import net.minecraft.entity.MoverType; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityTNTPrimed; -import net.minecraft.init.SoundEvents; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.item.TNTEntity; +import net.minecraft.network.PacketBuffer; +import net.minecraft.particles.ParticleTypes; import net.minecraft.util.DamageSource; -import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvents; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; +import net.minecraft.world.Explosion.Mode; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; @@ -50,70 +51,60 @@ import appeng.helpers.Reflected; import appeng.util.Platform; -public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntityAdditionalSpawnData +public final class EntityTinyTNTPrimed extends TNTEntity implements IEntityAdditionalSpawnData { - private static final float SIZE = .5f; - @Reflected - public EntityTinyTNTPrimed( final World w ) + public EntityTinyTNTPrimed( EntityType type, World worldIn ) { - super( w ); - this.setSize( SIZE, SIZE ); + super( type, worldIn ); + this.preventEntitySpawning = true; } - public EntityTinyTNTPrimed( final World w, final double x, final double y, final double z, final EntityLivingBase igniter ) + public EntityTinyTNTPrimed( final World w, final double x, final double y, final double z, final LivingEntity igniter ) { super( w, x, y, z, igniter ); - this.setSize( SIZE, SIZE ); - // this.yOffset = this.height / 2.0F; } /** * Called to update the entity's position/logic. */ @Override - public void onUpdate() + public void tick() { this.handleWaterMovement(); - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.motionY -= 0.03999999910593033D; - this.move( MoverType.SELF, this.motionX, this.motionY, this.motionZ ); - this.motionX *= 0.9800000190734863D; - this.motionY *= 0.9800000190734863D; - this.motionZ *= 0.9800000190734863D; + this.prevPosX = this.getPosX(); + this.prevPosY = this.getPosY(); + this.prevPosZ = this.getPosZ(); + this.setMotion( this.getMotion().subtract( 0, 0.03999999910593033D, 0 ) ); + this.move( MoverType.SELF, this.getMotion() ); + this.setMotion( this.getMotion().mul( 0.9800000190734863D, 0.9800000190734863D, 0.9800000190734863D ) ); if( this.onGround ) { - this.motionX *= 0.699999988079071D; - this.motionZ *= 0.699999988079071D; - this.motionY *= -0.5D; + this.setMotion( this.getMotion().mul( 0.699999988079071D, 0.699999988079071D, -0.5D ) ); } if( this.isInWater() && Platform.isServer() ) // put out the fuse. { AEApi.instance().definitions().blocks().tinyTNT().maybeStack( 1 ).ifPresent( tntStack -> { - final EntityItem item = new EntityItem( this.world, this.posX, this.posY, this.posZ, tntStack ); + final ItemEntity item = new ItemEntity( this.world, this.getPosX(), this.getPosY(), this.getPosZ(), tntStack ); - item.motionX = this.motionX; - item.motionY = this.motionY; - item.motionZ = this.motionZ; + item.setMotion( this.getMotion() ); item.prevPosX = this.prevPosX; item.prevPosY = this.prevPosY; item.prevPosZ = this.prevPosZ; - this.world.spawnEntity( item ); - this.setDead(); + this.world.addEntity( item ); + this.remove(); } ); } if( this.getFuse() <= 0 ) { - this.setDead(); + this.remove(); if( !this.world.isRemote ) { @@ -122,15 +113,16 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit } else { - this.world.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D ); + this.world.addParticle( ParticleTypes.SMOKE, this.getPosX(), this.getPosY(), this.getPosZ(), 0.0D, 0.0D, 0.0D ); } this.setFuse( this.getFuse() - 1 ); } // override :P - void explode() + @Override + protected void explode() { - this.world.playSound( null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, + this.world.playSound( null, this.getPosX(), this.getPosY(), this.getPosZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, ( 1.0F + ( this.world.rand.nextFloat() - this.world.rand.nextFloat() ) * 0.2F ) * 32.9F ); if( this.isInWater() ) @@ -138,8 +130,9 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit return; } - final Explosion ex = new Explosion( this.world, this, this.posX, this.posY, this.posZ, 0.2f, false, false ); - final AxisAlignedBB area = new AxisAlignedBB( this.posX - 1.5, this.posY - 1.5f, this.posZ - 1.5, this.posX + 1.5, this.posY + 1.5, this.posZ + 1.5 ); + final Explosion ex = new Explosion( this.world, this, this.getPosX(), this.getPosY(), this.getPosZ(), 0.2f, false, Mode.BREAK ); + final AxisAlignedBB area = new AxisAlignedBB( this.getPosX() - 1.5, this.getPosY() - 1.5f, this + .getPosZ() - 1.5, this.getPosX() + 1.5, this.getPosY() + 1.5, this.getPosZ() + 1.5 ); final List list = this.world.getEntitiesWithinAABBExcludingEntity( this, area ); net.minecraftforge.event.ForgeEventFactory.onExplosionDetonate( this.world, ex, list, 0.2f * 2d ); @@ -151,23 +144,25 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit if( AEConfig.instance().isFeatureEnabled( AEFeature.TINY_TNT_BLOCK_DAMAGE ) ) { - this.posY -= 0.25; + this.setPosition( this.getPosX(), this.getPosY() - 0.25, this.getPosZ() ); - for( int x = (int) ( this.posX - 2 ); x <= this.posX + 2; x++ ) + for( int x = (int) ( this.getPosX() - 2 ); x <= this.getPosX() + 2; x++ ) { - for( int y = (int) ( this.posY - 2 ); y <= this.posY + 2; y++ ) + for( int y = (int) ( this.getPosY() - 2 ); y <= this.getPosY() + 2; y++ ) { - for( int z = (int) ( this.posZ - 2 ); z <= this.posZ + 2; z++ ) + for( int z = (int) ( this.getPosZ() - 2 ); z <= this.getPosZ() + 2; z++ ) { final BlockPos point = new BlockPos( x, y, z ); - final IBlockState state = this.world.getBlockState( point ); + final BlockState state = this.world.getBlockState( point ); final Block block = state.getBlock(); if( block != null && !block.isAir( state, this.world, point ) ) { - float strength = (float) ( 2.3f - ( ( ( x + 0.5f ) - this.posX ) * ( ( x + 0.5f ) - this.posX ) + ( ( y + 0.5f ) - this.posY ) * ( ( y + 0.5f ) - this.posY ) + ( ( z + 0.5f ) - this.posZ ) * ( ( z + 0.5f ) - this.posZ ) ) ); + float strength = (float) ( 2.3f - ( ( ( x + 0.5f ) - this.getPosX() ) * ( ( x + 0.5f ) - this + .getPosX() ) + ( ( y + 0.5f ) - this.getPosY() ) * ( ( y + 0.5f ) - this.getPosY() ) + ( ( z + 0.5f ) - this + .getPosZ() ) * ( ( z + 0.5f ) - this.getPosZ() ) ) ); - final float resistance = block.getExplosionResistance( this.world, point, this, ex ); + final float resistance = block.getExplosionResistance( state, this.world, point, this, ex ); strength -= ( resistance + 0.3F ) * 0.11f; if( strength > 0.01 ) @@ -176,10 +171,10 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit { if( block.canDropFromExplosion( ex ) ) { - block.dropBlockAsItemWithChance( this.world, point, state, 1.0F / 1.0f, 0 ); + block.spawnDrops( state, this.world, point ); } - block.onBlockExploded( this.world, point, ex ); + block.onBlockExploded( null, this.world, point, ex ); } } } @@ -188,19 +183,19 @@ public final class EntityTinyTNTPrimed extends EntityTNTPrimed implements IEntit } } - AppEng.proxy.sendToAllNearExcept( null, this.posX, this.posY, this.posZ, 64, this.world, new PacketMockExplosion( this.posX, this.posY, this.posZ ) ); + AppEng.proxy.sendToAllNearExcept( null, this.getPosX(), this.getPosY(), this.getPosZ(), 64, this.world, + new PacketMockExplosion( this.getPosX(), this.getPosY(), this.getPosZ() ) ); } @Override - public void writeSpawnData( final ByteBuf data ) + public void writeSpawnData( PacketBuffer buffer ) { - data.writeByte( this.getFuse() ); + buffer.writeByte( this.getFuse() ); } @Override - public void readSpawnData( final ByteBuf data ) + public void readSpawnData( PacketBuffer additionalData ) { - this.setFuse( data.readByte() ); - ; + this.setFuse( additionalData.readByte() ); } } diff --git a/src/main/java/appeng/entity/RenderFloatingItem.java b/src/main/java/appeng/entity/RenderFloatingItem.java index 8668ea288..c01285de2 100644 --- a/src/main/java/appeng/entity/RenderFloatingItem.java +++ b/src/main/java/appeng/entity/RenderFloatingItem.java @@ -24,18 +24,18 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.RenderEntityItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemBlock; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.item.BlockItem; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class RenderFloatingItem extends RenderEntityItem { public RenderFloatingItem( final RenderManager manager ) { - super( manager, Minecraft.getMinecraft().getRenderItem() ); + super( manager, Minecraft.getInstance().getRenderItem() ); this.shadowOpaque = 0.0F; } @@ -49,7 +49,7 @@ public class RenderFloatingItem extends RenderEntityItem { GlStateManager.pushMatrix(); - if( !( efi.getItem().getItem() instanceof ItemBlock ) ) + if( !( efi.getItem().getItem() instanceof BlockItem ) ) { GlStateManager.translate( 0, -0.3f, 0 ); } diff --git a/src/main/java/appeng/entity/RenderTinyTNTPrimed.java b/src/main/java/appeng/entity/RenderTinyTNTPrimed.java index 00debfd11..83753d91c 100644 --- a/src/main/java/appeng/entity/RenderTinyTNTPrimed.java +++ b/src/main/java/appeng/entity/RenderTinyTNTPrimed.java @@ -25,13 +25,13 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class RenderTinyTNTPrimed extends Render { @@ -44,7 +44,7 @@ public class RenderTinyTNTPrimed extends Render @Override public void doRender( final EntityTinyTNTPrimed tnt, final double x, final double y, final double z, final float unused, final float life ) { - final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); + final BlockRendererDispatcher blockrendererdispatcher = Minecraft.getInstance().getBlockRendererDispatcher(); GlStateManager.pushMatrix(); GlStateManager.translate( (float) x, (float) y + 0.25F, (float) z ); float f2; diff --git a/src/main/java/appeng/facade/FacadeContainer.java b/src/main/java/appeng/facade/FacadeContainer.java index 0c7631a12..cd7689b6e 100644 --- a/src/main/java/appeng/facade/FacadeContainer.java +++ b/src/main/java/appeng/facade/FacadeContainer.java @@ -26,7 +26,7 @@ import io.netty.buffer.ByteBuf; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.AEApi; import appeng.api.parts.IFacadeContainer; @@ -102,15 +102,15 @@ public class FacadeContainer implements IFacadeContainer } @Override - public void writeToNBT( final NBTTagCompound c ) + public void writeToNBT( final CompoundNBT c ) { for( int x = 0; x < this.facades; x++ ) { if( this.storage.getFacade( x ) != null ) { - final NBTTagCompound data = new NBTTagCompound(); - this.storage.getFacade( x ).getItemStack().writeToNBT( data ); - c.setTag( "facade:" + x, data ); + final CompoundNBT data = new CompoundNBT(); + this.storage.getFacade( x ).getItemStack().write( data ); + c.put( "facade:" + x, data ); } } } @@ -156,16 +156,16 @@ public class FacadeContainer implements IFacadeContainer } @Override - public void readFromNBT( final NBTTagCompound c ) + public void readFromNBT( final CompoundNBT c ) { for( int x = 0; x < this.facades; x++ ) { this.storage.setFacade( x, null ); - final NBTTagCompound t = c.getCompoundTag( "facade:" + x ); + final CompoundNBT t = c.getCompound( "facade:" + x ); if( t != null ) { - final ItemStack is = new ItemStack( t ); + final ItemStack is = ItemStack.read( t ); if( !is.isEmpty() ) { final Item i = is.getItem(); diff --git a/src/main/java/appeng/facade/FacadePart.java b/src/main/java/appeng/facade/FacadePart.java index ea2080a36..6817df1d1 100644 --- a/src/main/java/appeng/facade/FacadePart.java +++ b/src/main/java/appeng/facade/FacadePart.java @@ -19,13 +19,13 @@ package appeng.facade; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import appeng.api.AEApi; import appeng.api.parts.IBoxProvider; @@ -65,7 +65,7 @@ public class FacadePart implements IFacadePart, IBoxProvider @Override public void getBoxes( final IPartCollisionHelper ch, final Entity e ) { - if( e instanceof EntityLivingBase ) + if( e instanceof LivingEntity ) { // prevent weird snag behavior ch.addBox( 0.0, 0.0, 14, 16.0, 16.0, 16.0 ); @@ -94,17 +94,6 @@ public class FacadePart implements IFacadePart, IBoxProvider return is.getItem(); } - @Override - public int getItemDamage() - { - final ItemStack is = this.getTextureItem(); - if( is.isEmpty() ) - { - return 0; - } - return is.getItemDamage(); - } - @Override public boolean notAEFacade() { @@ -139,7 +128,7 @@ public class FacadePart implements IFacadePart, IBoxProvider } @Override - public IBlockState getBlockState() + public BlockState getBlockState() { final Item maybeFacade = this.facade.getItem(); diff --git a/src/main/java/appeng/facade/IFacadeItem.java b/src/main/java/appeng/facade/IFacadeItem.java index fd10484ff..4a179c462 100644 --- a/src/main/java/appeng/facade/IFacadeItem.java +++ b/src/main/java/appeng/facade/IFacadeItem.java @@ -19,7 +19,7 @@ package appeng.facade; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import appeng.api.util.AEPartLocation; @@ -32,6 +32,6 @@ public interface IFacadeItem ItemStack getTextureItem( ItemStack is ); - IBlockState getTextureBlockState( ItemStack is ); + BlockState getTextureBlockState( ItemStack is ); } diff --git a/src/main/java/appeng/fluids/block/BlockFluidInterface.java b/src/main/java/appeng/fluids/block/BlockFluidInterface.java index 4eabf1efd..dbe6da66e 100644 --- a/src/main/java/appeng/fluids/block/BlockFluidInterface.java +++ b/src/main/java/appeng/fluids/block/BlockFluidInterface.java @@ -22,11 +22,11 @@ package appeng.fluids.block; import javax.annotation.Nullable; import net.minecraft.block.material.Material; -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.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.world.World; @@ -45,9 +45,9 @@ public class BlockFluidInterface extends AEBaseTileBlock } @Override - public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { return false; } diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java b/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java index 6be00d3d6..65906cde1 100644 --- a/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java +++ b/src/main/java/appeng/fluids/client/gui/GuiFluidFormationPlane.java @@ -5,7 +5,7 @@ package appeng.fluids.client.gui; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.implementations.GuiUpgradeable; import appeng.client.gui.widgets.GuiTabButton; @@ -25,9 +25,9 @@ public class GuiFluidFormationPlane extends GuiUpgradeable private final PartFluidFormationPlane plane; private GuiTabButton priority; - public GuiFluidFormationPlane( InventoryPlayer inventoryPlayer, PartFluidFormationPlane te ) + public GuiFluidFormationPlane( PlayerInventory PlayerInventory, PartFluidFormationPlane te ) { - super( new ContainerFluidFormationPlane( inventoryPlayer, te ) ); + super( new ContainerFluidFormationPlane( PlayerInventory, te ) ); this.ySize = 251; this.plane = te; } diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidIO.java b/src/main/java/appeng/fluids/client/gui/GuiFluidIO.java index 20ccdfd48..0f614c859 100644 --- a/src/main/java/appeng/fluids/client/gui/GuiFluidIO.java +++ b/src/main/java/appeng/fluids/client/gui/GuiFluidIO.java @@ -19,7 +19,7 @@ package appeng.fluids.client.gui; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.implementations.GuiUpgradeable; import appeng.core.localization.GuiText; @@ -40,9 +40,9 @@ public class GuiFluidIO extends GuiUpgradeable { private final PartSharedFluidBus bus; - public GuiFluidIO( InventoryPlayer inventoryPlayer, PartSharedFluidBus te ) + public GuiFluidIO( PlayerInventory PlayerInventory, PartSharedFluidBus te ) { - super( new ContainerFluidIO( inventoryPlayer, te ) ); + super( new ContainerFluidIO( PlayerInventory, te ) ); this.bus = te; } diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java b/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java index 14fd8742a..bd9b1c1da 100644 --- a/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java +++ b/src/main/java/appeng/fluids/client/gui/GuiFluidInterface.java @@ -22,7 +22,7 @@ package appeng.fluids.client.gui; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.client.gui.implementations.GuiUpgradeable; import appeng.client.gui.widgets.GuiTabButton; @@ -45,7 +45,7 @@ public class GuiFluidInterface extends GuiUpgradeable private final IFluidInterfaceHost host; private GuiTabButton priority; - public GuiFluidInterface( final InventoryPlayer ip, final IFluidInterfaceHost te ) + public GuiFluidInterface( final PlayerInventory ip, final IFluidInterfaceHost te ) { super( new ContainerFluidInterface( ip, te ) ); this.ySize = 231; diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidLevelEmitter.java b/src/main/java/appeng/fluids/client/gui/GuiFluidLevelEmitter.java index 8b0b5c4d5..3cb6a6682 100644 --- a/src/main/java/appeng/fluids/client/gui/GuiFluidLevelEmitter.java +++ b/src/main/java/appeng/fluids/client/gui/GuiFluidLevelEmitter.java @@ -5,7 +5,7 @@ package appeng.fluids.client.gui; import java.io.IOException; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.RedstoneMode; import appeng.api.config.Settings; @@ -36,9 +36,9 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable private GuiButton minus100; private GuiButton minus1000; - public GuiFluidLevelEmitter( final InventoryPlayer inventoryPlayer, final PartFluidLevelEmitter te ) + public GuiFluidLevelEmitter( final PlayerInventory PlayerInventory, final PartFluidLevelEmitter te ) { - super( new ContainerFluidLevelEmitter( inventoryPlayer, te ) ); + super( new ContainerFluidLevelEmitter( PlayerInventory, te ) ); this.levelEmitter = te; } diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java b/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java index ef001df02..93a6c3a7a 100644 --- a/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java +++ b/src/main/java/appeng/fluids/client/gui/GuiFluidStorageBus.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.api.config.AccessRestriction; import appeng.api.config.ActionItems; @@ -62,9 +62,9 @@ public class GuiFluidStorageBus extends GuiUpgradeable private GuiImgButton clear; private final PartFluidStorageBus bus; - public GuiFluidStorageBus( InventoryPlayer inventoryPlayer, PartFluidStorageBus te ) + public GuiFluidStorageBus( PlayerInventory PlayerInventory, PartFluidStorageBus te ) { - super( new ContainerFluidStorageBus( inventoryPlayer, te ) ); + super( new ContainerFluidStorageBus( PlayerInventory, te ) ); this.ySize = 251; this.bus = te; } diff --git a/src/main/java/appeng/fluids/client/gui/GuiFluidTerminal.java b/src/main/java/appeng/fluids/client/gui/GuiFluidTerminal.java index 2df75ab4a..d26480d92 100644 --- a/src/main/java/appeng/fluids/client/gui/GuiFluidTerminal.java +++ b/src/main/java/appeng/fluids/client/gui/GuiFluidTerminal.java @@ -29,7 +29,7 @@ import java.util.Locale; import org.lwjgl.input.Mouse; import net.minecraft.client.gui.GuiButton; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Slot; import net.minecraft.util.text.TextFormatting; @@ -81,12 +81,12 @@ public class GuiFluidTerminal extends AEBaseMEGui implements ISortSource, IConfi private GuiImgButton sortByBox; private GuiImgButton sortDirBox; - public GuiFluidTerminal( final InventoryPlayer inventoryPlayer, final ITerminalHost te ) + public GuiFluidTerminal( final PlayerInventory PlayerInventory, final ITerminalHost te ) { - this( inventoryPlayer, te, new ContainerFluidTerminal( inventoryPlayer, te ) ); + this( PlayerInventory, te, new ContainerFluidTerminal( PlayerInventory, te ) ); } - public GuiFluidTerminal( InventoryPlayer inventoryPlayer, final ITerminalHost te, final ContainerFluidTerminal c ) + public GuiFluidTerminal( PlayerInventory PlayerInventory, final ITerminalHost te, final ContainerFluidTerminal c ) { super( c ); this.terminal = te; diff --git a/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidSlot.java b/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidSlot.java index 7b1f7c1d5..4083e1677 100644 --- a/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidSlot.java +++ b/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidSlot.java @@ -8,7 +8,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -59,7 +59,7 @@ public class GuiFluidSlot extends GuiCustomSlot } @Override - public boolean canClick( final EntityPlayer player ) + public boolean canClick( final PlayerEntity player ) { final ItemStack mouseStack = player.inventory.getItemStack(); return mouseStack.isEmpty() || mouseStack.hasCapability( CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null ); diff --git a/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java b/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java index 5d9bad9b9..1470242d9 100644 --- a/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java +++ b/src/main/java/appeng/fluids/client/gui/widgets/GuiFluidTank.java @@ -24,8 +24,8 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; -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.storage.data.IAEFluidStack; import appeng.api.util.AEColor; @@ -33,7 +33,7 @@ import appeng.client.gui.widgets.ITooltip; import appeng.fluids.util.IAEFluidTank; -@SideOnly( Side.CLIENT ) +@OnlyIn( Dist.CLIENT ) public class GuiFluidTank extends GuiButton implements ITooltip { private final IAEFluidTank tank; diff --git a/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java b/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java index aa09acc9c..0cbe70bd0 100644 --- a/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java +++ b/src/main/java/appeng/fluids/container/ContainerFluidConfigurable.java @@ -5,7 +5,7 @@ package appeng.fluids.container; import java.util.Collections; import java.util.Map; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -25,7 +25,7 @@ public abstract class ContainerFluidConfigurable extends ContainerUpgradeable im { private FluidSyncHelper sync = null; - public ContainerFluidConfigurable( InventoryPlayer ip, IUpgradeableHost te ) + public ContainerFluidConfigurable( PlayerInventory ip, IUpgradeableHost te ) { super( ip, te ); } diff --git a/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java b/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java index 8705cc641..5a077a9b7 100644 --- a/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java +++ b/src/main/java/appeng/fluids/container/ContainerFluidFormationPlane.java @@ -2,7 +2,7 @@ package appeng.fluids.container; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.IItemHandler; import appeng.api.config.SecurityPermissions; @@ -17,7 +17,7 @@ public class ContainerFluidFormationPlane extends ContainerFluidConfigurable { private final PartFluidFormationPlane plane; - public ContainerFluidFormationPlane( final InventoryPlayer ip, final PartFluidFormationPlane te ) + public ContainerFluidFormationPlane( final PlayerInventory ip, final PartFluidFormationPlane te ) { super( ip, te ); this.plane = te; @@ -39,19 +39,19 @@ public class ContainerFluidFormationPlane extends ContainerFluidConfigurable protected void setupConfig() { final IItemHandler upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getPlayerInventory() ) ) .setNotDraggable() ); } diff --git a/src/main/java/appeng/fluids/container/ContainerFluidIO.java b/src/main/java/appeng/fluids/container/ContainerFluidIO.java index 0147bb2e1..db9023b32 100644 --- a/src/main/java/appeng/fluids/container/ContainerFluidIO.java +++ b/src/main/java/appeng/fluids/container/ContainerFluidIO.java @@ -19,7 +19,7 @@ package appeng.fluids.container; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import appeng.fluids.parts.PartSharedFluidBus; import appeng.fluids.util.IAEFluidTank; @@ -34,7 +34,7 @@ public class ContainerFluidIO extends ContainerFluidConfigurable { private final PartSharedFluidBus bus; - public ContainerFluidIO( InventoryPlayer ip, PartSharedFluidBus te ) + public ContainerFluidIO( PlayerInventory ip, PartSharedFluidBus te ) { super( ip, te ); this.bus = te; diff --git a/src/main/java/appeng/fluids/container/ContainerFluidInterface.java b/src/main/java/appeng/fluids/container/ContainerFluidInterface.java index 7055f2c1f..48cb63a1d 100644 --- a/src/main/java/appeng/fluids/container/ContainerFluidInterface.java +++ b/src/main/java/appeng/fluids/container/ContainerFluidInterface.java @@ -22,7 +22,7 @@ package appeng.fluids.container; import java.util.Collections; import java.util.Map; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import appeng.api.config.SecurityPermissions; @@ -40,7 +40,7 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable private final DualityFluidInterface myDuality; private final FluidSyncHelper tankSync; - public ContainerFluidInterface( final InventoryPlayer ip, final IFluidInterfaceHost te ) + public ContainerFluidInterface( final PlayerInventory ip, final IFluidInterfaceHost te ) { super( ip, te.getDualityFluidInterface().getHost() ); diff --git a/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java b/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java index 8eb730591..b1ede2773 100644 --- a/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java +++ b/src/main/java/appeng/fluids/container/ContainerFluidLevelEmitter.java @@ -3,10 +3,10 @@ package appeng.fluids.container; import net.minecraft.client.gui.GuiTextField; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import appeng.api.config.RedstoneMode; import appeng.api.config.SecurityPermissions; @@ -21,25 +21,25 @@ public class ContainerFluidLevelEmitter extends ContainerFluidConfigurable { private final PartFluidLevelEmitter lvlEmitter; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private GuiTextField textField; @GuiSync( 3 ) public long EmitterValue = -1; - public ContainerFluidLevelEmitter( final InventoryPlayer ip, final PartFluidLevelEmitter te ) + public ContainerFluidLevelEmitter( final PlayerInventory ip, final PartFluidLevelEmitter te ) { super( ip, te ); this.lvlEmitter = te; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void setTextField( final GuiTextField level ) { this.textField = level; this.textField.setText( String.valueOf( this.EmitterValue ) ); } - public void setLevel( final long l, final EntityPlayer player ) + public void setLevel( final long l, final PlayerEntity player ) { this.lvlEmitter.setReportingValue( l ); this.EmitterValue = l; diff --git a/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java b/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java index bdcdbfaa5..f94237a7f 100644 --- a/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java +++ b/src/main/java/appeng/fluids/container/ContainerFluidStorageBus.java @@ -21,7 +21,7 @@ package appeng.fluids.container; import java.util.Iterator; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.IItemHandler; import appeng.api.AEApi; @@ -59,7 +59,7 @@ public class ContainerFluidStorageBus extends ContainerFluidConfigurable @GuiSync( 4 ) public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY; - public ContainerFluidStorageBus( InventoryPlayer ip, PartFluidStorageBus te ) + public ContainerFluidStorageBus( PlayerInventory ip, PartFluidStorageBus te ) { super( ip, te ); this.storageBus = te; @@ -75,19 +75,19 @@ public class ContainerFluidStorageBus extends ContainerFluidConfigurable protected void setupConfig() { final IItemHandler upgrades = this.getUpgradeable().getInventoryByName( "upgrades" ); - this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ) + this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getPlayerInventory() ) ) .setNotDraggable() ); this.addSlotToContainer( - ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ) + ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getPlayerInventory() ) ) .setNotDraggable() ); } diff --git a/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java b/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java index cc570f473..c0cfae63a 100644 --- a/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java +++ b/src/main/java/appeng/fluids/container/ContainerFluidTerminal.java @@ -24,9 +24,9 @@ import java.nio.BufferOverflowException; import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.IContainerListener; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -91,7 +91,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa // Holds the fluid the client wishes to extract, or null for insert private IAEFluidStack clientRequestedTargetFluid = null; - public ContainerFluidTerminal( InventoryPlayer ip, ITerminalHost terminal ) + public ContainerFluidTerminal( PlayerInventory ip, ITerminalHost terminal ) { super( ip, terminal ); this.terminal = terminal; @@ -181,7 +181,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa } @Override - public void onContainerClosed( final EntityPlayer player ) + public void onContainerClosed( final PlayerEntity player ) { super.onContainerClosed( player ); if( this.monitor != null ) @@ -192,7 +192,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa private void queueInventory( final IContainerListener c ) { - if( Platform.isServer() && c instanceof EntityPlayer && this.monitor != null ) + if( Platform.isServer() && c instanceof PlayerEntity && this.monitor != null ) { try { @@ -207,14 +207,14 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa } catch( final BufferOverflowException boe ) { - NetworkHandler.instance().sendTo( piu, (EntityPlayerMP) c ); + NetworkHandler.instance().sendTo( piu, (PlayerEntityMP) c ); piu = new PacketMEFluidInventoryUpdate(); piu.appendFluid( send ); } } - NetworkHandler.instance().sendTo( piu, (EntityPlayerMP) c ); + NetworkHandler.instance().sendTo( piu, (PlayerEntityMP) c ); } catch( final IOException e ) { @@ -281,11 +281,11 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa this.clientCM.putSetting( set, sideLocal ); for( final IContainerListener crafter : this.listeners ) { - if( crafter instanceof EntityPlayerMP ) + if( crafter instanceof PlayerEntityMP ) { try { - NetworkHandler.instance().sendTo( new PacketValueConfig( set.name(), sideLocal.name() ), (EntityPlayerMP) crafter ); + NetworkHandler.instance().sendTo( new PacketValueConfig( set.name(), sideLocal.name() ), (PlayerEntityMP) crafter ); } catch( final IOException e ) { @@ -324,9 +324,9 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa for( final Object c : this.listeners ) { - if( c instanceof EntityPlayer ) + if( c instanceof PlayerEntity ) { - NetworkHandler.instance().sendTo( piu, (EntityPlayerMP) c ); + NetworkHandler.instance().sendTo( piu, (PlayerEntityMP) c ); } } } @@ -343,7 +343,7 @@ public class ContainerFluidTerminal extends AEBaseContainer implements IConfigMa } @Override - public void doAction( EntityPlayerMP player, InventoryAction action, int slot, long id ) + public void doAction( PlayerEntityMP player, InventoryAction action, int slot, long id ) { if( action != InventoryAction.FILL_ITEM && action != InventoryAction.EMPTY_ITEM ) { diff --git a/src/main/java/appeng/fluids/helper/DualityFluidInterface.java b/src/main/java/appeng/fluids/helper/DualityFluidInterface.java index 6d9987bb1..fd7566ba8 100644 --- a/src/main/java/appeng/fluids/helper/DualityFluidInterface.java +++ b/src/main/java/appeng/fluids/helper/DualityFluidInterface.java @@ -21,9 +21,9 @@ package appeng.fluids.helper; import java.util.Optional; -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.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -229,13 +229,13 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable return new DimensionalCoord( this.iHost.getTileEntity() ); } - public boolean hasCapability( Capability capabilityClass, EnumFacing facing ) + public boolean hasCapability( Capability capabilityClass, Direction facing ) { return capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR; } @SuppressWarnings( "unchecked" ) - public T getCapability( Capability capabilityClass, EnumFacing facing ) + public T getCapability( Capability capabilityClass, Direction facing ) { if( capabilityClass == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY ) { @@ -492,14 +492,14 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable this.priority = newValue; } - public void writeToNBT( final NBTTagCompound data ) + public void writeToNBT( final CompoundNBT data ) { data.setInteger( "priority", this.priority ); this.tanks.writeToNBT( data, "storage" ); this.config.writeToNBT( data, "config" ); } - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { this.config.readFromNBT( data, "config" ); this.tanks.readFromNBT( data, "storage" ); diff --git a/src/main/java/appeng/fluids/helper/FluidSyncHelper.java b/src/main/java/appeng/fluids/helper/FluidSyncHelper.java index 8a3eb8173..8bd64f102 100644 --- a/src/main/java/appeng/fluids/helper/FluidSyncHelper.java +++ b/src/main/java/appeng/fluids/helper/FluidSyncHelper.java @@ -6,7 +6,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.inventory.IContainerListener; import appeng.api.storage.data.IAEFluidStack; @@ -59,9 +59,9 @@ public class FluidSyncHelper for( final IContainerListener l : listeners ) { - if( l instanceof EntityPlayerMP ) + if( l instanceof PlayerEntityMP ) { - NetworkHandler.instance().sendTo( new PacketFluidSlot( data ), (EntityPlayerMP) l ); + NetworkHandler.instance().sendTo( new PacketFluidSlot( data ), (PlayerEntityMP) l ); } } } diff --git a/src/main/java/appeng/fluids/helper/IFluidInterfaceHost.java b/src/main/java/appeng/fluids/helper/IFluidInterfaceHost.java index c17d8a720..82a30e161 100644 --- a/src/main/java/appeng/fluids/helper/IFluidInterfaceHost.java +++ b/src/main/java/appeng/fluids/helper/IFluidInterfaceHost.java @@ -22,7 +22,7 @@ package appeng.fluids.helper; import java.util.EnumSet; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.implementations.IUpgradeableHost; import appeng.api.networking.security.IActionHost; @@ -33,7 +33,7 @@ public interface IFluidInterfaceHost extends IActionHost, IGridProxyable, IUpgra { DualityFluidInterface getDualityFluidInterface(); - EnumSet getTargets(); + EnumSet getTargets(); TileEntity getTileEntity(); diff --git a/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java b/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java index 2b7444284..baba7fbe9 100644 --- a/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java +++ b/src/main/java/appeng/fluids/items/BasicFluidStorageCell.java @@ -19,7 +19,7 @@ package appeng.fluids.items; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; @@ -103,7 +103,7 @@ public final class BasicFluidStorageCell extends AbstractStorageCell { diff --git a/src/main/java/appeng/fluids/items/FluidDummyItem.java b/src/main/java/appeng/fluids/items/FluidDummyItem.java index 134583aeb..25a66ba80 100644 --- a/src/main/java/appeng/fluids/items/FluidDummyItem.java +++ b/src/main/java/appeng/fluids/items/FluidDummyItem.java @@ -21,7 +21,7 @@ package appeng.fluids.items; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.NonNullList; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; @@ -55,7 +55,7 @@ public class FluidDummyItem extends AEBaseItem { if( is.hasTagCompound() ) { - NBTTagCompound tag = is.getTagCompound(); + CompoundNBT tag = is.getTagCompound(); return FluidStack.loadFluidStackFromNBT( tag ); } return null; @@ -69,7 +69,7 @@ public class FluidDummyItem extends AEBaseItem } else { - NBTTagCompound tag = new NBTTagCompound(); + CompoundNBT tag = new CompoundNBT(); fs.writeToNBT( tag ); is.setTagCompound( tag ); } diff --git a/src/main/java/appeng/fluids/parts/PartFluidAnnihilationPlane.java b/src/main/java/appeng/fluids/parts/PartFluidAnnihilationPlane.java index 1058e9c2a..db304f875 100644 --- a/src/main/java/appeng/fluids/parts/PartFluidAnnihilationPlane.java +++ b/src/main/java/appeng/fluids/parts/PartFluidAnnihilationPlane.java @@ -6,12 +6,12 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; 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.minecraft.world.World; import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.IFluidBlock; @@ -84,8 +84,8 @@ public class PartFluidAnnihilationPlane extends PartBasicState implements IGridT 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() ) ) { @@ -115,33 +115,33 @@ public class PartFluidAnnihilationPlane extends PartBasicState implements IGridT 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 class PartFluidAnnihilationPlane extends PartBasicState implements IGridT } @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 ) ) { @@ -244,7 +244,7 @@ public class PartFluidAnnihilationPlane extends PartBasicState implements IGridT final TileEntity te = this.getTile(); final World w = te.getWorld(); final BlockPos pos = te.getPos().offset( this.getSide().getFacing() ); - final IBlockState state = w.getBlockState( pos ); + final BlockState state = w.getBlockState( pos ); final Block block = state.getBlock(); if( block instanceof IFluidBlock || block instanceof BlockLiquid ) diff --git a/src/main/java/appeng/fluids/parts/PartFluidFormationPlane.java b/src/main/java/appeng/fluids/parts/PartFluidFormationPlane.java index 3a9be31de..a0d0f6fd8 100644 --- a/src/main/java/appeng/fluids/parts/PartFluidFormationPlane.java +++ b/src/main/java/appeng/fluids/parts/PartFluidFormationPlane.java @@ -8,12 +8,12 @@ import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +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.Vec3d; import net.minecraft.world.World; @@ -117,7 +117,7 @@ public class PartFluidFormationPlane extends PartAbstractFormationPlane getTargets() + public EnumSet getTargets() { return EnumSet.of( this.getSide().getFacing() ); } diff --git a/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java b/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java index a1852a586..788c2582e 100644 --- a/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java +++ b/src/main/java/appeng/fluids/parts/PartFluidLevelEmitter.java @@ -4,11 +4,11 @@ package appeng.fluids.parts; import java.util.Random; -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.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -323,7 +323,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc } @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() ) { @@ -355,7 +355,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.lastReportedValue = data.getLong( "lastReportedValue" ); @@ -365,7 +365,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc } @Override - public void writeToNBT( final NBTTagCompound data ) + public void writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setLong( "lastReportedValue", this.lastReportedValue ); diff --git a/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java b/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java index e03df2576..934618be5 100644 --- a/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java +++ b/src/main/java/appeng/fluids/parts/PartFluidStorageBus.java @@ -25,12 +25,12 @@ import java.util.Objects; import javax.annotation.Nonnull; -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.Vec3d; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; @@ -116,7 +116,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni private IMEInventory 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 ); if( accessor != null ) @@ -222,7 +222,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni } @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() ) { @@ -241,14 +241,14 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.config.readFromNBT( data, "config" ); } @Override - public void writeToNBT( final NBTTagCompound data ) + public void writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.config.writeToNBT( data, "config" ); @@ -429,7 +429,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni return 0; } - final EnumFacing targetSide = this.getSide().getFacing().getOpposite(); + final Direction targetSide = this.getSide().getFacing().getOpposite(); if( target.hasCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) ) { diff --git a/src/main/java/appeng/fluids/parts/PartFluidTerminal.java b/src/main/java/appeng/fluids/parts/PartFluidTerminal.java index 38c509026..cc3388fb4 100644 --- a/src/main/java/appeng/fluids/parts/PartFluidTerminal.java +++ b/src/main/java/appeng/fluids/parts/PartFluidTerminal.java @@ -19,7 +19,7 @@ package appeng.fluids.parts; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -54,7 +54,7 @@ public class PartFluidTerminal extends AbstractPartTerminal } @Override - public GuiBridge getGui( EntityPlayer player ) + public GuiBridge getGui( PlayerEntity player ) { return GuiBridge.GUI_FLUID_TERMINAL; } diff --git a/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java b/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java index ed2e372cd..2956fd474 100644 --- a/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java +++ b/src/main/java/appeng/fluids/parts/PartSharedFluidBus.java @@ -19,15 +19,15 @@ package appeng.fluids.parts; -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 net.minecraft.world.World; import appeng.api.AEApi; @@ -69,7 +69,7 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri } @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() ) ) @@ -102,7 +102,7 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri } @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() ) { @@ -158,14 +158,14 @@ public abstract class PartSharedFluidBus extends PartUpgradeable implements IGri } @Override - public void readFromNBT( NBTTagCompound extra ) + public void readFromNBT( CompoundNBT extra ) { super.readFromNBT( extra ); this.config.readFromNBT( extra, "config" ); } @Override - public void writeToNBT( NBTTagCompound extra ) + public void writeToNBT( CompoundNBT extra ) { super.writeToNBT( extra ); this.config.writeToNBT( extra, "config" ); diff --git a/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java b/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java index d0148bf38..e1d35899c 100644 --- a/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java +++ b/src/main/java/appeng/fluids/registries/BasicFluidCellGuiHandler.java @@ -19,7 +19,7 @@ package appeng.fluids.registries; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -46,7 +46,7 @@ public class BasicFluidCellGuiHandler implements ICellGuiHandler } @Override - public void openChestGui( final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan ) + public void openChestGui( final PlayerEntity player, final IChestOrDrive chest, final ICellHandler cellHandler, final IMEInventoryHandler inv, final ItemStack is, final IStorageChannel chan ) { Platform.openGUI( player, (TileEntity) chest, AEPartLocation.fromFacing( chest.getUp() ), GuiBridge.GUI_FLUID_TERMINAL ); } diff --git a/src/main/java/appeng/fluids/tile/TileFluidInterface.java b/src/main/java/appeng/fluids/tile/TileFluidInterface.java index 2968b65c8..384ab2164 100644 --- a/src/main/java/appeng/fluids/tile/TileFluidInterface.java +++ b/src/main/java/appeng/fluids/tile/TileFluidInterface.java @@ -24,9 +24,9 @@ import java.util.EnumSet; import javax.annotation.Nullable; 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.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.IItemHandler; @@ -97,7 +97,7 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable, } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.duality.writeToNBT( data ); @@ -105,7 +105,7 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable, } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.duality.readFromNBT( data ); @@ -124,9 +124,9 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable, } @Override - public EnumSet getTargets() + public EnumSet getTargets() { - return EnumSet.allOf( EnumFacing.class ); + return EnumSet.allOf( Direction.class ); } @Override @@ -142,13 +142,13 @@ public class TileFluidInterface extends AENetworkTile implements IGridTickable, } @Override - public boolean hasCapability( Capability capability, @Nullable EnumFacing facing ) + public boolean hasCapability( Capability capability, @Nullable Direction facing ) { return this.duality.hasCapability( capability, facing ) || super.hasCapability( capability, facing ); } @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { T result = this.duality.getCapability( capability, facing ); if( result != null ) diff --git a/src/main/java/appeng/fluids/util/AEFluidInventory.java b/src/main/java/appeng/fluids/util/AEFluidInventory.java index 09538e039..eb1a86025 100644 --- a/src/main/java/appeng/fluids/util/AEFluidInventory.java +++ b/src/main/java/appeng/fluids/util/AEFluidInventory.java @@ -4,7 +4,7 @@ package appeng.fluids.util; import java.util.Objects; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidTankProperties; @@ -277,20 +277,20 @@ public class AEFluidInventory implements IAEFluidTank return totalDrained; } - public void writeToNBT( final NBTTagCompound data, final String name ) + public void writeToNBT( final CompoundNBT data, final String name ) { - final NBTTagCompound c = new NBTTagCompound(); + final CompoundNBT c = new CompoundNBT(); this.writeToNBT( c ); data.setTag( name, c ); } - private void writeToNBT( final NBTTagCompound target ) + private void writeToNBT( final CompoundNBT target ) { for( int x = 0; x < this.fluids.length; x++ ) { try { - final NBTTagCompound c = new NBTTagCompound(); + final CompoundNBT c = new CompoundNBT(); if( this.fluids[x] != null ) { @@ -305,22 +305,22 @@ public class AEFluidInventory implements IAEFluidTank } } - public void readFromNBT( final NBTTagCompound data, final String name ) + public void readFromNBT( final CompoundNBT data, final String name ) { - final NBTTagCompound c = data.getCompoundTag( name ); + final CompoundNBT c = data.getCompoundTag( name ); if( c != null ) { this.readFromNBT( c ); } } - private void readFromNBT( final NBTTagCompound target ) + private void readFromNBT( final CompoundNBT target ) { for( int x = 0; x < this.fluids.length; x++ ) { try { - final NBTTagCompound c = target.getCompoundTag( "#" + x ); + final CompoundNBT c = target.getCompoundTag( "#" + x ); if( c != null ) { diff --git a/src/main/java/appeng/fluids/util/AEFluidStack.java b/src/main/java/appeng/fluids/util/AEFluidStack.java index d04652bcb..4b82dd944 100644 --- a/src/main/java/appeng/fluids/util/AEFluidStack.java +++ b/src/main/java/appeng/fluids/util/AEFluidStack.java @@ -29,10 +29,11 @@ import javax.annotation.Nonnull; import io.netty.buffer.ByteBuf; +import net.minecraft.fluid.Fluid; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.Fluid; +import net.minecraft.network.PacketBuffer; import net.minecraftforge.fluids.FluidStack; import appeng.api.AEApi; @@ -50,7 +51,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu { private final Fluid fluid; - private NBTTagCompound tagCompound; + private CompoundNBT tagCompound; private AEFluidStack( final AEFluidStack fluidStack ) { @@ -76,13 +77,13 @@ public final class AEFluidStack extends AEStack implements IAEFlu throw new IllegalArgumentException( "Fluid is null." ); } - this.setStackSize( fluidStack.amount ); + this.setStackSize( fluidStack.getAmount() ); this.setCraftable( false ); this.setCountRequestable( 0 ); - if( fluidStack.tag != null ) + if( fluidStack.getTag() != null ) { - this.tagCompound = fluidStack.tag.copy(); + this.tagCompound = fluidStack.getTag().copy(); } } @@ -96,7 +97,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu return new AEFluidStack( input ); } - public static IAEFluidStack fromNBT( final NBTTagCompound data ) + public static IAEFluidStack fromNBT( final CompoundNBT data ) { final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( data ); @@ -127,7 +128,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu final boolean hasTagCompound = ( mask & 0x80 ) > 0; // don't send this... - final NBTTagCompound d = new NBTTagCompound(); + final CompoundNBT d = new CompoundNBT(); final byte len2 = buffer.readByte(); final byte[] name = new byte[len2]; @@ -178,7 +179,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu } @Override - public void writeToNBT( final NBTTagCompound data ) + public void writeToNBT( final CompoundNBT data ) { data.setString( "FluidName", this.fluid.getName() ); data.setByte( "Count", (byte) 0 ); @@ -318,7 +319,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu } @Override - public void writeToPacket( final ByteBuf buffer ) throws IOException + public void writeToPacket( final PacketBuffer buffer ) throws IOException { final byte mask = (byte) ( ( this.getType( this.getStackSize() ) << 2 ) | ( this .getType( this.getCountRequestable() ) << 4 ) | ( (byte) ( this.isCraftable() ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 ); @@ -331,7 +332,7 @@ public final class AEFluidStack extends AEStack implements IAEFlu this.putPacketValue( buffer, this.getCountRequestable() ); } - private void writeToStream( final ByteBuf buffer ) throws IOException + private void writeToStream( final PacketBuffer buffer ) throws IOException { final byte[] name = this.fluid.getName().getBytes( "UTF-8" ); buffer.writeByte( (byte) name.length ); diff --git a/src/main/java/appeng/helpers/AEGlassMaterial.java b/src/main/java/appeng/helpers/AEGlassMaterial.java index 7667ea789..b0e86ec67 100644 --- a/src/main/java/appeng/helpers/AEGlassMaterial.java +++ b/src/main/java/appeng/helpers/AEGlassMaterial.java @@ -19,29 +19,14 @@ package appeng.helpers; -import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; +import net.minecraft.block.material.MaterialColor; +import net.minecraft.block.material.PushReaction; -public class AEGlassMaterial extends Material +public class AEGlassMaterial { - public static final AEGlassMaterial INSTANCE = ( new AEGlassMaterial( MapColor.AIR ) ); + public static final Material INSTANCE = new Material( MaterialColor.AIR, false, false, true, false, true, false, false, PushReaction.NORMAL ); - public AEGlassMaterial( final MapColor color ) - { - super( color ); - } - - @Override - public boolean isSolid() - { - return false; - } - - @Override - public boolean isOpaque() - { - return false; - } } diff --git a/src/main/java/appeng/helpers/DualityInterface.java b/src/main/java/appeng/helpers/DualityInterface.java index 3c1791bca..7391c4bf3 100644 --- a/src/main/java/appeng/helpers/DualityInterface.java +++ b/src/main/java/appeng/helpers/DualityInterface.java @@ -32,15 +32,15 @@ import javax.annotation.Nullable; import com.google.common.collect.ImmutableSet; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Items; -import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.block.BlockState; +import net.minecraft.inventory.CraftingInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.item.Items; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; @@ -214,7 +214,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn } } - public void writeToNBT( final NBTTagCompound data ) + public void writeToNBT( final CompoundNBT data ) { this.config.writeToNBT( data, "config" ); this.patterns.writeToNBT( data, "patterns" ); @@ -222,33 +222,33 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn this.upgrades.writeToNBT( data, "upgrades" ); this.cm.writeToNBT( data ); this.craftingTracker.writeToNBT( data ); - data.setInteger( "priority", this.priority ); + data.putInt( "priority", this.priority ); - final NBTTagList waitingToSend = new NBTTagList(); + final ListNBT waitingToSend = new ListNBT(); if( this.waitingToSend != null ) { for( final ItemStack is : this.waitingToSend ) { - final NBTTagCompound item = new NBTTagCompound(); - is.writeToNBT( item ); - waitingToSend.appendTag( item ); + final CompoundNBT item = new CompoundNBT(); + is.write( item ); + waitingToSend.add( item ); } } - data.setTag( "waitingToSend", waitingToSend ); + data.put( "waitingToSend", waitingToSend ); } - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { this.waitingToSend = null; - final NBTTagList waitingList = data.getTagList( "waitingToSend", 10 ); + final ListNBT waitingList = data.getList( "waitingToSend", 10 ); if( waitingList != null ) { - for( int x = 0; x < waitingList.tagCount(); x++ ) + for( int x = 0; x < waitingList.size(); x++ ) { - final NBTTagCompound c = waitingList.getCompoundTagAt( x ); + final CompoundNBT c = waitingList.getCompound( x ); if( c != null ) { - final ItemStack is = new ItemStack( c ); + final ItemStack is = ItemStack.read( c ); this.addToSendList( is ); } } @@ -259,7 +259,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn this.config.readFromNBT( data, "config" ); this.patterns.readFromNBT( data, "patterns" ); this.storage.readFromNBT( data, "storage" ); - this.priority = data.getInteger( "priority" ); + this.priority = data.getInt( "priority" ); this.cm.readFromNBT( data ); this.readConfig(); this.updateCraftingList(); @@ -584,7 +584,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn return this.hasWorkToDo() ? ( couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER ) : TickRateModulation.SLEEP; } - private void pushItemsOut( final EnumSet possibleDirections ) + private void pushItemsOut( final EnumSet possibleDirections ) { if( !this.hasItemsToSend() ) { @@ -599,7 +599,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn { ItemStack whatToSend = i.next(); - for( final EnumFacing s : possibleDirections ) + for( final Direction s : possibleDirections ) { final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) ); if( te == null ) @@ -894,7 +894,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn } @Override - public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table ) + public boolean pushPattern( final ICraftingPatternDetails patternDetails, final CraftingInventory table ) { if( this.hasItemsToSend() || !this.gridProxy.isActive() || !this.craftingList.contains( patternDetails ) ) { @@ -904,8 +904,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn final TileEntity tile = this.iHost.getTileEntity(); final World w = tile.getWorld(); - final EnumSet possibleDirections = this.iHost.getTargets(); - for( final EnumFacing s : possibleDirections ) + final EnumSet possibleDirections = this.iHost.getTargets(); + for( final Direction s : possibleDirections ) { final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) ); if( te instanceof IInterfaceHost ) @@ -979,13 +979,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn if( this.isBlocking() ) { - final EnumSet possibleDirections = this.iHost.getTargets(); + final EnumSet possibleDirections = this.iHost.getTargets(); final TileEntity tile = this.iHost.getTileEntity(); final World w = tile.getWorld(); boolean allAreBusy = true; - for( final EnumFacing s : possibleDirections ) + for( final Direction s : possibleDirections ) { final TileEntity te = w.getTileEntity( tile.getPos().offset( s ) ); @@ -1016,7 +1016,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn return this.cm.getSetting( Settings.BLOCK ) == YesNo.YES; } - private boolean acceptsItems( final InventoryAdaptor ad, final InventoryCrafting table ) + private boolean acceptsItems( final InventoryAdaptor ad, final CraftingInventory table ) { for( int x = 0; x < table.getSizeInventory(); x++ ) { @@ -1147,8 +1147,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn return ( (ICustomNameObject) this.iHost ).getCustomInventoryName(); } - final EnumSet possibleDirections = this.iHost.getTargets(); - for( final EnumFacing direction : possibleDirections ) + final EnumSet possibleDirections = this.iHost.getTargets(); + for( final Direction direction : possibleDirections ) { final BlockPos targ = hostTile.getPos().offset( direction ); final TileEntity directedTile = hostWorld.getTileEntity( targ ); @@ -1181,15 +1181,15 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn continue; } - final IBlockState directedBlockState = hostWorld.getBlockState( targ ); + final BlockState directedBlockState = hostWorld.getBlockState( targ ); final Block directedBlock = directedBlockState.getBlock(); - ItemStack what = new ItemStack( directedBlock, 1, directedBlock.getMetaFromState( directedBlockState ) ); + ItemStack what = new ItemStack( directedBlock, 1 ); try { Vec3d from = new Vec3d( hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5 ); - from = from.addVector( direction.getFrontOffsetX() * 0.501, direction.getFrontOffsetY() * 0.501, direction.getFrontOffsetZ() * 0.501 ); - final Vec3d to = from.addVector( direction.getFrontOffsetX(), direction.getFrontOffsetY(), direction.getFrontOffsetZ() ); - final RayTraceResult mop = hostWorld.rayTraceBlocks( from, to, true ); + from = from.add( direction.getXOffset() * 0.501, direction.getYOffset() * 0.501, direction.getZOffset() * 0.501 ); + final Vec3d to = from.add( direction.getXOffset(), direction.getYOffset(), direction.getZOffset() ); + final RayTraceResult mop = hostWorld.rayTraceBlocks( from, to ); if( mop != null && !BAD_BLOCKS.contains( directedBlock ) ) { if( mop.getBlockPos().equals( directedTile.getPos() ) ) @@ -1209,13 +1209,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn if( what.getItem() != Items.AIR ) { - return what.getUnlocalizedName(); + return what.getTranslationKey(); } final Item item = Item.getItemFromBlock( directedBlock ); if( item == Items.AIR ) { - return directedBlock.getUnlocalizedName(); + return directedBlock.getTranslationKey(); } } } @@ -1254,13 +1254,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn } } - public boolean hasCapability( Capability capabilityClass, EnumFacing facing ) + public boolean hasCapability( Capability capabilityClass, Direction facing ) { return capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || capabilityClass == Capabilities.STORAGE_MONITORABLE_ACCESSOR; } @SuppressWarnings( "unchecked" ) - public T getCapability( Capability capabilityClass, EnumFacing facing ) + public T getCapability( Capability capabilityClass, Direction facing ) { if( capabilityClass == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) { diff --git a/src/main/java/appeng/helpers/IInterfaceHost.java b/src/main/java/appeng/helpers/IInterfaceHost.java index 3593d6107..522ed0963 100644 --- a/src/main/java/appeng/helpers/IInterfaceHost.java +++ b/src/main/java/appeng/helpers/IInterfaceHost.java @@ -22,7 +22,7 @@ package appeng.helpers; import java.util.EnumSet; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.implementations.IUpgradeableHost; import appeng.api.networking.crafting.ICraftingProvider; @@ -34,7 +34,7 @@ public interface IInterfaceHost extends ICraftingProvider, IUpgradeableHost, ICr DualityInterface getInterfaceDuality(); - EnumSet getTargets(); + EnumSet getTargets(); TileEntity getTileEntity(); diff --git a/src/main/java/appeng/helpers/InvalidPatternHelper.java b/src/main/java/appeng/helpers/InvalidPatternHelper.java index ea1e0c85d..453675789 100644 --- a/src/main/java/appeng/helpers/InvalidPatternHelper.java +++ b/src/main/java/appeng/helpers/InvalidPatternHelper.java @@ -23,8 +23,8 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.text.TextFormatting; import appeng.util.Platform; @@ -40,30 +40,30 @@ public class InvalidPatternHelper public InvalidPatternHelper( final ItemStack is ) { - final NBTTagCompound encodedValue = is.getTagCompound(); + final CompoundNBT encodedValue = is.getTag(); if( encodedValue == null ) { throw new IllegalArgumentException( "No pattern here!" ); } - final NBTTagList inTag = encodedValue.getTagList( "in", 10 ); - final NBTTagList outTag = encodedValue.getTagList( "out", 10 ); + final ListNBT inTag = encodedValue.getList( "in", 10 ); + final ListNBT outTag = encodedValue.getList( "out", 10 ); this.isCrafting = encodedValue.getBoolean( "crafting" ); this.canSubstitute = this.isCrafting && encodedValue.getBoolean( "substitute" ); - for( int i = 0; i < outTag.tagCount(); i++ ) + for( int i = 0; i < outTag.size(); i++ ) { - this.outputs.add( new PatternIngredient( outTag.getCompoundTagAt( i ) ) ); + this.outputs.add( new PatternIngredient( outTag.getCompound( i ) ) ); } - for( int i = 0; i < inTag.tagCount(); i++ ) + for( int i = 0; i < inTag.size(); i++ ) { - NBTTagCompound in = inTag.getCompoundTagAt( i ); + CompoundNBT in = inTag.getCompound( i ); // skip empty slots in the crafting grid - if( in.hasNoTags() ) + if( in.isEmpty() ) { continue; } @@ -100,9 +100,9 @@ public class InvalidPatternHelper private ItemStack stack; - public PatternIngredient( NBTTagCompound tag ) + public PatternIngredient( CompoundNBT tag ) { - this.stack = new ItemStack( tag ); + this.stack = ItemStack.read( tag ); if( this.stack.isEmpty() ) { @@ -124,7 +124,7 @@ public class InvalidPatternHelper public int getDamage() { - return this.isValid() ? this.stack.getItemDamage() : this.damage; + return this.isValid() ? this.stack.getDamage() : this.damage; } public int getCount() diff --git a/src/main/java/appeng/helpers/LocationRotation.java b/src/main/java/appeng/helpers/LocationRotation.java index 6a8d7000e..0b83274b6 100644 --- a/src/main/java/appeng/helpers/LocationRotation.java +++ b/src/main/java/appeng/helpers/LocationRotation.java @@ -19,8 +19,8 @@ package appeng.helpers; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.Direction; +import net.minecraft.world.IBlockReader; import appeng.api.util.IOrientable; @@ -28,12 +28,12 @@ import appeng.api.util.IOrientable; public class LocationRotation implements IOrientable { - private final IBlockAccess w; + private final IBlockReader w; private final int x; private final int y; private final int z; - public LocationRotation( final IBlockAccess world, final int x, final int y, final int z ) + public LocationRotation( final IBlockReader world, final int x, final int y, final int z ) { this.w = world; this.x = x; @@ -48,24 +48,24 @@ public class LocationRotation implements IOrientable } @Override - public EnumFacing getForward() + public Direction getForward() { - if( this.getUp().getFrontOffsetY() == 0 ) + if( this.getUp().getYOffset() == 0 ) { - return EnumFacing.UP; + return Direction.UP; } - return EnumFacing.SOUTH; + return Direction.SOUTH; } @Override - public EnumFacing getUp() + public Direction getUp() { final int num = Math.abs( this.x + this.y + this.z ) % 6; - return EnumFacing.VALUES[num]; + return Direction.values()[num]; } @Override - public void setOrientation( final EnumFacing forward, final EnumFacing up ) + public void setOrientation( final Direction forward, final Direction up ) { } diff --git a/src/main/java/appeng/helpers/MetaRotation.java b/src/main/java/appeng/helpers/MetaRotation.java index 1ac643c3e..9c10aa89e 100644 --- a/src/main/java/appeng/helpers/MetaRotation.java +++ b/src/main/java/appeng/helpers/MetaRotation.java @@ -19,12 +19,12 @@ package appeng.helpers; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.block.BlockState; +import net.minecraft.state.Property; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; +import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import appeng.api.util.IOrientable; @@ -34,11 +34,11 @@ import appeng.decorative.solid.BlockQuartzPillar; public class MetaRotation implements IOrientable { - private final IProperty facingProp; - private final IBlockAccess w; + private final Property facingProp; + private final IBlockReader w; private final BlockPos pos; - public MetaRotation( final IBlockAccess world, final BlockPos pos, final IProperty facingProp ) + public MetaRotation( final IBlockReader world, final BlockPos pos, final Property facingProp ) { this.w = world; this.pos = pos; @@ -52,27 +52,27 @@ public class MetaRotation implements IOrientable } @Override - public EnumFacing getForward() + public Direction getForward() { - if( this.getUp().getFrontOffsetY() == 0 ) + if( this.getUp().getYOffset() == 0 ) { - return EnumFacing.UP; + return Direction.UP; } - return EnumFacing.SOUTH; + return Direction.SOUTH; } @Override - public EnumFacing getUp() + public Direction getUp() { - final IBlockState state = this.w.getBlockState( this.pos ); + final BlockState state = this.w.getBlockState( this.pos ); if( this.facingProp != null ) { - return state.getValue( this.facingProp ); + return state.get( this.facingProp ); } // TODO 1.10.2-R - Temp - Axis a = state.getValue( BlockQuartzPillar.AXIS_ORIENTATION ); + Axis a = state.get( BlockQuartzPillar.AXIS ); if( a == null ) { @@ -82,28 +82,28 @@ public class MetaRotation implements IOrientable switch( a ) { case X: - return EnumFacing.EAST; + return Direction.EAST; case Z: - return EnumFacing.SOUTH; + return Direction.SOUTH; default: case Y: - return EnumFacing.UP; + return Direction.UP; } } @Override - public void setOrientation( final EnumFacing forward, final EnumFacing up ) + public void setOrientation( final Direction forward, final Direction up ) { if( this.w instanceof World ) { if( this.facingProp != null ) { - ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( this.facingProp, up ) ); + ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).with( this.facingProp, up ) ); } else { // TODO 1.10.2-R - Temp - ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).withProperty( BlockQuartzPillar.AXIS_ORIENTATION, up.getAxis() ) ); + ( (World) this.w ).setBlockState( this.pos, this.w.getBlockState( this.pos ).with( BlockQuartzPillar.AXIS, up.getAxis() ) ); } } else diff --git a/src/main/java/appeng/helpers/MultiCraftingTracker.java b/src/main/java/appeng/helpers/MultiCraftingTracker.java index 464ef0716..9e8021a35 100644 --- a/src/main/java/appeng/helpers/MultiCraftingTracker.java +++ b/src/main/java/appeng/helpers/MultiCraftingTracker.java @@ -24,7 +24,7 @@ import java.util.concurrent.Future; import com.google.common.collect.ImmutableSet; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.world.World; import appeng.api.AEApi; @@ -53,20 +53,20 @@ public class MultiCraftingTracker this.size = size; } - public void readFromNBT( final NBTTagCompound extra ) + public void readFromNBT( final CompoundNBT extra ) { for( int x = 0; x < this.size; x++ ) { - final NBTTagCompound link = extra.getCompoundTag( "links-" + x ); + final CompoundNBT link = extra.getCompound( "links-" + x ); - if( link != null && !link.hasNoTags() ) + if( link != null && !link.isEmpty() ) { this.setLink( x, AEApi.instance().storage().loadCraftingLink( link, this.owner ) ); } } } - public void writeToNBT( final NBTTagCompound extra ) + public void writeToNBT( final CompoundNBT extra ) { for( int x = 0; x < this.size; x++ ) { @@ -74,9 +74,9 @@ public class MultiCraftingTracker if( link != null ) { - final NBTTagCompound ln = new NBTTagCompound(); + final CompoundNBT ln = new CompoundNBT(); link.writeToNBT( ln ); - extra.setTag( "links-" + x, ln ); + extra.put( "links-" + x, ln ); } } } diff --git a/src/main/java/appeng/helpers/NullRotation.java b/src/main/java/appeng/helpers/NullRotation.java index 1c18237eb..c8abc4305 100644 --- a/src/main/java/appeng/helpers/NullRotation.java +++ b/src/main/java/appeng/helpers/NullRotation.java @@ -19,7 +19,7 @@ package appeng.helpers; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.util.IOrientable; @@ -39,19 +39,19 @@ public class NullRotation implements IOrientable } @Override - public EnumFacing getForward() + public Direction getForward() { - return EnumFacing.SOUTH; + return Direction.SOUTH; } @Override - public EnumFacing getUp() + public Direction getUp() { - return EnumFacing.UP; + return Direction.UP; } @Override - public void setOrientation( final EnumFacing forward, final EnumFacing up ) + public void setOrientation( final Direction forward, final Direction up ) { } diff --git a/src/main/java/appeng/helpers/PatternHelper.java b/src/main/java/appeng/helpers/PatternHelper.java index dd20d02d9..2bc7f5386 100644 --- a/src/main/java/appeng/helpers/PatternHelper.java +++ b/src/main/java/appeng/helpers/PatternHelper.java @@ -27,13 +27,13 @@ import java.util.Map; import java.util.Set; import java.util.StringJoiner; -import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.inventory.CraftingInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.world.World; import appeng.api.AEApi; @@ -52,8 +52,8 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable in = new ArrayList<>(); final List out = new ArrayList<>(); - for( int x = 0; x < inTag.tagCount(); x++ ) + for( int x = 0; x < inTag.size(); x++ ) { - NBTTagCompound ingredient = inTag.getCompoundTagAt( x ); - final ItemStack gs = new ItemStack( ingredient ); + CompoundNBT ingredient = inTag.getCompound( x ); + final ItemStack gs = ItemStack.read( ingredient ); - if( !ingredient.hasNoTags() && gs.isEmpty() ) + if( !ingredient.isEmpty() && gs.isEmpty() ) { throw new IllegalArgumentException( "No pattern here!" ); } this.crafting.setInventorySlotContents( x, gs ); - if( !gs.isEmpty() && ( !this.isCrafting || !gs.hasTagCompound() ) ) + if( !gs.isEmpty() && ( !this.isCrafting || !gs.hasTag() ) ) { this.markItemAs( x, gs, TestStatus.ACCEPT ); } @@ -110,7 +110,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable for output <%s> rejected inputs [%s]. %s", - this.standardRecipe.getRegistryName(), this.standardRecipe.getRecipeOutput(), joinActualInputs, foundAlternativeRecipe ); + this.standardRecipe.getId(), this.standardRecipe.getRecipeOutput(), joinActualInputs, foundAlternativeRecipe ); } @Override @@ -459,7 +462,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable> 3 ) & 0x0F]; this.lumen = ( ( val >> 7 ) & 0x01 ) > 0; } @@ -102,7 +102,7 @@ public class Splotch return Math.abs( this.pos + val ); } - public EnumFacing getSide() + public Direction getSide() { return this.side; } diff --git a/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java b/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java index 35edefea1..096b3ce6b 100644 --- a/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java +++ b/src/main/java/appeng/helpers/WirelessTerminalGuiObject.java @@ -19,7 +19,7 @@ package appeng.helpers; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -56,7 +56,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II private final ItemStack effectiveItem; private final IWirelessTermHandler wth; private final String encryptionKey; - private final EntityPlayer myPlayer; + private final PlayerEntity myPlayer; private IGrid targetGrid; private IStorageGrid sg; private IMEMonitor itemStorage; @@ -65,7 +65,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II private double myRange = Double.MAX_VALUE; private final int inventorySlot; - public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z ) + public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final PlayerEntity ep, final World w, final int x, final int y, final int z ) { this.encryptionKey = wh.getEncryptionKey( is ); this.effectiveItem = is; diff --git a/src/main/java/appeng/hooks/DispenserBehaviorTinyTNT.java b/src/main/java/appeng/hooks/DispenserBehaviorTinyTNT.java index 75031b828..50fc94dd1 100644 --- a/src/main/java/appeng/hooks/DispenserBehaviorTinyTNT.java +++ b/src/main/java/appeng/hooks/DispenserBehaviorTinyTNT.java @@ -19,29 +19,29 @@ package appeng.hooks; -import net.minecraft.block.BlockDispenser; -import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.block.DispenserBlock; +import net.minecraft.dispenser.DefaultDispenseItemBehavior; import net.minecraft.dispenser.IBlockSource; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.world.World; import appeng.entity.EntityTinyTNTPrimed; -public final class DispenserBehaviorTinyTNT extends BehaviorDefaultDispenseItem +public final class DispenserBehaviorTinyTNT extends DefaultDispenseItemBehavior { @Override protected ItemStack dispenseStack( final IBlockSource dispenser, final ItemStack dispensedItem ) { - final EnumFacing enumfacing = dispenser.getBlockState().getValue( BlockDispenser.FACING ); + final Direction Direction = dispenser.getBlockState().get( DispenserBlock.FACING ); final World world = dispenser.getWorld(); - final int i = dispenser.getBlockPos().getX() + enumfacing.getFrontOffsetX(); - final int j = dispenser.getBlockPos().getY() + enumfacing.getFrontOffsetY(); - final int k = dispenser.getBlockPos().getZ() + enumfacing.getFrontOffsetZ(); + final int i = dispenser.getBlockPos().getX() + Direction.getXOffset(); + final int j = dispenser.getBlockPos().getY() + Direction.getYOffset(); + final int k = dispenser.getBlockPos().getZ() + Direction.getZOffset(); final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( world, i + 0.5F, j + 0.5F, k + 0.5F, null ); - world.spawnEntity( primedTinyTNTEntity ); + world.addEntity( primedTinyTNTEntity ); dispensedItem.setCount( dispensedItem.getCount() - 1 ); return dispensedItem; } diff --git a/src/main/java/appeng/hooks/DispenserBlockTool.java b/src/main/java/appeng/hooks/DispenserBlockTool.java index 65db383bf..fa92cb33f 100644 --- a/src/main/java/appeng/hooks/DispenserBlockTool.java +++ b/src/main/java/appeng/hooks/DispenserBlockTool.java @@ -19,20 +19,20 @@ package appeng.hooks; -import net.minecraft.block.BlockDispenser; -import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.block.DispenserBlock; +import net.minecraft.dispenser.DefaultDispenseItemBehavior; import net.minecraft.dispenser.IBlockSource; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; +import net.minecraft.world.server.ServerWorld; import appeng.util.Platform; -public final class DispenserBlockTool extends BehaviorDefaultDispenseItem +public final class DispenserBlockTool extends DefaultDispenseItemBehavior { @Override @@ -41,14 +41,14 @@ public final class DispenserBlockTool extends BehaviorDefaultDispenseItem final Item i = dispensedItem.getItem(); if( i instanceof IBlockTool ) { - final EnumFacing enumfacing = dispenser.getBlockState().getValue( BlockDispenser.FACING ); + final Direction Direction = dispenser.getBlockState().get( DispenserBlock.FACING ); final IBlockTool tm = (IBlockTool) i; final World w = dispenser.getWorld(); - if( w instanceof WorldServer ) + if( w instanceof ServerWorld ) { - tm.onItemUse( dispensedItem, Platform.getPlayer( (WorldServer) w ), w, dispenser.getBlockPos().offset( enumfacing ), EnumHand.MAIN_HAND, - enumfacing, 0.5f, 0.5f, 0.5f ); + tm.onItemUse( dispensedItem, Platform.getPlayer( (ServerWorld) w ), w, dispenser.getBlockPos().offset( Direction ), Hand.MAIN_HAND, + Direction, 0.5f, 0.5f, 0.5f ); } } return dispensedItem; diff --git a/src/main/java/appeng/hooks/DispenserMatterCannon.java b/src/main/java/appeng/hooks/DispenserMatterCannon.java index 1eae245dc..c69e88344 100644 --- a/src/main/java/appeng/hooks/DispenserMatterCannon.java +++ b/src/main/java/appeng/hooks/DispenserMatterCannon.java @@ -19,22 +19,22 @@ package appeng.hooks; -import net.minecraft.block.BlockDispenser; -import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.block.DispenserBlock; +import net.minecraft.dispenser.DefaultDispenseItemBehavior; import net.minecraft.dispenser.IBlockSource; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; +import net.minecraft.world.server.ServerWorld; import appeng.api.util.AEPartLocation; import appeng.items.tools.powered.ToolMatterCannon; import appeng.util.Platform; -public final class DispenserMatterCannon extends BehaviorDefaultDispenseItem +public final class DispenserMatterCannon extends DefaultDispenseItemBehavior { @Override @@ -43,11 +43,11 @@ public final class DispenserMatterCannon extends BehaviorDefaultDispenseItem final Item i = dispensedItem.getItem(); if( i instanceof ToolMatterCannon ) { - final EnumFacing enumfacing = dispenser.getBlockState().getValue( BlockDispenser.FACING ); + final Direction Direction = dispenser.getBlockState().get( DispenserBlock.FACING ); AEPartLocation dir = AEPartLocation.INTERNAL; for( final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS ) { - if( enumfacing.getFrontOffsetX() == d.xOffset && enumfacing.getFrontOffsetY() == d.yOffset && enumfacing.getFrontOffsetZ() == d.zOffset ) + if( Direction.getXOffset() == d.xOffset && Direction.getYOffset() == d.yOffset && Direction.getZOffset() == d.zOffset ) { dir = d; } @@ -56,14 +56,12 @@ public final class DispenserMatterCannon extends BehaviorDefaultDispenseItem final ToolMatterCannon tm = (ToolMatterCannon) i; final World w = dispenser.getWorld(); - if( w instanceof WorldServer ) + if( w instanceof ServerWorld ) { - final EntityPlayer p = Platform.getPlayer( (WorldServer) w ); + final PlayerEntity p = Platform.getPlayer( (ServerWorld) w ); Platform.configurePlayer( p, dir, dispenser.getBlockTileEntity() ); - p.posX += dir.xOffset; - p.posY += dir.yOffset; - p.posZ += dir.zOffset; + p.setPosition( p.getPosX() + dir.xOffset, p.getPosY() + dir.yOffset, p.getPosZ() + dir.zOffset ); dispensedItem = tm.onItemRightClick( w, p, null ).getResult(); } diff --git a/src/main/java/appeng/hooks/IBlockTool.java b/src/main/java/appeng/hooks/IBlockTool.java index f002018fc..12527e488 100644 --- a/src/main/java/appeng/hooks/IBlockTool.java +++ b/src/main/java/appeng/hooks/IBlockTool.java @@ -19,11 +19,11 @@ package appeng.hooks; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -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.math.BlockPos; import net.minecraft.world.World; @@ -31,8 +31,8 @@ import net.minecraft.world.World; public interface IBlockTool { // Workaround for dispenser logic. - EnumActionResult onItemUse( ItemStack is, EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ ); + ActionResult onItemUse( ItemStack is, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ ); - EnumActionResult onItemUse( EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ ); + ActionResult onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ ); } diff --git a/src/main/java/appeng/hooks/TickHandler.java b/src/main/java/appeng/hooks/TickHandler.java index 97ced90dd..b3e47ce52 100644 --- a/src/main/java/appeng/hooks/TickHandler.java +++ b/src/main/java/appeng/hooks/TickHandler.java @@ -36,12 +36,12 @@ import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; import net.minecraft.world.World; +import net.minecraftforge.event.TickEvent; +import net.minecraftforge.event.TickEvent.Phase; +import net.minecraftforge.event.TickEvent.Type; +import net.minecraftforge.event.TickEvent.WorldTickEvent; import net.minecraftforge.event.world.WorldEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.common.gameevent.TickEvent.Type; -import net.minecraftforge.fml.common.gameevent.TickEvent.WorldTickEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import appeng.api.AEApi; import appeng.api.networking.IGridNode; @@ -215,7 +215,7 @@ public class TickHandler while( !repo.tiles.isEmpty() ) { final AEBaseTile bt = repo.tiles.poll(); - if( !bt.isInvalid() ) + if( !bt.isRemoved() ) { bt.onReady(); } diff --git a/src/main/java/appeng/integration/IIntegrationModule.java b/src/main/java/appeng/integration/IIntegrationModule.java deleted file mode 100644 index 2d4be8967..000000000 --- a/src/main/java/appeng/integration/IIntegrationModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration; - - -public interface IIntegrationModule -{ - - default boolean isEnabled() - { - return true; - } - - default void preInit() throws Throwable - { - } - - default void init() throws Throwable - { - } - - default void postInit() - { - } - - class Stub implements IIntegrationModule - { - @Override - public boolean isEnabled() - { - return false; - } - } -} diff --git a/src/main/java/appeng/integration/IntegrationHelper.java b/src/main/java/appeng/integration/IntegrationHelper.java deleted file mode 100644 index 783bbd48a..000000000 --- a/src/main/java/appeng/integration/IntegrationHelper.java +++ /dev/null @@ -1,29 +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 . - */ - -package appeng.integration; - - -public class IntegrationHelper -{ - - public static void testClassExistence( final Object o, final Class clz ) - { - clz.isInstance( o ); - } -} diff --git a/src/main/java/appeng/integration/IntegrationNode.java b/src/main/java/appeng/integration/IntegrationNode.java deleted file mode 100644 index 271936202..000000000 --- a/src/main/java/appeng/integration/IntegrationNode.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration; - - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModAPIManager; - -import appeng.api.exceptions.ModNotInstalledException; -import appeng.core.AEConfig; -import appeng.core.AELog; - - -final class IntegrationNode -{ - - private final String displayName; - private final String modID; - private final IntegrationType type; - private IntegrationStage state = IntegrationStage.PRE_INIT; - private Throwable exception = null; - private IIntegrationModule mod = null; - - IntegrationNode( final String displayName, final String modID, final IntegrationType type ) - { - this.displayName = displayName; - this.type = type; - this.modID = modID; - } - - @Override - public String toString() - { - return this.getType().name() + ':' + this.getState().name(); - } - - boolean isActive() - { - if( this.getState() == IntegrationStage.PRE_INIT ) - { - this.call( IntegrationStage.PRE_INIT ); - } - - return this.getState() != IntegrationStage.FAILED; - } - - void call( final IntegrationStage stage ) - { - if( this.getState() != IntegrationStage.FAILED ) - { - if( this.getState().ordinal() > stage.ordinal() ) - { - return; - } - - try - { - switch( stage ) - { - case PRE_INIT: - final ModAPIManager apiManager = ModAPIManager.INSTANCE; - boolean enabled = this.modID == null || Loader.isModLoaded( this.modID ) || apiManager.hasAPI( this.modID ); - - AEConfig.instance() - .addCustomCategoryComment( "ModIntegration", - "Valid Values are 'AUTO', 'ON', or 'OFF' - defaults to 'AUTO' ; Suggested that you leave this alone unless your experiencing an issue, or wish to disable the integration for a reason." ); - final String mode = AEConfig.instance().get( "ModIntegration", this.displayName.replace( " ", "" ), "AUTO" ).getString(); - - if( mode.toUpperCase().equals( "ON" ) ) - { - enabled = true; - } - if( mode.toUpperCase().equals( "OFF" ) ) - { - enabled = false; - } - - if( enabled ) - { - this.mod = this.type.createInstance(); - } - else - { - throw new ModNotInstalledException( this.modID ); - } - - this.mod.preInit(); - this.setState( IntegrationStage.INIT ); - - break; - case INIT: - this.mod.init(); - this.setState( IntegrationStage.POST_INIT ); - - break; - case POST_INIT: - this.mod.postInit(); - this.setState( IntegrationStage.READY ); - - break; - case FAILED: - default: - break; - } - } - catch( final Throwable t ) - { - this.exception = t; - this.setState( IntegrationStage.FAILED ); - } - } - - if( stage == IntegrationStage.POST_INIT ) - { - if( this.getState() == IntegrationStage.FAILED ) - { - AELog.info( this.displayName + " - Integration Disabled" ); - if( !( this.exception instanceof ModNotInstalledException ) ) - { - AELog.integration( this.exception ); - } - } - else - { - AELog.info( this.displayName + " - Integration Enable" ); - } - } - } - - IntegrationType getType() - { - return this.type; - } - - IntegrationStage getState() - { - return this.state; - } - - private void setState( final IntegrationStage state ) - { - this.state = state; - } -} diff --git a/src/main/java/appeng/integration/IntegrationRegistry.java b/src/main/java/appeng/integration/IntegrationRegistry.java deleted file mode 100644 index d4cfbf453..000000000 --- a/src/main/java/appeng/integration/IntegrationRegistry.java +++ /dev/null @@ -1,104 +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 . - */ - -package appeng.integration; - - -import java.util.ArrayList; -import java.util.Collection; - -import net.minecraftforge.fml.relauncher.FMLLaunchHandler; -import net.minecraftforge.fml.relauncher.Side; - - -public enum IntegrationRegistry -{ - INSTANCE; - - private final Collection modules = new ArrayList<>(); - - public void add( final IntegrationType type ) - { - if( type.side == IntegrationSide.CLIENT && FMLLaunchHandler.side() == Side.SERVER ) - { - return; - } - - if( type.side == IntegrationSide.SERVER && FMLLaunchHandler.side() == Side.CLIENT ) - { - return; - } - - this.modules.add( new IntegrationNode( type.dspName, type.modID, type ) ); - } - - public void preInit() - { - for( final IntegrationNode node : this.modules ) - { - node.call( IntegrationStage.PRE_INIT ); - } - } - - public void init() - { - for( final IntegrationNode node : this.modules ) - { - node.call( IntegrationStage.INIT ); - } - } - - public void postInit() - { - for( final IntegrationNode node : this.modules ) - { - node.call( IntegrationStage.POST_INIT ); - } - } - - public String getStatus() - { - final StringBuilder builder = new StringBuilder( this.modules.size() * 3 ); - - for( final IntegrationNode node : this.modules ) - { - if( builder.length() != 0 ) - { - builder.append( ", " ); - } - - final String integrationState = node.getType() + ":" + ( node.getState() == IntegrationStage.FAILED ? "OFF" : "ON" ); - builder.append( integrationState ); - } - - return builder.toString(); - } - - public boolean isEnabled( final IntegrationType name ) - { - for( final IntegrationNode node : this.modules ) - { - if( node.getType() == name ) - { - return node.isActive(); - } - } - return false; - } - -} diff --git a/src/main/java/appeng/integration/IntegrationSide.java b/src/main/java/appeng/integration/IntegrationSide.java deleted file mode 100644 index 0e4a4b333..000000000 --- a/src/main/java/appeng/integration/IntegrationSide.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration; - - -enum IntegrationSide -{ - CLIENT, SERVER, BOTH -} diff --git a/src/main/java/appeng/integration/IntegrationStage.java b/src/main/java/appeng/integration/IntegrationStage.java deleted file mode 100644 index 4b65d76d5..000000000 --- a/src/main/java/appeng/integration/IntegrationStage.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration; - - -enum IntegrationStage -{ - - PRE_INIT, - INIT, - POST_INIT, - - FAILED, - READY - -} diff --git a/src/main/java/appeng/integration/IntegrationType.java b/src/main/java/appeng/integration/IntegrationType.java deleted file mode 100644 index c06a485a0..000000000 --- a/src/main/java/appeng/integration/IntegrationType.java +++ /dev/null @@ -1,114 +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 . - */ - -package appeng.integration; - - -import appeng.integration.modules.crafttweaker.CTModule; -import appeng.integration.modules.ic2.IC2Module; -import appeng.integration.modules.inventorytweaks.InventoryTweaksModule; -import appeng.integration.modules.jei.JEIModule; -import appeng.integration.modules.theoneprobe.TheOneProbeModule; -import appeng.integration.modules.waila.WailaModule; - - -public enum IntegrationType -{ - IC2( IntegrationSide.BOTH, "Industrial Craft 2", "ic2" ) - { - @Override - public IIntegrationModule createInstance() - { - return Integrations.setIc2( new IC2Module() ); - } - }, - - RC( IntegrationSide.BOTH, "Railcraft", "railcraft" ), - - MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "minefactoryreloaded" ), - - Waila( IntegrationSide.BOTH, "Waila", "waila" ) - { - @Override - public IIntegrationModule createInstance() - { - return new WailaModule(); - } - }, - - InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ) - { - @Override - public IIntegrationModule createInstance() - { - return Integrations.setInvTweaks( new InventoryTweaksModule() ); - } - }, - - JEI( IntegrationSide.CLIENT, "Just Enough Items", "jei" ) - { - @Override - public IIntegrationModule createInstance() - { - return Integrations.setJei( new JEIModule() ); - } - }, - - Mekanism( IntegrationSide.BOTH, "Mekanism", "mekanism" ), - - OpenComputers( IntegrationSide.BOTH, "OpenComputers", "opencomputers" ), - - THE_ONE_PROBE( IntegrationSide.BOTH, "TheOneProbe", "theoneprobe" ) - { - @Override - public IIntegrationModule createInstance() - { - return new TheOneProbeModule(); - } - }, - - TESLA( IntegrationSide.BOTH, "Tesla", "tesla" ), - - CRAFTTWEAKER( IntegrationSide.BOTH, "CraftTweaker", "crafttweaker" ) - { - @Override - public IIntegrationModule createInstance() - { - return new CTModule(); - } - }; - - public final IntegrationSide side; - public final String dspName; - public final String modID; - - IntegrationType( final IntegrationSide side, final String name, final String modid ) - { - this.side = side; - this.dspName = name; - this.modID = modid; - } - - public IIntegrationModule createInstance() - { - return new IIntegrationModule() - { - }; - } - -} diff --git a/src/main/java/appeng/integration/Integrations.java b/src/main/java/appeng/integration/Integrations.java deleted file mode 100644 index 871b4cb06..000000000 --- a/src/main/java/appeng/integration/Integrations.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration; - - -import appeng.integration.abstraction.IIC2; -import appeng.integration.abstraction.IInvTweaks; -import appeng.integration.abstraction.IJEI; -import appeng.integration.abstraction.IMekanism; -import appeng.integration.abstraction.IRC; - - -/** - * Provides convenient access to various integrations with other mods. - */ -public final class Integrations -{ - - static IIC2 ic2 = new IIC2.Stub(); - - static IJEI jei = new IJEI.Stub(); - - static IRC rc = new IRC.Stub(); - - static IMekanism mekanism = new IMekanism.Stub(); - - static IInvTweaks invTweaks = new IInvTweaks.Stub(); - - private Integrations() - { - } - - public static IIC2 ic2() - { - return ic2; - } - - public static IJEI jei() - { - return jei; - } - - public static IRC rc() - { - return rc; - } - - public static IMekanism mekanism() - { - return mekanism; - } - - public static IInvTweaks invTweaks() - { - return invTweaks; - } - - static IIC2 setIc2( IIC2 ic2 ) - { - Integrations.ic2 = ic2; - return ic2; - } - - static IJEI setJei( IJEI jei ) - { - Integrations.jei = jei; - return jei; - } - - static IRC setRc( IRC rc ) - { - Integrations.rc = rc; - return rc; - } - - static IMekanism setMekanism( IMekanism mekanism ) - { - Integrations.mekanism = mekanism; - return mekanism; - } - - static IInvTweaks setInvTweaks( IInvTweaks invTweaks ) - { - Integrations.invTweaks = invTweaks; - return invTweaks; - } - -} diff --git a/src/main/java/appeng/integration/abstraction/IAEFacade.java b/src/main/java/appeng/integration/abstraction/IAEFacade.java deleted file mode 100644 index 22102d08a..000000000 --- a/src/main/java/appeng/integration/abstraction/IAEFacade.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2018, 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 . - */ - -package appeng.integration.abstraction; - - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraftforge.fml.common.Optional; - -import team.chisel.ctm.api.IFacade; - - -/** - * Neat abstraction class for All the IFacade interfaces. - * - * @author covers1624 - */ -@Optional.Interface( iface = "team.chisel.ctm.api.IFacade", modid = "ctm-api" ) -public interface IAEFacade extends IFacade -{ - - IBlockState getFacadeState( IBlockAccess world, BlockPos pos, EnumFacing side ); - - @Nonnull - @Override - @Optional.Method( modid = "ctm-api" ) - default IBlockState getFacade( @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side, @Nonnull BlockPos connection ) - { - return getFacadeState( world, pos, side ); - } - - @Nonnull - @Override - @Optional.Method( modid = "ctm-api" ) - default IBlockState getFacade( @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nullable EnumFacing side ) - { - return getFacadeState( world, pos, side ); - } -} diff --git a/src/main/java/appeng/integration/abstraction/IC2PowerSink.java b/src/main/java/appeng/integration/abstraction/IC2PowerSink.java deleted file mode 100644 index c3f7f7e54..000000000 --- a/src/main/java/appeng/integration/abstraction/IC2PowerSink.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.abstraction; - - -import java.util.Set; - -import net.minecraft.util.EnumFacing; - - -/** - * Provides an abstraction for the IC2 Basic Sink so it can be stubbed out easily when the integration is disabled, or - * if the IC2 API is not available. - */ -public interface IC2PowerSink -{ - - default void invalidate() - { - } - - default void onChunkUnload() - { - } - - default void onLoad() - { - } - - default void setValidFaces( Set faces ) - { - } -} diff --git a/src/main/java/appeng/integration/abstraction/ICraftTweaker.java b/src/main/java/appeng/integration/abstraction/ICraftTweaker.java deleted file mode 100644 index f608607a8..000000000 --- a/src/main/java/appeng/integration/abstraction/ICraftTweaker.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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 . - */ - -package appeng.integration.abstraction; - - -import appeng.integration.IIntegrationModule; - - -public interface ICraftTweaker extends IIntegrationModule -{ - -} diff --git a/src/main/java/appeng/integration/abstraction/IIC2.java b/src/main/java/appeng/integration/abstraction/IIC2.java deleted file mode 100644 index c76784c87..000000000 --- a/src/main/java/appeng/integration/abstraction/IIC2.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.abstraction; - - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import appeng.integration.IIntegrationModule; -import appeng.integration.modules.ic2.IC2PowerSinkStub; -import appeng.tile.powersink.IExternalPowerSink; - - -public interface IIC2 extends IIntegrationModule -{ - - default void maceratorRecipe( ItemStack in, ItemStack out ) - { - } - - /** - * Create an IC2 power sink for the given external sink. - */ - default IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) - { - return IC2PowerSinkStub.INSTANCE; - } - - class Stub extends IIntegrationModule.Stub implements IIC2 - { - - } -} diff --git a/src/main/java/appeng/integration/abstraction/IInvTweaks.java b/src/main/java/appeng/integration/abstraction/IInvTweaks.java deleted file mode 100644 index f24d5c746..000000000 --- a/src/main/java/appeng/integration/abstraction/IInvTweaks.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.abstraction; - - -import net.minecraft.item.ItemStack; - -import appeng.integration.IIntegrationModule; - - -public interface IInvTweaks extends IIntegrationModule -{ - - default int compareItems( ItemStack i, ItemStack j ) - { - throw new UnsupportedOperationException(); - } - - class Stub extends IIntegrationModule.Stub implements IInvTweaks - { - } - -} diff --git a/src/main/java/appeng/integration/abstraction/IJEI.java b/src/main/java/appeng/integration/abstraction/IJEI.java deleted file mode 100644 index 7f934ebae..000000000 --- a/src/main/java/appeng/integration/abstraction/IJEI.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.abstraction; - - -import appeng.integration.IIntegrationModule; - - -/** - * Abstracts access to the JEI API functionality. - */ -public interface IJEI extends IIntegrationModule -{ - - default String getSearchText() - { - return ""; - } - - default void setSearchText( String searchText ) - { - } - - class Stub extends IIntegrationModule.Stub implements IJEI - { - } -} diff --git a/src/main/java/appeng/integration/abstraction/IMekanism.java b/src/main/java/appeng/integration/abstraction/IMekanism.java deleted file mode 100644 index cc1b48dd3..000000000 --- a/src/main/java/appeng/integration/abstraction/IMekanism.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.abstraction; - - -import net.minecraft.item.ItemStack; - -import appeng.integration.IIntegrationModule; - - -public interface IMekanism extends IIntegrationModule -{ - - default void addCrusherRecipe( ItemStack in, ItemStack out ) - { - } - - default void addEnrichmentChamberRecipe( ItemStack in, ItemStack out ) - { - } - - class Stub extends IIntegrationModule.Stub implements IMekanism - { - } -} diff --git a/src/main/java/appeng/integration/abstraction/IRC.java b/src/main/java/appeng/integration/abstraction/IRC.java deleted file mode 100644 index 74adda35b..000000000 --- a/src/main/java/appeng/integration/abstraction/IRC.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.abstraction; - - -import net.minecraft.item.ItemStack; - -import appeng.integration.IIntegrationModule; - - -public interface IRC extends IIntegrationModule -{ - - default void rockCrusher( ItemStack input, ItemStack output ) - { - } - - class Stub extends IIntegrationModule.Stub implements IRC - { - } - -} diff --git a/src/main/java/appeng/integration/modules/crafttweaker/AttunementRegistry.java b/src/main/java/appeng/integration/modules/crafttweaker/AttunementRegistry.java deleted file mode 100644 index 8bc7f4c60..000000000 --- a/src/main/java/appeng/integration/modules/crafttweaker/AttunementRegistry.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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 . - */ - -package appeng.integration.modules.crafttweaker; - - -import crafttweaker.api.item.IIngredient; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import appeng.api.AEApi; -import appeng.api.config.TunnelType; -import appeng.api.features.IP2PTunnelRegistry; - - -@ZenClass( "mods.appliedenergistics2.Attunement" ) -public class AttunementRegistry -{ - private AttunementRegistry() - { - } - - @ZenMethod - public static void attuneME( IIngredient itemStack ) - { - attune( itemStack, TunnelType.ME ); - } - - @ZenMethod - public static void attuneME( String modId ) - { - attune( modId, TunnelType.ME ); - } - - @ZenMethod - public static void attuneItem( IIngredient itemStack ) - { - attune( itemStack, TunnelType.ITEM ); - } - - @ZenMethod - public static void attuneItem( String modId ) - { - attune( modId, TunnelType.ITEM ); - } - - @ZenMethod - public static void attuneFluid( IIngredient itemStack ) - { - attune( itemStack, TunnelType.FLUID ); - } - - @ZenMethod - public static void attuneFluid( String modId ) - { - attune( modId, TunnelType.FLUID ); - } - - @ZenMethod - public static void attuneRedstone( IIngredient itemStack ) - { - attune( itemStack, TunnelType.REDSTONE ); - } - - @ZenMethod - public static void attuneRedstone( String modId ) - { - attune( modId, TunnelType.REDSTONE ); - } - - @ZenMethod - public static void attuneRF( IIngredient itemStack ) - { - attune( itemStack, TunnelType.FE_POWER ); - } - - @ZenMethod - public static void attuneRF( String modId ) - { - attune( modId, TunnelType.FE_POWER ); - } - - @ZenMethod - public static void attuneIC2( IIngredient itemStack ) - { - attune( itemStack, TunnelType.IC2_POWER ); - } - - @ZenMethod - public static void attuneIC2( String modId ) - { - attune( modId, TunnelType.IC2_POWER ); - } - - @ZenMethod - public static void attuneLight( IIngredient itemStack ) - { - attune( itemStack, TunnelType.LIGHT ); - } - - @ZenMethod - public static void attuneLight( String modId ) - { - attune( modId, TunnelType.LIGHT ); - } - - private static void attune( IIngredient itemStack, TunnelType type ) - { - IP2PTunnelRegistry registry = AEApi.instance().registries().p2pTunnel(); - CTModule.toStacks( itemStack ).ifPresent( c -> c.forEach( i -> registry.addNewAttunement( i, type ) ) ); - } - - private static void attune( String modid, TunnelType type ) - { - AEApi.instance().registries().p2pTunnel().addNewAttunement( modid, type ); - } -} diff --git a/src/main/java/appeng/integration/modules/crafttweaker/CTModule.java b/src/main/java/appeng/integration/modules/crafttweaker/CTModule.java deleted file mode 100644 index a6ca92318..000000000 --- a/src/main/java/appeng/integration/modules/crafttweaker/CTModule.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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 . - */ - -package appeng.integration.modules.crafttweaker; - - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.TreeSet; -import java.util.stream.Collectors; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraftforge.oredict.OreDictionary; - -import crafttweaker.CraftTweakerAPI; -import crafttweaker.IAction; -import crafttweaker.api.item.IIngredient; -import crafttweaker.api.item.IItemStack; - -import appeng.integration.abstraction.ICraftTweaker; -import appeng.util.Platform; - - -public class CTModule implements ICraftTweaker -{ - static final List MODIFICATIONS = new ArrayList<>(); - - @Override - public void preInit() - { - CraftTweakerAPI.registerClass( GrinderRecipes.class ); - CraftTweakerAPI.registerClass( InscriberRecipes.class ); - CraftTweakerAPI.registerClass( SpatialRegistry.class ); - CraftTweakerAPI.registerClass( AttunementRegistry.class ); - CraftTweakerAPI.registerClass( CannonRegistry.class ); - } - - @Override - public void postInit() - { - MODIFICATIONS.forEach( CraftTweakerAPI::apply ); - } - - public static ItemStack toStack( IItemStack iStack ) - { - if( iStack == null ) - { - return ItemStack.EMPTY; - } - else - { - return (ItemStack) iStack.getInternal(); - } - } - - public static List toStackExpand( IItemStack iStack ) - { - if( iStack == null ) - { - return Collections.emptyList(); - } - else - { - ItemStack is = (ItemStack) iStack.getInternal(); - if( !is.isItemStackDamageable() && is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) - { - NonNullList ret = NonNullList.create(); - is.getItem().getSubItems( CreativeTabs.SEARCH, ret ); - return ret.stream().map( i -> new ItemStack( i.getItem(), iStack.getAmount(), i.getItemDamage() ) ).collect( Collectors.toList() ); - } - else - { - return Collections.singletonList( is ); - } - } - } - - public static Optional> toStacks( IIngredient ingredient ) - { - if( ingredient == null ) - { - return Optional.empty(); - } - Set ret = new TreeSet<>( CTModule::compareItemStacks ); - ingredient.getItems().stream().map( CTModule::toStackExpand ).forEach( ret::addAll ); - if( ret.isEmpty() ) - { - return Optional.empty(); - } - return Optional.of( ret ); - } - - private static int compareItemStacks( ItemStack a, ItemStack b ) - { - if( Platform.itemComparisons().isSameItem( a, b ) ) - { - return 0; - } - if( a == null ) - { - return -1; - } - if( b == null ) - { - return 1; - } - return System.identityHashCode( a ) - System.identityHashCode( b ); - } -} diff --git a/src/main/java/appeng/integration/modules/crafttweaker/CannonRegistry.java b/src/main/java/appeng/integration/modules/crafttweaker/CannonRegistry.java deleted file mode 100644 index 8b64999a8..000000000 --- a/src/main/java/appeng/integration/modules/crafttweaker/CannonRegistry.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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 . - */ - -package appeng.integration.modules.crafttweaker; - - -import crafttweaker.api.item.IIngredient; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import appeng.api.AEApi; -import appeng.api.features.IMatterCannonAmmoRegistry; - - -@ZenClass( "mods.appliedenergistics2.Cannon" ) -public class CannonRegistry -{ - private CannonRegistry() - { - } - - @ZenMethod - public static void registerAmmo( IIngredient itemStack, double weight ) - { - IMatterCannonAmmoRegistry registry = AEApi.instance().registries().matterCannon(); - CTModule.toStacks( itemStack ).ifPresent( c -> c.forEach( i -> registry.registerAmmo( i, weight ) ) ); - } -} diff --git a/src/main/java/appeng/integration/modules/crafttweaker/GrinderRecipes.java b/src/main/java/appeng/integration/modules/crafttweaker/GrinderRecipes.java deleted file mode 100644 index 2e8b74429..000000000 --- a/src/main/java/appeng/integration/modules/crafttweaker/GrinderRecipes.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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 . - */ - -package appeng.integration.modules.crafttweaker; - - -import java.util.Collection; -import java.util.Collections; - -import net.minecraft.item.ItemStack; - -import crafttweaker.IAction; -import crafttweaker.api.item.IIngredient; -import crafttweaker.api.item.IItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import appeng.api.AEApi; -import appeng.api.features.IGrinderRecipe; -import appeng.api.features.IGrinderRecipeBuilder; - - -@ZenClass( "mods.appliedenergistics2.Grinder" ) -public class GrinderRecipes -{ - private GrinderRecipes() - { - } - - @ZenMethod - public static void addRecipe( IItemStack output, IIngredient input, int turns, @stanhebben.zenscript.annotations.Optional IItemStack secondary1Output, @stanhebben.zenscript.annotations.Optional Float secondary1Chance, @stanhebben.zenscript.annotations.Optional IItemStack secondary2Output, @stanhebben.zenscript.annotations.Optional Float secondary2Chance ) - { - Collection inStacks = CTModule.toStacks( input ).orElse( Collections.emptySet() ); - - for( ItemStack inStack : inStacks ) - { - IGrinderRecipeBuilder builder = AEApi.instance().registries().grinder().builder(); - builder.withInput( inStack ) - .withOutput( CTModule.toStack( output ) ) - .withTurns( turns ); - - final ItemStack s1 = CTModule.toStack( secondary1Output ); - if( !s1.isEmpty() ) - { - builder.withFirstOptional( s1, secondary1Chance == null ? 1.0f : secondary1Chance ); - } - final ItemStack s2 = CTModule.toStack( secondary2Output ); - if( !s2.isEmpty() ) - { - builder.withSecondOptional( s2, secondary2Chance == null ? 1.0f : secondary2Chance ); - } - CTModule.MODIFICATIONS.add( new Add( builder.build() ) ); - } - } - - @ZenMethod - public static void removeRecipe( IIngredient input ) - { - for( ItemStack inStack : CTModule.toStacks( input ).orElse( Collections.emptySet() ) ) - { - CTModule.MODIFICATIONS.add( new Remove( inStack ) ); - } - } - - private static class Add implements IAction - { - private final IGrinderRecipe entry; - - private Add( IGrinderRecipe entry ) - { - this.entry = entry; - } - - @Override - public void apply() - { - AEApi.instance().registries().grinder().addRecipe( this.entry ); - } - - @Override - public String describe() - { - return "Adding Grinder Entry for " + this.entry.getInput().getDisplayName(); - } - } - - private static class Remove implements IAction - { - private final ItemStack stack; - - private Remove( ItemStack stack ) - { - this.stack = stack; - } - - @Override - public void apply() - { - IGrinderRecipe recipe = AEApi.instance().registries().grinder().getRecipeForInput( this.stack ); - if( recipe != null ) - { - AEApi.instance().registries().grinder().removeRecipe( recipe ); - } - } - - @Override - public String describe() - { - return "Removing Grinder Entry for " + this.stack.getDisplayName(); - } - } -} diff --git a/src/main/java/appeng/integration/modules/crafttweaker/InscriberRecipes.java b/src/main/java/appeng/integration/modules/crafttweaker/InscriberRecipes.java deleted file mode 100644 index d5511018d..000000000 --- a/src/main/java/appeng/integration/modules/crafttweaker/InscriberRecipes.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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 . - */ - -package appeng.integration.modules.crafttweaker; - - -import java.util.Collection; -import java.util.Collections; -import java.util.Optional; -import java.util.stream.Collectors; - -import net.minecraft.item.ItemStack; - -import crafttweaker.IAction; -import crafttweaker.api.item.IIngredient; -import crafttweaker.api.item.IItemStack; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import appeng.api.AEApi; -import appeng.api.features.IInscriberRecipe; -import appeng.api.features.IInscriberRecipeBuilder; -import appeng.api.features.IInscriberRegistry; -import appeng.api.features.InscriberProcessType; - - -@ZenClass( "mods.appliedenergistics2.Inscriber" ) -public class InscriberRecipes -{ - private InscriberRecipes() - { - } - - @ZenMethod - public static void addRecipe( IItemStack output, IIngredient input, boolean inscribe, @stanhebben.zenscript.annotations.Optional IIngredient top, @stanhebben.zenscript.annotations.Optional IIngredient bottom ) - { - Optional> inStacks = CTModule.toStacks( input ); - if( !inStacks.isPresent() ) - { - return; - } - - Collection topList = CTModule.toStacks( top ).orElse( Collections.singleton( ItemStack.EMPTY ) ); - Collection bottomList = CTModule.toStacks( bottom ).orElse( Collections.singleton( ItemStack.EMPTY ) ); - - for( ItemStack topStack : topList ) - { - for( ItemStack bottomStack : bottomList ) - { - final IInscriberRecipeBuilder builder = AEApi.instance().registries().inscriber().builder(); - builder.withProcessType( inscribe ? InscriberProcessType.INSCRIBE : InscriberProcessType.PRESS ) - .withOutput( CTModule.toStack( output ) ) - .withInputs( inStacks.get() ); - - if( !topStack.isEmpty() ) - { - builder.withTopOptional( topStack ); - } - if( !bottomStack.isEmpty() ) - { - builder.withBottomOptional( bottomStack ); - } - CTModule.MODIFICATIONS.add( new Add( builder.build() ) ); - } - } - } - - @ZenMethod - public static void removeRecipe( IItemStack output ) - { - CTModule.MODIFICATIONS.add( new Remove( (ItemStack) output.getInternal() ) ); - } - - private static class Add implements IAction - { - private final IInscriberRecipe entry; - - private Add( IInscriberRecipe entry ) - { - this.entry = entry; - } - - @Override - public void apply() - { - AEApi.instance().registries().inscriber().addRecipe( this.entry ); - } - - @Override - public String describe() - { - return "Adding Inscriber Entry for " + this.entry.getOutput().getDisplayName(); - } - } - - private static class Remove implements IAction - { - private final ItemStack stack; - - private Remove( ItemStack stack ) - { - this.stack = stack; - } - - @Override - public void apply() - { - final IInscriberRegistry inscriber = AEApi.instance().registries().inscriber(); - inscriber.getRecipes() - .stream() - .filter( r -> r.getOutput().isItemEqual( this.stack ) ) - .collect( Collectors.toList() ) - .forEach( inscriber::removeRecipe ); - } - - @Override - public String describe() - { - return "Removing Inscriber Entry for " + this.stack.getDisplayName(); - } - } - -} diff --git a/src/main/java/appeng/integration/modules/crafttweaker/SpatialRegistry.java b/src/main/java/appeng/integration/modules/crafttweaker/SpatialRegistry.java deleted file mode 100644 index d92e9c4bf..000000000 --- a/src/main/java/appeng/integration/modules/crafttweaker/SpatialRegistry.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2017, 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 . - */ - -package appeng.integration.modules.crafttweaker; - - -import net.minecraft.tileentity.TileEntity; - -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -import appeng.api.AEApi; -import appeng.core.AELog; - - -@ZenClass( "mods.appliedenergistics2.Spatial" ) -public class SpatialRegistry -{ - private SpatialRegistry() - { - } - - @ZenMethod - public static void whitelistEntity( String entityClassName ) - { - Class entityClass = loadClass( entityClassName ); - if( entityClass != null ) - { - AEApi.instance().registries().movable().whiteListTileEntity( entityClass ); - } - } - - @SuppressWarnings( "unchecked" ) - private static Class loadClass( String className ) - { - try - { - return (Class) Class.forName( className ); - } - catch( Exception e ) - { - AELog.warn( e, "Failed to load TileEntity class '" + className + "'" ); - } - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/ic2/IC2Module.java b/src/main/java/appeng/integration/modules/ic2/IC2Module.java deleted file mode 100644 index d19782bb9..000000000 --- a/src/main/java/appeng/integration/modules/ic2/IC2Module.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.ic2; - - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import ic2.api.item.ElectricItem; - -import appeng.api.AEApi; -import appeng.api.config.TunnelType; -import appeng.api.features.IP2PTunnelRegistry; -import appeng.integration.IntegrationHelper; -import appeng.integration.abstraction.IC2PowerSink; -import appeng.integration.abstraction.IIC2; -import appeng.integration.modules.ic2.energy.PoweredItemManager; -import appeng.tile.powersink.IExternalPowerSink; - - -public class IC2Module implements IIC2 -{ - - private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" }; - - public IC2Module() - { - IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class ); - IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyAcceptor.class ); - IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyEmitter.class ); - IntegrationHelper.testClassExistence( this, ic2.api.energy.prefab.BasicSinkSource.class ); - IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class ); - IntegrationHelper.testClassExistence( this, ic2.api.item.IBackupElectricItemManager.class ); - IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class ); - IntegrationHelper.testClassExistence( this, ic2.api.recipe.IRecipeInput.class ); - } - - @Override - public void postInit() - { - final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel(); - - for( String string : IC2_CABLE_TYPES ) - { - reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER ); - } - - ElectricItem.registerBackupManager( new PoweredItemManager() ); - } - - private ItemStack getItem( final String name, String variant ) - { - return ic2.api.item.IC2Items.getItem( name, variant ); - } - - private ItemStack getCable( final String type ) - { - return this.getItem( "cable", "type:" + type ); - } - - /** - * Create an IC2 power sink for the given external sink. - */ - @Override - public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink ) - { - return new IC2PowerSinkAdapter( tileEntity, externalSink ); - } - - @Override - public void maceratorRecipe( ItemStack in, ItemStack out ) - { - ic2.api.recipe.Recipes.macerator.addRecipe( new IC2RecipeInput( in, in.getCount() ), null, false, out ); - } -} diff --git a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java deleted file mode 100644 index b15740d4b..000000000 --- a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkAdapter.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.ic2; - - -import java.util.EnumSet; -import java.util.Set; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; - -import ic2.api.energy.prefab.BasicSink; -import ic2.api.energy.tile.IEnergyEmitter; - -import appeng.api.config.Actionable; -import appeng.api.config.PowerUnits; -import appeng.integration.abstraction.IC2PowerSink; -import appeng.tile.powersink.IExternalPowerSink; - - -/** - * The real implementation of IC2PowerSink. - */ -public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink -{ - - private final IExternalPowerSink powerSink; - - private final Set validFaces = EnumSet.allOf( EnumFacing.class ); - - public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink ) - { - super( tileEntity, 0, Integer.MAX_VALUE ); - this.powerSink = powerSink; - } - - @Override - public void invalidate() - { - super.onChunkUnload(); - } - - @Override - public void onChunkUnload() - { - super.onChunkUnload(); - } - - @Override - public void onLoad() - { - super.onLoad(); - } - - @Override - public double getDemandedEnergy() - { - return this.powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE ); - } - - @Override - public double injectEnergy( EnumFacing directionFrom, double amount, double voltage ) - { - return PowerUnits.EU.convertTo( PowerUnits.AE, this.powerSink.injectExternalPower( PowerUnits.EU, amount, Actionable.MODULATE ) ); - } - - @Override - public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side ) - { - return this.validFaces.contains( side ); - } - - @Override - public void setValidFaces( Set faces ) - { - this.validFaces.clear(); - this.validFaces.addAll( faces ); - } -} diff --git a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkStub.java b/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkStub.java deleted file mode 100644 index a77654402..000000000 --- a/src/main/java/appeng/integration/modules/ic2/IC2PowerSinkStub.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.ic2; - - -import appeng.integration.abstraction.IC2PowerSink; - - -/** - * Implementation of IC2PowerSink that just stubs out all methods and does nothing. - */ -public enum IC2PowerSinkStub implements IC2PowerSink -{ - INSTANCE -} diff --git a/src/main/java/appeng/integration/modules/ic2/IC2RecipeInput.java b/src/main/java/appeng/integration/modules/ic2/IC2RecipeInput.java deleted file mode 100644 index b96693e5e..000000000 --- a/src/main/java/appeng/integration/modules/ic2/IC2RecipeInput.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.ic2; - - -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.item.ItemStack; - -import ic2.api.recipe.IRecipeInput; - - -/** - * Implementation of IRecipeInput for the macerator recipe. - * - * @author GuntherDW - */ -public class IC2RecipeInput implements IRecipeInput -{ - @Nonnull - private final ItemStack itemstack; - private final int amount; - - public IC2RecipeInput( ItemStack in, int amount ) - { - this.itemstack = in; - this.amount = amount; - } - - @Override - public boolean matches( ItemStack itemStack ) - { - return this.itemstack.isItemEqual( itemStack ); - } - - @Override - public int getAmount() - { - return this.amount; - } - - @Override - public List getInputs() - { - return Collections.unmodifiableList( Collections.singletonList( this.itemstack ) ); - } -} diff --git a/src/main/java/appeng/integration/modules/ic2/energy/PoweredItemManager.java b/src/main/java/appeng/integration/modules/ic2/energy/PoweredItemManager.java deleted file mode 100644 index 16dd809a0..000000000 --- a/src/main/java/appeng/integration/modules/ic2/energy/PoweredItemManager.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.ic2.energy; - - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -import ic2.api.item.IBackupElectricItemManager; - -import appeng.api.config.Actionable; -import appeng.api.config.PowerUnits; -import appeng.api.implementations.items.IAEItemPowerStorage; - - -public class PoweredItemManager implements IBackupElectricItemManager -{ - - @Override - public double charge( ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate ) - { - final double limit = this.getTransferLimit( stack ); - final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem(); - final double convertedPower = PowerUnits.EU.convertTo( PowerUnits.AE, amount ); - - double toAdd = convertedPower; - - if( !ignoreTransferLimit && amount > limit ) - { - toAdd = limit; - } - - final double overflow = poweredItem.injectAEPower( stack, toAdd, simulate ? Actionable.SIMULATE : Actionable.MODULATE ); - final double addedAmount = toAdd - (int) overflow; - - return PowerUnits.AE.convertTo( PowerUnits.EU, addedAmount ); - } - - @Override - public double discharge( ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate ) - { - return 0; - } - - @Override - public double getCharge( ItemStack stack ) - { - final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem(); - return (int) PowerUnits.AE.convertTo( PowerUnits.EU, poweredItem.getAECurrentPower( stack ) ); - } - - @Override - public double getMaxCharge( ItemStack stack ) - { - final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem(); - return PowerUnits.AE.convertTo( PowerUnits.EU, poweredItem.getAEMaxPower( stack ) ); - } - - @Override - public boolean canUse( ItemStack stack, double amount ) - { - return this.getCharge( stack ) > amount; - } - - @Override - public boolean use( ItemStack stack, double amount, EntityLivingBase entity ) - { - final IAEItemPowerStorage poweredItem = (IAEItemPowerStorage) stack.getItem(); - - if( this.canUse( stack, amount ) ) - { - final double toUse = PowerUnits.EU.convertTo( PowerUnits.AE, amount ); - - poweredItem.extractAEPower( stack, toUse, Actionable.MODULATE ); - - return true; - } - return false; - } - - @Override - public void chargeFromArmor( ItemStack stack, EntityLivingBase entity ) - { - // TODO Auto-generated method stub - } - - @Override - public String getToolTip( ItemStack stack ) - { - return null; - } - - @Override - public int getTier( ItemStack stack ) - { - return 1; - } - - @Override - public boolean handles( ItemStack stack ) - { - return !stack.isEmpty() && ( stack.getItem() instanceof IAEItemPowerStorage ); - } - - private double getTransferLimit( ItemStack itemStack ) - { - return Math.max( 32, this.getMaxCharge( itemStack ) / 200 ); - } - -} diff --git a/src/main/java/appeng/integration/modules/inventorytweaks/InventoryTweaksModule.java b/src/main/java/appeng/integration/modules/inventorytweaks/InventoryTweaksModule.java deleted file mode 100644 index c428a9a5f..000000000 --- a/src/main/java/appeng/integration/modules/inventorytweaks/InventoryTweaksModule.java +++ /dev/null @@ -1,41 +0,0 @@ - -package appeng.integration.modules.inventorytweaks; - - -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.Loader; - -import invtweaks.api.InvTweaksAPI; - -import appeng.integration.abstraction.IInvTweaks; - - -public class InventoryTweaksModule implements IInvTweaks -{ - InvTweaksAPI api = null; - - public InventoryTweaksModule() - { - try - { - this.api = (InvTweaksAPI) Class.forName( "invtweaks.forge.InvTweaksMod", true, Loader.instance().getModClassLoader() ) - .getField( "instance" ) - .get( null ); - } - catch( Exception ex ) - { - } - } - - @Override - public boolean isEnabled() - { - return this.api != null; - } - - @Override - public int compareItems( ItemStack i, ItemStack j ) - { - return this.api.compareItems( i, j ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/CondenserCategory.java b/src/main/java/appeng/integration/modules/jei/CondenserCategory.java deleted file mode 100644 index f44e5c6ce..000000000 --- a/src/main/java/appeng/integration/modules/jei/CondenserCategory.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeCategory; - -import appeng.api.AEApi; -import appeng.api.config.CondenserOutput; -import appeng.api.definitions.IMaterials; -import appeng.api.implementations.items.IStorageComponent; -import appeng.core.AppEng; -import appeng.tile.misc.TileCondenser; - - -class CondenserCategory implements IRecipeCategory -{ - - public static final String UID = "appliedenergistics2.condenser"; - - private final String localizedName; - - private final IDrawable background; - - private final IDrawable iconTrash; - - private final IDrawableAnimated progress; - - private final IDrawable iconButton; - - public CondenserCategory( IGuiHelper guiHelper ) - { - this.localizedName = I18n.format( "gui.appliedenergistics2.Condenser" ); - - ResourceLocation location = new ResourceLocation( AppEng.MOD_ID, "textures/guis/condenser.png" ); - this.background = guiHelper.createDrawable( location, 50, 25, 94, 48 ); - - ResourceLocation statesLocation = new ResourceLocation( AppEng.MOD_ID, "textures/guis/states.png" ); - this.iconTrash = guiHelper.createDrawable( statesLocation, 241, 81, 14, 14, 28, 0, 2, 0 ); - this.iconButton = guiHelper.createDrawable( statesLocation, 240, 240, 16, 16, 28, 0, 78, 0 ); - - IDrawableStatic progressDrawable = guiHelper.createDrawable( location, 178, 25, 6, 18, 0, 0, 70, 0 ); - this.progress = guiHelper.createAnimatedDrawable( progressDrawable, 40, IDrawableAnimated.StartDirection.BOTTOM, false ); - } - - @Override - public String getUid() - { - return CondenserCategory.UID; - } - - @Override - public String getTitle() - { - return this.localizedName; - } - - /** - * Return the name of the mod associated with this recipe category. - * Used for the recipe category tab's tooltip. - * - * @since JEI 4.5.0 - */ - @Override - public String getModName() - { - return AppEng.MOD_NAME; - } - - @Override - public IDrawable getBackground() - { - return this.background; - } - - @Override - public void drawExtras( Minecraft minecraft ) - { - this.progress.draw( minecraft ); - this.iconTrash.draw( minecraft ); - this.iconButton.draw( minecraft ); - } - - @Override - public void setRecipe( IRecipeLayout recipeLayout, CondenserOutputWrapper recipeWrapper, IIngredients ingredients ) - { - IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); - itemStacks.init( 0, false, 54, 26 ); - - // Get all storage cells and cycle them through a fake input slot - itemStacks.init( 1, true, 50, 0 ); - itemStacks.set( 1, this.getViableStorageComponents( recipeWrapper ) ); - - // This only sets the output - itemStacks.set( ingredients ); - } - - private List getViableStorageComponents( CondenserOutputWrapper recipeWrapper ) - { - CondenserOutput condenserOutput = recipeWrapper.getCondenserOutput(); - IMaterials materials = AEApi.instance().definitions().materials(); - List viableComponents = new ArrayList<>(); - materials.cell1kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); - materials.cell4kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); - materials.cell16kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); - materials.cell64kPart().maybeStack( 1 ).ifPresent( itemStack -> this.addViableComponent( condenserOutput, viableComponents, itemStack ) ); - return viableComponents; - } - - private void addViableComponent( CondenserOutput condenserOutput, List viableComponents, ItemStack itemStack ) - { - IStorageComponent comp = (IStorageComponent) itemStack.getItem(); - int storage = comp.getBytes( itemStack ) * TileCondenser.BYTE_MULTIPLIER; - if( storage >= condenserOutput.requiredPower ) - { - viableComponents.add( itemStack ); - } - } -} diff --git a/src/main/java/appeng/integration/modules/jei/CondenserOutputHandler.java b/src/main/java/appeng/integration/modules/jei/CondenserOutputHandler.java deleted file mode 100644 index 9369960e6..000000000 --- a/src/main/java/appeng/integration/modules/jei/CondenserOutputHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -import appeng.api.config.CondenserOutput; -import appeng.core.AppEng; - - -class CondenserOutputHandler implements IRecipeWrapperFactory -{ - - private final ItemStack matterBall; - private final ItemStack singularity; - private final IDrawable iconButtonMatterBall; - private final IDrawable iconButtonSingularity; - - public CondenserOutputHandler( IGuiHelper guiHelper, ItemStack matterBall, ItemStack singularity ) - { - this.matterBall = matterBall; - this.singularity = singularity; - - ResourceLocation statesLocation = new ResourceLocation( AppEng.MOD_ID, "textures/guis/states.png" ); - this.iconButtonMatterBall = guiHelper.createDrawable( statesLocation, 16, 112, 14, 14, 28, 0, 78, 0 ); - this.iconButtonSingularity = guiHelper.createDrawable( statesLocation, 32, 112, 14, 14, 28, 0, 78, 0 ); - } - - @Override - public IRecipeWrapper getRecipeWrapper( CondenserOutput recipe ) - { - switch( recipe ) - { - case MATTER_BALLS: - return new CondenserOutputWrapper( recipe, this.matterBall, this.iconButtonMatterBall ); - case SINGULARITY: - return new CondenserOutputWrapper( recipe, this.singularity, this.iconButtonSingularity ); - default: - return null; - } - } -} diff --git a/src/main/java/appeng/integration/modules/jei/CondenserOutputWrapper.java b/src/main/java/appeng/integration/modules/jei/CondenserOutputWrapper.java deleted file mode 100644 index b7754333f..000000000 --- a/src/main/java/appeng/integration/modules/jei/CondenserOutputWrapper.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.util.Collections; -import java.util.List; - -import javax.annotation.Nullable; - -import com.google.common.base.Splitter; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.client.config.HoverChecker; - -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -import appeng.api.config.CondenserOutput; - - -class CondenserOutputWrapper implements IRecipeWrapper -{ - private final ItemStack outputItem; - - private final CondenserOutput condenserOutput; - - private final HoverChecker buttonHoverChecker; - - private final IDrawable buttonIcon; - - CondenserOutputWrapper( CondenserOutput condenserOutput, ItemStack outputItem, IDrawable buttonIcon ) - { - this.condenserOutput = condenserOutput; - this.outputItem = outputItem; - this.buttonIcon = buttonIcon; - this.buttonHoverChecker = new HoverChecker( 28, 28 + 16, 78, 78 + 16, 0 ); - } - - @Override - public void getIngredients( IIngredients ingredients ) - { - ingredients.setOutput( ItemStack.class, this.outputItem ); - } - - public CondenserOutput getCondenserOutput() - { - return this.condenserOutput; - } - - @Nullable - @Override - public List getTooltipStrings( int mouseX, int mouseY ) - { - if( this.buttonHoverChecker.checkHover( mouseX, mouseY ) ) - { - String key; - - switch( this.condenserOutput ) - { - case MATTER_BALLS: - key = "gui.tooltips.appliedenergistics2.MatterBalls"; - break; - case SINGULARITY: - key = "gui.tooltips.appliedenergistics2.Singularity"; - break; - default: - return Collections.emptyList(); - } - - return Splitter.on( "\\n" ).splitToList( I18n.format( key, this.condenserOutput.requiredPower ) ); - } - return Collections.emptyList(); - } - - @Override - public void drawInfo( Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY ) - { - this.buttonIcon.draw( minecraft ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/FacadeRecipeWrapper.java b/src/main/java/appeng/integration/modules/jei/FacadeRecipeWrapper.java deleted file mode 100644 index badd96b73..000000000 --- a/src/main/java/appeng/integration/modules/jei/FacadeRecipeWrapper.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper; - - -/** - * Acts as a fake facade recipe wrapper, created by {@link FacadeRegistryPlugin}. - */ -class FacadeRecipeWrapper implements IShapedCraftingRecipeWrapper -{ - - private final ItemStack textureItem; - - private final ItemStack cableAnchor; - - private final ItemStack facade; - - FacadeRecipeWrapper( ItemStack textureItem, ItemStack cableAnchor, ItemStack facade ) - { - this.textureItem = textureItem; - this.cableAnchor = cableAnchor; - this.facade = facade; - } - - @Override - public int getWidth() - { - return 3; - } - - @Override - public int getHeight() - { - return 3; - } - - @Override - public void getIngredients( IIngredients ingredients ) - { - List input = new ArrayList<>( 9 ); - - input.add( ItemStack.EMPTY ); - input.add( this.cableAnchor ); - input.add( ItemStack.EMPTY ); - - input.add( this.cableAnchor ); - input.add( this.textureItem ); - input.add( this.cableAnchor ); - - input.add( ItemStack.EMPTY ); - input.add( this.cableAnchor ); - input.add( ItemStack.EMPTY ); - - ingredients.setInputs( ItemStack.class, input ); - ingredients.setOutput( ItemStack.class, this.facade ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/FacadeRegistryPlugin.java b/src/main/java/appeng/integration/modules/jei/FacadeRegistryPlugin.java deleted file mode 100644 index 3c20d5b23..000000000 --- a/src/main/java/appeng/integration/modules/jei/FacadeRegistryPlugin.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import mezz.jei.api.recipe.IFocus; -import mezz.jei.api.recipe.IRecipeCategory; -import mezz.jei.api.recipe.IRecipeRegistryPlugin; -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.VanillaRecipeCategoryUid; - -import appeng.items.parts.ItemFacade; - - -/** - * This plugin will dynamically add facade recipes for any item that can be turned into a facade. - */ -class FacadeRegistryPlugin implements IRecipeRegistryPlugin -{ - - private final ItemFacade itemFacade; - - private final ItemStack cableAnchor; - - FacadeRegistryPlugin( ItemFacade itemFacade, ItemStack cableAnchor ) - { - this.itemFacade = itemFacade; - this.cableAnchor = cableAnchor; - } - - @Override - public List getRecipeCategoryUids( IFocus focus ) - { - if( focus.getMode() == IFocus.Mode.OUTPUT && focus.getValue() instanceof ItemStack ) - { - // Looking up how a certain facade is crafted - ItemStack itemStack = (ItemStack) focus.getValue(); - if( itemStack.getItem() instanceof ItemFacade ) - { - return Collections.singletonList( VanillaRecipeCategoryUid.CRAFTING ); - } - } - else if( focus.getMode() == IFocus.Mode.INPUT && focus.getValue() instanceof ItemStack ) - { - // Looking up if a certain block can be used to make a facade - ItemStack itemStack = (ItemStack) focus.getValue(); - - if( !this.itemFacade.createFacadeForItem( itemStack, true ).isEmpty() ) - { - return Collections.singletonList( VanillaRecipeCategoryUid.CRAFTING ); - } - } - - return Collections.emptyList(); - } - - @SuppressWarnings( "unchecked" ) - @Override - public List getRecipeWrappers( IRecipeCategory recipeCategory, IFocus focus ) - { - if( !VanillaRecipeCategoryUid.CRAFTING.equals( recipeCategory.getUid() ) ) - { - return Collections.emptyList(); - } - - if( focus.getMode() == IFocus.Mode.OUTPUT && focus.getValue() instanceof ItemStack ) - { - // Looking up how a certain facade is crafted - ItemStack itemStack = (ItemStack) focus.getValue(); - if( itemStack.getItem() instanceof ItemFacade ) - { - ItemFacade facadeItem = (ItemFacade) itemStack.getItem(); - ItemStack textureItem = facadeItem.getTextureItem( itemStack ); - return Collections.singletonList( (T) new FacadeRecipeWrapper( textureItem, this.cableAnchor, itemStack ) ); - } - } - else if( focus.getMode() == IFocus.Mode.INPUT && focus.getValue() instanceof ItemStack ) - { - // Looking up if a certain block can be used to make a facade - - ItemStack itemStack = (ItemStack) focus.getValue(); - ItemStack facade = this.itemFacade.createFacadeForItem( itemStack, false ); - - if( !facade.isEmpty() ) - { - return Collections.singletonList( (T) new FacadeRecipeWrapper( itemStack, this.cableAnchor, facade ) ); - } - } - - return Collections.emptyList(); - } - - @Override - public List getRecipeWrappers( IRecipeCategory recipeCategory ) - { - return Collections.emptyList(); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/GrinderRecipeCategory.java b/src/main/java/appeng/integration/modules/jei/GrinderRecipeCategory.java deleted file mode 100644 index cfd09d818..000000000 --- a/src/main/java/appeng/integration/modules/jei/GrinderRecipeCategory.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import net.minecraft.client.resources.I18n; -import net.minecraft.util.ResourceLocation; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.IJeiHelpers; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeCategory; -import mezz.jei.api.recipe.IRecipeCategoryRegistration; - -import appeng.core.AppEng; - - -class GrinderRecipeCategory implements IRecipeCategory, IRecipeCategoryRegistration -{ - - public static final String UID = "appliedenergistics2.grinder"; - - private final String localizedName; - - private final IDrawable background; - - public GrinderRecipeCategory( IGuiHelper guiHelper ) - { - this.localizedName = I18n.format( "tile.appliedenergistics2.grindstone.name" ); - - ResourceLocation location = new ResourceLocation( AppEng.MOD_ID, "textures/guis/grinder.png" ); - this.background = guiHelper.createDrawable( location, 11, 16, 154, 70 ); - } - - @Override - public String getModName() - { - return AppEng.MOD_NAME; - } - - @Override - public String getUid() - { - return GrinderRecipeCategory.UID; - } - - @Override - public String getTitle() - { - return this.localizedName; - } - - @Override - public IDrawable getBackground() - { - return this.background; - } - - @Override - public void setRecipe( IRecipeLayout recipeLayout, GrinderRecipeWrapper recipeWrapper, IIngredients ingredients ) - { - IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); - - itemStacks.init( 0, true, 0, 0 ); - itemStacks.init( 1, false, 100, 46 ); - itemStacks.init( 2, false, 118, 46 ); - itemStacks.init( 3, false, 136, 46 ); - - itemStacks.set( ingredients ); - } - - @Override - public void addRecipeCategories( IRecipeCategory... recipeCategories ) - { - - } - - @Override - public IJeiHelpers getJeiHelpers() - { - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/jei/GrinderRecipeHandler.java b/src/main/java/appeng/integration/modules/jei/GrinderRecipeHandler.java deleted file mode 100644 index 74853e20d..000000000 --- a/src/main/java/appeng/integration/modules/jei/GrinderRecipeHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -import appeng.api.features.IGrinderRecipe; - - -class GrinderRecipeHandler implements IRecipeWrapperFactory -{ - @Override - public IRecipeWrapper getRecipeWrapper( IGrinderRecipe recipe ) - { - return new GrinderRecipeWrapper( recipe ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/GrinderRecipeWrapper.java b/src/main/java/appeng/integration/modules/jei/GrinderRecipeWrapper.java deleted file mode 100644 index 016c478e8..000000000 --- a/src/main/java/appeng/integration/modules/jei/GrinderRecipeWrapper.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; - -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -import appeng.api.features.IGrinderRecipe; - - -class GrinderRecipeWrapper implements IRecipeWrapper -{ - - private final IGrinderRecipe recipe; - - GrinderRecipeWrapper( IGrinderRecipe recipe ) - { - this.recipe = recipe; - } - - @Override - public void getIngredients( IIngredients ingredients ) - { - ingredients.setInput( ItemStack.class, this.recipe.getInput() ); - List outputs = new ArrayList<>( 3 ); - outputs.add( this.recipe.getOutput() ); - this.recipe.getOptionalOutput().ifPresent( outputs::add ); - this.recipe.getSecondOptionalOutput().ifPresent( outputs::add ); - ingredients.setOutputs( ItemStack.class, outputs ); - } - - @Override - public void drawInfo( Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY ) - { - - FontRenderer fr = Minecraft.getMinecraft().fontRenderer; - - int x = 118; - - final float scale = 0.85f; - final float invScale = 1 / scale; - GlStateManager.scale( scale, scale, 1 ); - - if( this.recipe.getOptionalOutput() != null ) - { - String text = String.format( "%d%%", (int) ( this.recipe.getOptionalChance() * 100 ) ); - float width = fr.getStringWidth( text ) * scale; - int xScaled = Math.round( ( x + ( 18 - width ) / 2 ) * invScale ); - fr.drawString( text, xScaled, (int) ( 65 * invScale ), Color.gray.getRGB() ); - x += 18; - } - - if( this.recipe.getSecondOptionalOutput() != null ) - { - String text = String.format( "%d%%", (int) ( this.recipe.getSecondOptionalChance() * 100 ) ); - float width = fr.getStringWidth( text ) * scale; - int xScaled = Math.round( ( x + ( 18 - width ) / 2 ) * invScale ); - fr.drawString( text, xScaled, (int) ( 65 * invScale ), Color.gray.getRGB() ); - } - - GlStateManager.scale( invScale, invScale, 1 ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/InscriberRecipeCategory.java b/src/main/java/appeng/integration/modules/jei/InscriberRecipeCategory.java deleted file mode 100644 index f5415c277..000000000 --- a/src/main/java/appeng/integration/modules/jei/InscriberRecipeCategory.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.I18n; -import net.minecraft.util.ResourceLocation; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeCategory; - -import appeng.core.AppEng; - - -class InscriberRecipeCategory implements IRecipeCategory -{ - - private static final int SLOT_INPUT_TOP = 0; - private static final int SLOT_INPUT_MIDDLE = 1; - private static final int SLOT_INPUT_BOTTOM = 2; - private static final int SLOT_OUTPUT = 3; - - static final String UID = "appliedenergistics2.inscriber"; - - private final IDrawable background; - - private final String localizedName; - - private final IDrawableAnimated progress; - - public InscriberRecipeCategory( IGuiHelper guiHelper ) - { - ResourceLocation location = new ResourceLocation( AppEng.MOD_ID, "textures/guis/inscriber.png" ); - this.background = guiHelper.createDrawable( location, 44, 15, 97, 64 ); - this.localizedName = I18n.format( "tile.appliedenergistics2.inscriber.name" ); - - IDrawableStatic progressDrawable = guiHelper.createDrawable( location, 135, 177, 6, 18, 24, 0, 91, 0 ); - this.progress = guiHelper.createAnimatedDrawable( progressDrawable, 40, IDrawableAnimated.StartDirection.BOTTOM, false ); - } - - @Override - public String getUid() - { - return UID; - } - - @Override - public String getTitle() - { - return this.localizedName; - } - - /** - * Return the name of the mod associated with this recipe category. - * Used for the recipe category tab's tooltip. - * - * @since JEI 4.5.0 - */ - @Override - public String getModName() - { - return AppEng.MOD_NAME; - } - - @Override - public IDrawable getBackground() - { - return this.background; - } - - @Override - public void drawExtras( Minecraft minecraft ) - { - this.progress.draw( minecraft ); - } - - @Override - public void setRecipe( IRecipeLayout recipeLayout, InscriberRecipeWrapper recipeWrapper, IIngredients ingredients ) - { - IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); - - itemStacks.init( SLOT_INPUT_TOP, true, 0, 0 ); - itemStacks.init( SLOT_INPUT_MIDDLE, true, 18, 23 ); - itemStacks.init( SLOT_INPUT_BOTTOM, true, 0, 46 ); - itemStacks.init( SLOT_OUTPUT, false, 68, 24 ); - - itemStacks.set( ingredients ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/InscriberRecipeHandler.java b/src/main/java/appeng/integration/modules/jei/InscriberRecipeHandler.java deleted file mode 100644 index e87371d04..000000000 --- a/src/main/java/appeng/integration/modules/jei/InscriberRecipeHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -import appeng.api.features.IInscriberRecipe; - - -class InscriberRecipeHandler implements IRecipeWrapperFactory -{ - @Override - public IRecipeWrapper getRecipeWrapper( IInscriberRecipe recipe ) - { - return new InscriberRecipeWrapper( recipe ); - } - -} diff --git a/src/main/java/appeng/integration/modules/jei/InscriberRecipeWrapper.java b/src/main/java/appeng/integration/modules/jei/InscriberRecipeWrapper.java deleted file mode 100644 index 40e6fab53..000000000 --- a/src/main/java/appeng/integration/modules/jei/InscriberRecipeWrapper.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -import appeng.api.features.IInscriberRecipe; - - -class InscriberRecipeWrapper implements IRecipeWrapper -{ - - private final IInscriberRecipe recipe; - - public InscriberRecipeWrapper( IInscriberRecipe recipe ) - { - this.recipe = recipe; - } - - @Override - public void getIngredients( IIngredients ingredients ) - { - List> inputSlots = new ArrayList<>( 3 ); - inputSlots.add( Collections.singletonList( this.recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ); - inputSlots.add( this.recipe.getInputs() ); - inputSlots.add( Collections.singletonList( this.recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ); - ingredients.setInputLists( ItemStack.class, inputSlots ); - - ingredients.setOutput( ItemStack.class, this.recipe.getOutput() ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/InscriberRegistryPlugin.java b/src/main/java/appeng/integration/modules/jei/InscriberRegistryPlugin.java deleted file mode 100644 index 441cd6747..000000000 --- a/src/main/java/appeng/integration/modules/jei/InscriberRegistryPlugin.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.util.Collections; -import java.util.List; - -import net.minecraft.item.ItemStack; - -import mezz.jei.api.recipe.IFocus; -import mezz.jei.api.recipe.IRecipeCategory; -import mezz.jei.api.recipe.IRecipeRegistryPlugin; -import mezz.jei.api.recipe.IRecipeWrapper; - -import appeng.api.AEApi; -import appeng.api.features.IInscriberRegistry; - - -/** - * Exposes the inscriber registry recipes to JEI. - */ -class InscriberRegistryPlugin implements IRecipeRegistryPlugin -{ - - private final IInscriberRegistry inscriber = AEApi.instance().registries().inscriber(); - - @Override - public List getRecipeCategoryUids( IFocus focus ) - { - if( !( focus.getValue() instanceof ItemStack ) ) - { - return Collections.emptyList(); - } - - if( focus.getMode() == IFocus.Mode.INPUT ) - { - ItemStack input = (ItemStack) focus.getValue(); - for( ItemStack validInput : this.inscriber.getInputs() ) - { - - } - } - - return Collections.emptyList(); - } - - @Override - public List getRecipeWrappers( IRecipeCategory recipeCategory, IFocus focus ) - { - return null; - } - - @Override - public List getRecipeWrappers( IRecipeCategory recipeCategory ) - { - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/jei/JEIModule.java b/src/main/java/appeng/integration/modules/jei/JEIModule.java deleted file mode 100644 index a20314f25..000000000 --- a/src/main/java/appeng/integration/modules/jei/JEIModule.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import appeng.integration.abstraction.IJEI; - - -public class JEIModule implements IJEI -{ - - private IJEI jei = new IJEI.Stub(); - - public void setJei( IJEI jei ) - { - this.jei = jei; - } - - public IJEI getJei() - { - return this.jei; - } - - @Override - public String getSearchText() - { - return this.jei.getSearchText(); - } - - @Override - public void setSearchText( String searchText ) - { - this.jei.setSearchText( searchText ); - } - - @Override - public boolean isEnabled() - { - return this.jei.isEnabled(); - } - -} diff --git a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java b/src/main/java/appeng/integration/modules/jei/JEIPlugin.java deleted file mode 100644 index 08c6630e4..000000000 --- a/src/main/java/appeng/integration/modules/jei/JEIPlugin.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import mezz.jei.api.IJeiRuntime; -import mezz.jei.api.IModPlugin; -import mezz.jei.api.IModRegistry; -import mezz.jei.api.ISubtypeRegistry; -import mezz.jei.api.recipe.IRecipeCategoryRegistration; -import mezz.jei.api.recipe.VanillaRecipeCategoryUid; - -import appeng.api.AEApi; -import appeng.api.config.CondenserOutput; -import appeng.api.definitions.IDefinitions; -import appeng.api.definitions.IItemDefinition; -import appeng.api.definitions.IMaterials; -import appeng.api.features.IGrinderRecipe; -import appeng.api.features.IInscriberRecipe; -import appeng.container.implementations.ContainerCraftingTerm; -import appeng.container.implementations.ContainerPatternTerm; -import appeng.core.AEConfig; -import appeng.core.features.AEFeature; -import appeng.core.localization.GuiText; -import appeng.integration.Integrations; -import appeng.items.parts.ItemFacade; - - -@mezz.jei.api.JEIPlugin -public class JEIPlugin implements IModPlugin -{ - @Override - public void registerItemSubtypes( ISubtypeRegistry subtypeRegistry ) - { - final Optional maybeFacade = AEApi.instance().definitions().items().facade().maybeItem(); - maybeFacade.ifPresent( subtypeRegistry::useNbtForSubtypes ); - } - - @Override - public void registerCategories( IRecipeCategoryRegistration registry ) - { - registry.addRecipeCategories( new GrinderRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) ); - registry.addRecipeCategories( new CondenserCategory( registry.getJeiHelpers().getGuiHelper() ) ); - registry.addRecipeCategories( new InscriberRecipeCategory( registry.getJeiHelpers().getGuiHelper() ) ); - } - - @Override - public void register( IModRegistry registry ) - { - IDefinitions definitions = AEApi.instance().definitions(); - - this.registerFacadeRecipe( definitions, registry ); - - this.registerInscriberRecipes( definitions, registry ); - - this.registerCondenserRecipes( definitions, registry ); - - this.registerGrinderRecipes( definitions, registry ); - - this.registerDescriptions( definitions, registry ); - - // Allow recipe transfer from JEI to crafting and pattern terminal - registry.getRecipeTransferRegistry() - .addRecipeTransferHandler( new RecipeTransferHandler<>( ContainerCraftingTerm.class ), - VanillaRecipeCategoryUid.CRAFTING ); - registry.getRecipeTransferRegistry() - .addRecipeTransferHandler( new RecipeTransferHandler<>( ContainerPatternTerm.class ), - VanillaRecipeCategoryUid.CRAFTING ); - } - - private void registerDescriptions( IDefinitions definitions, IModRegistry registry ) - { - IMaterials materials = definitions.materials(); - - final String message; - if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) ) - { - message = GuiText.ChargedQuartz.getLocal() + "\n\n" + GuiText.ChargedQuartzFind.getLocal(); - } - else - { - message = GuiText.ChargedQuartzFind.getLocal(); - } - this.addDescription( registry, materials.certusQuartzCrystalCharged(), message ); - - if( AEConfig.instance().isFeatureEnabled( AEFeature.METEORITE_WORLD_GEN ) ) - { - this.addDescription( registry, materials.logicProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() ); - this.addDescription( registry, materials.calcProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() ); - this.addDescription( registry, materials.engProcessorPress(), GuiText.inWorldCraftingPresses.getLocal() ); - } - - if( AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) ) - { - this.addDescription( registry, materials.fluixCrystal(), GuiText.inWorldFluix.getLocal() ); - } - - if( AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_SINGULARITY ) ) - { - this.addDescription( registry, materials.qESingularity(), GuiText.inWorldSingularity.getLocal() ); - } - - if( AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_PURIFICATION ) ) - { - this.addDescription( registry, materials.purifiedCertusQuartzCrystal(), GuiText.inWorldPurificationCertus.getLocal() ); - this.addDescription( registry, materials.purifiedNetherQuartzCrystal(), GuiText.inWorldPurificationNether.getLocal() ); - this.addDescription( registry, materials.purifiedFluixCrystal(), GuiText.inWorldPurificationFluix.getLocal() ); - } - - } - - private void addDescription( IModRegistry registry, IItemDefinition itemDefinition, String message ) - { - itemDefinition.maybeStack( 1 ).ifPresent( itemStack -> registry.addIngredientInfo( itemStack, ItemStack.class, message ) ); - } - - private void registerGrinderRecipes( IDefinitions definitions, IModRegistry registry ) - { - - ItemStack grindstone = definitions.blocks().grindstone().maybeStack( 1 ).orElse( ItemStack.EMPTY ); - - if( grindstone.isEmpty() ) - { - return; - } - - registry.handleRecipes( IGrinderRecipe.class, new GrinderRecipeHandler(), GrinderRecipeCategory.UID ); - registry.addRecipes( Lists.newArrayList( AEApi.instance().registries().grinder().getRecipes() ), GrinderRecipeCategory.UID ); - registry.addRecipeCatalyst( grindstone, GrinderRecipeCategory.UID ); - } - - private void registerCondenserRecipes( IDefinitions definitions, IModRegistry registry ) - { - - ItemStack condenser = definitions.blocks().condenser().maybeStack( 1 ).orElse( ItemStack.EMPTY ); - if( condenser.isEmpty() ) - { - return; - } - - ItemStack matterBall = definitions.materials().matterBall().maybeStack( 1 ).orElse( ItemStack.EMPTY ); - if( !matterBall.isEmpty() ) - { - registry.addRecipes( ImmutableList.of( CondenserOutput.MATTER_BALLS ), CondenserCategory.UID ); - } - - ItemStack singularity = definitions.materials().singularity().maybeStack( 1 ).orElse( ItemStack.EMPTY ); - if( !singularity.isEmpty() ) - { - registry.addRecipes( ImmutableList.of( CondenserOutput.SINGULARITY ), CondenserCategory.UID ); - } - - if( !matterBall.isEmpty() || !singularity.isEmpty() ) - { - registry.addRecipeCatalyst( condenser, CondenserCategory.UID ); - registry.handleRecipes( CondenserOutput.class, new CondenserOutputHandler( registry.getJeiHelpers().getGuiHelper(), matterBall, singularity ), - CondenserCategory.UID ); - } - } - - private void registerInscriberRecipes( IDefinitions definitions, IModRegistry registry ) - { - registry.handleRecipes( IInscriberRecipe.class, new InscriberRecipeHandler(), InscriberRecipeCategory.UID ); - - // Register the inscriber as the crafting item for the inscription category - definitions.blocks().inscriber().maybeStack( 1 ).ifPresent( inscriber -> - { - registry.addRecipeCatalyst( inscriber, InscriberRecipeCategory.UID ); - } ); - - List inscriberRecipes = new ArrayList<>( AEApi.instance().registries().inscriber().getRecipes() ); - registry.addRecipes( inscriberRecipes, InscriberRecipeCategory.UID ); - } - - // Handle the generic crafting recipe for patterns in JEI - private void registerFacadeRecipe( IDefinitions definitions, IModRegistry registry ) - { - Optional itemFacade = definitions.items().facade().maybeItem(); - Optional cableAnchor = definitions.parts().cableAnchor().maybeStack( 1 ); - if( itemFacade.isPresent() && cableAnchor.isPresent() && AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_FACADE_CRAFTING ) ) - { - registry.addRecipeRegistryPlugin( new FacadeRegistryPlugin( (ItemFacade) itemFacade.get(), cableAnchor.get() ) ); - } - } - - @Override - public void onRuntimeAvailable( IJeiRuntime jeiRuntime ) - { - JEIModule jeiModule = (JEIModule) Integrations.jei(); - jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/JeiRuntimeAdapter.java b/src/main/java/appeng/integration/modules/jei/JeiRuntimeAdapter.java deleted file mode 100644 index bf603697e..000000000 --- a/src/main/java/appeng/integration/modules/jei/JeiRuntimeAdapter.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import com.google.common.base.Strings; - -import mezz.jei.api.IJeiRuntime; - -import appeng.integration.abstraction.IJEI; - - -class JeiRuntimeAdapter implements IJEI -{ - - private final IJeiRuntime runtime; - - JeiRuntimeAdapter( IJeiRuntime jeiRuntime ) - { - this.runtime = jeiRuntime; - } - - @Override - public boolean isEnabled() - { - return true; - } - - @Override - public String getSearchText() - { - return Strings.nullToEmpty( this.runtime.getIngredientFilter().getFilterText() ); - } - - @Override - public void setSearchText( String searchText ) - { - this.runtime.getIngredientFilter().setFilterText( Strings.nullToEmpty( searchText ) ); - } -} diff --git a/src/main/java/appeng/integration/modules/jei/RecipeTransferHandler.java b/src/main/java/appeng/integration/modules/jei/RecipeTransferHandler.java deleted file mode 100644 index 4bda1835e..000000000 --- a/src/main/java/appeng/integration/modules/jei/RecipeTransferHandler.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.jei; - - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.annotation.Nullable; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -import mezz.jei.api.gui.IGuiIngredient; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.recipe.transfer.IRecipeTransferError; -import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; - -import appeng.container.slot.SlotCraftingMatrix; -import appeng.container.slot.SlotFakeCraftingMatrix; -import appeng.core.AELog; -import appeng.core.sync.network.NetworkHandler; -import appeng.core.sync.packets.PacketJEIRecipe; -import appeng.util.Platform; - - -class RecipeTransferHandler implements IRecipeTransferHandler -{ - - private final Class containerClass; - - RecipeTransferHandler( Class containerClass ) - { - this.containerClass = containerClass; - } - - @Override - public Class getContainerClass() - { - return this.containerClass; - } - - @Nullable - @Override - public IRecipeTransferError transferRecipe( T container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer ) - { - - if( !doTransfer ) - { - return null; - } - - Map> ingredients = recipeLayout.getItemStacks().getGuiIngredients(); - - final NBTTagCompound recipe = new NBTTagCompound(); - - int slotIndex = 0; - for( Map.Entry> ingredientEntry : ingredients.entrySet() ) - { - IGuiIngredient ingredient = ingredientEntry.getValue(); - if( !ingredient.isInput() ) - { - continue; - } - - for( final Slot slot : container.inventorySlots ) - { - if( slot instanceof SlotCraftingMatrix || slot instanceof SlotFakeCraftingMatrix ) - { - if( slot.getSlotIndex() == slotIndex ) - { - final NBTTagList tags = new NBTTagList(); - final List list = new ArrayList<>(); - final ItemStack displayed = ingredient.getDisplayedIngredient(); - - // prefer currently displayed item - if( displayed != null && !displayed.isEmpty() ) - { - list.add( displayed ); - } - - // prefer pure crystals. - for( ItemStack stack : ingredient.getAllIngredients() ) - { - if( Platform.isRecipePrioritized( stack ) ) - { - list.add( 0, stack ); - } - else - { - list.add( stack ); - } - } - - for( final ItemStack is : list ) - { - final NBTTagCompound tag = new NBTTagCompound(); - is.writeToNBT( tag ); - tags.appendTag( tag ); - } - - recipe.setTag( "#" + slot.getSlotIndex(), tags ); - break; - } - } - } - - slotIndex++; - } - - try - { - NetworkHandler.instance().sendToServer( new PacketJEIRecipe( recipe ) ); - } - catch( IOException e ) - { - AELog.debug( e ); - } - - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/PartInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/PartInfoProvider.java deleted file mode 100644 index ea598efed..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/PartInfoProvider.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.theoneprobe; - - -import java.util.List; -import java.util.Optional; - -import com.google.common.collect.Lists; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.parts.IPart; -import appeng.core.AppEng; -import appeng.integration.modules.theoneprobe.part.ChannelInfoProvider; -import appeng.integration.modules.theoneprobe.part.IPartProbInfoProvider; -import appeng.integration.modules.theoneprobe.part.P2PStateInfoProvider; -import appeng.integration.modules.theoneprobe.part.PartAccessor; -import appeng.integration.modules.theoneprobe.part.PowerStateInfoProvider; -import appeng.integration.modules.theoneprobe.part.StorageMonitorInfoProvider; - - -public final class PartInfoProvider implements IProbeInfoProvider -{ - private final List providers; - - private final PartAccessor accessor = new PartAccessor(); - - public PartInfoProvider() - { - final IPartProbInfoProvider channel = new ChannelInfoProvider(); - final IPartProbInfoProvider power = new PowerStateInfoProvider(); - final IPartProbInfoProvider storageMonitor = new StorageMonitorInfoProvider(); - final IPartProbInfoProvider p2p = new P2PStateInfoProvider(); - - this.providers = Lists.newArrayList( channel, power, p2p, storageMonitor ); - } - - @Override - public String getID() - { - return AppEng.MOD_ID + ":PartInfoProvider"; - } - - @Override - public void addProbeInfo( ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - final TileEntity te = world.getTileEntity( data.getPos() ); - final Optional maybePart = this.accessor.getMaybePart( te, data ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartProbInfoProvider provider : this.providers ) - { - provider.addProbeInfo( part, mode, probeInfo, player, world, blockState, data ); - } - } - - } -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/TheOneProbeModule.java b/src/main/java/appeng/integration/modules/theoneprobe/TheOneProbeModule.java deleted file mode 100644 index 0fb0b0172..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/TheOneProbeModule.java +++ /dev/null @@ -1,51 +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 . - */ - -package appeng.integration.modules.theoneprobe; - - -import java.util.function.Function; - -import net.minecraftforge.fml.common.event.FMLInterModComms; - -import mcjty.theoneprobe.api.ITheOneProbe; - -import appeng.integration.IIntegrationModule; -import appeng.integration.modules.theoneprobe.config.AEConfigProvider; - - -public class TheOneProbeModule implements IIntegrationModule, Function -{ - @Override - public void preInit() throws Throwable - { - FMLInterModComms.sendFunctionMessage( "theoneprobe", "getTheOneProbe", this.getClass().getName() ); - } - - @Override - public Void apply( ITheOneProbe input ) - { - input.registerProbeConfigProvider( new AEConfigProvider() ); - - input.registerProvider( new TileInfoProvider() ); - - input.registerProvider( new PartInfoProvider() ); - - return null; - } -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/TheOneProbeText.java b/src/main/java/appeng/integration/modules/theoneprobe/TheOneProbeText.java deleted file mode 100644 index 320c946b1..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/TheOneProbeText.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.theoneprobe; - - -import java.util.Locale; - -import net.minecraft.util.text.translation.I18n; - - -public enum TheOneProbeText -{ - CRAFTING, - - DEVICE_ONLINE, - DEVICE_OFFLINE, - DEVICE_MISSING_CHANNEL, - - P2P_UNLINKED, - P2P_INPUT_ONE_OUTPUT, - P2P_INPUT_MANY_OUTPUTS, - P2P_OUTPUT, - P2P_FREQUENCY, - - LOCKED, - UNLOCKED, - SHOWING, - - CONTAINS, - CHANNELS, - - STORED_ENERGY; - - private final String root; - - TheOneProbeText() - { - this.root = "theoneprobe.appliedenergistics2"; - } - - public String getLocal() - { - return I18n.translateToLocal( this.getUnlocalized() ); - } - - public String getUnlocalized() - { - return this.root + '.' + this.name().toLowerCase( Locale.ENGLISH ); - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/TileInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/TileInfoProvider.java deleted file mode 100644 index 82baa640b..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/TileInfoProvider.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.theoneprobe; - - -import java.util.List; - -import com.google.common.collect.Lists; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.core.AppEng; -import appeng.integration.modules.theoneprobe.tile.ChargerInfoProvider; -import appeng.integration.modules.theoneprobe.tile.CraftingMonitorInfoProvider; -import appeng.integration.modules.theoneprobe.tile.ITileProbInfoProvider; -import appeng.integration.modules.theoneprobe.tile.PowerStateInfoProvider; -import appeng.integration.modules.theoneprobe.tile.PowerStorageInfoProvider; -import appeng.tile.AEBaseTile; - - -public final class TileInfoProvider implements IProbeInfoProvider -{ - private final List providers; - - public TileInfoProvider() - { - final ITileProbInfoProvider charger = new ChargerInfoProvider(); - final ITileProbInfoProvider energyCell = new CraftingMonitorInfoProvider(); - final ITileProbInfoProvider craftingBlock = new PowerStateInfoProvider(); - final ITileProbInfoProvider craftingMonitor = new PowerStorageInfoProvider(); - - this.providers = Lists.newArrayList( charger, energyCell, craftingBlock, craftingMonitor ); - } - - @Override - public String getID() - { - return AppEng.MOD_ID + ":TileInfoProvider"; - } - - @Override - public void addProbeInfo( ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - final TileEntity tile = world.getTileEntity( data.getPos() ); - - if( tile instanceof AEBaseTile ) - { - final AEBaseTile aeBaseTile = (AEBaseTile) tile; - - for( final ITileProbInfoProvider provider : this.providers ) - { - provider.addProbeInfo( aeBaseTile, mode, probeInfo, player, world, blockState, data ); - } - } - } -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/config/AEConfigProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/config/AEConfigProvider.java deleted file mode 100644 index f575e9add..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/config/AEConfigProvider.java +++ /dev/null @@ -1,53 +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 . - */ - -package appeng.integration.modules.theoneprobe.config; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeConfig; -import mcjty.theoneprobe.api.IProbeConfigProvider; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeHitEntityData; - -import appeng.tile.AEBaseTile; - - -public class AEConfigProvider implements IProbeConfigProvider -{ - - @Override - public void getProbeConfig( IProbeConfig config, EntityPlayer player, World world, Entity entity, IProbeHitEntityData data ) - { - // Still no AE entities. - } - - @Override - public void getProbeConfig( IProbeConfig config, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( world.getTileEntity( data.getPos() ) instanceof AEBaseTile ) - { - config.setRFMode( 0 ); - } - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/part/ChannelInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/part/ChannelInfoProvider.java deleted file mode 100644 index c0e9f2b72..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/part/ChannelInfoProvider.java +++ /dev/null @@ -1,66 +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 . - */ - -package appeng.integration.modules.theoneprobe.part; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.parts.IPart; -import appeng.integration.modules.theoneprobe.TheOneProbeText; -import appeng.parts.networking.PartCableSmart; -import appeng.parts.networking.PartDenseCableSmart; - - -public class ChannelInfoProvider implements IPartProbInfoProvider -{ - - @Override - public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( part instanceof PartDenseCableSmart || part instanceof PartCableSmart ) - { - final int usedChannels; - final int maxChannels = ( part instanceof PartDenseCableSmart ) ? 32 : 8; - - if( part.getGridNode().isActive() ) - { - final NBTTagCompound tmp = new NBTTagCompound(); - part.writeToNBT( tmp ); - usedChannels = tmp.getByte( "usedChannels" ); - } - else - { - usedChannels = 0; - } - - final String formattedChannelString = String.format( TheOneProbeText.CHANNELS.getLocal(), usedChannels, maxChannels ); - - probeInfo.text( formattedChannelString ); - } - - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/part/IPartProbInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/part/IPartProbInfoProvider.java deleted file mode 100644 index 15e877073..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/part/IPartProbInfoProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.theoneprobe.part; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.parts.IPart; - - -/** - * Similar to {@link IProbeInfoProvider}, but already providing the {@link IPart} being looked at. - * - */ -public interface IPartProbInfoProvider -{ - - /** - * @see IProbeInfoProvider#addProbeInfo(ProbeMode, IProbeInfo, EntityPlayer, World, IBlockState, IProbeHitData) - */ - void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ); -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/part/P2PStateInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/part/P2PStateInfoProvider.java deleted file mode 100644 index 985dd05c2..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/part/P2PStateInfoProvider.java +++ /dev/null @@ -1,125 +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 . - */ - -package appeng.integration.modules.theoneprobe.part; - - -import com.google.common.collect.Iterators; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.parts.IPart; -import appeng.integration.modules.theoneprobe.TheOneProbeText; -import appeng.me.GridAccessException; -import appeng.parts.p2p.PartP2PTunnel; -import appeng.util.Platform; - - -public class P2PStateInfoProvider implements IPartProbInfoProvider -{ - - private static final int STATE_UNLINKED = 0; - private static final int STATE_OUTPUT = 1; - private static final int STATE_INPUT = 2; - - @Override - public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( part instanceof PartP2PTunnel ) - { - final PartP2PTunnel tunnel = (PartP2PTunnel) part; - - if( !tunnel.isPowered() ) - { - return; - } - - // The default state - int state = STATE_UNLINKED; - int outputCount = 0; - - if( !tunnel.isOutput() ) - { - outputCount = getOutputCount( tunnel ); - if( outputCount > 0 ) - { - // Only set it to INPUT if we know there are any outputs - state = STATE_INPUT; - } - } - else - { - final PartP2PTunnel input = tunnel.getInput(); - if( input != null ) - { - state = STATE_OUTPUT; - } - } - - switch( state ) - { - case STATE_UNLINKED: - probeInfo.text( TheOneProbeText.P2P_UNLINKED.getLocal() ); - break; - case STATE_OUTPUT: - probeInfo.text( TheOneProbeText.P2P_OUTPUT.getLocal() ); - break; - case STATE_INPUT: - probeInfo.text( getOutputText( outputCount ) ); - break; - } - - final short freq = tunnel.getFrequency(); - final String freqTooltip = Platform.p2p().toHexString( freq ); - - probeInfo.text( freqTooltip ); - } - } - - private static int getOutputCount( PartP2PTunnel tunnel ) - { - try - { - return Iterators.size( tunnel.getOutputs().iterator() ); - } - catch( GridAccessException e ) - { - // Well... unknown size it is! - return 0; - } - } - - private static String getOutputText( int outputs ) - { - if( outputs <= 1 ) - { - return TheOneProbeText.P2P_INPUT_ONE_OUTPUT.getLocal(); - } - else - { - return String.format( TheOneProbeText.P2P_INPUT_MANY_OUTPUTS.getLocal(), outputs ); - } - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/part/PartAccessor.java b/src/main/java/appeng/integration/modules/theoneprobe/part/PartAccessor.java deleted file mode 100644 index 3534d519a..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/part/PartAccessor.java +++ /dev/null @@ -1,55 +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 . - */ - -package appeng.integration.modules.theoneprobe.part; - - -import java.util.Optional; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; - -import mcjty.theoneprobe.api.IProbeHitData; - -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.SelectedPart; - - -public final class PartAccessor -{ - - public Optional getMaybePart( final TileEntity te, final IProbeHitData data ) - { - if( te instanceof IPartHost ) - { - BlockPos pos = data.getPos(); - final Vec3d position = data.getHitVec().addVector( -pos.getX(), -pos.getY(), -pos.getZ() ); - final IPartHost host = (IPartHost) te; - final SelectedPart sp = host.selectPart( position ); - - if( sp.part != null ) - { - return Optional.of( sp.part ); - } - } - - return Optional.empty(); - } -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/part/PowerStateInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/part/PowerStateInfoProvider.java deleted file mode 100644 index 951a62cfc..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/part/PowerStateInfoProvider.java +++ /dev/null @@ -1,71 +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 . - */ - -package appeng.integration.modules.theoneprobe.part; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.implementations.IPowerChannelState; -import appeng.api.parts.IPart; -import appeng.integration.modules.theoneprobe.TheOneProbeText; - - -public class PowerStateInfoProvider implements IPartProbInfoProvider -{ - - @Override - public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( part instanceof IPowerChannelState ) - { - final IPowerChannelState state = (IPowerChannelState) part; - final String tooltip = this.getToolTip( state.isActive(), state.isPowered() ); - - probeInfo.text( tooltip ); - } - - } - - private String getToolTip( final boolean isActive, final boolean isPowered ) - { - final String result; - - if( isActive && isPowered ) - { - result = TheOneProbeText.DEVICE_ONLINE.getLocal(); - } - else if( isPowered ) - { - result = TheOneProbeText.DEVICE_MISSING_CHANNEL.getLocal(); - } - else - { - result = TheOneProbeText.DEVICE_OFFLINE.getLocal(); - } - - return result; - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/part/StorageMonitorInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/part/StorageMonitorInfoProvider.java deleted file mode 100644 index 976999ff6..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/part/StorageMonitorInfoProvider.java +++ /dev/null @@ -1,67 +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 . - */ - -package appeng.integration.modules.theoneprobe.part; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.implementations.parts.IPartStorageMonitor; -import appeng.api.parts.IPart; -import appeng.api.storage.data.IAEFluidStack; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IAEStack; -import appeng.integration.modules.theoneprobe.TheOneProbeText; - - -public class StorageMonitorInfoProvider implements IPartProbInfoProvider -{ - - @Override - public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( part instanceof IPartStorageMonitor ) - { - final IPartStorageMonitor monitor = (IPartStorageMonitor) part; - - final IAEStack displayed = monitor.getDisplayed(); - final boolean isLocked = monitor.isLocked(); - - // TODO: generalize - if( displayed instanceof IAEItemStack ) - { - final IAEItemStack ais = (IAEItemStack) displayed; - probeInfo.text( TheOneProbeText.SHOWING.getLocal() + ": " + ais.asItemStackRepresentation().getDisplayName() ); - } - else if( displayed instanceof IAEFluidStack ) - { - final IAEFluidStack ais = (IAEFluidStack) displayed; - probeInfo.text( TheOneProbeText.SHOWING.getLocal() + ": " + ais.getFluid().getLocalizedName( ais.getFluidStack() ) ); - } - - probeInfo.text( isLocked ? TheOneProbeText.LOCKED.getLocal() : TheOneProbeText.UNLOCKED.getLocal() ); - } - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/tile/ChargerInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/tile/ChargerInfoProvider.java deleted file mode 100644 index b6b843b8e..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/tile/ChargerInfoProvider.java +++ /dev/null @@ -1,61 +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 . - */ - -package appeng.integration.modules.theoneprobe.tile; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.items.IItemHandler; - -import mcjty.theoneprobe.api.ElementAlignment; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.tile.AEBaseTile; -import appeng.tile.misc.TileCharger; - - -public class ChargerInfoProvider implements ITileProbInfoProvider -{ - - @Override - public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( tile instanceof TileCharger ) - { - final TileCharger charger = (TileCharger) tile; - final IItemHandler chargerInventory = charger.getInternalInventory(); - final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 ); - - if( !chargingItem.isEmpty() ) - { - final String currentInventory = chargingItem.getDisplayName(); - final IProbeInfo centerAlignedHorizontalLayout = probeInfo - .horizontal( probeInfo.defaultLayoutStyle().alignment( ElementAlignment.ALIGN_CENTER ) ); - - centerAlignedHorizontalLayout.item( chargingItem ); - centerAlignedHorizontalLayout.text( currentInventory ); - } - } - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/tile/CraftingMonitorInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/tile/CraftingMonitorInfoProvider.java deleted file mode 100644 index d1557c909..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/tile/CraftingMonitorInfoProvider.java +++ /dev/null @@ -1,65 +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 . - */ - -package appeng.integration.modules.theoneprobe.tile; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.ElementAlignment; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.storage.data.IAEItemStack; -import appeng.integration.modules.theoneprobe.TheOneProbeText; -import appeng.tile.AEBaseTile; -import appeng.tile.crafting.TileCraftingMonitorTile; - - -public class CraftingMonitorInfoProvider implements ITileProbInfoProvider -{ - - @Override - public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( tile instanceof TileCraftingMonitorTile ) - { - final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) tile; - final IAEItemStack displayStack = monitor.getJobProgress(); - - if( displayStack != null ) - { - // TODO: check if OK - final ItemStack itemStack = displayStack.asItemStackRepresentation(); - final String itemName = itemStack.getDisplayName(); - final String formattedCrafting = String.format( TheOneProbeText.CRAFTING.getLocal(), itemName ); - - final IProbeInfo centerAlignedHorizontalLayout = probeInfo - .horizontal( probeInfo.defaultLayoutStyle().alignment( ElementAlignment.ALIGN_CENTER ) ); - - centerAlignedHorizontalLayout.item( itemStack ); - centerAlignedHorizontalLayout.text( formattedCrafting ); - } - } - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/tile/ITileProbInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/tile/ITileProbInfoProvider.java deleted file mode 100644 index d7051da2b..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/tile/ITileProbInfoProvider.java +++ /dev/null @@ -1,45 +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 . - */ - -package appeng.integration.modules.theoneprobe.tile; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.tile.AEBaseTile; - - -/** - * Similar to {@link IProbeInfoProvider}, but already providing the {@link AEBaseTile} being looked at. - * - */ -public interface ITileProbInfoProvider -{ - - /** - * @see IProbeInfoProvider#addProbeInfo(ProbeMode, IProbeInfo, EntityPlayer, World, IBlockState, IProbeHitData) - */ - void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ); -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/tile/PowerStateInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/tile/PowerStateInfoProvider.java deleted file mode 100644 index 6bd9346db..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/tile/PowerStateInfoProvider.java +++ /dev/null @@ -1,64 +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 . - */ - -package appeng.integration.modules.theoneprobe.tile; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.implementations.IPowerChannelState; -import appeng.integration.modules.theoneprobe.TheOneProbeText; -import appeng.tile.AEBaseTile; - - -public class PowerStateInfoProvider implements ITileProbInfoProvider -{ - - @Override - public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( tile instanceof IPowerChannelState ) - { - final IPowerChannelState state = (IPowerChannelState) tile; - - final boolean isActive = state.isActive(); - final boolean isPowered = state.isPowered(); - - if( isActive && isPowered ) - { - probeInfo.text( TheOneProbeText.DEVICE_ONLINE.getLocal() ); - } - else if( isPowered ) - { - probeInfo.text( TheOneProbeText.DEVICE_MISSING_CHANNEL.getLocal() ); - } - else - { - probeInfo.text( TheOneProbeText.DEVICE_OFFLINE.getLocal() ); - } - } - - } - -} diff --git a/src/main/java/appeng/integration/modules/theoneprobe/tile/PowerStorageInfoProvider.java b/src/main/java/appeng/integration/modules/theoneprobe/tile/PowerStorageInfoProvider.java deleted file mode 100644 index d35bae02b..000000000 --- a/src/main/java/appeng/integration/modules/theoneprobe/tile/PowerStorageInfoProvider.java +++ /dev/null @@ -1,66 +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 . - */ - -package appeng.integration.modules.theoneprobe.tile; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.ProbeMode; - -import appeng.api.networking.energy.IAEPowerStorage; -import appeng.integration.modules.theoneprobe.TheOneProbeText; -import appeng.tile.AEBaseTile; -import appeng.util.Platform; - - -public class PowerStorageInfoProvider implements ITileProbInfoProvider -{ - - @Override - public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data ) - { - if( tile instanceof IAEPowerStorage ) - { - final IAEPowerStorage storage = (IAEPowerStorage) tile; - final double maxPower = storage.getAEMaxPower(); - - if( maxPower > 0 ) - { - final long internalCurrentPower = (long) ( storage.getAECurrentPower() * 100 ); - - if( internalCurrentPower >= 0 ) - { - final long internalMaxPower = (long) ( 100 * maxPower ); - - final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false ); - final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false ); - final String formattedString = String.format( TheOneProbeText.STORED_ENERGY.getLocal(), formatCurrentPower, formatMaxPower ); - - probeInfo.text( formattedString ); - } - } - } - - } - -} diff --git a/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java deleted file mode 100644 index 42cb8ec71..000000000 --- a/src/main/java/appeng/integration/modules/waila/BaseWailaDataProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; - - -/** - * Base implementation for {@link mcp.mobius.waila.api.IWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public abstract class BaseWailaDataProvider implements IWailaDataProvider -{ - @Override - public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return ItemStack.EMPTY; - } - - @Override - public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java deleted file mode 100644 index a7d87d0f0..000000000 --- a/src/main/java/appeng/integration/modules/waila/PartWailaDataProvider.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila; - - -import java.util.List; -import java.util.Optional; - -import com.google.common.collect.Lists; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; - -import appeng.api.parts.IPart; -import appeng.integration.modules.waila.part.ChannelWailaDataProvider; -import appeng.integration.modules.waila.part.IPartWailaDataProvider; -import appeng.integration.modules.waila.part.P2PStateWailaDataProvider; -import appeng.integration.modules.waila.part.PartAccessor; -import appeng.integration.modules.waila.part.PartStackWailaDataProvider; -import appeng.integration.modules.waila.part.PowerStateWailaDataProvider; -import appeng.integration.modules.waila.part.StorageMonitorWailaDataProvider; -import appeng.integration.modules.waila.part.Tracer; - - -/** - * Delegation provider for parts through {@link IPartWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PartWailaDataProvider implements IWailaDataProvider -{ - /** - * Contains all providers - */ - private final List providers; - - /** - * Can access parts through view-hits - */ - private final PartAccessor accessor = new PartAccessor(); - - /** - * Traces views hit on blocks - */ - private final Tracer tracer = new Tracer(); - - /** - * Initializes the provider list with all wanted providers - */ - public PartWailaDataProvider() - { - final IPartWailaDataProvider channel = new ChannelWailaDataProvider(); - final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider(); - final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider(); - final IPartWailaDataProvider p2pState = new P2PStateWailaDataProvider(); - final IPartWailaDataProvider partStack = new PartStackWailaDataProvider(); - - this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState ); - } - - @Override - public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - ItemStack wailaStack = ItemStack.EMPTY; - - for( final IPartWailaDataProvider provider : this.providers ) - { - wailaStack = provider.getWailaStack( part, config, wailaStack ); - } - return wailaStack; - } - - return ItemStack.EMPTY; - } - - @Override - public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaHead( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaBody( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - final RayTraceResult mop = accessor.getMOP(); - - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getWailaTail( part, currentToolTip, accessor, config ); - } - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag, final World world, BlockPos pos ) - { - final RayTraceResult mop = this.tracer.retraceBlock( world, player, pos ); - - if( mop != null ) - { - final Optional maybePart = this.accessor.getMaybePart( te, mop ); - - if( maybePart.isPresent() ) - { - final IPart part = maybePart.get(); - - for( final IPartWailaDataProvider provider : this.providers ) - { - provider.getNBTData( player, part, te, tag, world, pos ); - } - } - } - - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java deleted file mode 100644 index fe3348b8e..000000000 --- a/src/main/java/appeng/integration/modules/waila/TileWailaDataProvider.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila; - - -import java.util.List; - -import com.google.common.collect.Lists; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; - -import appeng.integration.modules.waila.tile.ChargerWailaDataProvider; -import appeng.integration.modules.waila.tile.CraftingMonitorWailaDataProvider; -import appeng.integration.modules.waila.tile.PowerStateWailaDataProvider; -import appeng.integration.modules.waila.tile.PowerStorageWailaDataProvider; - - -/** - * Delegation provider for tiles through {@link mcp.mobius.waila.api.IWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class TileWailaDataProvider implements IWailaDataProvider -{ - /** - * Contains all providers - */ - private final List providers; - - /** - * Initializes the provider list with all wanted providers - */ - public TileWailaDataProvider() - { - final IWailaDataProvider charger = new ChargerWailaDataProvider(); - final IWailaDataProvider energyCell = new PowerStorageWailaDataProvider(); - final IWailaDataProvider craftingBlock = new PowerStateWailaDataProvider(); - final IWailaDataProvider craftingMonitor = new CraftingMonitorWailaDataProvider(); - - this.providers = Lists.newArrayList( charger, energyCell, craftingBlock, craftingMonitor ); - } - - @Override - public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return ItemStack.EMPTY; - } - - @Override - public List getWailaHead( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getWailaHead( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getWailaBody( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public List getWailaTail( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getWailaTail( itemStack, currentToolTip, accessor, config ); - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - for( final IWailaDataProvider provider : this.providers ) - { - provider.getNBTData( player, te, tag, world, pos ); - } - - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/WailaModule.java b/src/main/java/appeng/integration/modules/waila/WailaModule.java deleted file mode 100644 index efa350f0d..000000000 --- a/src/main/java/appeng/integration/modules/waila/WailaModule.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila; - - -import net.minecraftforge.fml.common.event.FMLInterModComms; - -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaRegistrar; - -import appeng.integration.IIntegrationModule; -import appeng.integration.IntegrationHelper; -import appeng.tile.AEBaseTile; - - -public class WailaModule implements IIntegrationModule -{ - - public WailaModule() - { - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaConfigHandler.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataAccessor.class ); - IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.ITaggedList.class ); - } - - public static void register( final IWailaRegistrar registrar ) - { - final IWailaDataProvider partHost = new PartWailaDataProvider(); - - registrar.registerStackProvider( partHost, AEBaseTile.class ); - registrar.registerBodyProvider( partHost, AEBaseTile.class ); - registrar.registerNBTProvider( partHost, AEBaseTile.class ); - - final IWailaDataProvider tile = new TileWailaDataProvider(); - - registrar.registerBodyProvider( tile, AEBaseTile.class ); - registrar.registerNBTProvider( tile, AEBaseTile.class ); - } - - @Override - public void init() throws Throwable - { - FMLInterModComms.sendMessage( "waila", "register", this.getClass().getName() + ".register" ); - } - -} diff --git a/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java deleted file mode 100644 index ac51d200c..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/BasePartWailaDataProvider.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; - - -/** - * Default implementation of {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public abstract class BasePartWailaDataProvider implements IPartWailaDataProvider -{ - @Override - public ItemStack getWailaStack( final IPart part, final IWailaConfigHandler config, final ItemStack partStack ) - { - return ItemStack.EMPTY; - } - - @Override - public List getWailaHead( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaBody( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public List getWailaTail( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java deleted file mode 100644 index 98ac67f13..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/ChannelWailaDataProvider.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import it.unimi.dsi.fastutil.objects.Object2ByteMap; -import it.unimi.dsi.fastutil.objects.Object2ByteOpenHashMap; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; -import appeng.core.localization.WailaText; -import appeng.parts.networking.PartCableSmart; -import appeng.parts.networking.PartDenseCableSmart; - - -/** - * Channel-information provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class ChannelWailaDataProvider extends BasePartWailaDataProvider -{ - /** - * Channel key used for the transferred {@link net.minecraft.nbt.NBTTagCompound} - */ - private static final String ID_USED_CHANNELS = "usedChannels"; - - /** - * Used cache for channels if the channel was not transmitted through the server. - *

- * This is useful, when a player just started to look at a tile and thus just requested the new information from the - * server. - *

- * The cache will be updated from the server. - */ - private final Object2ByteMap cache = new Object2ByteOpenHashMap<>(); - - /** - * Adds the used and max channel to the tool tip - * - * @param part being looked at part - * @param currentToolTip current tool tip - * @param accessor wrapper for various world information - * @param config config to react to various settings - * - * @return modified tool tip - */ - @Override - public List getWailaBody( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - if( part instanceof PartCableSmart || part instanceof PartDenseCableSmart ) - { - final NBTTagCompound tag = accessor.getNBTData(); - - final byte usedChannels = this.getUsedChannels( part, tag, this.cache ); - - if( usedChannels >= 0 ) - { - final byte maxChannels = (byte) ( ( part instanceof PartDenseCableSmart ) ? 32 : 8 ); - - final String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels ); - currentToolTip.add( formattedToolTip ); - } - } - - return currentToolTip; - } - - /** - * Determines the source of the channel. - *

- * If the client received information of the channels on the server, they are used, else if the cache contains a - * previous stored value, this will be used. Default value is 0. - * - * @param part part to be looked at - * @param tag tag maybe containing the channel information - * @param cache cache with previous knowledge - * - * @return used channels on the cable - */ - private byte getUsedChannels( final IPart part, final NBTTagCompound tag, final Object2ByteMap cache ) - { - final byte usedChannels; - - if( tag.hasKey( ID_USED_CHANNELS ) ) - { - usedChannels = tag.getByte( ID_USED_CHANNELS ); - this.cache.put( part, usedChannels ); - } - else if( this.cache.containsKey( part ) ) - { - usedChannels = this.cache.get( part ); - } - else - { - usedChannels = -1; - } - - return usedChannels; - } - - /** - * Called on server to transfer information from server to client. - *

- * If the part is a cable, it writes the channel information in the {@code #tag} using the {@code ID_USED_CHANNELS} - * key. - * - * @param player player looking at the part - * @param part part being looked at - * @param te host of the part - * @param tag transferred tag which is send to the client - * @param world world of the part - * @param pos pos of the part - * - * @return tag send to the client - */ - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - if( part instanceof PartCableSmart || part instanceof PartDenseCableSmart ) - { - final NBTTagCompound tempTag = new NBTTagCompound(); - - part.writeToNBT( tempTag ); - - if( tempTag.hasKey( ID_USED_CHANNELS ) ) - { - final byte usedChannels = tempTag.getByte( ID_USED_CHANNELS ); - - tag.setByte( ID_USED_CHANNELS, usedChannels ); - } - } - - return tag; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java deleted file mode 100644 index 51126ea52..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/IPartWailaDataProvider.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; - - -/** - * An abstraction layer of the {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} for - * {@link appeng.api.parts.IPart}. - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public interface IPartWailaDataProvider -{ - ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack ); - - List getWailaHead( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ); - - List getWailaBody( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ); - - List getWailaTail( IPart part, List currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config ); - - NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ); -} diff --git a/src/main/java/appeng/integration/modules/waila/part/P2PStateWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/P2PStateWailaDataProvider.java deleted file mode 100644 index bf6fb98c3..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/P2PStateWailaDataProvider.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import com.google.common.collect.Iterators; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.translation.I18n; -import net.minecraft.world.World; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.parts.IPart; -import appeng.core.localization.WailaText; -import appeng.me.GridAccessException; -import appeng.parts.p2p.PartP2PTunnel; -import appeng.util.Platform; - - -/** - * Provides information about a P2P tunnel to WAILA. - */ -public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider -{ - - private static final int STATE_UNLINKED = 0; - private static final int STATE_OUTPUT = 1; - private static final int STATE_INPUT = 2; - public static final String TAG_P2P_STATE = "p2p_state"; - public static final String TAG_P2P_FREQUENCY = "p2p_frequency"; - - /** - * Adds state to the tooltip - * - * @param part part with state - * @param currentToolTip to be added to tooltip - * @param accessor wrapper for various information - * @param config config settings - * - * @return modified tooltip - */ - @Override - public List getWailaBody( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - if( part instanceof PartP2PTunnel ) - { - NBTTagCompound nbtData = accessor.getNBTData(); - if( nbtData.hasKey( TAG_P2P_STATE ) ) - { - int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE ); - if( stateArr.length == 2 ) - { - int state = stateArr[0]; - int outputs = stateArr[1]; - - switch( state ) - { - case STATE_UNLINKED: - currentToolTip.add( WailaText.P2PUnlinked.getLocal() ); - break; - case STATE_OUTPUT: - currentToolTip.add( WailaText.P2POutput.getLocal() ); - break; - case STATE_INPUT: - currentToolTip.add( getOutputText( outputs ) ); - break; - } - } - - final short freq = nbtData.getShort( TAG_P2P_FREQUENCY ); - final String freqTooltip = Platform.p2p().toHexString( freq ); - currentToolTip.add( I18n.translateToLocalFormatted( "gui.tooltips.appliedenergistics2.P2PFrequency", freqTooltip ) ); - } - } - - return currentToolTip; - } - - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - if( part instanceof PartP2PTunnel ) - { - final PartP2PTunnel tunnel = (PartP2PTunnel) part; - - if( !tunnel.isPowered() ) - { - return tag; - } - - // Frquency - final short frequency = tunnel.getFrequency(); - tag.setShort( TAG_P2P_FREQUENCY, frequency ); - - // The default state - int state = STATE_UNLINKED; - int outputCount = 0; - - if( !tunnel.isOutput() ) - { - outputCount = getOutputCount( tunnel ); - if( outputCount > 0 ) - { - // Only set it to INPUT if we know there are any outputs - state = STATE_INPUT; - } - } - else - { - PartP2PTunnel input = tunnel.getInput(); - if( input != null ) - { - state = STATE_OUTPUT; - } - } - - tag.setIntArray( TAG_P2P_STATE, new int[] { - state, - outputCount - } ); - - } - - return tag; - } - - private static int getOutputCount( PartP2PTunnel tunnel ) - { - try - { - return Iterators.size( tunnel.getOutputs().iterator() ); - } - catch( GridAccessException e ) - { - // Well... unknown size it is! - return 0; - } - } - - private static String getOutputText( int outputs ) - { - if( outputs <= 1 ) - { - return WailaText.P2PInputOneOutput.getLocal(); - } - else - { - return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs ); - } - } - -} diff --git a/src/main/java/appeng/integration/modules/waila/part/PartAccessor.java b/src/main/java/appeng/integration/modules/waila/part/PartAccessor.java deleted file mode 100644 index 7c1c810d5..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/PartAccessor.java +++ /dev/null @@ -1,71 +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 . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.Optional; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; - -import appeng.api.parts.IPart; -import appeng.api.parts.IPartHost; -import appeng.api.parts.SelectedPart; - - -/** - * Accessor to access specific parts for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PartAccessor -{ - /** - * Hits a {@link IPartHost} with {@link BlockPos}. - *

- * You can derive the looked at {@link IPart} by doing that. If a facade is being looked at, it is - * defined as being absent. - * - * @param te being looked at {@link TileEntity} - * @param mop type of ray-trace - * - * @return maybe the looked at {@link IPart} - */ - public Optional getMaybePart( final TileEntity te, final RayTraceResult mop ) - { - if( te instanceof IPartHost ) - { - BlockPos pos = mop.getBlockPos(); - final Vec3d position = mop.hitVec.addVector( -pos.getX(), -pos.getY(), -pos.getZ() ); - final IPartHost host = (IPartHost) te; - final SelectedPart sp = host.selectPart( position ); - - if( sp.part != null ) - { - return Optional.of( sp.part ); - } - } - - return Optional.empty(); - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java deleted file mode 100644 index 31ab7ddf6..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/PartStackWailaDataProvider.java +++ /dev/null @@ -1,47 +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 . - */ - -package appeng.integration.modules.waila.part; - - -import net.minecraft.item.ItemStack; - -import mcp.mobius.waila.api.IWailaConfigHandler; - -import appeng.api.parts.IPart; -import appeng.api.parts.PartItemStack; - - -/** - * Part ItemStack provider for WAILA - * - * @author TheJulianJES - * @version rv2 - * @since rv2 - */ -public class PartStackWailaDataProvider extends BasePartWailaDataProvider -{ - - @Override - public ItemStack getWailaStack( final IPart part, final IWailaConfigHandler config, ItemStack partStack ) - { - partStack = part.getItemStack( PartItemStack.PICK ); - return partStack; - } - -} diff --git a/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java deleted file mode 100644 index c7e3a8261..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/PowerStateWailaDataProvider.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.implementations.IPowerChannelState; -import appeng.api.parts.IPart; -import appeng.core.localization.WailaText; - - -/** - * Power state provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PowerStateWailaDataProvider extends BasePartWailaDataProvider -{ - /** - * Adds state to the tooltip - * - * @param part part with state - * @param currentToolTip to be added to tooltip - * @param accessor wrapper for various information - * @param config config settings - * - * @return modified tooltip - */ - @Override - public List getWailaBody( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - if( part instanceof IPowerChannelState ) - { - final IPowerChannelState state = (IPowerChannelState) part; - - currentToolTip.add( this.getToolTip( state.isActive(), state.isPowered() ) ); - } - - return currentToolTip; - } - - /** - * Gets the corresponding tool tip for different values of {@code #isActive} and {@code #isPowered} - * - * @param isActive if part is active - * @param isPowered if part is powered - * - * @return tooltip of the state - */ - private String getToolTip( final boolean isActive, final boolean isPowered ) - { - final String result; - - if( isActive && isPowered ) - { - result = WailaText.DeviceOnline.getLocal(); - } - else if( isPowered ) - { - result = WailaText.DeviceMissingChannel.getLocal(); - } - else - { - result = WailaText.DeviceOffline.getLocal(); - } - - return result; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java deleted file mode 100644 index 30647b6de..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/StorageMonitorWailaDataProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.part; - - -import java.util.List; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.implementations.parts.IPartStorageMonitor; -import appeng.api.parts.IPart; -import appeng.api.storage.data.IAEFluidStack; -import appeng.api.storage.data.IAEItemStack; -import appeng.api.storage.data.IAEStack; -import appeng.core.localization.WailaText; - - -/** - * Storage monitor provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class StorageMonitorWailaDataProvider extends BasePartWailaDataProvider -{ - /** - * Displays the stack if present and if the monitor is locked. - * Can handle fluids and items. - * - * @param part maybe storage monitor - * @param currentToolTip to be written to tooltip - * @param accessor information wrapper - * @param config config option - * - * @return modified tooltip - */ - @Override - public List getWailaBody( final IPart part, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - if( part instanceof IPartStorageMonitor ) - { - final IPartStorageMonitor monitor = (IPartStorageMonitor) part; - - final IAEStack displayed = monitor.getDisplayed(); - final boolean isLocked = monitor.isLocked(); - - // TODO: generalize - if( displayed instanceof IAEItemStack ) - { - final IAEItemStack ais = (IAEItemStack) displayed; - currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.asItemStackRepresentation().getDisplayName() ); - } - else if( displayed instanceof IAEFluidStack ) - { - final IAEFluidStack ais = (IAEFluidStack) displayed; - currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getFluid().getLocalizedName( ais.getFluidStack() ) ); - } - - currentToolTip.add( ( isLocked ) ? WailaText.Locked.getLocal() : WailaText.Unlocked.getLocal() ); - } - - return currentToolTip; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/part/Tracer.java b/src/main/java/appeng/integration/modules/waila/part/Tracer.java deleted file mode 100644 index 43e6bcd29..000000000 --- a/src/main/java/appeng/integration/modules/waila/part/Tracer.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.part; - - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - - -/** - * Tracer for players hitting blocks - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class Tracer -{ - /** - * Trace view of players to blocks. - * Ignore all which are out of reach. - * - * @param world word of block - * @param player player viewing block - * @param pos pos of block - * - * @return trace movement. Can be null - */ - public RayTraceResult retraceBlock( final World world, final EntityPlayerMP player, BlockPos pos ) - { - IBlockState blockState = world.getBlockState( pos ); - - final Vec3d headVec = this.getCorrectedHeadVec( player ); - final Vec3d lookVec = player.getLook( 1.0F ); - final double reach = this.getBlockReachDistance_server( player ); - final Vec3d endVec = headVec.addVector( lookVec.x * reach, lookVec.y * reach, lookVec.z * reach ); - - return blockState.collisionRayTrace( world, pos, headVec, endVec ); - } - - /** - * Gets the view point of a player - * - * @param player player with head - * - * @return view point of player - */ - private Vec3d getCorrectedHeadVec( final EntityPlayer player ) - { - double x = player.posX; - double y = player.posY; - double z = player.posZ; - - if( player.world.isRemote ) - { - // compatibility with eye height changing mods - y += player.getEyeHeight() - player.getDefaultEyeHeight(); - } - else - { - y += player.getEyeHeight(); - if( player instanceof EntityPlayerMP && player.isSneaking() ) - { - y -= 0.08; - } - } - return new Vec3d( x, y, z ); - } - - /** - * @param player multi-player player - * - * @return block reach distance of player - */ - private double getBlockReachDistance_server( final EntityPlayerMP player ) - { - return player.interactionManager.getBlockReachDistance(); - } -} diff --git a/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java deleted file mode 100644 index 80ad1da9c..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/ChargerWailaDataProvider.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.items.IItemHandler; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; -import appeng.tile.misc.TileCharger; - - -/** - * Charger provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class ChargerWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Displays the holding item and its tooltip - * - * @param itemStack stack of charger - * @param currentToolTip unmodified tooltip - * @param accessor wrapper information - * @param config config option - * - * @return modified tooltip - */ - @Override - public List getWailaBody( @Nonnull final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - if( te instanceof TileCharger ) - { - final TileCharger charger = (TileCharger) te; - final IItemHandler chargerInventory = charger.getInternalInventory(); - final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 ); - - if( !chargingItem.isEmpty() ) - { - final String currentInventory = chargingItem.getDisplayName(); - final EntityPlayer player = accessor.getPlayer(); - - currentToolTip.add( WailaText.Contains + ": " + currentInventory ); - ITooltipFlag.TooltipFlags tooltipFlag = Minecraft - .getMinecraft().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL; - chargingItem.getItem().addInformation( chargingItem, player.world, currentToolTip, tooltipFlag ); - } - } - - return currentToolTip; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java deleted file mode 100644 index 0c04718e1..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/CraftingMonitorWailaDataProvider.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.storage.data.IAEItemStack; -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; -import appeng.tile.crafting.TileCraftingMonitorTile; - - -/** - * Crafting-monitor provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class CraftingMonitorWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Displays the item currently crafted by the CPU cluster - * - * @param itemStack stack of crafting monitor - * @param currentToolTip unmodified tooltip - * @param accessor information wrapper - * @param config config option - * - * @return modified tooltip - */ - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - if( te instanceof TileCraftingMonitorTile ) - { - final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) te; - final IAEItemStack displayStack = monitor.getJobProgress(); - - if( displayStack != null ) - { - final String currentCrafting = displayStack.asItemStackRepresentation().getDisplayName(); - - currentToolTip.add( WailaText.Crafting.getLocal() + ": " + currentCrafting ); - } - } - - return currentToolTip; - } -} diff --git a/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java deleted file mode 100644 index cff256ddf..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/PowerStateWailaDataProvider.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.implementations.IPowerChannelState; -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; - - -/** - * Power state provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PowerStateWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Adds state to the tooltip - * - * @param itemStack stack of power state - * @param currentToolTip to be added to tooltip - * @param accessor wrapper for various information - * @param config config settings - * - * @return modified tooltip - */ - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - final TileEntity te = accessor.getTileEntity(); - - if( te instanceof IPowerChannelState ) - { - final IPowerChannelState state = (IPowerChannelState) te; - - final boolean isActive = state.isActive(); - final boolean isPowered = state.isPowered(); - - if( isActive && isPowered ) - { - currentToolTip.add( WailaText.DeviceOnline.getLocal() ); - } - else if( isPowered ) - { - currentToolTip.add( WailaText.DeviceMissingChannel.getLocal() ); - } - else - { - currentToolTip.add( WailaText.DeviceOffline.getLocal() ); - } - } - - return currentToolTip; - } -} \ No newline at end of file diff --git a/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java b/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java deleted file mode 100644 index d1b0439f7..000000000 --- a/src/main/java/appeng/integration/modules/waila/tile/PowerStorageWailaDataProvider.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.integration.modules.waila.tile; - - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import it.unimi.dsi.fastutil.objects.Object2LongMap; -import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -import mcp.mobius.waila.api.ITaggedList; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; - -import appeng.api.networking.energy.IAEPowerStorage; -import appeng.core.localization.WailaText; -import appeng.integration.modules.waila.BaseWailaDataProvider; -import appeng.util.Platform; - - -/** - * Power storage provider for WAILA - * - * @author thatsIch - * @version rv2 - * @since rv2 - */ -public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider -{ - /** - * Power key used for the transferred {@link net.minecraft.nbt.NBTTagCompound} - */ - private static final String ID_CURRENT_POWER = "currentPower"; - - /** - * Used cache for power if the power was not transmitted through the server. - *

- * This is useful, when a player just started to look at a tile and thus just requested the new information from the - * server. - *

- * The cache will be updated from the server. - */ - private final Object2LongMap cache = new Object2LongOpenHashMap<>(); - - /** - * Adds the current and max power to the tool tip - * Will ignore if the tile has an energy buffer ( > 0 ) - * - * @param itemStack stack of power storage - * @param currentToolTip current tool tip - * @param accessor wrapper for various world information - * @param config config to react to various settings - * - * @return modified tool tip - */ - @Override - public List getWailaBody( final ItemStack itemStack, final List currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config ) - { - // Removes RF tooltip on WAILA 1.5.9+ - ( (ITaggedList) currentToolTip ).removeEntries( "RFEnergyStorage" ); - - final TileEntity te = accessor.getTileEntity(); - if( te instanceof IAEPowerStorage ) - { - final IAEPowerStorage storage = (IAEPowerStorage) te; - - final double maxPower = storage.getAEMaxPower(); - if( maxPower > 0 ) - { - final NBTTagCompound tag = accessor.getNBTData(); - - final long internalCurrentPower = this.getInternalCurrentPower( tag, te ); - - if( internalCurrentPower >= 0 ) - { - final long internalMaxPower = (long) ( 100 * maxPower ); - - final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false ); - final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false ); - - currentToolTip.add( WailaText.Contains.getLocal() + ": " + formatCurrentPower + " / " + formatMaxPower ); - } - } - } - - return currentToolTip; - } - - /** - * Called on server to transfer information from server to client. - *

- * If the {@link net.minecraft.tileentity.TileEntity} is a {@link appeng.api.networking.energy.IAEPowerStorage}, it - * writes the power information to the {@code #tag} using the {@code #ID_CURRENT_POWER} key. - * - * @param player player looking at the power storage - * @param te power storage - * @param tag transferred tag which is send to the client - * @param world world of the power storage - * @param pos pos of the power storage - * - * @return tag send to the client - */ - @Override - public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos ) - { - if( te instanceof IAEPowerStorage ) - { - final IAEPowerStorage storage = (IAEPowerStorage) te; - - if( storage.getAEMaxPower() > 0 ) - { - final long internalCurrentPower = (long) ( 100 * storage.getAECurrentPower() ); - - tag.setLong( ID_CURRENT_POWER, internalCurrentPower ); - } - } - - return tag; - } - - /** - * Determines the current power. - *

- * If the client received power information on the server, they are used, else if the cache contains a previous - * stored value, this will be used. Default value is 0. - * - * @param te te to be looked at - * @param tag tag maybe containing the channel information - * - * @return used channels on the cable - */ - private long getInternalCurrentPower( final NBTTagCompound tag, final TileEntity te ) - { - final long internalCurrentPower; - - if( tag.hasKey( ID_CURRENT_POWER ) ) - { - internalCurrentPower = tag.getLong( ID_CURRENT_POWER ); - this.cache.put( te, internalCurrentPower ); - } - else if( this.cache.containsKey( te ) ) - { - internalCurrentPower = this.cache.get( te ); - } - else - { - internalCurrentPower = -1; - } - - return internalCurrentPower; - } -} diff --git a/src/main/java/appeng/items/AEBaseItem.java b/src/main/java/appeng/items/AEBaseItem.java index ca57f7aad..d3a674728 100644 --- a/src/main/java/appeng/items/AEBaseItem.java +++ b/src/main/java/appeng/items/AEBaseItem.java @@ -19,65 +19,29 @@ package appeng.items; -import java.util.List; - -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public abstract class AEBaseItem extends Item { - public AEBaseItem() + public AEBaseItem( Item.Properties properties ) { - this.setNoRepair(); + super( properties.setNoRepair() ); } @Override public String toString() { - String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered"; + String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered"; return this.getClass().getSimpleName() + "[" + regName + "]"; } - @SideOnly( Side.CLIENT ) - @Override - @SuppressWarnings( "unchecked" ) - public final void addInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) - { - this.addCheckedInformation( stack, world, lines, advancedTooltips ); - } - - @Override - public final void getSubItems( final CreativeTabs creativeTab, final NonNullList itemStacks ) - { - if( this.isInCreativeTab( creativeTab ) ) - { - this.getCheckedSubItems( creativeTab, itemStacks ); - } - } - @Override public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 ) { return false; } - @SideOnly( Side.CLIENT ) - protected void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) - { - super.addInformation( stack, world, lines, advancedTooltips ); - } - - protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList itemStacks ) - { - super.getSubItems( creativeTab, itemStacks ); - } - } diff --git a/src/main/java/appeng/items/contents/PortableCellViewer.java b/src/main/java/appeng/items/contents/PortableCellViewer.java index 52ee538ce..ad28a16dd 100644 --- a/src/main/java/appeng/items/contents/PortableCellViewer.java +++ b/src/main/java/appeng/items/contents/PortableCellViewer.java @@ -20,7 +20,7 @@ package appeng.items.contents; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.AEApi; import appeng.api.config.Actionable; @@ -98,7 +98,7 @@ public class PortableCellViewer extends MEMonitorHandler implement { final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) -> { - final NBTTagCompound data = Platform.openNbtData( PortableCellViewer.this.target ); + final CompoundNBT data = Platform.openNbtData( PortableCellViewer.this.target ); manager.writeToNBT( data ); } ); diff --git a/src/main/java/appeng/items/materials/ItemMaterial.java b/src/main/java/appeng/items/materials/ItemMaterial.java index 1945d2259..9b5d2c0e9 100644 --- a/src/main/java/appeng/items/materials/ItemMaterial.java +++ b/src/main/java/appeng/items/materials/ItemMaterial.java @@ -31,27 +31,25 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.item.ItemEntity; +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.Direction; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; 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 net.minecraftforge.oredict.OreDictionary; import appeng.api.config.Upgrades; import appeng.api.implementations.IUpgradeableHost; @@ -85,7 +83,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, instance = this; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { @@ -99,7 +97,7 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, if( mt == MaterialType.NAME_PRESS ) { - final NBTTagCompound c = Platform.openNbtData( stack ); + final CompoundNBT c = Platform.openNbtData( stack ); lines.add( c.getString( "InscribeName" ) ); } @@ -202,24 +200,8 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, return mat.getStackSrc(); } - public void registerOredicts() - { - for( final MaterialType mt : ImmutableSet.copyOf( this.dmgToMaterial.values() ) ) - { - if( mt.getOreName() != null ) - { - final String[] names = mt.getOreName().split( "," ); - - for( final String name : names ) - { - OreDictionary.registerOre( name, mt.stack( 1 ) ); - } - } - } - } - @Override - public String getUnlocalizedName( final ItemStack is ) + public String getTranslationKey( final ItemStack is ) { return "item.appliedenergistics2.material." + this.nameOf( is ).toLowerCase(); } @@ -240,9 +222,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, } @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { final TileEntity te = world.getTileEntity( pos ); IItemHandler upgrades = null; @@ -309,9 +291,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent, eqi.motionY = location.motionY; eqi.motionZ = location.motionZ; - if( location instanceof EntityItem && eqi instanceof EntityItem ) + if( location instanceof ItemEntity && eqi instanceof ItemEntity ) { - ( (EntityItem) eqi ).setDefaultPickupDelay(); + ( (ItemEntity) eqi ).setDefaultPickupDelay(); } return eqi; diff --git a/src/main/java/appeng/items/misc/ItemCrystalSeed.java b/src/main/java/appeng/items/misc/ItemCrystalSeed.java index 88644e681..97815a8a6 100644 --- a/src/main/java/appeng/items/misc/ItemCrystalSeed.java +++ b/src/main/java/appeng/items/misc/ItemCrystalSeed.java @@ -30,11 +30,11 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.NonNullList; 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.AEApi; import appeng.api.definitions.IMaterials; @@ -97,7 +97,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal else { final int progress; - final NBTTagCompound comp = Platform.openNbtData( is ); + final CompoundNBT comp = Platform.openNbtData( is ); comp.setInteger( "progress", progress = is.getItemDamage() ); is.setItemDamage( ( is.getItemDamage() / SINGLE_OFFSET ) * SINGLE_OFFSET ); return progress; @@ -147,7 +147,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal private void setProgress( final ItemStack is, final int newDamage ) { - final NBTTagCompound comp = Platform.openNbtData( is ); + final CompoundNBT comp = Platform.openNbtData( is ); comp.setInteger( "progress", newDamage ); is.setItemDamage( is.getItemDamage() / LEVEL_OFFSET * LEVEL_OFFSET ); } @@ -159,7 +159,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { lines.add( ButtonToolTips.DoesntDespawn.getLocal() ); @@ -176,26 +176,26 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal } @Override - public String getUnlocalizedName( final ItemStack is ) + public String getTranslationKey( final ItemStack is ) { final int damage = getProgress( is ); if( damage < CERTUS + SINGLE_OFFSET ) { - return this.getUnlocalizedName() + ".certus"; + return this.getTranslationKey() + ".certus"; } if( damage < NETHER + SINGLE_OFFSET ) { - return this.getUnlocalizedName() + ".nether"; + return this.getTranslationKey() + ".nether"; } if( damage < FLUIX + SINGLE_OFFSET ) { - return this.getUnlocalizedName() + ".fluix"; + return this.getTranslationKey() + ".fluix"; } - return this.getUnlocalizedName(); + return this.getTranslationKey(); } @Override diff --git a/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java b/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java index d44529829..f2171ffbe 100644 --- a/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java +++ b/src/main/java/appeng/items/misc/ItemCrystalSeedRendering.java @@ -24,8 +24,8 @@ import com.google.common.collect.ImmutableList; import net.minecraft.client.renderer.ItemMeshDefinition; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; -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.bootstrap.IItemRendering; import appeng.bootstrap.ItemRenderingCustomizer; @@ -51,7 +51,7 @@ public class ItemCrystalSeedRendering extends ItemRenderingCustomizer }; @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IItemRendering rendering ) { rendering.variants( ImmutableList.builder().add( MODELS_CERTUS ).add( MODELS_FLUIX ).add( MODELS_NETHER ).build() ); diff --git a/src/main/java/appeng/items/misc/ItemEncodedPattern.java b/src/main/java/appeng/items/misc/ItemEncodedPattern.java index 7f64305a0..33f792236 100644 --- a/src/main/java/appeng/items/misc/ItemEncodedPattern.java +++ b/src/main/java/appeng/items/misc/ItemEncodedPattern.java @@ -24,18 +24,18 @@ import java.util.Map; import java.util.WeakHashMap; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; 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.BlockPos; import net.minecraft.util.text.TextFormatting; 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.AEApi; import appeng.api.implementations.ICraftingPatternItem; @@ -60,7 +60,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity player, final Hand hand ) { this.clearPattern( player.getHeldItem( hand ), player ); @@ -68,21 +68,21 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt } @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { return this.clearPattern( player.getHeldItem( hand ), player ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS; } - private boolean clearPattern( final ItemStack stack, final EntityPlayer player ) + private boolean clearPattern( final ItemStack stack, final PlayerEntity player ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { if( Platform.isClient() ) { return false; } - final InventoryPlayer inv = player.inventory; + final PlayerInventory inv = player.inventory; ItemStack is = AEApi.instance().definitions().materials().blankPattern().maybeStack( stack.getCount() ).orElse( ItemStack.EMPTY ); if( !is.isEmpty() ) @@ -102,7 +102,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { final ICraftingPatternDetails details = this.getPatternForItem( stack, world ); diff --git a/src/main/java/appeng/items/parts/ItemFacade.java b/src/main/java/appeng/items/parts/ItemFacade.java index 70f29cc4e..d0fe08aeb 100644 --- a/src/main/java/appeng/items/parts/ItemFacade.java +++ b/src/main/java/appeng/items/parts/ItemFacade.java @@ -23,19 +23,19 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; +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.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -67,7 +67,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte } @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { return AEApi.instance().partHelper().placeBus( player.getHeldItem( hand ), pos, side, player, hand, world ); } @@ -133,7 +133,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte } } - private static boolean hasSimpleModel( IBlockState blockState ) + private static boolean hasSimpleModel( BlockState blockState ) { if( blockState.getRenderType() != EnumBlockRenderType.MODEL || blockState instanceof IExtendedBlockState ) { @@ -160,7 +160,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte // Try to get the block state based on the item stack's meta. If this fails, don't consider it for a facade // This for example fails for Pistons because they hardcoded an invalid meta value in vanilla - IBlockState blockState; + BlockState blockState; try { blockState = block.getStateFromMeta( metadata ); @@ -175,7 +175,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte final boolean isWhiteListed = FacadeConfig.instance().isWhiteListed( block, metadata ); final boolean isModel = blockState.getRenderType() == EnumBlockRenderType.MODEL; - final IBlockState defaultState = block.getDefaultState(); + final BlockState defaultState = block.getDefaultState(); final boolean isTileEntity = block.hasTileEntity( defaultState ); final boolean isFullCube = block.isFullCube( defaultState ); @@ -190,7 +190,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte } final ItemStack is = new ItemStack( this ); - final NBTTagCompound data = new NBTTagCompound(); + final CompoundNBT data = new CompoundNBT(); data.setString( TAG_ITEM_ID, itemStack.getItem().getRegistryName().toString() ); data.setInteger( TAG_DAMAGE, itemStack.getItemDamage() ); is.setTagCompound( data ); @@ -214,7 +214,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte public ItemStack getTextureItem( ItemStack is ) { - NBTTagCompound nbt = is.getTagCompound(); + CompoundNBT nbt = is.getTagCompound(); if( nbt == null ) { @@ -260,7 +260,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte } @Override - public IBlockState getTextureBlockState( ItemStack is ) + public BlockState getTextureBlockState( ItemStack is ) { ItemStack baseItemStack = this.getTextureItem( is ); @@ -322,7 +322,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte return ItemStack.EMPTY; } - final NBTTagCompound facadeTag = new NBTTagCompound(); + final CompoundNBT facadeTag = new CompoundNBT(); facadeTag.setString( TAG_ITEM_ID, item.getRegistryName().toString() ); facadeTag.setInteger( TAG_DAMAGE, ids[1] ); facadeStack.setTagCompound( facadeTag ); @@ -333,7 +333,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte @Override public boolean useAlphaPass( final ItemStack is ) { - IBlockState blockState = this.getTextureBlockState( is ); + BlockState blockState = this.getTextureBlockState( is ); if( blockState == null ) { diff --git a/src/main/java/appeng/items/parts/ItemPart.java b/src/main/java/appeng/items/parts/ItemPart.java index 0024dd2a9..f7f7c9b43 100644 --- a/src/main/java/appeng/items/parts/ItemPart.java +++ b/src/main/java/appeng/items/parts/ItemPart.java @@ -33,18 +33,16 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.Direction; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; import appeng.api.implementations.items.IItemGroup; @@ -154,7 +152,7 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public EnumActionResult onItemUse( final PlayerEntity player, final World w, final BlockPos pos, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ ) { if( this.getTypeByStack( player.getHeldItem( hand ) ) == PartType.INVALID_TYPE ) { @@ -165,10 +163,10 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } @Override - public String getUnlocalizedName( final ItemStack is ) + public String getTranslationKey( final ItemStack is ) { Preconditions.checkNotNull( is ); - return "item.appliedenergistics2.multi_part." + this.getTypeByStack( is ).getUnlocalizedName().toLowerCase(); + return "item.appliedenergistics2.multi_part." + this.getTypeByStack( is ).getTranslationKey().toLowerCase(); } @Override @@ -378,20 +376,4 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup } } - public void registerOreDicts() - { - for( final PartTypeWithVariant mt : ImmutableSet.copyOf( this.registered.values() ) ) - { - if( mt.part.getOreName() != null ) - { - final String[] names = mt.part.getOreName().split( "," ); - - for( final String name : names ) - { - OreDictionary.registerOre( name, new ItemStack( this, 1, mt.part.getBaseDamage() + mt.variant ) ); - } - } - } - } - } diff --git a/src/main/java/appeng/items/parts/ItemPartRendering.java b/src/main/java/appeng/items/parts/ItemPartRendering.java index 50f31642d..f6b3136a4 100644 --- a/src/main/java/appeng/items/parts/ItemPartRendering.java +++ b/src/main/java/appeng/items/parts/ItemPartRendering.java @@ -27,8 +27,8 @@ import java.util.stream.Collectors; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -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.util.AEColor; import appeng.bootstrap.IItemRendering; @@ -55,7 +55,7 @@ public class ItemPartRendering extends ItemRenderingCustomizer } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IItemRendering rendering ) { diff --git a/src/main/java/appeng/items/parts/PartType.java b/src/main/java/appeng/items/parts/PartType.java index 75838da0a..79fa6f2e5 100644 --- a/src/main/java/appeng/items/parts/PartType.java +++ b/src/main/java/appeng/items/parts/PartType.java @@ -32,8 +32,8 @@ import com.google.common.collect.ImmutableList; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; -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.IPart; import appeng.api.util.AEColor; @@ -100,7 +100,7 @@ public enum PartType } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) protected List createItemModels( String baseName ) { return Arrays.stream( AEColor.values() ) @@ -118,7 +118,7 @@ public enum PartType } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) protected List createItemModels( String baseName ) { return Arrays.stream( AEColor.values() ) @@ -136,7 +136,7 @@ public enum PartType } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) protected List createItemModels( String baseName ) { return Arrays.stream( AEColor.values() ) @@ -155,7 +155,7 @@ public enum PartType } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) protected List createItemModels( String baseName ) { return Arrays.stream( AEColor.values() ) @@ -174,7 +174,7 @@ public enum PartType } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) protected List createItemModels( String baseName ) { return Arrays.stream( AEColor.values() ) @@ -247,7 +247,7 @@ public enum PartType .noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel ) { @Override - String getUnlocalizedName() + String getTranslationKey() { return "p2p_tunnel"; } @@ -257,7 +257,7 @@ public enum PartType .noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel ) { @Override - String getUnlocalizedName() + String getTranslationKey() { return "p2p_tunnel"; } @@ -267,7 +267,7 @@ public enum PartType .noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel ) { @Override - String getUnlocalizedName() + String getTranslationKey() { return "p2p_tunnel"; } @@ -277,7 +277,7 @@ public enum PartType .noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel ) { @Override - String getUnlocalizedName() + String getTranslationKey() { return "p2p_tunnel"; } @@ -287,7 +287,7 @@ public enum PartType .of( IntegrationType.IC2 ), PartP2PIC2Power.class, GuiText.EUTunnel ) { @Override - String getUnlocalizedName() + String getTranslationKey() { return "p2p_tunnel"; } @@ -297,7 +297,7 @@ public enum PartType .noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel ) { @Override - String getUnlocalizedName() + String getTranslationKey() { return "p2p_tunnel"; } @@ -307,7 +307,7 @@ public enum PartType .noneOf( IntegrationType.class ), PartP2PFEPower.class, GuiText.FETunnel ) { @Override - String getUnlocalizedName() + String getTranslationKey() { return "p2p_tunnel"; } @@ -326,7 +326,7 @@ public enum PartType private final Set integrations; private final Class myPart; private final GuiText extraName; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private List itemModels; private final Set models; private final boolean enabled; @@ -388,13 +388,13 @@ public enum PartType } } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) protected List createItemModels( String baseName ) { return ImmutableList.of( modelFromBaseName( baseName ) ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private static ModelResourceLocation modelFromBaseName( String baseName ) { return new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "part/" + baseName ), "inventory" ); @@ -430,7 +430,7 @@ public enum PartType return this.myPart; } - String getUnlocalizedName() + String getTranslationKey() { return this.name().toLowerCase(); } @@ -455,7 +455,7 @@ public enum PartType return this.oreName; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public List getItemModels() { return this.itemModels; diff --git a/src/main/java/appeng/items/storage/AbstractStorageCell.java b/src/main/java/appeng/items/storage/AbstractStorageCell.java index 419d4f9eb..ba85835b2 100644 --- a/src/main/java/appeng/items/storage/AbstractStorageCell.java +++ b/src/main/java/appeng/items/storage/AbstractStorageCell.java @@ -23,17 +23,17 @@ import java.util.List; import java.util.Set; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; 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.BlockPos; 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; @@ -74,7 +74,7 @@ public abstract class AbstractStorageCell> extends AEBaseI this.component = whichCell; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { @@ -158,22 +158,22 @@ public abstract class AbstractStorageCell> extends AEBaseI } @Override - public ActionResult onItemRightClick( final World world, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World world, final PlayerEntity player, final Hand hand ) { this.disassembleDrive( player.getHeldItem( hand ), world, player ); return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) ); } - private boolean disassembleDrive( final ItemStack stack, final World world, final EntityPlayer player ) + private boolean disassembleDrive( final ItemStack stack, final World world, final PlayerEntity player ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { if( Platform.isClient() ) { return false; } - final InventoryPlayer playerInventory = player.inventory; + final PlayerInventory playerInventory = player.inventory; final IMEInventoryHandler inv = AEApi.instance().registries().cell().getCellInventory( stack, null, this.getChannel() ); if( inv != null && playerInventory.getCurrentItem() == stack ) { @@ -217,10 +217,10 @@ public abstract class AbstractStorageCell> extends AEBaseI return false; } - protected abstract void dropEmptyStorageCellCase( final InventoryAdaptor ia, final EntityPlayer player ); + protected abstract void dropEmptyStorageCellCase( final InventoryAdaptor ia, final PlayerEntity player ); @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { return this.disassembleDrive( player.getHeldItem( hand ), world, player ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS; } diff --git a/src/main/java/appeng/items/storage/BasicItemStorageCell.java b/src/main/java/appeng/items/storage/BasicItemStorageCell.java index 5c6de9811..68e1b8efa 100644 --- a/src/main/java/appeng/items/storage/BasicItemStorageCell.java +++ b/src/main/java/appeng/items/storage/BasicItemStorageCell.java @@ -19,7 +19,7 @@ package appeng.items.storage; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import appeng.api.AEApi; @@ -83,7 +83,7 @@ public final class BasicItemStorageCell extends AbstractStorageCell { diff --git a/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java b/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java index f3468bdb6..c147b9301 100644 --- a/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java +++ b/src/main/java/appeng/items/storage/ItemCreativeStorageCell.java @@ -24,8 +24,8 @@ import java.util.List; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; 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; @@ -76,7 +76,7 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { diff --git a/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java b/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java index b2a9e80b8..e8942ffbb 100644 --- a/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java +++ b/src/main/java/appeng/items/storage/ItemSpatialStorageCell.java @@ -23,12 +23,12 @@ import java.util.List; import net.minecraft.client.util.ITooltipFlag; 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.World; import net.minecraftforge.common.DimensionManager; -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.implementations.TransitionResult; import appeng.api.implementations.items.ISpatialStorageCell; @@ -57,7 +57,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag this.maxRegion = spatialScale; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { @@ -109,7 +109,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag { if( is.hasTagCompound() ) { - final NBTTagCompound c = is.getTagCompound(); + final CompoundNBT c = is.getTagCompound(); return new WorldCoord( c.getInteger( NBT_SIZE_X_KEY ), c.getInteger( NBT_SIZE_Y_KEY ), c.getInteger( NBT_SIZE_Z_KEY ) ); } return new WorldCoord( 0, 0, 0 ); @@ -120,7 +120,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag { if( is.hasTagCompound() ) { - final NBTTagCompound c = is.getTagCompound(); + final CompoundNBT c = is.getTagCompound(); return c.getInteger( NBT_CELL_ID_KEY ); } return -1; @@ -180,7 +180,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag private void setStorageCell( final ItemStack is, int id, BlockPos size ) { - final NBTTagCompound c = Platform.openNbtData( is ); + final CompoundNBT c = Platform.openNbtData( is ); c.setInteger( NBT_CELL_ID_KEY, id ); c.setInteger( NBT_SIZE_X_KEY, size.getX() ); diff --git a/src/main/java/appeng/items/tools/ToolBiometricCard.java b/src/main/java/appeng/items/tools/ToolBiometricCard.java index 0740090d4..53eaf4f31 100644 --- a/src/main/java/appeng/items/tools/ToolBiometricCard.java +++ b/src/main/java/appeng/items/tools/ToolBiometricCard.java @@ -25,17 +25,18 @@ import java.util.List; import com.mojang.authlib.GameProfile; import net.minecraft.client.util.ITooltipFlag; -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.nbt.NBTUtil; import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; 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.config.SecurityPermissions; import appeng.api.features.IPlayerRegistry; @@ -50,32 +51,32 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard { public ToolBiometricCard() { - this.setMaxStackSize( 1 ); + super( new Properties().maxStackSize( 1 ) ); } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity p, final Hand hand ) { - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { this.encode( p.getHeldItem( hand ), p ); p.swingArm( hand ); - return new ActionResult<>( EnumActionResult.SUCCESS, p.getHeldItem( hand ) ); + return ActionResult.resultSuccess( p.getHeldItem( hand ) ); } - return new ActionResult<>( EnumActionResult.PASS, p.getHeldItem( hand ) ); + return ActionResult.resultPass( p.getHeldItem( hand ) ); } @Override - public boolean itemInteractionForEntity( ItemStack is, final EntityPlayer player, final EntityLivingBase target, final EnumHand hand ) + public boolean itemInteractionForEntity( ItemStack is, final PlayerEntity player, final LivingEntity target, final Hand hand ) { - if( target instanceof EntityPlayer && !player.isSneaking() ) + if( target instanceof PlayerEntity && !player.isShiftKeyDown() ) { - if( player.capabilities.isCreativeMode ) + if( player.isCreative() ) { is = player.getHeldItem( hand ); } - this.encode( is, (EntityPlayer) target ); + this.encode( is, (PlayerEntity) target ); player.swingArm( hand ); return true; } @@ -83,13 +84,13 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard } @Override - public String getItemStackDisplayName( final ItemStack is ) + public ITextComponent getDisplayName( final ItemStack is ) { final GameProfile username = this.getProfile( is ); - return username != null ? super.getItemStackDisplayName( is ) + " - " + username.getName() : super.getItemStackDisplayName( is ); + return username != null ? super.getDisplayName( is ).appendText( " - " + username.getName() ) : super.getDisplayName( is ); } - private void encode( final ItemStack is, final EntityPlayer p ) + private void encode( final ItemStack is, final PlayerEntity p ) { final GameProfile username = this.getProfile( is ); @@ -106,27 +107,27 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard @Override public void setProfile( final ItemStack itemStack, final GameProfile profile ) { - final NBTTagCompound tag = Platform.openNbtData( itemStack ); + final CompoundNBT tag = Platform.openNbtData( itemStack ); if( profile != null ) { - final NBTTagCompound pNBT = new NBTTagCompound(); + final CompoundNBT pNBT = new CompoundNBT(); NBTUtil.writeGameProfile( pNBT, profile ); - tag.setTag( "profile", pNBT ); + tag.put( "profile", pNBT ); } else { - tag.removeTag( "profile" ); + tag.remove( "profile" ); } } @Override public GameProfile getProfile( final ItemStack is ) { - final NBTTagCompound tag = Platform.openNbtData( is ); - if( tag.hasKey( "profile" ) ) + final CompoundNBT tag = Platform.openNbtData( is ); + if( tag.contains( "profile" ) ) { - return NBTUtil.readGameProfileFromNBT( tag.getCompoundTag( "profile" ) ); + return NBTUtil.readGameProfile( tag.getCompound( "profile" ) ); } return null; } @@ -134,7 +135,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard @Override public EnumSet getPermissions( final ItemStack is ) { - final NBTTagCompound tag = Platform.openNbtData( is ); + final CompoundNBT tag = Platform.openNbtData( is ); final EnumSet result = EnumSet.noneOf( SecurityPermissions.class ); for( final SecurityPermissions sp : SecurityPermissions.values() ) @@ -151,25 +152,25 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard @Override public boolean hasPermission( final ItemStack is, final SecurityPermissions permission ) { - final NBTTagCompound tag = Platform.openNbtData( is ); + final CompoundNBT tag = Platform.openNbtData( is ); return tag.getBoolean( permission.name() ); } @Override public void removePermission( final ItemStack itemStack, final SecurityPermissions permission ) { - final NBTTagCompound tag = Platform.openNbtData( itemStack ); - if( tag.hasKey( permission.name() ) ) + final CompoundNBT tag = Platform.openNbtData( itemStack ); + if( tag.contains( permission.name() ) ) { - tag.removeTag( permission.name() ); + tag.remove( permission.name() ); } } @Override public void addPermission( final ItemStack itemStack, final SecurityPermissions permission ) { - final NBTTagCompound tag = Platform.openNbtData( itemStack ); - tag.setBoolean( permission.name(), true ); + final CompoundNBT tag = Platform.openNbtData( itemStack ); + tag.putBoolean( permission.name(), true ); } @Override @@ -179,27 +180,27 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard } @Override - @SideOnly( Side.CLIENT ) - public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) + @OnlyIn( Dist.CLIENT ) + public void addInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { final EnumSet perms = this.getPermissions( stack ); if( perms.isEmpty() ) { - lines.add( GuiText.NoPermissions.getLocal() ); + lines.add( new TranslationTextComponent( GuiText.NoPermissions.getLocal() ) ); } else { - String msg = null; + ITextComponent msg = null; for( final SecurityPermissions sp : perms ) { if( msg == null ) { - msg = Platform.gui_localize( sp.getUnlocalizedName() ); + msg = new TranslationTextComponent( sp.getTranslatedName() ); } else { - msg = msg + ", " + Platform.gui_localize( sp.getUnlocalizedName() ); + msg = msg.appendText( ", " ).appendSibling( new TranslationTextComponent( sp.getTranslatedName() ) ); } } lines.add( msg ); diff --git a/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java b/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java index 9c167b148..f6840f39b 100644 --- a/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java +++ b/src/main/java/appeng/items/tools/ToolBiometricCardRendering.java @@ -4,8 +4,8 @@ package appeng.items.tools; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; -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.bootstrap.IItemRendering; import appeng.bootstrap.ItemRenderingCustomizer; @@ -19,7 +19,7 @@ public class ToolBiometricCardRendering extends ItemRenderingCustomizer private static final ResourceLocation MODEL = new ResourceLocation( AppEng.MOD_ID, "builtin/biometric_card" ); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IItemRendering rendering ) { rendering.builtInModel( "models/item/builtin/biometric_card", new BiometricCardModel() ); diff --git a/src/main/java/appeng/items/tools/ToolMemoryCard.java b/src/main/java/appeng/items/tools/ToolMemoryCard.java index 75ae60bad..d326dd665 100644 --- a/src/main/java/appeng/items/tools/ToolMemoryCard.java +++ b/src/main/java/appeng/items/tools/ToolMemoryCard.java @@ -22,20 +22,20 @@ package appeng.items.tools; import java.util.List; import net.minecraft.client.util.ITooltipFlag; -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.ActionResult; 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.BlockPos; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.translation.I18n; -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.implementations.items.IMemoryCard; import appeng.api.implementations.items.MemoryCardMessages; @@ -60,12 +60,12 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) ); - final NBTTagCompound data = this.getData( stack ); + final CompoundNBT data = this.getData( stack ); if( data.hasKey( "tooltip" ) ) { lines.add( I18n.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) ); @@ -107,9 +107,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard } @Override - public void setMemoryCardContents( final ItemStack is, final String settingsName, final NBTTagCompound data ) + public void setMemoryCardContents( final ItemStack is, final String settingsName, final CompoundNBT data ) { - final NBTTagCompound c = Platform.openNbtData( is ); + final CompoundNBT c = Platform.openNbtData( is ); c.setString( "Config", settingsName ); c.setTag( "Data", data ); } @@ -117,19 +117,19 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard @Override public String getSettingsName( final ItemStack is ) { - final NBTTagCompound c = Platform.openNbtData( is ); + final CompoundNBT c = Platform.openNbtData( is ); final String name = c.getString( "Config" ); return name == null || name.isEmpty() ? GuiText.Blank.getUnlocalized() : name; } @Override - public NBTTagCompound getData( final ItemStack is ) + public CompoundNBT getData( final ItemStack is ) { - final NBTTagCompound c = Platform.openNbtData( is ); - NBTTagCompound o = c.getCompoundTag( "Data" ); + final CompoundNBT c = Platform.openNbtData( is ); + CompoundNBT o = c.getCompoundTag( "Data" ); if( o == null ) { - o = new NBTTagCompound(); + o = new CompoundNBT(); } return o.copy(); } @@ -137,7 +137,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard @Override public AEColor[] getColorCode( ItemStack is ) { - final NBTTagCompound tag = this.getData( is ); + final CompoundNBT tag = this.getData( is ); if( tag.hasKey( "colorCode" ) ) { @@ -154,7 +154,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard } @Override - public void notifyUser( final EntityPlayer player, final MemoryCardMessages msg ) + public void notifyUser( final PlayerEntity player, final MemoryCardMessages msg ) { if( Platform.isClient() ) { @@ -183,9 +183,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard } @Override - public EnumActionResult onItemUse( final EntityPlayer player, final World w, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hx, final float hy, final float hz ) + public EnumActionResult onItemUse( final PlayerEntity player, final World w, final BlockPos pos, final Hand hand, final Direction side, final float hx, final float hy, final float hz ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { if( !w.isRemote ) { @@ -200,9 +200,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard } @Override - public ActionResult onItemRightClick( World w, EntityPlayer player, EnumHand hand ) + public ActionResult onItemRightClick( World w, PlayerEntity player, Hand hand ) { - if( player.isSneaking() ) + if( player.isShiftKeyDown() ) { if( !w.isRemote ) { @@ -215,12 +215,12 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard } @Override - public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player ) + public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockReader world, final BlockPos pos, final PlayerEntity player ) { return true; } - private void clearCard( final EntityPlayer player, final World w, final EnumHand hand ) + private void clearCard( final PlayerEntity player, final World w, final Hand hand ) { final IMemoryCard mem = (IMemoryCard) player.getHeldItem( hand ).getItem(); mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED ); diff --git a/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java b/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java index e82548415..8f5c58121 100644 --- a/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java +++ b/src/main/java/appeng/items/tools/ToolMemoryCardRendering.java @@ -4,8 +4,8 @@ package appeng.items.tools; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.ResourceLocation; -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.bootstrap.IItemRendering; import appeng.bootstrap.ItemRenderingCustomizer; @@ -19,7 +19,7 @@ public class ToolMemoryCardRendering extends ItemRenderingCustomizer private static final ResourceLocation MODEL = new ResourceLocation( AppEng.MOD_ID, "builtin/memory_card" ); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IItemRendering rendering ) { rendering.builtInModel( "models/item/builtin/memory_card", new MemoryCardModel() ); diff --git a/src/main/java/appeng/items/tools/ToolNetworkTool.java b/src/main/java/appeng/items/tools/ToolNetworkTool.java index bc8badf94..aad07ca32 100644 --- a/src/main/java/appeng/items/tools/ToolNetworkTool.java +++ b/src/main/java/appeng/items/tools/ToolNetworkTool.java @@ -20,23 +20,18 @@ package appeng.items.tools; import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -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.ActionResult; +import net.minecraft.util.Direction; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; 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.common.Optional.Interface; - -import cofh.api.item.IToolHammer; import appeng.api.implementations.guiobjects.IGuiItem; import appeng.api.implementations.guiobjects.IGuiItemObject; @@ -57,10 +52,7 @@ import appeng.items.contents.NetworkToolViewer; import appeng.util.Platform; -// TODO BC Integration -//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore ) -@Interface( iface = "cofh.api.item.IToolHammer", modid = "cofhcore" ) -public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, IToolHammer /* , IToolWrench */ +public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench { public ToolNetworkTool() @@ -77,7 +69,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity p, final Hand hand ) { if( Platform.isClient() ) { @@ -93,7 +85,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, } @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public EnumActionResult onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand ) { final RayTraceResult mop = new RayTraceResult( new Vec3d( hitX, hitY, hitZ ), side, pos ); final TileEntity te = world.getTileEntity( pos ); @@ -108,7 +100,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, { return EnumActionResult.FAIL; } - else if( player.isSneaking() ) + else if( player.isShiftKeyDown() ) { return EnumActionResult.PASS; } @@ -128,12 +120,12 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, } @Override - public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player ) + public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockReader world, final BlockPos pos, final PlayerEntity player ) { return true; } - public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, final EnumHand hand, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public boolean serverSideToolLogic( final ItemStack is, final PlayerEntity p, final Hand hand, final World w, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ ) { if( side != null ) { @@ -143,7 +135,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, } final Block b = w.getBlockState( pos ).getBlock(); - if( !p.isSneaking() ) + if( !p.isShiftKeyDown() ) { final TileEntity te = w.getTileEntity( pos ); if( !( te instanceof IGridHost ) ) @@ -157,7 +149,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, } } - if( !p.isSneaking() ) + if( !p.isShiftKeyDown() ) { if( p.openContainer instanceof AEBaseContainer ) { @@ -191,35 +183,8 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, } @Override - public boolean canWrench( final ItemStack wrench, final EntityPlayer player, final BlockPos pos ) + public boolean canWrench( final ItemStack wrench, final PlayerEntity player, final BlockPos pos ) { return true; } - - // IToolHammer - start - @Override - public boolean isUsable( ItemStack item, EntityLivingBase user, BlockPos pos ) - { - return true; - } - - @Override - public boolean isUsable( ItemStack item, EntityLivingBase user, Entity entity ) - { - return true; - } - - @Override - public void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos ) - { - } - - @Override - public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity ) - { - } - // IToolHammer - end - - // TODO: BC WRENCH INTEGRATION - } diff --git a/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java b/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java index df6efe057..90d910cc8 100644 --- a/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java +++ b/src/main/java/appeng/items/tools/powered/ToolChargedStaff.java @@ -19,7 +19,7 @@ package appeng.items.tools.powered; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; import net.minecraft.util.math.AxisAlignedBB; @@ -41,7 +41,7 @@ public class ToolChargedStaff extends AEBasePoweredItem } @Override - public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter ) + public boolean hitEntity( final ItemStack item, final LivingEntity target, final LivingEntity hitter ) { if( this.getAECurrentPower( item ) > 300 ) { diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java index 766eb9c4c..da5e27093 100644 --- a/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java +++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicator.java @@ -32,22 +32,22 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockColored; import net.minecraft.block.BlockStainedGlass; import net.minecraft.block.BlockStainedGlassPane; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.util.ITooltipFlag; -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.EnumDyeColor; import net.minecraft.item.ItemSnowball; 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.BlockPos; 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 net.minecraftforge.oredict.OreDictionary; @@ -90,7 +90,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe { for( final AEColor color : AEColor.VALID_COLORS ) { - final String dyeName = color.dye.getUnlocalizedName(); + final String dyeName = color.dye.getTranslationKey(); final String oreDictName = "dye" + WordUtils.capitalize( dyeName ); final int oreDictId = OreDictionary.getOreID( oreDictName ); @@ -104,13 +104,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe } @Override - public EnumActionResult onItemUse( EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ ) + public EnumActionResult onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ ) { return this.onItemUse( p.getHeldItem( hand ), p, w, pos, hand, side, hitX, hitY, hitZ ); } @Override - public EnumActionResult onItemUse( ItemStack is, EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ ) + public EnumActionResult onItemUse( ItemStack is, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ ) { final Block blk = w.getBlockState( pos ).getBlock(); @@ -185,7 +185,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe } } - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { this.cycleColors( is, paintBall, 1 ); } @@ -248,10 +248,10 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe public ItemStack getColor( final ItemStack is ) { - final NBTTagCompound c = is.getTagCompound(); + final CompoundNBT c = is.getTagCompound(); if( c != null && c.hasKey( "color" ) ) { - final NBTTagCompound color = c.getCompoundTag( "color" ); + final CompoundNBT color = c.getCompoundTag( "color" ); final ItemStack oldColor = new ItemStack( color ); if( !oldColor.isEmpty() ) { @@ -333,22 +333,22 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe private void setColor( final ItemStack is, final ItemStack newColor ) { - final NBTTagCompound data = Platform.openNbtData( is ); + final CompoundNBT data = Platform.openNbtData( is ); if( newColor.isEmpty() ) { data.removeTag( "color" ); } else { - final NBTTagCompound color = new NBTTagCompound(); + final CompoundNBT color = new CompoundNBT(); newColor.writeToNBT( color ); data.setTag( "color", color ); } } - private boolean recolourBlock( final Block blk, final EnumFacing side, final World w, final BlockPos pos, final EnumFacing orientation, final AEColor newColor, final EntityPlayer p ) + private boolean recolourBlock( final Block blk, final Direction side, final World w, final BlockPos pos, final Direction orientation, final AEColor newColor, final PlayerEntity p ) { - final IBlockState state = w.getBlockState( pos ); + final BlockState state = w.getBlockState( pos ); if( blk instanceof BlockColored ) { @@ -422,7 +422,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { super.addCheckedInformation( stack, world, lines, advancedTooltips ); diff --git a/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java b/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java index d3596e012..8bca871ee 100644 --- a/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java +++ b/src/main/java/appeng/items/tools/powered/ToolColorApplicatorRendering.java @@ -5,8 +5,8 @@ package appeng.items.tools.powered; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -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.util.AEColor; import appeng.bootstrap.IItemRendering; @@ -22,7 +22,7 @@ public class ToolColorApplicatorRendering extends ItemRenderingCustomizer private static final ModelResourceLocation MODEL_UNCOLORED = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "color_applicator_uncolored" ), "inventory" ); @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void customize( IItemRendering rendering ) { rendering.builtInModel( "models/item/builtin/color_applicator_colored", new ColorApplicatorModel() ); diff --git a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java index f45e151e6..5a2bc3261 100644 --- a/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java +++ b/src/main/java/appeng/items/tools/powered/ToolEntropyManipulator.java @@ -25,22 +25,20 @@ import java.util.List; import java.util.Map; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.BlockTNT; +import net.minecraft.block.Blocks; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.init.SoundEvents; -import net.minecraft.item.ItemBlock; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.util.ActionResult; -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.SoundCategory; +import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; @@ -90,10 +88,10 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT private static class InWorldToolOperationIngredient { - private final IBlockState state; + private final BlockState state; private final boolean blockOnly; - public InWorldToolOperationIngredient( final IBlockState state ) + public InWorldToolOperationIngredient( final BlockState state ) { this.state = state; this.blockOnly = false; @@ -127,7 +125,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT } } - private void heat( final IBlockState state, final World w, final BlockPos pos ) + private void heat( final BlockState state, final World w, final BlockPos pos ) { InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( state ) ); @@ -151,7 +149,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT } } - private boolean canHeat( final IBlockState state ) + private boolean canHeat( final BlockState state ) { InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( state ) ); @@ -163,7 +161,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT return r != null; } - private void cool( final IBlockState state, final World w, final BlockPos pos ) + private void cool( final BlockState state, final World w, final BlockPos pos ) { InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( state ) ); @@ -187,7 +185,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT } } - private boolean canCool( final IBlockState state ) + private boolean canCool( final BlockState state ) { InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( state ) ); @@ -200,7 +198,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT } @Override - public boolean hitEntity( final ItemStack item, final EntityLivingBase target, final EntityLivingBase hitter ) + public boolean hitEntity( final ItemStack item, final LivingEntity target, final LivingEntity hitter ) { if( this.getAECurrentPower( item ) > 1600 ) { @@ -212,7 +210,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity p, final Hand hand ) { final RayTraceResult target = this.rayTrace( w, p, true ); @@ -224,12 +222,12 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT { if( target.typeOfHit == RayTraceResult.Type.BLOCK ) { - final IBlockState state = w.getBlockState( target.getBlockPos() ); + final BlockState state = w.getBlockState( target.getBlockPos() ); if( state.getMaterial() == Material.LAVA || state.getMaterial() == Material.WATER ) { if( Platform.hasPermissions( new DimensionalCoord( w, target.getBlockPos() ), p ) ) { - this.onItemUse( p, w, target.getBlockPos(), hand, EnumFacing.UP, 0.0F, 0.0F, 0.0F ); + this.onItemUse( p, w, target.getBlockPos(), hand, Direction.UP, 0.0F, 0.0F, 0.0F ); } } } @@ -239,13 +237,13 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT } @Override - public EnumActionResult onItemUse( EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ ) + public EnumActionResult onItemUse( PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ ) { return this.onItemUse( p.getHeldItem( hand ), p, w, pos, hand, side, hitX, hitY, hitZ ); } @Override - public EnumActionResult onItemUse( ItemStack item, EntityPlayer p, World w, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ ) + public ActionResult onItemUse( ItemStack item, PlayerEntity p, World w, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ ) { if( this.getAECurrentPower( item ) > 1600 ) { @@ -254,10 +252,10 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT return EnumActionResult.FAIL; } - final IBlockState state = w.getBlockState( pos ); + final BlockState state = w.getBlockState( pos ); final Block blockID = state.getBlock(); - if( p.isSneaking() ) + if( p.isShiftKeyDown() ) { if( this.canCool( state ) ) { @@ -300,7 +298,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT if( !result.isEmpty() ) { - if( result.getItem() instanceof ItemBlock ) + if( result.getItem() instanceof BlockItem ) { if( Block.getBlockFromItem( result.getItem() ) == blockID && result.getItem().getDamage( result ) == blockID .getMetaFromState( state ) ) diff --git a/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java b/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java index 28cadf65b..bced9d510 100644 --- a/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java +++ b/src/main/java/appeng/items/tools/powered/ToolMatterCannon.java @@ -24,27 +24,27 @@ import java.util.List; import javax.annotation.Nullable; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.passive.EntitySheep; -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.ActionResult; import net.minecraft.util.DamageSource; +import net.minecraft.util.Direction; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; 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.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; @@ -86,7 +86,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< super( AEConfig.instance().getMatterCannonBattery() ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { @@ -102,7 +102,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer p, final @Nullable EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity p, final @Nullable Hand hand ) { if( this.getAECurrentPower( p.getHeldItem( hand ) ) > 1600 ) { @@ -190,7 +190,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< return new ActionResult<>( EnumActionResult.FAIL, p.getHeldItem( hand ) ); } - private void shootPaintBalls( final ItemStack type, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 ) + private void shootPaintBalls( final ItemStack type, final World w, final PlayerEntity p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 ) { final AxisAlignedBB bb = new AxisAlignedBB( Math.min( Vec3d.x, Vec3d1.x ), Math.min( Vec3d.y, Vec3d1.y ), Math.min( Vec3d.z, Vec3d1.z ), Math .max( Vec3d.x, Vec3d1.x ), Math.max( Vec3d.y, Vec3d1.y ), Math.max( Vec3d.z, Vec3d1.z ) ).grow( 16, 16, 16 ); @@ -203,9 +203,9 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< { final Entity entity1 = (Entity) list.get( l ); - if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) ) + if( !entity1.isAlive() && entity1 != p && !( entity1 instanceof ItemEntity ) ) { - if( entity1.isEntityAlive() ) + if( entity1.isAlive() ) { // prevent killing / flying of mounts. if( entity1.isRidingOrBeingRiddenBy( p ) ) @@ -279,7 +279,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< } else if( pos.typeOfHit == RayTraceResult.Type.BLOCK ) { - final EnumFacing side = pos.sideHit; + final Direction side = pos.sideHit; final BlockPos hitPos = pos.getBlockPos().offset( side ); if( !Platform.hasPermissions( new DimensionalCoord( w, hitPos ), p ) ) @@ -306,7 +306,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< } } - private void standardAmmo( float penetration, final World w, final EntityPlayer p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 ) + private void standardAmmo( float penetration, final World w, final PlayerEntity p, final Vec3d Vec3d, final Vec3d Vec3d1, final Vec3d direction, final double d0, final double d1, final double d2 ) { boolean hasDestroyed = true; while( penetration > 0 && hasDestroyed ) @@ -326,7 +326,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< if( !entity1.isDead && entity1 != p && !( entity1 instanceof EntityItem ) ) { - if( entity1.isEntityAlive() ) + if( entity1.isAlive() ) { // prevent killing / flying of mounts. if( entity1.isRidingOrBeingRiddenBy( p ) ) @@ -383,15 +383,15 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< if( pos.typeOfHit == RayTraceResult.Type.ENTITY ) { final int dmg = (int) Math.ceil( penetration / 20.0f ); - if( pos.entityHit instanceof EntityLivingBase ) + if( pos.entityHit instanceof LivingEntity ) { - final EntityLivingBase el = (EntityLivingBase) pos.entityHit; + final LivingEntity el = (LivingEntity) pos.entityHit; penetration -= dmg; el.knockBack( p, 0, -direction.x, -direction.z ); // el.knockBack( p, 0, Vec3d.x, // Vec3d.z ); el.attackEntityFrom( dmgSrc, dmg ); - if( !el.isEntityAlive() ) + if( !el.isAlive() ) { hasDestroyed = true; } @@ -414,7 +414,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell< } else { - final IBlockState bs = w.getBlockState( pos.getBlockPos() ); + final BlockState bs = w.getBlockState( pos.getBlockPos() ); // int meta = w.getBlockMetadata( // pos.blockX, pos.blockY, pos.blockZ ); diff --git a/src/main/java/appeng/items/tools/powered/ToolPortableCell.java b/src/main/java/appeng/items/tools/powered/ToolPortableCell.java index 1adbe42ef..3b530c89b 100644 --- a/src/main/java/appeng/items/tools/powered/ToolPortableCell.java +++ b/src/main/java/appeng/items/tools/powered/ToolPortableCell.java @@ -23,15 +23,15 @@ import java.util.List; import java.util.Set; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; 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; @@ -63,13 +63,13 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell< } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity player, final Hand hand ) { Platform.openGUI( player, null, AEPartLocation.INTERNAL, GuiBridge.GUI_PORTABLE_CELL ); return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public boolean isFull3D() { @@ -77,7 +77,7 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell< } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { super.addCheckedInformation( stack, world, lines, advancedTooltips ); diff --git a/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java b/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java index 062ef6961..e3ec56b1d 100644 --- a/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java +++ b/src/main/java/appeng/items/tools/powered/ToolWirelessTerminal.java @@ -22,16 +22,16 @@ package appeng.items.tools.powered; import java.util.List; import net.minecraft.client.util.ITooltipFlag; -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.ActionResult; import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.text.translation.I18n; 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.AEApi; import appeng.api.config.Actionable; @@ -57,13 +57,13 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer player, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity player, final Hand hand ) { AEApi.instance().registries().wireless().openWirelessTerminalGui( player.getHeldItem( hand ), w, player ); return new ActionResult<>( EnumActionResult.SUCCESS, player.getHeldItem( hand ) ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public boolean isFull3D() { @@ -71,14 +71,14 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { super.addCheckedInformation( stack, world, lines, advancedTooltips ); if( stack.hasTagCompound() ) { - final NBTTagCompound tag = Platform.openNbtData( stack ); + final CompoundNBT tag = Platform.openNbtData( stack ); if( tag != null ) { final String encKey = tag.getString( "encryptionKey" ); @@ -106,13 +106,13 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless } @Override - public boolean usePower( final EntityPlayer player, final double amount, final ItemStack is ) + public boolean usePower( final PlayerEntity player, final double amount, final ItemStack is ) { return this.extractAEPower( is, amount, Actionable.MODULATE ) >= amount - 0.5; } @Override - public boolean hasPower( final EntityPlayer player, final double amt, final ItemStack is ) + public boolean hasPower( final PlayerEntity player, final double amt, final ItemStack is ) { return this.getAECurrentPower( is ) >= amt; } @@ -122,7 +122,7 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless { final ConfigManager out = new ConfigManager( ( manager, settingName, newValue ) -> { - final NBTTagCompound data = Platform.openNbtData( target ); + final CompoundNBT data = Platform.openNbtData( target ); manager.writeToNBT( data ); } ); @@ -137,14 +137,14 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless @Override public String getEncryptionKey( final ItemStack item ) { - final NBTTagCompound tag = Platform.openNbtData( item ); + final CompoundNBT tag = Platform.openNbtData( item ); return tag.getString( "encryptionKey" ); } @Override public void setEncryptionKey( final ItemStack item, final String encKey, final String name ) { - final NBTTagCompound tag = Platform.openNbtData( item ); + final CompoundNBT tag = Platform.openNbtData( item ); tag.setString( "encryptionKey", encKey ); tag.setString( "name", name ); } diff --git a/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java b/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java index 0283eb1cb..37fc50b8b 100644 --- a/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java +++ b/src/main/java/appeng/items/tools/powered/powersink/AEBasePoweredItem.java @@ -25,12 +25,12 @@ import java.util.List; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; -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.config.AccessRestriction; import appeng.api.config.Actionable; @@ -57,11 +57,11 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow this.powerCapacity = powerCapacity; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) @Override public void addCheckedInformation( final ItemStack stack, final World world, final List lines, final ITooltipFlag advancedTooltips ) { - final NBTTagCompound tag = stack.getTagCompound(); + final CompoundNBT tag = stack.getTagCompound(); double internalCurrentPower = 0; final double internalMaxPower = this.getAEMaxPower( stack ); @@ -88,7 +88,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow super.getCheckedSubItems( creativeTab, itemStacks ); final ItemStack charged = new ItemStack( this, 1 ); - final NBTTagCompound tag = Platform.openNbtData( charged ); + final CompoundNBT tag = Platform.openNbtData( charged ); tag.setDouble( CURRENT_POWER_NBT_KEY, this.getAEMaxPower( charged ) ); tag.setDouble( MAX_POWER_NBT_KEY, this.getAEMaxPower( charged ) ); @@ -129,7 +129,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow if( mode == Actionable.MODULATE ) { - final NBTTagCompound data = Platform.openNbtData( is ); + final CompoundNBT data = Platform.openNbtData( is ); final double toAdd = Math.min( amount, required ); data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage + toAdd ); @@ -146,7 +146,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow if( mode == Actionable.MODULATE ) { - final NBTTagCompound data = Platform.openNbtData( is ); + final CompoundNBT data = Platform.openNbtData( is ); data.setDouble( CURRENT_POWER_NBT_KEY, currentStorage - fulfillable ); } @@ -163,7 +163,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow @Override public double getAECurrentPower( final ItemStack is ) { - final NBTTagCompound data = Platform.openNbtData( is ); + final CompoundNBT data = Platform.openNbtData( is ); return data.getDouble( CURRENT_POWER_NBT_KEY ); } @@ -175,7 +175,7 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow } @Override - public ICapabilityProvider initCapabilities( ItemStack stack, NBTTagCompound nbt ) + public ICapabilityProvider initCapabilities( ItemStack stack, CompoundNBT nbt ) { return new PoweredItemCapabilities( stack, this ); } diff --git a/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java b/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java index c28f0738c..31ace0fa3 100644 --- a/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java +++ b/src/main/java/appeng/items/tools/powered/powersink/PoweredItemCapabilities.java @@ -24,7 +24,7 @@ import javax.annotation.Nullable; import net.darkhax.tesla.api.ITeslaConsumer; import net.darkhax.tesla.api.ITeslaHolder; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.energy.IEnergyStorage; @@ -62,14 +62,14 @@ class PoweredItemCapabilities implements ICapabilityProvider, IEnergyStorage } @Override - public boolean hasCapability( Capability capability, @Nullable EnumFacing facing ) + public boolean hasCapability( Capability capability, @Nullable Direction facing ) { return capability == Capabilities.FORGE_ENERGY || capability == Capabilities.TESLA_CONSUMER || capability == Capabilities.TESLA_HOLDER; } @SuppressWarnings( "unchecked" ) @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { if( capability == Capabilities.FORGE_ENERGY ) { diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzAxe.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzAxe.java index 0438e4d23..808d84bba 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzAxe.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzAxe.java @@ -19,20 +19,23 @@ package appeng.items.tools.quartz; -import net.minecraft.item.ItemAxe; +import net.minecraft.item.AxeItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTier; import appeng.core.features.AEFeature; import appeng.util.Platform; -public class ToolQuartzAxe extends ItemAxe +public class ToolQuartzAxe extends AxeItem { private final AEFeature type; public ToolQuartzAxe( final AEFeature type ) { - super( ToolMaterial.IRON ); + super( ItemTier.IRON, 6.0F, -3.1F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) ); this.type = type; } diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java index 0fd8fb449..69682e82e 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzCuttingKnife.java @@ -19,12 +19,12 @@ package appeng.items.tools.quartz; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; 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.BlockPos; import net.minecraft.world.World; @@ -50,7 +50,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem } @Override - public EnumActionResult onItemUse( final EntityPlayer p, final World worldIn, final BlockPos pos, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ ) + public EnumActionResult onItemUse( final PlayerEntity p, final World worldIn, final BlockPos pos, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ ) { if( Platform.isServer() ) { @@ -60,7 +60,7 @@ public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem } @Override - public ActionResult onItemRightClick( final World w, final EntityPlayer p, final EnumHand hand ) + public ActionResult onItemRightClick( final World w, final PlayerEntity p, final Hand hand ) { if( Platform.isServer() ) { diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzHoe.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzHoe.java index c1376824a..4f9d589e5 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzHoe.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzHoe.java @@ -19,20 +19,23 @@ package appeng.items.tools.quartz; -import net.minecraft.item.ItemHoe; +import net.minecraft.item.HoeItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTier; import appeng.core.features.AEFeature; import appeng.util.Platform; -public class ToolQuartzHoe extends ItemHoe +public class ToolQuartzHoe extends HoeItem { private final AEFeature type; public ToolQuartzHoe( final AEFeature type ) { - super( ToolMaterial.IRON ); + super( ItemTier.IRON, -1.0F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) ); this.type = type; } diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzPickaxe.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzPickaxe.java index 3b5bfbf6e..5723a8529 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzPickaxe.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzPickaxe.java @@ -19,20 +19,23 @@ package appeng.items.tools.quartz; -import net.minecraft.item.ItemPickaxe; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTier; +import net.minecraft.item.PickaxeItem; import appeng.core.features.AEFeature; import appeng.util.Platform; -public class ToolQuartzPickaxe extends ItemPickaxe +public class ToolQuartzPickaxe extends PickaxeItem { private final AEFeature type; public ToolQuartzPickaxe( final AEFeature type ) { - super( ToolMaterial.IRON ); + super( ItemTier.IRON, 1, -2.8F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) ); this.type = type; } diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzSpade.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzSpade.java index ffcb6ec18..22dc153a0 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzSpade.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzSpade.java @@ -19,20 +19,23 @@ package appeng.items.tools.quartz; -import net.minecraft.item.ItemSpade; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemTier; +import net.minecraft.item.ShovelItem; import appeng.core.features.AEFeature; import appeng.util.Platform; -public class ToolQuartzSpade extends ItemSpade +public class ToolQuartzSpade extends ShovelItem { private final AEFeature type; public ToolQuartzSpade( final AEFeature type ) { - super( ToolMaterial.IRON ); + super( ItemTier.IRON, 1.5F, -3.0F, ( new Item.Properties() ).group( ItemGroup.TOOLS ) ); this.type = type; } diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzSword.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzSword.java index 6cd0901e6..6774f011b 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzSword.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzSword.java @@ -19,20 +19,23 @@ package appeng.items.tools.quartz; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; +import net.minecraft.item.ItemTier; +import net.minecraft.item.SwordItem; import appeng.core.features.AEFeature; import appeng.util.Platform; -public class ToolQuartzSword extends ItemSword +public class ToolQuartzSword extends SwordItem { private final AEFeature type; public ToolQuartzSword( AEFeature type ) { - super( ToolMaterial.IRON ); + super( ItemTier.IRON, 3, -2.4F, ( new Item.Properties() ).group( ItemGroup.COMBAT ) ); this.type = type; } diff --git a/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java b/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java index 8e28002ed..ec7ac701f 100644 --- a/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java +++ b/src/main/java/appeng/items/tools/quartz/ToolQuartzWrench.java @@ -20,19 +20,12 @@ package appeng.items.tools.quartz; import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.item.ItemUseContext; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.Optional.Interface; - -import cofh.api.item.IToolHammer; import appeng.api.implementations.items.IAEWrench; import appeng.api.util.DimensionalCoord; @@ -40,88 +33,40 @@ import appeng.items.AEBaseItem; import appeng.util.Platform; -// TODO BC Integration -//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore ) -@Interface( iface = "cofh.api.item.IToolHammer", modid = "cofhcore" ) -public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolHammer /* , IToolWrench */ +public class ToolQuartzWrench extends AEBaseItem implements IAEWrench { public ToolQuartzWrench() { - this.setMaxStackSize( 1 ); - this.setHarvestLevel( "wrench", 0 ); + super( new Properties().maxStackSize( 1 ) ); } @Override - public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand ) + public ActionResultType onItemUse( ItemUseContext context ) { - final Block b = world.getBlockState( pos ).getBlock(); - if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) ) + final Block b = context.getWorld().getBlockState( context.getPos() ).getBlock(); + if( b != null && !context.getPlayer().isShiftKeyDown() && Platform.hasPermissions( new DimensionalCoord( context.getWorld(), context.getPos() ), + context.getPlayer() ) ) { if( Platform.isClient() ) { // TODO 1.10-R - if we return FAIL on client, action will not be sent to server. Fix that in all // Block#onItemUseFirst overrides. - return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.PASS; + return !context.getWorld().isRemote ? ActionResultType.SUCCESS : ActionResultType.PASS; } - if( b.rotateBlock( world, pos, side ) ) + if( b.rotate( context.getWorld().getBlockState( context.getPos() ), context.getWorld(), context.getPos(), Rotation.CLOCKWISE_90 ) != null ) { - player.swingArm( hand ); - return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; + context.getPlayer().swingArm( context.getHand() ); + return !context.getWorld().isRemote ? ActionResultType.SUCCESS : ActionResultType.FAIL; } } - return EnumActionResult.PASS; + return ActionResultType.PASS; } @Override - public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player ) + public boolean canWrench( final ItemStack wrench, final PlayerEntity player, final BlockPos pos ) { return true; } - - @Override - public boolean canWrench( final ItemStack wrench, final EntityPlayer player, final BlockPos pos ) - { - return true; - } - - // IToolHammer - start - @Override - public boolean isUsable( ItemStack item, EntityLivingBase user, BlockPos pos ) - { - return true; - } - - @Override - public boolean isUsable( ItemStack item, EntityLivingBase user, Entity entity ) - { - return true; - } - - @Override - public void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos ) - { - } - - @Override - public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity ) - { - } - - // IToolHammer - end - - // TODO: BC Wrench Integration - /* - * @Override - * public boolean canWrench( EntityPlayer player, int x, int y, int z ) - * { - * return true; - * } - * @Override - * public void wrenchUsed( EntityPlayer player, int x, int y, int z ) - * { - * player.swingItem(); - * } - */ } diff --git a/src/main/java/appeng/loot/ChestLoot.java b/src/main/java/appeng/loot/ChestLoot.java deleted file mode 100644 index f7422cf02..000000000 --- a/src/main/java/appeng/loot/ChestLoot.java +++ /dev/null @@ -1,71 +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 . - */ - -package appeng.loot; - - -import net.minecraft.world.storage.loot.LootEntry; -import net.minecraft.world.storage.loot.LootEntryItem; -import net.minecraft.world.storage.loot.LootPool; -import net.minecraft.world.storage.loot.LootTableList; -import net.minecraft.world.storage.loot.RandomValueRange; -import net.minecraft.world.storage.loot.conditions.LootCondition; -import net.minecraft.world.storage.loot.conditions.RandomChance; -import net.minecraft.world.storage.loot.functions.LootFunction; -import net.minecraft.world.storage.loot.functions.SetMetadata; -import net.minecraftforge.event.LootTableLoadEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; - -import appeng.api.AEApi; -import appeng.api.definitions.IMaterials; - - -public class ChestLoot -{ - - @SubscribeEvent - public void loadLootTable( LootTableLoadEvent event ) - { - if( event.getName() == LootTableList.CHESTS_ABANDONED_MINESHAFT ) - { - // TODO 1.9.4 aftermath - All these loot quality, pools and stuff. Figure it out and balance it. - final IMaterials materials = AEApi.instance().definitions().materials(); - materials.certusQuartzCrystal().maybeStack( 1 ).ifPresent( is -> - { - event.getTable() - .addPool( new LootPool( new LootEntry[] { - new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { - new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { - new RandomChance( 1 ) }, "AE2 Crystal_" + is.getItemDamage() ) - }, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 Crystals" ) ); - } ); - - materials.certusQuartzDust().maybeStack( 1 ).ifPresent( is -> - { - event.getTable() - .addPool( new LootPool( new LootEntryItem[] { - new LootEntryItem( is.getItem(), 2, 3, new LootFunction[] { - new SetMetadata( null, new RandomValueRange( is.getItemDamage() ) ) }, new LootCondition[] { - new RandomChance( 1 ) }, "AE2 Dust_" + is.getItemDamage() ) - }, new LootCondition[0], new RandomValueRange( 1, 4 ), new RandomValueRange( 0, 2 ), "AE2 DUSTS" ) ); - } ); - - } - } - -} \ No newline at end of file diff --git a/src/main/java/appeng/me/GridNode.java b/src/main/java/appeng/me/GridNode.java index 6dc863a48..096c6bd2c 100644 --- a/src/main/java/appeng/me/GridNode.java +++ b/src/main/java/appeng/me/GridNode.java @@ -27,9 +27,9 @@ import java.util.Deque; import java.util.EnumSet; import java.util.List; -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.World; @@ -214,7 +214,7 @@ public class GridNode implements IGridNode, IPathItem this.compressedData |= ( this.gridProxy.getGridColor().ordinal() << 3 ); - for( final EnumFacing dir : this.gridProxy.getConnectableSides() ) + for( final Direction dir : this.gridProxy.getConnectableSides() ) { this.compressedData |= ( 1 << ( dir.ordinal() + 8 ) ); } @@ -327,11 +327,11 @@ public class GridNode implements IGridNode, IPathItem } @Override - public void loadFromNBT( final String name, final NBTTagCompound nodeData ) + public void loadFromNBT( final String name, final CompoundNBT nodeData ) { if( this.myGrid == null ) { - final NBTTagCompound node = nodeData.getCompoundTag( name ); + final CompoundNBT node = nodeData.getCompoundTag( name ); this.playerID = node.getInteger( "p" ); this.setLastSecurityKey( node.getLong( "k" ) ); @@ -346,11 +346,11 @@ public class GridNode implements IGridNode, IPathItem } @Override - public void saveToNBT( final String name, final NBTTagCompound nodeData ) + public void saveToNBT( final String name, final CompoundNBT nodeData ) { if( this.myStorage != null ) { - final NBTTagCompound node = new NBTTagCompound(); + final CompoundNBT node = new CompoundNBT(); node.setInteger( "p", this.playerID ); node.setLong( "k", this.getLastSecurityKey() ); diff --git a/src/main/java/appeng/me/GridStorage.java b/src/main/java/appeng/me/GridStorage.java index 65b91e41e..48de36ead 100644 --- a/src/main/java/appeng/me/GridStorage.java +++ b/src/main/java/appeng/me/GridStorage.java @@ -26,7 +26,7 @@ import java.lang.ref.WeakReference; import java.util.WeakHashMap; import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.networking.IGrid; import appeng.api.networking.IGridStorage; @@ -38,7 +38,7 @@ public class GridStorage implements IGridStorage { private final long myID; - private final NBTTagCompound data; + private final CompoundNBT data; private final GridStorageSearch mySearchEntry; // keep myself in the list until I'm private final WeakHashMap divided = new WeakHashMap<>(); private WeakReference internalGrid = null; @@ -55,7 +55,7 @@ public class GridStorage implements IGridStorage { this.myID = id; this.mySearchEntry = gss; - this.data = new NBTTagCompound(); + this.data = new CompoundNBT(); } /** @@ -69,7 +69,7 @@ public class GridStorage implements IGridStorage { this.myID = id; this.mySearchEntry = gss; - NBTTagCompound myTag = null; + CompoundNBT myTag = null; try { @@ -78,7 +78,7 @@ public class GridStorage implements IGridStorage } catch( final Throwable t ) { - myTag = new NBTTagCompound(); + myTag = new CompoundNBT(); } this.data = myTag; @@ -91,7 +91,7 @@ public class GridStorage implements IGridStorage { this.myID = 0; this.mySearchEntry = null; - this.data = new NBTTagCompound(); + this.data = new CompoundNBT(); } public String getValue() @@ -127,7 +127,7 @@ public class GridStorage implements IGridStorage } @Override - public NBTTagCompound dataObject() + public CompoundNBT dataObject() { return this.data; } diff --git a/src/main/java/appeng/me/cache/PathGridCache.java b/src/main/java/appeng/me/cache/PathGridCache.java index 0ee8faff0..224a9eb07 100644 --- a/src/main/java/appeng/me/cache/PathGridCache.java +++ b/src/main/java/appeng/me/cache/PathGridCache.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import appeng.api.AEApi; import appeng.api.networking.GridFlags; @@ -351,10 +351,10 @@ public class PathGridCache implements IPathingGrid { for( final IGridNode n : this.requireChannels ) { - EntityPlayer player = AEApi.instance().registries().players().findPlayer( n.getPlayerID() ); - if( player instanceof EntityPlayerMP ) + PlayerEntity player = AEApi.instance().registries().players().findPlayer( n.getPlayerID() ); + if( player instanceof PlayerEntityMP ) { - currentBracket.trigger( (EntityPlayerMP) player ); + currentBracket.trigger( (PlayerEntityMP) player ); } } } diff --git a/src/main/java/appeng/me/cache/SecurityCache.java b/src/main/java/appeng/me/cache/SecurityCache.java index 529f90528..d946b5072 100644 --- a/src/main/java/appeng/me/cache/SecurityCache.java +++ b/src/main/java/appeng/me/cache/SecurityCache.java @@ -27,7 +27,7 @@ import java.util.List; import com.google.common.base.Preconditions; import com.mojang.authlib.GameProfile; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.api.config.SecurityPermissions; import appeng.api.networking.IGrid; @@ -150,7 +150,7 @@ public class SecurityCache implements ISecurityGrid } @Override - public boolean hasPermission( final EntityPlayer player, final SecurityPermissions perm ) + public boolean hasPermission( final PlayerEntity player, final SecurityPermissions perm ) { Preconditions.checkNotNull( player ); Preconditions.checkNotNull( perm ); diff --git a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java index b9c2d5288..4871974a1 100644 --- a/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java +++ b/src/main/java/appeng/me/cluster/implementations/CraftingCPUCluster.java @@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableList; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -1007,9 +1007,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU Character.MAX_RADIX ); } - private NBTTagCompound generateLinkData( final String craftingID, final boolean standalone, final boolean req ) + private CompoundNBT generateLinkData( final String craftingID, final boolean standalone, final boolean req ) { - final NBTTagCompound tag = new NBTTagCompound(); + final CompoundNBT tag = new CompoundNBT(); tag.setString( "CraftID", craftingID ); tag.setBoolean( "canceled", false ); @@ -1142,7 +1142,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU return is; } - public void writeToNBT( final NBTTagCompound data ) + public void writeToNBT( final CompoundNBT data ) { data.setTag( "finalOutput", this.writeItem( this.finalOutput ) ); data.setTag( "inventory", this.writeList( this.inventory.getItemList() ) ); @@ -1151,7 +1151,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU if( this.myLastLink != null ) { - final NBTTagCompound link = new NBTTagCompound(); + final CompoundNBT link = new CompoundNBT(); this.myLastLink.writeToNBT( link ); data.setTag( "link", link ); } @@ -1159,7 +1159,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU final NBTTagList list = new NBTTagList(); for( final Entry e : this.tasks.entrySet() ) { - final NBTTagCompound item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) ); + final CompoundNBT item = this.writeItem( AEItemStack.fromItemStack( e.getKey().getPattern() ) ); item.setLong( "craftingProgress", e.getValue().value ); list.appendTag( item ); } @@ -1172,9 +1172,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU data.setLong( "remainingItemCount", this.getRemainingItemCount() ); } - private NBTTagCompound writeItem( final IAEItemStack finalOutput2 ) + private CompoundNBT writeItem( final IAEItemStack finalOutput2 ) { - final NBTTagCompound out = new NBTTagCompound(); + final CompoundNBT out = new CompoundNBT(); if( finalOutput2 != null ) { @@ -1212,9 +1212,9 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU this.updateName(); } - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { - this.finalOutput = AEItemStack.fromNBT( (NBTTagCompound) data.getTag( "finalOutput" ) ); + this.finalOutput = AEItemStack.fromNBT( (CompoundNBT) data.getTag( "finalOutput" ) ); for( final IAEItemStack ais : this.readList( (NBTTagList) data.getTag( "inventory" ) ) ) { this.inventory.injectItems( ais, Actionable.MODULATE, this.machineSrc ); @@ -1225,7 +1225,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU if( data.hasKey( "link" ) ) { - final NBTTagCompound link = data.getCompoundTag( "link" ); + final CompoundNBT link = data.getCompoundTag( "link" ); this.myLastLink = new CraftingLink( link, this ); this.submitLink( this.myLastLink ); } @@ -1233,7 +1233,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU final NBTTagList list = data.getTagList( "tasks", 10 ); for( int x = 0; x < list.tagCount(); x++ ) { - final NBTTagCompound item = list.getCompoundTagAt( x ); + final CompoundNBT item = list.getCompoundTagAt( x ); final IAEItemStack pattern = AEItemStack.fromNBT( item ); if( pattern != null && pattern.getItem() instanceof ICraftingPatternItem ) { diff --git a/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java b/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java index c8f28ce09..e40e13b1e 100644 --- a/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java +++ b/src/main/java/appeng/me/cluster/implementations/QuantumCalculator.java @@ -21,7 +21,7 @@ package appeng.me.cluster.implementations; 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.AEApi; @@ -162,7 +162,7 @@ public class QuantumCalculator extends MBCalculator return te instanceof TileQuantumBridge; } - private boolean isBlockAtLocation( final IBlockAccess w, final BlockPos pos, final IBlockDefinition def ) + private boolean isBlockAtLocation( final IBlockReader w, final BlockPos pos, final IBlockDefinition def ) { return def.maybeBlock().map( block -> block == w.getBlockState( pos ).getBlock() ).orElse( false ); } diff --git a/src/main/java/appeng/me/helpers/AENetworkProxy.java b/src/main/java/appeng/me/helpers/AENetworkProxy.java index f6f5215a1..d722a9fe7 100644 --- a/src/main/java/appeng/me/helpers/AENetworkProxy.java +++ b/src/main/java/appeng/me/helpers/AENetworkProxy.java @@ -24,10 +24,10 @@ import java.util.EnumSet; import com.mojang.authlib.GameProfile; -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.networking.GridFlags; @@ -62,14 +62,14 @@ public class AENetworkProxy implements IGridBlock private final boolean worldNode; private final String nbtName; // name private AEColor myColor = AEColor.TRANSPARENT; - private NBTTagCompound data = null; // input + private CompoundNBT data = null; // input private ItemStack myRepInstance = ItemStack.EMPTY; private boolean isReady = false; private IGridNode node = null; - private EnumSet validSides; + private EnumSet validSides; private EnumSet flags = EnumSet.noneOf( GridFlags.class ); private double idleDraw = 1.0; - private EntityPlayer owner; + private PlayerEntity owner; public AENetworkProxy( final IGridProxyable te, final String nbtName, final ItemStack visual, final boolean inWorld ) { @@ -77,7 +77,7 @@ public class AENetworkProxy implements IGridBlock this.nbtName = nbtName; this.worldNode = inWorld; this.myRepInstance = visual; - this.validSides = EnumSet.allOf( EnumFacing.class ); + this.validSides = EnumSet.allOf( Direction.class ); } public void setVisualRepresentation( final ItemStack is ) @@ -85,7 +85,7 @@ public class AENetworkProxy implements IGridBlock this.myRepInstance = is; } - public void writeToNBT( final NBTTagCompound tag ) + public void writeToNBT( final CompoundNBT tag ) { if( this.node != null ) { @@ -93,7 +93,7 @@ public class AENetworkProxy implements IGridBlock } } - public void setValidSides( final EnumSet validSides ) + public void setValidSides( final EnumSet validSides ) { this.validSides = validSides; if( this.node != null ) @@ -155,7 +155,7 @@ public class AENetworkProxy implements IGridBlock return this.node; } - public void readFromNBT( final NBTTagCompound tag ) + public void readFromNBT( final CompoundNBT tag ) { this.data = tag; if( this.node != null && this.data != null ) @@ -342,7 +342,7 @@ public class AENetworkProxy implements IGridBlock } @Override - public EnumSet getConnectableSides() + public EnumSet getConnectableSides() { return this.validSides; } @@ -434,7 +434,7 @@ public class AENetworkProxy implements IGridBlock return eg; } - public void setOwner( final EntityPlayer player ) + public void setOwner( final PlayerEntity player ) { this.owner = player; } diff --git a/src/main/java/appeng/me/helpers/BaseActionSource.java b/src/main/java/appeng/me/helpers/BaseActionSource.java index 4c7ded5b2..07b11ede3 100644 --- a/src/main/java/appeng/me/helpers/BaseActionSource.java +++ b/src/main/java/appeng/me/helpers/BaseActionSource.java @@ -21,7 +21,7 @@ package appeng.me.helpers; import java.util.Optional; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.api.networking.security.IActionHost; import appeng.api.networking.security.IActionSource; @@ -31,7 +31,7 @@ public class BaseActionSource implements IActionSource { @Override - public Optional player() + public Optional player() { return Optional.empty(); } diff --git a/src/main/java/appeng/me/helpers/MachineSource.java b/src/main/java/appeng/me/helpers/MachineSource.java index 27bc9c384..2b4270d9b 100644 --- a/src/main/java/appeng/me/helpers/MachineSource.java +++ b/src/main/java/appeng/me/helpers/MachineSource.java @@ -21,7 +21,7 @@ package appeng.me.helpers; import java.util.Optional; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.api.networking.security.IActionHost; import appeng.api.networking.security.IActionSource; @@ -38,7 +38,7 @@ public class MachineSource implements IActionSource } @Override - public Optional player() + public Optional player() { return Optional.empty(); } diff --git a/src/main/java/appeng/me/helpers/PlayerSource.java b/src/main/java/appeng/me/helpers/PlayerSource.java index 2024d56f7..c8bb9b048 100644 --- a/src/main/java/appeng/me/helpers/PlayerSource.java +++ b/src/main/java/appeng/me/helpers/PlayerSource.java @@ -23,7 +23,7 @@ import java.util.Optional; import com.google.common.base.Preconditions; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import appeng.api.networking.security.IActionHost; import appeng.api.networking.security.IActionSource; @@ -32,10 +32,10 @@ import appeng.api.networking.security.IActionSource; public class PlayerSource implements IActionSource { - private final EntityPlayer player; + private final PlayerEntity player; private final IActionHost via; - public PlayerSource( final EntityPlayer p, final IActionHost v ) + public PlayerSource( final PlayerEntity p, final IActionHost v ) { Preconditions.checkNotNull( p ); this.player = p; @@ -43,7 +43,7 @@ public class PlayerSource implements IActionSource } @Override - public Optional player() + public Optional player() { return Optional.of( this.player ); } diff --git a/src/main/java/appeng/me/storage/AbstractCellInventory.java b/src/main/java/appeng/me/storage/AbstractCellInventory.java index 27ca71d3f..3d4a2cb69 100644 --- a/src/main/java/appeng/me/storage/AbstractCellInventory.java +++ b/src/main/java/appeng/me/storage/AbstractCellInventory.java @@ -20,7 +20,7 @@ package appeng.me.storage; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.IItemHandler; import appeng.api.config.FuzzyMode; @@ -50,7 +50,7 @@ public abstract class AbstractCellInventory> implements IC protected static final String ITEM_PRE_FORMATTED_FUZZY = "FP"; private static final String[] ITEM_SLOT_KEYS = new String[MAX_ITEM_TYPES]; private static final String[] ITEM_SLOT_COUNT_KEYS = new String[MAX_ITEM_TYPES]; - private final NBTTagCompound tagCompound; + private final CompoundNBT tagCompound; protected final ISaveProvider container; private int maxItemTypes = MAX_ITEM_TYPES; private short storedItems = 0; @@ -120,7 +120,7 @@ public abstract class AbstractCellInventory> implements IC { itemCount += v.getStackSize(); - final NBTTagCompound g = new NBTTagCompound(); + final CompoundNBT g = new CompoundNBT(); v.writeToNBT( g ); this.tagCompound.setTag( ITEM_SLOT_KEYS[x], g ); this.tagCompound.setInteger( ITEM_SLOT_COUNT_KEYS[x], (int) v.getStackSize() ); @@ -196,7 +196,7 @@ public abstract class AbstractCellInventory> implements IC for( int slot = 0; slot < types; slot++ ) { - NBTTagCompound compoundTag = this.tagCompound.getCompoundTag( ITEM_SLOT_KEYS[slot] ); + CompoundNBT compoundTag = this.tagCompound.getCompoundTag( ITEM_SLOT_KEYS[slot] ); int stackSize = this.tagCompound.getInteger( ITEM_SLOT_COUNT_KEYS[slot] ); needsUpdate |= !this.loadCellItem( compoundTag, stackSize ); } @@ -214,7 +214,7 @@ public abstract class AbstractCellInventory> implements IC * @param stackSize * @return true when successfully loaded */ - protected abstract boolean loadCellItem( NBTTagCompound compoundTag, int stackSize ); + protected abstract boolean loadCellItem( CompoundNBT compoundTag, int stackSize ); @Override public IItemList getAvailableItems( final IItemList out ) diff --git a/src/main/java/appeng/me/storage/BasicCellInventory.java b/src/main/java/appeng/me/storage/BasicCellInventory.java index 15cdff2d4..e5c6f7bc0 100644 --- a/src/main/java/appeng/me/storage/BasicCellInventory.java +++ b/src/main/java/appeng/me/storage/BasicCellInventory.java @@ -4,7 +4,7 @@ package appeng.me.storage; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.config.Actionable; import appeng.api.exceptions.AppEngException; @@ -253,7 +253,7 @@ public class BasicCellInventory> extends AbstractCellInven } @Override - protected boolean loadCellItem( NBTTagCompound compoundTag, int stackSize ) + protected boolean loadCellItem( CompoundNBT compoundTag, int stackSize ) { // Now load the item stack final T t; diff --git a/src/main/java/appeng/me/storage/BasicCellInventoryHandler.java b/src/main/java/appeng/me/storage/BasicCellInventoryHandler.java index 5a0bce287..593a810da 100644 --- a/src/main/java/appeng/me/storage/BasicCellInventoryHandler.java +++ b/src/main/java/appeng/me/storage/BasicCellInventoryHandler.java @@ -20,7 +20,7 @@ package appeng.me.storage; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.IItemHandler; import appeng.api.config.FuzzyMode; @@ -143,7 +143,7 @@ public class BasicCellInventoryHandler> extends MEInventor return this.getWhitelist(); } - NBTTagCompound openNbtData() + CompoundNBT openNbtData() { return Platform.openNbtData( this.getCellInv().getItemStack() ); } diff --git a/src/main/java/appeng/me/storage/MEMonitorIInventory.java b/src/main/java/appeng/me/storage/MEMonitorIInventory.java index 50f4a1b2b..8b58eca4d 100644 --- a/src/main/java/appeng/me/storage/MEMonitorIInventory.java +++ b/src/main/java/appeng/me/storage/MEMonitorIInventory.java @@ -247,7 +247,7 @@ public class MEMonitorIInventory implements IMEMonitor, ITickingMo private void postDifference( final Iterable a ) { - // AELog.info( a.getItemStack().getUnlocalizedName() + " @ " + a.getStackSize() ); + // AELog.info( a.getItemStack().getTranslationKey() + " @ " + a.getStackSize() ); if( a != null ) { final Iterator, Object>> i = this.listeners.entrySet().iterator(); diff --git a/src/main/java/appeng/parts/AEBasePart.java b/src/main/java/appeng/parts/AEBasePart.java index 51f6841a9..989dffd52 100644 --- a/src/main/java/appeng/parts/AEBasePart.java +++ b/src/main/java/appeng/parts/AEBasePart.java @@ -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 ); } diff --git a/src/main/java/appeng/parts/BusCollisionHelper.java b/src/main/java/appeng/parts/BusCollisionHelper.java index c6f138070..1a314b86d 100644 --- a/src/main/java/appeng/parts/BusCollisionHelper.java +++ b/src/main/java/appeng/parts/BusCollisionHelper.java @@ -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 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 boxes, final EnumFacing x, final EnumFacing y, final EnumFacing z, final Entity e, final boolean visual ) + public BusCollisionHelper( final List 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; } diff --git a/src/main/java/appeng/parts/CableBusContainer.java b/src/main/java/appeng/parts/CableBusContainer.java index 070c55014..c27f9d713 100644 --- a/src/main/java/appeng/parts/CableBusContainer.java +++ b/src/main/java/appeng/parts/CableBusContainer.java @@ -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 sides = EnumSet.allOf( EnumFacing.class ); + final EnumSet 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 enumSet ) + public boolean canConnectRedstone( final EnumSet 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 ) { diff --git a/src/main/java/appeng/parts/ICableBusContainer.java b/src/main/java/appeng/parts/ICableBusContainer.java index 1a399ce20..15d2c0452 100644 --- a/src/main/java/appeng/parts/ICableBusContainer.java +++ b/src/main/java/appeng/parts/ICableBusContainer.java @@ -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 of ); + boolean canConnectRedstone( EnumSet 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(); diff --git a/src/main/java/appeng/parts/NullCableBusContainer.java b/src/main/java/appeng/parts/NullCableBusContainer.java index 437736105..64bbbee86 100644 --- a/src/main/java/appeng/parts/NullCableBusContainer.java +++ b/src/main/java/appeng/parts/NullCableBusContainer.java @@ -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 of ) + public boolean canConnectRedstone( final EnumSet 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; } diff --git a/src/main/java/appeng/parts/PartPlacement.java b/src/main/java/appeng/parts/PartPlacement.java index 2e34893c9..3cac61804 100644 --- a/src/main/java/appeng/parts/PartPlacement.java +++ b/src/main/java/appeng/parts/PartPlacement.java @@ -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 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 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 maybeMultiPartStack = multiPart.maybeStack( 1 ); final Optional maybeMultiPartBlock = multiPart.maybeBlock(); - final Optional maybeMultiPartItemBlock = multiPart.maybeItemBlock(); + final Optional 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; diff --git a/src/main/java/appeng/parts/automation/BlockUpgradeInventory.java b/src/main/java/appeng/parts/automation/BlockUpgradeInventory.java index fbdd32227..94fbfffde 100644 --- a/src/main/java/appeng/parts/automation/BlockUpgradeInventory.java +++ b/src/main/java/appeng/parts/automation/BlockUpgradeInventory.java @@ -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; diff --git a/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java b/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java index ca2429bb6..ad277685a 100644 --- a/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java +++ b/src/main/java/appeng/parts/automation/PartAbstractFormationPlane.java @@ -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> 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> 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> 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> 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() ); diff --git a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java index c582f36d0..c0be5a03a 100644 --- a/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java +++ b/src/main/java/appeng/parts/automation/PartAnnihilationPlane.java @@ -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 items ) { - final IBlockState state = w.getBlockState( pos ); + final BlockState state = w.getBlockState( pos ); final float hardness = state.getBlockHardness( w, pos ); float requiredEnergy = 1 + hardness; diff --git a/src/main/java/appeng/parts/automation/PartExportBus.java b/src/main/java/appeng/parts/automation/PartExportBus.java index d428e0ae2..a380153b3 100644 --- a/src/main/java/appeng/parts/automation/PartExportBus.java +++ b/src/main/java/appeng/parts/automation/PartExportBus.java @@ -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() ) { diff --git a/src/main/java/appeng/parts/automation/PartFormationPlane.java b/src/main/java/appeng/parts/automation/PartFormationPlane.java index 48f550173..8e641eaa3 100644 --- a/src/main/java/appeng/parts/automation/PartFormationPlane.java +++ b/src/main/java/appeng/parts/automation/PartFormationPlane.java @@ -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 } @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 } @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 } @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 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 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; } diff --git a/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java b/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java index a987537d5..841db1522 100644 --- a/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java +++ b/src/main/java/appeng/parts/automation/PartIdentityAnnihilationPlane.java @@ -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 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 ) ) { diff --git a/src/main/java/appeng/parts/automation/PartImportBus.java b/src/main/java/appeng/parts/automation/PartImportBus.java index 47e42e3ac..9326bd139 100644 --- a/src/main/java/appeng/parts/automation/PartImportBus.java +++ b/src/main/java/appeng/parts/automation/PartImportBus.java @@ -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() ) { diff --git a/src/main/java/appeng/parts/automation/PartLevelEmitter.java b/src/main/java/appeng/parts/automation/PartLevelEmitter.java index a1f46a0e7..f27d0d4cc 100644 --- a/src/main/java/appeng/parts/automation/PartLevelEmitter.java +++ b/src/main/java/appeng/parts/automation/PartLevelEmitter.java @@ -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 ); diff --git a/src/main/java/appeng/parts/automation/PartSharedItemBus.java b/src/main/java/appeng/parts/automation/PartSharedItemBus.java index 782579fb9..2efdb94fb 100644 --- a/src/main/java/appeng/parts/automation/PartSharedItemBus.java +++ b/src/main/java/appeng/parts/automation/PartSharedItemBus.java @@ -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() ) ) diff --git a/src/main/java/appeng/parts/automation/PartUpgradeable.java b/src/main/java/appeng/parts/automation/PartUpgradeable.java index 42a5776fc..7d574d6ab 100644 --- a/src/main/java/appeng/parts/automation/PartUpgradeable.java +++ b/src/main/java/appeng/parts/automation/PartUpgradeable.java @@ -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 ); diff --git a/src/main/java/appeng/parts/automation/PlaneBakedModel.java b/src/main/java/appeng/parts/automation/PlaneBakedModel.java index 62a04236b..56578c08a 100644 --- a/src/main/java/appeng/parts/automation/PlaneBakedModel.java +++ b/src/main/java/appeng/parts/automation/PlaneBakedModel.java @@ -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 getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand ) + public List getQuads( @Nullable BlockState state, @Nullable Direction side, long rand ) { if( side == null ) { diff --git a/src/main/java/appeng/parts/automation/UpgradeInventory.java b/src/main/java/appeng/parts/automation/UpgradeInventory.java index 152f787d1..b79170e74 100644 --- a/src/main/java/appeng/parts/automation/UpgradeInventory.java +++ b/src/main/java/appeng/parts/automation/UpgradeInventory.java @@ -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(); diff --git a/src/main/java/appeng/parts/misc/PartCableAnchor.java b/src/main/java/appeng/parts/misc/PartCableAnchor.java index a77201714..568e25076 100644 --- a/src/main/java/appeng/parts/misc/PartCableAnchor.java +++ b/src/main/java/appeng/parts/misc/PartCableAnchor.java @@ -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 ) { } diff --git a/src/main/java/appeng/parts/misc/PartInterface.java b/src/main/java/appeng/parts/misc/PartInterface.java index 75b3c192a..4f2ae4512 100644 --- a/src/main/java/appeng/parts/misc/PartInterface.java +++ b/src/main/java/appeng/parts/misc/PartInterface.java @@ -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 getTargets() + public EnumSet getTargets() { return EnumSet.of( this.getSide().getFacing() ); } diff --git a/src/main/java/appeng/parts/misc/PartSharedStorageBus.java b/src/main/java/appeng/parts/misc/PartSharedStorageBus.java index 18a3fb1bd..d786944c1 100644 --- a/src/main/java/appeng/parts/misc/PartSharedStorageBus.java +++ b/src/main/java/appeng/parts/misc/PartSharedStorageBus.java @@ -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 ); diff --git a/src/main/java/appeng/parts/misc/PartStorageBus.java b/src/main/java/appeng/parts/misc/PartStorageBus.java index 9441a9dc8..ba74366ff 100644 --- a/src/main/java/appeng/parts/misc/PartStorageBus.java +++ b/src/main/java/appeng/parts/misc/PartStorageBus.java @@ -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 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 ) ) { diff --git a/src/main/java/appeng/parts/misc/PartToggleBus.java b/src/main/java/appeng/parts/misc/PartToggleBus.java index 128031bf5..8ea0ccce5 100644 --- a/src/main/java/appeng/parts/misc/PartToggleBus.java +++ b/src/main/java/appeng/parts/misc/PartToggleBus.java @@ -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 ); diff --git a/src/main/java/appeng/parts/networking/PartCable.java b/src/main/java/appeng/parts/networking/PartCable.java index 7834a4765..23eee8547 100644 --- a/src/main/java/appeng/parts/networking/PartCable.java +++ b/src/main/java/appeng/parts/networking/PartCable.java @@ -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 sides ) + public void setValidSides( final EnumSet 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 ) { diff --git a/src/main/java/appeng/parts/networking/PartQuartzFiber.java b/src/main/java/appeng/parts/networking/PartQuartzFiber.java index f29b80464..46a0965e3 100644 --- a/src/main/java/appeng/parts/networking/PartQuartzFiber.java +++ b/src/main/java/appeng/parts/networking/PartQuartzFiber.java @@ -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 ); diff --git a/src/main/java/appeng/parts/p2p/PartP2PFluids.java b/src/main/java/appeng/parts/p2p/PartP2PFluids.java index 0590ef63b..d16b5e21f 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PFluids.java +++ b/src/main/java/appeng/parts/p2p/PartP2PFluids.java @@ -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 implements IFlui } @Override - public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor ) + public void onNeighborChanged( IBlockReader w, BlockPos pos, BlockPos neighbor ) { this.cachedTank = null; diff --git a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java b/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java deleted file mode 100644 index e9ae8e27c..000000000 --- a/src/main/java/appeng/parts/p2p/PartP2PIC2Power.java +++ /dev/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 . - */ - -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 -{ - - 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 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 outs; - try - { - outs = PartP2PIC2Power.this.getOutputs(); - } - catch( GridAccessException e ) - { - return amount; - } - - if( outs.isEmpty() ) - { - return amount; - } - - List 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; - } - } - } - -} \ No newline at end of file diff --git a/src/main/java/appeng/parts/p2p/PartP2PItems.java b/src/main/java/appeng/parts/p2p/PartP2PItems.java index 61deecd4f..71ac80718 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PItems.java +++ b/src/main/java/appeng/parts/p2p/PartP2PItems.java @@ -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 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 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() ) ) diff --git a/src/main/java/appeng/parts/p2p/PartP2PLight.java b/src/main/java/appeng/parts/p2p/PartP2PLight.java index 3211d865c..1816adb69 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PLight.java +++ b/src/main/java/appeng/parts/p2p/PartP2PLight.java @@ -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 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 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 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 diff --git a/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java b/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java deleted file mode 100644 index 6a40bcfd9..000000000 --- a/src/main/java/appeng/parts/p2p/PartP2POpenComputers.java +++ /dev/null @@ -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 . - */ - -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 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(); -// } -// } diff --git a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java index 13c85d8e8..5d41f4152 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PRedstone.java +++ b/src/main/java/appeng/parts/p2p/PartP2PRedstone.java @@ -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 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 } @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 } @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 ); diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java index 6271684ed..0c6202102 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PTunnel.java +++ b/src/main/java/appeng/parts/p2p/PartP2PTunnel.java @@ -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 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 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 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 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 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 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 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 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 ) diff --git a/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java b/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java index f7a335900..eaf156618 100644 --- a/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java +++ b/src/main/java/appeng/parts/p2p/PartP2PTunnelME.java @@ -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 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 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 ); diff --git a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java index c45c7614e..8544cb4b3 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartMonitor.java @@ -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() ); diff --git a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java index dfb4bbbcb..24bc87ca7 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartReporting.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartReporting.java @@ -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 ); diff --git a/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java b/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java index be4a62408..34ef0bedf 100644 --- a/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java +++ b/src/main/java/appeng/parts/reporting/AbstractPartTerminal.java @@ -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; } diff --git a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java index fd2bc5514..fc0757500 100644 --- a/src/main/java/appeng/parts/reporting/PartConversionMonitor.java +++ b/src/main/java/appeng/parts/reporting/PartConversionMonitor.java @@ -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 ) diff --git a/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java b/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java index d4fd1413a..627d834a0 100644 --- a/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartCraftingTerminal.java @@ -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; diff --git a/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java b/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java index e5ef4911f..810a2878e 100644 --- a/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartInterfaceTerminal.java @@ -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 ) ) { diff --git a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java index d917907a3..5e8ce40d3 100644 --- a/src/main/java/appeng/parts/reporting/PartPatternTerminal.java +++ b/src/main/java/appeng/parts/reporting/PartPatternTerminal.java @@ -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; diff --git a/src/main/java/appeng/server/ServerHelper.java b/src/main/java/appeng/server/ServerHelper.java index 3c9339374..1dd74bf7a 100644 --- a/src/main/java/appeng/server/ServerHelper.java +++ b/src/main/java/appeng/server/ServerHelper.java @@ -23,11 +23,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.RayTraceResult; @@ -48,7 +48,7 @@ import appeng.util.Platform; public class ServerHelper extends CommonHelper { - private EntityPlayer renderModeBased; + private PlayerEntity renderModeBased; @Override public void preinit() @@ -75,7 +75,7 @@ public class ServerHelper extends CommonHelper } @Override - public List getPlayers() + public List getPlayers() { if( !Platform.isClient() ) { @@ -91,26 +91,26 @@ public class ServerHelper extends CommonHelper } @Override - public void sendToAllNearExcept( final EntityPlayer p, final double x, final double y, final double z, final double dist, final World w, final AppEngPacket packet ) + public void sendToAllNearExcept( final PlayerEntity p, final double x, final double y, final double z, final double dist, final World w, final AppEngPacket packet ) { if( Platform.isClient() ) { return; } - for( final EntityPlayer o : this.getPlayers() ) + for( final PlayerEntity o : this.getPlayers() ) { - final EntityPlayerMP entityplayermp = (EntityPlayerMP) o; + final PlayerEntityMP PlayerEntitymp = (PlayerEntityMP) o; - if( entityplayermp != p && entityplayermp.world == w ) + if( PlayerEntitymp != p && PlayerEntitymp.world == w ) { - final double dX = x - entityplayermp.posX; - final double dY = y - entityplayermp.posY; - final double dZ = z - entityplayermp.posZ; + final double dX = x - PlayerEntitymp.posX; + final double dY = y - PlayerEntitymp.posY; + final double dZ = z - PlayerEntitymp.posZ; if( dX * dX + dY * dY + dZ * dZ < dist * dist ) { - NetworkHandler.instance().sendTo( packet, entityplayermp ); + NetworkHandler.instance().sendTo( packet, PlayerEntitymp ); } } } @@ -158,22 +158,22 @@ public class ServerHelper extends CommonHelper } @Override - public void updateRenderMode( final EntityPlayer player ) + public void updateRenderMode( final PlayerEntity player ) { this.renderModeBased = player; } - protected CableRenderMode renderModeForPlayer( final EntityPlayer player ) + protected CableRenderMode renderModeForPlayer( final PlayerEntity player ) { if( player != null ) { - for( int x = 0; x < InventoryPlayer.getHotbarSize(); x++ ) + for( int x = 0; x < PlayerInventory.getHotbarSize(); x++ ) { final ItemStack is = player.inventory.getStackInSlot( x ); if( !is.isEmpty() && is.getItem() instanceof ToolNetworkTool ) { - final NBTTagCompound c = is.getTagCompound(); + final CompoundNBT c = is.getTagCompound(); if( c != null && c.getBoolean( "hideFacades" ) ) { return CableRenderMode.CABLE_VIEW; diff --git a/src/main/java/appeng/services/VersionChecker.java b/src/main/java/appeng/services/VersionChecker.java index 87bec13df..26a3d8c53 100644 --- a/src/main/java/appeng/services/VersionChecker.java +++ b/src/main/java/appeng/services/VersionChecker.java @@ -25,7 +25,7 @@ import javax.annotation.Nonnull; import com.google.common.base.Preconditions; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.event.FMLInterModComms; @@ -179,7 +179,7 @@ public final class VersionChecker implements Runnable { if( Loader.isModLoaded( "VersionChecker" ) ) { - final NBTTagCompound versionInf = new NBTTagCompound(); + final CompoundNBT versionInf = new CompoundNBT(); versionInf.setString( "modDisplayName", AppEng.MOD_NAME ); versionInf.setString( "oldVersion", modFormatted ); versionInf.setString( "newVersion", ghFormatted ); diff --git a/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java b/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java index e18f487ae..570314e0e 100644 --- a/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java +++ b/src/main/java/appeng/services/export/MinecraftItemCSVExporter.java @@ -40,7 +40,7 @@ import org.apache.commons.io.FileUtils; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; @@ -168,7 +168,7 @@ final class MinecraftItemCSVExporter implements Exporter if( this.mode == ExportMode.VERBOSE ) { final Item item = input.getItem(); - final String unlocalizedItem = input.getUnlocalizedName(); + final String unlocalizedItem = input.getTranslationKey(); final Block block = Block.getBlockFromItem( item ); final boolean isBlock = block != Blocks.AIR && !block.equals( Blocks.AIR ); final Class stackClass = input.getClass(); @@ -226,7 +226,7 @@ final class MinecraftItemCSVExporter implements Exporter } else { - AELog.debug( EXPORTING_SUBTYPES_MESSAGE, input.getUnlocalizedName(), input.getHasSubtypes() ); + AELog.debug( EXPORTING_SUBTYPES_MESSAGE, input.getTranslationKey(), input.getHasSubtypes() ); } final String itemName = ForgeRegistries.ITEMS.getKey( input ).toString(); @@ -243,7 +243,7 @@ final class MinecraftItemCSVExporter implements Exporter } catch( final Exception ignored ) { - AELog.warn( EXPORTING_SUBTYPES_FAILED_MESSAGE, input.getUnlocalizedName() ); + AELog.warn( EXPORTING_SUBTYPES_FAILED_MESSAGE, input.getTranslationKey() ); AELog.debug( ignored ); // ignore if mods do bullshit in their code @@ -264,7 +264,7 @@ final class MinecraftItemCSVExporter implements Exporter } final List joinedBlockAttributes = Lists.newArrayListWithCapacity( 5 ); - final String unlocalizedItem = input.getUnlocalizedName(); + final String unlocalizedItem = input.getTranslationKey(); final String localization = I18n.translateToLocal( unlocalizedItem + LOCALIZATION_NAME_EXTENSION ); joinedBlockAttributes.add( itemName ); diff --git a/src/main/java/appeng/spatial/CachedPlane.java b/src/main/java/appeng/spatial/CachedPlane.java index b8ee6de75..7321647af 100644 --- a/src/main/java/appeng/spatial/CachedPlane.java +++ b/src/main/java/appeng/spatial/CachedPlane.java @@ -25,9 +25,9 @@ import java.util.List; import java.util.Map.Entry; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.texture.ITickable; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.world.NextTickListEntry; import net.minecraft.world.World; @@ -62,7 +62,7 @@ public class CachedPlane private final IMovableRegistry reg = AEApi.instance().registries().movable(); private final List updates = new ArrayList<>(); private int verticalBits; - private final IBlockState matrixBlockState; + private final BlockState matrixBlockState; public CachedPlane( final World w, final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ ) { @@ -111,8 +111,7 @@ public class CachedPlane { for( int z = 0; z < this.z_size; z++ ) { - this.myColumns[x][z] = new Column( w.getChunkFromChunkCoords( ( minX + x ) >> 4, - ( minZ + z ) >> 4 ), ( minX + x ) & 0xF, ( minZ + z ) & 0xF, minCY, cy_size ); + this.myColumns[x][z] = new Column( w.getChunk( ( minX + x ) >> 4, ( minZ + z ) >> 4 ), ( minX + x ) & 0xF, ( minZ + z ) & 0xF, minCY, cy_size ); } } @@ -125,7 +124,7 @@ public class CachedPlane final List> rawTiles = new ArrayList<>(); final List deadTiles = new ArrayList<>(); - final Chunk c = w.getChunkFromChunkCoords( minCX + cx, minCZ + cz ); + final Chunk c = w.getChunk( minCX + cx, minCZ + cz ); this.myChunks[cx][cz] = c; rawTiles.addAll( ( (HashMap) c.getTileEntityMap() ).entrySet() ); @@ -151,7 +150,7 @@ public class CachedPlane // don't skip air, just let the code replace it... if( details.state != null && details.state.getBlock() == Platform.AIR_BLOCK && details.state.getMaterial().isReplaceable() ) { - w.setBlockToAir( tePOS ); + w.removeBlock( tePOS, false ); } else { @@ -166,7 +165,7 @@ public class CachedPlane c.getTileEntityMap().remove( cp ); } - final long k = this.getWorld().getTotalWorldTime(); + final long k = this.getWorld().getGameTime(); final List list = this.getWorld().getPendingBlockUpdates( c, false ); if( list != null ) { @@ -392,7 +391,7 @@ public class CachedPlane private static class BlockStorageData { - public IBlockState state; + public BlockState state; public int light; } diff --git a/src/main/java/appeng/spatial/DefaultSpatialHandler.java b/src/main/java/appeng/spatial/DefaultSpatialHandler.java index ad6893344..77b65a541 100644 --- a/src/main/java/appeng/spatial/DefaultSpatialHandler.java +++ b/src/main/java/appeng/spatial/DefaultSpatialHandler.java @@ -19,7 +19,7 @@ package appeng.spatial; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -55,7 +55,7 @@ public class DefaultSpatialHandler implements IMovableHandler if( c.isLoaded() ) { - final IBlockState state = w.getBlockState( newPosition ); + final BlockState state = w.getBlockState( newPosition ); w.addTileEntity( te ); w.notifyBlockUpdate( newPosition, state, state, 1 ); } diff --git a/src/main/java/appeng/spatial/StorageChunkProvider.java b/src/main/java/appeng/spatial/StorageChunkProvider.java index cc7c80567..a840a9352 100644 --- a/src/main/java/appeng/spatial/StorageChunkProvider.java +++ b/src/main/java/appeng/spatial/StorageChunkProvider.java @@ -22,7 +22,7 @@ package appeng.spatial; import java.util.ArrayList; import java.util.List; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.EnumCreatureType; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -72,7 +72,7 @@ public class StorageChunkProvider extends ChunkGeneratorOverworld return chunk; } - private void fillChunk( Chunk chunk, IBlockState defaultState ) + private void fillChunk( Chunk chunk, BlockState defaultState ) { for( int cx = 0; cx < 16; cx++ ) { diff --git a/src/main/java/appeng/spatial/StorageHelper.java b/src/main/java/appeng/spatial/StorageHelper.java index a697cdbb7..0e5958662 100644 --- a/src/main/java/appeng/spatial/StorageHelper.java +++ b/src/main/java/appeng/spatial/StorageHelper.java @@ -23,9 +23,9 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -111,9 +111,9 @@ public class StorageHelper // load the chunk! newWorld.getChunkProvider().provideChunk( MathHelper.floor( link.x ) >> 4, MathHelper.floor( link.z ) >> 4 ); - if( entity instanceof EntityPlayerMP && link.dim.provider instanceof StorageWorldProvider ) + if( entity instanceof PlayerEntityMP && link.dim.provider instanceof StorageWorldProvider ) { - AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger( (EntityPlayerMP) entity ); + AppEng.instance().getAdvancementTriggers().getSpatialExplorer().trigger( (PlayerEntityMP) entity ); } entity.changeDimension( link.dim.provider.getDimension(), new METeleporter( link ) ); @@ -230,7 +230,7 @@ public class StorageHelper @Override public void visit( final BlockPos pos ) { - final IBlockState state = this.dst.getBlockState( pos ); + final BlockState state = this.dst.getBlockState( pos ); final Block blk = state.getBlock(); blk.neighborChanged( state, this.dst, pos, blk, pos ); } @@ -240,9 +240,9 @@ public class StorageHelper { private final World dst; - private final IBlockState state; + private final BlockState state; - public WrapInMatrixFrame( final IBlockState state, final World dst2 ) + public WrapInMatrixFrame( final BlockState state, final World dst2 ) { this.dst = dst2; this.state = state; diff --git a/src/main/java/appeng/spatial/StorageWorldProvider.java b/src/main/java/appeng/spatial/StorageWorldProvider.java index b6e141bf1..4650d3091 100644 --- a/src/main/java/appeng/spatial/StorageWorldProvider.java +++ b/src/main/java/appeng/spatial/StorageWorldProvider.java @@ -29,8 +29,8 @@ import net.minecraft.world.biome.BiomeProviderSingle; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.IChunkGenerator; import net.minecraftforge.client.IRenderHandler; -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.client.render.SpatialSkyRender; import appeng.core.AppEng; @@ -67,7 +67,7 @@ public class StorageWorldProvider extends WorldProvider } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public float[] calcSunriseSunsetColors( final float celestialAngle, final float partialTicks ) { return null; @@ -86,7 +86,7 @@ public class StorageWorldProvider extends WorldProvider } @Override - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public boolean isSkyColored() { return true; diff --git a/src/main/java/appeng/thirdparty/codechicken/lib/model/CachedFormat.java b/src/main/java/appeng/thirdparty/codechicken/lib/model/CachedFormat.java index 0c407a6c6..415124016 100644 --- a/src/main/java/appeng/thirdparty/codechicken/lib/model/CachedFormat.java +++ b/src/main/java/appeng/thirdparty/codechicken/lib/model/CachedFormat.java @@ -73,10 +73,10 @@ public class CachedFormat public CachedFormat( VertexFormat format ) { this.format = format; - this.elementCount = format.getElementCount(); + this.elementCount = format.getElements().size(); for( int i = 0; i < this.elementCount; i++ ) { - VertexFormatElement element = format.getElement( i ); + VertexFormatElement element = format.getElements().get( i ); switch( element.getUsage() ) { case POSITION: diff --git a/src/main/java/appeng/thirdparty/codechicken/lib/model/Quad.java b/src/main/java/appeng/thirdparty/codechicken/lib/model/Quad.java index e9725992a..ef12b4d86 100644 --- a/src/main/java/appeng/thirdparty/codechicken/lib/model/Quad.java +++ b/src/main/java/appeng/thirdparty/codechicken/lib/model/Quad.java @@ -19,18 +19,16 @@ package appeng.thirdparty.codechicken.lib.model; -import javax.vecmath.Vector3f; - -import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.Vector3f; +import net.minecraft.client.renderer.model.BakedQuad; 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 net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.pipeline.IVertexConsumer; import net.minecraftforge.client.model.pipeline.IVertexProducer; import net.minecraftforge.client.model.pipeline.LightUtil; -import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import appeng.thirdparty.codechicken.lib.math.InterpHelper; @@ -46,7 +44,7 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer public CachedFormat format; public int tintIndex = -1; - public EnumFacing orientation; + public Direction orientation; public boolean diffuseLighting = true; public TextureAtlasSprite sprite; @@ -91,7 +89,7 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer } @Override - public void setQuadOrientation( EnumFacing orientation ) + public void setQuadOrientation( Direction orientation ) { this.orientation = orientation; } @@ -129,10 +127,10 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer { this.vertexIndex = 0; this.full = true; - if(orientation == null) + if( this.orientation == null ) { - calculateOrientation(false); - } + this.calculateOrientation( false ); + } } } } @@ -198,40 +196,41 @@ public class Quad implements IVertexProducer, ISmartVertexConsumer vec[1] = (float) MathHelper.clamp( vec[1], bb.minY, bb.maxY ); vec[2] = (float) MathHelper.clamp( vec[2], bb.minZ, bb.maxZ ); } - calculateOrientation(true); + this.calculateOrientation( true ); } - /** - * Re-calculates the Orientation of this quad, - * optionally the normal vector. - * - * @param setNormal If the normal vector should be updated. - */ + /** + * Re-calculates the Orientation of this quad, + * optionally the normal vector. + * + * @param setNormal If the normal vector should be updated. + */ public void calculateOrientation( boolean setNormal ) - { - this.v1.set( this.vertices[3].vec ); - this.t.set( this.vertices[1].vec ); - this.v1.sub( this.t ); + { + this.v1.set( this.vertices[3].vec ); + this.t.set( this.vertices[1].vec ); + this.v1.sub( this.t ); - this.v2.set( this.vertices[2].vec ); - this.t.set( this.vertices[0].vec ); - this.v2.sub( this.t ); + this.v2.set( this.vertices[2].vec ); + this.t.set( this.vertices[0].vec ); + this.v2.sub( this.t ); - this.normal.cross( this.v2, this.v1 ); - this.normal.normalize(); + this.normal.set( this.v2.getX(), this.v2.getY(), this.v2.getZ() ); + this.normal.cross( this.v1 ); + this.normal.normalize(); - if( this.format.hasNormal && setNormal) - { - for( Vertex vertex : this.vertices ) - { - vertex.normal[0] = this.normal.x; - vertex.normal[1] = this.normal.y; - vertex.normal[2] = this.normal.z; - vertex.normal[3] = 0; - } - } - this.orientation = EnumFacing.getFacingFromVector( this.normal.x, this.normal.y, this.normal.z ); - } + if( this.format.hasNormal && setNormal ) + { + for( Vertex vertex : this.vertices ) + { + vertex.normal[0] = this.normal.getX(); + vertex.normal[1] = this.normal.getY(); + vertex.normal[2] = this.normal.getZ(); + vertex.normal[3] = 0; + } + } + this.orientation = Direction.getFacingFromVector( this.normal.getX(), this.normal.getY(), this.normal.getZ() ); + } /** * Used to create a new quad complete copy of this one. diff --git a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/BakedPipeline.java b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/BakedPipeline.java index 735373e99..a8920e286 100644 --- a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/BakedPipeline.java +++ b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/BakedPipeline.java @@ -27,9 +27,8 @@ import java.util.stream.Collectors; 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 net.minecraftforge.client.model.pipeline.IVertexConsumer; -import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import appeng.thirdparty.codechicken.lib.model.CachedFormat; import appeng.thirdparty.codechicken.lib.model.ISmartVertexConsumer; @@ -223,7 +222,7 @@ public class BakedPipeline implements ISmartVertexConsumer } @Override - public void setQuadOrientation( EnumFacing orientation ) + public void setQuadOrientation( Direction orientation ) { this.check(); this.unpacker.setQuadOrientation( orientation ); diff --git a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/QuadTransformer.java b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/QuadTransformer.java index 4749481c2..64bb26868 100644 --- a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/QuadTransformer.java +++ b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/QuadTransformer.java @@ -23,7 +23,7 @@ import javax.annotation.OverridingMethodsMustInvokeSuper; 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 net.minecraftforge.client.model.pipeline.IVertexConsumer; import appeng.thirdparty.codechicken.lib.model.CachedFormat; @@ -108,7 +108,7 @@ public abstract class QuadTransformer implements IVertexConsumer, ISmartVertexCo } @Override - public void setQuadOrientation( EnumFacing orientation ) + public void setQuadOrientation( Direction orientation ) { this.quad.setQuadOrientation( orientation ); } diff --git a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadCornerKicker.java b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadCornerKicker.java index 523cdd75e..cbc50adbf 100644 --- a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadCornerKicker.java +++ b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadCornerKicker.java @@ -19,11 +19,11 @@ package appeng.thirdparty.codechicken.lib.model.pipeline.transformers; -import static net.minecraft.util.EnumFacing.AxisDirection.NEGATIVE; -import static net.minecraft.util.EnumFacing.AxisDirection.POSITIVE; +import static net.minecraft.util.Direction.AxisDirection.NEGATIVE; +import static net.minecraft.util.Direction.AxisDirection.POSITIVE; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.AxisDirection; +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.Vec3i; @@ -140,7 +140,7 @@ public class QuadCornerKicker extends QuadTransformer float z = vertex.vec[2]; if( epsComp( x, corner.pX( this.box ) ) && epsComp( y, corner.pY( this.box ) ) && epsComp( z, corner.pZ( this.box ) ) ) { - Vec3i vec = EnumFacing.VALUES[hoz].getDirectionVec(); + Vec3i vec = Direction.values()[hoz].getDirectionVec(); x -= vec.getX() * this.thickness; y -= vec.getY() * this.thickness; z -= vec.getZ() * this.thickness; diff --git a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadFaceStripper.java b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadFaceStripper.java index e9f52ee22..bc4074b69 100644 --- a/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadFaceStripper.java +++ b/src/main/java/appeng/thirdparty/codechicken/lib/model/pipeline/transformers/QuadFaceStripper.java @@ -19,9 +19,9 @@ package appeng.thirdparty.codechicken.lib.model.pipeline.transformers; -import static net.minecraft.util.EnumFacing.AxisDirection.POSITIVE; +import static net.minecraft.util.Direction.AxisDirection.POSITIVE; -import net.minecraft.util.EnumFacing.AxisDirection; +import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.client.model.pipeline.IVertexConsumer; diff --git a/src/main/java/appeng/tile/AEBaseInvTile.java b/src/main/java/appeng/tile/AEBaseInvTile.java index 7a5f128e4..ac2788bae 100644 --- a/src/main/java/appeng/tile/AEBaseInvTile.java +++ b/src/main/java/appeng/tile/AEBaseInvTile.java @@ -25,8 +25,8 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; 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.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; @@ -46,16 +46,16 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven { @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); final IItemHandler inv = this.getInternalInventory(); if( inv != EmptyHandler.INSTANCE ) { - final NBTTagCompound opt = data.getCompoundTag( "inv" ); + final CompoundNBT opt = data.getCompoundTag( "inv" ); for( int x = 0; x < inv.getSlots(); x++ ) { - final NBTTagCompound item = opt.getCompoundTag( "item" + x ); + final CompoundNBT item = opt.getCompoundTag( "item" + x ); ItemHandlerUtil.setStackInSlot( inv, x, new ItemStack( item ) ); } } @@ -64,16 +64,16 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven public abstract @Nonnull IItemHandler getInternalInventory(); @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); final IItemHandler inv = this.getInternalInventory(); if( inv != EmptyHandler.INSTANCE ) { - final NBTTagCompound opt = new NBTTagCompound(); + final CompoundNBT opt = new CompoundNBT(); for( int x = 0; x < inv.getSlots(); x++ ) { - final NBTTagCompound item = new NBTTagCompound(); + final CompoundNBT item = new CompoundNBT(); final ItemStack is = inv.getStackInSlot( x ); if( !is.isEmpty() ) { @@ -111,16 +111,16 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven { return new TextComponentString( this.getCustomInventoryName() ); } - return new TextComponentTranslation( this.getBlockType().getUnlocalizedName() ); + return new TextComponentTranslation( this.getBlockType().getTranslationKey() ); } - protected @Nonnull IItemHandler getItemHandlerForSide( @Nonnull EnumFacing side ) + protected @Nonnull IItemHandler getItemHandlerForSide( @Nonnull Direction side ) { return this.getInternalInventory(); } @Override - public boolean hasCapability( Capability capability, EnumFacing facing ) + public boolean hasCapability( Capability capability, Direction facing ) { if( capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) { @@ -138,7 +138,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven @SuppressWarnings( "unchecked" ) @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { if( capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) { diff --git a/src/main/java/appeng/tile/AEBaseTile.java b/src/main/java/appeng/tile/AEBaseTile.java index 29295552a..49d6e4151 100644 --- a/src/main/java/appeng/tile/AEBaseTile.java +++ b/src/main/java/appeng/tile/AEBaseTile.java @@ -31,14 +31,14 @@ import javax.annotation.Nullable; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.NetworkManager; import net.minecraft.network.play.server.SPacketUpdateTileEntity; 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.World; import net.minecraftforge.items.IItemHandler; @@ -66,13 +66,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, private int renderFragment = 0; @Nullable private String customName; - private EnumFacing forward = null; - private EnumFacing up = null; - private IBlockState state; + private Direction forward = null; + private Direction up = null; + private BlockState state; private boolean markDirtyQueued = false; @Override - public boolean shouldRefresh( final World world, final BlockPos pos, final IBlockState oldState, final IBlockState newSate ) + public boolean shouldRefresh( final World world, final BlockPos pos, final BlockState oldState, final BlockState newSate ) { return newSate.getBlock() != oldState.getBlock(); // state doesn't change tile entities in AE2. } @@ -110,22 +110,12 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, return src.stack( 1 ); } - @Nonnull - public IBlockState getBlockState() - { - if( this.state == null ) - { - this.state = this.world.getBlockState( this.getPos() ); - } - return this.state; - } - @Override - public void readFromNBT( final NBTTagCompound data ) + public void read( final CompoundNBT data ) { - super.readFromNBT( data ); + super.read( data ); - if( data.hasKey( "customName" ) ) + if( data.contains( "customName" ) ) { this.customName = data.getString( "customName" ); } @@ -138,8 +128,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, { if( this.canBeRotated() ) { - this.forward = EnumFacing.valueOf( data.getString( "forward" ) ); - this.up = EnumFacing.valueOf( data.getString( "up" ) ); + this.forward = Direction.valueOf( data.getString( "forward" ) ); + this.up = Direction.valueOf( data.getString( "up" ) ); } } catch( final IllegalArgumentException ignored ) @@ -148,19 +138,19 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT write( final CompoundNBT data ) { - super.writeToNBT( data ); + super.write( data ); if( this.canBeRotated() ) { - data.setString( "forward", this.getForward().name() ); - data.setString( "up", this.getUp().name() ); + data.putString( "forward", this.getForward().name() ); + data.putString( "up", this.getUp().name() ); } if( this.customName != null ) { - data.setString( "customName", this.customName ); + data.putString( "customName", this.customName ); } return data; @@ -190,9 +180,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, * This builds a tag with the actual data that should be sent to the client for update syncs. * If the tile entity doesn't need update syncs, it returns null. */ - private NBTTagCompound writeUpdateData() + private CompoundNBT writeUpdateData() { - final NBTTagCompound data = new NBTTagCompound(); + final CompoundNBT data = new CompoundNBT(); final ByteBuf stream = Unpooled.buffer(); @@ -210,7 +200,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, } stream.capacity( stream.readableBytes() ); - data.setByteArray( "X", stream.array() ); + data.putByteArray( "X", stream.array() ); return data; } @@ -242,18 +232,18 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, * Handles tile entites that are being sent to the client as part of a full chunk. */ @Override - public NBTTagCompound getUpdateTag() + public CompoundNBT getUpdateTag() { - final NBTTagCompound data = this.writeUpdateData(); + final CompoundNBT data = this.writeUpdateData(); if( data == null ) { - return new NBTTagCompound(); + return new CompoundNBT(); } - data.setInteger( "x", this.pos.getX() ); - data.setInteger( "y", this.pos.getY() ); - data.setInteger( "z", this.pos.getZ() ); + data.putInt( "x", this.pos.getX() ); + data.putInt( "y", this.pos.getY() ); + data.putInt( "z", this.pos.getZ() ); return data; } @@ -261,7 +251,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, * Handles tile entites that are being received by the client as part of a full chunk. */ @Override - public void handleUpdateTag( NBTTagCompound tag ) + public void handleUpdateTag( CompoundNBT tag ) { final ByteBuf stream = Unpooled.copiedBuffer( tag.getByteArray( "X" ) ); @@ -275,12 +265,12 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, { if( this.canBeRotated() ) { - final EnumFacing old_Forward = this.forward; - final EnumFacing old_Up = this.up; + final Direction old_Forward = this.forward; + final Direction old_Up = this.up; final byte orientation = data.readByte(); - this.forward = EnumFacing.VALUES[orientation & 0x7]; - this.up = EnumFacing.VALUES[orientation >> 3]; + this.forward = Direction.values()[orientation & 0x7]; + this.up = Direction.values()[orientation >> 3]; return this.forward != old_Forward || this.up != old_Up; } @@ -325,27 +315,27 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, } @Override - public EnumFacing getForward() + public Direction getForward() { if( this.forward == null ) { - return EnumFacing.NORTH; + return Direction.NORTH; } return this.forward; } @Override - public EnumFacing getUp() + public Direction getUp() { if( this.up == null ) { - return EnumFacing.UP; + return Direction.UP; } return this.up; } @Override - public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) + public void setOrientation( final Direction inForward, final Direction inUp ) { this.forward = inForward; this.up = inUp; @@ -353,11 +343,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, Platform.notifyBlocksOfNeighbors( this.world, this.pos ); } - public void onPlacement( final ItemStack stack, final EntityPlayer player, final EnumFacing side ) + public void onPlacement( final ItemStack stack, final PlayerEntity player, final Direction side ) { - if( stack.hasTagCompound() ) + if( stack.hasTag() ) { - this.uploadSettings( SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound() ); + this.uploadSettings( SettingsFrom.DISMANTLE_ITEM, stack.getTag() ); } } @@ -367,7 +357,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, * @param from source of settings * @param compound compound of source */ - public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound ) + public void uploadSettings( final SettingsFrom from, final CompoundNBT compound ) { if( compound != null && this instanceof IConfigurableObject ) { @@ -381,7 +371,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, if( this instanceof IPriorityHost ) { final IPriorityHost pHost = (IPriorityHost) this; - pHost.setPriority( compound.getInteger( "priority" ) ); + pHost.setPriority( compound.getInt( "priority" ) ); } if( this instanceof ISegmentedInventory ) @@ -391,7 +381,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, { final AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv; final AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSlots() ); - tmp.readFromNBT( compound, "config" ); + tmp.read( compound, "config" ); for( int x = 0; x < tmp.getSlots(); x++ ) { target.setStackInSlot( x, tmp.getStackInSlot( x ) ); @@ -427,13 +417,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, * * @return compound of source */ - public NBTTagCompound downloadSettings( final SettingsFrom from ) + public CompoundNBT downloadSettings( final SettingsFrom from ) { - final NBTTagCompound output = new NBTTagCompound(); + final CompoundNBT output = new CompoundNBT(); if( this.hasCustomInventoryName() ) { - final NBTTagCompound dsp = new NBTTagCompound(); + final CompoundNBT dsp = new CompoundNBT(); dsp.setString( "Name", this.getCustomInventoryName() ); output.setTag( "display", dsp ); } diff --git a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java index b4124026e..c6160d9a9 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingMonitorTile.java @@ -24,12 +24,12 @@ 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.EnumFacing; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import appeng.api.AEApi; import appeng.api.implementations.tiles.IColorableTile; @@ -41,10 +41,10 @@ import appeng.util.item.AEItemStack; public class TileCraftingMonitorTile extends TileCraftingTile implements IColorableTile { - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private Integer dspList; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private boolean updateList; private IAEItemStack dspPlay; @@ -90,7 +90,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); if( data.hasKey( "paintedColor" ) ) @@ -100,7 +100,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setByte( "paintedColor", (byte) this.paintedColor.ordinal() ); @@ -154,7 +154,7 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora } @Override - public boolean recolourBlock( final EnumFacing side, final AEColor newPaintedColor, final EntityPlayer who ) + public boolean recolourBlock( final Direction side, final AEColor newPaintedColor, final PlayerEntity who ) { if( this.paintedColor == newPaintedColor ) { diff --git a/src/main/java/appeng/tile/crafting/TileCraftingTile.java b/src/main/java/appeng/tile/crafting/TileCraftingTile.java index 9734f591f..f80543a56 100644 --- a/src/main/java/appeng/tile/crafting/TileCraftingTile.java +++ b/src/main/java/appeng/tile/crafting/TileCraftingTile.java @@ -25,11 +25,11 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Optional; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; 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 appeng.api.AEApi; import appeng.api.config.Actionable; @@ -60,14 +60,14 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this ); - private NBTTagCompound previousState = null; + private CompoundNBT previousState = null; private boolean isCoreBlock = false; private CraftingCPUCluster cluster; public TileCraftingTile() { this.getProxy().setFlags( GridFlags.MULTIBLOCK, GridFlags.REQUIRE_CHANNEL ); - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); } @Override @@ -160,12 +160,12 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP power = this.getProxy().isActive(); } - final IBlockState current = this.world.getBlockState( this.pos ); + final BlockState current = this.world.getBlockState( this.pos ); // The tile might try to update while being destroyed if( current.getBlock() instanceof BlockCraftingUnit ) { - final IBlockState newState = current.withProperty( BlockCraftingUnit.POWERED, power ).withProperty( BlockCraftingUnit.FORMED, formed ); + final BlockState newState = current.withProperty( BlockCraftingUnit.POWERED, power ).withProperty( BlockCraftingUnit.FORMED, formed ); if( current != newState ) { @@ -179,11 +179,11 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP { if( formed ) { - this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.allOf( Direction.class ) ); } else { - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); } } } @@ -198,7 +198,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setBoolean( "core", this.isCoreBlock() ); @@ -210,7 +210,7 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.setCoreBlock( data.getBoolean( "core" ) ); @@ -372,12 +372,12 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP this.isCoreBlock = isCoreBlock; } - public NBTTagCompound getPreviousState() + public CompoundNBT getPreviousState() { return this.previousState; } - public void setPreviousState( final NBTTagCompound previousState ) + public void setPreviousState( final CompoundNBT previousState ) { this.previousState = previousState; } diff --git a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java index c41231bec..94ffaef03 100644 --- a/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java +++ b/src/main/java/appeng/tile/crafting/TileMolecularAssembler.java @@ -26,9 +26,9 @@ import io.netty.buffer.ByteBuf; 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.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.WorldServer; @@ -115,7 +115,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade } @Override - public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table, final EnumFacing where ) + public boolean pushPattern( final ICraftingPatternDetails patternDetails, final InventoryCrafting table, final Direction where ) { if( this.myPattern.isEmpty() ) { @@ -213,7 +213,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); if( this.forcePlan && this.myPlan != null ) @@ -221,7 +221,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade final ItemStack pattern = this.myPlan.getPattern(); if( !pattern.isEmpty() ) { - final NBTTagCompound compound = new NBTTagCompound(); + final CompoundNBT compound = new CompoundNBT(); pattern.writeToNBT( compound ); data.setTag( "myPlan", compound ); data.setInteger( "pushDirection", this.pushDirection.ordinal() ); @@ -234,7 +234,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); if( data.hasKey( "myPlan" ) ) @@ -346,7 +346,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade } @Override - protected IItemHandler getItemHandlerForSide( EnumFacing side ) + protected IItemHandler getItemHandlerForSide( Direction side ) { return this.gridInvExt; } @@ -536,7 +536,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade { if( this.pushDirection == AEPartLocation.INTERNAL ) { - for( final EnumFacing d : EnumFacing.VALUES ) + for( final Direction d : Direction.VALUES ) { output = this.pushTo( output, d ); } @@ -555,7 +555,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade this.gridInv.setStackInSlot( 9, output ); } - private ItemStack pushTo( ItemStack output, final EnumFacing d ) + private ItemStack pushTo( ItemStack output, final Direction d ) { if( output.isEmpty() ) { diff --git a/src/main/java/appeng/tile/grid/AENetworkInvTile.java b/src/main/java/appeng/tile/grid/AENetworkInvTile.java index 567dea7ee..2c364a32e 100644 --- a/src/main/java/appeng/tile/grid/AENetworkInvTile.java +++ b/src/main/java/appeng/tile/grid/AENetworkInvTile.java @@ -19,7 +19,7 @@ package appeng.tile.grid; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; @@ -35,14 +35,14 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true ); @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.getProxy().readFromNBT( data ); } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.getProxy().writeToNBT( data ); diff --git a/src/main/java/appeng/tile/grid/AENetworkPowerTile.java b/src/main/java/appeng/tile/grid/AENetworkPowerTile.java index 4bcdf3d2a..3b194d734 100644 --- a/src/main/java/appeng/tile/grid/AENetworkPowerTile.java +++ b/src/main/java/appeng/tile/grid/AENetworkPowerTile.java @@ -19,7 +19,7 @@ package appeng.tile.grid; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; @@ -37,14 +37,14 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true ); @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.getProxy().readFromNBT( data ); } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.getProxy().writeToNBT( data ); diff --git a/src/main/java/appeng/tile/grid/AENetworkTile.java b/src/main/java/appeng/tile/grid/AENetworkTile.java index e7a6fb7f9..6c9e65e42 100644 --- a/src/main/java/appeng/tile/grid/AENetworkTile.java +++ b/src/main/java/appeng/tile/grid/AENetworkTile.java @@ -19,7 +19,7 @@ package appeng.tile.grid; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.networking.IGridNode; import appeng.api.networking.security.IActionHost; @@ -37,14 +37,14 @@ public class AENetworkTile extends AEBaseTile implements IActionHost, IGridProxy private final AENetworkProxy gridProxy = this.createProxy(); @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.getProxy().readFromNBT( data ); } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.getProxy().writeToNBT( data ); diff --git a/src/main/java/appeng/tile/grindstone/TileCrank.java b/src/main/java/appeng/tile/grindstone/TileCrank.java index b73b9e59d..942cfe2d0 100644 --- a/src/main/java/appeng/tile/grindstone/TileCrank.java +++ b/src/main/java/appeng/tile/grindstone/TileCrank.java @@ -25,10 +25,10 @@ import java.util.List; import io.netty.buffer.ByteBuf; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -80,7 +80,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable return null; } - final EnumFacing grinder = this.getUp().getOpposite(); + final Direction grinder = this.getUp().getOpposite(); final TileEntity te = this.world.getTileEntity( this.pos.offset( grinder ) ); if( te instanceof ICrankable ) { @@ -105,10 +105,10 @@ public class TileCrank extends AEBaseTile implements ICustomCollision, ITickable } @Override - public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) + public void setOrientation( final Direction inForward, final Direction inUp ) { super.setOrientation( inForward, inUp ); - final IBlockState state = this.world.getBlockState( this.pos ); + final BlockState state = this.world.getBlockState( this.pos ); this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos ); } diff --git a/src/main/java/appeng/tile/grindstone/TileGrinder.java b/src/main/java/appeng/tile/grindstone/TileGrinder.java index 8a1f83c49..63a834cbe 100644 --- a/src/main/java/appeng/tile/grindstone/TileGrinder.java +++ b/src/main/java/appeng/tile/grindstone/TileGrinder.java @@ -22,9 +22,9 @@ package appeng.tile.grindstone; import java.util.ArrayList; import java.util.List; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.RangedWrapper; @@ -48,10 +48,10 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable private int points; @Override - public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) + public void setOrientation( final Direction inForward, final Direction inUp ) { super.setOrientation( inForward, inUp ); - final IBlockState state = this.world.getBlockState( this.pos ); + final BlockState state = this.world.getBlockState( this.pos ); this.getBlockType().neighborChanged( state, this.world, this.pos, state.getBlock(), this.pos ); } @@ -62,7 +62,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable } @Override - protected IItemHandler getItemHandlerForSide( EnumFacing side ) + protected IItemHandler getItemHandlerForSide( Direction side ) { return this.invExt; } @@ -182,7 +182,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable } @Override - public boolean canCrankAttach( final EnumFacing directionToCrank ) + public boolean canCrankAttach( final Direction directionToCrank ) { return this.getUp() == directionToCrank; } diff --git a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java index f2e7adc43..cbcae7e08 100644 --- a/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java +++ b/src/main/java/appeng/tile/inventory/AppEngInternalAEInventory.java @@ -24,7 +24,7 @@ import java.util.Iterator; import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; @@ -66,27 +66,27 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab return this.inv[var1]; } - public void writeToNBT( final NBTTagCompound data, final String name ) + public void writeToNBT( final CompoundNBT data, final String name ) { - final NBTTagCompound c = new NBTTagCompound(); + final CompoundNBT c = new CompoundNBT(); this.writeToNBT( c ); - data.setTag( name, c ); + data.put( name, c ); } - private void writeToNBT( final NBTTagCompound target ) + private void writeToNBT( final CompoundNBT target ) { for( int x = 0; x < this.size; x++ ) { try { - final NBTTagCompound c = new NBTTagCompound(); + final CompoundNBT c = new CompoundNBT(); if( this.inv[x] != null ) { this.inv[x].writeToNBT( c ); } - target.setTag( "#" + x, c ); + target.put( "#" + x, c ); } catch( final Exception ignored ) { @@ -94,22 +94,22 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab } } - public void readFromNBT( final NBTTagCompound data, final String name ) + public void readFromNBT( final CompoundNBT data, final String name ) { - final NBTTagCompound c = data.getCompoundTag( name ); + final CompoundNBT c = data.getCompound( name ); if( c != null ) { this.readFromNBT( c ); } } - private void readFromNBT( final NBTTagCompound target ) + private void readFromNBT( final CompoundNBT target ) { for( int x = 0; x < this.size; x++ ) { try { - final NBTTagCompound c = target.getCompoundTag( "#" + x ); + final CompoundNBT c = target.getCompound( "#" + x ); if( c != null ) { diff --git a/src/main/java/appeng/tile/inventory/AppEngInternalInventory.java b/src/main/java/appeng/tile/inventory/AppEngInternalInventory.java index 1e47b00fe..fa43be6a0 100644 --- a/src/main/java/appeng/tile/inventory/AppEngInternalInventory.java +++ b/src/main/java/appeng/tile/inventory/AppEngInternalInventory.java @@ -26,7 +26,7 @@ import java.util.Iterator; import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.ItemStackHandler; import appeng.util.Platform; @@ -171,21 +171,21 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl return true; } - public void writeToNBT( final NBTTagCompound data, final String name ) + public void writeToNBT( final CompoundNBT data, final String name ) { - data.setTag( name, this.serializeNBT() ); + data.put( name, this.serializeNBT() ); } - public void readFromNBT( final NBTTagCompound data, final String name ) + public void readFromNBT( final CompoundNBT data, final String name ) { - final NBTTagCompound c = data.getCompoundTag( name ); + final CompoundNBT c = data.getCompound( name ); if( c != null ) { this.readFromNBT( c ); } } - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { this.deserializeNBT( data ); } diff --git a/src/main/java/appeng/tile/misc/TileCellWorkbench.java b/src/main/java/appeng/tile/misc/TileCellWorkbench.java index 8e102df0f..c9784ba15 100644 --- a/src/main/java/appeng/tile/misc/TileCellWorkbench.java +++ b/src/main/java/appeng/tile/misc/TileCellWorkbench.java @@ -22,7 +22,7 @@ package appeng.tile.misc; 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.World; import net.minecraftforge.items.IItemHandler; @@ -103,7 +103,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.cell.writeToNBT( data, "cell" ); @@ -113,7 +113,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.cell.readFromNBT( data, "cell" ); diff --git a/src/main/java/appeng/tile/misc/TileCharger.java b/src/main/java/appeng/tile/misc/TileCharger.java index 2f8d059c1..ca63bf726 100644 --- a/src/main/java/appeng/tile/misc/TileCharger.java +++ b/src/main/java/appeng/tile/misc/TileCharger.java @@ -26,9 +26,9 @@ import java.util.List; 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.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.items.IItemHandler; import appeng.api.AEApi; @@ -67,7 +67,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid public TileCharger() { - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); this.getProxy().setFlags(); this.setInternalMaxPower( POWER_MAXIMUM_AMOUNT ); this.getProxy().setIdlePowerUsage( 0 ); @@ -108,7 +108,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid } @Override - public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) + public void setOrientation( final Direction inForward, final Direction inUp ) { super.setOrientation( inForward, inUp ); this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); @@ -147,7 +147,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid } @Override - public boolean canCrankAttach( final EnumFacing directionToCrank ) + public boolean canCrankAttach( final Direction directionToCrank ) { return this.getUp() == directionToCrank || this.getUp().getOpposite() == directionToCrank; } @@ -173,7 +173,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable, IGrid this.markForUpdate(); } - public void activate( final EntityPlayer player ) + public void activate( final PlayerEntity player ) { if( !Platform.hasPermissions( new DimensionalCoord( this ), player ) ) { diff --git a/src/main/java/appeng/tile/misc/TileCondenser.java b/src/main/java/appeng/tile/misc/TileCondenser.java index 2a0561a2c..0f927cb1d 100644 --- a/src/main/java/appeng/tile/misc/TileCondenser.java +++ b/src/main/java/appeng/tile/misc/TileCondenser.java @@ -22,8 +22,8 @@ package appeng.tile.misc; import javax.annotation.Nullable; 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.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -85,7 +85,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.cm.writeToNBT( data ); @@ -94,7 +94,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.cm.readFromNBT( data ); @@ -220,7 +220,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, } @Override - public boolean hasCapability( Capability capability, EnumFacing facing ) + public boolean hasCapability( Capability capability, Direction facing ) { if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY ) { @@ -235,7 +235,7 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost, @SuppressWarnings( "unchecked" ) @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { if( capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY ) { diff --git a/src/main/java/appeng/tile/misc/TileInscriber.java b/src/main/java/appeng/tile/misc/TileInscriber.java index 7ed1ae4f7..0e9091327 100644 --- a/src/main/java/appeng/tile/misc/TileInscriber.java +++ b/src/main/java/appeng/tile/misc/TileInscriber.java @@ -31,8 +31,8 @@ import com.google.common.collect.Lists; import io.netty.buffer.ByteBuf; 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.World; import net.minecraftforge.items.IItemHandler; @@ -104,7 +104,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, public TileInscriber() { - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); this.setInternalMaxPower( 1600 ); this.getProxy().setIdlePowerUsage( 0 ); this.settings = new ConfigManager( this ); @@ -132,7 +132,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.upgrades.writeToNBT( data, "upgrades" ); @@ -141,7 +141,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.upgrades.readFromNBT( data, "upgrades" ); @@ -205,7 +205,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, } @Override - public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) + public void setOrientation( final Direction inForward, final Direction inUp ) { super.setOrientation( inForward, inUp ); this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.getForward() ) ) ); @@ -470,7 +470,7 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, } @Override - protected IItemHandler getItemHandlerForSide( @Nonnull EnumFacing facing ) + protected IItemHandler getItemHandlerForSide( @Nonnull Direction facing ) { if( facing == this.getUp() ) { @@ -538,21 +538,21 @@ public class TileInscriber extends AENetworkPowerTile implements IGridTickable, if( !plateA.isEmpty() ) { - final NBTTagCompound tag = Platform.openNbtData( plateA ); + final CompoundNBT tag = Platform.openNbtData( plateA ); name += tag.getString( "InscribeName" ); } if( !plateB.isEmpty() ) { - final NBTTagCompound tag = Platform.openNbtData( plateB ); + final CompoundNBT tag = Platform.openNbtData( plateB ); name += " " + tag.getString( "InscribeName" ); } final ItemStack startingItem = input.copy(); final ItemStack renamedItem = input.copy(); - final NBTTagCompound tag = Platform.openNbtData( renamedItem ); + final CompoundNBT tag = Platform.openNbtData( renamedItem ); - final NBTTagCompound display = tag.getCompoundTag( "display" ); + final CompoundNBT display = tag.getCompoundTag( "display" ); tag.setTag( "display", display ); if( name.length() > 0 ) diff --git a/src/main/java/appeng/tile/misc/TileInterface.java b/src/main/java/appeng/tile/misc/TileInterface.java index 6a945c307..4905c737f 100644 --- a/src/main/java/appeng/tile/misc/TileInterface.java +++ b/src/main/java/appeng/tile/misc/TileInterface.java @@ -31,9 +31,9 @@ import io.netty.buffer.ByteBuf; 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.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; @@ -87,14 +87,14 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II this.duality.notifyNeighbors(); } - public void setSide( final EnumFacing facing ) + public void setSide( final Direction facing ) { if( Platform.isClient() ) { return; } - EnumFacing newForward = facing; + Direction newForward = facing; if( !this.omniDirectional && this.getForward() == facing.getOpposite() ) { @@ -116,14 +116,14 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II if( this.omniDirectional ) { - this.setOrientation( EnumFacing.NORTH, EnumFacing.UP ); + this.setOrientation( Direction.NORTH, Direction.UP ); } else { - EnumFacing newUp = EnumFacing.UP; - if( newForward == EnumFacing.UP || newForward == EnumFacing.DOWN ) + Direction newUp = Direction.UP; + if( newForward == Direction.UP || newForward == Direction.DOWN ) { - newUp = EnumFacing.NORTH; + newUp = Direction.NORTH; } this.setOrientation( newForward, newUp ); } @@ -137,7 +137,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II { if( this.omniDirectional ) { - this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.allOf( Direction.class ) ); } else { @@ -167,7 +167,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setBoolean( "omniDirectional", this.omniDirectional ); @@ -176,7 +176,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.omniDirectional = data.getBoolean( "omniDirectional" ); @@ -255,11 +255,11 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II } @Override - public EnumSet getTargets() + public EnumSet getTargets() { if( this.omniDirectional ) { - return EnumSet.allOf( EnumFacing.class ); + return EnumSet.allOf( Direction.class ); } return EnumSet.of( this.getForward() ); } @@ -339,13 +339,13 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II } @Override - public boolean hasCapability( Capability capability, @Nullable EnumFacing facing ) + public boolean hasCapability( Capability capability, @Nullable Direction facing ) { return this.duality.hasCapability( capability, facing ) || super.hasCapability( capability, facing ); } @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { T result = this.duality.getCapability( capability, facing ); if( result != null ) diff --git a/src/main/java/appeng/tile/misc/TilePaint.java b/src/main/java/appeng/tile/misc/TilePaint.java index 3ea68a889..3a909bdc9 100644 --- a/src/main/java/appeng/tile/misc/TilePaint.java +++ b/src/main/java/appeng/tile/misc/TilePaint.java @@ -29,10 +29,10 @@ import java.util.List; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; 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.util.math.Vec3d; import net.minecraft.world.EnumSkyBlock; @@ -58,7 +58,7 @@ public class TilePaint extends AEBaseTile } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); final ByteBuf myDat = Unpooled.buffer(); @@ -87,7 +87,7 @@ public class TilePaint extends AEBaseTile } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); if( data.hasKey( "dots" ) ) @@ -160,7 +160,7 @@ public class TilePaint extends AEBaseTile return; } - for( final EnumFacing side : EnumFacing.VALUES ) + for( final Direction side : Direction.VALUES ) { if( !this.isSideValid( side ) ) { @@ -171,14 +171,14 @@ public class TilePaint extends AEBaseTile this.updateData(); } - public boolean isSideValid( final EnumFacing side ) + public boolean isSideValid( final Direction side ) { final BlockPos p = this.pos.offset( side ); - final IBlockState blk = this.world.getBlockState( p ); + final BlockState blk = this.world.getBlockState( p ); return blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() ); } - private void removeSide( final EnumFacing side ) + private void removeSide( final Direction side ) { final Iterator i = this.dots.iterator(); while( i.hasNext() ) @@ -218,7 +218,7 @@ public class TilePaint extends AEBaseTile } } - public void cleanSide( final EnumFacing side ) + public void cleanSide( final Direction side ) { if( this.dots == null ) { @@ -235,11 +235,11 @@ public class TilePaint extends AEBaseTile return this.isLit; } - public void addBlot( final ItemStack type, final EnumFacing side, final Vec3d hitVec ) + public void addBlot( final ItemStack type, final Direction side, final Vec3d hitVec ) { final BlockPos p = this.pos.offset( side ); - final IBlockState blk = this.world.getBlockState( p ); + final BlockState blk = this.world.getBlockState( p ); if( blk.getBlock().isSideSolid( this.world.getBlockState( p ), this.world, p, side.getOpposite() ) ) { final ItemPaintBall ipb = (ItemPaintBall) type.getItem(); diff --git a/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java b/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java index 0837b573a..9ba128052 100644 --- a/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java +++ b/src/main/java/appeng/tile/misc/TileQuartzGrowthAccelerator.java @@ -24,7 +24,7 @@ import java.util.EnumSet; import io.netty.buffer.ByteBuf; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.implementations.IPowerChannelState; import appeng.api.implementations.tiles.ICrystalGrowthAccelerator; @@ -44,7 +44,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower public TileQuartzGrowthAccelerator() { - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); this.getProxy().setFlags(); this.getProxy().setIdlePowerUsage( 8 ); } @@ -85,7 +85,7 @@ public class TileQuartzGrowthAccelerator extends AENetworkTile implements IPower } @Override - public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) + public void setOrientation( final Direction inForward, final Direction inUp ) { super.setOrientation( inForward, inUp ); this.getProxy().setValidSides( EnumSet.of( this.getUp(), this.getUp().getOpposite() ) ); diff --git a/src/main/java/appeng/tile/misc/TileSecurityStation.java b/src/main/java/appeng/tile/misc/TileSecurityStation.java index eac5479c1..fec9d8ea2 100644 --- a/src/main/java/appeng/tile/misc/TileSecurityStation.java +++ b/src/main/java/appeng/tile/misc/TileSecurityStation.java @@ -26,12 +26,12 @@ import java.util.Map; import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; -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.World; import net.minecraftforge.common.MinecraftForge; @@ -158,7 +158,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost, } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.cm.writeToNBT( data ); @@ -167,12 +167,12 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost, data.setLong( "securityKey", this.securityKey ); this.getConfigSlot().writeToNBT( data, "config" ); - final NBTTagCompound storedItems = new NBTTagCompound(); + final CompoundNBT storedItems = new CompoundNBT(); int offset = 0; for( final IAEItemStack ais : this.inventory.getStoredItems() ) { - final NBTTagCompound it = new NBTTagCompound(); + final CompoundNBT it = new CompoundNBT(); ais.createItemStack().writeToNBT( it ); storedItems.setTag( String.valueOf( offset ), it ); offset++; @@ -183,7 +183,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost, } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.cm.readFromNBT( data ); @@ -195,13 +195,13 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost, this.securityKey = data.getLong( "securityKey" ); this.getConfigSlot().readFromNBT( data, "config" ); - final NBTTagCompound storedItems = data.getCompoundTag( "storedItems" ); + final CompoundNBT storedItems = data.getCompoundTag( "storedItems" ); for( final Object key : storedItems.getKeySet() ) { final NBTBase obj = storedItems.getTag( (String) key ); - if( obj instanceof NBTTagCompound ) + if( obj instanceof CompoundNBT ) { - this.inventory.getStoredItems().add( AEItemStack.fromItemStack( new ItemStack( (NBTTagCompound) obj ) ) ); + this.inventory.getStoredItems().add( AEItemStack.fromItemStack( new ItemStack( (CompoundNBT) obj ) ) ); } } } @@ -355,7 +355,7 @@ public class TileSecurityStation extends AENetworkTile implements ITerminalHost, } @Override - public boolean recolourBlock( final EnumFacing side, final AEColor newPaintedColor, final EntityPlayer who ) + public boolean recolourBlock( final Direction side, final AEColor newPaintedColor, final PlayerEntity who ) { if( this.paintedColor == newPaintedColor ) { diff --git a/src/main/java/appeng/tile/misc/TileVibrationChamber.java b/src/main/java/appeng/tile/misc/TileVibrationChamber.java index e8284c8c7..a82d08546 100644 --- a/src/main/java/appeng/tile/misc/TileVibrationChamber.java +++ b/src/main/java/appeng/tile/misc/TileVibrationChamber.java @@ -27,9 +27,9 @@ import io.netty.buffer.ByteBuf; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.items.IItemHandler; import appeng.api.config.Actionable; @@ -98,7 +98,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setDouble( "burnTime", this.getBurnTime() ); @@ -108,7 +108,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.setBurnTime( data.getDouble( "burnTime" ) ); @@ -117,7 +117,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka } @Override - protected IItemHandler getItemHandlerForSide( @Nonnull EnumFacing facing ) + protected IItemHandler getItemHandlerForSide( @Nonnull Direction facing ) { return this.invExt; } diff --git a/src/main/java/appeng/tile/networking/CableBusTESR.java b/src/main/java/appeng/tile/networking/CableBusTESR.java index b2bf0e71c..b03997e96 100644 --- a/src/main/java/appeng/tile/networking/CableBusTESR.java +++ b/src/main/java/appeng/tile/networking/CableBusTESR.java @@ -20,7 +20,7 @@ package appeng.tile.networking; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.parts.IPart; import appeng.tile.AEBaseTile; @@ -40,7 +40,7 @@ public class CableBusTESR extends TileEntitySpecialRenderer TileCableBusTESR realTe = (TileCableBusTESR) te; - for( EnumFacing facing : EnumFacing.values() ) + for( Direction facing : Direction.values() ) { IPart part = realTe.getPart( facing ); if( part != null && part.requireDynamicRender() ) diff --git a/src/main/java/appeng/tile/networking/TileCableBus.java b/src/main/java/appeng/tile/networking/TileCableBus.java index 0f53291cd..8654dd3f1 100644 --- a/src/main/java/appeng/tile/networking/TileCableBus.java +++ b/src/main/java/appeng/tile/networking/TileCableBus.java @@ -28,11 +28,11 @@ import javax.annotation.Nullable; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; -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.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -65,14 +65,14 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl private int oldLV = -1; // on re-calculate light when it changes @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.getCableBus().readFromNBT( data ); } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.getCableBus().writeToNBT( data ); @@ -249,7 +249,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } @Override - public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final EntityPlayer player, final EnumHand hand ) + public AEPartLocation addPart( final ItemStack is, final AEPartLocation side, final PlayerEntity player, final Hand hand ) { return this.getCableBus().addPart( is, side, player, hand ); } @@ -261,7 +261,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } @Override - public IPart getPart( final EnumFacing side ) + public IPart getPart( final Direction side ) { return this.getCableBus().getPart( side ); } @@ -291,7 +291,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } @Override - public boolean isBlocked( final EnumFacing side ) + public boolean isBlocked( final Direction side ) { // TODO 1.10.2-R - Stuff. return false; @@ -370,7 +370,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } @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 this.getCableBus().recolourBlock( side, colour, who ); } @@ -386,7 +386,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } @Override - public boolean hasCapability( Capability capabilityClass, @Nullable EnumFacing fromSide ) + public boolean hasCapability( Capability capabilityClass, @Nullable Direction fromSide ) { // Note that null will be translated to INTERNAL here AEPartLocation partLocation = AEPartLocation.fromFacing( fromSide ); @@ -398,7 +398,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile, ICustomColl } @Override - public T getCapability( Capability capabilityClass, @Nullable EnumFacing fromSide ) + public T getCapability( Capability capabilityClass, @Nullable Direction fromSide ) { // Note that null will be translated to INTERNAL here AEPartLocation partLocation = AEPartLocation.fromFacing( fromSide ); diff --git a/src/main/java/appeng/tile/networking/TileController.java b/src/main/java/appeng/tile/networking/TileController.java index ec9bf8907..fe2e2b98e 100644 --- a/src/main/java/appeng/tile/networking/TileController.java +++ b/src/main/java/appeng/tile/networking/TileController.java @@ -22,7 +22,7 @@ package appeng.tile.networking; import java.util.EnumSet; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.EmptyHandler; @@ -72,9 +72,9 @@ public class TileController extends AENetworkPowerTile public void onNeighborChange( final boolean force ) { - final boolean xx = this.checkController( this.pos.offset( EnumFacing.EAST ) ) && this.checkController( this.pos.offset( EnumFacing.WEST ) ); - final boolean yy = this.checkController( this.pos.offset( EnumFacing.UP ) ) && this.checkController( this.pos.offset( EnumFacing.DOWN ) ); - final boolean zz = this.checkController( this.pos.offset( EnumFacing.NORTH ) ) && this.checkController( this.pos.offset( EnumFacing.SOUTH ) ); + final boolean xx = this.checkController( this.pos.offset( Direction.EAST ) ) && this.checkController( this.pos.offset( Direction.WEST ) ); + final boolean yy = this.checkController( this.pos.offset( Direction.UP ) ) && this.checkController( this.pos.offset( Direction.DOWN ) ); + final boolean zz = this.checkController( this.pos.offset( Direction.NORTH ) ) && this.checkController( this.pos.offset( Direction.SOUTH ) ); // int meta = world.getBlockMetadata( xCoord, yCoord, zCoord ); // boolean hasPower = meta > 0; @@ -88,11 +88,11 @@ public class TileController extends AENetworkPowerTile { if( this.isValid ) { - this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.allOf( Direction.class ) ); } else { - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); } this.updateMeta(); diff --git a/src/main/java/appeng/tile/networking/TileEnergyCell.java b/src/main/java/appeng/tile/networking/TileEnergyCell.java index 525ef0cce..b699b5366 100644 --- a/src/main/java/appeng/tile/networking/TileEnergyCell.java +++ b/src/main/java/appeng/tile/networking/TileEnergyCell.java @@ -19,7 +19,7 @@ package appeng.tile.networking; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; @@ -99,7 +99,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setDouble( "internalCurrentPower", this.internalCurrentPower ); @@ -107,7 +107,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.internalCurrentPower = data.getDouble( "internalCurrentPower" ); @@ -120,7 +120,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage } @Override - public void uploadSettings( final SettingsFrom from, final NBTTagCompound compound ) + public void uploadSettings( final SettingsFrom from, final CompoundNBT compound ) { if( from == SettingsFrom.DISMANTLE_ITEM ) { @@ -129,11 +129,11 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage } @Override - public NBTTagCompound downloadSettings( final SettingsFrom from ) + public CompoundNBT downloadSettings( final SettingsFrom from ) { if( from == SettingsFrom.DISMANTLE_ITEM ) { - final NBTTagCompound tag = new NBTTagCompound(); + final CompoundNBT tag = new CompoundNBT(); tag.setDouble( "internalCurrentPower", this.internalCurrentPower ); tag.setDouble( "internalMaxPower", this.getInternalMaxPower() ); // used for tool tip. return tag; diff --git a/src/main/java/appeng/tile/networking/TileWireless.java b/src/main/java/appeng/tile/networking/TileWireless.java index 3c9d401c9..c230a1a8f 100644 --- a/src/main/java/appeng/tile/networking/TileWireless.java +++ b/src/main/java/appeng/tile/networking/TileWireless.java @@ -25,7 +25,7 @@ import java.util.EnumSet; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.items.IItemHandler; import appeng.api.AEApi; @@ -62,11 +62,11 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi { this.inv.setFilter( new AEItemDefinitionFilter( AEApi.instance().definitions().materials().wirelessBooster() ) ); this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); } @Override - public void setOrientation( final EnumFacing inForward, final EnumFacing inUp ) + public void setOrientation( final Direction inForward, final Direction inUp ) { super.setOrientation( inForward, inUp ); this.getProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) ); diff --git a/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java b/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java index 719d522eb..f0af7364d 100644 --- a/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java +++ b/src/main/java/appeng/tile/powersink/AEBasePoweredTile.java @@ -23,8 +23,8 @@ import java.util.EnumSet; import javax.annotation.Nullable; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.energy.IEnergyStorage; @@ -50,7 +50,7 @@ public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowe private AccessRestriction internalPowerFlow = AccessRestriction.READ_WRITE; // the current power buffer. private double internalCurrentPower = 0; - private EnumSet internalPowerSides = EnumSet.allOf( EnumFacing.class ); + private EnumSet internalPowerSides = EnumSet.allOf( Direction.class ); private final IEnergyStorage forgeEnergyAdapter; private Object teslaEnergyAdapter; @@ -67,12 +67,12 @@ public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowe this.ic2Sink.setValidFaces( this.internalPowerSides ); } - protected EnumSet getPowerSides() + protected EnumSet getPowerSides() { return this.internalPowerSides.clone(); } - protected void setPowerSides( final EnumSet sides ) + protected void setPowerSides( final EnumSet sides ) { this.internalPowerSides = sides; this.ic2Sink.setValidFaces( sides ); @@ -80,7 +80,7 @@ public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowe } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setDouble( "internalCurrentPower", this.getInternalCurrentPower() ); @@ -88,7 +88,7 @@ public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowe } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.setInternalCurrentPower( data.getDouble( "internalCurrentPower" ) ); @@ -268,7 +268,7 @@ public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowe } @Override - public boolean hasCapability( Capability capability, EnumFacing facing ) + public boolean hasCapability( Capability capability, Direction facing ) { if( capability == Capabilities.FORGE_ENERGY ) { @@ -290,7 +290,7 @@ public abstract class AEBasePoweredTile extends AEBaseInvTile implements IAEPowe @SuppressWarnings( "unchecked" ) @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { if( capability == Capabilities.FORGE_ENERGY ) { diff --git a/src/main/java/appeng/tile/powersink/TeslaEnergyAdapter.java b/src/main/java/appeng/tile/powersink/TeslaEnergyAdapter.java deleted file mode 100644 index 02b63239a..000000000 --- a/src/main/java/appeng/tile/powersink/TeslaEnergyAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.tile.powersink; - - -import net.darkhax.tesla.api.ITeslaConsumer; - -import appeng.api.config.Actionable; -import appeng.api.config.PowerUnits; - - -/** - * Adapts an {@link IExternalPowerSink} to Forges {@link net.darkhax.tesla.api.ITeslaConsumer}. - */ -class TeslaEnergyAdapter implements ITeslaConsumer -{ - - private final IExternalPowerSink sink; - - TeslaEnergyAdapter( IExternalPowerSink sink ) - { - this.sink = sink; - } - - @Override - public long givePower( long power, boolean simulated ) - { - // Cut it down to what we can represent in a double - double offeredPower = power; - - final double overflow = this.sink.injectExternalPower( PowerUnits.RF, offeredPower, simulated ? Actionable.SIMULATE : Actionable.MODULATE ); - - return (long) ( power - overflow ); - } -} diff --git a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java index e4d95c1fd..4a6885d8d 100644 --- a/src/main/java/appeng/tile/qnb/TileQuantumBridge.java +++ b/src/main/java/appeng/tile/qnb/TileQuantumBridge.java @@ -27,9 +27,9 @@ import io.netty.buffer.ByteBuf; import net.minecraft.block.Block; 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.ITickable; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.wrapper.EmptyHandler; @@ -67,7 +67,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock public TileQuantumBridge() { - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); this.getProxy().setFlags( GridFlags.DENSE_CAPACITY ); this.getProxy().setIdlePowerUsage( 22 ); } @@ -130,7 +130,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock } @Override - protected IItemHandler getItemHandlerForSide( EnumFacing side ) + protected IItemHandler getItemHandlerForSide( Direction side ) { if( this.isCenter() ) { @@ -206,7 +206,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock if( affectWorld ) { - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); } } @@ -236,8 +236,8 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock if( this.isCorner() || this.isCenter() ) { - final EnumSet sides = EnumSet.noneOf( EnumFacing.class ); - for( final EnumFacing dir : this.getAdjacentQuantumBridges() ) + final EnumSet sides = EnumSet.noneOf( Direction.class ); + for( final Direction dir : this.getAdjacentQuantumBridges() ) { sides.add( dir ); } @@ -246,7 +246,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock } else { - this.getProxy().setValidSides( EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.allOf( Direction.class ) ); } } } @@ -256,11 +256,11 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock return ( this.constructed & this.getCorner() ) == this.getCorner() && this.constructed != -1; } - public EnumSet getAdjacentQuantumBridges() + public EnumSet getAdjacentQuantumBridges() { - final EnumSet set = EnumSet.noneOf( EnumFacing.class ); + final EnumSet set = EnumSet.noneOf( Direction.class ); - for( final EnumFacing d : EnumFacing.values() ) + for( final Direction d : Direction.values() ) { final TileEntity te = this.world.getTileEntity( this.pos.offset( d ) ); if( te instanceof TileQuantumBridge ) @@ -277,7 +277,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock final ItemStack is = this.internalInventory.getStackInSlot( 0 ); if( !is.isEmpty() ) { - final NBTTagCompound c = is.getTagCompound(); + final CompoundNBT c = is.getTagCompound(); if( c != null ) { return c.getLong( "freq" ); diff --git a/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java b/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java index f61d1ffb4..c38d9c6d2 100644 --- a/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java +++ b/src/main/java/appeng/tile/spatial/TileSpatialIOPort.java @@ -22,8 +22,8 @@ package appeng.tile.spatial; import javax.annotation.Nonnull; 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.world.World; import net.minecraftforge.items.IItemHandler; @@ -65,7 +65,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setInteger( "lastRedstoneState", this.lastRedstoneState.ordinal() ); @@ -73,7 +73,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); if( data.hasKey( "lastRedstoneState" ) ) @@ -182,7 +182,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl } @Override - protected @Nonnull IItemHandler getItemHandlerForSide( @Nonnull EnumFacing side ) + protected @Nonnull IItemHandler getItemHandlerForSide( @Nonnull Direction side ) { return this.invExt; } diff --git a/src/main/java/appeng/tile/spatial/TileSpatialPylon.java b/src/main/java/appeng/tile/spatial/TileSpatialPylon.java index d3bf6101f..5ed878ff1 100644 --- a/src/main/java/appeng/tile/spatial/TileSpatialPylon.java +++ b/src/main/java/appeng/tile/spatial/TileSpatialPylon.java @@ -24,7 +24,7 @@ import java.util.EnumSet; import io.netty.buffer.ByteBuf; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import appeng.api.networking.GridFlags; import appeng.api.networking.events.MENetworkChannelsChanged; @@ -63,7 +63,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock { this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL, GridFlags.MULTIBLOCK ); this.getProxy().setIdlePowerUsage( 0.5 ); - this.getProxy().setValidSides( EnumSet.noneOf( EnumFacing.class ) ); + this.getProxy().setValidSides( EnumSet.noneOf( Direction.class ) ); } @Override @@ -123,7 +123,7 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock public void updateStatus( final SpatialPylonCluster c ) { this.cluster = c; - this.getProxy().setValidSides( c == null ? EnumSet.noneOf( EnumFacing.class ) : EnumSet.allOf( EnumFacing.class ) ); + this.getProxy().setValidSides( c == null ? EnumSet.noneOf( Direction.class ) : EnumSet.allOf( Direction.class ) ); this.recalculateDisplay(); } diff --git a/src/main/java/appeng/tile/storage/TileChest.java b/src/main/java/appeng/tile/storage/TileChest.java index f552db406..ceaa2873f 100644 --- a/src/main/java/appeng/tile/storage/TileChest.java +++ b/src/main/java/appeng/tile/storage/TileChest.java @@ -28,10 +28,10 @@ import javax.annotation.Nullable; 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 net.minecraft.util.ITickable; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.fluids.Fluid; @@ -431,7 +431,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.config.readFromNBT( data ); @@ -443,7 +443,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.config.writeToNBT( data ); @@ -516,7 +516,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal } @Override - protected IItemHandler getItemHandlerForSide( @Nonnull EnumFacing side ) + protected IItemHandler getItemHandlerForSide( @Nonnull Direction side ) { if( side == this.getForward() ) { @@ -616,7 +616,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal } - public boolean openGui( final EntityPlayer p ) + public boolean openGui( final PlayerEntity p ) { this.updateHandler(); if( this.cellHandler != null ) @@ -645,7 +645,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal } @Override - public boolean recolourBlock( final EnumFacing side, final AEColor newPaintedColor, final EntityPlayer who ) + public boolean recolourBlock( final Direction side, final AEColor newPaintedColor, final PlayerEntity who ) { if( this.paintedColor == newPaintedColor ) { @@ -745,7 +745,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal return super.injectItems( input, mode, src ); } - private boolean securityCheck( final EntityPlayer player, final SecurityPermissions requiredPermission ) + private boolean securityCheck( final PlayerEntity player, final SecurityPermissions requiredPermission ) { if( TileChest.this.getTile() instanceof IActionHost && requiredPermission != null ) { @@ -791,7 +791,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal } @Override - public boolean hasCapability( Capability capability, EnumFacing facing ) + public boolean hasCapability( Capability capability, Direction facing ) { this.updateHandler(); if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && this.fluidHandler != null && facing != this.getForward() ) @@ -807,7 +807,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, ITerminal @SuppressWarnings( "unchecked" ) @Override - public T getCapability( Capability capability, @Nullable EnumFacing facing ) + public T getCapability( Capability capability, @Nullable Direction facing ) { this.updateHandler(); if( capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY && this.fluidHandler != null && facing != this.getForward() ) diff --git a/src/main/java/appeng/tile/storage/TileDrive.java b/src/main/java/appeng/tile/storage/TileDrive.java index c57d8cd01..4fb00a46a 100644 --- a/src/main/java/appeng/tile/storage/TileDrive.java +++ b/src/main/java/appeng/tile/storage/TileDrive.java @@ -30,7 +30,7 @@ import java.util.Map; import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.IItemHandler; import appeng.api.AEApi; @@ -172,7 +172,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.isCached = false; @@ -180,7 +180,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); data.setInteger( "priority", this.priority ); diff --git a/src/main/java/appeng/tile/storage/TileIOPort.java b/src/main/java/appeng/tile/storage/TileIOPort.java index 52c0cfc54..b79a3bf0d 100644 --- a/src/main/java/appeng/tile/storage/TileIOPort.java +++ b/src/main/java/appeng/tile/storage/TileIOPort.java @@ -25,8 +25,8 @@ import java.util.Map; import net.minecraft.block.Block; 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.World; import net.minecraftforge.items.IItemHandler; @@ -110,7 +110,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC } @Override - public NBTTagCompound writeToNBT( final NBTTagCompound data ) + public CompoundNBT writeToNBT( final CompoundNBT data ) { super.writeToNBT( data ); this.manager.writeToNBT( data ); @@ -120,7 +120,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC } @Override - public void readFromNBT( final NBTTagCompound data ) + public void readFromNBT( final CompoundNBT data ) { super.readFromNBT( data ); this.manager.readFromNBT( data ); @@ -251,7 +251,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC } @Override - protected IItemHandler getItemHandlerForSide( final EnumFacing facing ) + protected IItemHandler getItemHandlerForSide( final Direction facing ) { if( facing == this.getUp() || facing == this.getUp().getOpposite() ) { diff --git a/src/main/java/appeng/tile/storage/TileSkyChest.java b/src/main/java/appeng/tile/storage/TileSkyChest.java index 2ea8923f5..fc722b436 100644 --- a/src/main/java/appeng/tile/storage/TileSkyChest.java +++ b/src/main/java/appeng/tile/storage/TileSkyChest.java @@ -23,7 +23,7 @@ import java.io.IOException; import io.netty.buffer.ByteBuf; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.ITickable; @@ -86,7 +86,7 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable return this.inv; } - public void openInventory( final EntityPlayer player ) + public void openInventory( final PlayerEntity player ) { if( !player.isSpectator() ) { @@ -105,7 +105,7 @@ public class TileSkyChest extends AEBaseInvTile implements ITickable } } - public void closeInventory( final EntityPlayer player ) + public void closeInventory( final PlayerEntity player ) { if( !player.isSpectator() ) { diff --git a/src/main/java/appeng/util/BlockUpdate.java b/src/main/java/appeng/util/BlockUpdate.java index 3efafc862..23fc29510 100644 --- a/src/main/java/appeng/util/BlockUpdate.java +++ b/src/main/java/appeng/util/BlockUpdate.java @@ -37,7 +37,7 @@ public class BlockUpdate implements IWorldCallable { if( world.isBlockLoaded( this.pos ) ) { - world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK, true ); + world.notifyNeighborsOfStateChange( this.pos, Platform.AIR_BLOCK ); } return true; diff --git a/src/main/java/appeng/util/ConfigManager.java b/src/main/java/appeng/util/ConfigManager.java index c4c33a92e..2b4eeb6d1 100644 --- a/src/main/java/appeng/util/ConfigManager.java +++ b/src/main/java/appeng/util/ConfigManager.java @@ -23,7 +23,7 @@ import java.util.EnumMap; import java.util.Map; import java.util.Set; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.config.LevelEmitterMode; import appeng.api.config.Settings; @@ -82,11 +82,11 @@ public final class ConfigManager implements IConfigManager * @param tagCompound to be written to compound */ @Override - public void writeToNBT( final NBTTagCompound tagCompound ) + public void writeToNBT( final CompoundNBT tagCompound ) { for( final Map.Entry> entry : this.settings.entrySet() ) { - tagCompound.setString( entry.getKey().name(), this.settings.get( entry.getKey() ).toString() ); + tagCompound.putString( entry.getKey().name(), this.settings.get( entry.getKey() ).toString() ); } } @@ -96,13 +96,13 @@ public final class ConfigManager implements IConfigManager * @param tagCompound to be read from compound */ @Override - public void readFromNBT( final NBTTagCompound tagCompound ) + public void readFromNBT( final CompoundNBT tagCompound ) { for( final Map.Entry> entry : this.settings.entrySet() ) { try { - if( tagCompound.hasKey( entry.getKey().name() ) ) + if( tagCompound.contains( entry.getKey().name() ) ) { String value = tagCompound.getString( entry.getKey().name() ); diff --git a/src/main/java/appeng/util/InWorldToolOperationResult.java b/src/main/java/appeng/util/InWorldToolOperationResult.java index 6df11be61..43f2a23fa 100644 --- a/src/main/java/appeng/util/InWorldToolOperationResult.java +++ b/src/main/java/appeng/util/InWorldToolOperationResult.java @@ -22,16 +22,16 @@ package appeng.util; import java.util.ArrayList; import java.util.List; +import net.minecraft.block.AirBlock; import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; public class InWorldToolOperationResult { - private final IBlockState blockState; + private final BlockState blockState; private final List drops; public InWorldToolOperationResult() @@ -40,13 +40,13 @@ public class InWorldToolOperationResult this.drops = null; } - public InWorldToolOperationResult( final IBlockState block, final List drops ) + public InWorldToolOperationResult( final BlockState block, final List drops ) { this.blockState = block; this.drops = drops; } - public InWorldToolOperationResult( final IBlockState block ) + public InWorldToolOperationResult( final BlockState block ) { this.blockState = block; this.drops = null; @@ -55,7 +55,7 @@ public class InWorldToolOperationResult public static InWorldToolOperationResult getBlockOperationResult( final ItemStack[] items ) { final List temp = new ArrayList<>(); - IBlockState b = null; + BlockState b = null; for( final ItemStack l : items ) { @@ -63,7 +63,7 @@ public class InWorldToolOperationResult { final Block bl = Block.getBlockFromItem( l.getItem() ); - if( bl != null && !( bl instanceof BlockAir ) ) + if( bl != null && !( bl instanceof AirBlock ) ) { b = bl.getDefaultState(); continue; @@ -76,7 +76,7 @@ public class InWorldToolOperationResult return new InWorldToolOperationResult( b, temp ); } - public IBlockState getBlockState() + public BlockState getBlockState() { return this.blockState; } diff --git a/src/main/java/appeng/util/InventoryAdaptor.java b/src/main/java/appeng/util/InventoryAdaptor.java index 07b330d29..bf47ca2c5 100644 --- a/src/main/java/appeng/util/InventoryAdaptor.java +++ b/src/main/java/appeng/util/InventoryAdaptor.java @@ -19,10 +19,10 @@ package appeng.util; -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.EnumFacing; +import net.minecraft.util.Direction; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -41,9 +41,9 @@ import appeng.util.inv.ItemSlot; */ public abstract class InventoryAdaptor implements Iterable { - public static InventoryAdaptor getAdaptor( final TileEntity te, final EnumFacing d ) + public static InventoryAdaptor getAdaptor( final TileEntity te, final Direction d ) { - if( te != null && te.hasCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d ) ) + if( te != null && te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d ) ) { // Attempt getting an IItemHandler for the given side via caps IItemHandler itemHandler = te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d ); @@ -55,7 +55,7 @@ public abstract class InventoryAdaptor implements Iterable return null; } - public static InventoryAdaptor getAdaptor( final EntityPlayer te ) + public static InventoryAdaptor getAdaptor( final PlayerEntity te ) { if( te != null ) { diff --git a/src/main/java/appeng/util/Platform.java b/src/main/java/appeng/util/Platform.java index 03ccfd0d4..968497fd6 100644 --- a/src/main/java/appeng/util/Platform.java +++ b/src/main/java/appeng/util/Platform.java @@ -36,45 +36,42 @@ import com.google.common.base.Preconditions; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerEntityMP; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.play.server.SPacketChunkData; import net.minecraft.server.management.PlayerChunkMap; import net.minecraft.server.management.PlayerChunkMapEntry; 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.util.math.MathHelper; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.util.registry.RegistryNamespaced; -import net.minecraft.util.text.translation.I18n; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.server.ServerWorld; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.FakePlayerFactory; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.common.FMLCommonHandler; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; @@ -136,9 +133,6 @@ import appeng.util.prioritylist.IPartitionList; */ public class Platform { - - public static final Block AIR_BLOCK = Blocks.AIR; - public static final int DEF_OFFSET = 16; private static final boolean CLIENT_INSTALL = FMLCommonHandler.instance().getSide().isClient(); @@ -147,7 +141,7 @@ public class Platform * random source, use it for item drop locations... */ private static final Random RANDOM_GENERATOR = new Random(); - private static final WeakHashMap FAKE_PLAYERS = new WeakHashMap<>(); + private static final WeakHashMap FAKE_PLAYERS = new WeakHashMap<>(); // private static Method getEntry; private static final ItemComparisonHelper ITEM_COMPARISON_HELPER = new ItemComparisonHelper(); @@ -231,7 +225,7 @@ public class Platform return AEPartLocation.INTERNAL; } - public static EnumFacing crossProduct( final EnumFacing forward, final EnumFacing up ) + public static Direction crossProduct( final Direction forward, final Direction up ) { final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY(); final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ(); @@ -240,23 +234,23 @@ public class Platform switch( west_x + west_y * 2 + west_z * 3 ) { case 1: - return EnumFacing.EAST; + return Direction.EAST; case -1: - return EnumFacing.WEST; + return Direction.WEST; case 2: - return EnumFacing.UP; + return Direction.UP; case -2: - return EnumFacing.DOWN; + return Direction.DOWN; case 3: - return EnumFacing.SOUTH; + return Direction.SOUTH; case -3: - return EnumFacing.NORTH; + return Direction.NORTH; } // something is better then nothing? - return EnumFacing.NORTH; + return Direction.NORTH; } public static T rotateEnum( T ce, final boolean backwards, final EnumSet validOptions ) @@ -355,7 +349,7 @@ public class Platform return false; } - public static void openGUI( @Nonnull final EntityPlayer p, @Nullable final TileEntity tile, @Nullable final AEPartLocation side, @Nonnull final GuiBridge type ) + public static void openGUI( @Nonnull final PlayerEntity p, @Nullable final TileEntity tile, @Nullable final AEPartLocation side, @Nonnull final GuiBridge type ) { if( isClient() ) { @@ -405,7 +399,7 @@ public class Platform return CLIENT_INSTALL; } - public static boolean hasPermissions( final DimensionalCoord dc, final EntityPlayer player ) + public static boolean hasPermissions( final DimensionalCoord dc, final PlayerEntity player ) { return dc.getWorld().canMineBlockBody( player, dc.getPos() ); } @@ -428,7 +422,7 @@ public class Platform public static ItemStack[] getBlockDrops( final World w, final BlockPos pos ) { List out = new ArrayList<>(); - final IBlockState state = w.getBlockState( pos ); + final BlockState state = w.getBlockState( pos ); if( state != null ) { @@ -491,13 +485,13 @@ public class Platform /* * Creates / or loads previous NBT Data on items, used for editing items owned by AE. */ - public static NBTTagCompound openNbtData( final ItemStack i ) + public static CompoundNBT openNbtData( final ItemStack i ) { - NBTTagCompound compound = i.getTagCompound(); + CompoundNBT compound = i.getTagCompound(); if( compound == null ) { - i.setTagCompound( compound = new NBTTagCompound() ); + i.setTagCompound( compound = new CompoundNBT() ); } return compound; @@ -567,7 +561,7 @@ public class Platform return CraftingManager.findMatchingResult( ic, world ); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public static List getTooltip( final Object o ) { if( o == null ) @@ -594,7 +588,7 @@ public class Platform { ITooltipFlag.TooltipFlags tooltipFlag = Minecraft .getMinecraft().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL; - return itemStack.getTooltip( Minecraft.getMinecraft().player, tooltipFlag ); + return itemStack.getTooltip( Minecraft.getInstance().player, tooltipFlag ); } catch( final Exception errB ) { @@ -651,7 +645,7 @@ public class Platform String name = itemStack.getDisplayName(); if( name == null || name.isEmpty() ) { - name = itemStack.getItem().getUnlocalizedName( itemStack ); + name = itemStack.getItem().getTranslationKey( itemStack ); } return name == null ? "** Null" : name; } @@ -659,7 +653,7 @@ public class Platform { try { - final String n = itemStack.getUnlocalizedName(); + final String n = itemStack.getTranslationKey(); return n == null ? "** Null" : n; } catch( final Exception errB ) @@ -691,12 +685,12 @@ public class Platform String n = fluidStack.getLocalizedName(); if( n == null || "".equalsIgnoreCase( n ) ) { - n = fluidStack.getUnlocalizedName(); + n = fluidStack.getTranslationKey(); } return n == null ? "** Null" : n; } - public static boolean isWrench( final EntityPlayer player, final ItemStack eq, final BlockPos pos ) + public static boolean isWrench( final PlayerEntity player, final ItemStack eq, final BlockPos pos ) { if( !eq.isEmpty() ) { @@ -744,20 +738,20 @@ public class Platform return false; } - public static EntityPlayer getPlayer( final WorldServer w ) + public static PlayerEntity getPlayer( final ServerWorld w ) { if( w == null ) { throw new InvalidParameterException( "World is null." ); } - final EntityPlayer wrp = FAKE_PLAYERS.get( w ); + final PlayerEntity wrp = FAKE_PLAYERS.get( w ); if( wrp != null ) { return wrp; } - final EntityPlayer p = FakePlayerFactory.getMinecraft( w ); + final PlayerEntity p = FakePlayerFactory.getMinecraft( w ); FAKE_PLAYERS.put( w, p ); return p; } @@ -942,7 +936,7 @@ public class Platform return forward; } - public static EnumFacing rotateAround( final EnumFacing forward, final EnumFacing axis ) + public static Direction rotateAround( final Direction forward, final Direction axis ) { switch( forward ) { @@ -954,13 +948,13 @@ public class Platform case UP: return forward; case NORTH: - return EnumFacing.EAST; + return Direction.EAST; case SOUTH: - return EnumFacing.WEST; + return Direction.WEST; case EAST: - return EnumFacing.NORTH; + return Direction.NORTH; case WEST: - return EnumFacing.SOUTH; + return Direction.SOUTH; default: break; } @@ -969,13 +963,13 @@ public class Platform switch( axis ) { case NORTH: - return EnumFacing.WEST; + return Direction.WEST; case SOUTH: - return EnumFacing.EAST; + return Direction.EAST; case EAST: - return EnumFacing.SOUTH; + return Direction.SOUTH; case WEST: - return EnumFacing.NORTH; + return Direction.NORTH; default: break; } @@ -984,13 +978,13 @@ public class Platform switch( axis ) { case UP: - return EnumFacing.WEST; + return Direction.WEST; case DOWN: - return EnumFacing.EAST; + return Direction.EAST; case EAST: - return EnumFacing.UP; + return Direction.UP; case WEST: - return EnumFacing.DOWN; + return Direction.DOWN; default: break; } @@ -999,13 +993,13 @@ public class Platform switch( axis ) { case UP: - return EnumFacing.EAST; + return Direction.EAST; case DOWN: - return EnumFacing.WEST; + return Direction.WEST; case EAST: - return EnumFacing.DOWN; + return Direction.DOWN; case WEST: - return EnumFacing.UP; + return Direction.UP; default: break; } @@ -1014,13 +1008,13 @@ public class Platform switch( axis ) { case UP: - return EnumFacing.NORTH; + return Direction.NORTH; case DOWN: - return EnumFacing.SOUTH; + return Direction.SOUTH; case NORTH: - return EnumFacing.UP; + return Direction.UP; case SOUTH: - return EnumFacing.DOWN; + return Direction.DOWN; default: break; } @@ -1028,13 +1022,13 @@ public class Platform switch( axis ) { case UP: - return EnumFacing.SOUTH; + return Direction.SOUTH; case DOWN: - return EnumFacing.NORTH; + return Direction.NORTH; case NORTH: - return EnumFacing.DOWN; + return Direction.DOWN; case SOUTH: - return EnumFacing.UP; + return Direction.UP; default: break; } @@ -1044,13 +1038,13 @@ public class Platform return forward; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public static String gui_localize( final String string ) { return I18n.translateToLocal( string ); } - public static LookDirection getPlayerRay( final EntityPlayer playerIn, final float eyeOffset ) + public static LookDirection getPlayerRay( final PlayerEntity playerIn, final float eyeOffset ) { double reachDistance = 5.0d; @@ -1069,9 +1063,9 @@ public class Platform final float eyeRayX = yawRayX * pitchMultiplier; final float eyeRayZ = yawRayZ * pitchMultiplier; - if( playerIn instanceof EntityPlayerMP ) + if( playerIn instanceof PlayerEntityMP ) { - reachDistance = ( (EntityPlayerMP) playerIn ).interactionManager.getBlockReachDistance(); + reachDistance = ( (PlayerEntityMP) playerIn ).interactionManager.getBlockReachDistance(); } final Vec3d from = new Vec3d( x, y, z ); @@ -1080,7 +1074,7 @@ public class Platform return new LookDirection( from, to ); } - public static RayTraceResult rayTrace( final EntityPlayer p, final boolean hitBlocks, final boolean hitEntities ) + public static RayTraceResult rayTrace( final PlayerEntity p, final boolean hitBlocks, final boolean hitEntities ) { final World w = p.getEntityWorld(); @@ -1415,7 +1409,7 @@ public class Platform return gs.hasPermission( playerID, SecurityPermissions.BUILD ); } - public static void configurePlayer( final EntityPlayer player, final AEPartLocation side, final TileEntity tile ) + public static void configurePlayer( final PlayerEntity player, final AEPartLocation side, final TileEntity tile ) { float pitch = 0.0f; float yaw = 0.0f; @@ -1654,7 +1648,7 @@ public class Platform } } - public static float getEyeOffset( final EntityPlayer player ) + public static float getEyeOffset( final PlayerEntity player ) { assert player.world.isRemote : "Valid only on client"; return (float) ( player.posY + player.getEyeHeight() - player.getDefaultEyeHeight() ); @@ -1662,7 +1656,7 @@ public class Platform // public static void addStat( final int playerID, final Achievement achievement ) // { - // final EntityPlayer p = AEApi.instance().registries().players().findPlayer( playerID ); + // final PlayerEntity p = AEApi.instance().registries().players().findPlayer( playerID ); // if( p != null ) // { // p.addStat( achievement, 1 ); diff --git a/src/main/java/appeng/util/helpers/ItemComparisonHelper.java b/src/main/java/appeng/util/helpers/ItemComparisonHelper.java index b65c50f03..641149192 100644 --- a/src/main/java/appeng/util/helpers/ItemComparisonHelper.java +++ b/src/main/java/appeng/util/helpers/ItemComparisonHelper.java @@ -23,8 +23,7 @@ import javax.annotation.Nonnull; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraftforge.oredict.OreDictionary; +import net.minecraft.nbt.CompoundNBT; import appeng.api.config.FuzzyMode; import appeng.util.item.OreHelper; @@ -50,15 +49,7 @@ public class ItemComparisonHelper */ public boolean isEqualItemType( @Nonnull final ItemStack that, @Nonnull final ItemStack other ) { - if( !that.isEmpty() && !other.isEmpty() && that.getItem() == other.getItem() ) - { - if( that.isItemStackDamageable() ) - { - return true; - } - return that.getItemDamage() == other.getItemDamage(); - } - return false; + return !that.isEmpty() && !other.isEmpty() && that.getItem() == other.getItem(); } /** @@ -71,7 +62,7 @@ public class ItemComparisonHelper */ public boolean isSameItem( @Nonnull final ItemStack is, @Nonnull final ItemStack filter ) { - return ItemStack.areItemsEqual( is, filter ) && this.isNbtTagEqual( is.getTagCompound(), filter.getTagCompound() ); + return ItemStack.areItemsEqual( is, filter ) && this.isNbtTagEqual( is.getTag(), filter.getTag() ); } /** @@ -103,12 +94,12 @@ public class ItemComparisonHelper } else if( mode == FuzzyMode.PERCENT_99 ) { - return ( a.getItemDamage() > 1 ) == ( b.getItemDamage() > 1 ); + return ( a.getDamage() > 1 ) == ( b.getDamage() > 1 ); } else { - final float percentDamagedOfA = (float) a.getItemDamage() / (float) a.getMaxDamage(); - final float percentDamagedOfB = (float) b.getItemDamage() / (float) b.getMaxDamage(); + final float percentDamagedOfA = (float) a.getDamage() / a.getMaxDamage(); + final float percentDamagedOfB = (float) b.getDamage() / b.getMaxDamage(); return ( percentDamagedOfA > mode.breakPoint ) == ( percentDamagedOfB > mode.breakPoint ); } @@ -130,15 +121,15 @@ public class ItemComparisonHelper * then the vanilla version which likes to fail when NBT Compound data changes order, it is pretty expensive * performance wise, so try an use shared tag compounds as long as the system remains in AE. */ - public boolean isNbtTagEqual( final NBTBase left, final NBTBase right ) + public boolean isNbtTagEqual( final CompoundNBT left, final CompoundNBT right ) { if( left == right ) { return true; } - final boolean isLeftEmpty = left == null || left.hasNoTags(); - final boolean isRightEmpty = right == null || right.hasNoTags(); + final boolean isLeftEmpty = left == null || left.isEmpty(); + final boolean isRightEmpty = right == null || right.isEmpty(); if( isLeftEmpty && isRightEmpty ) { diff --git a/src/main/java/appeng/util/helpers/ItemHandlerUtil.java b/src/main/java/appeng/util/helpers/ItemHandlerUtil.java index 3dcffb3b0..394302a4b 100644 --- a/src/main/java/appeng/util/helpers/ItemHandlerUtil.java +++ b/src/main/java/appeng/util/helpers/ItemHandlerUtil.java @@ -19,7 +19,7 @@ package appeng.util.helpers; -import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.inventory.CraftingInventory; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; @@ -72,7 +72,7 @@ public class ItemHandlerUtil } } - public static void copy( final InventoryCrafting from, final IItemHandler to, boolean deepCopy ) + public static void copy( final CraftingInventory from, final IItemHandler to, boolean deepCopy ) { for( int i = 0; i < Math.min( from.getSizeInventory(), to.getSlots() ); ++i ) { diff --git a/src/main/java/appeng/util/inv/AdaptorItemHandlerPlayerInv.java b/src/main/java/appeng/util/inv/AdaptorItemHandlerPlayerInv.java index df8a5aacd..943fdaa70 100644 --- a/src/main/java/appeng/util/inv/AdaptorItemHandlerPlayerInv.java +++ b/src/main/java/appeng/util/inv/AdaptorItemHandlerPlayerInv.java @@ -19,7 +19,7 @@ package appeng.util.inv; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraftforge.items.wrapper.PlayerMainInvWrapper; @@ -28,7 +28,7 @@ import appeng.util.Platform; public class AdaptorItemHandlerPlayerInv extends AdaptorItemHandler { - public AdaptorItemHandlerPlayerInv( final EntityPlayer playerInv ) + public AdaptorItemHandlerPlayerInv( final PlayerEntity playerInv ) { super( new PlayerMainInvWrapper( playerInv.inventory ) ); } diff --git a/src/main/java/appeng/util/inv/WrapperCursorItemHandler.java b/src/main/java/appeng/util/inv/WrapperCursorItemHandler.java index 3196c0a10..c7f9f733b 100644 --- a/src/main/java/appeng/util/inv/WrapperCursorItemHandler.java +++ b/src/main/java/appeng/util/inv/WrapperCursorItemHandler.java @@ -19,20 +19,20 @@ package appeng.util.inv; -import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.entity.player.PlayerInventory; import net.minecraftforge.items.ItemStackHandler; public class WrapperCursorItemHandler extends ItemStackHandler { - private final InventoryPlayer inv; + private final PlayerInventory inv; - public WrapperCursorItemHandler( InventoryPlayer inventoryPlayer ) + public WrapperCursorItemHandler( PlayerInventory PlayerInventory ) { super( 1 ); - this.inv = inventoryPlayer; - this.setStackInSlot( 0, inventoryPlayer.getItemStack() ); + this.inv = PlayerInventory; + this.setStackInSlot( 0, PlayerInventory.getItemStack() ); } @Override diff --git a/src/main/java/appeng/util/inv/WrapperInvItemHandler.java b/src/main/java/appeng/util/inv/WrapperInvItemHandler.java index df85079e7..af6c575a8 100644 --- a/src/main/java/appeng/util/inv/WrapperInvItemHandler.java +++ b/src/main/java/appeng/util/inv/WrapperInvItemHandler.java @@ -19,7 +19,7 @@ package appeng.util.inv; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; @@ -109,19 +109,19 @@ public class WrapperInvItemHandler implements IInventory } @Override - public boolean isUsableByPlayer( EntityPlayer player ) + public boolean isUsableByPlayer( PlayerEntity player ) { return false; } @Override - public void openInventory( EntityPlayer player ) + public void openInventory( PlayerEntity player ) { // NOP } @Override - public void closeInventory( EntityPlayer player ) + public void closeInventory( PlayerEntity player ) { // NOP } diff --git a/src/main/java/appeng/util/item/AEItemStack.java b/src/main/java/appeng/util/item/AEItemStack.java index b2047f4bc..e677ed710 100644 --- a/src/main/java/appeng/util/item/AEItemStack.java +++ b/src/main/java/appeng/util/item/AEItemStack.java @@ -21,7 +21,6 @@ package appeng.util.item; import java.util.List; import java.util.Objects; -import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -30,11 +29,11 @@ import io.netty.buffer.ByteBuf; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.PacketBuffer; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.common.network.ByteBufUtils; -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.ItemHandlerHelper; import appeng.api.AEApi; @@ -48,13 +47,12 @@ import appeng.util.Platform; public final class AEItemStack extends AEStack implements IAEItemStack { private AESharedItemStack sharedStack; - private Optional oreReference; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private String displayName; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private List tooltip; - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) private ResourceLocation uniqueID; private AEItemStack( final AEItemStack is ) @@ -63,7 +61,6 @@ public final class AEItemStack extends AEStack implements IAEItemS this.setCraftable( is.isCraftable() ); this.setCountRequestable( is.getCountRequestable() ); this.sharedStack = is.sharedStack; - this.oreReference = is.oreReference; } private AEItemStack( final AESharedItemStack is, long size ) @@ -72,7 +69,6 @@ public final class AEItemStack extends AEStack implements IAEItemS this.setStackSize( size ); this.setCraftable( false ); this.setCountRequestable( 0 ); - this.oreReference = OreHelper.INSTANCE.getOre( is.getDefinition() ); } @Nullable @@ -86,14 +82,14 @@ public final class AEItemStack extends AEStack implements IAEItemS return new AEItemStack( AEItemStackRegistry.getRegisteredStack( stack ), stack.getCount() ); } - public static IAEItemStack fromNBT( final NBTTagCompound i ) + public static IAEItemStack fromNBT( final CompoundNBT i ) { if( i == null ) { return null; } - final ItemStack itemstack = new ItemStack( i ); + final ItemStack itemstack = ItemStack.read( i ); if( itemstack.isEmpty() ) { return null; @@ -107,12 +103,12 @@ public final class AEItemStack extends AEStack implements IAEItemS } @Override - public void writeToNBT( final NBTTagCompound i ) + public void writeToNBT( final CompoundNBT i ) { - this.getDefinition().writeToNBT( i ); - i.setLong( "Cnt", this.getStackSize() ); - i.setLong( "Req", this.getCountRequestable() ); - i.setBoolean( "Craft", this.isCraftable() ); + this.getDefinition().write( i ); + i.putLong( "Cnt", this.getStackSize() ); + i.putLong( "Req", this.getCountRequestable() ); + i.putBoolean( "Craft", this.isCraftable() ); } public static AEItemStack fromPacket( final ByteBuf data ) @@ -122,7 +118,8 @@ public final class AEItemStack extends AEStack implements IAEItemS final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 ); final boolean isCraftable = ( mask & 0x40 ) > 0; - final ItemStack itemstack = new ItemStack( ByteBufUtils.readTag( data ) ); + final PacketBuffer p = new PacketBuffer( data ); + final ItemStack itemstack = p.readItemStack(); final long stackSize = getPacketValue( stackType, data ); final long countRequestable = getPacketValue( countReqType, data ); @@ -138,13 +135,13 @@ public final class AEItemStack extends AEStack implements IAEItemS } @Override - public void writeToPacket( final ByteBuf i ) + public void writeToPacket( final PacketBuffer i ) { final byte mask = (byte) ( ( this.getType( this.getStackSize() ) << 2 ) | ( this .getType( this.getCountRequestable() ) << 4 ) | ( (byte) ( this.isCraftable() ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 ); i.writeByte( mask ); - ByteBufUtils.writeTag( i, this.getDefinition().serializeNBT() ); + i.writeCompoundTag( this.getDefinition().serializeNBT() ); this.putPacketValue( i, this.getStackSize() ); this.putPacketValue( i, this.getCountRequestable() ); } @@ -165,11 +162,6 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public boolean fuzzyComparison( final IAEItemStack other, final FuzzyMode mode ) { - if( mode == FuzzyMode.IGNORE_ALL && OreHelper.INSTANCE.sameOre( this, other ) ) - { - return true; - } - final ItemStack itemStack = this.getDefinition(); final ItemStack otherStack = other.getDefinition(); @@ -218,12 +210,6 @@ public final class AEItemStack extends AEStack implements IAEItemS return this.sharedStack.getItemDamage(); } - @Override - public boolean sameOre( final IAEItemStack is ) - { - return OreHelper.INSTANCE.sameOre( this, is ); - } - @Override public boolean isSameType( final IAEItemStack otherStack ) { @@ -274,10 +260,10 @@ public final class AEItemStack extends AEStack implements IAEItemS @Override public String toString() { - return this.getStackSize() + "x" + this.getDefinition().getItem().getUnlocalizedName() + "@" + this.getDefinition().getItemDamage(); + return this.getStackSize() + "x" + this.getDefinition().getItem().getRegistryName(); } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public List getToolTip() { if( this.tooltip == null ) @@ -287,7 +273,7 @@ public final class AEItemStack extends AEStack implements IAEItemS return this.tooltip; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public String getDisplayName() { if( this.displayName == null ) @@ -297,31 +283,16 @@ public final class AEItemStack extends AEStack implements IAEItemS return this.displayName; } - @SideOnly( Side.CLIENT ) + @OnlyIn( Dist.CLIENT ) public String getModID() { - if( this.uniqueID == null ) - { - this.uniqueID = Item.REGISTRY.getNameForObject( this.getDefinition().getItem() ); - } - - if( this.uniqueID == null ) - { - return "** Null"; - } - - return this.uniqueID.getResourceDomain() == null ? "** Null" : this.uniqueID.getResourceDomain(); - } - - public Optional getOre() - { - return this.oreReference; + return this.getDefinition().getItem().getRegistryName().getNamespace(); } @Override public boolean hasTagCompound() { - return this.getDefinition().hasTagCompound(); + return this.getDefinition().hasTag(); } @Override @@ -353,21 +324,18 @@ public final class AEItemStack extends AEStack implements IAEItemS } else if( mode == FuzzyMode.PERCENT_99 ) { - return ( a.getItemDamage() > 1 ) == ( b.getItemDamage() > 1 ); + return ( a.getDamage() > 1 ) == ( b.getDamage() > 1 ); } else { - final float percentDamageOfA = (float) a.getItemDamage() / (float) a.getMaxDamage(); - final float percentDamageOfB = (float) b.getItemDamage() / (float) b.getMaxDamage(); + final float percentDamageOfA = (float) a.getDamage() / a.getMaxDamage(); + final float percentDamageOfB = (float) b.getDamage() / b.getMaxDamage(); return ( percentDamageOfA > mode.breakPoint ) == ( percentDamageOfB > mode.breakPoint ); } } - - return a.getMetadata() == b.getMetadata(); } return false; } - } diff --git a/src/main/java/appeng/util/item/AESharedItemStack.java b/src/main/java/appeng/util/item/AESharedItemStack.java index 4e4aeb7b8..553605077 100644 --- a/src/main/java/appeng/util/item/AESharedItemStack.java +++ b/src/main/java/appeng/util/item/AESharedItemStack.java @@ -25,15 +25,15 @@ import com.google.common.base.Preconditions; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import appeng.api.config.FuzzyMode; final class AESharedItemStack implements Comparable { - private static final NBTTagCompound LOW_TAG = new NBTTagCompound(); - private static final NBTTagCompound HIGH_TAG = new NBTTagCompound(); + private static final CompoundNBT LOW_TAG = new CompoundNBT(); + private static final CompoundNBT HIGH_TAG = new CompoundNBT(); private final ItemStack itemStack; private final int itemId; @@ -44,7 +44,7 @@ final class AESharedItemStack implements Comparable { this.itemStack = itemStack; this.itemId = Item.getIdFromItem( itemStack.getItem() ); - this.itemDamage = itemStack.getItemDamage(); + this.itemDamage = itemStack.getDamage(); this.hashCode = this.makeHashCode(); } @@ -131,24 +131,24 @@ final class AESharedItemStack implements Comparable private int compareNBT( final ItemStack b ) { - if( this.itemStack.getTagCompound() == b.getTagCompound() ) + if( this.itemStack.getTag() == b.getTag() ) { return 0; } - if( this.itemStack.getTagCompound() == LOW_TAG || b.getTagCompound() == HIGH_TAG ) + if( this.itemStack.getTag() == LOW_TAG || b.getTag() == HIGH_TAG ) { return -1; } - if( this.itemStack.getTagCompound() == HIGH_TAG || b.getTagCompound() == LOW_TAG ) + if( this.itemStack.getTag() == HIGH_TAG || b.getTag() == LOW_TAG ) { return 1; } - return System.identityHashCode( this.itemStack.getTagCompound() ) - System.identityHashCode( b.getTagCompound() ); + return System.identityHashCode( this.itemStack.getTag() ) - System.identityHashCode( b.getTag() ); } private int makeHashCode() { - return Objects.hash( this.itemId, this.itemDamage, this.itemStack.hasTagCompound() ? this.itemStack.getTagCompound() : 0 ); + return Objects.hash( this.itemId, this.itemDamage, this.itemStack.hasTag() ? this.itemStack.getTag() : 0 ); } /** @@ -170,7 +170,7 @@ final class AESharedItemStack implements Comparable Preconditions.checkState( !stack.isEmpty(), "ItemStack#isEmpty() has to be false" ); Preconditions.checkState( stack.getCount() == 1, "ItemStack#getCount() has to be 1" ); - final NBTTagCompound tag = stack.hasTagCompound() ? stack.getTagCompound() : null; + final CompoundNBT tag = stack.hasTag() ? stack.getTag() : null; this.lower = this.makeLowerBound( stack, tag, fuzzy, ignoreMeta ); this.upper = this.makeUpperBound( stack, tag, fuzzy, ignoreMeta ); @@ -186,14 +186,14 @@ final class AESharedItemStack implements Comparable return this.upper; } - private AESharedItemStack makeLowerBound( final ItemStack itemStack, final NBTTagCompound tag, final FuzzyMode fuzzy, final boolean ignoreMeta ) + private AESharedItemStack makeLowerBound( final ItemStack itemStack, final CompoundNBT tag, final FuzzyMode fuzzy, final boolean ignoreMeta ) { final ItemStack newDef = itemStack.copy(); if( ignoreMeta ) { - newDef.setItemDamage( MIN_DAMAGE_VALUE ); - newDef.setTagCompound( tag ); + newDef.setDamage( MIN_DAMAGE_VALUE ); + newDef.setTag( tag ); } else { @@ -201,40 +201,40 @@ final class AESharedItemStack implements Comparable { if( fuzzy == FuzzyMode.IGNORE_ALL ) { - newDef.setItemDamage( MIN_DAMAGE_VALUE ); + newDef.setDamage( MIN_DAMAGE_VALUE ); } else if( fuzzy == FuzzyMode.PERCENT_99 ) { - if( itemStack.getItemDamage() == MIN_DAMAGE_VALUE ) + if( itemStack.getDamage() == MIN_DAMAGE_VALUE ) { - newDef.setItemDamage( MIN_DAMAGE_VALUE ); + newDef.setDamage( MIN_DAMAGE_VALUE ); } else { - newDef.setItemDamage( MIN_DAMAGE_VALUE + 1 ); + newDef.setDamage( MIN_DAMAGE_VALUE + 1 ); } } else { final int breakpoint = fuzzy.calculateBreakPoint( itemStack.getMaxDamage() ); - final int damage = breakpoint <= itemStack.getItemDamage() ? breakpoint : 0; - newDef.setItemDamage( damage ); + final int damage = breakpoint <= itemStack.getDamage() ? breakpoint : 0; + newDef.setDamage( damage ); } } - newDef.setTagCompound( LOW_TAG ); + newDef.setTag( LOW_TAG ); } return new AESharedItemStack( newDef ); } - private AESharedItemStack makeUpperBound( final ItemStack itemStack, final NBTTagCompound tag, final FuzzyMode fuzzy, final boolean ignoreMeta ) + private AESharedItemStack makeUpperBound( final ItemStack itemStack, final CompoundNBT tag, final FuzzyMode fuzzy, final boolean ignoreMeta ) { final ItemStack newDef = itemStack.copy(); if( ignoreMeta ) { - newDef.setItemDamage( MAX_DAMAGE_VALUE ); - newDef.setTagCompound( tag ); + newDef.setDamage( MAX_DAMAGE_VALUE ); + newDef.setTag( tag ); } else { @@ -242,27 +242,27 @@ final class AESharedItemStack implements Comparable { if( fuzzy == FuzzyMode.IGNORE_ALL ) { - newDef.setItemDamage( itemStack.getMaxDamage() + 1 ); + newDef.setDamage( itemStack.getMaxDamage() + 1 ); } else if( fuzzy == FuzzyMode.PERCENT_99 ) { - if( itemStack.getItemDamage() == MIN_DAMAGE_VALUE ) + if( itemStack.getDamage() == MIN_DAMAGE_VALUE ) { - newDef.setItemDamage( MIN_DAMAGE_VALUE ); + newDef.setDamage( MIN_DAMAGE_VALUE ); } else { - newDef.setItemDamage( itemStack.getMaxDamage() + 1 ); + newDef.setDamage( itemStack.getMaxDamage() + 1 ); } } else { final int breakpoint = fuzzy.calculateBreakPoint( itemStack.getMaxDamage() ); - final int damage = itemStack.getItemDamage() < breakpoint ? breakpoint - 1 : itemStack.getMaxDamage() + 1; - newDef.setItemDamage( damage ); + final int damage = itemStack.getDamage() < breakpoint ? breakpoint - 1 : itemStack.getMaxDamage() + 1; + newDef.setDamage( damage ); } } - newDef.setTagCompound( HIGH_TAG ); + newDef.setTag( HIGH_TAG ); } return new AESharedItemStack( newDef ); diff --git a/src/main/java/appeng/util/item/ItemList.java b/src/main/java/appeng/util/item/ItemList.java index c8e22b796..87e927e5c 100644 --- a/src/main/java/appeng/util/item/ItemList.java +++ b/src/main/java/appeng/util/item/ItemList.java @@ -19,15 +19,12 @@ package appeng.util.item; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.NavigableMap; import java.util.concurrent.ConcurrentSkipListMap; -import net.minecraftforge.oredict.OreDictionary; - import appeng.api.config.FuzzyMode; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemList; @@ -81,26 +78,7 @@ public final class ItemList implements IItemList final AEItemStack ais = (AEItemStack) filter; - return ais.getOre().map( or -> - { - if( or.getAEEquivalents().size() == 1 ) - { - final IAEItemStack is = or.getAEEquivalents().get( 0 ); - - return this.findFuzzyDamage( is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ); - } - else - { - final Collection output = new ArrayList<>(); - - for( final IAEItemStack is : or.getAEEquivalents() ) - { - output.addAll( this.findFuzzyDamage( is, fuzzy, is.getItemDamage() == OreDictionary.WILDCARD_VALUE ) ); - } - - return output; - } - } ).orElse( this.findFuzzyDamage( ais, fuzzy, false ) ); + return this.findFuzzyDamage( ais, fuzzy, false ); } @Override diff --git a/src/main/java/appeng/util/item/OreHelper.java b/src/main/java/appeng/util/item/OreHelper.java deleted file mode 100644 index ee4836e3f..000000000 --- a/src/main/java/appeng/util/item/OreHelper.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.util.item; - - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import appeng.api.storage.data.IAEItemStack; - - -public class OreHelper -{ - - public static final OreHelper INSTANCE = new OreHelper(); - - /** - * A local cache to speed up OreDictionary lookups. - */ - private final LoadingCache> oreDictCache = CacheBuilder.newBuilder().build( new CacheLoader>() - { - @Override - public List load( final String oreName ) - { - return OreDictionary.getOres( oreName ); - } - } ); - - private final Map references = new HashMap<>(); - - /** - * Test if the passed {@link ItemStack} is an ore. - * - * @param itemStack the itemstack to test - * - * @return true if an ore entry exists, false otherwise - */ - public Optional getOre( final ItemStack itemStack ) - { - final ItemRef ir = new ItemRef( itemStack ); - - if( !this.references.containsKey( ir ) ) - { - final OreReference ref = new OreReference(); - final Collection ores = ref.getOres(); - final Collection set = ref.getEquivalents(); - - final Set toAdd = new HashSet<>(); - - for( final String ore : OreDictionary.getOreNames() ) - { - // skip ore if it is a match already or null. - if( ore == null || toAdd.contains( ore ) ) - { - continue; - } - - for( final ItemStack oreItem : this.oreDictCache.getUnchecked( ore ) ) - { - if( OreDictionary.itemMatches( oreItem, itemStack, false ) ) - { - toAdd.add( ore ); - break; - } - } - } - - for( final String ore : toAdd ) - { - set.add( ore ); - ores.add( OreDictionary.getOreID( ore ) ); - } - - if( !set.isEmpty() ) - { - this.references.put( ir, ref ); - } - else - { - this.references.put( ir, null ); - } - } - - return Optional.ofNullable( this.references.get( ir ) ); - } - - boolean sameOre( final AEItemStack aeItemStack, final IAEItemStack is ) - { - final OreReference a = aeItemStack.getOre().orElse( null ); - final OreReference b = aeItemStack.getOre().orElse( null ); - - return this.sameOre( a, b ); - } - - public boolean sameOre( final OreReference a, final OreReference b ) - { - if( a == null || b == null ) - { - return false; - } - - if( a == b ) - { - return true; - } - - final Collection bOres = b.getOres(); - for( final Integer ore : a.getOres() ) - { - if( bOres.contains( ore ) ) - { - return true; - } - } - - return false; - } - - boolean sameOre( final AEItemStack aeItemStack, final ItemStack o ) - { - return aeItemStack.getOre().map( a -> - { - for( final String oreName : a.getEquivalents() ) - { - for( final ItemStack oreItem : this.oreDictCache.getUnchecked( oreName ) ) - { - if( OreDictionary.itemMatches( oreItem, o, false ) ) - { - return true; - } - } - } - return false; - } ) - .orElse( false ); - } - - List getCachedOres( final String oreName ) - { - return this.oreDictCache.getUnchecked( oreName ); - } - - private static class ItemRef - { - - private final Item ref; - private final int damage; - private final int hash; - - ItemRef( final ItemStack stack ) - { - this.ref = stack.getItem(); - - if( stack.getItem().isDamageable() ) - { - this.damage = 0; // IGNORED - } - else - { - this.damage = stack.getItemDamage(); // might be important... - } - - this.hash = this.ref.hashCode() ^ this.damage; - } - - @Override - public int hashCode() - { - return this.hash; - } - - @Override - public boolean equals( final Object obj ) - { - if( obj == null ) - { - return false; - } - if( this.getClass() != obj.getClass() ) - { - return false; - } - final ItemRef other = (ItemRef) obj; - return this.damage == other.damage && this.ref == other.ref; - } - - @Override - public String toString() - { - return "ItemRef [ref=" + this.ref.getUnlocalizedName() + ", damage=" + this.damage + ", hash=" + this.hash + ']'; - } - } -} \ No newline at end of file diff --git a/src/main/java/appeng/util/item/OreReference.java b/src/main/java/appeng/util/item/OreReference.java deleted file mode 100644 index a32fa58b1..000000000 --- a/src/main/java/appeng/util/item/OreReference.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of Applied Energistics 2. - * Copyright (c) 2013 - 2014, 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 . - */ - -package appeng.util.item; - - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import appeng.api.storage.data.IAEItemStack; - - -public class OreReference -{ - - private final List otherOptions = new ArrayList<>(); - private final Set ores = new HashSet<>(); - private List aeOtherOptions = null; - - Collection getEquivalents() - { - return this.otherOptions; - } - - List getAEEquivalents() - { - if( this.aeOtherOptions == null ) - { - this.aeOtherOptions = new ArrayList<>( this.otherOptions.size() ); - - // SUMMON AE STACKS! - for( final String oreName : this.otherOptions ) - { - for( final ItemStack is : OreHelper.INSTANCE.getCachedOres( oreName ) ) - { - if( is.getItem() != Items.AIR ) - { - this.aeOtherOptions.add( AEItemStack.fromItemStack( is ) ); - } - } - } - } - - return this.aeOtherOptions; - } - - Collection getOres() - { - return this.ores; - } -} diff --git a/src/main/java/appeng/worldgen/MeteoritePlacer.java b/src/main/java/appeng/worldgen/MeteoritePlacer.java index d2a57d0a7..de3eb8772 100644 --- a/src/main/java/appeng/worldgen/MeteoritePlacer.java +++ b/src/main/java/appeng/worldgen/MeteoritePlacer.java @@ -25,17 +25,16 @@ import java.util.HashSet; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Blocks; +import net.minecraft.entity.item.ItemEntity; 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.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; import appeng.api.definitions.IBlockDefinition; @@ -67,7 +66,7 @@ public final class MeteoritePlacer private double realCrater = this.meteoriteSize * 2 + 5; private double squaredMeteoriteSize = this.meteoriteSize * this.meteoriteSize; private double crater = this.realCrater * this.realCrater; - private NBTTagCompound settings; + private CompoundNBT settings; private Fallout type; public MeteoritePlacer() @@ -88,13 +87,10 @@ public final class MeteoritePlacer this.validSpawn.add( Blocks.GOLD_ORE ); this.validSpawn.add( Blocks.DIAMOND_ORE ); this.validSpawn.add( Blocks.REDSTONE_ORE ); - this.validSpawn.add( Blocks.HARDENED_CLAY ); this.validSpawn.add( Blocks.ICE ); this.validSpawn.add( Blocks.SNOW ); - this.validSpawn.add( Blocks.STAINED_HARDENED_CLAY ); this.skyStoneDefinition.maybeBlock().ifPresent( this.invalidSpawn::add ); - this.invalidSpawn.add( Blocks.PLANKS ); this.invalidSpawn.add( Blocks.IRON_DOOR ); this.invalidSpawn.add( Blocks.IRON_BARS ); this.invalidSpawn.add( Blocks.OAK_DOOR ); @@ -104,29 +100,27 @@ public final class MeteoritePlacer this.invalidSpawn.add( Blocks.IRON_DOOR ); this.invalidSpawn.add( Blocks.JUNGLE_DOOR ); this.invalidSpawn.add( Blocks.SPRUCE_DOOR ); - this.invalidSpawn.add( Blocks.BRICK_BLOCK ); + this.invalidSpawn.add( Blocks.BRICKS ); this.invalidSpawn.add( Blocks.CLAY ); this.invalidSpawn.add( Blocks.WATER ); - this.invalidSpawn.add( Blocks.LOG ); - this.invalidSpawn.add( Blocks.LOG2 ); this.type = new Fallout( this.putter, this.skyStoneDefinition ); } - boolean spawnMeteorite( final IMeteoriteWorld w, final NBTTagCompound meteoriteBlob ) + boolean spawnMeteorite( final IMeteoriteWorld w, final CompoundNBT meteoriteBlob ) { this.settings = meteoriteBlob; - final int x = this.settings.getInteger( "x" ); - final int y = this.settings.getInteger( "y" ); - final int z = this.settings.getInteger( "z" ); + final int x = this.settings.getInt( "x" ); + final int y = this.settings.getInt( "y" ); + final int z = this.settings.getInt( "z" ); this.meteoriteSize = this.settings.getDouble( "real_sizeOfMeteorite" ); this.realCrater = this.settings.getDouble( "realCrater" ); this.squaredMeteoriteSize = this.settings.getDouble( "sizeOfMeteorite" ); this.crater = this.settings.getDouble( "crater" ); - final Block blk = Block.getBlockById( this.settings.getInteger( "blk" ) ); + final Block blk = Block.getBlockById( this.settings.getInt( "blk" ) ); if( blk == Blocks.SAND ) { @@ -141,7 +135,7 @@ public final class MeteoritePlacer this.type = new FalloutSnow( w, x, y, z, this.putter, this.skyStoneDefinition ); } - final int skyMode = this.settings.getInteger( "skyMode" ); + final int skyMode = this.settings.getInt( "skyMode" ); // creator if( skyMode > 10 ) @@ -204,11 +198,11 @@ public final class MeteoritePlacer } for( final Object o : w.getWorld() - .getEntitiesWithinAABB( EntityItem.class, + .getEntitiesWithinAABB( ItemEntity.class, new AxisAlignedBB( w.minX( x - 30 ), y - 5, w.minZ( z - 30 ), w.maxX( x + 30 ), y + 30, w.maxZ( z + 30 ) ) ) ) { final Entity e = (Entity) o; - e.setDead(); + e.remove(); } } @@ -223,7 +217,7 @@ public final class MeteoritePlacer this.skyChestDefinition.maybeBlock().ifPresent( block -> this.putter.put( w, x, y, z, block ) ); final TileEntity te = w.getTileEntity( x, y, z ); - final InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, EnumFacing.UP ); + final InventoryAdaptor ap = InventoryAdaptor.getAdaptor( te, Direction.UP ); if( ap != null ) { int primary = Math.max( 1, (int) ( Math.random() * 4 ) ); @@ -297,16 +291,7 @@ public final class MeteoritePlacer break; case 1: final List possibles = new ArrayList<>(); - possibles.addAll( OreDictionary.getOres( "nuggetIron" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetCopper" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetTin" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetSilver" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetLead" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetPlatinum" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetNickel" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetAluminium" ) ); - possibles.addAll( OreDictionary.getOres( "nuggetElectrum" ) ); - possibles.add( new ItemStack( net.minecraft.init.Items.GOLD_NUGGET ) ); + possibles.add( new ItemStack( net.minecraft.item.Items.GOLD_NUGGET ) ); ItemStack nugget = Platform.pickRandom( possibles ); if( !nugget.isEmpty() ) @@ -376,7 +361,7 @@ public final class MeteoritePlacer if( blk_b != blk ) { - final IBlockState meta_b = w.getBlockState( i, j + 1, k ); + final BlockState meta_b = w.getBlockState( i, j + 1, k ); w.setBlock( i, j, k, meta_b, 3 ); } @@ -427,8 +412,8 @@ public final class MeteoritePlacer double getSqDistance( final int x, final int z ) { - final int chunkX = this.settings.getInteger( "x" ) - x; - final int chunkZ = this.settings.getInteger( "z" ) - z; + final int chunkX = this.settings.getInt( "x" ) - x; + final int chunkZ = this.settings.getInt( "z" ) - z; return chunkX * chunkX + chunkZ * chunkZ; } @@ -447,24 +432,24 @@ public final class MeteoritePlacer return false; // must spawn on a valid block.. } - this.settings = new NBTTagCompound(); - this.settings.setInteger( "x", x ); - this.settings.setInteger( "y", y ); - this.settings.setInteger( "z", z ); - this.settings.setInteger( "blk", Block.getIdFromBlock( blk ) ); + this.settings = new CompoundNBT(); + this.settings.putInt( "x", x ); + this.settings.putInt( "y", y ); + this.settings.putInt( "z", z ); + this.settings.putString( "blk", blk.getRegistryName().toString() ); - this.settings.setDouble( "real_sizeOfMeteorite", this.meteoriteSize ); - this.settings.setDouble( "realCrater", this.realCrater ); - this.settings.setDouble( "sizeOfMeteorite", this.squaredMeteoriteSize ); - this.settings.setDouble( "crater", this.crater ); + this.settings.putDouble( "real_sizeOfMeteorite", this.meteoriteSize ); + this.settings.putDouble( "realCrater", this.realCrater ); + this.settings.putDouble( "sizeOfMeteorite", this.squaredMeteoriteSize ); + this.settings.putDouble( "crater", this.crater ); - this.settings.setBoolean( "lava", Math.random() > 0.9 ); + this.settings.putBoolean( "lava", Math.random() > 0.9 ); if( blk == Blocks.SAND ) { this.type = new FalloutSand( w, x, y, z, this.putter, this.skyStoneDefinition ); } - else if( blk == Blocks.HARDENED_CLAY ) + else if( blk == Blocks.TERRACOTTA ) { this.type = new FalloutCopy( w, x, y, z, this.putter, this.skyStoneDefinition ); } @@ -559,16 +544,16 @@ public final class MeteoritePlacer this.decay( w, x, y, z ); } - this.settings.setInteger( "skyMode", skyMode ); + this.settings.putInt( "skyMode", skyMode ); w.done(); - WorldData.instance().spawnData().addNearByMeteorites( w.getWorld().provider.getDimension(), x >> 4, z >> 4, this.settings ); + WorldData.instance().spawnData().addNearByMeteorites( w.getWorld().getDimension(), x >> 4, z >> 4, this.settings ); return true; } return false; } - NBTTagCompound getSettings() + CompoundNBT getSettings() { return this.settings; } diff --git a/src/main/java/appeng/worldgen/MeteoriteWorldGen.java b/src/main/java/appeng/worldgen/MeteoriteWorldGen.java index 74e552695..7ceddeaf9 100644 --- a/src/main/java/appeng/worldgen/MeteoriteWorldGen.java +++ b/src/main/java/appeng/worldgen/MeteoriteWorldGen.java @@ -21,7 +21,7 @@ package appeng.worldgen; import java.util.Random; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.world.World; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.IChunkGenerator; @@ -100,7 +100,7 @@ public final class MeteoriteWorldGen implements IWorldGenerator return false; } - private Iterable getNearByMeteorites( final World w, final int chunkX, final int chunkZ ) + private Iterable getNearByMeteorites( final World w, final int chunkX, final int chunkZ ) { return WorldData.instance().spawnData().getNearByMeteorites( w.provider.getDimension(), chunkX, chunkZ ); } @@ -128,7 +128,7 @@ public final class MeteoriteWorldGen implements IWorldGenerator double minSqDist = Double.MAX_VALUE; // near by meteorites! - for( final NBTTagCompound data : MeteoriteWorldGen.this.getNearByMeteorites( world, chunkX, chunkZ ) ) + for( final CompoundNBT data : MeteoriteWorldGen.this.getNearByMeteorites( world, chunkX, chunkZ ) ) { final MeteoritePlacer mp = new MeteoritePlacer(); mp.spawnMeteorite( new ChunkOnly( world, chunkX, chunkZ ), data ); diff --git a/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java b/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java index 4060933f7..ee3e2089a 100644 --- a/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java +++ b/src/main/java/appeng/worldgen/meteorite/ChunkOnly.java @@ -20,7 +20,7 @@ package appeng.worldgen.meteorite; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -89,7 +89,7 @@ public class ChunkOnly extends StandardWorld } @Override - public void setBlock( final int x, final int y, final int z, final IBlockState state, final int flags ) + public void setBlock( final int x, final int y, final int z, final BlockState state, final int flags ) { if( this.range( x, y, z ) ) { diff --git a/src/main/java/appeng/worldgen/meteorite/Fallout.java b/src/main/java/appeng/worldgen/meteorite/Fallout.java index 955d0e37e..451e1bb06 100644 --- a/src/main/java/appeng/worldgen/meteorite/Fallout.java +++ b/src/main/java/appeng/worldgen/meteorite/Fallout.java @@ -19,7 +19,7 @@ package appeng.worldgen.meteorite; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import appeng.api.definitions.IBlockDefinition; import appeng.util.Platform; diff --git a/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java b/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java index a203de694..69dfa4076 100644 --- a/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java +++ b/src/main/java/appeng/worldgen/meteorite/FalloutCopy.java @@ -19,7 +19,7 @@ package appeng.worldgen.meteorite; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import appeng.api.definitions.IBlockDefinition; import appeng.util.Platform; @@ -31,7 +31,7 @@ public class FalloutCopy extends Fallout private static final double AIR_BLOCK_THRESHOLD = 0.8; private static final double BLOCK_THRESHOLD_STEP = 0.1; - private final IBlockState block; + private final BlockState block; private final MeteoriteBlockPutter putter; public FalloutCopy( final IMeteoriteWorld w, final int x, final int y, final int z, final MeteoriteBlockPutter putter, final IBlockDefinition skyStoneDefinition ) diff --git a/src/main/java/appeng/worldgen/meteorite/FalloutSand.java b/src/main/java/appeng/worldgen/meteorite/FalloutSand.java index c81df9f38..179c3c52b 100644 --- a/src/main/java/appeng/worldgen/meteorite/FalloutSand.java +++ b/src/main/java/appeng/worldgen/meteorite/FalloutSand.java @@ -19,7 +19,7 @@ package appeng.worldgen.meteorite; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import appeng.api.definitions.IBlockDefinition; diff --git a/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java b/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java index f3053ac3d..305120a08 100644 --- a/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java +++ b/src/main/java/appeng/worldgen/meteorite/FalloutSnow.java @@ -19,7 +19,7 @@ package appeng.worldgen.meteorite; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import appeng.api.definitions.IBlockDefinition; diff --git a/src/main/java/appeng/worldgen/meteorite/IMeteoriteWorld.java b/src/main/java/appeng/worldgen/meteorite/IMeteoriteWorld.java index 3663a405c..e8d3e1626 100644 --- a/src/main/java/appeng/worldgen/meteorite/IMeteoriteWorld.java +++ b/src/main/java/appeng/worldgen/meteorite/IMeteoriteWorld.java @@ -20,7 +20,7 @@ package appeng.worldgen.meteorite; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -47,9 +47,9 @@ public interface IMeteoriteWorld void setBlock( int i, int j, int k, Block blk ); - void setBlock( int i, int j, int k, IBlockState state, int l ); + void setBlock( int i, int j, int k, BlockState state, int l ); void done(); - IBlockState getBlockState( int x, int y, int z ); + BlockState getBlockState( int x, int y, int z ); } \ No newline at end of file diff --git a/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java b/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java index 823ca78f3..f8052fa6e 100644 --- a/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java +++ b/src/main/java/appeng/worldgen/meteorite/MeteoriteBlockPutter.java @@ -20,8 +20,8 @@ package appeng.worldgen.meteorite; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; public class MeteoriteBlockPutter @@ -39,7 +39,7 @@ public class MeteoriteBlockPutter return true; } - void put( final IMeteoriteWorld w, final int i, final int j, final int k, final IBlockState state, final int meta ) + void put( final IMeteoriteWorld w, final int i, final int j, final int k, final BlockState state, final int meta ) { if( w.getBlock( i, j, k ) == Blocks.BEDROCK ) { diff --git a/src/main/java/appeng/worldgen/meteorite/StandardWorld.java b/src/main/java/appeng/worldgen/meteorite/StandardWorld.java index 350a1c687..69b731990 100644 --- a/src/main/java/appeng/worldgen/meteorite/StandardWorld.java +++ b/src/main/java/appeng/worldgen/meteorite/StandardWorld.java @@ -20,8 +20,8 @@ package appeng.worldgen.meteorite; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -126,7 +126,7 @@ public class StandardWorld implements IMeteoriteWorld } @Override - public void setBlock( final int x, final int y, final int z, final IBlockState state, final int l ) + public void setBlock( final int x, final int y, final int z, final BlockState state, final int l ) { if( this.range( x, y, z ) ) { @@ -135,7 +135,7 @@ public class StandardWorld implements IMeteoriteWorld } @Override - public IBlockState getBlockState( final int x, final int y, final int z ) + public BlockState getBlockState( final int x, final int y, final int z ) { if( this.range( x, y, z ) ) {