diff --git a/src/api/java/buildcraft/api/core/BlockIndex.java b/src/api/java/buildcraft/api/core/BlockIndex.java index 4553a2cf6..0389ab40d 100755 --- a/src/api/java/buildcraft/api/core/BlockIndex.java +++ b/src/api/java/buildcraft/api/core/BlockIndex.java @@ -12,6 +12,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; /** @@ -29,6 +30,12 @@ public class BlockIndex implements Comparable { /** * Creates an index for a block located on x, y. z */ + public BlockIndex(BlockPos pos) { + this.x = pos.getX(); + this.y = pos.getY(); + this.z = pos.getZ(); + } + public BlockIndex(int x, int y, int z) { this.x = x; this.y = y; @@ -48,7 +55,7 @@ public class BlockIndex implements Comparable { } public BlockIndex(TileEntity entity) { - this(entity.xCoord, entity.yCoord, entity.zCoord); + this(entity.getPos()); } /** @@ -80,7 +87,7 @@ public class BlockIndex implements Comparable { } public Block getBlock(World world) { - return world.getBlock(x, y, z); + return world.getBlockState(new BlockPos(x, y, z)).getBlock(); } @Override diff --git a/src/api/java/buildcraft/api/core/EnumColor.java b/src/api/java/buildcraft/api/core/EnumColor.java index 2f7763911..aab61399f 100755 --- a/src/api/java/buildcraft/api/core/EnumColor.java +++ b/src/api/java/buildcraft/api/core/EnumColor.java @@ -11,10 +11,7 @@ package buildcraft.api.core; import java.util.Locale; import java.util.Random; -import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; public enum EnumColor { @@ -105,8 +102,6 @@ public enum EnumColor { 0xEA7835, 0xe4e4e4}; - @SideOnly(Side.CLIENT) - private static IIcon[] brushIcons; public int getDarkHex() { return DARK_HEX[ordinal()]; @@ -189,13 +184,4 @@ public enum EnumColor { } return b.toString().trim(); } - - public static void setIconArray(IIcon[] icons) { - brushIcons = icons; - } - - @SideOnly(Side.CLIENT) - public IIcon getIcon() { - return brushIcons [ordinal()]; - } } diff --git a/src/api/java/buildcraft/api/core/IIconProvider.java b/src/api/java/buildcraft/api/core/IIconProvider.java index 876977cb2..d49858bd4 100755 --- a/src/api/java/buildcraft/api/core/IIconProvider.java +++ b/src/api/java/buildcraft/api/core/IIconProvider.java @@ -8,24 +8,10 @@ */ package buildcraft.api.core; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.util.IIcon; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public interface IIconProvider { - /** - * @param iconIndex - */ - @SideOnly(Side.CLIENT) - IIcon getIcon(int iconIndex); - - /** - * A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider - * @param iconRegister - */ - @SideOnly(Side.CLIENT) - void registerIcons(IIconRegister iconRegister); } diff --git a/src/api/java/buildcraft/api/core/Position.java b/src/api/java/buildcraft/api/core/Position.java index 84e0d6f1b..ac41d43b4 100755 --- a/src/api/java/buildcraft/api/core/Position.java +++ b/src/api/java/buildcraft/api/core/Position.java @@ -16,30 +16,30 @@ import net.minecraft.util.EnumFacing; public class Position implements ISerializable { public double x, y, z; - public ForgeDirection orientation; + public EnumFacing orientation; public Position() { x = 0; y = 0; z = 0; - orientation = ForgeDirection.UNKNOWN; + orientation = null; } public Position(double ci, double cj, double ck) { x = ci; y = cj; z = ck; - orientation = ForgeDirection.UNKNOWN; + orientation = null; } - public Position(double ci, double cj, double ck, ForgeDirection corientation) { + public Position(double ci, double cj, double ck, EnumFacing corientation) { x = ci; y = cj; z = ck; orientation = corientation; if (orientation == null) { - orientation = ForgeDirection.UNKNOWN; + orientation = null; } } @@ -55,17 +55,17 @@ public class Position implements ISerializable { } public Position(TileEntity tile) { - x = tile.xCoord; - y = tile.yCoord; - z = tile.zCoord; - orientation = ForgeDirection.UNKNOWN; + x = tile.getPos().getX(); + y = tile.getPos().getY(); + z = tile.getPos().getZ(); + orientation = null; } public Position(BlockIndex index) { x = index.x; y = index.y; z = index.z; - orientation = ForgeDirection.UNKNOWN; + orientation = null; } public void moveRight(double step) { @@ -137,7 +137,7 @@ public class Position implements ISerializable { public void writeToNBT(NBTTagCompound nbttagcompound) { if (orientation == null) { - orientation = ForgeDirection.UNKNOWN; + orientation = null; } nbttagcompound.setDouble("i", x); @@ -150,7 +150,7 @@ public class Position implements ISerializable { x = nbttagcompound.getDouble("i"); y = nbttagcompound.getDouble("j"); z = nbttagcompound.getDouble("k"); - orientation = ForgeDirection.values() [nbttagcompound.getByte("orientation")]; + orientation = EnumFacing.VALUES [nbttagcompound.getByte("orientation")]; } @Override @@ -181,7 +181,7 @@ public class Position implements ISerializable { x = stream.readDouble(); y = stream.readDouble(); z = stream.readDouble(); - orientation = ForgeDirection.getOrientation(stream.readByte()); + orientation = EnumFacing.getFront(stream.readByte()); } @Override diff --git a/src/api/java/buildcraft/api/core/render/ICullable.java b/src/api/java/buildcraft/api/core/render/ICullable.java index 63b56e1c6..094658e3d 100755 --- a/src/api/java/buildcraft/api/core/render/ICullable.java +++ b/src/api/java/buildcraft/api/core/render/ICullable.java @@ -21,7 +21,7 @@ public interface ICullable { //They are used to effectively cull obstructed sides while processing facades. //Make sure your implementation is correct otherwise expect FPS drop - void setRenderSide(ForgeDirection side, boolean render); + void setRenderSide(EnumFacing side, boolean render); void setRenderAllSides(); diff --git a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java b/src/api/java/buildcraft/api/core/render/ITextureStateManager.java deleted file mode 100755 index 8161d6b93..000000000 --- a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java +++ /dev/null @@ -1,7 +0,0 @@ -package buildcraft.api.core.render; - -import net.minecraft.util.IIcon; - -public interface ITextureStateManager { - void set(IIcon icon); -} diff --git a/src/api/java/buildcraft/api/core/render/ITextureStates.java b/src/api/java/buildcraft/api/core/render/ITextureStates.java index 835caf7fe..3dd0fd9fb 100755 --- a/src/api/java/buildcraft/api/core/render/ITextureStates.java +++ b/src/api/java/buildcraft/api/core/render/ITextureStates.java @@ -9,14 +9,9 @@ package buildcraft.api.core.render; import net.minecraft.block.Block; -import net.minecraft.util.IIcon; public interface ITextureStates extends ICullable { - ITextureStateManager getTextureState(); - - IIcon getIcon(int side, int meta); - Block getBlock(); } diff --git a/src/api/java/cofh/api/energy/IEnergyHandler.java b/src/api/java/cofh/api/energy/IEnergyHandler.java index 8e2493344..1f8967bea 100644 --- a/src/api/java/cofh/api/energy/IEnergyHandler.java +++ b/src/api/java/cofh/api/energy/IEnergyHandler.java @@ -26,7 +26,7 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { * @return Amount of energy that was (or would have been, if simulated) received. */ @Override - int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate); + int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate); /** * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. @@ -40,19 +40,19 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { * @return Amount of energy that was (or would have been, if simulated) extracted. */ @Override - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); + int extractEnergy(EnumFacing from, int maxExtract, boolean simulate); /** * Returns the amount of energy currently stored. */ @Override - int getEnergyStored(ForgeDirection from); + int getEnergyStored(EnumFacing from); /** * Returns the maximum amount of energy that can be stored. */ @Override - int getMaxEnergyStored(ForgeDirection from); + int getMaxEnergyStored(EnumFacing from); } diff --git a/src/api/java/cofh/api/energy/IEnergyProvider.java b/src/api/java/cofh/api/energy/IEnergyProvider.java index 5eb709471..584c1ebcf 100644 --- a/src/api/java/cofh/api/energy/IEnergyProvider.java +++ b/src/api/java/cofh/api/energy/IEnergyProvider.java @@ -23,16 +23,16 @@ public interface IEnergyProvider extends IEnergyConnection { * If TRUE, the extraction will only be simulated. * @return Amount of energy that was (or would have been, if simulated) extracted. */ - int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); + int extractEnergy(EnumFacing from, int maxExtract, boolean simulate); /** * Returns the amount of energy currently stored. */ - int getEnergyStored(ForgeDirection from); + int getEnergyStored(EnumFacing from); /** * Returns the maximum amount of energy that can be stored. */ - int getMaxEnergyStored(ForgeDirection from); + int getMaxEnergyStored(EnumFacing from); } diff --git a/src/api/java/cofh/api/energy/ItemEnergyContainer.java b/src/api/java/cofh/api/energy/ItemEnergyContainer.java index 055ae45bc..6ff02225a 100644 --- a/src/api/java/cofh/api/energy/ItemEnergyContainer.java +++ b/src/api/java/cofh/api/energy/ItemEnergyContainer.java @@ -63,15 +63,15 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { @Override public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { - if (container.stackTagCompound == null) { - container.stackTagCompound = new NBTTagCompound(); + if (container.getTagCompound() == null) { + container.setTagCompound(new NBTTagCompound()); } - int energy = container.stackTagCompound.getInteger("Energy"); + int energy = container.getTagCompound().getInteger("Energy"); int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive)); if (!simulate) { energy += energyReceived; - container.stackTagCompound.setInteger("Energy", energy); + container.getTagCompound().setInteger("Energy", energy); } return energyReceived; } @@ -79,15 +79,15 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { @Override public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) { return 0; } - int energy = container.stackTagCompound.getInteger("Energy"); + int energy = container.getTagCompound().getInteger("Energy"); int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract)); if (!simulate) { energy -= energyExtracted; - container.stackTagCompound.setInteger("Energy", energy); + container.getTagCompound().setInteger("Energy", energy); } return energyExtracted; } @@ -95,10 +95,10 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { @Override public int getEnergyStored(ItemStack container) { - if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) { + if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) { return 0; } - return container.stackTagCompound.getInteger("Energy"); + return container.getTagCompound().getInteger("Energy"); } @Override diff --git a/src/api/java/cofh/api/energy/TileEnergyHandler.java b/src/api/java/cofh/api/energy/TileEnergyHandler.java index 14129845e..175ee6676 100644 --- a/src/api/java/cofh/api/energy/TileEnergyHandler.java +++ b/src/api/java/cofh/api/energy/TileEnergyHandler.java @@ -30,34 +30,34 @@ public class TileEnergyHandler extends TileEntity implements IEnergyHandler { /* IEnergyConnection */ @Override - public boolean canConnectEnergy(ForgeDirection from) { + public boolean canConnectEnergy(EnumFacing from) { return true; } /* IEnergyReceiver */ @Override - public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) { + public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) { return storage.receiveEnergy(maxReceive, simulate); } /* IEnergyProvider */ @Override - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) { + public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) { return storage.extractEnergy(maxExtract, simulate); } /* IEnergyReceiver and IEnergyProvider */ @Override - public int getEnergyStored(ForgeDirection from) { + public int getEnergyStored(EnumFacing from) { return storage.getEnergyStored(); } @Override - public int getMaxEnergyStored(ForgeDirection from) { + public int getMaxEnergyStored(EnumFacing from) { return storage.getMaxEnergyStored(); } diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java index e7e96810a..17d453776 100644 --- a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java +++ b/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java @@ -11,7 +11,7 @@ import dan200.computercraft.api.lua.LuaException; import dan200.computercraft.api.peripheral.IPeripheral; import net.minecraft.inventory.IInventory; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.BlockPos; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -31,7 +31,7 @@ public interface ITurtleAccess * Returns a vector containing the integer co-ordinates at which the turtle resides. * @return a vector containing the integer co-ordinates at which the turtle resides. */ - public ChunkCoordinates getPosition(); + public BlockPos getPosition(); /** * TODO: Document me diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java index 461d6e2bc..f1254cd82 100644 --- a/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java +++ b/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java @@ -7,8 +7,9 @@ package dan200.computercraft.api.turtle; import dan200.computercraft.api.peripheral.IPeripheral; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; /** * The primary interface for defining an turtle for Turtles. A turtle turtle @@ -85,7 +86,7 @@ public interface ITurtleUpgrade * @param side Which side of the turtle (left or right) the peripheral resides on. * @return The IIcon that you wish to be used to render your turtle peripheral. */ - public IIcon getIcon( ITurtleAccess turtle, TurtleSide side ); + public TextureAtlasSprite getIcon(ITurtleAccess turtle, TurtleSide side ); /** * TODO: Document me diff --git a/src/api/java/ic2/api/Direction.java b/src/api/java/ic2/api/Direction.java index 13eb00cc7..69004b2dc 100644 --- a/src/api/java/ic2/api/Direction.java +++ b/src/api/java/ic2/api/Direction.java @@ -1,6 +1,7 @@ package ic2.api; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.util.EnumFacing; @@ -40,8 +41,8 @@ public enum Direction { return directions[(side + 2) % 6]; } - public static Direction fromForgeDirection(ForgeDirection dir) { - if (dir == ForgeDirection.UNKNOWN) return null; + public static Direction fromEnumFacing(EnumFacing dir) { + if (dir == null) return null; return fromSideValue(dir.ordinal()); } @@ -53,7 +54,7 @@ public enum Direction { * @return Adjacent tile entity or null if none exists */ public TileEntity applyToTileEntity(TileEntity te) { - return applyTo(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord); + return applyTo(te.getWorld(), te.getPos().getX(), te.getPos().getY(), te.getPos().getZ()); } /** @@ -65,14 +66,12 @@ public enum Direction { * @param z Z coordinate to check from * @return Adjacent tile entity or null if none exists */ - public TileEntity applyTo(World world, int x, int y, int z) { - int coords[] = { x, y, z }; + public TileEntity applyTo(World world, BlockPos pos) { - coords[ordinal() / 2] += getSign(); - if (world != null && world.blockExists(coords[0], coords[1], coords[2])) { + if (world != null && world.blockExists(pos)) { try { - return world.getTileEntity(coords[0], coords[1], coords[2]); + return world.getTileEntity(pos); } catch (Exception e) { throw new RuntimeException("error getting TileEntity at dim "+world.provider.dimensionId+" "+coords[0]+"/"+coords[1]+"/"+coords[2]); } @@ -108,8 +107,8 @@ public enum Direction { return (ordinal() % 2) * 2 - 1; } - public ForgeDirection toForgeDirection() { - return ForgeDirection.getOrientation(toSideValue()); + public EnumFacing toEnumFacing() { + return EnumFacing.getOrientation(toSideValue()); } public static final Direction[] directions = Direction.values(); diff --git a/src/api/java/ic2/api/crops/CropCard.java b/src/api/java/ic2/api/crops/CropCard.java index ac2f832b9..952cc4306 100644 --- a/src/api/java/ic2/api/crops/CropCard.java +++ b/src/api/java/ic2/api/crops/CropCard.java @@ -1,11 +1,9 @@ package ic2.api.crops; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.ModContainer; @@ -143,37 +141,6 @@ public abstract class CropCard { */ public abstract int maxSize(); - /** - * Instantiate your Icons here. - * - * This method will get called by IC2, don't call it yourself. - * - * It's highly recommended to use your own assert domain here, e.g. yourmod:crop/* instead of - * ic2:crop/*, which will then read assets/yourmod/textures/blocks/crop/*.png. - */ - @SideOnly(Side.CLIENT) - public void registerSprites(IIconRegister iconRegister) { - textures = new IIcon[maxSize()]; - - for (int i = 1; i <= textures.length; i++) { - // ic2:crop/blockCrop.NAME.n is the legacy name for backwards compatiblity - textures[i - 1] = iconRegister.registerIcon("ic2:crop/blockCrop."+name()+"."+i); - } - } - - /** - * Sprite the crop is meant to be rendered with. - * - * @param crop reference to ICropTile - * @return 0-255, representing the sprite index on the crop's spritesheet. - */ - @SideOnly(Side.CLIENT) - public IIcon getSprite(ICropTile crop) { - if (crop.getSize() <= 0 || crop.getSize() > textures.length) return null; - - return textures[crop.getSize() - 1]; - } - /** * Amount of growth points needed to increase the plant's size. * Default is 200 * tier. @@ -426,8 +393,5 @@ public abstract class CropCard { } } - @SideOnly(Side.CLIENT) - protected IIcon textures[]; - private final String modId; // TODO: make owner abstract, remove modId auto detection } diff --git a/src/api/java/ic2/api/crops/Crops.java b/src/api/java/ic2/api/crops/Crops.java index 6907e3c31..1fc86e486 100644 --- a/src/api/java/ic2/api/crops/Crops.java +++ b/src/api/java/ic2/api/crops/Crops.java @@ -2,7 +2,6 @@ package ic2.api.crops; import java.util.Collection; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.world.biome.BiomeGenBase; @@ -131,14 +130,6 @@ public abstract class Crops { */ public abstract BaseSeed getBaseSeed(ItemStack stack); - /** - * Execute registerSprites for all registered crop cards. - * - * This method will get called by IC2, don't call it yourself. - */ - @SideOnly(Side.CLIENT) - public abstract void startSpriteRegistration(IIconRegister iconRegister); - /** * Returns the ID for the given crop. * diff --git a/src/api/java/ic2/api/crops/ICropTile.java b/src/api/java/ic2/api/crops/ICropTile.java index 6fd887ee0..9c7e32dde 100644 --- a/src/api/java/ic2/api/crops/ICropTile.java +++ b/src/api/java/ic2/api/crops/ICropTile.java @@ -3,7 +3,7 @@ package ic2.api.crops; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; /** @@ -207,7 +207,7 @@ public interface ICropTile { * * @return Crop location */ - public ChunkCoordinates getLocation(); + public BlockPos getLocation(); /** * Get the crop's light level. diff --git a/src/api/java/ic2/api/energy/IEnergyNet.java b/src/api/java/ic2/api/energy/IEnergyNet.java index 792cdbf6a..6c3bac5a7 100644 --- a/src/api/java/ic2/api/energy/IEnergyNet.java +++ b/src/api/java/ic2/api/energy/IEnergyNet.java @@ -1,6 +1,7 @@ package ic2.api.energy; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraft.util.EnumFacing; @@ -25,7 +26,7 @@ public interface IEnergyNet { * @param z z-coordinate * @return tile entity registered to the energy net or null if none is registered */ - TileEntity getTileEntity(World world, int x, int y, int z); + TileEntity getTileEntity(World world, BlockPos pos); /** * Get the EnergyNet-registered neighbor tile entity at the specified position. @@ -34,7 +35,7 @@ public interface IEnergyNet { * @param dir direction the neighbor is to be found * @return neighbor tile entity registered to the energy net or null if none is registered */ - TileEntity getNeighbor(TileEntity te, ForgeDirection dir); + TileEntity getNeighbor(TileEntity te, EnumFacing dir); /** * determine how much energy has been emitted by the EnergyEmitter specified diff --git a/src/api/java/ic2/api/energy/event/EnergyTileEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileEvent.java index 86b8dc2b1..e4571693b 100644 --- a/src/api/java/ic2/api/energy/event/EnergyTileEvent.java +++ b/src/api/java/ic2/api/energy/event/EnergyTileEvent.java @@ -15,7 +15,7 @@ public class EnergyTileEvent extends WorldEvent { public final IEnergyTile energyTile; public EnergyTileEvent(IEnergyTile energyTile1) { - super(((TileEntity) energyTile1).getWorldObj()); + super(((TileEntity) energyTile1).getWorld()); if (world == null) throw new NullPointerException("world is null"); diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.java b/src/api/java/ic2/api/energy/prefab/BasicSink.java index 2b4b139b7..9419ec7a8 100644 --- a/src/api/java/ic2/api/energy/prefab/BasicSink.java +++ b/src/api/java/ic2/api/energy/prefab/BasicSink.java @@ -340,7 +340,7 @@ public class BasicSink extends TileEntity implements IEnergySink { // energy net interface >> @Override - public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) { + public boolean acceptsEnergyFrom(TileEntity emitter, EnumFacing direction) { return true; } @@ -350,7 +350,7 @@ public class BasicSink extends TileEntity implements IEnergySink { } @Override - public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) { + public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) { energyStored += amount; return 0; diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.java b/src/api/java/ic2/api/energy/prefab/BasicSource.java index 9a51739b3..af8b06f95 100644 --- a/src/api/java/ic2/api/energy/prefab/BasicSource.java +++ b/src/api/java/ic2/api/energy/prefab/BasicSource.java @@ -343,7 +343,7 @@ public class BasicSource extends TileEntity implements IEnergySource { // energy net interface >> @Override - public boolean emitsEnergyTo(TileEntity receiver, ForgeDirection direction) { + public boolean emitsEnergyTo(TileEntity receiver, EnumFacing direction) { return true; } diff --git a/src/api/java/ic2/api/energy/tile/IHeatSource.java b/src/api/java/ic2/api/energy/tile/IHeatSource.java index aec9b6c30..c442d10fd 100644 --- a/src/api/java/ic2/api/energy/tile/IHeatSource.java +++ b/src/api/java/ic2/api/energy/tile/IHeatSource.java @@ -7,7 +7,7 @@ public interface IHeatSource { /* * Return max heat transmission peer Tick (only theoretical bandwidth not available amount) */ - int maxrequestHeatTick(ForgeDirection directionFrom); + int maxrequestHeatTick(EnumFacing directionFrom); /* * @param requested amount of heat to transfer @@ -19,5 +19,5 @@ public interface IHeatSource { * requestHeat(100) : return 50 : so 50 units of heat remove from HeatSource */ - int requestHeat(ForgeDirection directionFrom, int requestheat); + int requestHeat(EnumFacing directionFrom, int requestheat); } diff --git a/src/api/java/ic2/api/energy/tile/IKineticSource.java b/src/api/java/ic2/api/energy/tile/IKineticSource.java index 56fbaea0b..37b0226c8 100644 --- a/src/api/java/ic2/api/energy/tile/IKineticSource.java +++ b/src/api/java/ic2/api/energy/tile/IKineticSource.java @@ -6,7 +6,7 @@ public interface IKineticSource { /* * Return max kinetic energy transmission peer Tick (only theoretical bandwidth not available amount) */ - int maxrequestkineticenergyTick(ForgeDirection directionFrom); + int maxrequestkineticenergyTick(EnumFacing directionFrom); /* * @param requested amount of kinetic energy to transfer @@ -18,5 +18,5 @@ public interface IKineticSource { * requestkineticenergy(100) : return 50 : so 50 units of kinetic energy remove from KineticSource */ - int requestkineticenergy(ForgeDirection directionFrom, int requestkineticenergy); + int requestkineticenergy(EnumFacing directionFrom, int requestkineticenergy); } diff --git a/src/api/java/ic2/api/tile/IEnergyStorage.java b/src/api/java/ic2/api/tile/IEnergyStorage.java index b35b0469d..8fd96da2c 100644 --- a/src/api/java/ic2/api/tile/IEnergyStorage.java +++ b/src/api/java/ic2/api/tile/IEnergyStorage.java @@ -57,5 +57,5 @@ public interface IEnergyStorage { * @param side side the teleporter is draining energy from * @return Whether the block is teleporter compatible */ - public boolean isTeleporterCompatible(ForgeDirection side); + public boolean isTeleporterCompatible(EnumFacing side); } diff --git a/src/main/java/mekanism/client/render/RenderTickHandler.java b/src/main/java/mekanism/client/render/RenderTickHandler.java index a1285d860..7a0a58d00 100644 --- a/src/main/java/mekanism/client/render/RenderTickHandler.java +++ b/src/main/java/mekanism/client/render/RenderTickHandler.java @@ -20,6 +20,7 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.particle.EntityFX; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; @@ -139,16 +140,16 @@ public class RenderTickHandler mRight.translate(rRight); Pos3D v = playerPos.clone().translate(vLeft); - spawnAndSetParticle("flame", world, v.xCoord, v.yCoord, v.zCoord, mLeft.xCoord, mLeft.yCoord, mLeft.zCoord); - spawnAndSetParticle("smoke", world, v.xCoord, v.yCoord, v.zCoord, mLeft.xCoord, mLeft.yCoord, mLeft.zCoord); + spawnAndSetParticle(EnumParticleTypes.FLAME, world, v.xCoord, v.yCoord, v.zCoord, mLeft.xCoord, mLeft.yCoord, mLeft.zCoord); + spawnAndSetParticle(EnumParticleTypes.SMOKE_NORMAL, world, v.xCoord, v.yCoord, v.zCoord, mLeft.xCoord, mLeft.yCoord, mLeft.zCoord); v = playerPos.clone().translate(vRight); - spawnAndSetParticle("flame", world, v.xCoord, v.yCoord, v.zCoord, mRight.xCoord, mRight.yCoord, mRight.zCoord); - spawnAndSetParticle("smoke", world, v.xCoord, v.yCoord, v.zCoord, mRight.xCoord, mRight.yCoord, mRight.zCoord); + spawnAndSetParticle(EnumParticleTypes.FLAME, world, v.xCoord, v.yCoord, v.zCoord, mRight.xCoord, mRight.yCoord, mRight.zCoord); + spawnAndSetParticle(EnumParticleTypes.SMOKE_NORMAL, world, v.xCoord, v.yCoord, v.zCoord, mRight.xCoord, mRight.yCoord, mRight.zCoord); v = playerPos.clone().translate(vCenter); - spawnAndSetParticle("flame", world, v.xCoord, v.yCoord, v.zCoord, mCenter.xCoord, mCenter.yCoord, mCenter.zCoord); - spawnAndSetParticle("smoke", world, v.xCoord, v.yCoord, v.zCoord, mCenter.xCoord, mCenter.yCoord, mCenter.zCoord); + spawnAndSetParticle(EnumParticleTypes.FLAME, world, v.xCoord, v.yCoord, v.zCoord, mCenter.xCoord, mCenter.yCoord, mCenter.zCoord); + spawnAndSetParticle(EnumParticleTypes.SMOKE_NORMAL, world, v.xCoord, v.yCoord, v.zCoord, mCenter.xCoord, mCenter.yCoord, mCenter.zCoord); } } @@ -197,7 +198,7 @@ public class RenderTickHandler Pos3D mergedVec = playerPos.translate(flameVec); - spawnAndSetParticle("flame", world, mergedVec.xCoord, mergedVec.yCoord, mergedVec.zCoord, flameMotion.xCoord, flameMotion.yCoord, flameMotion.zCoord); + spawnAndSetParticle(EnumParticleTypes.FLAME, world, mergedVec.xCoord, mergedVec.yCoord, mergedVec.zCoord, flameMotion.xCoord, flameMotion.yCoord, flameMotion.zCoord); } } } @@ -206,15 +207,15 @@ public class RenderTickHandler } } - public void spawnAndSetParticle(String s, World world, double x, double y, double z, double velX, double velY, double velZ) + public void spawnAndSetParticle(EnumParticleTypes s, World world, double x, double y, double z, double velX, double velY, double velZ) { EntityFX fx = null; - if(s.equals("flame")) + if(s.equals(EnumParticleTypes.FLAME)) { fx = new EntityJetpackFlameFX(world, x, y, z, velX, velY, velZ); } - else if(s.equals("smoke")) + else if(s.equals(EnumParticleTypes.SMOKE_NORMAL)) { fx = new EntityJetpackSmokeFX(world, x, y, z, velX, velY, velZ); } diff --git a/src/main/java/mekanism/client/sound/ISoundSource.java b/src/main/java/mekanism/client/sound/ISoundSource.java index aa333b5e6..01c7bcfb6 100644 --- a/src/main/java/mekanism/client/sound/ISoundSource.java +++ b/src/main/java/mekanism/client/sound/ISoundSource.java @@ -1,8 +1,8 @@ package mekanism.client.sound; -import mekanism.api.Pos3D; import net.minecraft.client.audio.ISound.AttenuationType; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec3; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -18,7 +18,7 @@ public interface ISoundSource public float getFrequency(); @SideOnly(Side.CLIENT) - public Pos3D getSoundPosition(); + public Vec3 getSoundPosition(); @SideOnly(Side.CLIENT) public boolean shouldRepeat(); diff --git a/src/main/java/mekanism/client/sound/Sound.java b/src/main/java/mekanism/client/sound/Sound.java index 32eaef9ea..39cf75e48 100644 --- a/src/main/java/mekanism/client/sound/Sound.java +++ b/src/main/java/mekanism/client/sound/Sound.java @@ -148,7 +148,7 @@ public class Sound implements ISound } @Override - public float getFrequency() + public float getPitch() { return pitch; } diff --git a/src/main/java/mekanism/common/PacketHandler.java b/src/main/java/mekanism/common/PacketHandler.java index 4eb3f3841..eb437355e 100644 --- a/src/main/java/mekanism/common/PacketHandler.java +++ b/src/main/java/mekanism/common/PacketHandler.java @@ -72,6 +72,7 @@ import net.minecraft.nbt.NBTSizeTracker; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumFacing; import net.minecraft.util.Vec3; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.NetworkRegistry; @@ -170,6 +171,10 @@ public class PacketHandler { output.writeByte((Byte)data); } + else if(data instanceof EnumFacing) + { + output.writeInt(((EnumFacing)data).ordinal()); + } else if(data instanceof ItemStack) { writeStack(output, (ItemStack)data); diff --git a/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java b/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java index 7b5693a0a..fe28120af 100644 --- a/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java +++ b/src/main/java/mekanism/common/base/IAdvancedBoundingBlock.java @@ -11,6 +11,7 @@ import mekanism.api.energy.IStrictEnergyStorage; import mekanism.common.integration.IComputerIntegration; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; @InterfaceList({ @Interface(iface = "ic2.api.energy.tile.IEnergySink", modid = "IC2"), @@ -18,11 +19,11 @@ import net.minecraft.item.ItemStack; }) public interface IAdvancedBoundingBlock extends IBoundingBlock, ISidedInventory, IEnergySink, IStrictEnergyAcceptor, IStrictEnergyStorage, IEnergyHandler, IComputerIntegration, IFilterAccess { - public int[] getBoundSlots(Coord4D location, int side); + public int[] getBoundSlots(Coord4D location, EnumFacing side); public boolean canBoundInsert(Coord4D location, int i, ItemStack itemstack); - public boolean canBoundExtract(Coord4D location, int i, ItemStack itemstack, int j); + public boolean canBoundExtract(Coord4D location, int i, ItemStack itemstack, EnumFacing side); public void onPower(); diff --git a/src/main/java/mekanism/common/base/ITileComponent.java b/src/main/java/mekanism/common/base/ITileComponent.java index 5253b98d2..315f360c8 100644 --- a/src/main/java/mekanism/common/base/ITileComponent.java +++ b/src/main/java/mekanism/common/base/ITileComponent.java @@ -16,5 +16,5 @@ public interface ITileComponent public void write(NBTTagCompound nbtTags); - public void write(ArrayList data); + public void write(ArrayList data); } diff --git a/src/main/java/mekanism/common/base/ITileNetwork.java b/src/main/java/mekanism/common/base/ITileNetwork.java index cf9c6227f..45c3a5be0 100644 --- a/src/main/java/mekanism/common/base/ITileNetwork.java +++ b/src/main/java/mekanism/common/base/ITileNetwork.java @@ -22,5 +22,5 @@ public interface ITileNetwork * @param data - list of data * @return ArrayList */ - public ArrayList getNetworkedData(ArrayList data); + public ArrayList getNetworkedData(ArrayList data); } diff --git a/src/main/java/mekanism/common/block/BlockMachine.java b/src/main/java/mekanism/common/block/BlockMachine.java index fbc0f521b..02fce578b 100644 --- a/src/main/java/mekanism/common/block/BlockMachine.java +++ b/src/main/java/mekanism/common/block/BlockMachine.java @@ -354,22 +354,22 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IBlo if(side == 4) { - world.spawnParticle("smoke", (xRandom - iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (xRandom - iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); world.spawnParticle("reddust", (xRandom - iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); } else if(side == 5) { - world.spawnParticle("smoke", (xRandom + iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (xRandom + iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); world.spawnParticle("reddust", (xRandom + iRandom), yRandom, (zRandom + jRandom), 0.0D, 0.0D, 0.0D); } else if(side == 2) { - world.spawnParticle("smoke", (xRandom + jRandom), yRandom, (zRandom - iRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (xRandom + jRandom), yRandom, (zRandom - iRandom), 0.0D, 0.0D, 0.0D); world.spawnParticle("reddust", (xRandom + jRandom), yRandom, (zRandom - iRandom), 0.0D, 0.0D, 0.0D); } else if(side == 3) { - world.spawnParticle("smoke", (xRandom + jRandom), yRandom, (zRandom + iRandom), 0.0D, 0.0D, 0.0D); + world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (xRandom + jRandom), yRandom, (zRandom + iRandom), 0.0D, 0.0D, 0.0D); world.spawnParticle("reddust", (xRandom + jRandom), yRandom, (zRandom + iRandom), 0.0D, 0.0D, 0.0D); } }