Most of the 1.8 Port.

This commit is contained in:
AlgorithmX2
2015-06-15 19:44:59 -05:00
parent 17465e68e8
commit 38afde724b
824 changed files with 12120 additions and 9158 deletions
@@ -25,6 +25,7 @@ package appeng.api.config;
import java.util.EnumSet;
import javax.annotation.Nonnull;
+2 -3
View File
@@ -28,12 +28,11 @@ import java.util.HashMap;
import java.util.Map;
import net.minecraft.item.ItemStack;
import com.google.common.base.Optional;
import appeng.api.definitions.IItemDefinition;
import appeng.api.util.AEItemDefinition;
import com.google.common.base.Optional;
public enum Upgrades
{
@@ -3,6 +3,7 @@ package appeng.api.definitions;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import com.google.common.base.Optional;
@@ -24,11 +25,9 @@ public interface IBlockDefinition extends IItemDefinition
* Compare Block with world.
*
* @param world world of block
* @param x x pos of block
* @param y y pos of block
* @param z z pos of block
* @param pos location
*
* @return if the block is placed in the world at the specific location.
*/
boolean isSameAs( IBlockAccess world, int x, int y, int z );
boolean isSameAs( IBlockAccess world, BlockPos pos );
}
@@ -57,8 +57,16 @@ public interface IBlocks
IBlockDefinition skyStone();
IBlockDefinition skyStoneBlock();
IBlockDefinition skyStoneBrick();
IBlockDefinition skyStoneSmallBrick();
IBlockDefinition skyChest();
IBlockDefinition skyChestBlock();
IBlockDefinition skyCompass();
IBlockDefinition skyStoneStair();
@@ -77,6 +85,7 @@ public interface IBlocks
IBlockDefinition quartzPillarStair();
/*
IBlockDefinition skyStoneSlab();
IBlockDefinition skyStoneBlockSlab();
@@ -92,7 +101,8 @@ public interface IBlocks
IBlockDefinition chiseledQuartzSlab();
IBlockDefinition quartzPillarSlab();
*/
/*
* misc
*/
@@ -2,6 +2,7 @@ package appeng.api.definitions;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
@@ -27,14 +28,12 @@ public interface IComparableDefinition
* Compare Block with world.
*
* @param world world of block
* @param x x pos of block
* @param y y pos of block
* @param z z pos of block
* @param pos in world.
*
* @return if the block is placed in the world at the specific location.
*
* @deprecated moved to {@link IBlockDefinition}. Is removed in the next major release rv3
*/
@Deprecated
boolean isSameAs( IBlockAccess world, int x, int y, int z );
boolean isSameAs( IBlockAccess world, BlockPos pos );
}
@@ -78,13 +78,13 @@ public interface IParts
IItemDefinition p2PTunnelLiquids();
IItemDefinition p2PTunnelEU();
//IItemDefinition p2PTunnelEU();
IItemDefinition p2PTunnelRF();
//IItemDefinition p2PTunnelRF();
IItemDefinition p2PTunnelLight();
IItemDefinition p2PTunnelOpenComputers();
//IItemDefinition p2PTunnelOpenComputers();
IItemDefinition cableAnchor();
@@ -24,8 +24,7 @@
package appeng.api.events;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Event;
import appeng.api.features.ILocatable;
@@ -2,6 +2,7 @@ package appeng.api.features;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
@@ -2,6 +2,7 @@ package appeng.api.features;
import java.util.Collection;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
@@ -3,6 +3,7 @@ package appeng.api.features;
import java.util.List;
import java.util.Set;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
@@ -27,7 +27,6 @@ package appeng.api.features;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import appeng.api.config.TunnelType;
@@ -26,7 +26,6 @@ package appeng.api.features;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.util.IConfigManager;
@@ -27,7 +27,6 @@ package appeng.api.implementations;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.networking.crafting.ICraftingPatternDetails;
@@ -25,7 +25,6 @@ package appeng.api.implementations;
import net.minecraft.tileentity.TileEntity;
import appeng.api.config.Upgrades;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.util.IConfigurableObject;
@@ -25,6 +25,7 @@ package appeng.api.implementations.guiobjects;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
@@ -35,5 +36,5 @@ import net.minecraft.world.World;
public interface IGuiItem
{
IGuiItemObject getGuiObject( ItemStack is, World world, int x, int y, int z );
IGuiItemObject getGuiObject( ItemStack is, World world, BlockPos pos );
}
@@ -25,7 +25,6 @@ package appeng.api.implementations.guiobjects;
import net.minecraft.inventory.IInventory;
import appeng.api.networking.IGridHost;
@@ -25,7 +25,6 @@ package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.config.AccessRestriction;
import appeng.api.networking.energy.IAEPowerStorage;
@@ -26,6 +26,7 @@ package appeng.api.implementations.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
/**
@@ -39,11 +40,9 @@ public interface IAEWrench
* Check if the wrench can be used.
*
* @param player wrenching player
* @param x x pos of wrenched block
* @param y y pos of wrenched block
* @param z z pos of wrenched block
* @param pos of block.
*
* @return true if wrench can be used
*/
boolean canWrench( ItemStack wrench, EntityPlayer player, int x, int y, int z );
boolean canWrench( ItemStack wrench, EntityPlayer player, BlockPos pos );
}
@@ -27,13 +27,12 @@ package appeng.api.implementations.items;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import com.mojang.authlib.GameProfile;
import appeng.api.config.SecurityPermissions;
import appeng.api.features.IPlayerRegistry;
import appeng.api.networking.security.ISecurityRegistry;
import com.mojang.authlib.GameProfile;
public interface IBiometricCard
{
@@ -27,7 +27,6 @@ package appeng.api.implementations.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.implementations.TransitionResult;
import appeng.api.util.WorldCoord;
@@ -25,7 +25,6 @@ package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellWorkbenchItem;
import appeng.api.storage.data.IAEItemStack;
@@ -25,7 +25,6 @@ package appeng.api.implementations.items;
import net.minecraft.item.ItemStack;
import appeng.api.config.Upgrades;
@@ -27,18 +27,18 @@ package appeng.api.implementations.parts;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.networking.IGridHost;
import appeng.api.parts.BusSupport;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
/**
* Implemented on the {@link IPart}s cable objects that can be placed at {@link ForgeDirection}.UNKNOWN in
* Implemented on the {@link IPart}s cable objects that can be placed at {@link AEPartLocation}.UNKNOWN in
* {@link IPartHost}s
*/
public interface IPartCable extends IPart, IGridHost
@@ -75,7 +75,7 @@ public interface IPartCable extends IPart, IGridHost
*
* @param sides sides of cable
*/
void setValidSides( EnumSet<ForgeDirection> sides );
void setValidSides( EnumSet<EnumFacing> sides );
/**
* used to tests if a cable connects to neighbors visually.
@@ -84,5 +84,5 @@ public interface IPartCable extends IPart, IGridHost
*
* @return true if this side is currently connects to an external block.
*/
boolean isConnected( ForgeDirection side );
boolean isConnected( EnumFacing side );
}
@@ -25,8 +25,7 @@ package appeng.api.implementations.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.util.AEColor;
@@ -35,5 +34,5 @@ public interface IColorableTile
AEColor getColor();
boolean recolourBlock( ForgeDirection side, AEColor colour, EntityPlayer who );
boolean recolourBlock( EnumFacing side, AEColor colour, EntityPlayer who );
}
@@ -25,8 +25,7 @@ package appeng.api.implementations.tiles;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.networking.crafting.ICraftingPatternDetails;
@@ -42,7 +41,7 @@ public interface ICraftingMachine
*
* @return if it was accepted, all or nothing.
*/
boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, ForgeDirection ejectionDirection );
boolean pushPattern( ICraftingPatternDetails patternDetails, InventoryCrafting table, EnumFacing ejectionDirection );
/**
* check if the crafting machine is accepting pushes via pushPattern, if this is false, all calls to push will fail,
@@ -24,7 +24,7 @@
package appeng.api.implementations.tiles;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
/**
@@ -55,5 +55,5 @@ public interface ICrankable
/**
* @return true if the crank can attach on the given side.
*/
boolean canCrankAttach( ForgeDirection directionToCrank );
boolean canCrankAttach( EnumFacing directionToCrank );
}
@@ -24,8 +24,7 @@
package appeng.api.implementations.tiles;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IStorageMonitorable;
@@ -36,5 +35,5 @@ import appeng.api.storage.IStorageMonitorable;
public interface ITileStorageMonitorable
{
IStorageMonitorable getMonitorable( ForgeDirection side, BaseActionSource src );
IStorageMonitorable getMonitorable( EnumFacing side, BaseActionSource src );
}
@@ -25,6 +25,7 @@ package appeng.api.movable;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
@@ -61,9 +62,7 @@ public interface IMovableHandler
*
* @param tile to be moved tile
* @param world world of tile
* @param x x coord of tile
* @param y y coord of tile
* @param z z coord of tile
* @param newPosition the new location
*/
void moveTile( TileEntity tile, World world, int x, int y, int z );
void moveTile( TileEntity tile, World world, BlockPos newPosition );
}
@@ -27,8 +27,7 @@ package appeng.api.networking;
import java.util.EnumSet;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.parts.IPart;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
@@ -94,7 +93,7 @@ public interface IGridBlock
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
* for {@link IPart} implementations.
*/
EnumSet<ForgeDirection> getConnectableSides();
EnumSet<EnumFacing> getConnectableSides();
/**
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
@@ -24,7 +24,7 @@
package appeng.api.networking;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.util.AEPartLocation;
/**
@@ -54,7 +54,7 @@ public interface IGridConnection
*
* @return the direction of the connection, only valid for in world connections.
*/
ForgeDirection getDirection( IGridNode gridNode );
AEPartLocation getDirection( IGridNode gridNode );
/**
* by destroying a connection you may create new grids, and trigger un-expected behavior, you should only destroy
@@ -25,10 +25,9 @@ package appeng.api.networking;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.parts.IPart;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
/**
@@ -49,7 +48,7 @@ public interface IGridHost
* @return a new IGridNode, create these with
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
*/
IGridNode getGridNode( ForgeDirection dir );
IGridNode getGridNode( AEPartLocation dir );
/**
* Determines how cables render when they connect to this block. Priority is
@@ -57,7 +56,7 @@ public interface IGridHost
*
* @param dir direction
*/
AECableType getCableConnectionType( ForgeDirection dir );
AECableType getCableConnectionType( AEPartLocation dir );
/**
* break this host, its violating security rules, just break your block, or part.
@@ -28,9 +28,8 @@ import java.util.EnumSet;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.IAppEngApi;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IReadOnlyCollection;
@@ -89,9 +88,9 @@ public interface IGridNode
World getWorld();
/**
* @return a set of the connected sides, UNKNOWN represents an invisible connection
* @return a set of the connected sides, INTERNAL represents an invisible connection
*/
EnumSet<ForgeDirection> getConnectedSides();
EnumSet<AEPartLocation> getConnectedSides();
/**
* lets you iterate a nodes connections
@@ -27,15 +27,14 @@ package appeng.api.networking.crafting;
import java.util.concurrent.Future;
import net.minecraft.world.World;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridCache;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.data.IAEItemStack;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
public interface ICraftingGrid extends IGridCache
{
@@ -27,7 +27,6 @@ package appeng.api.networking.crafting;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.storage.data.IAEItemStack;
@@ -24,12 +24,12 @@
package appeng.api.networking.crafting;
import com.google.common.collect.ImmutableSet;
import appeng.api.config.Actionable;
import appeng.api.networking.security.IActionHost;
import appeng.api.storage.data.IAEItemStack;
import com.google.common.collect.ImmutableSet;
public interface ICraftingRequester extends IActionHost
{
@@ -25,7 +25,6 @@ package appeng.api.networking.security;
import net.minecraft.entity.player.EntityPlayer;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGridCache;
+1 -1
View File
@@ -24,5 +24,5 @@
@API( apiVersion = "rv2", owner = "appliedenergistics2", provides = "appliedenergistics2|API" ) package appeng.api;
import cpw.mods.fml.common.API;
import net.minecraftforge.fml.common.API;
@@ -24,12 +24,12 @@
package appeng.api.parts;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.util.AEPartLocation;
/**
@@ -50,12 +50,12 @@ public interface IFacadeContainer
/**
* Removed the facade on the given side, or does nothing.
*/
void removeFacade( IPartHost host, ForgeDirection side );
void removeFacade( IPartHost host, AEPartLocation side );
/**
* @return the {@link IFacadePart} for a given side, or null.
*/
IFacadePart getFacade( ForgeDirection s );
IFacadePart getFacade( AEPartLocation s );
/**
* rotate the facades left.
@@ -24,15 +24,15 @@
package appeng.api.parts;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
/**
@@ -69,7 +69,7 @@ public interface IFacadePart
* @param renderStilt if to render stilt
*/
@SideOnly( Side.CLIENT )
void renderStatic( int x, int y, int z, IPartRenderHelper instance, RenderBlocks renderer, IFacadeContainer fc, AxisAlignedBB busBounds, boolean renderStilt );
void renderStatic( BlockPos pos, IPartRenderHelper instance, IRenderHelper renderer, IFacadeContainer fc, AxisAlignedBB busBounds, boolean renderStilt );
/**
* render the part in inventory.
@@ -78,12 +78,12 @@ public interface IFacadePart
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderInventory( IPartRenderHelper instance, RenderBlocks renderer );
void renderInventory( IPartRenderHelper instance, IRenderHelper renderer );
/**
* @return side the facade is in
*/
ForgeDirection getSide();
AEPartLocation getSide();
/**
* @return the box for the face of the facade
+16 -19
View File
@@ -24,28 +24,27 @@
package appeng.api.parts;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import io.netty.buffer.ByteBuf;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.networking.IGridNode;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
public interface IPart extends IBoxProvider
@@ -74,7 +73,7 @@ public interface IPart extends IBoxProvider
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderInventory( IPartRenderHelper rh, RenderBlocks renderer );
void renderInventory( IPartRenderHelper rh, IRenderHelper renderer );
/**
* render world renderer ( preferred )
@@ -88,7 +87,7 @@ public interface IPart extends IBoxProvider
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer );
void renderStatic( BlockPos pos, IPartRenderHelper rh, IRenderHelper renderer );
/**
* render TESR.
@@ -102,14 +101,14 @@ public interface IPart extends IBoxProvider
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderDynamic( double x, double y, double z, IPartRenderHelper rh, RenderBlocks renderer );
void renderDynamic( double x, double y, double z, IPartRenderHelper rh, IRenderHelper renderer );
/**
* @return the Block sheet icon used when rendering the breaking particles, return null to use the ItemStack
* texture.
*/
@SideOnly( Side.CLIENT )
IIcon getBreakingTexture();
TextureAtlasSprite getBreakingTexture(IRenderHelper renderer);
/**
* return true only if your part require dynamic rendering, must be consistent.
@@ -233,7 +232,7 @@ public interface IPart extends IBoxProvider
* @param host part side
* @param tile tile entity of part
*/
void setPartHostInfo( ForgeDirection side, IPartHost host, TileEntity tile );
void setPartHostInfo( AEPartLocation side, IPartHost host, TileEntity tile );
/**
* Called when you right click the part, very similar to Block.onActivateBlock
@@ -273,12 +272,10 @@ public interface IPart extends IBoxProvider
* same as Block.randomDisplayTick, for but parts.
*
* @param world world of block
* @param x x coord of block
* @param y y coord of block
* @param z z coord of block
* @param pos location of block
* @param r random
*/
void randomDisplayTick( World world, int x, int y, int z, Random r );
void randomDisplayTick( World world, BlockPos pos, Random r );
/**
* Called when placed in the world by a player, this happens before addWorld.
@@ -287,7 +284,7 @@ public interface IPart extends IBoxProvider
* @param held held item
* @param side placing side
*/
void onPlacement( EntityPlayer player, ItemStack held, ForgeDirection side );
void onPlacement( EntityPlayer player, ItemStack held, AEPartLocation side );
/**
* Used to determine which parts can be placed on what cables.
@@ -24,7 +24,7 @@
package appeng.api.parts;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface IPartCollisionHelper
@@ -47,17 +47,17 @@ public interface IPartCollisionHelper
/**
* @return east in world space.
*/
ForgeDirection getWorldX();
EnumFacing getWorldX();
/**
* @return up in world space.
*/
ForgeDirection getWorldY();
EnumFacing getWorldY();
/**
* @return forward in world space.
*/
ForgeDirection getWorldZ();
EnumFacing getWorldZ();
/**
* @return true if this test is to get the BB Collision information.
@@ -26,6 +26,8 @@ package appeng.api.parts;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
@@ -69,16 +71,14 @@ public interface IPartHelper
* use in use item, to try and place a IBusItem
*
* @param is ItemStack of an item which implements {@link IPartItem}
* @param x x pos of part
* @param y y pos of part
* @param z z pos of part
* @param BlockPos pos of part
* @param side side which the part should be on
* @param player player placing part
* @param world part in world
*
* @return true if placing was successful
*/
boolean placeBus( ItemStack is, int x, int y, int z, int side, EntityPlayer player, World world );
boolean placeBus( ItemStack is, BlockPos pos, EnumFacing side, EntityPlayer player, World world );
/**
* @return the render mode
+21 -11
View File
@@ -29,10 +29,10 @@ import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord;
@@ -50,7 +50,7 @@ public interface IPartHost
IFacadeContainer getFacadeContainer();
/**
* Test if you can add a part to the specified side of the Part Host, {@link ForgeDirection}.UNKNOWN is used to
* Test if you can add a part to the specified side of the Part Host, {@link AEPartLocation}.UNKNOWN is used to
* represent the cable in the middle.
*
* @param part to be added part
@@ -58,7 +58,7 @@ public interface IPartHost
*
* @return returns false if the part cannot be added.
*/
boolean canAddPart( ItemStack part, ForgeDirection side );
boolean canAddPart( ItemStack part, AEPartLocation side );
/**
* try to add a new part to the specified side, returns false if it failed to be added.
@@ -68,19 +68,28 @@ public interface IPartHost
* @param owner with owning player
*
* @return null if the item failed to add, the side it was placed on other wise ( may different for cables,
* {@link ForgeDirection}.UNKNOWN )
* {@link AEPartLocation}.UNKNOWN )
*/
ForgeDirection addPart( ItemStack is, ForgeDirection side, EntityPlayer owner );
AEPartLocation addPart( ItemStack is, AEPartLocation side, EntityPlayer owner );
/**
* Get part by side ( center is {@link ForgeDirection}.UNKNOWN )
* Get part by side ( center is {@link AEPartLocation}.UNKNOWN )
*
* @param side side of part
*
* @return the part located on the specified side, or null if there is no part.
*/
IPart getPart( ForgeDirection side );
IPart getPart( AEPartLocation side );
/**
* Get part by side, this method cannot aquire the center part, you must use the other varient of getPart.
*
* @param side side of part
*
* @return the part located on the specified side, or null if there is no part.
*/
IPart getPart( EnumFacing side );
/**
* removes the part on the side, this doesn't drop it or anything, if you don't do something with it, its just
* "gone" and its never coming back; think about it.
@@ -90,7 +99,7 @@ public interface IPartHost
* @param side side of part
* @param suppressUpdate - used if you need to replace a part's INSTANCE, without really removing it first.
*/
void removePart( ForgeDirection side, boolean suppressUpdate );
void removePart( AEPartLocation side, boolean suppressUpdate );
/**
* something changed, might want to send a packet to clients to update state.
@@ -123,7 +132,7 @@ public interface IPartHost
*
* @return returns if microblocks are blocking this cable path.
*/
boolean isBlocked( ForgeDirection side );
boolean isBlocked( EnumFacing side );
/**
* finds the part located at the position ( pos must be relative, not global )
@@ -151,7 +160,7 @@ public interface IPartHost
*
* @return true of the part host is receiving redstone from an external source.
*/
boolean hasRedstone( ForgeDirection side );
boolean hasRedstone( AEPartLocation side );
/**
* returns false if this block contains any parts or facades, true other wise.
@@ -179,4 +188,5 @@ public interface IPartHost
* @return true if tile is in world
*/
boolean isInWorld();
}
@@ -27,12 +27,12 @@ package appeng.api.parts;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.client.render.IRenderHelper;
import appeng.client.texture.IAESprite;
public interface IPartRenderHelper
@@ -57,31 +57,27 @@ public interface IPartRenderHelper
*
* render a single face.
*
* @param x x coord of part
* @param y y coord of part
* @param z z coord of part
* @param pos POSITION of part
* @param ico icon of part
* @param face direction its facing
* @param renderer renderer of part
*/
@SideOnly( Side.CLIENT )
void renderFace( int x, int y, int z, IIcon ico, ForgeDirection face, RenderBlocks renderer );
void renderFace( BlockPos pos, IAESprite ico, EnumFacing face, IRenderHelper renderer );
/**
* static renderer
*
* render a box with a cut out box in the center.
*
* @param x x pos of part
* @param y y pos of part
* @param z z pos of part
* @param pos pos of part
* @param ico icon of part
* @param face face of part
* @param edgeThickness thickness of the edge
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderFaceCutout( int x, int y, int z, IIcon ico, ForgeDirection face, float edgeThickness, RenderBlocks renderer );
void renderFaceCutout( BlockPos pos, IAESprite ico, EnumFacing face, float edgeThickness, IRenderHelper renderer );
/**
* static renderer
@@ -94,17 +90,17 @@ public interface IPartRenderHelper
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderBlock( int x, int y, int z, RenderBlocks renderer );
void renderBlock( BlockPos pos, IRenderHelper renderer );
/**
* render a single face in inventory renderer.
*
* @param IIcon icon of part
* @param TextureAtlasSprite icon of part
* @param direction face of part
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderInventoryFace( IIcon IIcon, ForgeDirection direction, RenderBlocks renderer );
void renderInventoryFace( IAESprite IIcon, EnumFacing direction, IRenderHelper renderer );
/**
* render a box in inventory renderer.
@@ -112,7 +108,7 @@ public interface IPartRenderHelper
* @param renderer renderer
*/
@SideOnly( Side.CLIENT )
void renderInventoryBox( RenderBlocks renderer );
void renderInventoryBox( IRenderHelper renderer );
/**
* inventory, and static renderer.
@@ -126,16 +122,16 @@ public interface IPartRenderHelper
* @param west west face
* @param east east face
*/
void setTexture( IIcon down, IIcon up, IIcon north, IIcon south, IIcon west, IIcon east );
void setTexture( IAESprite down, IAESprite up, IAESprite north, IAESprite south, IAESprite west, IAESprite east );
/**
* inventory, and static renderer.
*
* set all sides to a single IIcon.
* set all sides to a single TextureAtlasSprite.
*
* @param ico to be set icon
*/
void setTexture( IIcon ico );
void setTexture( IAESprite ico );
/**
* configure the color multiplier for the inventory renderer.
@@ -152,30 +148,17 @@ public interface IPartRenderHelper
/**
* @return the east vector in world directions, rather then renderer
*/
ForgeDirection getWorldX();
EnumFacing getWorldX();
/**
* @return the up vector in world directions, rather then renderer.
*/
ForgeDirection getWorldY();
EnumFacing getWorldY();
/**
* @return the forward vector in world directions, rather then renderer.
*/
ForgeDirection getWorldZ();
/**
* Pre-Calculates default lighting for the part, call this before using the render helper to render anything else to
* get simplified, but faster lighting for more then one block.
*
* Only worth it if you render more then 1 block.
*/
ISimplifiedBundle useSimplifiedRendering( int x, int y, int z, IBoxProvider p, ISimplifiedBundle sim );
/**
* disables, useSimplifiedRendering.
*/
void normalRendering();
EnumFacing getWorldZ();
/**
* render a block using the current renderer state.
@@ -185,7 +168,7 @@ public interface IPartRenderHelper
* @param z z pos of part
* @param renderer renderer of part
*/
void renderBlockCurrentBounds( int x, int y, int z, RenderBlocks renderer );
void renderBlockCurrentBounds( BlockPos pos, IRenderHelper renderer );
/**
* allow you to enable your part to render during the alpha pass or the standard pass.
@@ -199,5 +182,5 @@ public interface IPartRenderHelper
*
* @param complementOf sides to render
*/
void setFacesToRender( EnumSet<ForgeDirection> complementOf );
void setFacesToRender( EnumSet<EnumFacing> complementOf );
}
@@ -1,30 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
public interface ISimplifiedBundle
{
}
+17 -2
View File
@@ -27,7 +27,8 @@ package appeng.api.parts;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.util.AEPartLocation;
/**
@@ -46,7 +47,21 @@ public abstract class LayerBase extends TileEntity // implements IPartHost
*
* @return the part for the requested side.
*/
public IPart getPart( ForgeDirection side )
public IPart getPart( AEPartLocation side )
{
return null; // place holder.
}
/**
* Grants access for the layer to the parts of the host.
*
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
*
* @param side side of part
*
* @return the part for the requested side.
*/
public IPart getPart( EnumFacing side )
{
return null; // place holder.
}
@@ -24,7 +24,7 @@
package appeng.api.parts;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.util.AEPartLocation;
/**
@@ -44,25 +44,25 @@ public class SelectedPart
public final IFacadePart facade;
/**
* side the part is mounted too, or {@link ForgeDirection}.UNKNOWN for cables.
* side the part is mounted too, or {@link AEPartLocation}.UNKNOWN for cables.
*/
public final ForgeDirection side;
public final AEPartLocation side;
public SelectedPart()
{
this.part = null;
this.facade = null;
this.side = ForgeDirection.UNKNOWN;
this.side = AEPartLocation.INTERNAL;
}
public SelectedPart( IPart part, ForgeDirection side )
public SelectedPart( IPart part, AEPartLocation side )
{
this.part = part;
this.facade = null;
this.side = side;
}
public SelectedPart( IFacadePart facade, ForgeDirection side )
public SelectedPart( IFacadePart facade, AEPartLocation side )
{
this.part = null;
this.facade = facade;
@@ -25,7 +25,6 @@ package appeng.api.recipes;
import net.minecraft.item.ItemStack;
import appeng.api.exceptions.MissingIngredientError;
import appeng.api.exceptions.RegistrationError;
@@ -25,6 +25,7 @@ package appeng.api.recipes;
import java.io.BufferedReader;
import javax.annotation.Nonnull;
@@ -26,12 +26,10 @@ package appeng.api.storage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.client.texture.IAESprite;
/**
@@ -68,7 +66,7 @@ public interface ICellHandler
* assets for examples.
*/
@SideOnly( Side.CLIENT )
IIcon getTopTexture_Light();
IAESprite getTopTexture_Light();
/**
* @return the ME Chest texture for medium pixels this storage cell type, should be 10x10 with 3px of transparent
@@ -76,7 +74,7 @@ public interface ICellHandler
* assets for examples.
*/
@SideOnly( Side.CLIENT )
IIcon getTopTexture_Medium();
IAESprite getTopTexture_Medium();
/**
* @return the ME Chest texture for dark pixels this storage cell type, should be 10x10 with 3px of transparent
@@ -84,7 +82,7 @@ public interface ICellHandler
* assets for examples.
*/
@SideOnly( Side.CLIENT )
IIcon getTopTexture_Dark();
IAESprite getTopTexture_Dark();
/**
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
@@ -26,7 +26,6 @@ package appeng.api.storage;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.data.IAEItemStack;
@@ -25,7 +25,6 @@ package appeng.api.storage;
import net.minecraft.item.ItemStack;
import appeng.api.IAppEngApi;
@@ -26,7 +26,6 @@ package appeng.api.storage;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.api.config.FuzzyMode;
@@ -25,8 +25,7 @@ package appeng.api.storage;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.networking.security.BaseActionSource;
@@ -45,7 +44,7 @@ public interface IExternalStorageHandler
*
* @return true, if it can get a handler via getInventory
*/
boolean canHandle( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc );
boolean canHandle( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource mySrc );
/**
* if this can handle the given inventory, return the a IMEInventory implementing class for it, if not return null
@@ -60,5 +59,5 @@ public interface IExternalStorageHandler
*
* @return The Handler for the inventory
*/
IMEInventory getInventory( TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src );
IMEInventory getInventory( TileEntity te, EnumFacing d, StorageChannel channel, BaseActionSource src );
}
@@ -25,8 +25,7 @@ package appeng.api.storage;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.IAppEngApi;
import appeng.api.networking.security.BaseActionSource;
@@ -54,5 +53,5 @@ public interface IExternalStorageRegistry
*
* @return the handler for a given tile / forge direction
*/
IExternalStorageHandler getHandler( TileEntity te, ForgeDirection opposite, StorageChannel channel, BaseActionSource mySrc );
IExternalStorageHandler getHandler( TileEntity te, EnumFacing opposite, StorageChannel channel, BaseActionSource mySrc );
}
@@ -24,14 +24,13 @@
package appeng.api.storage;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.networking.crafting.ICraftingLink;
import appeng.api.networking.crafting.ICraftingRequester;
import appeng.api.networking.energy.IEnergySource;
@@ -28,14 +28,14 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import com.google.common.collect.ImmutableList;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import com.google.common.collect.ImmutableList;
/**
* Common implementation of a simple class that monitors injection/extraction of a inventory to send events to a list of
@@ -55,13 +55,13 @@ public class MEMonitorHandler<StackType extends IAEStack> implements IMEMonitor<
public MEMonitorHandler( IMEInventoryHandler<StackType> t )
{
this.internalHandler = t;
this.cachedList = (IItemList<StackType>) t.getChannel().createList();
this.cachedList = t.getChannel().createList();
}
public MEMonitorHandler( IMEInventoryHandler<StackType> t, StorageChannel chan )
{
this.internalHandler = t;
this.cachedList = (IItemList<StackType>) chan.createList();
this.cachedList = chan.createList();
}
@Override
@@ -24,12 +24,11 @@
package appeng.api.storage.data;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.nbt.NBTTagCompound;
import java.io.IOException;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.StorageChannel;
@@ -25,7 +25,6 @@ package appeng.api.storage.data;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.features.IItemComparison;
@@ -0,0 +1,53 @@
package appeng.api.util;
import net.minecraft.util.AxisAlignedBB;
/**
* Mutable stand in for Axis Aligned BB, this was used to prevent GC Thrashing.. Related code could also be re-written.
*/
public class AEAxisAlignedBB
{
public double minX;
public double minY;
public double minZ;
public double maxX;
public double maxY;
public double maxZ;
public AxisAlignedBB getBoundingBox()
{
return AxisAlignedBB.fromBounds( minX, minY, minZ, maxX, maxY, maxZ );
}
public AEAxisAlignedBB(double a,double b, double c, double d, double e, double f)
{
minX=a;
minY=b;
minZ=c;
maxX=d;
maxY=e;
maxZ=f;
}
public static AEAxisAlignedBB fromBounds(
double a,
double b,
double c,
double d,
double e,
double f )
{
return new AEAxisAlignedBB(a,b,c,d,e,f);
}
public static AEAxisAlignedBB fromBounds(
AxisAlignedBB bb )
{
return new AEAxisAlignedBB( bb.minX,
bb.minY,
bb.minZ,
bb.maxX,
bb.maxY,
bb.maxZ );
}
}
+25 -18
View File
@@ -27,6 +27,7 @@ package appeng.api.util;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.util.StatCollector;
@@ -38,39 +39,39 @@ import net.minecraft.util.StatCollector;
public enum AEColor
{
White( "gui.appliedenergistics2.White", 0xBEBEBE, 0xDBDBDB, 0xFAFAFA ),
White( "gui.appliedenergistics2.White", EnumDyeColor.WHITE, 0xBEBEBE, 0xDBDBDB, 0xFAFAFA ),
Orange( "gui.appliedenergistics2.Orange", 0xF99739, 0xFAAE44, 0xF4DEC3 ),
Orange( "gui.appliedenergistics2.Orange", EnumDyeColor.ORANGE, 0xF99739, 0xFAAE44, 0xF4DEC3 ),
Magenta( "gui.appliedenergistics2.Magenta", 0x821E82, 0xB82AB8, 0xC598C8 ),
Magenta( "gui.appliedenergistics2.Magenta", EnumDyeColor.MAGENTA, 0x821E82, 0xB82AB8, 0xC598C8 ),
LightBlue( "gui.appliedenergistics2.LightBlue", 0x628DCB, 0x82ACE7, 0xD8F6FF ),
LightBlue( "gui.appliedenergistics2.LightBlue", EnumDyeColor.LIGHT_BLUE, 0x628DCB, 0x82ACE7, 0xD8F6FF ),
Yellow( "gui.appliedenergistics2.Yellow", 0xFFF7AA, 0xF8FF4A, 0xFFFFE8 ),
Yellow( "gui.appliedenergistics2.Yellow", EnumDyeColor.YELLOW, 0xFFF7AA, 0xF8FF4A, 0xFFFFE8 ),
Lime( "gui.appliedenergistics2.Lime", 0x7CFF4A, 0xBBFF51, 0xE7F7D7 ),
Lime( "gui.appliedenergistics2.Lime", EnumDyeColor.LIME, 0x7CFF4A, 0xBBFF51, 0xE7F7D7 ),
Pink( "gui.appliedenergistics2.Pink", 0xDC8DB5, 0xF8B5D7, 0xF7DEEB ),
Pink( "gui.appliedenergistics2.Pink", EnumDyeColor.PINK, 0xDC8DB5, 0xF8B5D7, 0xF7DEEB ),
Gray( "gui.appliedenergistics2.Gray", 0x7C7C7C, 0xA0A0A0, 0xC9C9C9 ),
Gray( "gui.appliedenergistics2.Gray", EnumDyeColor.GRAY, 0x7C7C7C, 0xA0A0A0, 0xC9C9C9 ),
LightGray( "gui.appliedenergistics2.LightGray", 0x9D9D9D, 0xCDCDCD, 0xEFEFEF ),
LightGray( "gui.appliedenergistics2.LightGray", EnumDyeColor.SILVER, 0x9D9D9D, 0xCDCDCD, 0xEFEFEF ),
Cyan( "gui.appliedenergistics2.Cyan", 0x2F9BA5, 0x51AAC6, 0xAEDDF4 ),
Cyan( "gui.appliedenergistics2.Cyan", EnumDyeColor.CYAN, 0x2F9BA5, 0x51AAC6, 0xAEDDF4 ),
Purple( "gui.appliedenergistics2.Purple", 0x8230B2, 0xA453CE, 0xC7A3CC ),
Purple( "gui.appliedenergistics2.Purple", EnumDyeColor.PURPLE, 0x8230B2, 0xA453CE, 0xC7A3CC ),
Blue( "gui.appliedenergistics2.Blue", 0x2D29A0, 0x514AFF, 0xDDE6FF ),
Blue( "gui.appliedenergistics2.Blue", EnumDyeColor.BLUE, 0x2D29A0, 0x514AFF, 0xDDE6FF ),
Brown( "gui.appliedenergistics2.Brown", 0x724E35, 0xB7967F, 0xE0D2C8 ),
Brown( "gui.appliedenergistics2.Brown", EnumDyeColor.BROWN, 0x724E35, 0xB7967F, 0xE0D2C8 ),
Green( "gui.appliedenergistics2.Green", 0x45A021, 0x60E32E, 0xE3F2E3 ),
Green( "gui.appliedenergistics2.Green", EnumDyeColor.GREEN, 0x45A021, 0x60E32E, 0xE3F2E3 ),
Red( "gui.appliedenergistics2.Red", 0xA50029, 0xFF003C, 0xFFE6ED ),
Red( "gui.appliedenergistics2.Red", EnumDyeColor.RED, 0xA50029, 0xFF003C, 0xFFE6ED ),
Black( "gui.appliedenergistics2.Black", 0x2B2B2B, 0x565656, 0x848484 ),
Black( "gui.appliedenergistics2.Black", EnumDyeColor.BLACK, 0x2B2B2B, 0x565656, 0x848484 ),
Transparent( "gui.appliedenergistics2.Fluix", 0x1B2344, 0x895CA8, 0xD7BBEC );
Transparent( "gui.appliedenergistics2.Fluix", null, 0x1B2344, 0x895CA8, 0xD7BBEC );
public static final List<AEColor> VALID_COLORS = Arrays.asList( White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, Green, Red, Black );
@@ -94,12 +95,18 @@ public enum AEColor
*/
public final int whiteVariant;
AEColor( String unlocalizedName, int blackHex, int medHex, int whiteHex )
/**
* Vanilla Dye Equivilient
*/
public final EnumDyeColor dye;
AEColor( String unlocalizedName, EnumDyeColor dye, int blackHex, int medHex, int whiteHex )
{
this.unlocalizedName = unlocalizedName;
this.blackVariant = blackHex;
this.mediumVariant = medHex;
this.whiteVariant = whiteHex;
this.dye = dye;
}
/**
@@ -30,8 +30,8 @@ import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.definitions.IComparableDefinition;
import appeng.api.definitions.IItemDefinition;
@@ -98,14 +98,12 @@ public interface AEItemDefinition
* Compare Block with world.
*
* @param world world of block
* @param x x pos of block
* @param y y pos of block
* @param z z pos of block
* @param pos in world.
*
* @return if the block is placed in the world at the specific location.
*
* @deprecated use {@link IComparableDefinition#isSameAs(IBlockAccess, int, int, int)} }
*/
@Deprecated
boolean sameAsBlock( IBlockAccess world, int x, int y, int z );
boolean sameAsBlock( IBlockAccess world, BlockPos pos );
}
@@ -0,0 +1,100 @@
package appeng.api.util;
import net.minecraft.util.EnumFacing;
/**
* Stand in for previous Forge Direction, Several uses of this class are simply legacy where as some uses of this class are intended.
*/
public enum AEPartLocation
{
/**
* Negative Y
*/
DOWN(0, -1, 0),
/**
* Positive Y
*/
UP(0, 1, 0),
/**
* Negative Z
*/
NORTH(0, 0, -1),
/**
* Positive Z
*/
SOUTH(0, 0, 1),
/**
* Negative X
*/
WEST(-1, 0, 0),
/**
* Posative X
*/
EAST(1, 0, 0),
/**
* Center or inside of the block.
*/
INTERNAL(0, 0, 0);
public final int xOffset;
public final int yOffset;
public final int zOffset;
private static final EnumFacing[] facings = { EnumFacing.DOWN, EnumFacing.UP, EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST, null };
private static final int[] OPPOSITES = {1, 0, 3, 2, 5, 4, 6};
public static final AEPartLocation[] SIDE_LOCATIONS = {DOWN, UP, NORTH, SOUTH, WEST, EAST};
private AEPartLocation(int x, int y, int z)
{
xOffset = x;
yOffset = y;
zOffset = z;
}
/**
* @return Part Location
*/
public static AEPartLocation fromOrdinal(int id)
{
if (id >= 0 && id < SIDE_LOCATIONS.length)
return SIDE_LOCATIONS[id];
return INTERNAL;
}
/**
* 100% chance of success.
*
* @param side
* @return proper Part Location for a facing enum.
*/
public static AEPartLocation fromFacing(EnumFacing side)
{
if ( side == null ) return INTERNAL;
return values()[side.ordinal()];
}
/**
* @return Opposite Part Location, INTERNAL remains INTERNAL.
*/
public AEPartLocation getOpposite()
{
return fromOrdinal(OPPOSITES[ordinal()]);
}
/**
* @return EnumFacing Equivalence, if Center returns null.
*/
public EnumFacing getFacing()
{
return facings[ordinal()];
}
}
@@ -25,6 +25,7 @@ package appeng.api.util;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
@@ -47,15 +48,22 @@ public class DimensionalCoord extends WorldCoord
public DimensionalCoord( TileEntity s )
{
super( s );
this.w = s.getWorldObj();
this.dimId = this.w.provider.dimensionId;
this.w = s.getWorld();
this.dimId = this.w.provider.getDimensionId();
}
public DimensionalCoord( World _w, int _x, int _y, int _z )
public DimensionalCoord( World _w, int x, int y, int z )
{
super( _x, _y, _z );
super( x,y,z );
this.w = _w;
this.dimId = _w.provider.dimensionId;
this.dimId = _w.provider.getDimensionId();
}
public DimensionalCoord( World _w, BlockPos pos )
{
super( pos );
this.w = _w;
this.dimId = _w.provider.getDimensionId();
}
@Override
@@ -96,4 +104,5 @@ public class DimensionalCoord extends WorldCoord
{
return this.w;
}
}
@@ -27,6 +27,7 @@ package appeng.api.util;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
@@ -38,10 +39,8 @@ public interface ICommonTile
* the block itself.
*
* @param world world of tile entity
* @param x x pos of tile entity
* @param y y pos of tile entity
* @param z z pos of tile entity
* @param pos location of the block
* @param drops drops of tile entity
*/
void getDrops( World world, int x, int y, int z, List<ItemStack> drops );
void getDrops( World world, BlockPos pos, List<ItemStack> drops );
}
@@ -27,7 +27,6 @@ package appeng.api.util;
import java.util.Set;
import net.minecraft.nbt.NBTTagCompound;
import appeng.api.config.Settings;
@@ -23,8 +23,9 @@
package appeng.api.util;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.util.ForgeDirection;
/**
@@ -45,12 +46,12 @@ public interface IOrientable
/**
* @return the direction the tile is facing
*/
ForgeDirection getForward();
EnumFacing getForward();
/**
* @return the direction top of the tile
*/
ForgeDirection getUp();
EnumFacing getUp();
/**
* Update the orientation
@@ -58,5 +59,5 @@ public interface IOrientable
* @param Forward new forward direction
* @param Up new upwards direction
*/
void setOrientation( ForgeDirection Forward, ForgeDirection Up );
void setOrientation( EnumFacing Forward, EnumFacing Up );
}
@@ -24,6 +24,7 @@
package appeng.api.util;
import net.minecraft.util.BlockPos;
import net.minecraft.world.IBlockAccess;
@@ -46,5 +47,5 @@ public interface IOrientableBlock
*
* @return a IOrientable if applicable
*/
IOrientable getOrientable( IBlockAccess world, int x, int y, int z );
IOrientable getOrientable( IBlockAccess world, BlockPos z );
}
+36 -23
View File
@@ -25,7 +25,7 @@ package appeng.api.util;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.BlockPos;
/**
@@ -41,7 +41,7 @@ public class WorldCoord
public WorldCoord( TileEntity s )
{
this( s.xCoord, s.yCoord, s.zCoord );
this( s.getPos() );
}
public WorldCoord( int _x, int _y, int _z )
@@ -51,11 +51,19 @@ public class WorldCoord
this.z = _z;
}
public WorldCoord subtract( ForgeDirection direction, int length )
public WorldCoord(
BlockPos pos )
{
this.x -= direction.offsetX * length;
this.y -= direction.offsetY * length;
this.z -= direction.offsetZ * length;
x = pos.getX();
y = pos.getY();
z = pos.getZ();
}
public WorldCoord subtract( AEPartLocation direction, int length )
{
this.x -= direction.xOffset * length;
this.y -= direction.yOffset * length;
this.z -= direction.zOffset * length;
return this;
}
@@ -94,7 +102,7 @@ public class WorldCoord
/**
* Will Return NULL if it's at some diagonal!
*/
public ForgeDirection directionTo( WorldCoord loc )
public AEPartLocation directionTo( WorldCoord loc )
{
int ox = this.x - loc.x;
int oy = this.y - loc.y;
@@ -104,34 +112,34 @@ public class WorldCoord
int ylen = Math.abs( oy );
int zlen = Math.abs( oz );
if( loc.isEqual( this.copy().add( ForgeDirection.EAST, xlen ) ) )
if( loc.isEqual( this.copy().add( AEPartLocation.EAST, xlen ) ) )
{
return ForgeDirection.EAST;
return AEPartLocation.EAST;
}
if( loc.isEqual( this.copy().add( ForgeDirection.WEST, xlen ) ) )
if( loc.isEqual( this.copy().add( AEPartLocation.WEST, xlen ) ) )
{
return ForgeDirection.WEST;
return AEPartLocation.WEST;
}
if( loc.isEqual( this.copy().add( ForgeDirection.NORTH, zlen ) ) )
if( loc.isEqual( this.copy().add( AEPartLocation.NORTH, zlen ) ) )
{
return ForgeDirection.NORTH;
return AEPartLocation.NORTH;
}
if( loc.isEqual( this.copy().add( ForgeDirection.SOUTH, zlen ) ) )
if( loc.isEqual( this.copy().add( AEPartLocation.SOUTH, zlen ) ) )
{
return ForgeDirection.SOUTH;
return AEPartLocation.SOUTH;
}
if( loc.isEqual( this.copy().add( ForgeDirection.UP, ylen ) ) )
if( loc.isEqual( this.copy().add( AEPartLocation.UP, ylen ) ) )
{
return ForgeDirection.UP;
return AEPartLocation.UP;
}
if( loc.isEqual( this.copy().add( ForgeDirection.DOWN, ylen ) ) )
if( loc.isEqual( this.copy().add( AEPartLocation.DOWN, ylen ) ) )
{
return ForgeDirection.DOWN;
return AEPartLocation.DOWN;
}
return null;
@@ -142,11 +150,11 @@ public class WorldCoord
return this.x == c.x && this.y == c.y && this.z == c.z;
}
public WorldCoord add( ForgeDirection direction, int length )
public WorldCoord add( AEPartLocation direction, int length )
{
this.x += direction.offsetX * length;
this.y += direction.offsetY * length;
this.z += direction.offsetZ * length;
this.x += direction.xOffset * length;
this.y += direction.yOffset * length;
this.z += direction.zOffset * length;
return this;
}
@@ -167,6 +175,11 @@ public class WorldCoord
return obj instanceof WorldCoord && this.isEqual( (WorldCoord) obj );
}
public BlockPos getPos()
{
return new BlockPos(x,y,z);
}
@Override
public String toString()
{