diff --git a/src/api/java/buildcraft/api/APIHelper.java b/src/api/java/buildcraft/api/APIHelper.java old mode 100644 new mode 100755 index 777c9fccf..dd47dcc7c --- a/src/api/java/buildcraft/api/APIHelper.java +++ b/src/api/java/buildcraft/api/APIHelper.java @@ -2,11 +2,11 @@ package buildcraft.api; import java.util.Arrays; +import org.apache.commons.lang3.StringUtils; + import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.LoaderState; -import org.apache.commons.lang3.StringUtils; - import buildcraft.api.core.BCLog; public class APIHelper { diff --git a/src/api/java/buildcraft/api/IDoubleRegistry.java b/src/api/java/buildcraft/api/IDoubleRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/ISimpleRegistry.java b/src/api/java/buildcraft/api/ISimpleRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/ITripleRegistry.java b/src/api/java/buildcraft/api/ITripleRegistry.java old mode 100644 new mode 100755 index 8b7f1ee92..ea29b613c --- a/src/api/java/buildcraft/api/ITripleRegistry.java +++ b/src/api/java/buildcraft/api/ITripleRegistry.java @@ -2,10 +2,10 @@ package buildcraft.api; import java.util.Set; -import net.minecraft.item.Item; - import org.apache.commons.lang3.tuple.Triple; +import net.minecraft.item.Item; + public interface ITripleRegistry extends ISimpleRegistry { /** @return An unmodifiable set containing all the current mappings of the registry */ Set> getDefinitions(); diff --git a/src/api/java/buildcraft/api/ObjectDefinition.java b/src/api/java/buildcraft/api/ObjectDefinition.java old mode 100644 new mode 100755 index 439462dd4..54c9bd127 --- a/src/api/java/buildcraft/api/ObjectDefinition.java +++ b/src/api/java/buildcraft/api/ObjectDefinition.java @@ -16,7 +16,7 @@ public class ObjectDefinition { protected static String getCurrentMod() { ModContainer container = Loader.instance().activeModContainer(); if (container == null) { - throw new IllegalStateException("Pipes MUST be registered inside a mod"); + throw new IllegalStateException("Objects MUST be created inside a mod"); } return container.getModId(); } diff --git a/src/api/java/buildcraft/api/blocks/IColorRemovable.java b/src/api/java/buildcraft/api/blocks/IColorRemovable.java old mode 100644 new mode 100755 index 709b4bc61..6833da4db --- a/src/api/java/buildcraft/api/blocks/IColorRemovable.java +++ b/src/api/java/buildcraft/api/blocks/IColorRemovable.java @@ -1,7 +1,7 @@ package buildcraft.api.blocks; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IColorRemovable { diff --git a/src/api/java/buildcraft/api/blocks/package-info.java b/src/api/java/buildcraft/api/blocks/package-info.java old mode 100644 new mode 100755 index f6dd0ee7c..c3bc6eac1 --- a/src/api/java/buildcraft/api/blocks/package-info.java +++ b/src/api/java/buildcraft/api/blocks/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.blocks; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java b/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java index e0d421681..dad91b98f 100755 --- a/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java +++ b/src/api/java/buildcraft/api/blueprints/BlueprintDeployer.java @@ -6,8 +6,8 @@ package buildcraft.api.blueprints; import java.io.File; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** This class is provided as a utility class for third-party mods that would like to easily deploy structures that are diff --git a/src/api/java/buildcraft/api/blueprints/BuilderAPI.java b/src/api/java/buildcraft/api/blueprints/BuilderAPI.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/blueprints/IBuilderContext.java b/src/api/java/buildcraft/api/blueprints/IBuilderContext.java old mode 100644 new mode 100755 index 3a57573f6..e5eb8900b --- a/src/api/java/buildcraft/api/blueprints/IBuilderContext.java +++ b/src/api/java/buildcraft/api/blueprints/IBuilderContext.java @@ -4,14 +4,15 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.blueprints; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; + import buildcraft.api.core.IBox; /** This interface provide contextual information when building or initializing blueprint slots. */ public interface IBuilderContext { - Vec3 rotatePositionLeft(Vec3 pos); + Vec3d rotatePositionLeft(Vec3d pos); IBox surroundingBox(); diff --git a/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java b/src/api/java/buildcraft/api/blueprints/ISchematicHelper.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java b/src/api/java/buildcraft/api/blueprints/ISchematicRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/blueprints/MappingRegistry.java b/src/api/java/buildcraft/api/blueprints/MappingRegistry.java index 04fcf3ee3..4bdddb1c4 100755 --- a/src/api/java/buildcraft/api/blueprints/MappingRegistry.java +++ b/src/api/java/buildcraft/api/blueprints/MappingRegistry.java @@ -6,10 +6,14 @@ package buildcraft.api.blueprints; import java.util.ArrayList; import java.util.Collection; -import java.util.Comparator; import java.util.HashMap; import java.util.Map.Entry; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.ListMultimap; + +import org.apache.logging.log4j.Level; + import net.minecraft.block.Block; import net.minecraft.crash.CrashReportCategory; import net.minecraft.entity.Entity; @@ -19,6 +23,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagShort; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.common.util.Constants; import net.minecraftforge.fml.common.FMLModContainer; import net.minecraftforge.fml.common.Loader; @@ -26,13 +31,10 @@ import net.minecraftforge.fml.common.ModContainer; import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent; import net.minecraftforge.fml.common.registry.GameRegistry; -import org.apache.logging.log4j.Level; - import buildcraft.api.core.BCLog; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ListMultimap; - +// Deprecated as NBT will be saved in a compressing format rather than only for blocks, items and entities. +@Deprecated public class MappingRegistry { public HashMap blockToId = new HashMap(); @@ -100,7 +102,7 @@ public class MappingRegistry { public ResourceLocation itemIdToWorld(int id) throws MappingNotFoundException { Item item = getItemForId(id); - return Item.itemRegistry.getNameForObject(item); + return Item.REGISTRY.getNameForObject(item); } public Block getBlockForId(int id) throws MappingNotFoundException { @@ -134,7 +136,7 @@ public class MappingRegistry { public ResourceLocation blockIdToWorld(int id) throws MappingNotFoundException { Block block = getBlockForId(id); - return Block.blockRegistry.getNameForObject(block); + return Block.REGISTRY.getNameForObject(block); } public Class getEntityForId(int id) throws MappingNotFoundException { @@ -164,7 +166,7 @@ public class MappingRegistry { // 1.7.10 back-compat if (nbt.hasKey("id", Constants.NBT.TAG_SHORT)) { Item item = getItemForId(nbt.getShort("id")); - nbt.setString("id", (Item.itemRegistry.getNameForObject(item).toString())); + nbt.setString("id", (Item.REGISTRY.getNameForObject(item).toString())); } } @@ -215,7 +217,7 @@ public class MappingRegistry { for (Block b : idToBlock) { NBTTagCompound sub = new NBTTagCompound(); if (b != null) { - Object obj = Block.blockRegistry.getNameForObject(b); + Object obj = Block.REGISTRY.getNameForObject(b); if (obj == null) { BCLog.logger.error("Block " + b.getUnlocalizedName() + " (" + b.getClass().getName() + ") does not have a registry name! This is a bug!"); @@ -241,7 +243,7 @@ public class MappingRegistry { for (Item i : idToItem) { NBTTagCompound sub = new NBTTagCompound(); if (i != null) { - ResourceLocation obj = Item.itemRegistry.getNameForObject(i); + ResourceLocation obj = Item.REGISTRY.getNameForObject(i); if (obj == null) { BCLog.logger.error("Item " + i.getUnlocalizedName() + " (" + i.getClass().getName() + ") does not have a registry name! This is a bug!"); @@ -322,15 +324,15 @@ public class MappingRegistry { ResourceLocation location = new ResourceLocation(name); Block b = null; - if (!Block.blockRegistry.containsKey(location) && name.contains(":")) { + if (!Block.REGISTRY.containsKey(location) && name.contains(":")) { b = (Block) getMissingMappingFromFML(true, name, i); if (b != null) { - BCLog.logger.info("Remapped " + name + " to " + Block.blockRegistry.getNameForObject(b)); + BCLog.logger.info("Remapped " + name + " to " + Block.REGISTRY.getNameForObject(b)); } } - if (b == null && Block.blockRegistry.containsKey(location)) { - b = (Block) Block.blockRegistry.getObject(location); + if (b == null && Block.REGISTRY.containsKey(location)) { + b = (Block) Block.REGISTRY.getObject(location); } if (b != null) { @@ -357,15 +359,15 @@ public class MappingRegistry { ResourceLocation location = new ResourceLocation(name); Item item = null; - if (!Item.itemRegistry.containsKey(location) && name.contains(":")) { + if (!Item.REGISTRY.containsKey(location) && name.contains(":")) { item = (Item) getMissingMappingFromFML(false, name, i); if (item != null) { - BCLog.logger.info("Remapped " + name + " to " + Item.itemRegistry.getNameForObject(item)); + BCLog.logger.info("Remapped " + name + " to " + Item.REGISTRY.getNameForObject(item)); } } - if (item == null && Item.itemRegistry.containsKey(location)) { - item = (Item) Item.itemRegistry.getObject(location); + if (item == null && Item.REGISTRY.containsKey(location)) { + item = (Item) Item.REGISTRY.getObject(location); } if (item != null) { @@ -406,16 +408,19 @@ public class MappingRegistry { } public void addToCrashReport(CrashReportCategory cat) { - Comparator> comparator = (e1, e2) -> e1.getValue() - e2.getValue(); - cat.addCrashSection("Item Map Count", itemToId.size()); - itemToId.entrySet().stream().sorted(comparator).forEach(e -> cat.addCrashSection(" - ID " + e.getValue(), Item.itemRegistry.getNameForObject( - e.getKey()))); + for (Entry e : itemToId.entrySet()) { + cat.addCrashSection(" - ID " + e.getValue(), Item.REGISTRY.getNameForObject(e.getKey())); + } cat.addCrashSection("Block Map Count", blockToId.size()); - blockToId.entrySet().stream().sorted(comparator).forEach(e -> cat.addCrashSection(" - ID " + e.getValue(), e.getKey())); + for (Entry e : blockToId.entrySet()) { + cat.addCrashSection(" - ID " + e.getValue(), Block.REGISTRY.getNameForObject(e.getKey())); + } cat.addCrashSection("Entity Map Count", entityToId.size()); - entityToId.entrySet().stream().sorted(comparator).forEach(e -> cat.addCrashSection(" - ID " + e.getValue(), e.getKey())); + for (Entry, Integer> e : entityToId.entrySet()) { + cat.addCrashSection(" - ID " + e.getValue(), e.getKey()); + } } } diff --git a/src/api/java/buildcraft/api/blueprints/Schematic.java b/src/api/java/buildcraft/api/blueprints/Schematic.java index dc3ce350a..c246a7104 100755 --- a/src/api/java/buildcraft/api/blueprints/Schematic.java +++ b/src/api/java/buildcraft/api/blueprints/Schematic.java @@ -8,8 +8,9 @@ import java.util.List; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + import buildcraft.api.core.IInvSlot; /** A schematic is a piece of a blueprint. It allows to stock blocks or entities to blueprints, and can have a state @@ -97,12 +98,12 @@ public abstract class Schematic { } /** Applies translations to all positions in the schematic to center in the blueprint referential */ - public void translateToBlueprint(Vec3 transform) { + public void translateToBlueprint(Vec3d transform) { } /** Apply translations to all positions in the schematic to center in the builder referential */ - public void translateToWorld(Vec3 transform) {} + public void translateToWorld(Vec3d transform) {} /** Translates blocks and item ids to the blueprint referential */ public void idsToBlueprint(MappingRegistry registry) {} diff --git a/src/api/java/buildcraft/api/blueprints/SchematicBlock.java b/src/api/java/buildcraft/api/blueprints/SchematicBlock.java index 6f6fdaee1..952797d19 100755 --- a/src/api/java/buildcraft/api/blueprints/SchematicBlock.java +++ b/src/api/java/buildcraft/api/blueprints/SchematicBlock.java @@ -4,26 +4,21 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.blueprints; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; import net.minecraft.block.Block; import net.minecraft.block.BlockFalling; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumFacing.Axis; +import net.minecraft.util.Rotation; +import net.minecraft.util.math.BlockPos; + import net.minecraftforge.common.util.Constants; import net.minecraftforge.fluids.BlockFluidBase; + import buildcraft.api.core.BCLog; public class SchematicBlock extends SchematicBlockBase { @@ -124,6 +119,7 @@ public class SchematicBlock extends SchematicBlockBase { context.world().setBlockState(pos, state, 3); } + @Override public boolean doNotUse() { return doNotUse; } @@ -193,21 +189,7 @@ public class SchematicBlock extends SchematicBlockBase { // Pretty much all blocks (that rotate) rotate this way now @Override public void rotateLeft(IBuilderContext context) { - IProperty facingProp = getFacingProp(); - if (facingProp != null) { - EnumFacing face = state.getValue(facingProp); - if (face.getAxis() == Axis.Y) return; - state = state.withProperty(facingProp, face.rotateY()); - } - } - - protected IProperty getFacingProp() { - Collection props = state.getPropertyNames(); - for (IProperty prop : props) { - if ("facing".equals(prop.getName()) && state.getValue(prop) instanceof EnumFacing) { - return prop; - } - } - return null; + // FIXME: This might be the wrong way + state = state.withRotation(Rotation.CLOCKWISE_90); } } diff --git a/src/api/java/buildcraft/api/blueprints/SchematicEntity.java b/src/api/java/buildcraft/api/blueprints/SchematicEntity.java index 68d465923..7ffba9442 100755 --- a/src/api/java/buildcraft/api/blueprints/SchematicEntity.java +++ b/src/api/java/buildcraft/api/blueprints/SchematicEntity.java @@ -16,7 +16,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagDouble; import net.minecraft.nbt.NBTTagFloat; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; + import net.minecraftforge.common.util.Constants; public class SchematicEntity extends Schematic { @@ -47,17 +48,17 @@ public class SchematicEntity extends Schematic { } @Override - public void translateToBlueprint(Vec3 transform) { + public void translateToBlueprint(Vec3d transform) { NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + Vec3d pos = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); pos = pos.add(transform); entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); } @Override - public void translateToWorld(Vec3 transform) { + public void translateToWorld(Vec3d transform) { NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + Vec3d pos = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); pos = pos.add(transform); entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); @@ -78,7 +79,7 @@ public class SchematicEntity extends Schematic { @Override public void rotateLeft(IBuilderContext context) { NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 pos = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + Vec3d pos = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); pos = context.rotatePositionLeft(pos); entityNBT.setTag("Pos", this.newDoubleNBTList(pos.xCoord, pos.yCoord, pos.zCoord)); @@ -123,7 +124,7 @@ public class SchematicEntity extends Schematic { if (sub.getInteger("id") >= 0) { // Maps the id in the blueprint to the id in the world - sub.setInteger("id", Item.itemRegistry.getIDForObject(registry.getItemForId(sub.getInteger("id")))); + sub.setInteger("id", Item.REGISTRY.getIDForObject(registry.getItemForId(sub.getInteger("id")))); rqs.add(ItemStack.loadItemStackFromNBT(sub)); } else { @@ -166,12 +167,12 @@ public class SchematicEntity extends Schematic { public boolean isAlreadyBuilt(IBuilderContext context) { NBTTagList nbttaglist = entityNBT.getTagList("Pos", 6); - Vec3 newPosition = new Vec3(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); + Vec3d newPosition = new Vec3d(nbttaglist.getDoubleAt(0), nbttaglist.getDoubleAt(1), nbttaglist.getDoubleAt(2)); for (Object o : context.world().loadedEntityList) { Entity e = (Entity) o; - Vec3 existingPositon = new Vec3(e.posX, e.posY, e.posZ); + Vec3d existingPositon = new Vec3d(e.posX, e.posY, e.posZ); if (existingPositon.distanceTo(newPosition) <= 0.1) { return true; diff --git a/src/api/java/buildcraft/api/blueprints/SchematicFluid.java b/src/api/java/buildcraft/api/blueprints/SchematicFluid.java old mode 100644 new mode 100755 index f3912aabb..551c17f8c --- a/src/api/java/buildcraft/api/blueprints/SchematicFluid.java +++ b/src/api/java/buildcraft/api/blueprints/SchematicFluid.java @@ -9,7 +9,8 @@ import java.util.List; import net.minecraft.block.BlockLiquid; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; + import net.minecraftforge.fluids.FluidStack; public class SchematicFluid extends SchematicBlock { diff --git a/src/api/java/buildcraft/api/blueprints/SchematicMask.java b/src/api/java/buildcraft/api/blueprints/SchematicMask.java index fa5f43a7b..50538e711 100755 --- a/src/api/java/buildcraft/api/blueprints/SchematicMask.java +++ b/src/api/java/buildcraft/api/blueprints/SchematicMask.java @@ -11,9 +11,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.WorldServer; + import buildcraft.api.core.BuildCraftAPI; public class SchematicMask extends SchematicBlockBase { @@ -36,7 +37,7 @@ public class SchematicMask extends SchematicBlockBase { return; } else { ItemStack stack = stacks.get(0); - EntityPlayer player = BuildCraftAPI.proxy.getBuildCraftPlayer((WorldServer) context.world()).get(); + EntityPlayer player = BuildCraftAPI.fakePlayerProvider.getBuildCraftPlayer((WorldServer) context.world()).get(); // force the block to be air block, in case it's just a soft // block which replacement is not straightforward diff --git a/src/api/java/buildcraft/api/blueprints/SchematicTile.java b/src/api/java/buildcraft/api/blueprints/SchematicTile.java index 5c47547fe..2dbbe2198 100755 --- a/src/api/java/buildcraft/api/blueprints/SchematicTile.java +++ b/src/api/java/buildcraft/api/blueprints/SchematicTile.java @@ -10,8 +10,10 @@ import java.util.List; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; + import buildcraft.api.core.JavaTools; public class SchematicTile extends SchematicBlock { @@ -46,7 +48,8 @@ public class SchematicTile extends SchematicBlock { tileNBT.setInteger("x", pos.getX()); tileNBT.setInteger("y", pos.getY()); tileNBT.setInteger("z", pos.getZ()); - TileEntity tile = TileEntity.createAndLoadEntity(tileNBT); + // The minecraft server argument doesn't seem to be used... + TileEntity tile = TileEntity.create(tileNBT); tile.setWorldObj(context.world()); context.world().setTileEntity(pos, tile); } diff --git a/src/api/java/buildcraft/api/blueprints/package-info.java b/src/api/java/buildcraft/api/blueprints/package-info.java old mode 100644 new mode 100755 index 07f2f046a..3b3632424 --- a/src/api/java/buildcraft/api/blueprints/package-info.java +++ b/src/api/java/buildcraft/api/blueprints/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.blueprints; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java b/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java index 6a37e73f0..8e327073a 100755 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java +++ b/src/api/java/buildcraft/api/boards/RedstoneBoardNBT.java @@ -10,6 +10,7 @@ import java.util.Random; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.common.util.Constants; public abstract class RedstoneBoardNBT { diff --git a/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java b/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java index 72ebd4466..4a4161b19 100755 --- a/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java +++ b/src/api/java/buildcraft/api/boards/RedstoneBoardRobotNBT.java @@ -6,6 +6,7 @@ package buildcraft.api.boards; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; + import buildcraft.api.robots.EntityRobotBase; public abstract class RedstoneBoardRobotNBT extends RedstoneBoardNBT { diff --git a/src/api/java/buildcraft/api/boards/package-info.java b/src/api/java/buildcraft/api/boards/package-info.java old mode 100644 new mode 100755 index 4b250a286..6253f5b79 --- a/src/api/java/buildcraft/api/boards/package-info.java +++ b/src/api/java/buildcraft/api/boards/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.boards; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/core/BCLog.java b/src/api/java/buildcraft/api/core/BCLog.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/BuildCraftAPI.java b/src/api/java/buildcraft/api/core/BuildCraftAPI.java old mode 100644 new mode 100755 index b96784aff..19e9e9c79 --- a/src/api/java/buildcraft/api/core/BuildCraftAPI.java +++ b/src/api/java/buildcraft/api/core/BuildCraftAPI.java @@ -8,16 +8,16 @@ import java.lang.reflect.Method; import java.util.HashMap; import java.util.Set; -import net.minecraft.block.Block; -import net.minecraft.util.BlockPos; -import net.minecraft.world.World; - import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import net.minecraft.block.Block; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + public final class BuildCraftAPI { - public static ICoreProxy proxy; + public static IBCFakePlayer fakePlayerProvider; public static final Set softBlocks = Sets.newHashSet(); public static final HashMap worldProperties = Maps.newHashMap(); diff --git a/src/api/java/buildcraft/api/core/ConfigAccessor.java b/src/api/java/buildcraft/api/core/ConfigAccessor.java old mode 100644 new mode 100755 index 64d95f917..a66346ac5 --- a/src/api/java/buildcraft/api/core/ConfigAccessor.java +++ b/src/api/java/buildcraft/api/core/ConfigAccessor.java @@ -2,10 +2,10 @@ package buildcraft.api.core; import java.util.Map; -import net.minecraftforge.common.config.Property; - import com.google.common.collect.Maps; +import net.minecraftforge.common.config.Property; + /** Use this to access the various config options. It is recommended that you use this as opposed to the variables in * the mod, as users may only install the modules that they want, and not the one you may have refereed to. */ @Deprecated diff --git a/src/api/java/buildcraft/api/core/EnumColor.java b/src/api/java/buildcraft/api/core/EnumColor.java old mode 100644 new mode 100755 index 155996f45..028843870 --- a/src/api/java/buildcraft/api/core/EnumColor.java +++ b/src/api/java/buildcraft/api/core/EnumColor.java @@ -10,7 +10,8 @@ import java.util.Random; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.IStringSerializable; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -116,7 +117,7 @@ public enum EnumColor implements IStringSerializable { } public String getLocalizedName() { - return StatCollector.translateToLocal(getTag()); + return I18n.translateToLocal(getTag()); } public String getDye() { diff --git a/src/api/java/buildcraft/api/core/EnumPipePart.java b/src/api/java/buildcraft/api/core/EnumPipePart.java old mode 100644 new mode 100755 index de48191f5..fbdc058d5 --- a/src/api/java/buildcraft/api/core/EnumPipePart.java +++ b/src/api/java/buildcraft/api/core/EnumPipePart.java @@ -1,28 +1,29 @@ package buildcraft.api.core; -import io.netty.buffer.ByteBuf; - import java.util.Locale; import java.util.Map; +import com.google.common.collect.Maps; + import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase.NBTPrimitive; import net.minecraft.nbt.NBTTagString; import net.minecraft.util.EnumFacing; import net.minecraft.util.IStringSerializable; -import com.google.common.collect.Maps; +import io.netty.buffer.ByteBuf; -public enum EnumPipePart implements IStringSerializable,INetworkLoadable_BC8 { +public enum EnumPipePart implements IStringSerializable, INetworkLoadable_BC8 { DOWN(EnumFacing.DOWN), UP(EnumFacing.UP), NORTH(EnumFacing.NORTH), SOUTH(EnumFacing.SOUTH), WEST(EnumFacing.WEST), EAST(EnumFacing.EAST), - /** CENTER, UNKNOWN and ALL are all valid uses of this constant. */ + /** CENTER, UNKNOWN and ALL are all valid uses of this. */ CENTER(null); + public static final EnumPipePart[] VALUES = values(); private static final Map facingMap = Maps.newEnumMap(EnumFacing.class); private static final Map nameMap = Maps.newHashMap(); private static final int MAX_VALUES = values().length; @@ -36,6 +37,10 @@ public enum EnumPipePart implements IStringSerializable,INetworkLoadable_BC8 getBuildCraftPlayer(WorldServer world); } diff --git a/src/api/java/buildcraft/api/core/IBox.java b/src/api/java/buildcraft/api/core/IBox.java old mode 100644 new mode 100755 index d7c11f4f4..56007e382 --- a/src/api/java/buildcraft/api/core/IBox.java +++ b/src/api/java/buildcraft/api/core/IBox.java @@ -4,7 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; public interface IBox extends IZone { IBox expand(int amount); diff --git a/src/api/java/buildcraft/api/core/IBuildCraftMod.java b/src/api/java/buildcraft/api/core/IBuildCraftMod.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/IFluidFilter.java b/src/api/java/buildcraft/api/core/IFluidFilter.java index 0b61d440d..0cd10d669 100755 --- a/src/api/java/buildcraft/api/core/IFluidFilter.java +++ b/src/api/java/buildcraft/api/core/IFluidFilter.java @@ -4,9 +4,9 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core; -import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; public interface IFluidFilter { - boolean matches(Fluid fluid); + boolean matches(FluidStack fluid); } diff --git a/src/api/java/buildcraft/api/core/IIconProvider.java b/src/api/java/buildcraft/api/core/IIconProvider.java old mode 100644 new mode 100755 index 418c08a00..0583835a0 --- a/src/api/java/buildcraft/api/core/IIconProvider.java +++ b/src/api/java/buildcraft/api/core/IIconProvider.java @@ -2,6 +2,7 @@ package buildcraft.api.core; 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; diff --git a/src/api/java/buildcraft/api/core/IInvSlot.java b/src/api/java/buildcraft/api/core/IInvSlot.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java b/src/api/java/buildcraft/api/core/INBTLoadable_BC8.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/INBTStoreable.java b/src/api/java/buildcraft/api/core/INBTStoreable.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java b/src/api/java/buildcraft/api/core/INetworkLoadable_BC8.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/IPathProvider.java b/src/api/java/buildcraft/api/core/IPathProvider.java old mode 100644 new mode 100755 index d953bca12..f21ef36c5 --- a/src/api/java/buildcraft/api/core/IPathProvider.java +++ b/src/api/java/buildcraft/api/core/IPathProvider.java @@ -2,10 +2,14 @@ package buildcraft.api.core; import java.util.List; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; + +import buildcraft.api.items.IMapLocation.MapLocationType; /** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */ public interface IPathProvider { + /** @return The completed path. This should loop back onto itself (The last position is the same as the first + * position) if you are {@link MapLocationType#PATH_REPEATING} */ List getPath(); /** Remove from the world all objects used to define the path. */ diff --git a/src/api/java/buildcraft/api/core/ISerializable.java b/src/api/java/buildcraft/api/core/ISerializable.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/IStackFilter.java b/src/api/java/buildcraft/api/core/IStackFilter.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/IWorldProperty.java b/src/api/java/buildcraft/api/core/IWorldProperty.java index ba440d7d3..415dc12d1 100755 --- a/src/api/java/buildcraft/api/core/IWorldProperty.java +++ b/src/api/java/buildcraft/api/core/IWorldProperty.java @@ -4,7 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.core; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IWorldProperty { diff --git a/src/api/java/buildcraft/api/core/IZone.java b/src/api/java/buildcraft/api/core/IZone.java index 5d722ffe6..21a5df210 100755 --- a/src/api/java/buildcraft/api/core/IZone.java +++ b/src/api/java/buildcraft/api/core/IZone.java @@ -6,12 +6,12 @@ package buildcraft.api.core; import java.util.Random; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; public interface IZone { /** Returns the smallest possible distance that the index would have to be changed by in order for - * {@link #contains(Vec3)} to return true. If the position is already inside then this will return 0 */ + * {@link #contains(Vec3d)} to return true. If the position is already inside then this will return 0 */ double distanceTo(BlockPos index); /** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */ @@ -19,8 +19,8 @@ public interface IZone { /** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range * specified by this zone. */ - boolean contains(Vec3 point); + boolean contains(Vec3d point); - /** Gets a random position that {@link #contains(Vec3)} will return true. */ + /** Gets a random position that {@link #contains(Vec3d)} will return true. */ BlockPos getRandomBlockPos(Random rand); } diff --git a/src/api/java/buildcraft/api/core/Identifier.java b/src/api/java/buildcraft/api/core/Identifier.java old mode 100644 new mode 100755 index 45dab1ad7..c74e8df1b --- a/src/api/java/buildcraft/api/core/Identifier.java +++ b/src/api/java/buildcraft/api/core/Identifier.java @@ -2,15 +2,17 @@ package buildcraft.api.core; import java.util.Map; import java.util.UUID; -import java.util.function.Supplier; + +import com.google.common.base.Supplier; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -23,8 +25,18 @@ public abstract class Identifier { private static Map> registeredIdentifiers; static { - registeredIdentifiers.put("mincraft:tile", () -> new Tile(0, null)); - registeredIdentifiers.put("mincraft:entity", () -> new MovableEntity(0, null)); + registeredIdentifiers.put("mincraft:tile", new Supplier() { + @Override + public Identifier get() { + return new Tile(0, null); + } + }); + registeredIdentifiers.put("mincraft:entity", new Supplier() { + @Override + public Identifier get() { + return new MovableEntity(0, null); + } + }); } protected final int dimId; @@ -85,7 +97,7 @@ public abstract class Identifier { public static Tile create(TileEntity tile) { if (tile.getWorld() == null) throw new NullPointerException("tile.getWorld() for the tile " + tile.getClass()); if (tile.getPos() == null) throw new NullPointerException("tile.getPos() for the tile " + tile.getClass()); - return new Tile(tile.getWorld().provider.getDimensionId(), tile.getPos()); + return new Tile(tile.getWorld().provider.getDimension(), tile.getPos()); } private Tile(int dimId, BlockPos pos) { @@ -132,7 +144,7 @@ public abstract class Identifier { @SideOnly(Side.CLIENT) public TileEntity getByIdentifierClient() { World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return null; + if (world == null || world.provider.getDimension() != dimId) return null; return world.getTileEntity(pos); } @@ -140,7 +152,7 @@ public abstract class Identifier { @SideOnly(Side.CLIENT) public boolean isLoadedClient() { World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return false; + if (world == null || world.provider.getDimension() != dimId) return false; return world.getTileEntity(pos) != null; } @@ -152,7 +164,7 @@ public abstract class Identifier { public static MovableEntity create(Entity ent) { if (ent.getEntityWorld() == null) throw new NullPointerException("ent.getEntityWorld() for the entity " + ent.getClass()); if (ent.getPersistentID() == null) throw new NullPointerException("ent.getPersistentID() for the entity " + ent.getClass()); - return new MovableEntity(ent.getEntityWorld().provider.getDimensionId(), ent.getPersistentID()); + return new MovableEntity(ent.getEntityWorld().provider.getDimension(), ent.getPersistentID()); } private MovableEntity(int dimId, UUID uniqueId) { @@ -160,34 +172,43 @@ public abstract class Identifier { this.uniqueId = uniqueId; } + private Entity get(World world) { + for (Entity entity : world.loadedEntityList) { + if (entity.getPersistentID().equals(uniqueId)) { + return entity; + } + } + return null; + } + @Override public Entity getByIdentifier(MinecraftServer server) { World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimensionId() != dimId) return null; - return world.loadedEntityList.stream().filter(e -> e.getPersistentID().equals(uniqueId)).findFirst().orElse(null); + if (world == null || world.provider.getDimension() != dimId) return null; + return get(world); } @Override public boolean isLoaded(MinecraftServer server) { World world = server.worldServerForDimension(dimId); - if (world == null || world.provider.getDimensionId() != dimId) return false; - return world.loadedEntityList.stream().filter(e -> e.getPersistentID().equals(uniqueId)).findFirst().orElse(null) != null; + if (world == null || world.provider.getDimension() != dimId) return false; + return get(world) != null; } @Override @SideOnly(Side.CLIENT) public Entity getByIdentifierClient() { World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return null; - return world.loadedEntityList.stream().filter(e -> e.getPersistentID().equals(uniqueId)).findFirst().orElse(null); + if (world == null || world.provider.getDimension() != dimId) return null; + return get(world); } @Override @SideOnly(Side.CLIENT) public boolean isLoadedClient() { World world = Minecraft.getMinecraft().theWorld; - if (world == null || world.provider.getDimensionId() != dimId) return false; - return world.loadedEntityList.stream().filter(e -> e.getPersistentID().equals(uniqueId)).findFirst().orElse(null) != null; + if (world == null || world.provider.getDimension() != dimId) return false; + return get(world) != null; } @Override diff --git a/src/api/java/buildcraft/api/core/SafeTimeTracker.java b/src/api/java/buildcraft/api/core/SafeTimeTracker.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/StackKey.java b/src/api/java/buildcraft/api/core/StackKey.java old mode 100644 new mode 100755 index 13a8e8989..3d2037ee2 --- a/src/api/java/buildcraft/api/core/StackKey.java +++ b/src/api/java/buildcraft/api/core/StackKey.java @@ -7,6 +7,7 @@ package buildcraft.api.core; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidStack; @@ -80,8 +81,7 @@ public final class StackKey { } } if (fluidStack != null) { - if (fluidStack.getFluid().getID() != k.fluidStack.getFluid().getID() || fluidStack.amount != k.fluidStack.amount || !objectsEqual( - fluidStack.tag, k.fluidStack.tag)) { + if (!fluidStack.isFluidEqual(k.fluidStack) || fluidStack.amount != k.fluidStack.amount) { return false; } } @@ -98,7 +98,7 @@ public final class StackKey { } result = 31 * result + 7; if (fluidStack != null) { - result = 31 * result + fluidStack.getFluid().getID(); + result = 31 * result + fluidStack.getFluid().getName().hashCode(); result = 31 * result + fluidStack.amount; result = 31 * result + objectHashCode(fluidStack.tag); } diff --git a/src/api/java/buildcraft/api/core/package-info.java b/src/api/java/buildcraft/api/core/package-info.java old mode 100644 new mode 100755 index 57a6ababf..f0b642a91 --- a/src/api/java/buildcraft/api/core/package-info.java +++ b/src/api/java/buildcraft/api/core/package-info.java @@ -2,8 +2,7 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "2.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") +@API(apiVersion = "2.1", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core") package buildcraft.api.core; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/core/render/ICullable.java b/src/api/java/buildcraft/api/core/render/ICullable.java old mode 100644 new mode 100755 index ea4b1f444..2399a6927 --- a/src/api/java/buildcraft/api/core/render/ICullable.java +++ b/src/api/java/buildcraft/api/core/render/ICullable.java @@ -4,8 +4,8 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.core.render; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; /* This interface designates a block as a state machine responsible for culling For implementation details look into diff --git a/src/api/java/buildcraft/api/core/render/ITextureStateManager.java b/src/api/java/buildcraft/api/core/render/ITextureStateManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/core/render/ITextureStates.java b/src/api/java/buildcraft/api/core/render/ITextureStates.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/crops/CropManager.java b/src/api/java/buildcraft/api/crops/CropManager.java old mode 100644 new mode 100755 index 3d512a710..a5d9f6d64 --- a/src/api/java/buildcraft/api/crops/CropManager.java +++ b/src/api/java/buildcraft/api/crops/CropManager.java @@ -6,7 +6,7 @@ import java.util.List; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/api/java/buildcraft/api/crops/ICropHandler.java b/src/api/java/buildcraft/api/crops/ICropHandler.java old mode 100644 new mode 100755 index 45d9b9733..0eb41f8de --- a/src/api/java/buildcraft/api/crops/ICropHandler.java +++ b/src/api/java/buildcraft/api/crops/ICropHandler.java @@ -5,7 +5,7 @@ import java.util.List; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; diff --git a/src/api/java/buildcraft/api/crops/package-info.java b/src/api/java/buildcraft/api/crops/package-info.java old mode 100644 new mode 100755 index 3961a8800..803ce050a --- a/src/api/java/buildcraft/api/crops/package-info.java +++ b/src/api/java/buildcraft/api/crops/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.crops; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/enums/EnumBlueprintType.java b/src/api/java/buildcraft/api/enums/EnumBlueprintType.java old mode 100644 new mode 100755 index 31ee2dba5..8d6217797 --- a/src/api/java/buildcraft/api/enums/EnumBlueprintType.java +++ b/src/api/java/buildcraft/api/enums/EnumBlueprintType.java @@ -1,6 +1,7 @@ package buildcraft.api.enums; import net.minecraft.item.ItemStack; + import buildcraft.api.items.IBlueprintItem; public enum EnumBlueprintType { diff --git a/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java b/src/api/java/buildcraft/api/enums/EnumDecoratedBlock.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/enums/EnumEnergyStage.java b/src/api/java/buildcraft/api/enums/EnumEnergyStage.java old mode 100644 new mode 100755 index c25616782..319b80440 --- a/src/api/java/buildcraft/api/enums/EnumEnergyStage.java +++ b/src/api/java/buildcraft/api/enums/EnumEnergyStage.java @@ -1,8 +1,8 @@ package buildcraft.api.enums; -import net.minecraft.util.IStringSerializable; +import java.util.Locale; -import org.apache.commons.lang3.StringUtils; +import net.minecraft.util.IStringSerializable; public enum EnumEnergyStage implements IStringSerializable { BLUE, @@ -11,10 +11,13 @@ public enum EnumEnergyStage implements IStringSerializable { RED, OVERHEAT, BLACK; + public static final EnumEnergyStage[] VALUES = values(); + private final String modelName = name().toLowerCase(Locale.ROOT); + public String getModelName() { - return StringUtils.lowerCase(name()); + return modelName; } @Override diff --git a/src/api/java/buildcraft/api/enums/EnumEngineType.java b/src/api/java/buildcraft/api/enums/EnumEngineType.java old mode 100644 new mode 100755 index f2be6833e..16e2714b7 --- a/src/api/java/buildcraft/api/enums/EnumEngineType.java +++ b/src/api/java/buildcraft/api/enums/EnumEngineType.java @@ -1,7 +1,5 @@ package buildcraft.api.enums; -import java.util.Locale; - import net.minecraft.util.IStringSerializable; public enum EnumEngineType implements IStringSerializable { @@ -10,18 +8,25 @@ public enum EnumEngineType implements IStringSerializable { IRON("energy", "iron"), CREATIVE("energy", "creative"); + public final String unlocalizedTag; public final String resourceLocation; + public static final EnumEngineType[] VALUES = values(); + EnumEngineType(String mod, String loc) { + unlocalizedTag = loc; resourceLocation = "buildcraft" + mod + ":blocks/engine/inv/" + loc + "/"; } @Override public String getName() { - return name(); + return unlocalizedTag; } - public String getModelName() { - return getName().toLowerCase(Locale.ROOT); + public static EnumEngineType fromMeta(int meta) { + if (meta < 0 || meta >= VALUES.length) { + meta = 0; + } + return VALUES[meta]; } } diff --git a/src/api/java/buildcraft/api/enums/EnumFillerPattern.java b/src/api/java/buildcraft/api/enums/EnumFillerPattern.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java b/src/api/java/buildcraft/api/enums/EnumLaserTableType.java old mode 100644 new mode 100755 index 82569e1e3..cc8b41e7d --- a/src/api/java/buildcraft/api/enums/EnumLaserTableType.java +++ b/src/api/java/buildcraft/api/enums/EnumLaserTableType.java @@ -2,6 +2,7 @@ package buildcraft.api.enums; import net.minecraft.block.state.IBlockState; import net.minecraft.util.IStringSerializable; + import buildcraft.api.properties.BuildCraftProperties; public enum EnumLaserTableType implements IStringSerializable { diff --git a/src/api/java/buildcraft/api/enums/EnumMachineState.java b/src/api/java/buildcraft/api/enums/EnumMachineState.java old mode 100644 new mode 100755 index 48bfa4075..6a215c235 --- a/src/api/java/buildcraft/api/enums/EnumMachineState.java +++ b/src/api/java/buildcraft/api/enums/EnumMachineState.java @@ -2,6 +2,7 @@ package buildcraft.api.enums; import net.minecraft.block.state.IBlockState; import net.minecraft.util.IStringSerializable; + import buildcraft.api.properties.BuildCraftProperties; public enum EnumMachineState implements IStringSerializable { diff --git a/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java b/src/api/java/buildcraft/api/enums/EnumRedstoneChipset.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/enums/EnumSpring.java b/src/api/java/buildcraft/api/enums/EnumSpring.java old mode 100644 new mode 100755 index 8f2e4d0bc..85eed2ca0 --- a/src/api/java/buildcraft/api/enums/EnumSpring.java +++ b/src/api/java/buildcraft/api/enums/EnumSpring.java @@ -3,11 +3,12 @@ package buildcraft.api.enums; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.IStringSerializable; + import buildcraft.api.properties.BuildCraftProperties; public enum EnumSpring implements IStringSerializable { - WATER(5, -1, Blocks.water.getDefaultState()), + WATER(5, -1, Blocks.WATER.getDefaultState()), OIL(6000, 8, null); // Set in BuildCraftEnergy public static final EnumSpring[] VALUES = values(); public final int tickRate, chance; @@ -21,9 +22,10 @@ public enum EnumSpring implements IStringSerializable { } public static EnumSpring fromState(IBlockState state) { - return (EnumSpring) state.getValue(BuildCraftProperties.SPRING_TYPE); + return state.getValue(BuildCraftProperties.SPRING_TYPE); } + @Override public String getName() { return this.name(); } diff --git a/src/api/java/buildcraft/api/enums/package-info.java b/src/api/java/buildcraft/api/enums/package-info.java old mode 100644 new mode 100755 index d42334751..8c585be95 --- a/src/api/java/buildcraft/api/enums/package-info.java +++ b/src/api/java/buildcraft/api/enums/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.enums; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/events/BlockInteractionEvent.java b/src/api/java/buildcraft/api/events/BlockInteractionEvent.java old mode 100644 new mode 100755 index e9bede1c2..4a4d8b7bd --- a/src/api/java/buildcraft/api/events/BlockInteractionEvent.java +++ b/src/api/java/buildcraft/api/events/BlockInteractionEvent.java @@ -6,6 +6,7 @@ package buildcraft.api.events; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; + import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java b/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java old mode 100644 new mode 100755 index da1b9696d..22a8a74fa --- a/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java +++ b/src/api/java/buildcraft/api/events/BlockPlacedDownEvent.java @@ -6,7 +6,8 @@ package buildcraft.api.events; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; + import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/api/java/buildcraft/api/events/PipePlacedEvent.java b/src/api/java/buildcraft/api/events/PipePlacedEvent.java old mode 100644 new mode 100755 index d3241f628..3664a57d2 --- a/src/api/java/buildcraft/api/events/PipePlacedEvent.java +++ b/src/api/java/buildcraft/api/events/PipePlacedEvent.java @@ -5,15 +5,17 @@ package buildcraft.api.events; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.item.Item; +import net.minecraft.util.math.BlockPos; + import net.minecraftforge.fml.common.eventhandler.Event; public class PipePlacedEvent extends Event { public EntityPlayer player; - public String pipeType; + public Item pipeType; public BlockPos pos; - public PipePlacedEvent(EntityPlayer player, String pipeType, BlockPos pos) { + public PipePlacedEvent(EntityPlayer player, Item pipeType, BlockPos pos) { this.player = player; this.pipeType = pipeType; this.pos = pos; diff --git a/src/api/java/buildcraft/api/events/RobotEvent.java b/src/api/java/buildcraft/api/events/RobotEvent.java old mode 100644 new mode 100755 index d70137733..9b12b64d2 --- a/src/api/java/buildcraft/api/events/RobotEvent.java +++ b/src/api/java/buildcraft/api/events/RobotEvent.java @@ -6,8 +6,10 @@ package buildcraft.api.events; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; + import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; + import buildcraft.api.robots.EntityRobotBase; public abstract class RobotEvent extends Event { diff --git a/src/api/java/buildcraft/api/events/RobotPlacementEvent.java b/src/api/java/buildcraft/api/events/RobotPlacementEvent.java old mode 100644 new mode 100755 index fe4128e7e..b0abc44d8 --- a/src/api/java/buildcraft/api/events/RobotPlacementEvent.java +++ b/src/api/java/buildcraft/api/events/RobotPlacementEvent.java @@ -5,6 +5,7 @@ package buildcraft.api.events; import net.minecraft.entity.player.EntityPlayer; + import net.minecraftforge.fml.common.eventhandler.Cancelable; import net.minecraftforge.fml.common.eventhandler.Event; diff --git a/src/api/java/buildcraft/api/events/package-info.java b/src/api/java/buildcraft/api/events/package-info.java old mode 100644 new mode 100755 index 3bdb55140..06cd25fea --- a/src/api/java/buildcraft/api/events/package-info.java +++ b/src/api/java/buildcraft/api/events/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.events; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/facades/FacadeAPI.java b/src/api/java/buildcraft/api/facades/FacadeAPI.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/facades/FacadeType.java b/src/api/java/buildcraft/api/facades/FacadeType.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/facades/IFacadeItem.java b/src/api/java/buildcraft/api/facades/IFacadeItem.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/facades/package-info.java b/src/api/java/buildcraft/api/facades/package-info.java old mode 100644 new mode 100755 index 5393f3e57..2c79167b3 --- a/src/api/java/buildcraft/api/facades/package-info.java +++ b/src/api/java/buildcraft/api/facades/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.facades; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/filler/FillerManager.java b/src/api/java/buildcraft/api/filler/FillerManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/filler/IFillerPattern.java b/src/api/java/buildcraft/api/filler/IFillerPattern.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/filler/IFillerRegistry.java b/src/api/java/buildcraft/api/filler/IFillerRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/filler/package-info.java b/src/api/java/buildcraft/api/filler/package-info.java old mode 100644 new mode 100755 index 6449026b6..3e9d907de --- a/src/api/java/buildcraft/api/filler/package-info.java +++ b/src/api/java/buildcraft/api/filler/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.filler; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java b/src/api/java/buildcraft/api/fuels/BuildcraftFuelRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/fuels/ICoolant.java b/src/api/java/buildcraft/api/fuels/ICoolant.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/fuels/ICoolantManager.java b/src/api/java/buildcraft/api/fuels/ICoolantManager.java old mode 100644 new mode 100755 index 54aff0367..849bf1acf --- a/src/api/java/buildcraft/api/fuels/ICoolantManager.java +++ b/src/api/java/buildcraft/api/fuels/ICoolantManager.java @@ -7,6 +7,7 @@ package buildcraft.api.fuels; import java.util.Collection; import net.minecraftforge.fluids.Fluid; + import buildcraft.api.core.StackKey; public interface ICoolantManager { diff --git a/src/api/java/buildcraft/api/fuels/IFuel.java b/src/api/java/buildcraft/api/fuels/IFuel.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/fuels/IFuelManager.java b/src/api/java/buildcraft/api/fuels/IFuelManager.java old mode 100644 new mode 100755 index b7d6a99ba..367818270 --- a/src/api/java/buildcraft/api/fuels/IFuelManager.java +++ b/src/api/java/buildcraft/api/fuels/IFuelManager.java @@ -7,13 +7,21 @@ package buildcraft.api.fuels; import java.util.Collection; import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; public interface IFuelManager { IFuel addFuel(IFuel fuel); IFuel addFuel(Fluid fluid, int powerPerCycle, int totalBurningTime); + IDirtyFuel addDirtyFuel(Fluid fuel, int powerPerCycle, int totalBurningTime, FluidStack residue); + Collection getFuels(); IFuel getFuel(Fluid fluid); + + public interface IDirtyFuel extends IFuel { + /** @return The residue fluidstack, per bucket of original fuel. */ + FluidStack getResidue(); + } } diff --git a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java b/src/api/java/buildcraft/api/fuels/ISolidCoolant.java old mode 100644 new mode 100755 index ab41cc46d..2b466efeb --- a/src/api/java/buildcraft/api/fuels/ISolidCoolant.java +++ b/src/api/java/buildcraft/api/fuels/ISolidCoolant.java @@ -5,6 +5,7 @@ package buildcraft.api.fuels; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidStack; public interface ISolidCoolant { diff --git a/src/api/java/buildcraft/api/fuels/package-info.java b/src/api/java/buildcraft/api/fuels/package-info.java old mode 100644 new mode 100755 index 4089f42c1..93d524dbf --- a/src/api/java/buildcraft/api/fuels/package-info.java +++ b/src/api/java/buildcraft/api/fuels/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.fuels; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/gates/GateExpansionController.java b/src/api/java/buildcraft/api/gates/GateExpansionController.java old mode 100644 new mode 100755 index c443aee0b..9ef7f861d --- a/src/api/java/buildcraft/api/gates/GateExpansionController.java +++ b/src/api/java/buildcraft/api/gates/GateExpansionController.java @@ -4,10 +4,11 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.gates; -import java.util.List; +import java.util.Collection; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; + import buildcraft.api.statements.IActionInternal; import buildcraft.api.statements.IStatement; import buildcraft.api.statements.IStatementParameter; @@ -43,9 +44,9 @@ public abstract class GateExpansionController { return false; } - public void addTriggers(List list) {} + public void addTriggers(Collection list) {} - public void addActions(List list) {} + public void addActions(Collection list) {} public void writeToNBT(NBTTagCompound nbt) {} diff --git a/src/api/java/buildcraft/api/gates/GateExpansionModelKey.java b/src/api/java/buildcraft/api/gates/GateExpansionModelKey.java new file mode 100755 index 000000000..f39402e5c --- /dev/null +++ b/src/api/java/buildcraft/api/gates/GateExpansionModelKey.java @@ -0,0 +1,36 @@ +package buildcraft.api.gates; + +import java.util.Arrays; + +import net.minecraft.util.BlockRenderLayer; + +public class GateExpansionModelKey> { + public final BlockRenderLayer layer; + public final IExpansionBaker baker; + private final int hash; + + public GateExpansionModelKey(BlockRenderLayer layer, IExpansionBaker baker) { + if (layer != BlockRenderLayer.CUTOUT && layer != BlockRenderLayer.TRANSLUCENT) { + throw new IllegalArgumentException("Unsuported layer! Was " + layer + ", wanted CUTOUT or TRANSLUCENT"); + } + if (baker == null) throw new NullPointerException("baker"); + this.layer = layer; + this.baker = baker; + hash = Arrays.hashCode(new int[] { layer.hashCode(), System.identityHashCode(baker) }); + } + + @Override + public int hashCode() { + return hash; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + GateExpansionModelKey other = (GateExpansionModelKey) obj; + if (baker != other.baker) return false; + return true; + } +} diff --git a/src/api/java/buildcraft/api/gates/GateExpansions.java b/src/api/java/buildcraft/api/gates/GateExpansions.java old mode 100644 new mode 100755 index 006d1bc9b..eb00ab512 --- a/src/api/java/buildcraft/api/gates/GateExpansions.java +++ b/src/api/java/buildcraft/api/gates/GateExpansions.java @@ -4,16 +4,12 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.gates; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import net.minecraft.item.ItemStack; +import java.util.*; import com.google.common.collect.HashBiMap; +import net.minecraft.item.ItemStack; + public final class GateExpansions { private static final Map expansions = new HashMap(); private static final ArrayList expansionIDs = new ArrayList(); diff --git a/src/api/java/buildcraft/api/gates/IExpansionBaker.java b/src/api/java/buildcraft/api/gates/IExpansionBaker.java new file mode 100755 index 000000000..846cfe598 --- /dev/null +++ b/src/api/java/buildcraft/api/gates/IExpansionBaker.java @@ -0,0 +1,13 @@ +package buildcraft.api.gates; + +import com.google.common.collect.ImmutableList; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.vertex.VertexFormat; + +public interface IExpansionBaker> { + /** @return The vertex format used to generate the quads. */ + VertexFormat getVertexFormat(); + + ImmutableList bake(K key); +} diff --git a/src/api/java/buildcraft/api/gates/IGate.java b/src/api/java/buildcraft/api/gates/IGate.java old mode 100644 new mode 100755 index df2364937..c44400c10 --- a/src/api/java/buildcraft/api/gates/IGate.java +++ b/src/api/java/buildcraft/api/gates/IGate.java @@ -4,6 +4,7 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.gates; +import java.util.Collection; import java.util.List; import buildcraft.api.statements.IStatement; @@ -18,13 +19,15 @@ public interface IGate extends ISidedStatementContainer { IPipe getPipe(); + Collection getExpansions(); + List getTriggers(); List getActions(); List getActiveActions(); - List getTriggerParameters(int index); + List getTriggerParameters(int slot); - List getActionParameters(int index); + List getActionParameters(int slot); } diff --git a/src/api/java/buildcraft/api/gates/IGateExpansion.java b/src/api/java/buildcraft/api/gates/IGateExpansion.java old mode 100644 new mode 100755 index d58f0e9ee..005767855 --- a/src/api/java/buildcraft/api/gates/IGateExpansion.java +++ b/src/api/java/buildcraft/api/gates/IGateExpansion.java @@ -4,12 +4,10 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.gates; -import java.util.List; - -import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.BlockRenderLayer; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -25,9 +23,8 @@ public interface IGateExpansion { void textureStitch(TextureMap map); @SideOnly(Side.CLIENT) - IGateStaticRenderState getRenderState(); + GateExpansionModelKey getRenderModelKey(BlockRenderLayer layer); - public interface IGateStaticRenderState { - List bake(VertexFormat format); - } + // FIXME : This is ugly. + boolean canAddToGate(int numTriggerParameters, int numActionParameters); } diff --git a/src/api/java/buildcraft/api/gates/package-info.java b/src/api/java/buildcraft/api/gates/package-info.java old mode 100644 new mode 100755 index e58f15f69..b86ad48bd --- a/src/api/java/buildcraft/api/gates/package-info.java +++ b/src/api/java/buildcraft/api/gates/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.gates; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/items/IBlueprintItem.java b/src/api/java/buildcraft/api/items/IBlueprintItem.java old mode 100644 new mode 100755 index fe72af7d0..d67bc39fd --- a/src/api/java/buildcraft/api/items/IBlueprintItem.java +++ b/src/api/java/buildcraft/api/items/IBlueprintItem.java @@ -1,6 +1,7 @@ package buildcraft.api.items; import net.minecraft.item.ItemStack; + import buildcraft.api.enums.EnumBlueprintType; public interface IBlueprintItem extends INamedItem { diff --git a/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java b/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java old mode 100644 new mode 100755 index 97847c468..697b87597 --- a/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java +++ b/src/api/java/buildcraft/api/items/IItemCustomPipeRender.java @@ -1,6 +1,7 @@ package buildcraft.api.items; import net.minecraft.item.ItemStack; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/api/java/buildcraft/api/items/IList.java b/src/api/java/buildcraft/api/items/IList.java old mode 100644 new mode 100755 index 97bd77ded..4e9c1bc17 --- a/src/api/java/buildcraft/api/items/IList.java +++ b/src/api/java/buildcraft/api/items/IList.java @@ -3,8 +3,5 @@ package buildcraft.api.items; import net.minecraft.item.ItemStack; public interface IList extends INamedItem { - @Deprecated - String getLabel(ItemStack stack); - boolean matches(ItemStack stackList, ItemStack item); } diff --git a/src/api/java/buildcraft/api/items/IMapLocation.java b/src/api/java/buildcraft/api/items/IMapLocation.java old mode 100644 new mode 100755 index 545e07dd4..e7b2299b9 --- a/src/api/java/buildcraft/api/items/IMapLocation.java +++ b/src/api/java/buildcraft/api/items/IMapLocation.java @@ -3,8 +3,9 @@ package buildcraft.api.items; import java.util.List; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; + import buildcraft.api.core.IBox; import buildcraft.api.core.IZone; @@ -15,7 +16,9 @@ public interface IMapLocation extends INamedItem { SPOT, AREA, PATH, - ZONE; + ZONE, + /** Like PATH but repeats around in a loop. */ + PATH_REPEATING; public final int meta = ordinal(); diff --git a/src/api/java/buildcraft/api/items/INamedItem.java b/src/api/java/buildcraft/api/items/INamedItem.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/items/package-info.java b/src/api/java/buildcraft/api/items/package-info.java old mode 100644 new mode 100755 index 0a8a9b6e0..f6d2835d6 --- a/src/api/java/buildcraft/api/items/package-info.java +++ b/src/api/java/buildcraft/api/items/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.items; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java b/src/api/java/buildcraft/api/library/ILibraryTypeHandler.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/library/LibraryAPI.java b/src/api/java/buildcraft/api/library/LibraryAPI.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandler.java b/src/api/java/buildcraft/api/library/LibraryTypeHandler.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java b/src/api/java/buildcraft/api/library/LibraryTypeHandlerByteArray.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java b/src/api/java/buildcraft/api/library/LibraryTypeHandlerNBT.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/library/package-info.java b/src/api/java/buildcraft/api/library/package-info.java old mode 100644 new mode 100755 index a12f6d708..e41a0dc0f --- a/src/api/java/buildcraft/api/library/package-info.java +++ b/src/api/java/buildcraft/api/library/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.library; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/lists/ListMatchHandler.java b/src/api/java/buildcraft/api/lists/ListMatchHandler.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/lists/ListRegistry.java b/src/api/java/buildcraft/api/lists/ListRegistry.java old mode 100644 new mode 100755 index 5c7be2384..1f3655244 --- a/src/api/java/buildcraft/api/lists/ListRegistry.java +++ b/src/api/java/buildcraft/api/lists/ListRegistry.java @@ -20,7 +20,7 @@ public final class ListRegistry { } } - public static List getHandlers() { + public static List getHandlers() { return Collections.unmodifiableList(handlers); } } diff --git a/src/api/java/buildcraft/api/lists/package-info.java b/src/api/java/buildcraft/api/lists/package-info.java old mode 100644 new mode 100755 index 9cca05170..603c33587 --- a/src/api/java/buildcraft/api/lists/package-info.java +++ b/src/api/java/buildcraft/api/lists/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.lists; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/package-info.java b/src/api/java/buildcraft/api/package-info.java old mode 100644 new mode 100755 index 3e2a2335d..640f52a7d --- a/src/api/java/buildcraft/api/package-info.java +++ b/src/api/java/buildcraft/api/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/power/IEngine.java b/src/api/java/buildcraft/api/power/IEngine.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/power/ILaserTarget.java b/src/api/java/buildcraft/api/power/ILaserTarget.java old mode 100644 new mode 100755 index 95627970a..3743d22fd --- a/src/api/java/buildcraft/api/power/ILaserTarget.java +++ b/src/api/java/buildcraft/api/power/ILaserTarget.java @@ -4,7 +4,6 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.power; - /** This interface should be defined by any Tile which wants to receive energy from BuildCraft lasers. * * The respective Block MUST implement ILaserTargetBlock! */ diff --git a/src/api/java/buildcraft/api/power/ILaserTargetBlock.java b/src/api/java/buildcraft/api/power/ILaserTargetBlock.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/power/IRedstoneEngine.java b/src/api/java/buildcraft/api/power/IRedstoneEngine.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/power/IRedstoneEngineReceiver.java b/src/api/java/buildcraft/api/power/IRedstoneEngineReceiver.java old mode 100644 new mode 100755 index ccbb2f7bb..213d06fe2 --- a/src/api/java/buildcraft/api/power/IRedstoneEngineReceiver.java +++ b/src/api/java/buildcraft/api/power/IRedstoneEngineReceiver.java @@ -5,6 +5,7 @@ package buildcraft.api.power; import net.minecraft.util.EnumFacing; + import cofh.api.energy.IEnergyReceiver; /** Implement this on tiles that you wish to be able to receive Redstone Engine (low-power) energy. diff --git a/src/api/java/buildcraft/api/power/package-info.java b/src/api/java/buildcraft/api/power/package-info.java old mode 100644 new mode 100755 index 0c4fe99d9..c20c3ee4c --- a/src/api/java/buildcraft/api/power/package-info.java +++ b/src/api/java/buildcraft/api/power/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.power; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java b/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java old mode 100644 new mode 100755 index 21a7ec85e..e0ba3a62d --- a/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java +++ b/src/api/java/buildcraft/api/properties/BuildCraftExtendedProperty.java @@ -2,12 +2,12 @@ package buildcraft.api.properties; import java.util.List; -import net.minecraftforge.common.property.IExtendedBlockState; -import net.minecraftforge.common.property.IUnlistedProperty; - import com.google.common.base.Predicate; import com.google.common.base.Predicates; +import net.minecraftforge.common.property.IExtendedBlockState; +import net.minecraftforge.common.property.IUnlistedProperty; + public class BuildCraftExtendedProperty> extends BuildCraftProperty implements IUnlistedProperty { private final Predicate function; @@ -22,7 +22,7 @@ public class BuildCraftExtendedProperty> extends BuildCr } public static BuildCraftExtendedProperty create(String name, final double min, final double max) { - return new BuildCraftExtendedProperty<>(name, Double.class, new Predicate() { + return new BuildCraftExtendedProperty(name, Double.class, new Predicate() { @Override public boolean apply(Double input) { return input >= min && input <= max; diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java b/src/api/java/buildcraft/api/properties/BuildCraftProperties.java old mode 100644 new mode 100755 index 9851da271..e689a6e1a --- a/src/api/java/buildcraft/api/properties/BuildCraftProperties.java +++ b/src/api/java/buildcraft/api/properties/BuildCraftProperties.java @@ -2,32 +2,25 @@ package buildcraft.api.properties; import java.util.Map; -import net.minecraft.util.EnumFacing; -import buildcraft.api.core.EnumColor; -import buildcraft.api.enums.EnumBlueprintType; -import buildcraft.api.enums.EnumDecoratedBlock; -import buildcraft.api.enums.EnumEnergyStage; -import buildcraft.api.enums.EnumEngineType; -import buildcraft.api.enums.EnumFillerPattern; -import buildcraft.api.enums.EnumLaserTableType; -import buildcraft.api.enums.EnumMachineState; -import buildcraft.api.enums.EnumSpring; - import com.google.common.collect.Maps; +import net.minecraft.item.EnumDyeColor; +import net.minecraft.util.EnumFacing; + +import buildcraft.api.enums.*; + public final class BuildCraftProperties { public static final BuildCraftProperty BLOCK_FACING = BuildCraftProperty.create("facing", EnumFacing.Plane.HORIZONTAL.facings()); public static final BuildCraftProperty BLOCK_FACING_6 = BuildCraftProperty.create("facing", EnumFacing.class); - public static final BuildCraftProperty BLOCK_COLOR = BuildCraftProperty.create("color", EnumColor.class); + public static final BuildCraftProperty BLOCK_COLOR = BuildCraftProperty.create("color", EnumDyeColor.class); public static final BuildCraftProperty SPRING_TYPE = BuildCraftProperty.create("type", EnumSpring.class); public static final BuildCraftProperty ENGINE_TYPE = BuildCraftProperty.create("type", EnumEngineType.class); public static final BuildCraftProperty LASER_TABLE_TYPE = BuildCraftProperty.create("type", EnumLaserTableType.class); public static final BuildCraftProperty MACHINE_STATE = BuildCraftProperty.create("state", EnumMachineState.class); public static final BuildCraftProperty ENERGY_STAGE = BuildCraftProperty.create("stage", EnumEnergyStage.class); public static final BuildCraftProperty BLUEPRINT_TYPE = BuildCraftProperty.create("blueprint_type", EnumBlueprintType.class); - public static final BuildCraftProperty DECORATED_BLOCK = BuildCraftProperty.create("decoration_type", - EnumDecoratedBlock.class); + public static final BuildCraftProperty DECORATED_BLOCK = BuildCraftProperty.create("decoration_type", EnumDecoratedBlock.class); public static final BuildCraftProperty GENERIC_PIPE_DATA = BuildCraftProperty.create("pipe_data", 0, 15); public static final BuildCraftProperty LED_POWER = BuildCraftProperty.create("led_power", 0, 3); @@ -35,6 +28,7 @@ public final class BuildCraftProperties { public static final BuildCraftProperty JOINED_BELOW = BuildCraftProperty.create("joined_below", false); public static final BuildCraftProperty MOVING = BuildCraftProperty.create("moving", false); public static final BuildCraftProperty LED_DONE = BuildCraftProperty.create("led_done", false); + public static final BuildCraftProperty ACTIVE = BuildCraftProperty.create("active", false); public static final BuildCraftProperty CONNECTED_UP = BuildCraftProperty.create("connected_up", false); public static final BuildCraftProperty CONNECTED_DOWN = BuildCraftProperty.create("connected_down", false); diff --git a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java b/src/api/java/buildcraft/api/properties/BuildCraftProperty.java old mode 100644 new mode 100755 index 2a335f9e0..b768d251a --- a/src/api/java/buildcraft/api/properties/BuildCraftProperty.java +++ b/src/api/java/buildcraft/api/properties/BuildCraftProperty.java @@ -3,10 +3,13 @@ package buildcraft.api.properties; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Locale; + +import com.google.common.base.Optional; import net.minecraft.block.properties.PropertyHelper; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; /** This class exists primarily to allow for a property to be used as either a normal IProperty, or an * IUnlistedProperty. It also exists to give IProperty's generic types. */ @@ -108,9 +111,9 @@ public class BuildCraftProperty> extends PropertyHelper< } else if (value instanceof IStringSerializable) { return ((IStringSerializable) value).getName(); } else if (value instanceof Enum) { - return ((Enum) value).name(); + return ((Enum) value).name().toLowerCase(Locale.ROOT); } else { - return value.toString(); + return value.toString().toLowerCase(Locale.ROOT); } } @@ -126,4 +129,19 @@ public class BuildCraftProperty> extends PropertyHelper< builder.append("]"); return builder.toString(); } + + @Override + public Optional parseValue(String value) { + if (clazz.isEnum()) { + return parseEnum(value, (BuildCraftProperty) this); + } + return Optional.absent(); + } + + public static > Optional parseEnum(String name, BuildCraftProperty prop) { + for (E e : prop.values) { + if (e.name().equalsIgnoreCase(name)) return Optional.of(e); + } + return Optional.absent(); + } } diff --git a/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java b/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java old mode 100644 new mode 100755 index 6d726784b..72904b5cb --- a/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java +++ b/src/api/java/buildcraft/api/recipes/BuildcraftRecipeRegistry.java @@ -10,6 +10,7 @@ public final class BuildcraftRecipeRegistry { public static IIntegrationRecipeManager integrationTable; public static IRefineryRecipeManager refinery; public static IProgrammingRecipeManager programmingTable; + public static IComplexRefineryRecipeManager complexRefinery; private BuildcraftRecipeRegistry() {} } diff --git a/src/api/java/buildcraft/api/recipes/CraftingResult.java b/src/api/java/buildcraft/api/recipes/CraftingResult.java index 514284423..53fde5cf2 100755 --- a/src/api/java/buildcraft/api/recipes/CraftingResult.java +++ b/src/api/java/buildcraft/api/recipes/CraftingResult.java @@ -7,6 +7,7 @@ package buildcraft.api.recipes; import java.util.ArrayList; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidStack; public class CraftingResult { diff --git a/src/api/java/buildcraft/api/recipes/IAssemblyRecipeManager.java b/src/api/java/buildcraft/api/recipes/IAssemblyRecipeManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java b/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java new file mode 100755 index 000000000..5623b5eaa --- /dev/null +++ b/src/api/java/buildcraft/api/recipes/IComplexRefineryRecipeManager.java @@ -0,0 +1,66 @@ +package buildcraft.api.recipes; + +import java.util.Set; + +import com.google.common.base.Predicate; + +import net.minecraftforge.fluids.FluidStack; + +public interface IComplexRefineryRecipeManager { + IHeatableRecipe createHeatingRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); + + IHeatableRecipe addHeatableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); + + ICoolableRecipe createCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks); + + ICoolableRecipe addCoolableRecipe(FluidStack in, FluidStack out, int heatFrom, int heatTo, int ticks, boolean replaceExisting); + + IDistilationRecipe createDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks); + + IDistilationRecipe addDistilationRecipe(FluidStack in, FluidStack outGas, FluidStack outLiquid, int ticks, boolean replaceExisting); + + IComplexRefineryRegistry getHeatableRegistry(); + + IComplexRefineryRegistry getCoolableRegistry(); + + IComplexRefineryRegistry getDistilationRegistry(); + + public interface IComplexRefineryRegistry { + /** @return an unmodifiable set containing all of the distilation recipies that satisfy the given predicate. All + * of the recipe objects are guarenteed to never be null. */ + Set getRecipes(Predicate toReturn); + + /** @return an unmodifiable set containing all of the distilation recipies. */ + Set getAllRecipes(); + + R getRecipeForInput(FluidStack fluid); + + Set removeRecipes(Predicate toRemove); + + R addRecipe(R recipe, boolean replaceExisting); + } + + public interface IComplexRefineryRecipe { + int ticks(); + + FluidStack in(); + } + + public interface IHeatExchangerRecipe extends IComplexRefineryRecipe { + FluidStack out(); + + int heatFrom(); + + int heatTo(); + } + + public interface IHeatableRecipe extends IHeatExchangerRecipe {} + + public interface ICoolableRecipe extends IHeatExchangerRecipe {} + + public interface IDistilationRecipe extends IComplexRefineryRecipe { + FluidStack outGas(); + + FluidStack outLiquid(); + } +} diff --git a/src/api/java/buildcraft/api/recipes/IFlexibleCrafter.java b/src/api/java/buildcraft/api/recipes/IFlexibleCrafter.java old mode 100644 new mode 100755 index a69b0424f..3cad0d5d9 --- a/src/api/java/buildcraft/api/recipes/IFlexibleCrafter.java +++ b/src/api/java/buildcraft/api/recipes/IFlexibleCrafter.java @@ -5,6 +5,7 @@ package buildcraft.api.recipes; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidStack; public interface IFlexibleCrafter { diff --git a/src/api/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java b/src/api/java/buildcraft/api/recipes/IFlexibleRecipeViewable.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/IIntegrationRecipe.java b/src/api/java/buildcraft/api/recipes/IIntegrationRecipe.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/IIntegrationRecipeManager.java b/src/api/java/buildcraft/api/recipes/IIntegrationRecipeManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/IProgrammingRecipe.java b/src/api/java/buildcraft/api/recipes/IProgrammingRecipe.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/IProgrammingRecipeManager.java b/src/api/java/buildcraft/api/recipes/IProgrammingRecipeManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/IRecipeManager.java b/src/api/java/buildcraft/api/recipes/IRecipeManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/IRefineryRecipeManager.java b/src/api/java/buildcraft/api/recipes/IRefineryRecipeManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/recipes/package-info.java b/src/api/java/buildcraft/api/recipes/package-info.java old mode 100644 new mode 100755 index b15cbf465..f8cc9942a --- a/src/api/java/buildcraft/api/recipes/package-info.java +++ b/src/api/java/buildcraft/api/recipes/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.recipes; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/robots/DockingStation.java b/src/api/java/buildcraft/api/robots/DockingStation.java index 3e5d2904c..a1b6a1b89 100755 --- a/src/api/java/buildcraft/api/robots/DockingStation.java +++ b/src/api/java/buildcraft/api/robots/DockingStation.java @@ -6,10 +6,12 @@ package buildcraft.api.robots; import net.minecraft.inventory.IInventory; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fluids.IFluidHandler; + import buildcraft.api.core.BCLog; import buildcraft.api.core.EnumPipePart; import buildcraft.api.statements.StatementSlot; diff --git a/src/api/java/buildcraft/api/robots/EntityRobotBase.java b/src/api/java/buildcraft/api/robots/EntityRobotBase.java index 8f9b64b74..49ffe0999 100755 --- a/src/api/java/buildcraft/api/robots/EntityRobotBase.java +++ b/src/api/java/buildcraft/api/robots/EntityRobotBase.java @@ -9,12 +9,15 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import net.minecraftforge.fluids.IFluidHandler; + +import cofh.api.energy.IEnergyStorage; + import buildcraft.api.boards.RedstoneBoardRobot; import buildcraft.api.core.IZone; -import cofh.api.energy.IEnergyStorage; public abstract class EntityRobotBase extends EntityLiving implements IInventory, IFluidHandler { diff --git a/src/api/java/buildcraft/api/robots/IDockingStationProvider.java b/src/api/java/buildcraft/api/robots/IDockingStationProvider.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java b/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java old mode 100644 new mode 100755 index 82e0a39ce..fa39ee1a1 --- a/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java +++ b/src/api/java/buildcraft/api/robots/IRobotOverlayItem.java @@ -2,6 +2,7 @@ package buildcraft.api.robots; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.item.ItemStack; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/api/java/buildcraft/api/robots/IRobotRegistry.java b/src/api/java/buildcraft/api/robots/IRobotRegistry.java index 07b432f6c..96360f564 100755 --- a/src/api/java/buildcraft/api/robots/IRobotRegistry.java +++ b/src/api/java/buildcraft/api/robots/IRobotRegistry.java @@ -7,8 +7,8 @@ package buildcraft.api.robots; import java.util.Collection; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; public interface IRobotRegistry { diff --git a/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java b/src/api/java/buildcraft/api/robots/IRobotRegistryProvider.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/robots/ResourceIdBlock.java b/src/api/java/buildcraft/api/robots/ResourceIdBlock.java index 3e9363afa..4e70b1797 100755 --- a/src/api/java/buildcraft/api/robots/ResourceIdBlock.java +++ b/src/api/java/buildcraft/api/robots/ResourceIdBlock.java @@ -4,11 +4,11 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; +import org.apache.commons.lang3.builder.HashCodeBuilder; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; - -import org.apache.commons.lang3.builder.HashCodeBuilder; +import net.minecraft.util.math.BlockPos; import buildcraft.api.core.EnumPipePart; diff --git a/src/api/java/buildcraft/api/robots/ResourceIdRequest.java b/src/api/java/buildcraft/api/robots/ResourceIdRequest.java index e23e218f1..ab37ad2c6 100755 --- a/src/api/java/buildcraft/api/robots/ResourceIdRequest.java +++ b/src/api/java/buildcraft/api/robots/ResourceIdRequest.java @@ -4,10 +4,10 @@ * of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */ package buildcraft.api.robots; -import net.minecraft.nbt.NBTTagCompound; - import org.apache.commons.lang3.builder.HashCodeBuilder; +import net.minecraft.nbt.NBTTagCompound; + import buildcraft.api.core.EnumPipePart; public class ResourceIdRequest extends ResourceIdBlock { diff --git a/src/api/java/buildcraft/api/robots/RobotManager.java b/src/api/java/buildcraft/api/robots/RobotManager.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/robots/package-info.java b/src/api/java/buildcraft/api/robots/package-info.java old mode 100644 new mode 100755 index 6bb10c952..4fd622b34 --- a/src/api/java/buildcraft/api/robots/package-info.java +++ b/src/api/java/buildcraft/api/robots/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.robots; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/statements/IActionExternal.java b/src/api/java/buildcraft/api/statements/IActionExternal.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/IActionInternal.java b/src/api/java/buildcraft/api/statements/IActionInternal.java old mode 100644 new mode 100755 index c3c77a4b1..621c317e8 --- a/src/api/java/buildcraft/api/statements/IActionInternal.java +++ b/src/api/java/buildcraft/api/statements/IActionInternal.java @@ -8,4 +8,8 @@ public interface IActionInternal extends IStatement { void actionActivate(IStatementContainer source, IStatementParameter[] parameters); + public interface IActionInternalSingle extends IActionInternal { + /** @return True if this action should only be fired for the first tick of it being active. */ + boolean singleActionTick(); + } } diff --git a/src/api/java/buildcraft/api/statements/IActionProvider.java b/src/api/java/buildcraft/api/statements/IActionProvider.java old mode 100644 new mode 100755 index 63625b05a..5eb27abc0 --- a/src/api/java/buildcraft/api/statements/IActionProvider.java +++ b/src/api/java/buildcraft/api/statements/IActionProvider.java @@ -10,10 +10,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; public interface IActionProvider { + void addInternalActions(Collection actions, IStatementContainer container); - /** Returns the list of actions that are available from the statement container holding the gate. */ - Collection getInternalActions(IStatementContainer container); - - /** Returns the list of actions available to a gate next to the given block. */ - Collection getExternalActions(EnumFacing side, TileEntity tile); + void addExternalActions(Collection actions, EnumFacing side, TileEntity tile); } diff --git a/src/api/java/buildcraft/api/statements/IActionReceptor.java b/src/api/java/buildcraft/api/statements/IActionReceptor.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java b/src/api/java/buildcraft/api/statements/IOverrideDefaultStatements.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/IStatement.java b/src/api/java/buildcraft/api/statements/IStatement.java old mode 100644 new mode 100755 index dc0254332..123488b09 --- a/src/api/java/buildcraft/api/statements/IStatement.java +++ b/src/api/java/buildcraft/api/statements/IStatement.java @@ -5,6 +5,8 @@ package buildcraft.api.statements; 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; @@ -33,4 +35,7 @@ public interface IStatement { * texture on the map block texture map. */ @SideOnly(Side.CLIENT) TextureAtlasSprite getGuiSprite(); + + @SideOnly(Side.CLIENT) + void registerIcons(TextureMap register); } diff --git a/src/api/java/buildcraft/api/statements/IStatementContainer.java b/src/api/java/buildcraft/api/statements/IStatementContainer.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/IStatementParameter.java b/src/api/java/buildcraft/api/statements/IStatementParameter.java index 7ef29c793..d8b73c0ff 100755 --- a/src/api/java/buildcraft/api/statements/IStatementParameter.java +++ b/src/api/java/buildcraft/api/statements/IStatementParameter.java @@ -5,8 +5,10 @@ package buildcraft.api.statements; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -33,4 +35,7 @@ public interface IStatementParameter { /** This returns the parameter after a left rotation. Used in particular in blueprints orientation. */ IStatementParameter rotateLeft(); + + @SideOnly(Side.CLIENT) + void registerIcons(TextureMap map); } diff --git a/src/api/java/buildcraft/api/statements/ITriggerExternal.java b/src/api/java/buildcraft/api/statements/ITriggerExternal.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java b/src/api/java/buildcraft/api/statements/ITriggerExternalOverride.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/ITriggerProvider.java b/src/api/java/buildcraft/api/statements/ITriggerProvider.java old mode 100644 new mode 100755 index d6ffbd42f..847b1a0aa --- a/src/api/java/buildcraft/api/statements/ITriggerProvider.java +++ b/src/api/java/buildcraft/api/statements/ITriggerProvider.java @@ -10,11 +10,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; public interface ITriggerProvider { - - /** Returns the list of triggers that are available from the object holding the gate. */ - Collection getInternalTriggers(IStatementContainer container); + void addInternalTriggers(Collection triggers, IStatementContainer container); /** Returns the list of triggers available to a gate next to the given block. */ - Collection getExternalTriggers(EnumFacing side, TileEntity tile); - + void addExternalTriggers(Collection triggers, EnumFacing side, TileEntity tile); } diff --git a/src/api/java/buildcraft/api/statements/StatementManager.java b/src/api/java/buildcraft/api/statements/StatementManager.java old mode 100644 new mode 100755 index 34872e5b0..c3def1090 --- a/src/api/java/buildcraft/api/statements/StatementManager.java +++ b/src/api/java/buildcraft/api/statements/StatementManager.java @@ -4,14 +4,15 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.statements; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + import buildcraft.api.core.BCLog; public final class StatementManager { @@ -50,93 +51,57 @@ public final class StatementManager { } public static List getExternalTriggers(EnumFacing side, TileEntity entity) { - List result; - if (entity instanceof IOverrideDefaultStatements) { - result = ((IOverrideDefaultStatements) entity).overrideTriggers(); + List result = ((IOverrideDefaultStatements) entity).overrideTriggers(); if (result != null) { return result; } } - result = new LinkedList(); + LinkedHashSet triggers = new LinkedHashSet(); for (ITriggerProvider provider : triggerProviders) { - Collection toAdd = provider.getExternalTriggers(side, entity); - - if (toAdd != null) { - for (ITriggerExternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } + provider.addExternalTriggers(triggers, side, entity); } - return result; + return new ArrayList(triggers); } public static List getExternalActions(EnumFacing side, TileEntity entity) { - List result = new LinkedList(); - if (entity instanceof IOverrideDefaultStatements) { - result = ((IOverrideDefaultStatements) entity).overrideActions(); + List result = ((IOverrideDefaultStatements) entity).overrideActions(); if (result != null) { return result; } } - result = new LinkedList(); + LinkedHashSet actions = new LinkedHashSet(); for (IActionProvider provider : actionProviders) { - Collection toAdd = provider.getExternalActions(side, entity); - - if (toAdd != null) { - for (IActionExternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } + provider.addExternalActions(actions, side, entity); } - return result; + return new ArrayList(actions); } public static List getInternalTriggers(IStatementContainer container) { - List result = new LinkedList(); + LinkedHashSet triggers = new LinkedHashSet(); for (ITriggerProvider provider : triggerProviders) { - Collection toAdd = provider.getInternalTriggers(container); - - if (toAdd != null) { - for (ITriggerInternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } + provider.addInternalTriggers(triggers, container); } - return result; + return new ArrayList(triggers); } public static List getInternalActions(IStatementContainer container) { - List result = new LinkedList(); + LinkedHashSet actions = new LinkedHashSet(); for (IActionProvider provider : actionProviders) { - Collection toAdd = provider.getInternalActions(container); - - if (toAdd != null) { - for (IActionInternal t : toAdd) { - if (!result.contains(t)) { - result.add(t); - } - } - } + provider.addInternalActions(actions, container); } - return result; + return new ArrayList(actions); } public static IStatementParameter createParameter(String kind) { @@ -144,6 +109,10 @@ public final class StatementManager { } private static IStatementParameter createParameter(Class param) { + if (param == null) { + return null; + } + try { return param.newInstance(); } catch (InstantiationException e) { @@ -158,19 +127,19 @@ public final class StatementManager { return null; } - // /** - // * Generally, this function should be called by every mod implementing - // * the Statements API ***as a container*** (that is, adding its own gates) - // * on the client side from a given Item of choice. - // */ - // @SideOnly(Side.CLIENT) - // public static void registerIcons(TextureAtlasSpriteRegister register) { - // for (IStatement statement : statements.values()) { - // statement.registerIcons(register); - // } - // - // for (Class parameter : parameters.values()) { - // createParameter(parameter).registerIcons(register); - // } - // } + /** + * Generally, this function should be called by every mod implementing + * the Statements API ***as a container*** (that is, adding its own gates) + * on the client side from a given Item of choice. + */ + @SideOnly(Side.CLIENT) + public static void registerIcons(TextureMap register) { + for (IStatement statement : statements.values()) { + statement.registerIcons(register); + } + + for (Class parameter : parameters.values()) { + createParameter(parameter).registerIcons(register); + } + } } diff --git a/src/api/java/buildcraft/api/statements/StatementMouseClick.java b/src/api/java/buildcraft/api/statements/StatementMouseClick.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java b/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java index 3ed0ec5db..463293854 100755 --- a/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java +++ b/src/api/java/buildcraft/api/statements/StatementParameterItemStack.java @@ -7,6 +7,7 @@ package buildcraft.api.statements; import java.util.Objects; import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -87,4 +88,9 @@ public class StatementParameterItemStack implements IStatementParameter { public IStatementParameter rotateLeft() { return this; } + + @Override + public void registerIcons(TextureMap map) { + + } } diff --git a/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java b/src/api/java/buildcraft/api/statements/containers/IRedstoneStatementContainer.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java b/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java old mode 100644 new mode 100755 index 4c3de34f5..b65ace45a --- a/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java +++ b/src/api/java/buildcraft/api/statements/containers/ISidedStatementContainer.java @@ -1,6 +1,7 @@ package buildcraft.api.statements.containers; import net.minecraft.util.EnumFacing; + import buildcraft.api.statements.IStatementContainer; /** Created by asie on 3/14/15. */ diff --git a/src/api/java/buildcraft/api/statements/package-info.java b/src/api/java/buildcraft/api/statements/package-info.java old mode 100644 new mode 100755 index 4a6139b3d..7dd2c74e6 --- a/src/api/java/buildcraft/api/statements/package-info.java +++ b/src/api/java/buildcraft/api/statements/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.statements; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/tablet/ITablet.java b/src/api/java/buildcraft/api/tablet/ITablet.java old mode 100644 new mode 100755 index 09b3af4a2..e88a4cf36 --- a/src/api/java/buildcraft/api/tablet/ITablet.java +++ b/src/api/java/buildcraft/api/tablet/ITablet.java @@ -1,6 +1,7 @@ package buildcraft.api.tablet; import net.minecraft.nbt.NBTTagCompound; + import net.minecraftforge.fml.relauncher.Side; public interface ITablet { diff --git a/src/api/java/buildcraft/api/tablet/TabletAPI.java b/src/api/java/buildcraft/api/tablet/TabletAPI.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tablet/TabletBitmap.java b/src/api/java/buildcraft/api/tablet/TabletBitmap.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tablet/TabletProgram.java b/src/api/java/buildcraft/api/tablet/TabletProgram.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java b/src/api/java/buildcraft/api/tablet/TabletProgramFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tablet/TabletTicker.java b/src/api/java/buildcraft/api/tablet/TabletTicker.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tablet/package-info.java b/src/api/java/buildcraft/api/tablet/package-info.java old mode 100644 new mode 100755 index 0f16c278b..cc87d8657 --- a/src/api/java/buildcraft/api/tablet/package-info.java +++ b/src/api/java/buildcraft/api/tablet/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.tablet; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/tiles/IControllable.java b/src/api/java/buildcraft/api/tiles/IControllable.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tiles/IDebuggable.java b/src/api/java/buildcraft/api/tiles/IDebuggable.java old mode 100644 new mode 100755 index e8af6d3f5..4e5cb3d5d --- a/src/api/java/buildcraft/api/tiles/IDebuggable.java +++ b/src/api/java/buildcraft/api/tiles/IDebuggable.java @@ -3,6 +3,7 @@ package buildcraft.api.tiles; import java.util.List; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/api/java/buildcraft/api/tiles/IHasWork.java b/src/api/java/buildcraft/api/tiles/IHasWork.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tiles/IHeatable.java b/src/api/java/buildcraft/api/tiles/IHeatable.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java b/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java old mode 100644 new mode 100755 index 521b4e7ea..89a7c1456 --- a/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java +++ b/src/api/java/buildcraft/api/tiles/ITileAreaProvider.java @@ -1,6 +1,7 @@ package buildcraft.api.tiles; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; + import buildcraft.api.core.IAreaProvider; /** Used for more fine-grained control of whether or not a machine connects to the provider here. */ diff --git a/src/api/java/buildcraft/api/tiles/package-info.java b/src/api/java/buildcraft/api/tiles/package-info.java old mode 100644 new mode 100755 index 54d026b2d..d4c217fc3 --- a/src/api/java/buildcraft/api/tiles/package-info.java +++ b/src/api/java/buildcraft/api/tiles/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.tiles; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/tools/IToolWrench.java b/src/api/java/buildcraft/api/tools/IToolWrench.java old mode 100644 new mode 100755 index 0138fdf91..74aaa7e6e --- a/src/api/java/buildcraft/api/tools/IToolWrench.java +++ b/src/api/java/buildcraft/api/tools/IToolWrench.java @@ -6,7 +6,7 @@ package buildcraft.api.tools; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /*** Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft */ public interface IToolWrench { diff --git a/src/api/java/buildcraft/api/tools/package-info.java b/src/api/java/buildcraft/api/tools/package-info.java old mode 100644 new mode 100755 index bb6df1f41..873fba1b0 --- a/src/api/java/buildcraft/api/tools/package-info.java +++ b/src/api/java/buildcraft/api/tools/package-info.java @@ -6,4 +6,3 @@ package buildcraft.api.tools; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/transport/ICustomPipeConnection.java b/src/api/java/buildcraft/api/transport/ICustomPipeConnection.java old mode 100644 new mode 100755 index c4cc1efdf..57c05e70e --- a/src/api/java/buildcraft/api/transport/ICustomPipeConnection.java +++ b/src/api/java/buildcraft/api/transport/ICustomPipeConnection.java @@ -1,8 +1,8 @@ package buildcraft.api.transport; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ICustomPipeConnection { diff --git a/src/api/java/buildcraft/api/transport/IInjectable.java b/src/api/java/buildcraft/api/transport/IInjectable.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/IItemPipe.java b/src/api/java/buildcraft/api/transport/IItemPipe.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/IPipe.java b/src/api/java/buildcraft/api/transport/IPipe.java index 563b53cc5..96a7a764c 100755 --- a/src/api/java/buildcraft/api/transport/IPipe.java +++ b/src/api/java/buildcraft/api/transport/IPipe.java @@ -5,6 +5,7 @@ package buildcraft.api.transport; import net.minecraft.util.EnumFacing; + import buildcraft.api.gates.IGate; public interface IPipe { diff --git a/src/api/java/buildcraft/api/transport/IPipeConnection.java b/src/api/java/buildcraft/api/transport/IPipeConnection.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/IPipeTile.java b/src/api/java/buildcraft/api/transport/IPipeTile.java old mode 100644 new mode 100755 index a74e22ef5..357d9011c --- a/src/api/java/buildcraft/api/transport/IPipeTile.java +++ b/src/api/java/buildcraft/api/transport/IPipeTile.java @@ -7,7 +7,9 @@ package buildcraft.api.transport; import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import buildcraft.api.transport.pluggable.PipePluggable; public interface IPipeTile extends IInjectable { @@ -22,6 +24,8 @@ public interface IPipeTile extends IInjectable { World getWorldBC(); + BlockPos getPosBC(); + /** True if the pipe is connected to the block/pipe in the specific direction * * @param with diff --git a/src/api/java/buildcraft/api/transport/IStripesActivator.java b/src/api/java/buildcraft/api/transport/IStripesActivator.java old mode 100644 new mode 100755 index 540346d7b..b9a0445a8 --- a/src/api/java/buildcraft/api/transport/IStripesActivator.java +++ b/src/api/java/buildcraft/api/transport/IStripesActivator.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; public interface IStripesActivator { - void sendItem(ItemStack itemStack, EnumFacing direction); + boolean sendItem(ItemStack itemStack, EnumFacing direction); void dropItem(ItemStack itemStack, EnumFacing direction); } diff --git a/src/api/java/buildcraft/api/transport/IStripesHandler.java b/src/api/java/buildcraft/api/transport/IStripesHandler.java old mode 100644 new mode 100755 index 71f420552..311589eaa --- a/src/api/java/buildcraft/api/transport/IStripesHandler.java +++ b/src/api/java/buildcraft/api/transport/IStripesHandler.java @@ -6,8 +6,8 @@ package buildcraft.api.transport; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IStripesHandler { diff --git a/src/api/java/buildcraft/api/transport/IStripesPipe.java b/src/api/java/buildcraft/api/transport/IStripesPipe.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/PipeConnectionAPI.java b/src/api/java/buildcraft/api/transport/PipeConnectionAPI.java old mode 100644 new mode 100755 index ce44514c1..c5ae04628 --- a/src/api/java/buildcraft/api/transport/PipeConnectionAPI.java +++ b/src/api/java/buildcraft/api/transport/PipeConnectionAPI.java @@ -2,14 +2,14 @@ package buildcraft.api.transport; import java.util.Map; +import com.google.common.collect.Maps; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import com.google.common.collect.Maps; - /** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered * version does not override your own implementation. */ diff --git a/src/api/java/buildcraft/api/transport/PipeManager.java b/src/api/java/buildcraft/api/transport/PipeManager.java index 8a1e3b5aa..595b20e24 100755 --- a/src/api/java/buildcraft/api/transport/PipeManager.java +++ b/src/api/java/buildcraft/api/transport/PipeManager.java @@ -4,15 +4,11 @@ * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ package buildcraft.api.transport; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; + import buildcraft.api.transport.pluggable.PipePluggable; public abstract class PipeManager { diff --git a/src/api/java/buildcraft/api/transport/PipeWire.java b/src/api/java/buildcraft/api/transport/PipeWire.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/package-info.java b/src/api/java/buildcraft/api/transport/package-info.java old mode 100644 new mode 100755 index e0c225e57..004c271a1 --- a/src/api/java/buildcraft/api/transport/package-info.java +++ b/src/api/java/buildcraft/api/transport/package-info.java @@ -2,8 +2,7 @@ * * The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which * should be located as "LICENSE.API" in the BuildCraft source code distribution. */ -@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport") +@API(apiVersion = "5.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport") package buildcraft.api.transport; import net.minecraftforge.fml.common.API; - diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java b/src/api/java/buildcraft/api/transport/pipe_bc8/BCPipeEventHandler.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java b/src/api/java/buildcraft/api/transport/pipe_bc8/EnumContentsJourneyPart.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java old mode 100644 new mode 100755 index a2e124e2a..a18140f6b --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IConnection_BC8.java @@ -2,6 +2,7 @@ package buildcraft.api.transport.pipe_bc8; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; + import buildcraft.api.transport.pipe_bc8.IExtractionManager.IExtractable_BC8; import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertable_BC8; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java old mode 100644 new mode 100755 index 5b63c8d60..0983d7d16 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IExtractionManager.java @@ -1,6 +1,7 @@ package buildcraft.api.transport.pipe_bc8; import net.minecraft.util.EnumFacing; + import buildcraft.api.core.IFluidFilter; import buildcraft.api.core.IStackFilter; import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertableFactory; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java old mode 100644 new mode 100755 index 4443683a5..0ae64a68a --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IInsertionManager.java @@ -1,6 +1,7 @@ package buildcraft.api.transport.pipe_bc8; import net.minecraft.util.EnumFacing; + import buildcraft.api.core.IFluidFilter; import buildcraft.api.core.IStackFilter; import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; @@ -23,15 +24,6 @@ public interface IInsertionManager { boolean tryInsertFluid(IPipeContentsEditableFluid fluid, Object extractor, EnumFacing direction, boolean simulate); - default boolean tryInsert(IPipeContentsEditable contents, Object extractor, EnumFacing direction, boolean simulate) { - if (contents instanceof IPipeContentsEditableItem) { - return tryInsertItems((IPipeContentsEditableItem) contents, extractor, direction, simulate); - } else if (contents instanceof IPipeContentsEditableFluid) { - return tryInsertFluid((IPipeContentsEditableFluid) contents, extractor, direction, simulate); - } - return false; - } - /** @return True if {@link #tryExtractItems(IStackFilter, Object, EnumFacing, boolean)} can return a non-null * value at any future point in time. */ boolean acceptsItems(); diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeAddonItem.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeBehaviourFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java old mode 100644 new mode 100755 index 9457c9adf..23e16eeb2 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContents.java @@ -3,6 +3,7 @@ package buildcraft.api.transport.pipe_bc8; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java old mode 100644 new mode 100755 index 8f9f21b68..789772f12 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeContentsEditable.java @@ -1,15 +1,18 @@ package buildcraft.api.transport.pipe_bc8; -import io.netty.buffer.ByteBuf; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; + import net.minecraftforge.fluids.Fluid; + import buildcraft.api.core.INBTLoadable_BC8; import buildcraft.api.core.INetworkLoadable_BC8; import buildcraft.api.transport.pipe_bc8.IPipePropertyProvider.IPipePropertyProviderEditable; +import io.netty.buffer.ByteBuf; + /** Provides a way to change the contents of a pipe. */ public interface IPipeContentsEditable extends IPipeContents, INetworkLoadable_BC8, INBTLoadable_BC8 { IPipeContents asReadOnly(); diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java old mode 100644 new mode 100755 index ef07c485c..1d39da2b1 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHelper.java @@ -1,7 +1,9 @@ package buildcraft.api.transport.pipe_bc8; import net.minecraft.item.ItemStack; + import net.minecraftforge.fluids.FluidStack; + import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableFluid; import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable.IPipeContentsEditableItem; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeHolder_BC8.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListener.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerFactory.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeListenerRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java old mode 100644 new mode 100755 index 4b4e998a9..5581d82ff --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipePropertyProvider.java @@ -3,6 +3,7 @@ package buildcraft.api.transport.pipe_bc8; import java.util.Set; import net.minecraft.nbt.NBTBase; + import buildcraft.api.core.INBTLoadable_BC8; import buildcraft.api.core.INetworkLoadable_BC8; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java old mode 100644 new mode 100755 index 9a401b621..ca0ec628b --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeRegistry.java @@ -1,6 +1,7 @@ package buildcraft.api.transport.pipe_bc8; import net.minecraft.item.Item; + import buildcraft.api.ITripleRegistry; public interface IPipeRegistry extends ITripleRegistry { diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeType.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipeType.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java old mode 100644 new mode 100755 index 5bc716319..66dc2037c --- a/src/api/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/IPipe_BC8.java @@ -4,6 +4,7 @@ import java.util.Map; import net.minecraft.util.EnumFacing; import net.minecraft.world.World; + import buildcraft.api.core.INBTLoadable_BC8; import buildcraft.api.transport.pipe_bc8.event_bc8.IPipeEvent_BC8; @@ -38,16 +39,12 @@ public interface IPipe_BC8 extends INBTLoadable_BC8 { /** Makes this pipe send a client update at some point in the future. This might send it now, or it might send it * next tick. */ - default void scheduleClientUpdate(IPipeListener listener) { - sendClientUpdate(listener); - } + void scheduleClientUpdate(IPipeListener listener); /** Makes this pipe re-render its static parts. */ void sendRenderUpdate(); /** Makes this pipe send a render update at some point in the future. This might send it now, or it might send it in * a few ticks time. */ - default void scheduleRenderUpdate() { - sendRenderUpdate(); - } + void scheduleRenderUpdate(); } diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPluggable_BC8.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java b/src/api/java/buildcraft/api/transport/pipe_bc8/IPropertyRegistry.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java old mode 100644 new mode 100755 index cd141c4b3..80030d459 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeAPI_BC8.java @@ -1,6 +1,7 @@ package buildcraft.api.transport.pipe_bc8; import net.minecraft.item.EnumDyeColor; + import buildcraft.api.APIHelper; import buildcraft.api.transport.pipe_bc8.IExtractionManager.IExtractable_BC8; import buildcraft.api.transport.pipe_bc8.IInsertionManager.IInsertable_BC8; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java old mode 100644 new mode 100755 index e17039a14..41daf25fb --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeBehaviour_BC8.java @@ -1,9 +1,10 @@ package buildcraft.api.transport.pipe_bc8; -import io.netty.buffer.ByteBuf; import net.minecraft.nbt.NBTBase; import net.minecraft.util.EnumFacing; +import io.netty.buffer.ByteBuf; + /** An instance is created by instance of IBehaviourFactory per pipe block in world, and is registered with the pipe * event bus to listen and respond to events. */ public abstract class PipeBehaviour_BC8 implements IPipeListener { diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java old mode 100644 new mode 100755 index 6605adc83..aa0a46c65 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeConnectionAPI.java @@ -2,14 +2,15 @@ package buildcraft.api.transport.pipe_bc8; import java.util.Map; +import com.google.common.collect.Maps; + import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import buildcraft.api.transport.ICustomPipeConnection; -import com.google.common.collect.Maps; +import buildcraft.api.transport.ICustomPipeConnection; /** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you * do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java old mode 100644 new mode 100755 index b79a6a3af..909cf8c5a --- a/src/api/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/PipeDefinition_BC8.java @@ -6,8 +6,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.ResourceLocation; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import buildcraft.api.ObjectDefinition; import buildcraft.api.core.BCLog; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java old mode 100644 new mode 100755 index ca95bb5c8..f03e246a8 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventConnection_BC8.java @@ -3,6 +3,7 @@ package buildcraft.api.transport.pipe_bc8.event_bc8; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import buildcraft.api.transport.IPipeConnection; import buildcraft.api.transport.pipe_bc8.IConnection_BC8; import buildcraft.api.transport.pipe_bc8.IPipe_BC8; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java old mode 100644 new mode 100755 index 9e6711637..5b0c1f894 --- a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventContents_BC8.java @@ -3,6 +3,7 @@ package buildcraft.api.transport.pipe_bc8.event_bc8; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; + import buildcraft.api.transport.pipe_bc8.IPipeContents; import buildcraft.api.transport.pipe_bc8.IPipeContentsEditable; import buildcraft.api.transport.pipe_bc8.IPipe_BC8; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java old mode 100644 new mode 100755 index a2405ea55..f007b1b2d --- a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java +++ b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEventInteract_BC8.java @@ -2,7 +2,8 @@ package buildcraft.api.transport.pipe_bc8.event_bc8; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.math.AxisAlignedBB; + import buildcraft.api.tools.IToolWrench; import buildcraft.api.transport.pipe_bc8.IPipeListener; diff --git a/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java b/src/api/java/buildcraft/api/transport/pipe_bc8/event_bc8/IPipeEvent_BC8.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java b/src/api/java/buildcraft/api/transport/pluggable/IConnectionMatrix.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/IFacadePluggable.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java old mode 100644 new mode 100755 index 5d1332f9b..61c69bed4 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java +++ b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableDynamicRenderer.java @@ -1,8 +1,13 @@ package buildcraft.api.transport.pluggable; import net.minecraft.util.EnumFacing; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + import buildcraft.api.transport.IPipe; +@SideOnly(Side.CLIENT) public interface IPipePluggableDynamicRenderer { void renderDynamicPluggable(IPipe pipe, EnumFacing side, PipePluggable pipePluggable, double x, double y, double z); } diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java old mode 100644 new mode 100755 index 1a2d7bbee..b9295e5f0 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java +++ b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableItem.java @@ -2,6 +2,7 @@ package buildcraft.api.transport.pluggable; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; + import buildcraft.api.transport.IPipe; public interface IPipePluggableItem { diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableState.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableState.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableStaticRenderer.java b/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableStaticRenderer.java deleted file mode 100644 index fd55e2f1c..000000000 --- a/src/api/java/buildcraft/api/transport/pluggable/IPipePluggableStaticRenderer.java +++ /dev/null @@ -1,18 +0,0 @@ -package buildcraft.api.transport.pluggable; - -import java.util.List; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.util.EnumFacing; -import buildcraft.api.transport.IPipe; - -public interface IPipePluggableStaticRenderer { - List bakeCutout(IPipeRenderState render, IPipePluggableState pluggableState, IPipe pipe, PipePluggable pluggable, EnumFacing face); - - /** Use this if you need to render in the translucent pass. */ - public interface Translucent extends IPipePluggableStaticRenderer { - /** For performance return a list that is as small as possible */ - List bakeTranslucent(IPipeRenderState render, IPipePluggableState pluggableState, IPipe pipe, PipePluggable pluggable, - EnumFacing face); - } -} diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPipeRenderState.java b/src/api/java/buildcraft/api/transport/pluggable/IPipeRenderState.java old mode 100644 new mode 100755 diff --git a/src/api/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java b/src/api/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java new file mode 100755 index 000000000..829eedaa8 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/IPluggableModelBaker.java @@ -0,0 +1,17 @@ +package buildcraft.api.transport.pluggable; + +import com.google.common.collect.ImmutableList; + +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.vertex.VertexFormat; + +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public interface IPluggableModelBaker> { + /** @return The vertex format used to generate the quads. */ + VertexFormat getVertexFormat(); + + ImmutableList bake(K key); +} diff --git a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java b/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java index 3aaa96f92..2f3db1410 100755 --- a/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java +++ b/src/api/java/buildcraft/api/transport/pluggable/PipePluggable.java @@ -5,10 +5,13 @@ package buildcraft.api.transport.pluggable; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; + import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; + import buildcraft.api.core.INBTStoreable; import buildcraft.api.core.ISerializable; import buildcraft.api.transport.IPipeTile; @@ -45,14 +48,14 @@ public abstract class PipePluggable implements INBTStoreable, ISerializable { public abstract AxisAlignedBB getBoundingBox(EnumFacing side); - @SideOnly(Side.CLIENT) - public abstract IPipePluggableStaticRenderer getRenderer(); - @SideOnly(Side.CLIENT) public IPipePluggableDynamicRenderer getDynamicRenderer() { return null; } + @SideOnly(Side.CLIENT) + public abstract PluggableModelKey getModelRenderKey(BlockRenderLayer layer, EnumFacing side); + public boolean requiresRenderUpdate(PipePluggable old) { return true; } diff --git a/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java b/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java new file mode 100755 index 000000000..32739e4a6 --- /dev/null +++ b/src/api/java/buildcraft/api/transport/pluggable/PluggableModelKey.java @@ -0,0 +1,42 @@ +package buildcraft.api.transport.pluggable; + +import java.util.Arrays; +import java.util.Objects; + +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; + +public abstract class PluggableModelKey> { + public final BlockRenderLayer layer; + public final IPluggableModelBaker baker; + public final EnumFacing side; + private final int hash; + + public PluggableModelKey(BlockRenderLayer layer, IPluggableModelBaker baker, EnumFacing side) { + this.layer = layer; + if (layer != BlockRenderLayer.CUTOUT && layer != BlockRenderLayer.TRANSLUCENT) { + throw new IllegalArgumentException("Can only use CUTOUT or TRANSLUCENT at the moment (was " + layer + ")"); + } + if (baker == null) throw new NullPointerException("baker"); + this.baker = baker; + this.side = side; + /* Don't include the block layer in the hash code as there are different caches for cutout and translucent */ + this.hash = Arrays.hashCode(new int[] { System.identityHashCode(baker), Objects.hashCode(side) }); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null) return false; + if (getClass() != obj.getClass()) return false; + PluggableModelKey other = (PluggableModelKey) obj; + if (baker != other.baker) return false; + if (side != other.side) return false; + return true; + } + + @Override + public int hashCode() { + return hash; + } +} diff --git a/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java b/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java index 95312efbd..740a9def9 100644 --- a/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java +++ b/src/api/java/dan200/computercraft/api/ComputerCraftAPI.java @@ -8,8 +8,8 @@ package dan200.computercraft.api; import java.lang.reflect.Method; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import dan200.computercraft.api.filesystem.IMount; import dan200.computercraft.api.filesystem.IWritableMount; diff --git a/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java b/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java index 49ce88e11..6e9e7afdd 100644 --- a/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java +++ b/src/api/java/dan200/computercraft/api/peripheral/IPeripheralProvider.java @@ -6,8 +6,8 @@ package dan200.computercraft.api.peripheral; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/dan200/computercraft/api/permissions/ITurtlePermissionProvider.java b/src/api/java/dan200/computercraft/api/permissions/ITurtlePermissionProvider.java index 1afc0fea6..ed6fdb197 100644 --- a/src/api/java/dan200/computercraft/api/permissions/ITurtlePermissionProvider.java +++ b/src/api/java/dan200/computercraft/api/permissions/ITurtlePermissionProvider.java @@ -6,7 +6,7 @@ package dan200.computercraft.api.permissions; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java b/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java index 8893ec695..8cba44fce 100644 --- a/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java +++ b/src/api/java/dan200/computercraft/api/redstone/IBundledRedstoneProvider.java @@ -6,8 +6,8 @@ package dan200.computercraft.api.redstone; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java b/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java index b851d397b..b22c796b7 100644 --- a/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java +++ b/src/api/java/dan200/computercraft/api/turtle/ITurtleAccess.java @@ -8,9 +8,9 @@ package dan200.computercraft.api.turtle; import net.minecraft.inventory.IInventory; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import dan200.computercraft.api.lua.ILuaContext; import dan200.computercraft.api.lua.LuaException; @@ -45,7 +45,7 @@ public interface ITurtleAccess * @param f The subframe fraction * @return a vector containing the floating point co-ordinates at which the turtle resides. */ - public Vec3 getVisualPosition( float f ); + public Vec3d getVisualPosition( float f ); /** * 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 08e59fb4a..4996454b7 100644 --- a/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java +++ b/src/api/java/dan200/computercraft/api/turtle/ITurtleUpgrade.java @@ -8,7 +8,7 @@ package dan200.computercraft.api.turtle; import javax.vecmath.Matrix4f; -import net.minecraft.client.resources.model.IBakedModel; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; diff --git a/src/api/java/ic2/api/crops/Crops.java b/src/api/java/ic2/api/crops/Crops.java index 27bc26de6..74dc7f1fb 100644 --- a/src/api/java/ic2/api/crops/Crops.java +++ b/src/api/java/ic2/api/crops/Crops.java @@ -3,7 +3,7 @@ package ic2.api.crops; import java.util.Collection; import net.minecraft.item.ItemStack; -import net.minecraft.world.biome.BiomeGenBase; +import net.minecraft.world.biome.Biome; import net.minecraftforge.common.BiomeDictionary.Type; /** @@ -41,7 +41,7 @@ public abstract class Crops { * @param biome Biome to check * @return Humidity bonus or 0 if none */ - public abstract int getHumidityBiomeBonus(BiomeGenBase biome); + public abstract int getHumidityBiomeBonus(Biome biome); /** * Gets the nutrient bonus for a biome. @@ -49,7 +49,7 @@ public abstract class Crops { * @param biome Biome to check * @return Nutrient bonus or 0 if none */ - public abstract int getNutrientBiomeBonus(BiomeGenBase biome); + public abstract int getNutrientBiomeBonus(Biome biome); /** * Get the crop card for the specified owner and name. diff --git a/src/api/java/ic2/api/crops/ICropTile.java b/src/api/java/ic2/api/crops/ICropTile.java index 9c7e32dde..0d50f8e9a 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.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/ic2/api/energy/IEnergyNet.java b/src/api/java/ic2/api/energy/IEnergyNet.java index 321fe566c..cee3344d1 100644 --- a/src/api/java/ic2/api/energy/IEnergyNet.java +++ b/src/api/java/ic2/api/energy/IEnergyNet.java @@ -1,8 +1,8 @@ package ic2.api.energy; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/ic2/api/energy/event/EnergyTileEvent.java b/src/api/java/ic2/api/energy/event/EnergyTileEvent.java index 4de79ceae..5c8cc094b 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 EnergyTileEvent(IEnergyTile energyTile1) { super(((TileEntity) energyTile1).getWorld()); - if (world == null) throw new NullPointerException("world is null"); + if (getWorld() == null) throw new NullPointerException("world is null"); this.energyTile = energyTile1; } diff --git a/src/api/java/li/cil/oc/api/API.java b/src/api/java/li/cil/oc/api/API.java old mode 100644 new mode 100755 index e23da1570..c5f8c08e4 --- a/src/api/java/li/cil/oc/api/API.java +++ b/src/api/java/li/cil/oc/api/API.java @@ -1,5 +1,6 @@ package li.cil.oc.api; +import com.typesafe.config.Config; import li.cil.oc.api.detail.DriverAPI; import li.cil.oc.api.detail.FileSystemAPI; import li.cil.oc.api.detail.ItemAPI; @@ -8,8 +9,6 @@ import li.cil.oc.api.detail.ManualAPI; import li.cil.oc.api.detail.NanomachinesAPI; import li.cil.oc.api.detail.NetworkAPI; -import com.typesafe.config.Config; - /** * Central reference for the API. *

@@ -19,7 +18,7 @@ import com.typesafe.config.Config; */ public class API { public static final String ID_OWNER = "OpenComputers|Core"; - public static final String VERSION = "5.6.4"; + public static final String VERSION = "6.0.0-alpha"; // ----------------------------------------------------------------------- // diff --git a/src/api/java/li/cil/oc/api/CreativeTab.java b/src/api/java/li/cil/oc/api/CreativeTab.java old mode 100644 new mode 100755 index fcc395666..2454256fe --- a/src/api/java/li/cil/oc/api/CreativeTab.java +++ b/src/api/java/li/cil/oc/api/CreativeTab.java @@ -13,7 +13,7 @@ public final class CreativeTab { * not try to access this anyway when OpenComputers isn't * present (don't ship the API in your mod), so don't rely on this! */ - public static CreativeTabs instance = CreativeTabs.tabRedstone; + public static CreativeTabs instance = CreativeTabs.REDSTONE; private CreativeTab() { } diff --git a/src/api/java/li/cil/oc/api/Driver.java b/src/api/java/li/cil/oc/api/Driver.java old mode 100644 new mode 100755 index 493cc3e10..a89570253 --- a/src/api/java/li/cil/oc/api/Driver.java +++ b/src/api/java/li/cil/oc/api/Driver.java @@ -1,15 +1,21 @@ package li.cil.oc.api; -import java.util.Collection; - import li.cil.oc.api.driver.Block; import li.cil.oc.api.driver.Converter; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.driver.EnvironmentProvider; +import li.cil.oc.api.driver.InventoryProvider; import li.cil.oc.api.driver.Item; +import li.cil.oc.api.driver.SidedBlock; +import li.cil.oc.api.network.EnvironmentHost; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.world.World; +import java.util.Collection; + /** * This API allows registering new drivers with the mod. *

@@ -24,7 +30,7 @@ import net.minecraft.world.World; * at that time. Only start calling these methods in the init phase or later. * * @see Network - * @see Block + * @see SidedBlock * @see Item */ public final class Driver { @@ -39,12 +45,31 @@ public final class Driver { * phases. * * @param driver the driver to register. + * @deprecated Use {@link SidedBlock} instead. */ + @Deprecated // TODO Remove in OC 1.7 public static void add(final Block driver) { if (API.driver != null) API.driver.add(driver); } + /** + * Registers a new side-aware block driver. + *

+ * Whenever the neighboring blocks of an Adapter block change, it checks if + * there exists a driver for the changed block, and if it is configured to + * interface that block type connects it to the component network. + *

+ * This must be called in the init phase, not the pre- or post-init + * phases. + * + * @param driver the driver to register. + */ + public static void add(final SidedBlock driver) { + if (API.driver != null) + API.driver.add(driver); + } + /** * Registers a new item driver. *

@@ -77,6 +102,56 @@ public final class Driver { API.driver.add(converter); } + /** + * Register a new environment provider. + *

+ * Environment providers are used for mapping item stacks to the type of + * environment that will be created by the stack, either by it being + * placed in the world and acting as a block component, or by being + * placed in an component inventory and created by the item's driver. + * + * @param provider the provider to register. + */ + public static void add(final EnvironmentProvider provider) { + if (API.driver != null) + API.driver.add(provider); + } + + /** + * Register a new inventory provider. + *

+ * Inventory providers are used for accessing item inventories using + * the inventory controller upgrade, for example. + * + * @param provider the provider to register. + */ + public static void add(final InventoryProvider provider) { + if (API.driver != null) + API.driver.add(provider); + } + + /** + * Looks up a driver for the block at the specified position in the + * specified world. + *

+ * Note that several drivers for a single block can exist. Because of this + * block drivers are always encapsulated in a 'compound' driver, which is + * what will be returned here. In other words, you should will not + * get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}. + * + * @param world the world containing the block. + * @param pos the position of the block. + * @return a driver for the block, or null if there is none. + * @deprecated Use {@link #driverFor(World, BlockPos, EnumFacing)}, + * passing null if the side is to be ignored. + */ + @Deprecated // TODO Remove in OC 1.7 + public static Block driverFor(World world, BlockPos pos) { + if (API.driver != null) + return API.driver.driverFor(world, pos); + return null; + } + /** * Looks up a driver for the block at the specified position in the * specified world. @@ -90,9 +165,9 @@ public final class Driver { * @param pos the position of the block. * @return a driver for the block, or null if there is none. */ - public static Block driverFor(World world, BlockPos pos) { + public static SidedBlock driverFor(World world, BlockPos pos, EnumFacing side) { if (API.driver != null) - return API.driver.driverFor(world, pos); + return API.driver.driverFor(world, pos, side); return null; } @@ -132,12 +207,47 @@ public final class Driver { return null; } + /** + * Looks up the environment associated with the specified item stack. + *

+ * This will use the registered {@link EnvironmentProvider}s to find + * an environment type for the specified item stack. If none can be + * found, returns null. + * + * @param stack the item stack to get the environment type for. + * @return the type of environment associated with the stack, or null. + */ + public static Class environmentFor(ItemStack stack) { + if (API.driver != null) + return API.driver.environmentFor(stack); + return null; + } + + /** + * Get an inventory implementation providing access to an item inventory. + *

+ * This will use the registered {@link InventoryProvider}s to find an + * inventory implementation providing access to the specified stack. + * If none can be found, returns null. + *

+ * Note that the specified player may be null, but will usually + * be the fake player of the agent making use of this API. + * + * @param stack the item stack to get the inventory access for. + * @param player the player holding the item. May be null. + * @return the inventory implementation interfacing the stack, or null. + */ + public static IInventory inventoryFor(ItemStack stack, EntityPlayer player) { + if (API.driver != null) + return API.driver.inventoryFor(stack, player); + return null; + } + /** * Get a list of all registered block drivers. *

* This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. + * customized logic. *

* The returned collection is read-only. * @@ -153,8 +263,7 @@ public final class Driver { * Get a list of all registered item drivers. *

* This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. + * customized logic. *

* The returned collection is read-only. * diff --git a/src/api/java/li/cil/oc/api/FileSystem.java b/src/api/java/li/cil/oc/api/FileSystem.java old mode 100644 new mode 100755 index 2d457c921..49557d0cf --- a/src/api/java/li/cil/oc/api/FileSystem.java +++ b/src/api/java/li/cil/oc/api/FileSystem.java @@ -1,6 +1,6 @@ package li.cil.oc.api; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import li.cil.oc.api.fs.Label; import li.cil.oc.api.network.ManagedEnvironment; diff --git a/src/api/java/li/cil/oc/api/IMC.java b/src/api/java/li/cil/oc/api/IMC.java old mode 100644 new mode 100755 index e4785ed7c..e1632093b --- a/src/api/java/li/cil/oc/api/IMC.java +++ b/src/api/java/li/cil/oc/api/IMC.java @@ -4,7 +4,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.fml.common.event.FMLInterModComms; - import org.apache.commons.lang3.tuple.Pair; /** diff --git a/src/api/java/li/cil/oc/api/Items.java b/src/api/java/li/cil/oc/api/Items.java old mode 100644 new mode 100755 index 93e4b2615..81a10bc2f --- a/src/api/java/li/cil/oc/api/Items.java +++ b/src/api/java/li/cil/oc/api/Items.java @@ -1,11 +1,11 @@ package li.cil.oc.api; -import java.util.concurrent.Callable; - import li.cil.oc.api.detail.ItemInfo; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; +import java.util.concurrent.Callable; + /** * Access to item definitions for all blocks and items provided by * OpenComputers. diff --git a/src/api/java/li/cil/oc/api/Machine.java b/src/api/java/li/cil/oc/api/Machine.java old mode 100644 new mode 100755 index 6af312f43..ddb412d59 --- a/src/api/java/li/cil/oc/api/Machine.java +++ b/src/api/java/li/cil/oc/api/Machine.java @@ -1,11 +1,11 @@ package li.cil.oc.api; -import java.util.Collection; -import java.util.Collections; - import li.cil.oc.api.machine.Architecture; import li.cil.oc.api.machine.MachineHost; +import java.util.Collection; +import java.util.Collections; + /** * This API is intended for people who would like to implement custom computer * blocks or anything else hosting a computer. @@ -45,6 +45,18 @@ public final class Machine { return Collections.emptyList(); } + /** + * Get the name of the specified architecture. + * + * @param architecture the architecture to get the name for. + * @return the name of the specified architecture. + */ + public static String getArchitectureName(Class architecture) { + if (API.machine != null) + return API.machine.getArchitectureName(architecture); + return null; + } + /** * Creates a new machine for the specified host. *

diff --git a/src/api/java/li/cil/oc/api/Manual.java b/src/api/java/li/cil/oc/api/Manual.java old mode 100644 new mode 100755 index 733f30bb6..5096202c7 --- a/src/api/java/li/cil/oc/api/Manual.java +++ b/src/api/java/li/cil/oc/api/Manual.java @@ -7,7 +7,7 @@ import li.cil.oc.api.manual.PathProvider; import li.cil.oc.api.manual.TabIconRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/li/cil/oc/api/Nanomachines.java b/src/api/java/li/cil/oc/api/Nanomachines.java old mode 100644 new mode 100755 index a0ab61e99..afa239b8d --- a/src/api/java/li/cil/oc/api/Nanomachines.java +++ b/src/api/java/li/cil/oc/api/Nanomachines.java @@ -1,11 +1,11 @@ package li.cil.oc.api; -import java.util.Collections; - import li.cil.oc.api.nanomachines.BehaviorProvider; import li.cil.oc.api.nanomachines.Controller; import net.minecraft.entity.player.EntityPlayer; +import java.util.Collections; + /** * This API allows interfacing with nanomachines. *

diff --git a/src/api/java/li/cil/oc/api/Network.java b/src/api/java/li/cil/oc/api/Network.java old mode 100644 new mode 100755 index a159f39e8..5db80f8e5 --- a/src/api/java/li/cil/oc/api/Network.java +++ b/src/api/java/li/cil/oc/api/Network.java @@ -8,6 +8,8 @@ import li.cil.oc.api.network.Visibility; import li.cil.oc.api.network.WirelessEndpoint; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; /** * This class provides factories for networks and nodes. @@ -29,8 +31,7 @@ import net.minecraft.tileentity.TileEntity; */ public final class Network { /** - * Tries to add a tile entity's network node(s) at the specified coordinates - * to adjacent networks. + * Convenience overload for {@link #joinOrCreateNetwork(IBlockAccess, BlockPos)}. *

* If the tile entity implements {@link Environment} its one node will be * connected to any existing adjacent tile entity nodes. If none exist a @@ -48,6 +49,18 @@ public final class Network { API.network.joinOrCreateNetwork(tileEntity); } + /** + * Tries to add network node(s) at the specified coordinates to adjacent + * networks. + * + * @param world the world containing the location to connect. + * @param pos the position at which to update the network. + */ + public static void joinOrCreateNetwork(final IBlockAccess world, final BlockPos pos) { + if (API.network != null) + API.network.joinOrCreateNetwork(world, pos); + } + /** * Creates a new network with the specified node as its initial node. *

diff --git a/src/api/java/li/cil/oc/api/Persistable.java b/src/api/java/li/cil/oc/api/Persistable.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/README.md b/src/api/java/li/cil/oc/api/README.md old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/component/Keyboard.java b/src/api/java/li/cil/oc/api/component/Keyboard.java old mode 100644 new mode 100755 index a0407be92..d679c03d5 --- a/src/api/java/li/cil/oc/api/component/Keyboard.java +++ b/src/api/java/li/cil/oc/api/component/Keyboard.java @@ -1,47 +1,17 @@ package li.cil.oc.api.component; -import li.cil.oc.api.Persistable; -import li.cil.oc.api.network.Environment; -import net.minecraft.entity.player.EntityPlayer; - /** - * This interface is implemented by the keyboard component, to allow more - * flexible use of it. - *

- * You can obtain an instance of the keyboard component via the item driver - * of the keyboard block, for example: - *

- *     final ItemStack stack = li.cil.oc.api.Items.get("keyboard").createItemStack(1);
- *     final Keyboard keyboard = (Keyboard) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
- * 
+ * Not meant to be implemented. + * + * @deprecated Use li.cil.oc.api.internal.Keyboard instead. */ -public interface Keyboard extends Environment, Persistable { +@Deprecated +public interface Keyboard extends li.cil.oc.api.internal.Keyboard { /** - * Sets a custom usability override. - *

- * Instead of the default check, which is based on the component's owner's - * position, the specified callback will be queried for usability checks - * instead. - *

- * Pass null here to unset a previously set override. + * Not meant to be implemented. * - * @param callback the usability checker to use. + * @deprecated Use li.cil.oc.api.internal.Keyboard.UsabilityChecker instead. */ - void setUsableOverride(UsabilityChecker callback); - - /** - * Contract interface that has to implemented for usability check overrides. - * - * @see #setUsableOverride(li.cil.oc.api.component.Keyboard.UsabilityChecker) - */ - interface UsabilityChecker { - /** - * Whether the specified keyboard is usable by the specified player. - * - * @param keyboard the keyboard to check for. - * @param player the player to check for. - * @return whether the keyboard is usable by the player. - */ - boolean isUsableByPlayer(Keyboard keyboard, EntityPlayer player); + interface UsabilityChecker extends li.cil.oc.api.internal.Keyboard.UsabilityChecker { } } diff --git a/src/api/java/li/cil/oc/api/component/RackBusConnectable.java b/src/api/java/li/cil/oc/api/component/RackBusConnectable.java new file mode 100755 index 000000000..352c9ee3d --- /dev/null +++ b/src/api/java/li/cil/oc/api/component/RackBusConnectable.java @@ -0,0 +1,25 @@ +package li.cil.oc.api.component; + +import li.cil.oc.api.network.Environment; +import li.cil.oc.api.network.Packet; + +/** + * Use this interface on environments that may receive network messages from a + * bus in a rack. + *

+ * Specifically, this is checked on environments in servers installed in racks. + * The server will collect the first three environments of components in it + * implement this interface, and provide their nodes to the rack via the + * {@link RackMountable#getConnectableAt(int)} method. This in turn will allow them + * to be 'connected' to the buses, so that they can receive network messages + * arriving on the respective side of the rack. + */ +public interface RackBusConnectable extends Environment { + /** + * Called to inject a network packet that arrived on the bus this + * environment is connected to in the hosting rack. + * + * @param packet the packet to handle. + */ + void receivePacket(Packet packet); +} diff --git a/src/api/java/li/cil/oc/api/component/RackMountable.java b/src/api/java/li/cil/oc/api/component/RackMountable.java new file mode 100755 index 000000000..efe405744 --- /dev/null +++ b/src/api/java/li/cil/oc/api/component/RackMountable.java @@ -0,0 +1,74 @@ +package li.cil.oc.api.component; + +import li.cil.oc.api.network.Analyzable; +import li.cil.oc.api.network.ComponentHost; +import li.cil.oc.api.network.ManagedEnvironment; +import li.cil.oc.api.util.StateAware; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumHand; + +/** + * Use this interface on environments provided by drivers for items that can + * be installed in a server rack. + *

+ * The provided environment can be used for updating the part in its installed + * state. The nodes provided by the getters in this interface are used to + * access nodes provided by the environment (e.g. multiple "interfacing" + * nodes for a switch), and connect the nodes to the corresponding buses as + * defined by the rack's configuration. + *

+ * Note: mountables may implement the {@link ComponentHost} interface and + * {@link IInventory}. In this case, if they contain a redstone card and have + * a state of State.IsWorking the rack will visually connect to + * redstone, for example. Same goes for abstract bus cards, and potentially + * more things in the future. + *

+ * Furthermore, implementing {@link Analyzable} will allow specifying more + * information when the analyzer is used on the mountable while it's in a rack. + */ +public interface RackMountable extends ManagedEnvironment, StateAware { + /** + * Returns some data describing the state of the mountable. + *

+ * This is called on the server side to synchronize data to the client after + * the rack's {@link li.cil.oc.api.internal.Rack#markChanged(int)} + * method has been called for the slot this mountable is in. It will there + * be passed on with the render event to allow state specific rendering of + * the mountable in the rack. + * + * @return the data to synchronize to the clients. + */ + NBTTagCompound getData(); + + /** + * The number of connectables exposed by the environment. + *

+ * Node that only the first three will ever be used. + */ + int getConnectableCount(); + + /** + * Returns the node at the specified index. + */ + RackBusConnectable getConnectableAt(int index); + + /** + * This gets called when the server rack is activated by a player, and + * hits the space occupied by this mountable. + *

+ * As per usual, keep in mind that the hit coordinates are comparatively + * imprecise on the server side, since they'll have been sent in a + * pointlessly compressed fashion (because MC is a dummy like that). + * + * @param player the player activating the mountable. + * @param hand the hand the player used. + * @param heldItem the item held in that hand. + * @param hitX the relative x coordinate of the activation on the mountable. + * @param hitY the relative y coordinate of the activation on the mountable. + * @return whether the activation was handled (e.g. GUI opened). + */ + boolean onActivate(EntityPlayer player, EnumHand hand, ItemStack heldItem, float hitX, float hitY); +} diff --git a/src/api/java/li/cil/oc/api/component/TextBuffer.java b/src/api/java/li/cil/oc/api/component/TextBuffer.java old mode 100644 new mode 100755 index 45efcd0d2..a997a00ba --- a/src/api/java/li/cil/oc/api/component/TextBuffer.java +++ b/src/api/java/li/cil/oc/api/component/TextBuffer.java @@ -7,576 +7,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; /** - * This interface implements functionality for displaying and manipulating - * text, like screens and robots. An implementation can be obtained via the - * screens' item driver. - *

- * This allows re-using the built-in screen logic in third-party code without - * access to the internals of OC. - *

- * To get an instance of the buffer component, use its item driver, e.g.: - *

- *     final ItemStack stack = li.cil.oc.api.Items.get("screen1").createItemStack(1);
- *     final TextBuffer buffer = (TextBuffer) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
- * 
- */ -public interface TextBuffer extends ManagedEnvironment, Persistable { - /** - * Controls how much energy the buffer will consume per tick. - *

- * This is not necessarily the actual amount consumed per tick, - * instead it is a base value that cost is based on, incorporating a few - * other factors. This is the cost a tier one screen will consume if every - * character is lit (non-black). Larger buffers (i.e. buffers with a higher - * maximum resolution) cost proportionally more. - *

- * Note that this amount of energy is not necessarily subtracted each tick, - * instead every n ticks, n times the amount of energy it costs to run the - * buffer will be consumed, where n is configurable in the OC config. - *

- * This defaults to OC's built-in default value. + * Not meant to be implemented. * - * @param value the base energy cost per tick. - * @see #getEnergyCostPerTick() + * @deprecated Use li.cil.oc.api.internal.TextBuffer instead. */ - void setEnergyCostPerTick(double value); - - /** - * Get the energy cost per tick. - * - * @return the base energy cost per tick. - * @see #setEnergyCostPerTick(double) - */ - double getEnergyCostPerTick(); - - /** - * Set whether the buffer is powered on. - *

- * For example, screens can be powered on and off by sending a redstone - * pulse into them, in addition to their component API. - * - * @param value whether the buffer should be on or not. - * @see #getPowerState() - */ - void setPowerState(boolean value); - - /** - * Get the current power state. - * - * @return whether the buffer is powered on. - * @see #setPowerState(boolean) - */ - boolean getPowerState(); - - /** - * Sets the maximum resolution supported by this buffer. - * - * @param width the maximum horizontal resolution, in characters. - * @param height the maximum vertical resolution, in characters. - */ - void setMaximumResolution(int width, int height); - - /** - * Get the maximum horizontal size of the buffer. - */ - int getMaximumWidth(); - - /** - * Get the maximum vertical size of the buffer. - */ - int getMaximumHeight(); - - /** - * Set the 'aspect ratio' of the buffer. - *

- * Not to be confused with the maximum resolution of the buffer, this - * refers to the 'physical' size of the buffer's container. For multi- - * block screens, for example, this is the number of horizontal and - * vertical blocks. - * - * @param width the horizontal size of the physical representation. - * @param height the vertical size of the physical representation. - */ - void setAspectRatio(double width, double height); - - /** - * Get the aspect ratio of the buffer. - *

- * Note that this is in fact width / height. - * - * @see #setAspectRatio(double, double) - */ - double getAspectRatio(); - - /** - * Set the buffer's active resolution. - * - * @param width the horizontal resolution. - * @param height the vertical resolution. - * @return true if the resolution changed. - */ - boolean setResolution(int width, int height); - - /** - * Get the current horizontal resolution. - * - * @see #setResolution(int, int) - */ - int getWidth(); - - /** - * Get the current vertical resolution. - * - * @see #setResolution(int, int) - */ - int getHeight(); - - /** - * Sets the maximum color depth supported by this buffer. - *

- * Note that this is the maximum supported depth, lower depths - * will be supported, too. So when setting this to four bit, one bit will - * be supported, too. When setting this to eight bit, four and one bit - * will be supported, also. - * - * @param depth the maximum color depth of the buffer. - */ - void setMaximumColorDepth(ColorDepth depth); - - /** - * Get the maximum color depth supported. - */ - ColorDepth getMaximumColorDepth(); - - /** - * Set the active color depth for this buffer. - * - * @param depth the new color depth. - * @return true if the color depth changed. - */ - boolean setColorDepth(ColorDepth depth); - - /** - * Get the active color depth of this buffer. - */ - ColorDepth getColorDepth(); - - /** - * Set the color of the active color palette at the specified index. - *

- * This will error if the current depth does not have a palette (one bit). - * - * @param index the index at which to set the color. - * @param color the color to set for the specified index. - */ - void setPaletteColor(int index, int color); - - /** - * Get the color in the active color palette at the specified index. - *

- * This will error if the current depth does not have a palette (one bit). - * - * @param index the index at which to get the color. - * @return the color in the active palette at the specified index. - */ - int getPaletteColor(int index); - - /** - * Set the active foreground color, not using a palette. - * - * @param color the new foreground color. - * @see #setForegroundColor(int, boolean) - */ - void setForegroundColor(int color); - - /** - * Set the active foreground color. - *

- * If the value is not from the palette, the actually stored value may - * differ from the specified one, as it is converted to the buffer's - * current color depth. - *

- * For palette-only color formats (four bit) the best fit from the palette - * is chosen, if the value is not from the palette. - * - * @param color the color or palette index. - * @param isFromPalette trueif color specifies a palette index. - */ - void setForegroundColor(int color, boolean isFromPalette); - - /** - * The active foreground color. - */ - int getForegroundColor(); - - /** - * true if the foreground color is from the color palette, meaning - * the value returned from {@link #getForegroundColor()} is the color - * palette index. - */ - boolean isForegroundFromPalette(); - - /** - * Set the active background color, not using a palette. - * - * @param color the new background color. - * @see #setBackgroundColor(int, boolean) - */ - void setBackgroundColor(int color); - - /** - * Set the active background color. - *

- * If the value is not from the palette, the actually stored value may - * differ from the specified one, as it is converted to the buffer's - * current color depth. - *

- * For palette-only color formats (four bit) the best fit from the palette - * is chosen, if the value is not from the palette. - * - * @param color the color or palette index. - * @param isFromPalette trueif color specifies a palette index. - */ - void setBackgroundColor(int color, boolean isFromPalette); - - /** - * The active background color. - */ - int getBackgroundColor(); - - /** - * true if the background color is from the color palette, meaning - * the value returned from {@link #getBackgroundColor()} is the color - * palette index. - */ - boolean isBackgroundFromPalette(); - - /** - * Copy a portion of the text buffer. - *

- * This will copy the area's text and colors. - * - * @param column the starting horizontal index of the area to copy. - * @param row the starting vertical index of the area to copy. - * @param width the width of the area to copy. - * @param height the height of the area to copy. - * @param horizontalTranslation the horizontal offset, relative to the starting column to copy the are to. - * @param verticalTranslation the vertical offset, relative to the starting row to copy the are to. - */ - void copy(int column, int row, int width, int height, int horizontalTranslation, int verticalTranslation); - - /** - * Fill a portion of the text buffer. - *

- * This will set the area's colors to the currently active ones. - * - * @param column the starting horizontal index of the area to fill. - * @param row the starting vertical index of the area to fill. - * @param width the width of the area to fill. - * @param height the height of the area to fill. - * @param value the character to fill the area with. - */ - void fill(int column, int row, int width, int height, char value); - - /** - * Write a string into the text buffer. - *

- * This will apply the currently active colors to the changed area. - * - * @param column the starting horizontal index to write at. - * @param row the starting vertical index to write at. - * @param value the string to write. - * @param vertical true if the string should be written vertically instead of horizontally. - */ - void set(int column, int row, String value, boolean vertical); - - /** - * Get the character in the text buffer at the specified location. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the character at that index. - */ - char get(int column, int row); - - /** - * Get the foreground color of the text buffer at the specified location. - *

- * Important: this may be a palette index. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the foreground color at that index. - */ - int getForegroundColor(int column, int row); - - /** - * Whether the foreground color of the text buffer at the specified - * location if from the color palette. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return whether the foreground at that index is from the palette. - */ - boolean isForegroundFromPalette(int column, int row); - - /** - * Get the background color of the text buffer at the specified location. - *

- * Important: this may be a palette index. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return the background color at that index. - */ - int getBackgroundColor(int column, int row); - - /** - * Whether the background color of the text buffer at the specified - * location if from the color palette. - * - * @param column the horizontal index. - * @param row the vertical index. - * @return whether the background at that index is from the palette. - */ - boolean isBackgroundFromPalette(int column, int row); - - /** - * Overwrites a portion of the text in raw mode. - *

- * This will copy the given char array into the buffer, starting at the - * specified column and row. The array is expected to be indexed row- - * first, i.e. the first dimension is the vertical axis, the second - * the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param text the text to write. - */ - void rawSetText(int column, int row, char[][] text); - - /** - * Overwrites a portion of the foreground color information in raw mode. - *

- * This will convert the specified RGB data (in 0xRRGGBB format) - * to the internal, packed representation and copy it into the buffer, - * starting at the specified column and row. The array is expected to be - * indexed row-first, i.e. the first dimension is the vertical axis, the - * second the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param color the foreground color data to write. - */ - void rawSetForeground(int column, int row, int[][] color); - - /** - * Overwrites a portion of the background color information in raw mode. - *

- * This will convert the specified RGB data (in 0xRRGGBB format) - * to the internal, packed representation and copy it into the buffer, - * starting at the specified column and row. The array is expected to be - * indexed row-first, i.e. the first dimension is the vertical axis, the - * second the horizontal. - *

- * Important: this performs no checks as to whether something - * actually changed. It will always send the changed patch to clients. - * It will also not crop the specified array to the actually used range. - * In other words, this is not intended to be exposed as-is to user code, - * it should always be called with validated, and, as necessary, cropped - * values. - * - * @param column the horizontal index. - * @param row the vertical index. - * @param color the background color data to write. - */ - void rawSetBackground(int column, int row, int[][] color); - - // ----------------------------------------------------------------------- // - - /** - * Renders the text displayed on the buffer. - *

- * You are responsible for setting up the actual context and applying any - * transformations necessary to properly position and scale the text before - * calling this. The text should be rendered on a black background. - *

- * You can use this to either render the text in a GUI or in the world. - * - * @return true if the displayed content changed since the last - * call to this method. - */ - @SideOnly(Side.CLIENT) - boolean renderText(); - - /** - * The natural width of the rendered text. - *

- * This is the width of the complete text buffer, in pixels. In other - * words, this is the width of the buffer in chars times the actual width - * of a single char in pixels. - * - * @return the total width of the rendered buffer, in pixels. - */ - @SideOnly(Side.CLIENT) - int renderWidth(); - - /** - * The natural height of the rendered text. - *

- * This is the height of the complete text buffer, in pixels. In other - * words, this is the height of the buffer in chars times the actual height - * of a single char in pixels. - * - * @return the total height of the rendered buffer, in pixels. - */ - @SideOnly(Side.CLIENT) - int renderHeight(); - - /** - * Set whether the contents of the buffer should currently be rendered. - *

- * Note that this is automatically overwritten when the buffer's power - * state changes, i.e. when it runs out of power or gets back power. - * - * @param enabled whether the text buffer should be rendered. - */ - @SideOnly(Side.CLIENT) - void setRenderingEnabled(boolean enabled); - - /** - * Gets whether the contents of the buffer should currently be rendered. - * - * @see #setRenderingEnabled(boolean) - */ - @SideOnly(Side.CLIENT) - boolean isRenderingEnabled(); - - // ----------------------------------------------------------------------- // - - /** - * Signals a key down event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param character the character of the pressed key. - * @param code the key code of the pressed key. - * @param player the player that pressed the key. Pass null on the client side. - */ - void keyDown(char character, int code, EntityPlayer player); - - /** - * Signals a key up event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param character the character of the released key. - * @param code the key code of the released key. - * @param player the player that released the key. Pass null on the client side. - */ - void keyUp(char character, int code, EntityPlayer player); - - /** - * Signals a clipboard paste event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will trigger a message that will be picked up by - * keyboards, which will then cause a signal in attached machines. - * - * @param value the text that was pasted. - * @param player the player that pasted the text. Pass null on the client side. - */ - void clipboard(String value, EntityPlayer player); - - /** - * Signals a mouse button down event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that was pressed. - * @param player the player that pressed the mouse button. Pass null on the client side. - */ - void mouseDown(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse drag event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that is pressed. - * @param player the player that moved the mouse. Pass null on the client side. - */ - void mouseDrag(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse button release event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param button the button of the mouse that was released. - * @param player the player that released the mouse button. Pass null on the client side. - */ - void mouseUp(double x, double y, int button, EntityPlayer player); - - /** - * Signals a mouse wheel scroll event for the buffer. - *

- * On the client side this causes a packet to be sent to the server. On the - * server side this will cause a signal in attached machines. - * - * @param x the horizontal coordinate of the mouse, in characters. - * @param y the vertical coordinate of the mouse, in characters. - * @param delta indicates the direction of the mouse scroll. - * @param player the player that scrolled the mouse wheel. Pass null on the client side. - */ - void mouseScroll(double x, double y, int delta, EntityPlayer player); - - // ----------------------------------------------------------------------- // - - /** - * Used when setting a buffer's maximum color depth. - */ - enum ColorDepth { - /** - * Monochrome color, black and white. - */ - OneBit, - - /** - * 16 color palette, defaults to Minecraft colors. - */ - FourBit, - - /** - * 240 colors, 16 color palette, defaults to grayscale. - */ - EightBit - } +@Deprecated +public interface TextBuffer extends li.cil.oc.api.internal.TextBuffer { } diff --git a/src/api/java/li/cil/oc/api/component/package-info.java b/src/api/java/li/cil/oc/api/component/package-info.java old mode 100644 new mode 100755 index 831cef78e..61c8d8958 --- a/src/api/java/li/cil/oc/api/component/package-info.java +++ b/src/api/java/li/cil/oc/api/component/package-info.java @@ -1,9 +1,8 @@ /** - * This package provides interfaces to allow interacting with some components. + * This package contains interfaces to be implemented on components. *

- * These interfaces allow more specific interaction with some of OpenComputers' - * components, which would otherwise require reflection or linking against the - * mod itself. + * This will allow OpenComputers to provide some more advanced integration + * with your components. */ @net.minecraftforge.fml.common.API( owner = API.ID_OWNER, @@ -11,4 +10,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.component; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/detail/Builder.java b/src/api/java/li/cil/oc/api/detail/Builder.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/detail/DriverAPI.java b/src/api/java/li/cil/oc/api/detail/DriverAPI.java old mode 100644 new mode 100755 index b3cc4d530..1bdab9120 --- a/src/api/java/li/cil/oc/api/detail/DriverAPI.java +++ b/src/api/java/li/cil/oc/api/detail/DriverAPI.java @@ -1,15 +1,21 @@ package li.cil.oc.api.detail; -import java.util.Collection; - import li.cil.oc.api.driver.Block; import li.cil.oc.api.driver.Converter; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.driver.EnvironmentProvider; +import li.cil.oc.api.driver.InventoryProvider; import li.cil.oc.api.driver.Item; +import li.cil.oc.api.driver.SidedBlock; +import li.cil.oc.api.network.EnvironmentHost; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumFacing; import net.minecraft.world.World; +import java.util.Collection; + public interface DriverAPI { /** * Registers a new driver for a block component. @@ -22,9 +28,25 @@ public interface DriverAPI { * phases. * * @param driver the driver for a block component. + * @deprecated Use {@link SidedBlock} instead. */ + @Deprecated // TODO Remove in OC 1.7 void add(Block driver); + /** + * Registers a new side-aware block driver. + *

+ * Whenever the neighboring blocks of an Adapter block change, it checks if + * there exists a driver for the changed block, and if it is configured to + * interface that block type connects it to the component network. + *

+ * This must be called in the init phase, not the pre- or post-init + * phases. + * + * @param driver the driver to register. + */ + void add(SidedBlock driver); + /** * Registers a new driver for an item component. *

@@ -51,6 +73,28 @@ public interface DriverAPI { */ void add(Converter converter); + /** + * Register a new environment provider. + *

+ * Environment providers are used for mapping item stacks to the type of + * environment that will be created by the stack, either by it being + * placed in the world and acting as a block component, or by being + * placed in an component inventory and created by the item's driver. + * + * @param provider the provider to register. + */ + void add(EnvironmentProvider provider); + + /** + * Register a new inventory provider. + *

+ * Inventory providers are used for accessing item inventories using + * the inventory controller upgrade, for example. + * + * @param provider the provider to register. + */ + void add(InventoryProvider provider); + /** * Looks up a driver for the block at the specified position in the * specified world. @@ -63,9 +107,28 @@ public interface DriverAPI { * @param world the world containing the block. * @param pos the position of the block. * @return a driver for the block, or null if there is none. + * @deprecated Use {@link #driverFor(World, BlockPos, EnumFacing)}, + * passing null if the side is to be ignored. */ + @Deprecated // TODO Remove in OC 1.7 Block driverFor(World world, BlockPos pos); + /** + * Looks up a driver for the block at the specified position in the + * specified world. + *

+ * Note that several drivers for a single block can exist. Because of this + * block drivers are always encapsulated in a 'compound' driver, which is + * what will be returned here. In other words, you should will not + * get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}. + * + * @param world the world containing the block. + * @param pos the position of the block. + * @param side the side of the block. + * @return a driver for the block, or null if there is none. + */ + SidedBlock driverFor(World world, BlockPos pos, EnumFacing side); + /** * Looks up a driver for the specified item stack. *

@@ -94,12 +157,41 @@ public interface DriverAPI { */ Item driverFor(ItemStack stack); + /** + * Looks up the environment associated with the specified item stack. + *

+ * This will use the registered {@link EnvironmentProvider}s to find + * an environment type for the specified item stack. If none can be + * found, returns null. + * + * @param stack the item stack to get the environment type for. + * @return the type of environment associated with the stack, or null. + */ + Class environmentFor(ItemStack stack); + + /** + * Get an inventory implementation providing access to an item inventory. + *

+ * This will use the registered {@link InventoryProvider}s to find an + * inventory implementation providing access to the specified stack. + * If none can be found, returns null. + *

+ * Note that the specified player may be null, but will usually + * be the fake player of the agent making use of this API. + * + * @param stack the item stack to get the inventory access for. + * @param player the player holding the item. May be null. + * @return the inventory implementation interfacing the stack, or null. + */ + IInventory inventoryFor(ItemStack stack, EntityPlayer player); + /** * Get a list of all registered block drivers. *

* This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. + * customized logic. + *

+ * The returned collection is read-only. * * @return the list of all registered block drivers. */ @@ -109,8 +201,9 @@ public interface DriverAPI { * Get a list of all registered item drivers. *

* This is intended to allow checking for particular drivers using more - * customized logic, and in particular to check for drivers with the - * {@link li.cil.oc.api.driver.EnvironmentAware} interface. + * customized logic. + *

+ * The returned collection is read-only. * * @return the list of all registered item drivers. */ diff --git a/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java b/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java old mode 100644 new mode 100755 index b413adc86..fa58c3b1a --- a/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java +++ b/src/api/java/li/cil/oc/api/detail/FileSystemAPI.java @@ -1,6 +1,6 @@ package li.cil.oc.api.detail; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import li.cil.oc.api.fs.FileSystem; import li.cil.oc.api.fs.Label; import li.cil.oc.api.network.ManagedEnvironment; diff --git a/src/api/java/li/cil/oc/api/detail/ItemAPI.java b/src/api/java/li/cil/oc/api/detail/ItemAPI.java old mode 100644 new mode 100755 index 089736215..358472c48 --- a/src/api/java/li/cil/oc/api/detail/ItemAPI.java +++ b/src/api/java/li/cil/oc/api/detail/ItemAPI.java @@ -1,11 +1,11 @@ package li.cil.oc.api.detail; -import java.util.concurrent.Callable; - import li.cil.oc.api.FileSystem; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.ItemStack; +import java.util.concurrent.Callable; + public interface ItemAPI { /** * Get a descriptor object for the block or item with the specified name. diff --git a/src/api/java/li/cil/oc/api/detail/ItemInfo.java b/src/api/java/li/cil/oc/api/detail/ItemInfo.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/detail/MachineAPI.java b/src/api/java/li/cil/oc/api/detail/MachineAPI.java old mode 100644 new mode 100755 index c543662c9..458f7cd03 --- a/src/api/java/li/cil/oc/api/detail/MachineAPI.java +++ b/src/api/java/li/cil/oc/api/detail/MachineAPI.java @@ -1,11 +1,11 @@ package li.cil.oc.api.detail; -import java.util.Collection; - import li.cil.oc.api.machine.Architecture; import li.cil.oc.api.machine.Machine; import li.cil.oc.api.machine.MachineHost; +import java.util.Collection; + public interface MachineAPI { /** * Register an architecture that can be used to create new machines. @@ -29,6 +29,14 @@ public interface MachineAPI { */ Collection> architectures(); + /** + * Get the name of the specified architecture. + * + * @param architecture the architecture to get the name for. + * @return the name of the specified architecture. + */ + String getArchitectureName(Class architecture); + /** * Creates a new machine for the specified host. *

diff --git a/src/api/java/li/cil/oc/api/detail/ManualAPI.java b/src/api/java/li/cil/oc/api/detail/ManualAPI.java old mode 100644 new mode 100755 index a53c84a20..605955472 --- a/src/api/java/li/cil/oc/api/detail/ManualAPI.java +++ b/src/api/java/li/cil/oc/api/detail/ManualAPI.java @@ -7,7 +7,7 @@ import li.cil.oc.api.manual.PathProvider; import li.cil.oc.api.manual.TabIconRenderer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface ManualAPI { diff --git a/src/api/java/li/cil/oc/api/detail/NanomachinesAPI.java b/src/api/java/li/cil/oc/api/detail/NanomachinesAPI.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/detail/NetworkAPI.java b/src/api/java/li/cil/oc/api/detail/NetworkAPI.java old mode 100644 new mode 100755 index 444a12927..967f4f1fd --- a/src/api/java/li/cil/oc/api/detail/NetworkAPI.java +++ b/src/api/java/li/cil/oc/api/detail/NetworkAPI.java @@ -7,11 +7,12 @@ import li.cil.oc.api.network.Visibility; import li.cil.oc.api.network.WirelessEndpoint; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; public interface NetworkAPI { /** - * Tries to add a tile entity's network node(s) at the specified coordinates - * to adjacent networks. + * Convenience overload for {@link #joinOrCreateNetwork(IBlockAccess, BlockPos)}. *

* If the tile entity implements {@link Environment} its one node will be * connected to any existing adjacent tile entity nodes. If none exist a @@ -26,6 +27,15 @@ public interface NetworkAPI { */ void joinOrCreateNetwork(TileEntity tileEntity); + /** + * Tries to add network node(s) at the specified coordinates to adjacent + * networks. + * + * @param world the world containing the location to connect. + * @param pos the position at which to update the network. + */ + void joinOrCreateNetwork(IBlockAccess world, BlockPos pos); + /** * Creates a new network with the specified node as its initial node. *

diff --git a/src/api/java/li/cil/oc/api/detail/package-info.java b/src/api/java/li/cil/oc/api/detail/package-info.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/driver/Block.java b/src/api/java/li/cil/oc/api/driver/Block.java old mode 100644 new mode 100755 index f9ed7c21f..c30d7d544 --- a/src/api/java/li/cil/oc/api/driver/Block.java +++ b/src/api/java/li/cil/oc/api/driver/Block.java @@ -1,7 +1,7 @@ package li.cil.oc.api.driver; import li.cil.oc.api.network.ManagedEnvironment; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** @@ -21,7 +21,11 @@ import net.minecraft.world.World; * Note that it is possible to write one driver that supports as many different * blocks as you wish. I'd recommend writing one per device (type), though, to * keep things modular. + * + * @deprecated Use {@link SidedBlock} instead, ignoring the side argument if + * the side doesn't matter. */ +@Deprecated // TODO Remove in OC 1.7 public interface Block { /** * Used to determine the block types this driver handles. diff --git a/src/api/java/li/cil/oc/api/driver/Converter.java b/src/api/java/li/cil/oc/api/driver/Converter.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java b/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java old mode 100644 new mode 100755 index 72a4c0415..10493e6cc --- a/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java +++ b/src/api/java/li/cil/oc/api/driver/EnvironmentAware.java @@ -17,7 +17,10 @@ import net.minecraft.item.ItemStack; * For block drivers there is a bit more work involved, since you have to check * if the item is the item block that corresponds to the supported block type. * This should usually not be an issue either, though. + * + * @deprecated Use an {@link EnvironmentProvider} instead. */ +@Deprecated public interface EnvironmentAware { /** * Get the type of environment that would be created for the specified diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java b/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java old mode 100644 new mode 100755 index 505068131..6597dc9d1 --- a/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java +++ b/src/api/java/li/cil/oc/api/driver/EnvironmentHost.java @@ -1,52 +1,7 @@ package li.cil.oc.api.driver; -import net.minecraft.world.World; - /** - * To be implemented by 'hosts' of components. - *

- * This is what's passed to drivers as the host when creating an environment. - * It is generally used to represent the components' location in the world. - *

- * You will only need to implement this if you intend to host components, e.g. - * by providing a custom computer case or such. In OpenComputers this interface - * is usually implemented directly by the tile entities acting as the host, so - * in most cases you should be able to cast this to TileEntity for - * more options, if necessary. + * @deprecated Use li.cil.oc.api.network.EnvironmentHost directly. */ -public interface EnvironmentHost { - /** - * The world the container lives in. - */ - World world(); - - /** - * The container's X position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 0.5. - */ - double xPosition(); - - /** - * The container's Y position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 2.5. - */ - double yPosition(); - - /** - * The container's Z position in the world. - *

- * For tile entities this is the centered position. For example, - * if the tile entity is located at (0, 2, 3) this will be 3.5. - */ - double zPosition(); - - /** - * Marks the container as "changed" so that it knows it has to be saved - * again in the next world save. - */ - void markChanged(); +public interface EnvironmentHost extends li.cil.oc.api.network.EnvironmentHost { } diff --git a/src/api/java/li/cil/oc/api/driver/EnvironmentProvider.java b/src/api/java/li/cil/oc/api/driver/EnvironmentProvider.java new file mode 100755 index 000000000..842c1b33b --- /dev/null +++ b/src/api/java/li/cil/oc/api/driver/EnvironmentProvider.java @@ -0,0 +1,29 @@ +package li.cil.oc.api.driver; + +import net.minecraft.item.ItemStack; + +/** + * Environment providers allow OpenComputers to resolve item stacks to the + * environments generated by the block or item component of the stack. + *

+ * This is mainly used in OpenComputers' NEI usage handler for displaying + * a component's API. + */ +public interface EnvironmentProvider { + /** + * Get the environment provided by the specified stack. + *

+ * For blocks this will usually be the tile entity. In particular, for + * {@link li.cil.oc.api.network.SimpleComponent}s this allows returning + * an arbitrary class type instead of an environment type, since the + * {@link li.cil.oc.api.network.Environment} interface will be injected + * by the class transformer at runtime. + *

+ * For items this will be the type of the environment returned by the + * item driver's {@link Item#createEnvironment} method. + * + * @param stack the stack to get the environment type for. + * @return the environment type for the specified stack. + */ + Class getEnvironment(ItemStack stack); +} diff --git a/src/api/java/li/cil/oc/api/driver/InventoryProvider.java b/src/api/java/li/cil/oc/api/driver/InventoryProvider.java new file mode 100755 index 000000000..4308b454a --- /dev/null +++ b/src/api/java/li/cil/oc/api/driver/InventoryProvider.java @@ -0,0 +1,42 @@ +package li.cil.oc.api.driver; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +/** + * Inventory providers are used to access contents of item inventories. + *

+ * In OpenComputers an example for this would be servers, in other mods + * this can be backpacks and the like. Inventory providers are used to + * allow agents (robots, drones) to interact with such inventories using + * the inventory controller upgrade, for example. + *

+ * Implementations returned by {@link #getInventory} should save changes + * back to the item stack when {@link IInventory#markDirty()} is called. + * Return null if the specified stack is not supported. + */ +public interface InventoryProvider { + /** + * Checks whether this provider works for the specified item stack. + * + * @param stack the item stack to check for. + * @param player the player holding the item, may be null. + * @return true if the stack is supported, false otherwise. + */ + boolean worksWith(ItemStack stack, EntityPlayer player); + + /** + * Get an inventory implementation that allows interfacing with the + * item inventory represented by the specified item stack. + *

+ * Note that the specified player may be null, but will + * usually be the fake player of the agent using the + * inventory controller upgrade to access the item inventory. + * + * @param stack the item stack to get the inventory for. + * @param player the player holding the item, may be null. + * @return the inventory representing the contents, or null. + */ + IInventory getInventory(ItemStack stack, EntityPlayer player); +} diff --git a/src/api/java/li/cil/oc/api/driver/Item.java b/src/api/java/li/cil/oc/api/driver/Item.java old mode 100644 new mode 100755 index 6ad94678e..5f95e3de3 --- a/src/api/java/li/cil/oc/api/driver/Item.java +++ b/src/api/java/li/cil/oc/api/driver/Item.java @@ -62,7 +62,7 @@ public interface Item { * @param host the host the environment will be managed by. * @return the environment for that item. */ - ManagedEnvironment createEnvironment(ItemStack stack, EnvironmentHost host); + ManagedEnvironment createEnvironment(ItemStack stack, li.cil.oc.api.network.EnvironmentHost host); /** * The slot type of the specified item this driver supports. diff --git a/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java b/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java old mode 100644 new mode 100755 index 969811f4a..3798d2c5d --- a/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java +++ b/src/api/java/li/cil/oc/api/driver/MethodWhitelist.java @@ -1,5 +1,7 @@ package li.cil.oc.api.driver; +import net.minecraft.util.math.BlockPos; + /** * This interface can be implemented by environments to enforce a method * whitelist. @@ -15,7 +17,7 @@ package li.cil.oc.api.driver; * suppress inventory functionality if your TileEntity implements IInventory. *

* To do so, implement this interface in the environment that you - * return from your driver's {@link Block#createEnvironment(net.minecraft.world.World, net.minecraft.util.BlockPos)} + * return from your driver's {@link SidedBlock#createEnvironment(net.minecraft.world.World, BlockPos, net.minecraft.util.EnumFacing)} * method, and provide the names of the allowed methods from {@link #whitelistedMethods()}. *

* Important: if multiple drivers apply to a single block that each diff --git a/src/api/java/li/cil/oc/api/driver/NamedBlock.java b/src/api/java/li/cil/oc/api/driver/NamedBlock.java old mode 100644 new mode 100755 index 44b416647..a80ee22d8 --- a/src/api/java/li/cil/oc/api/driver/NamedBlock.java +++ b/src/api/java/li/cil/oc/api/driver/NamedBlock.java @@ -1,5 +1,7 @@ package li.cil.oc.api.driver; +import net.minecraft.util.math.BlockPos; + /** * This interface can be added to environments generated by block * drivers to provide a 'preferred name' in case the driver is merged with @@ -7,7 +9,7 @@ package li.cil.oc.api.driver; *

* This was previously to be implemented on the driver itself, but that has been * deprecated. Implement it in the environment returned from the block driver's - * {@link Block#createEnvironment(net.minecraft.world.World, net.minecraft.util.BlockPos)} + * {@link SidedBlock#createEnvironment(net.minecraft.world.World, BlockPos, net.minecraft.util.EnumFacing)} * method instead. */ public interface NamedBlock { diff --git a/src/api/java/li/cil/oc/api/driver/SidedBlock.java b/src/api/java/li/cil/oc/api/driver/SidedBlock.java new file mode 100755 index 000000000..ff6d87e71 --- /dev/null +++ b/src/api/java/li/cil/oc/api/driver/SidedBlock.java @@ -0,0 +1,71 @@ +package li.cil.oc.api.driver; + +import li.cil.oc.api.network.ManagedEnvironment; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +/** + * Interface for side-aware block component drivers. + *

+ * This driver type is used for components that are blocks, i.e. that can be + * placed in the world, but cannot be modified to or don't want to have their + * {@link net.minecraft.tileentity.TileEntity} implement one of the interfaces + * for environments ({@link li.cil.oc.api.network.Environment} or + * {@link li.cil.oc.api.network.SidedEnvironment}). + *

+ * A block driver is used by Adapter blocks to check its neighbors and + * whether those neighbors should be treated as components or not. If a driver + * is present, it will be used to create a {@link ManagedEnvironment} that is + * managed by the adapter. + *

+ * Note that it is possible to write one driver that supports as many different + * blocks as you wish. I'd recommend writing one per device (type), though, to + * keep things modular. + *

+ * Note that side-aware block drivers are queried before regular block drivers, + * because they are more specific. + */ +public interface SidedBlock { + /** + * Used to determine the block types this driver handles. + *

+ * This is used to determine which driver to use for a block placed next to + * an Adapter block. Note that the return value should not change + * over time; if it does, though, an already installed component will not + * be removed, since this value is only checked when scanning blocks. You + * can force this by sending a neighbor block change notification. + *

+ * The side is relative to the block, i.e. "south" is the side of the block + * facing south. + * + * @param world the world in which the block to check lives. + * @param pos the position coordinate of the block to check. + * @param side the side of the block to check. + * @return true if the block is supported; false otherwise. + */ + boolean worksWith(World world, BlockPos pos, EnumFacing side); + + /** + * Create a new managed environment interfacing the specified block. + *

+ * This is used to connect the component to the component network when it + * is detected next to an Adapter. Components that are not part of + * the component network probably don't make much sense (can't think of any + * uses at this time), but you may still opt to not implement this - i.e. + * it is safe to return null here. + *

+ * This is expected to return a new instance each time it is + * called. The created instance's life cycle is managed by the + * Adapter block that caused its creation. + *

+ * The side is relative to the block, i.e. "south" is the side of the block + * facing south. + * + * @param world the world containing the block to get the environment for. + * @param pos the position coordinate of the block to check. + * @param side the side of the block to check. + * @return the environment for the block at that location. + */ + ManagedEnvironment createEnvironment(World world, BlockPos pos, EnumFacing side); +} \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/item/CallBudget.java b/src/api/java/li/cil/oc/api/driver/item/CallBudget.java new file mode 100755 index 000000000..e407b419c --- /dev/null +++ b/src/api/java/li/cil/oc/api/driver/item/CallBudget.java @@ -0,0 +1,30 @@ +package li.cil.oc.api.driver.item; + +import net.minecraft.item.ItemStack; + +/** + * Common functionality provided by parts that influence a machine's speed. + *

+ * By default, this is implemented by OpenComputers' {@link Processor}s and + * {@link Memory}. + *

+ * The actual call budget of a machine is set to the average of + * the specified call budget of all present components. + *

+ * A processor and memory implementation may choose not to implement this + * interface. If no component providing a call budget it present in a machine, + * a value of 1.0 will be used, i.e. the "default" speed modifier. + */ +public interface CallBudget { + /** + * The budget for direct calls provided by the specified component. + *

+ * For reference, the default budgets for OpenComputers' processors are + * 0.5, 1.0 and 1.5 for tier one, two and three, respectively. This means + * you can consider it a multiplier for the machine's operation speed. + * + * @param stack the stack representing the part to get the call budget for. + * @return the budget for direct calls per tick provided. + */ + double getCallBudget(ItemStack stack); +} diff --git a/src/api/java/li/cil/oc/api/driver/item/Chargeable.java b/src/api/java/li/cil/oc/api/driver/item/Chargeable.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/driver/item/Container.java b/src/api/java/li/cil/oc/api/driver/item/Container.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/driver/item/HostAware.java b/src/api/java/li/cil/oc/api/driver/item/HostAware.java old mode 100644 new mode 100755 index 2a47a2b15..097e46adf --- a/src/api/java/li/cil/oc/api/driver/item/HostAware.java +++ b/src/api/java/li/cil/oc/api/driver/item/HostAware.java @@ -1,6 +1,6 @@ package li.cil.oc.api.driver.item; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import li.cil.oc.api.driver.Item; import net.minecraft.item.ItemStack; diff --git a/src/api/java/li/cil/oc/api/driver/item/Inventory.java b/src/api/java/li/cil/oc/api/driver/item/Inventory.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/driver/item/Memory.java b/src/api/java/li/cil/oc/api/driver/item/Memory.java old mode 100644 new mode 100755 index 638971e40..3cd72a8f5 --- a/src/api/java/li/cil/oc/api/driver/item/Memory.java +++ b/src/api/java/li/cil/oc/api/driver/item/Memory.java @@ -17,7 +17,8 @@ public interface Memory extends Item { * This factor has to be interpreted by each individual architecture to fit * its own memory needs. The actual values returned here should roughly be * equivalent to the item's tier. For example, the built-in memory modules - * provide 1 for tier one, 2 for tier 1.5, 3 for tier 2, etc. + * provide defaults of 192 for tier one, 256 for tier 1.5, 384 for tier 2, etc. + * Mind that those values may be changed in the config file. * * @param stack the item to get the provided memory for. * @return the amount of memory the specified component provides. diff --git a/src/api/java/li/cil/oc/api/driver/item/MutableProcessor.java b/src/api/java/li/cil/oc/api/driver/item/MutableProcessor.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/driver/item/Processor.java b/src/api/java/li/cil/oc/api/driver/item/Processor.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/driver/item/Slot.java b/src/api/java/li/cil/oc/api/driver/item/Slot.java old mode 100644 new mode 100755 index 3e19fc805..bc631dc51 --- a/src/api/java/li/cil/oc/api/driver/item/Slot.java +++ b/src/api/java/li/cil/oc/api/driver/item/Slot.java @@ -14,6 +14,7 @@ public final class Slot { public static final String Floppy = "floppy"; public static final String HDD = "hdd"; public static final String Memory = "memory"; + public static final String RackMountable = "rack_mountable"; public static final String Tablet = "tablet"; public static final String Upgrade = "upgrade"; diff --git a/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java b/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java old mode 100644 new mode 100755 index b3b1ad08c..87bc9f1ad --- a/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java +++ b/src/api/java/li/cil/oc/api/driver/item/UpgradeRenderer.java @@ -1,10 +1,12 @@ package li.cil.oc.api.driver.item; -import java.util.Set; - import li.cil.oc.api.event.RobotRenderEvent; import li.cil.oc.api.internal.Robot; import net.minecraft.item.ItemStack; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +import java.util.Set; /** * This interface can be implemented by items to allow custom rendering of diff --git a/src/api/java/li/cil/oc/api/driver/item/package-info.java b/src/api/java/li/cil/oc/api/driver/item/package-info.java old mode 100644 new mode 100755 index d8ba8c6ec..24a730120 --- a/src/api/java/li/cil/oc/api/driver/item/package-info.java +++ b/src/api/java/li/cil/oc/api/driver/item/package-info.java @@ -10,4 +10,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.driver.item; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/driver/package-info.java b/src/api/java/li/cil/oc/api/driver/package-info.java old mode 100644 new mode 100755 index 7416e5feb..7a3ee423c --- a/src/api/java/li/cil/oc/api/driver/package-info.java +++ b/src/api/java/li/cil/oc/api/driver/package-info.java @@ -10,4 +10,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.driver; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java b/src/api/java/li/cil/oc/api/event/FileSystemAccessEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java b/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java old mode 100644 new mode 100755 index c0571906b..1dc586556 --- a/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java +++ b/src/api/java/li/cil/oc/api/event/GeolyzerEvent.java @@ -1,13 +1,13 @@ package li.cil.oc.api.event; +import li.cil.oc.api.network.EnvironmentHost; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; + import java.util.HashMap; import java.util.Map; -import li.cil.oc.api.driver.EnvironmentHost; -import net.minecraft.util.BlockPos; -import net.minecraftforge.fml.common.eventhandler.Cancelable; -import net.minecraftforge.fml.common.eventhandler.Event; - /** * This event is fired by the geolyzer block/upgrade. *

@@ -37,18 +37,42 @@ public abstract class GeolyzerEvent extends Event { * the geolyzer. By default this will yield a (noisy) listing of the * hardness of the blocks. *

- * Note: the y coordinate is computed as geolyzer.y - 32 + data.index. + * The bounds are guaranteed to not define a volume larger than 64. + * Resulting data should be written to the {@link #data} array such that + * index = x + z*w + y*w*d, with w = maxX - minX + * and d = maxZ - minZ (h meaning height, d + * meaning depth). */ public static class Scan extends GeolyzerEvent { /** - * The relative x coordinate of the column being scanned. + * The relative minimal x coordinate of the box being scanned (inclusive). */ - public final int scanX; + public final int minX; /** - * The relative z coordinate of the column being scanned. + * The relative minimal y coordinate of the box being scanned (inclusive). */ - public final int scanZ; + public final int minY; + + /** + * The relative minimal z coordinate of the box being scanned (inclusive). + */ + public final int minZ; + + /** + * The relative maximal x coordinate of the box being scanned (inclusive). + */ + public final int maxX; + + /** + * The relative maximal y coordinate of the box being scanned (inclusive). + */ + public final int maxY; + + /** + * The relative maximal z coordinate of the box being scanned (inclusive). + */ + public final int maxZ; /** * The data for the column of blocks being scanned, which is an @@ -57,10 +81,14 @@ public abstract class GeolyzerEvent extends Event { */ public final float[] data = new float[64]; - public Scan(EnvironmentHost host, Map options, int scanX, int scanZ) { + public Scan(EnvironmentHost host, Map options, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { super(host, options); - this.scanX = scanX; - this.scanZ = scanZ; + this.minX = minX; + this.minY = minY; + this.minZ = minZ; + this.maxX = maxX; + this.maxY = maxY; + this.maxZ = maxZ; } } diff --git a/src/api/java/li/cil/oc/api/event/NetworkActivityEvent.java b/src/api/java/li/cil/oc/api/event/NetworkActivityEvent.java new file mode 100755 index 000000000..918f31fe6 --- /dev/null +++ b/src/api/java/li/cil/oc/api/event/NetworkActivityEvent.java @@ -0,0 +1,158 @@ +package li.cil.oc.api.event; + +import li.cil.oc.api.network.Node; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.fml.common.eventhandler.Event; + +/** + * Events for handling network activity and representing it on the client. + *

+ * This is used to render network activity + * indicators on some containers (e.g. computer, server). + *

+ * Use this to implement rendering of disk access indicators on you own + * containers / computers / drive bays. + *

+ * Canceling this event is provided to allow registering higher priority + * event handlers that override default behavior. + */ +public class NetworkActivityEvent extends Event { + protected World world; + + protected double x; + + protected double y; + + protected double z; + + protected TileEntity tileEntity; + + protected NBTTagCompound data; + + /** + * Constructor for tile entity hosted network cards. + * + * @param tileEntity the tile entity hosting the network card. + * @param data the additional data. + */ + protected NetworkActivityEvent(TileEntity tileEntity, NBTTagCompound data) { + this.world = tileEntity.getWorld(); + this.x = tileEntity.getPos().getX() + 0.5; + this.y = tileEntity.getPos().getY() + 0.5; + this.z = tileEntity.getPos().getZ() + 0.5; + this.tileEntity = tileEntity; + this.data = data; + } + + /** + * Constructor for arbitrarily hosted network cards. + * + * @param world the world the network card lives in. + * @param x the x coordinate of the network card's container. + * @param y the y coordinate of the network card's container. + * @param z the z coordinate of the network card's container. + * @param data the additional data. + */ + protected NetworkActivityEvent(World world, double x, double y, double z, NBTTagCompound data) { + this.world = world; + this.x = x; + this.y = y; + this.z = z; + this.tileEntity = null; + this.data = data; + } + + /** + * The world the network card lives in. + */ + public World getWorld() { + return world; + } + + /** + * The x coordinate of the network card's container. + */ + public double getX() { + return x; + } + + /** + * The y coordinate of the network card's container. + */ + public double getY() { + return y; + } + + /** + * The z coordinate of the network card's container. + */ + public double getZ() { + return z; + } + + /** + * The tile entity hosting the network card. + *

+ * Important: this can be null, which is usually the + * case when the container is an entity or item. + */ + public TileEntity getTileEntity() { + return tileEntity; + } + + /** + * Addition custom data, this is used to transmit the number of the server + * in a server rack the network card lives in, for example. + */ + public NBTTagCompound getData() { + return data; + } + + public static final class Server extends NetworkActivityEvent { + private Node node; + + public Server(TileEntity tileEntity, Node node) { + super(tileEntity, new NBTTagCompound()); + this.node = node; + } + + public Server(World world, double x, double y, double z, Node node) { + super(world, x, y, z, new NBTTagCompound()); + this.node = node; + } + + /** + * The node of the network card that signalled activity. + */ + public Node getNode() { + return node; + } + } + + public static final class Client extends NetworkActivityEvent { + /** + * Constructor for tile entity hosted network card. + * + * @param tileEntity the tile entity hosting the network card. + * @param data the additional data. + */ + public Client(TileEntity tileEntity, NBTTagCompound data) { + super(tileEntity, data); + } + + /** + * Constructor for arbitrarily hosted network card. + * + * @param world the world the file system lives in. + * @param x the x coordinate of the network card's container. + * @param y the y coordinate of the network card's container. + * @param z the z coordinate of the network card's container. + * @param data the additional data. + */ + public Client(World world, double x, double y, double z, NBTTagCompound data) { + super(world, x, y, z, data); + } + } +} diff --git a/src/api/java/li/cil/oc/api/event/RackMountableRenderEvent.java b/src/api/java/li/cil/oc/api/event/RackMountableRenderEvent.java new file mode 100755 index 000000000..2c3a8c6c0 --- /dev/null +++ b/src/api/java/li/cil/oc/api/event/RackMountableRenderEvent.java @@ -0,0 +1,182 @@ +package li.cil.oc.api.event; + +import li.cil.oc.api.component.RackMountable; +import li.cil.oc.api.internal.Rack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import net.minecraftforge.fml.common.eventhandler.Event; +import org.lwjgl.opengl.GL11; + +/** + * Fired to allow rendering a custom overlay for {@link li.cil.oc.api.component.RackMountable}s. + *

+ * When this event is fired, the GL state is set up such that the origin is + * the top left corner of the mountable the event was fired for. It's the + * event handler's responsibility to not render outside the are of the + * mountable (unless that's explicitly what they're going for, of course). + */ +public abstract class RackMountableRenderEvent extends Event { + /** + * The rack that house the mountable this event is fired for. + */ + public final Rack rack; + + /** + * The index of the mountable in the rack the event is fired for. + */ + public final int mountable; + + /** + * Some additional data made available by the mountable. May be null. + * + * @see RackMountable#getData() + */ + public final NBTTagCompound data; + + public RackMountableRenderEvent(Rack rack, int mountable, NBTTagCompound data) { + this.rack = rack; + this.mountable = mountable; + this.data = data; + } + + /** + * Fired when the static rack model is rendered. + *

+ * Code here runs inside a ISimpleBlockRenderingHandler, so functionality + * is limited to what's possible in there. This is primarily meant to allow setting + * a custom override texture (renderer.setOverrideBlockTexture) for the + * mountables front. + *

+ * The bounds will be set up before this call, so you may adjust those, if you wish. + */ + @Cancelable + public static class Block extends RackMountableRenderEvent { + /** + * The front-facing side, i.e. where the mountable is visible on the rack. + */ + public final EnumFacing side; + + /** + * Texture to use for the front of the mountable. + */ + private TextureAtlasSprite frontTextureOverride; + + public Block(final Rack rack, final int mountable, final NBTTagCompound data, final EnumFacing side) { + super(rack, mountable, data); + this.side = side; + } + + /** + * The texture currently set to use for the front of the mountable, or null. + */ + public TextureAtlasSprite getFrontTextureOverride() { + return frontTextureOverride; + } + + /** + * Set the texture to use for the front of the mountable. + * + * @param texture the texture to use. + */ + public void setFrontTextureOverride(final TextureAtlasSprite texture) { + frontTextureOverride = texture; + } + } + + /** + * Fired when the dynamic rack model is rendered. + *

+ * Code here runs inside a TileEntitySpecialRenderer, so go nuts. This is + * primarily meant to allow rendering custom overlays, such as LEDs. The GL state + * will have been adjusted such that rendering a one by one quad starting at the + * origin will fill the full front face of the rack (i.e. rotation and translation + * have already been applied). + *

+ * If you wish to have something glowing (like LEDs), you'll have to disable + * lighting yourself (and enable it again afterwards!). + *

+ * Use the {@link #renderOverlay(ResourceLocation)} to render a slice from a + * texture in the vertical area occupied by the mountable. + */ + public static class TileEntity extends RackMountableRenderEvent { + /** + * The vertical low and high texture coordinates for the mountable's slot. + *

+ * This is purely for convenience; they're computed as (2/16)+i*(3/16). + */ + public final float v0, v1; + + public TileEntity(final Rack rack, final int mountable, final NBTTagCompound data, final float v0, final float v1) { + super(rack, mountable, data); + this.v0 = v0; + this.v1 = v1; + } + + /** + * Utility method for rendering a texture as the front-side overlay. + * + * @param texture the texture to use to render the overlay. + */ + public void renderOverlay(final ResourceLocation texture) { + renderOverlay(texture, 0, 1); + } + + /** + * Utility method for rendering a texture as the front-side overlay + * over a specified horizontal area. + * + * @param texture the texture to use to render the overlay. + * @param u0 the lower end of the vertical area to render at. + * @param u1 the upper end of the vertical area to render at. + */ + public void renderOverlay(final ResourceLocation texture, final float u0, final float u1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + final Tessellator t = Tessellator.getInstance(); + final VertexBuffer r = t.getBuffer(); + r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + r.pos(u0, v1, 0).tex(u0, v1).endVertex(); + r.pos(u1, v1, 0).tex(u1, v1).endVertex(); + r.pos(u1, v0, 0).tex(u1, v0).endVertex(); + r.pos(u0, v0, 0).tex(u0, v0).endVertex(); + t.draw(); + } + + /** + * Utility method for rendering an atlas texture as the front-side overlay. + * + * @param texture the atlas texture to use to render the overlay. + */ + public void renderOverlayFromAtlas(final ResourceLocation texture) { + renderOverlayFromAtlas(texture, 0, 1); + } + + /** + * Utility method for rendering an atlas texture as the front-side overlay + * over a specified horizontal area. + * + * @param texture the atlas texture to use to render the overlay. + * @param u0 the lower end of the vertical area to render at. + * @param u1 the upper end of the vertical area to render at. + */ + public void renderOverlayFromAtlas(final ResourceLocation texture, final float u0, final float u1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); + final TextureAtlasSprite icon = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(texture.toString()); + final Tessellator t = Tessellator.getInstance(); + final VertexBuffer r = t.getBuffer(); + r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); + r.pos(u0, v1, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v1 * 16)).endVertex(); + r.pos(u1, v1, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v1 * 16)).endVertex(); + r.pos(u1, v0, 0).tex(icon.getInterpolatedU(u1 * 16), icon.getInterpolatedV(v0 * 16)).endVertex(); + r.pos(u0, v0, 0).tex(icon.getInterpolatedU(u0 * 16), icon.getInterpolatedV(v0 * 16)).endVertex(); + t.draw(); + } + } +} diff --git a/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java b/src/api/java/li/cil/oc/api/event/RobotAnalyzeEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java b/src/api/java/li/cil/oc/api/event/RobotAttackEntityEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java b/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java old mode 100644 new mode 100755 index 3014df130..5e11343aa --- a/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java +++ b/src/api/java/li/cil/oc/api/event/RobotBreakBlockEvent.java @@ -1,7 +1,7 @@ package li.cil.oc.api.event; import li.cil.oc.api.internal.Agent; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Cancelable; diff --git a/src/api/java/li/cil/oc/api/event/RobotEvent.java b/src/api/java/li/cil/oc/api/event/RobotEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java b/src/api/java/li/cil/oc/api/event/RobotExhaustionEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java b/src/api/java/li/cil/oc/api/event/RobotMoveEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java b/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java old mode 100644 new mode 100755 index 45d2a6e44..36cb5e60f --- a/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java +++ b/src/api/java/li/cil/oc/api/event/RobotPlaceBlockEvent.java @@ -2,7 +2,7 @@ package li.cil.oc.api.event; import li.cil.oc.api.internal.Agent; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.eventhandler.Cancelable; diff --git a/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java b/src/api/java/li/cil/oc/api/event/RobotPlaceInAirEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java b/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java old mode 100644 new mode 100755 index 6c2d163b5..4b20d0364 --- a/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java +++ b/src/api/java/li/cil/oc/api/event/RobotRenderEvent.java @@ -1,16 +1,15 @@ package li.cil.oc.api.event; -import java.util.Set; - import li.cil.oc.api.driver.item.UpgradeRenderer; import li.cil.oc.api.internal.Agent; import li.cil.oc.api.internal.Robot; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.eventhandler.Cancelable; - import org.lwjgl.util.vector.Vector3f; import org.lwjgl.util.vector.Vector4f; +import java.util.Set; + /** * Fired directly before the robot's chassis is rendered. *

diff --git a/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java b/src/api/java/li/cil/oc/api/event/RobotUsedToolEvent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/event/package-info.java b/src/api/java/li/cil/oc/api/event/package-info.java old mode 100644 new mode 100755 index 65e5831d9..7fe9fe75e --- a/src/api/java/li/cil/oc/api/event/package-info.java +++ b/src/api/java/li/cil/oc/api/event/package-info.java @@ -8,4 +8,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.event; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/fs/FileSystem.java b/src/api/java/li/cil/oc/api/fs/FileSystem.java old mode 100644 new mode 100755 index 13962275d..a9af47466 --- a/src/api/java/li/cil/oc/api/fs/FileSystem.java +++ b/src/api/java/li/cil/oc/api/fs/FileSystem.java @@ -1,9 +1,9 @@ package li.cil.oc.api.fs; -import java.io.FileNotFoundException; - import li.cil.oc.api.Persistable; +import java.io.FileNotFoundException; + /** * Interface for file system driver compatible file systems. *

diff --git a/src/api/java/li/cil/oc/api/fs/Handle.java b/src/api/java/li/cil/oc/api/fs/Handle.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/fs/Label.java b/src/api/java/li/cil/oc/api/fs/Label.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/fs/Mode.java b/src/api/java/li/cil/oc/api/fs/Mode.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/fs/package-info.java b/src/api/java/li/cil/oc/api/fs/package-info.java old mode 100644 new mode 100755 index 98eb58849..d1e3c5f2f --- a/src/api/java/li/cil/oc/api/fs/package-info.java +++ b/src/api/java/li/cil/oc/api/fs/package-info.java @@ -19,4 +19,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.fs; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/internal/Adapter.java b/src/api/java/li/cil/oc/api/internal/Adapter.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/internal/Agent.java b/src/api/java/li/cil/oc/api/internal/Agent.java old mode 100644 new mode 100755 index ce114627e..6f78c196b --- a/src/api/java/li/cil/oc/api/internal/Agent.java +++ b/src/api/java/li/cil/oc/api/internal/Agent.java @@ -1,11 +1,11 @@ package li.cil.oc.api.internal; -import java.util.UUID; - import li.cil.oc.api.machine.MachineHost; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import java.util.UUID; + /** * General marker interface for autonomous agents such as robots and drones. */ diff --git a/src/api/java/li/cil/oc/api/internal/Case.java b/src/api/java/li/cil/oc/api/internal/Case.java old mode 100644 new mode 100755 index 991dcebee..22fc98da3 --- a/src/api/java/li/cil/oc/api/internal/Case.java +++ b/src/api/java/li/cil/oc/api/internal/Case.java @@ -1,8 +1,8 @@ package li.cil.oc.api.internal; -import li.cil.oc.api.driver.EnvironmentHost; import li.cil.oc.api.machine.MachineHost; import li.cil.oc.api.network.Environment; +import li.cil.oc.api.network.EnvironmentHost; import net.minecraft.inventory.IInventory; /** diff --git a/src/api/java/li/cil/oc/api/internal/Colored.java b/src/api/java/li/cil/oc/api/internal/Colored.java old mode 100644 new mode 100755 index c51d33acc..6e1d75a25 --- a/src/api/java/li/cil/oc/api/internal/Colored.java +++ b/src/api/java/li/cil/oc/api/internal/Colored.java @@ -1,7 +1,5 @@ package li.cil.oc.api.internal; -import net.minecraft.item.EnumDyeColor; - /** * This interface is implemented by tile entities that can be colored by * players, such as screens, computer cases and cables. @@ -16,12 +14,24 @@ public interface Colored { * * @return the current color value. */ - EnumDyeColor getColor(); + int getColor(); /** * Set the color value. * * @param value the new color value. */ - void setColor(EnumDyeColor value); + void setColor(int value); + + /** + * Whether the color of the implementing object controls how it can connect + * to other objects. If this is true for both involved + * objects, silver/light gray objects connect to any other object, but + * objects of otherwise different color do not connect to each other. If + * this is false for either of the two objects, they may + * always connect to each other. + * + * @return whether the color influences this object's connectivity. + */ + boolean controlsConnectivity(); } diff --git a/src/api/java/li/cil/oc/api/internal/Database.java b/src/api/java/li/cil/oc/api/internal/Database.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/internal/Drone.java b/src/api/java/li/cil/oc/api/internal/Drone.java old mode 100644 new mode 100755 index 8ddebd61f..45a9aba3d --- a/src/api/java/li/cil/oc/api/internal/Drone.java +++ b/src/api/java/li/cil/oc/api/internal/Drone.java @@ -1,7 +1,7 @@ package li.cil.oc.api.internal; -import li.cil.oc.api.driver.EnvironmentHost; -import net.minecraft.util.Vec3; +import li.cil.oc.api.network.EnvironmentHost; +import net.minecraft.util.math.Vec3d; /** * This interface is implemented as a marker by drones. @@ -20,7 +20,7 @@ public interface Drone extends Agent, EnvironmentHost, Rotatable, Tiered { /** * Get the current target coordinates of the drone. */ - Vec3 getTarget(); + Vec3d getTarget(); /** * Set the new target coordinates of the drone. @@ -29,7 +29,7 @@ public interface Drone extends Agent, EnvironmentHost, Rotatable, Tiered { * to avoid jitter on the client and floating point inaccuracies to * accumulate. */ - void setTarget(Vec3 value); + void setTarget(Vec3d value); /** * Get the drones velocity vector. @@ -38,5 +38,5 @@ public interface Drone extends Agent, EnvironmentHost, Rotatable, Tiered { * so you can cast this to {@link net.minecraft.entity.Entity} and use that * instead, if you'd like. */ - Vec3 getVelocity(); + Vec3d getVelocity(); } diff --git a/src/api/java/li/cil/oc/api/internal/Keyboard.java b/src/api/java/li/cil/oc/api/internal/Keyboard.java new file mode 100755 index 000000000..7fdbf325a --- /dev/null +++ b/src/api/java/li/cil/oc/api/internal/Keyboard.java @@ -0,0 +1,47 @@ +package li.cil.oc.api.internal; + +import li.cil.oc.api.Persistable; +import li.cil.oc.api.network.Environment; +import net.minecraft.entity.player.EntityPlayer; + +/** + * This interface is implemented by the keyboard component, to allow more + * flexible use of it. + *

+ * You can obtain an instance of the keyboard component via the item driver + * of the keyboard block, for example: + *

+ *     final ItemStack stack = li.cil.oc.api.Items.get("keyboard").createItemStack(1);
+ *     final Keyboard keyboard = (Keyboard) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
+ * 
+ */ +public interface Keyboard extends Environment, Persistable { + /** + * Sets a custom usability override. + *

+ * Instead of the default check, which is based on the component's owner's + * position, the specified callback will be queried for usability checks + * instead. + *

+ * Pass null here to unset a previously set override. + * + * @param callback the usability checker to use. + */ + void setUsableOverride(UsabilityChecker callback); + + /** + * Contract interface that has to implemented for usability check overrides. + * + * @see #setUsableOverride(Keyboard.UsabilityChecker) + */ + interface UsabilityChecker { + /** + * Whether the specified keyboard is usable by the specified player. + * + * @param keyboard the keyboard to check for. + * @param player the player to check for. + * @return whether the keyboard is usable by the player. + */ + boolean isUsableByPlayer(Keyboard keyboard, EntityPlayer player); + } +} diff --git a/src/api/java/li/cil/oc/api/internal/Microcontroller.java b/src/api/java/li/cil/oc/api/internal/Microcontroller.java old mode 100644 new mode 100755 index 585267ed3..6a9fcff13 --- a/src/api/java/li/cil/oc/api/internal/Microcontroller.java +++ b/src/api/java/li/cil/oc/api/internal/Microcontroller.java @@ -1,6 +1,6 @@ package li.cil.oc.api.internal; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import li.cil.oc.api.machine.MachineHost; import li.cil.oc.api.network.Environment; diff --git a/src/api/java/li/cil/oc/api/internal/MultiTank.java b/src/api/java/li/cil/oc/api/internal/MultiTank.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/internal/Rack.java b/src/api/java/li/cil/oc/api/internal/Rack.java new file mode 100755 index 000000000..46aa88d3b --- /dev/null +++ b/src/api/java/li/cil/oc/api/internal/Rack.java @@ -0,0 +1,64 @@ +package li.cil.oc.api.internal; + +import li.cil.oc.api.component.RackMountable; +import li.cil.oc.api.network.EnvironmentHost; +import li.cil.oc.api.network.SidedEnvironment; +import net.minecraft.inventory.IInventory; +import net.minecraft.nbt.NBTTagCompound; + +/** + * This interface is implemented by the rack tile entity. + *

+ * It particularly allows {@link RackMountable}s installed in the rack to flag + * themselves as having changed, so their data gets resent to clients. + *

+ * Server racks do not serve as environment for the computer nodes of + * servers. That's what the {@link li.cil.oc.api.internal.Server}s are for, + * which are mountables that can be placed in the rack. + *

+ * Another purpose is to allow identifying tile entities as racks via the API, + * i.e. without having to link against internal classes. This also means that + * you should not implement this. + */ +public interface Rack extends SidedEnvironment, EnvironmentHost, Rotatable, IInventory { + /** + * Determine the index of the specified mountable. + * + * @param mountable the mountable in this rack to get the index of. + * @return the index in the rack, or -1 if it's not in the rack. + */ + int indexOfMountable(RackMountable mountable); + + /** + * The mountable in the specified slot. + *

+ * This can be null, for example when there is no mountable installed + * in that slot. + * + * @param slot the slot in which to get the mountable. + * @return the mountable currently hosted in the specified slot. + */ + RackMountable getMountable(int slot); + + /** + * Get the last data state provided by the mountable in the specified slot. + *

+ * This is also available on the client. This may be null. + * + * @param slot the slot of the mountable to get the data for. + * @return the data of the mountable in that slot, or null. + */ + NBTTagCompound getMountableData(int slot); + + /** + * Mark the mountable in the specified slot as changed. + *

+ * This will cause the mountable's {@link RackMountable#getData()} method + * to be called in the next tick and the updated data to be sent to the + * clients, where it can be used for state based rendering of the mountable + * for example. + * + * @param slot the slot of the mountable to queue for updating. + */ + void markChanged(int slot); +} diff --git a/src/api/java/li/cil/oc/api/internal/Robot.java b/src/api/java/li/cil/oc/api/internal/Robot.java old mode 100644 new mode 100755 index 8746ae44d..b618deadb --- a/src/api/java/li/cil/oc/api/internal/Robot.java +++ b/src/api/java/li/cil/oc/api/internal/Robot.java @@ -1,6 +1,6 @@ package li.cil.oc.api.internal; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import li.cil.oc.api.network.Environment; import net.minecraft.inventory.ISidedInventory; import net.minecraftforge.fluids.IFluidHandler; diff --git a/src/api/java/li/cil/oc/api/internal/Rotatable.java b/src/api/java/li/cil/oc/api/internal/Rotatable.java old mode 100644 new mode 100755 index 4171084ac..68f1cab0e --- a/src/api/java/li/cil/oc/api/internal/Rotatable.java +++ b/src/api/java/li/cil/oc/api/internal/Rotatable.java @@ -6,7 +6,7 @@ import net.minecraft.util.EnumFacing; * This interface is implemented by the computer case and robot tile entities * to allow item components to query the orientation of their host, i.e. to * allow getting the facing of the tile entity passed to their drivers' - * {@link li.cil.oc.api.driver.Item#createEnvironment(net.minecraft.item.ItemStack, li.cil.oc.api.driver.EnvironmentHost)} + * {@link li.cil.oc.api.driver.Item#createEnvironment(net.minecraft.item.ItemStack, li.cil.oc.api.network.EnvironmentHost)} * method. *

* This interface is not meant to be implemented, just used. diff --git a/src/api/java/li/cil/oc/api/internal/Server.java b/src/api/java/li/cil/oc/api/internal/Server.java old mode 100644 new mode 100755 index 5c5b8cd87..8bf8ffac8 --- a/src/api/java/li/cil/oc/api/internal/Server.java +++ b/src/api/java/li/cil/oc/api/internal/Server.java @@ -1,10 +1,11 @@ package li.cil.oc.api.internal; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.component.RackMountable; import li.cil.oc.api.machine.MachineHost; +import li.cil.oc.api.network.EnvironmentHost; /** - * This interface is implemented as a marker by servers in server racks. + * This interface is implemented as a marker by servers in racks. *

* This is implemented by servers in server racks, which serve as their * computer components' environment. That means you can use this to check for @@ -14,17 +15,17 @@ import li.cil.oc.api.machine.MachineHost; * *

* You can get a reference to a server either via the above cast, or via a - * {@link li.cil.oc.api.internal.ServerRack}. + * {@link li.cil.oc.api.internal.Rack#getMountable(int)}. *

* The only purpose is to allow identifying node environments as servers * via the API, i.e. without having to link against internal classes. This * also means that you should not implement this. */ -public interface Server extends EnvironmentHost, MachineHost, Tiered { +public interface Server extends EnvironmentHost, MachineHost, Tiered, RackMountable { /** * The server rack this server is in. */ - ServerRack rack(); + Rack rack(); /** * The slot of the server rack this server is in. diff --git a/src/api/java/li/cil/oc/api/internal/ServerRack.java b/src/api/java/li/cil/oc/api/internal/ServerRack.java deleted file mode 100644 index 9f8d2cd0c..000000000 --- a/src/api/java/li/cil/oc/api/internal/ServerRack.java +++ /dev/null @@ -1,38 +0,0 @@ -package li.cil.oc.api.internal; - -import li.cil.oc.api.network.Environment; -import li.cil.oc.api.network.SidedEnvironment; -import net.minecraft.inventory.IInventory; - -/** - * This interface is implemented as a marker by server racks. - *

- * This is implemented by server rack tile entities. That means you can use - * this to check for server racks by using: - *

- *     if (tileEntity instanceof ServerRack) {
- * 
- *

- * Server racks do not serve as environment for the computer nodes of - * servers. That's what the {@link li.cil.oc.api.internal.Server}s are for. - *

- * The only purpose is to allow identifying tile entities as server racks - * via the API, i.e. without having to link against internal classes. This - * also means that you should not implement this. - */ -public interface ServerRack extends Environment, SidedEnvironment, Rotatable, IInventory { - /** - * The server in the specified slot. - *

- * This can be null, for example when there is no server installed - * in that slot. - * - * @return the server currently hosted in the specified slot. - */ - Server server(int slot); - - /** - * The currently set wireless range in which remote terminals work. - */ - int range(); -} diff --git a/src/api/java/li/cil/oc/api/internal/Tablet.java b/src/api/java/li/cil/oc/api/internal/Tablet.java old mode 100644 new mode 100755 index 342a81223..e042685ac --- a/src/api/java/li/cil/oc/api/internal/Tablet.java +++ b/src/api/java/li/cil/oc/api/internal/Tablet.java @@ -1,6 +1,6 @@ package li.cil.oc.api.internal; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import li.cil.oc.api.machine.MachineHost; import net.minecraft.entity.player.EntityPlayer; diff --git a/src/api/java/li/cil/oc/api/internal/TextBuffer.java b/src/api/java/li/cil/oc/api/internal/TextBuffer.java new file mode 100755 index 000000000..2c7d3bcc1 --- /dev/null +++ b/src/api/java/li/cil/oc/api/internal/TextBuffer.java @@ -0,0 +1,608 @@ +package li.cil.oc.api.internal; + +import li.cil.oc.api.Persistable; +import li.cil.oc.api.network.ManagedEnvironment; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +/** + * This interface implements functionality for displaying and manipulating + * text, like screens and robots. An implementation can be obtained via the + * screens' item driver. + *

+ * This allows re-using the built-in screen logic in third-party code without + * access to the internals of OC. + *

+ * To get an instance of the buffer component, use its item driver, e.g.: + *

+ *     final ItemStack stack = li.cil.oc.api.Items.get("screen1").createItemStack(1);
+ *     final TextBuffer buffer = (TextBuffer) li.cil.oc.api.Driver.driverFor(stack).createEnvironment(stack, this);
+ * 
+ */ +public interface TextBuffer extends ManagedEnvironment, Persistable { + /** + * Controls how much energy the buffer will consume per tick. + *

+ * This is not necessarily the actual amount consumed per tick, + * instead it is a base value that cost is based on, incorporating a few + * other factors. This is the cost a tier one screen will consume if every + * character is lit (non-black). Larger buffers (i.e. buffers with a higher + * maximum resolution) cost proportionally more. + *

+ * Note that this amount of energy is not necessarily subtracted each tick, + * instead every n ticks, n times the amount of energy it costs to run the + * buffer will be consumed, where n is configurable in the OC config. + *

+ * This defaults to OC's built-in default value. + * + * @param value the base energy cost per tick. + * @see #getEnergyCostPerTick() + */ + void setEnergyCostPerTick(double value); + + /** + * Get the energy cost per tick. + * + * @return the base energy cost per tick. + * @see #setEnergyCostPerTick(double) + */ + double getEnergyCostPerTick(); + + /** + * Set whether the buffer is powered on. + *

+ * For example, screens can be powered on and off by sending a redstone + * pulse into them, in addition to their component API. + * + * @param value whether the buffer should be on or not. + * @see #getPowerState() + */ + void setPowerState(boolean value); + + /** + * Get the current power state. + * + * @return whether the buffer is powered on. + * @see #setPowerState(boolean) + */ + boolean getPowerState(); + + /** + * Sets the maximum resolution supported by this buffer. + * + * @param width the maximum horizontal resolution, in characters. + * @param height the maximum vertical resolution, in characters. + */ + void setMaximumResolution(int width, int height); + + /** + * Get the maximum horizontal size of the buffer. + */ + int getMaximumWidth(); + + /** + * Get the maximum vertical size of the buffer. + */ + int getMaximumHeight(); + + /** + * Set the 'aspect ratio' of the buffer. + *

+ * Not to be confused with the maximum resolution of the buffer, this + * refers to the 'physical' size of the buffer's container. For multi- + * block screens, for example, this is the number of horizontal and + * vertical blocks. + * + * @param width the horizontal size of the physical representation. + * @param height the vertical size of the physical representation. + */ + void setAspectRatio(double width, double height); + + /** + * Get the aspect ratio of the buffer. + *

+ * Note that this is in fact width / height. + * + * @see #setAspectRatio(double, double) + */ + double getAspectRatio(); + + /** + * Set the buffer's active resolution. + * + * @param width the horizontal resolution. + * @param height the vertical resolution. + * @return true if the resolution changed. + */ + boolean setResolution(int width, int height); + + /** + * Get the current horizontal resolution. + * + * @see #setResolution(int, int) + */ + int getWidth(); + + /** + * Get the current vertical resolution. + * + * @see #setResolution(int, int) + */ + int getHeight(); + + /** + * Set the buffer's active viewport resolution. + *

+ * This cannot exceed the current buffer resolution. + * + * @param width the horizontal resolution. + * @param height the vertical resolution. + * @return true if the resolution changed. + * @see #setResolution(int, int) + */ + boolean setViewport(int width, int height); + + /** + * Get the current horizontal viewport resolution. + * + * @see #setViewport(int, int) + */ + int getViewportWidth(); + + /** + * Get the current vertical viewport resolution. + * + * @see #setViewport(int, int) + */ + int getViewportHeight(); + + /** + * Sets the maximum color depth supported by this buffer. + *

+ * Note that this is the maximum supported depth, lower depths + * will be supported, too. So when setting this to four bit, one bit will + * be supported, too. When setting this to eight bit, four and one bit + * will be supported, also. + * + * @param depth the maximum color depth of the buffer. + */ + void setMaximumColorDepth(ColorDepth depth); + + /** + * Get the maximum color depth supported. + */ + ColorDepth getMaximumColorDepth(); + + /** + * Set the active color depth for this buffer. + * + * @param depth the new color depth. + * @return true if the color depth changed. + */ + boolean setColorDepth(ColorDepth depth); + + /** + * Get the active color depth of this buffer. + */ + ColorDepth getColorDepth(); + + /** + * Set the color of the active color palette at the specified index. + *

+ * This will error if the current depth does not have a palette (one bit). + * + * @param index the index at which to set the color. + * @param color the color to set for the specified index. + */ + void setPaletteColor(int index, int color); + + /** + * Get the color in the active color palette at the specified index. + *

+ * This will error if the current depth does not have a palette (one bit). + * + * @param index the index at which to get the color. + * @return the color in the active palette at the specified index. + */ + int getPaletteColor(int index); + + /** + * Set the active foreground color, not using a palette. + * + * @param color the new foreground color. + * @see #setForegroundColor(int, boolean) + */ + void setForegroundColor(int color); + + /** + * Set the active foreground color. + *

+ * If the value is not from the palette, the actually stored value may + * differ from the specified one, as it is converted to the buffer's + * current color depth. + *

+ * For palette-only color formats (four bit) the best fit from the palette + * is chosen, if the value is not from the palette. + * + * @param color the color or palette index. + * @param isFromPalette trueif color specifies a palette index. + */ + void setForegroundColor(int color, boolean isFromPalette); + + /** + * The active foreground color. + */ + int getForegroundColor(); + + /** + * true if the foreground color is from the color palette, meaning + * the value returned from {@link #getForegroundColor()} is the color + * palette index. + */ + boolean isForegroundFromPalette(); + + /** + * Set the active background color, not using a palette. + * + * @param color the new background color. + * @see #setBackgroundColor(int, boolean) + */ + void setBackgroundColor(int color); + + /** + * Set the active background color. + *

+ * If the value is not from the palette, the actually stored value may + * differ from the specified one, as it is converted to the buffer's + * current color depth. + *

+ * For palette-only color formats (four bit) the best fit from the palette + * is chosen, if the value is not from the palette. + * + * @param color the color or palette index. + * @param isFromPalette trueif color specifies a palette index. + */ + void setBackgroundColor(int color, boolean isFromPalette); + + /** + * The active background color. + */ + int getBackgroundColor(); + + /** + * true if the background color is from the color palette, meaning + * the value returned from {@link #getBackgroundColor()} is the color + * palette index. + */ + boolean isBackgroundFromPalette(); + + /** + * Copy a portion of the text buffer. + *

+ * This will copy the area's text and colors. + * + * @param column the starting horizontal index of the area to copy. + * @param row the starting vertical index of the area to copy. + * @param width the width of the area to copy. + * @param height the height of the area to copy. + * @param horizontalTranslation the horizontal offset, relative to the starting column to copy the are to. + * @param verticalTranslation the vertical offset, relative to the starting row to copy the are to. + */ + void copy(int column, int row, int width, int height, int horizontalTranslation, int verticalTranslation); + + /** + * Fill a portion of the text buffer. + *

+ * This will set the area's colors to the currently active ones. + * + * @param column the starting horizontal index of the area to fill. + * @param row the starting vertical index of the area to fill. + * @param width the width of the area to fill. + * @param height the height of the area to fill. + * @param value the character to fill the area with. + */ + void fill(int column, int row, int width, int height, char value); + + /** + * Write a string into the text buffer. + *

+ * This will apply the currently active colors to the changed area. + * + * @param column the starting horizontal index to write at. + * @param row the starting vertical index to write at. + * @param value the string to write. + * @param vertical true if the string should be written vertically instead of horizontally. + */ + void set(int column, int row, String value, boolean vertical); + + /** + * Get the character in the text buffer at the specified location. + * + * @param column the horizontal index. + * @param row the vertical index. + * @return the character at that index. + */ + char get(int column, int row); + + /** + * Get the foreground color of the text buffer at the specified location. + *

+ * Important: this may be a palette index. + * + * @param column the horizontal index. + * @param row the vertical index. + * @return the foreground color at that index. + */ + int getForegroundColor(int column, int row); + + /** + * Whether the foreground color of the text buffer at the specified + * location if from the color palette. + * + * @param column the horizontal index. + * @param row the vertical index. + * @return whether the foreground at that index is from the palette. + */ + boolean isForegroundFromPalette(int column, int row); + + /** + * Get the background color of the text buffer at the specified location. + *

+ * Important: this may be a palette index. + * + * @param column the horizontal index. + * @param row the vertical index. + * @return the background color at that index. + */ + int getBackgroundColor(int column, int row); + + /** + * Whether the background color of the text buffer at the specified + * location if from the color palette. + * + * @param column the horizontal index. + * @param row the vertical index. + * @return whether the background at that index is from the palette. + */ + boolean isBackgroundFromPalette(int column, int row); + + /** + * Overwrites a portion of the text in raw mode. + *

+ * This will copy the given char array into the buffer, starting at the + * specified column and row. The array is expected to be indexed row- + * first, i.e. the first dimension is the vertical axis, the second + * the horizontal. + *

+ * Important: this performs no checks as to whether something + * actually changed. It will always send the changed patch to clients. + * It will also not crop the specified array to the actually used range. + * In other words, this is not intended to be exposed as-is to user code, + * it should always be called with validated, and, as necessary, cropped + * values. + * + * @param column the horizontal index. + * @param row the vertical index. + * @param text the text to write. + */ + void rawSetText(int column, int row, char[][] text); + + /** + * Overwrites a portion of the foreground color information in raw mode. + *

+ * This will convert the specified RGB data (in 0xRRGGBB format) + * to the internal, packed representation and copy it into the buffer, + * starting at the specified column and row. The array is expected to be + * indexed row-first, i.e. the first dimension is the vertical axis, the + * second the horizontal. + *

+ * Important: this performs no checks as to whether something + * actually changed. It will always send the changed patch to clients. + * It will also not crop the specified array to the actually used range. + * In other words, this is not intended to be exposed as-is to user code, + * it should always be called with validated, and, as necessary, cropped + * values. + * + * @param column the horizontal index. + * @param row the vertical index. + * @param color the foreground color data to write. + */ + void rawSetForeground(int column, int row, int[][] color); + + /** + * Overwrites a portion of the background color information in raw mode. + *

+ * This will convert the specified RGB data (in 0xRRGGBB format) + * to the internal, packed representation and copy it into the buffer, + * starting at the specified column and row. The array is expected to be + * indexed row-first, i.e. the first dimension is the vertical axis, the + * second the horizontal. + *

+ * Important: this performs no checks as to whether something + * actually changed. It will always send the changed patch to clients. + * It will also not crop the specified array to the actually used range. + * In other words, this is not intended to be exposed as-is to user code, + * it should always be called with validated, and, as necessary, cropped + * values. + * + * @param column the horizontal index. + * @param row the vertical index. + * @param color the background color data to write. + */ + void rawSetBackground(int column, int row, int[][] color); + + // ----------------------------------------------------------------------- // + + /** + * Renders the text displayed on the buffer. + *

+ * You are responsible for setting up the actual context and applying any + * transformations necessary to properly position and scale the text before + * calling this. The text should be rendered on a black background. + *

+ * You can use this to either render the text in a GUI or in the world. + * + * @return true if the displayed content changed since the last + * call to this method. + */ + @SideOnly(Side.CLIENT) + boolean renderText(); + + /** + * The natural width of the rendered text. + *

+ * This is the width of the complete text buffer, in pixels. In other + * words, this is the width of the buffer in chars times the actual width + * of a single char in pixels. + * + * @return the total width of the rendered buffer, in pixels. + */ + @SideOnly(Side.CLIENT) + int renderWidth(); + + /** + * The natural height of the rendered text. + *

+ * This is the height of the complete text buffer, in pixels. In other + * words, this is the height of the buffer in chars times the actual height + * of a single char in pixels. + * + * @return the total height of the rendered buffer, in pixels. + */ + @SideOnly(Side.CLIENT) + int renderHeight(); + + /** + * Set whether the contents of the buffer should currently be rendered. + *

+ * Note that this is automatically overwritten when the buffer's power + * state changes, i.e. when it runs out of power or gets back power. + * + * @param enabled whether the text buffer should be rendered. + */ + @SideOnly(Side.CLIENT) + void setRenderingEnabled(boolean enabled); + + /** + * Gets whether the contents of the buffer should currently be rendered. + * + * @see #setRenderingEnabled(boolean) + */ + @SideOnly(Side.CLIENT) + boolean isRenderingEnabled(); + + // ----------------------------------------------------------------------- // + + /** + * Signals a key down event for the buffer. + *

+ * On the client side this causes a packet to be sent to the server. On the + * server side this will trigger a message that will be picked up by + * keyboards, which will then cause a signal in attached machines. + * + * @param character the character of the pressed key. + * @param code the key code of the pressed key. + * @param player the player that pressed the key. Pass null on the client side. + */ + void keyDown(char character, int code, EntityPlayer player); + + /** + * Signals a key up event for the buffer. + *

+ * On the client side this causes a packet to be sent to the server. On the + * server side this will trigger a message that will be picked up by + * keyboards, which will then cause a signal in attached machines. + * + * @param character the character of the released key. + * @param code the key code of the released key. + * @param player the player that released the key. Pass null on the client side. + */ + void keyUp(char character, int code, EntityPlayer player); + + /** + * Signals a clipboard paste event for the buffer. + *

+ * On the client side this causes a packet to be sent to the server. On the + * server side this will trigger a message that will be picked up by + * keyboards, which will then cause a signal in attached machines. + * + * @param value the text that was pasted. + * @param player the player that pasted the text. Pass null on the client side. + */ + void clipboard(String value, EntityPlayer player); + + /** + * Signals a mouse button down event for the buffer. + *

+ * On the client side this causes a packet to be sent to the server. On the + * server side this will cause a signal in attached machines. + * + * @param x the horizontal coordinate of the mouse, in characters. + * @param y the vertical coordinate of the mouse, in characters. + * @param button the button of the mouse that was pressed. + * @param player the player that pressed the mouse button. Pass null on the client side. + */ + void mouseDown(double x, double y, int button, EntityPlayer player); + + /** + * Signals a mouse drag event for the buffer. + *

+ * On the client side this causes a packet to be sent to the server. On the + * server side this will cause a signal in attached machines. + * + * @param x the horizontal coordinate of the mouse, in characters. + * @param y the vertical coordinate of the mouse, in characters. + * @param button the button of the mouse that is pressed. + * @param player the player that moved the mouse. Pass null on the client side. + */ + void mouseDrag(double x, double y, int button, EntityPlayer player); + + /** + * Signals a mouse button release event for the buffer. + *

+ * On the client side this causes a packet to be sent to the server. On the + * server side this will cause a signal in attached machines. + * + * @param x the horizontal coordinate of the mouse, in characters. + * @param y the vertical coordinate of the mouse, in characters. + * @param button the button of the mouse that was released. + * @param player the player that released the mouse button. Pass null on the client side. + */ + void mouseUp(double x, double y, int button, EntityPlayer player); + + /** + * Signals a mouse wheel scroll event for the buffer. + *

+ * On the client side this causes a packet to be sent to the server. On the + * server side this will cause a signal in attached machines. + * + * @param x the horizontal coordinate of the mouse, in characters. + * @param y the vertical coordinate of the mouse, in characters. + * @param delta indicates the direction of the mouse scroll. + * @param player the player that scrolled the mouse wheel. Pass null on the client side. + */ + void mouseScroll(double x, double y, int delta, EntityPlayer player); + + // ----------------------------------------------------------------------- // + + /** + * Used when setting a buffer's maximum color depth. + */ + enum ColorDepth { + /** + * Monochrome color, black and white. + */ + OneBit, + + /** + * 16 color palette, defaults to Minecraft colors. + */ + FourBit, + + /** + * 240 colors, 16 color palette, defaults to grayscale. + */ + EightBit + } +} diff --git a/src/api/java/li/cil/oc/api/internal/Tiered.java b/src/api/java/li/cil/oc/api/internal/Tiered.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/internal/Wrench.java b/src/api/java/li/cil/oc/api/internal/Wrench.java old mode 100644 new mode 100755 index fa85ad243..f1584824a --- a/src/api/java/li/cil/oc/api/internal/Wrench.java +++ b/src/api/java/li/cil/oc/api/internal/Wrench.java @@ -1,7 +1,7 @@ package li.cil.oc.api.internal; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/li/cil/oc/api/internal/package-info.java b/src/api/java/li/cil/oc/api/internal/package-info.java old mode 100644 new mode 100755 index d894dcae0..ad700a273 --- a/src/api/java/li/cil/oc/api/internal/package-info.java +++ b/src/api/java/li/cil/oc/api/internal/package-info.java @@ -19,4 +19,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.internal; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/machine/Architecture.java b/src/api/java/li/cil/oc/api/machine/Architecture.java old mode 100644 new mode 100755 index cb37a1ecc..0bf190b44 --- a/src/api/java/li/cil/oc/api/machine/Architecture.java +++ b/src/api/java/li/cil/oc/api/machine/Architecture.java @@ -1,14 +1,10 @@ package li.cil.oc.api.machine; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import java.lang.annotation.*; + /** * This interface abstracts away any language specific details for the Machine. *

@@ -111,6 +107,22 @@ public interface Architecture { */ ExecutionResult runThreaded(boolean isSynchronizedReturn); + /** + * Called when a new signal is queued in the hosting {@link Machine}. + *

+ * Depending on how you structure your architecture, you may not need this + * callback. For example, the Lua architectures simply pull the next signal + * from the queue whenever {@link #runThreaded} is called again. However, + * if you'd like to react to signals in a more timely manner, you can + * react to this while you are in a {@link #runThreaded} call, + * which is what it is intended to be used for. + *

+ * Keep in mind that this may be called from any random thread, since + * {@link Context#signal} does not require being called from a specific + * thread. + */ + void onSignal(); + /** * Called when the owning machine was connected to the component network. *

diff --git a/src/api/java/li/cil/oc/api/machine/Arguments.java b/src/api/java/li/cil/oc/api/machine/Arguments.java old mode 100644 new mode 100755 index 3e6c8671b..a5a1c992c --- a/src/api/java/li/cil/oc/api/machine/Arguments.java +++ b/src/api/java/li/cil/oc/api/machine/Arguments.java @@ -1,9 +1,9 @@ package li.cil.oc.api.machine; -import java.util.Map; - import net.minecraft.item.ItemStack; +import java.util.Map; + /** * This interface provides access to arguments passed to a {@link Callback}. *

diff --git a/src/api/java/li/cil/oc/api/machine/Callback.java b/src/api/java/li/cil/oc/api/machine/Callback.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/machine/Context.java b/src/api/java/li/cil/oc/api/machine/Context.java old mode 100644 new mode 100755 index fe82dacb6..b92aa7509 --- a/src/api/java/li/cil/oc/api/machine/Context.java +++ b/src/api/java/li/cil/oc/api/machine/Context.java @@ -137,6 +137,24 @@ public interface Context { */ boolean stop(); + /** + * This method allows dynamic costs for direct calls. + *

+ * It will update the budget for direct calls in the current context, and + * throw a {@link LimitReachedException} that should not be caught + * by the callback function. It will be handled in the calling code and + * take care of switching states as necessary. + *

+ * Call this from a method with @Callback(direct = true) and + * no limit set to use dynamic costs. If a limit is set, it will + * always be deduced from the budget in addition to this. + *

+ * When called from a non-direct / synchronous callback this does nothing. + * + * @param callCost the cost of the direct call being performed. + */ + void consumeCallBudget(double callCost); + /** * Push a signal into the computer. *

diff --git a/src/api/java/li/cil/oc/api/machine/ExecutionResult.java b/src/api/java/li/cil/oc/api/machine/ExecutionResult.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/machine/LimitReachedException.java b/src/api/java/li/cil/oc/api/machine/LimitReachedException.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/machine/Machine.java b/src/api/java/li/cil/oc/api/machine/Machine.java old mode 100644 new mode 100755 index 9c53f93b4..b7270f76c --- a/src/api/java/li/cil/oc/api/machine/Machine.java +++ b/src/api/java/li/cil/oc/api/machine/Machine.java @@ -1,9 +1,9 @@ package li.cil.oc.api.machine; -import java.util.Map; - import li.cil.oc.api.network.ManagedEnvironment; +import java.util.Map; + /** * This interface allows interacting with a Machine obtained via the factory * method {@link li.cil.oc.api.Machine#create(MachineHost)}. diff --git a/src/api/java/li/cil/oc/api/machine/MachineHost.java b/src/api/java/li/cil/oc/api/machine/MachineHost.java old mode 100644 new mode 100755 index bade1f0eb..a5077334b --- a/src/api/java/li/cil/oc/api/machine/MachineHost.java +++ b/src/api/java/li/cil/oc/api/machine/MachineHost.java @@ -1,6 +1,6 @@ package li.cil.oc.api.machine; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import li.cil.oc.api.network.Environment; import li.cil.oc.api.network.Node; import net.minecraft.item.ItemStack; diff --git a/src/api/java/li/cil/oc/api/machine/Signal.java b/src/api/java/li/cil/oc/api/machine/Signal.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/machine/Value.java b/src/api/java/li/cil/oc/api/machine/Value.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/machine/package-info.java b/src/api/java/li/cil/oc/api/machine/package-info.java old mode 100644 new mode 100755 index 2922cfd54..97807dcc8 --- a/src/api/java/li/cil/oc/api/machine/package-info.java +++ b/src/api/java/li/cil/oc/api/machine/package-info.java @@ -22,4 +22,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.machine; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/manual/ContentProvider.java b/src/api/java/li/cil/oc/api/manual/ContentProvider.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/manual/ImageProvider.java b/src/api/java/li/cil/oc/api/manual/ImageProvider.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/manual/ImageRenderer.java b/src/api/java/li/cil/oc/api/manual/ImageRenderer.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java b/src/api/java/li/cil/oc/api/manual/InteractiveImageRenderer.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/manual/PathProvider.java b/src/api/java/li/cil/oc/api/manual/PathProvider.java old mode 100644 new mode 100755 index 804c0f031..4f796f2b2 --- a/src/api/java/li/cil/oc/api/manual/PathProvider.java +++ b/src/api/java/li/cil/oc/api/manual/PathProvider.java @@ -1,7 +1,7 @@ package li.cil.oc.api.manual; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java b/src/api/java/li/cil/oc/api/manual/TabIconRenderer.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/manual/package-info.java b/src/api/java/li/cil/oc/api/manual/package-info.java old mode 100644 new mode 100755 index 1c821b918..1cdeae847 --- a/src/api/java/li/cil/oc/api/manual/package-info.java +++ b/src/api/java/li/cil/oc/api/manual/package-info.java @@ -11,4 +11,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.manual; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/nanomachines/Behavior.java b/src/api/java/li/cil/oc/api/nanomachines/Behavior.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/nanomachines/BehaviorProvider.java b/src/api/java/li/cil/oc/api/nanomachines/BehaviorProvider.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/nanomachines/Controller.java b/src/api/java/li/cil/oc/api/nanomachines/Controller.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/nanomachines/DisableReason.java b/src/api/java/li/cil/oc/api/nanomachines/DisableReason.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Analyzable.java b/src/api/java/li/cil/oc/api/network/Analyzable.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java b/src/api/java/li/cil/oc/api/network/BlacklistedPeripheral.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Component.java b/src/api/java/li/cil/oc/api/network/Component.java old mode 100644 new mode 100755 index 84df6eaa5..abf29618f --- a/src/api/java/li/cil/oc/api/network/Component.java +++ b/src/api/java/li/cil/oc/api/network/Component.java @@ -1,10 +1,10 @@ package li.cil.oc.api.network; -import java.util.Collection; - import li.cil.oc.api.machine.Callback; import li.cil.oc.api.machine.Context; +import java.util.Collection; + /** * Components are nodes that can be addressed computers via drivers. *

diff --git a/src/api/java/li/cil/oc/api/network/ComponentConnector.java b/src/api/java/li/cil/oc/api/network/ComponentConnector.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/ComponentHost.java b/src/api/java/li/cil/oc/api/network/ComponentHost.java new file mode 100755 index 000000000..d0680c556 --- /dev/null +++ b/src/api/java/li/cil/oc/api/network/ComponentHost.java @@ -0,0 +1,14 @@ +package li.cil.oc.api.network; + +/** + * A more in-depth implementation of an environment host, also providing + * access to the hosted environments. + */ +public interface ComponentHost extends EnvironmentHost { + /** + * The list of components active in the component host. + * + * @return the list of components. + */ + Iterable getComponents(); +} diff --git a/src/api/java/li/cil/oc/api/network/Connector.java b/src/api/java/li/cil/oc/api/network/Connector.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Environment.java b/src/api/java/li/cil/oc/api/network/Environment.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/EnvironmentHost.java b/src/api/java/li/cil/oc/api/network/EnvironmentHost.java new file mode 100755 index 000000000..db3f47c78 --- /dev/null +++ b/src/api/java/li/cil/oc/api/network/EnvironmentHost.java @@ -0,0 +1,52 @@ +package li.cil.oc.api.network; + +import net.minecraft.world.World; + +/** + * To be implemented by 'hosts' of components. + *

+ * This is what's passed to drivers as the host when creating an environment. + * It is generally used to represent the components' location in the world. + *

+ * You will only need to implement this if you intend to host components, e.g. + * by providing a custom computer case or such. In OpenComputers this interface + * is usually implemented directly by the tile entities acting as the host, so + * in most cases you should be able to cast this to TileEntity for + * more options, if necessary. + */ +public interface EnvironmentHost { + /** + * The world the container lives in. + */ + World world(); + + /** + * The container's X position in the world. + *

+ * For tile entities this is the centered position. For example, + * if the tile entity is located at (0, 2, 3) this will be 0.5. + */ + double xPosition(); + + /** + * The container's Y position in the world. + *

+ * For tile entities this is the centered position. For example, + * if the tile entity is located at (0, 2, 3) this will be 2.5. + */ + double yPosition(); + + /** + * The container's Z position in the world. + *

+ * For tile entities this is the centered position. For example, + * if the tile entity is located at (0, 2, 3) this will be 3.5. + */ + double zPosition(); + + /** + * Marks the container as "changed" so that it knows it has to be saved + * again in the next world save. + */ + void markChanged(); +} diff --git a/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java b/src/api/java/li/cil/oc/api/network/FilteredEnvironment.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java b/src/api/java/li/cil/oc/api/network/ManagedEnvironment.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java b/src/api/java/li/cil/oc/api/network/ManagedPeripheral.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Message.java b/src/api/java/li/cil/oc/api/network/Message.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Network.java b/src/api/java/li/cil/oc/api/network/Network.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Node.java b/src/api/java/li/cil/oc/api/network/Node.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Packet.java b/src/api/java/li/cil/oc/api/network/Packet.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/SidedComponent.java b/src/api/java/li/cil/oc/api/network/SidedComponent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/SidedEnvironment.java b/src/api/java/li/cil/oc/api/network/SidedEnvironment.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/SimpleComponent.java b/src/api/java/li/cil/oc/api/network/SimpleComponent.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/Visibility.java b/src/api/java/li/cil/oc/api/network/Visibility.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java b/src/api/java/li/cil/oc/api/network/WirelessEndpoint.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/network/package-info.java b/src/api/java/li/cil/oc/api/network/package-info.java old mode 100644 new mode 100755 index 0bda9c964..4892d137c --- a/src/api/java/li/cil/oc/api/network/package-info.java +++ b/src/api/java/li/cil/oc/api/network/package-info.java @@ -10,4 +10,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.network; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/package-info.java b/src/api/java/li/cil/oc/api/package-info.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractBehavior.java b/src/api/java/li/cil/oc/api/prefab/AbstractBehavior.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java b/src/api/java/li/cil/oc/api/prefab/AbstractInteractiveImageRenderer.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractProvider.java b/src/api/java/li/cil/oc/api/prefab/AbstractProvider.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/prefab/AbstractValue.java b/src/api/java/li/cil/oc/api/prefab/AbstractValue.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/prefab/DriverBlock.java b/src/api/java/li/cil/oc/api/prefab/DriverBlock.java old mode 100644 new mode 100755 index d8b8e1fa9..b672abccd --- a/src/api/java/li/cil/oc/api/prefab/DriverBlock.java +++ b/src/api/java/li/cil/oc/api/prefab/DriverBlock.java @@ -4,7 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; @@ -21,7 +21,9 @@ import net.minecraftforge.oredict.OreDictionary; * any. * * @see li.cil.oc.api.network.ManagedEnvironment + * @deprecated Use {@link DriverSidedBlock} instead. */ +@Deprecated // TODO Remove in OC 1.7 @SuppressWarnings("UnusedDeclaration") public abstract class DriverBlock implements li.cil.oc.api.driver.Block { protected final ItemStack[] blocks; diff --git a/src/api/java/li/cil/oc/api/prefab/DriverItem.java b/src/api/java/li/cil/oc/api/prefab/DriverItem.java old mode 100644 new mode 100755 index e56e4f715..5b098a449 --- a/src/api/java/li/cil/oc/api/prefab/DriverItem.java +++ b/src/api/java/li/cil/oc/api/prefab/DriverItem.java @@ -1,6 +1,6 @@ package li.cil.oc.api.prefab; -import li.cil.oc.api.driver.EnvironmentHost; +import li.cil.oc.api.network.EnvironmentHost; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; diff --git a/src/api/java/li/cil/oc/api/prefab/DriverSidedBlock.java b/src/api/java/li/cil/oc/api/prefab/DriverSidedBlock.java new file mode 100755 index 000000000..3f4db0ee5 --- /dev/null +++ b/src/api/java/li/cil/oc/api/prefab/DriverSidedBlock.java @@ -0,0 +1,57 @@ +package li.cil.oc.api.prefab; + +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; + +/** + * If you wish to create a block component for a third-party block, i.e. a block + * for which you do not control the tile entity, such as vanilla blocks, you + * will need a block driver. + *

+ * This prefab allows creating a driver that works for a specified list of item + * stacks (to support different blocks with the same id but different metadata + * values). + *

+ * You still have to provide the implementation for creating its environment, if + * any. + *

+ * To limit sidedness, I recommend overriding {@link #worksWith(World, BlockPos, EnumFacing)} + * and calling super.worksWith in addition to the side check. + * + * @see li.cil.oc.api.network.ManagedEnvironment + */ +@SuppressWarnings("UnusedDeclaration") +public abstract class DriverSidedBlock implements li.cil.oc.api.driver.SidedBlock { + protected final ItemStack[] blocks; + + protected DriverSidedBlock(final ItemStack... blocks) { + this.blocks = blocks.clone(); + } + + @Override + public boolean worksWith(final World world, final BlockPos pos, final EnumFacing side) { + final IBlockState state = world.getBlockState(pos); + final Block block = state.getBlock(); + return worksWith(block, block.getMetaFromState(state)); + } + + protected boolean worksWith(final Block referenceBlock, final int referenceMetadata) { + for (ItemStack stack : blocks) { + if (stack != null && stack.getItem() instanceof ItemBlock) { + final ItemBlock item = (ItemBlock) stack.getItem(); + final Block supportedBlock = item.getBlock(); + final int supportedMetadata = item.getMetadata(stack.getItemDamage()); + if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) { + return true; + } + } + } + return false; + } +} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverSidedTileEntity.java b/src/api/java/li/cil/oc/api/prefab/DriverSidedTileEntity.java new file mode 100755 index 000000000..0b06f2e6b --- /dev/null +++ b/src/api/java/li/cil/oc/api/prefab/DriverSidedTileEntity.java @@ -0,0 +1,26 @@ +package li.cil.oc.api.prefab; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +/** + * To limit sidedness, I recommend overriding {@link #worksWith(World, BlockPos, EnumFacing)} + * and calling super.worksWith in addition to the side check. + */ +public abstract class DriverSidedTileEntity implements li.cil.oc.api.driver.SidedBlock { + public abstract Class getTileEntityClass(); + + @Override + public boolean worksWith(final World world, final BlockPos pos, final EnumFacing side) { + final Class filter = getTileEntityClass(); + if (filter == null) { + // This can happen if filter classes are deduced by reflection and + // the class in question is not present. + return false; + } + final TileEntity tileEntity = world.getTileEntity(pos); + return tileEntity != null && filter.isAssignableFrom(tileEntity.getClass()); + } +} diff --git a/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java b/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java old mode 100644 new mode 100755 index 338462b79..061dd6486 --- a/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java +++ b/src/api/java/li/cil/oc/api/prefab/DriverTileEntity.java @@ -1,9 +1,13 @@ package li.cil.oc.api.prefab; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +/** + * @deprecated Use {@link DriverSidedTileEntity} instead. + */ +@Deprecated // TODO Remove in OC 1.7 public abstract class DriverTileEntity implements li.cil.oc.api.driver.Block { public abstract Class getTileEntityClass(); diff --git a/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java b/src/api/java/li/cil/oc/api/prefab/ItemStackTabIconRenderer.java old mode 100644 new mode 100755 diff --git a/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java b/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java old mode 100644 new mode 100755 index ed9ccfba4..3841707c6 --- a/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java +++ b/src/api/java/li/cil/oc/api/prefab/ManagedEnvironment.java @@ -9,6 +9,8 @@ import net.minecraft.nbt.NBTTagCompound; * unused methods don't clutter the implementing class. */ public abstract class ManagedEnvironment implements li.cil.oc.api.network.ManagedEnvironment { + public static final String NODE_TAG = "node"; + // Should be initialized using setNode(api.Network.newNode()). See TileEntityEnvironment. private Node _node; @@ -45,7 +47,7 @@ public abstract class ManagedEnvironment implements li.cil.oc.api.network.Manage @Override public void load(final NBTTagCompound nbt) { if (node() != null) { - node().load(nbt.getCompoundTag("node")); + node().load(nbt.getCompoundTag(NODE_TAG)); } } @@ -61,13 +63,13 @@ public abstract class ManagedEnvironment implements li.cil.oc.api.network.Manage final NBTTagCompound nodeTag = new NBTTagCompound(); node().save(nodeTag); - nbt.setTag("node", nodeTag); + nbt.setTag(NODE_TAG, nodeTag); node().remove(); } else { final NBTTagCompound nodeTag = new NBTTagCompound(); node().save(nodeTag); - nbt.setTag("node", nodeTag); + nbt.setTag(NODE_TAG, nodeTag); } } } diff --git a/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java b/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java old mode 100644 new mode 100755 index cbcc90206..44d5efe68 --- a/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java +++ b/src/api/java/li/cil/oc/api/prefab/ResourceContentProvider.java @@ -1,17 +1,16 @@ package li.cil.oc.api.prefab; +import com.google.common.base.Charsets; +import li.cil.oc.api.manual.ContentProvider; +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; -import li.cil.oc.api.manual.ContentProvider; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; - -import com.google.common.base.Charsets; - /** * Basic implementation of a content provider based on Minecraft's resource * loading framework. diff --git a/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java b/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java old mode 100644 new mode 100755 index f0fcaf2c8..f87057695 --- a/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java +++ b/src/api/java/li/cil/oc/api/prefab/TextureTabIconRenderer.java @@ -3,12 +3,11 @@ package li.cil.oc.api.prefab; import li.cil.oc.api.manual.TabIconRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; - import org.lwjgl.opengl.GL11; /** @@ -28,7 +27,7 @@ public class TextureTabIconRenderer implements TabIconRenderer { Minecraft.getMinecraft().getTextureManager().bindTexture(location); GL11.glBindTexture(GL11.GL_TEXTURE_2D, Minecraft.getMinecraft().getTextureManager().getTexture(location).getGlTextureId()); final Tessellator t = Tessellator.getInstance(); - final WorldRenderer r = t.getWorldRenderer(); + final VertexBuffer r = t.getBuffer(); r.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); r.pos(0, 16, 0).tex(0, 1).endVertex(); r.pos(16, 16, 0).tex(1, 1).endVertex(); diff --git a/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java b/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java old mode 100644 new mode 100755 index 4f255d67f..531552534 --- a/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java +++ b/src/api/java/li/cil/oc/api/prefab/TileEntityEnvironment.java @@ -144,7 +144,7 @@ public abstract class TileEntityEnvironment extends TileEntity implements Enviro } @Override - public void writeToNBT(final NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { super.writeToNBT(nbt); // See readFromNBT() regarding host check. if (node != null && node.host() == this) { @@ -152,5 +152,6 @@ public abstract class TileEntityEnvironment extends TileEntity implements Enviro node.save(nodeNbt); nbt.setTag("oc:node", nodeNbt); } + return nbt; } } diff --git a/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java b/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java old mode 100644 new mode 100755 index 945a83e00..c3d878d9e --- a/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java +++ b/src/api/java/li/cil/oc/api/prefab/TileEntitySidedEnvironment.java @@ -136,7 +136,7 @@ public abstract class TileEntitySidedEnvironment extends TileEntity implements S } @Override - public void writeToNBT(NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); int index = 0; for (Node node : nodes) { @@ -148,5 +148,6 @@ public abstract class TileEntitySidedEnvironment extends TileEntity implements S } ++index; } + return nbt; } } diff --git a/src/api/java/li/cil/oc/api/prefab/package-info.java b/src/api/java/li/cil/oc/api/prefab/package-info.java old mode 100644 new mode 100755 index 8f9e779b5..306982259 --- a/src/api/java/li/cil/oc/api/prefab/package-info.java +++ b/src/api/java/li/cil/oc/api/prefab/package-info.java @@ -13,4 +13,4 @@ apiVersion = API.VERSION) package li.cil.oc.api.prefab; -import li.cil.oc.api.API; +import li.cil.oc.api.API; \ No newline at end of file diff --git a/src/api/java/li/cil/oc/api/util/Lifecycle.java b/src/api/java/li/cil/oc/api/util/Lifecycle.java new file mode 100755 index 000000000..ddf0bbdd2 --- /dev/null +++ b/src/api/java/li/cil/oc/api/util/Lifecycle.java @@ -0,0 +1,66 @@ +package li.cil.oc.api.util; + +import li.cil.oc.api.network.Node; + +/** + * Implement this on {@link li.cil.oc.api.network.ManagedEnvironment}s to be + * notified with proper lifecycle changes, instead of relying on something + * like {@link li.cil.oc.api.network.Environment#onDisconnect(Node)}. + *

+ * This is primarily intended to be used on the client side, where there + * are no nodes, to allow components to know when they are being unloaded. + */ +public interface Lifecycle { + /** + * States an object can enter. + */ + enum LifecycleState { + /** + * State immediately active after construction of the object. + *

+ * This generally means initial construction of the object and + * restoring its state (e.g. loading data if it's persistable). + */ + Constructing, + + /** + * State active when object is being lazily set up. + *

+ * This generally means setting up references, and connecting + * nodes if the object is networked. + */ + Initializing, + + /** + * State active when object finished setting up. + *

+ * This means everything is set up and the object now enters + * its general use lifetime (where components are updated each + * tick for example). + */ + Initialized, + + /** + * State active when object begins cleaning up. + *

+ * This means tearing down references and disconnecting nodes, + * for example. + */ + Disposing, + + /** + * State active after object has been cleaned up, right before + * references by the managing container to it are dropped. + *

+ * This means the object is now considered "dead". + */ + Disposed + } + + /** + * Called when the state of the object changes. + * + * @param state the lifecycle state that is being entered. + */ + void onLifecycleStateChange(LifecycleState state); +} diff --git a/src/api/java/li/cil/oc/api/util/StateAware.java b/src/api/java/li/cil/oc/api/util/StateAware.java new file mode 100755 index 000000000..cbdfa1bd0 --- /dev/null +++ b/src/api/java/li/cil/oc/api/util/StateAware.java @@ -0,0 +1,42 @@ +package li.cil.oc.api.util; + +import java.util.EnumSet; + +/** + * Implemented on machines that have an "working" state. + *

+ * This is similar to BuildCraft's IHasWork interface. + *

+ * This can also be implemented on {@link li.cil.oc.api.component.RackMountable}s + * to indicate a working state, which is used when checking for redstone cards + * in them, for example (only active mountables will be used). + */ +public interface StateAware { + /** + * Get the current work state (usually a TileEntity. + *

+ * An empty set indicates that no work can be performed. + * + * @return the current state. + */ + EnumSet getCurrentState(); + + /** + * Possible work states. + */ + enum State { + None, + + /** + * Indicates that some work can be performed / energy can be consumed, + * but that the current state is being idle. + */ + CanWork, + + /** + * Indicates that some work is currently being performed / some energy + * is currently being consumed. + */ + IsWorking + } +} diff --git a/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java index 5226d11ef..074de6cd5 100644 --- a/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java +++ b/src/api/java/mcp/mobius/waila/api/IWailaCommonAccessor.java @@ -6,9 +6,9 @@ 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.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; /** @@ -28,7 +28,7 @@ public interface IWailaCommonAccessor { TileEntity getTileEntity(); Entity getEntity(); BlockPos getPosition(); - Vec3 getRenderingPosition(); + Vec3d getRenderingPosition(); NBTTagCompound getNBTData(); int getNBTInteger(NBTTagCompound tag, String keyname); double getPartialFrame(); diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java index 0d08a704a..4038d7721 100644 --- a/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java +++ b/src/api/java/mcp/mobius/waila/api/IWailaDataAccessor.java @@ -6,10 +6,10 @@ 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.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; /** @@ -28,9 +28,9 @@ public interface IWailaDataAccessor{ int getMetadata(); IBlockState getBlockState(); TileEntity getTileEntity(); - MovingObjectPosition getMOP(); + RayTraceResult getMOP(); BlockPos getPosition(); - Vec3 getRenderingPosition(); + Vec3d getRenderingPosition(); NBTTagCompound getNBTData(); int getNBTInteger(NBTTagCompound tag, String keyname); double getPartialFrame(); diff --git a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java index e0ddfc116..0d0e75598 100644 --- a/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java +++ b/src/api/java/mcp/mobius/waila/api/IWailaDataProvider.java @@ -6,7 +6,7 @@ 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.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; /** diff --git a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java index 4c364575e..52326671f 100644 --- a/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java +++ b/src/api/java/mcp/mobius/waila/api/IWailaEntityAccessor.java @@ -3,8 +3,8 @@ package mcp.mobius.waila.api; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; /** @@ -19,8 +19,8 @@ public interface IWailaEntityAccessor { World getWorld(); EntityPlayer getPlayer(); Entity getEntity(); - MovingObjectPosition getMOP(); - Vec3 getRenderingPosition(); + RayTraceResult getMOP(); + Vec3d getRenderingPosition(); NBTTagCompound getNBTData(); int getNBTInteger(NBTTagCompound tag, String keyname); double getPartialFrame(); diff --git a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java index 99fb5e8ae..55184c620 100644 --- a/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java +++ b/src/api/java/mcp/mobius/waila/api/IWailaFMPAccessor.java @@ -3,8 +3,8 @@ package mcp.mobius.waila.api; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; /** @@ -19,11 +19,11 @@ public interface IWailaFMPAccessor { World getWorld(); EntityPlayer getPlayer(); TileEntity getTileEntity(); - MovingObjectPosition getPosition(); + RayTraceResult getPosition(); NBTTagCompound getNBTData(); NBTTagCompound getFullNBTData(); int getNBTInteger(NBTTagCompound tag, String keyname); double getPartialFrame(); - Vec3 getRenderingPosition(); + Vec3d getRenderingPosition(); String getID(); } diff --git a/src/main/java/cofh/api/energy/TileEnergyHandler.java b/src/main/java/cofh/api/energy/TileEnergyHandler.java index e72eb38c9..273ffaa77 100644 --- a/src/main/java/cofh/api/energy/TileEnergyHandler.java +++ b/src/main/java/cofh/api/energy/TileEnergyHandler.java @@ -19,10 +19,12 @@ public class TileEnergyHandler extends TileEntity implements IEnergyHandler { } @Override - public void writeToNBT(NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); storage.writeToNBT(nbt); + + return nbt; } /* IEnergyConnection */ diff --git a/src/main/java/mekanism/api/Chunk3D.java b/src/main/java/mekanism/api/Chunk3D.java index efbd19702..ae56ad3e9 100644 --- a/src/main/java/mekanism/api/Chunk3D.java +++ b/src/main/java/mekanism/api/Chunk3D.java @@ -1,6 +1,7 @@ package mekanism.api; import net.minecraft.entity.Entity; +import net.minecraft.util.math.ChunkPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -62,7 +63,7 @@ public class Chunk3D */ public boolean exists(World world) { - return world.getChunkProvider().chunkExists(xCoord, zCoord); + return world.getChunkProvider().getLoadedChunk(xCoord, zCoord) != null; } /** @@ -79,9 +80,9 @@ public class Chunk3D * Returns this Chunk3D in the Minecraft-based ChunkCoordIntPair format. * @return this Chunk3D as a ChunkCoordIntPair */ - public ChunkCoordIntPair toPair() + public ChunkPos getPos() { - return new ChunkCoordIntPair(xCoord, zCoord); + return new ChunkPos(xCoord, zCoord); } @Override diff --git a/src/main/java/mekanism/api/Coord4D.java b/src/main/java/mekanism/api/Coord4D.java index 70a5fee7b..3f112edf0 100644 --- a/src/main/java/mekanism/api/Coord4D.java +++ b/src/main/java/mekanism/api/Coord4D.java @@ -15,6 +15,7 @@ import net.minecraft.util.EnumFacing; 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.world.IBlockAccess; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -59,7 +60,7 @@ public class Coord4D yCoord = (int)entity.posY; zCoord = (int)entity.posZ; - dimensionId = entity.worldObj.provider.getDimensionId(); + dimensionId = entity.worldObj.provider.getDimension(); } /** @@ -80,10 +81,10 @@ public class Coord4D public Coord4D(BlockPos pos, World world) { - this(pos.getX(), pos.getY(), pos.getZ(), world.provider.getDimensionId()); + this(pos.getX(), pos.getY(), pos.getZ(), world.provider.getDimension()); } - public Coord4D(MovingObjectPosition mop, World world) + public Coord4D(RayTraceResult mop, World world) { this(mop.getBlockPos(), world); } @@ -230,7 +231,7 @@ public class Coord4D { IBlockState state = getBlockState(world); - if(state == null || state == Blocks.air) + if(state == null || state == Blocks.AIR) { return null; } @@ -350,7 +351,7 @@ public class Coord4D */ public boolean exists(World world) { - return world.getChunkProvider() == null || world.getChunkProvider().chunkExists(xCoord >> 4, zCoord >> 4); + return world.getChunkProvider() == null || world.getChunkProvider().getLoadedChunk(xCoord >> 4, zCoord >> 4) != null; } /** @@ -398,7 +399,7 @@ public class Coord4D */ public AxisAlignedBB getBoundingBox() { - return AxisAlignedBB.fromBounds(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1); + return new AxisAlignedBB(xCoord, yCoord, zCoord, xCoord+1, yCoord+1, zCoord+1); } @Override diff --git a/src/main/java/mekanism/api/EnumColor.java b/src/main/java/mekanism/api/EnumColor.java index edfea2b89..c01241ec7 100644 --- a/src/main/java/mekanism/api/EnumColor.java +++ b/src/main/java/mekanism/api/EnumColor.java @@ -2,6 +2,8 @@ package mekanism.api; import net.minecraft.util.IStringSerializable; +import com.sun.imageio.plugins.common.I18N; + /** * Simple color enum for adding colors to in-game GUI strings of text. * @author AidanBrady @@ -58,12 +60,12 @@ public enum EnumColor implements IStringSerializable */ public String getLocalizedName() { - return StatCollector.translateToLocal("color." + unlocalizedName); + return I18N.getString("color." + unlocalizedName); } public String getDyeName() { - return StatCollector.translateToLocal("dye." + unlocalizedName); + return I18N.getString("dye." + unlocalizedName); } public String getOreDictName() diff --git a/src/main/java/mekanism/api/Range4D.java b/src/main/java/mekanism/api/Range4D.java index ee55b1da9..2678817a9 100644 --- a/src/main/java/mekanism/api/Range4D.java +++ b/src/main/java/mekanism/api/Range4D.java @@ -53,7 +53,7 @@ public class Range4D public static Range4D getChunkRange(EntityPlayer player) { - int radius = FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().getViewDistance(); + int radius = FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getViewDistance(); return new Range4D(new Chunk3D(player)).expandChunks(radius); } diff --git a/src/main/java/mekanism/api/gas/Gas.java b/src/main/java/mekanism/api/gas/Gas.java index c6b6c4801..a1db395d6 100644 --- a/src/main/java/mekanism/api/gas/Gas.java +++ b/src/main/java/mekanism/api/gas/Gas.java @@ -9,6 +9,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import com.sun.imageio.plugins.common.I18N; + /** * Gas - a class used to set specific properties of gasses when used or seen in-game. * @author aidancbrady @@ -96,7 +98,7 @@ public class Gas */ public String getLocalizedName() { - return StatCollector.translateToLocal(getUnlocalizedName()); + return I18N.getString(getUnlocalizedName()); } /** diff --git a/src/main/java/mekanism/api/gas/OreGas.java b/src/main/java/mekanism/api/gas/OreGas.java index 4f0740fa9..7edba0ba7 100644 --- a/src/main/java/mekanism/api/gas/OreGas.java +++ b/src/main/java/mekanism/api/gas/OreGas.java @@ -1,5 +1,7 @@ package mekanism.api.gas; +import com.sun.imageio.plugins.common.I18N; + public class OreGas extends Gas { @@ -32,6 +34,6 @@ public class OreGas extends Gas public String getOreName() { - return StatCollector.translateToLocal(oreName); + return I18N.getString(oreName); } } diff --git a/src/main/java/mekanism/api/infuse/InfuseType.java b/src/main/java/mekanism/api/infuse/InfuseType.java index 93064f2b1..c9a99a7bf 100644 --- a/src/main/java/mekanism/api/infuse/InfuseType.java +++ b/src/main/java/mekanism/api/infuse/InfuseType.java @@ -3,6 +3,8 @@ package mekanism.api.infuse; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.ResourceLocation; +import com.sun.imageio.plugins.common.I18N; + /** * The types of infuse currently available in Mekanism. * @author AidanBrady @@ -42,6 +44,6 @@ public final class InfuseType public String getLocalizedName() { - return StatCollector.translateToLocal(unlocalizedName); + return I18N.getString(unlocalizedName); } } diff --git a/src/main/java/mekanism/api/transmitters/DynamicNetwork.java b/src/main/java/mekanism/api/transmitters/DynamicNetwork.java index 7fe1e4619..eec9a9e1d 100644 --- a/src/main/java/mekanism/api/transmitters/DynamicNetwork.java +++ b/src/main/java/mekanism/api/transmitters/DynamicNetwork.java @@ -267,7 +267,7 @@ public abstract class DynamicNetwork> implemen if(coord.xCoord > maxZ) maxZ = coord.zCoord; } - return new Range4D(minX, minY, minZ, maxX, maxY, maxZ, initTransmitter.world().provider.getDimensionId()); + return new Range4D(minX, minY, minZ, maxX, maxY, maxZ, initTransmitter.world().provider.getDimension()); } public void register() diff --git a/src/main/java/mekanism/api/transmitters/TransmissionType.java b/src/main/java/mekanism/api/transmitters/TransmissionType.java index 2b2b5560d..f8961a283 100644 --- a/src/main/java/mekanism/api/transmitters/TransmissionType.java +++ b/src/main/java/mekanism/api/transmitters/TransmissionType.java @@ -3,6 +3,8 @@ package mekanism.api.transmitters; import mekanism.api.gas.IGasTransmitter; import net.minecraft.tileentity.TileEntity; +import com.sun.imageio.plugins.common.I18N; + public enum TransmissionType { ENERGY("EnergyNetwork", "Energy"), @@ -32,7 +34,7 @@ public enum TransmissionType public String localize() { - return StatCollector.translateToLocal("transmission." + getTransmission()); + return I18N.getString("transmission." + getTransmission()); } public static boolean checkTransmissionType(ITransmitter sideTile, TransmissionType type) diff --git a/src/main/java/mekanism/client/ClientProxy.java b/src/main/java/mekanism/client/ClientProxy.java index 4f90aedb7..d82005c38 100644 --- a/src/main/java/mekanism/client/ClientProxy.java +++ b/src/main/java/mekanism/client/ClientProxy.java @@ -810,7 +810,7 @@ public class ClientProxy extends CommonProxy } @Override - public void addHitEffects(Coord4D coord, MovingObjectPosition mop) + public void addHitEffects(Coord4D coord, RayTraceResult mop) { if(Minecraft.getMinecraft().theWorld != null) { diff --git a/src/main/java/mekanism/client/gui/GuiMModIDFilter.java b/src/main/java/mekanism/client/gui/GuiMModIDFilter.java index 48129026a..9765d11d4 100644 --- a/src/main/java/mekanism/client/gui/GuiMModIDFilter.java +++ b/src/main/java/mekanism/client/gui/GuiMModIDFilter.java @@ -332,7 +332,7 @@ public class GuiMModIDFilter extends GuiMekanism { if(stack.getItem() instanceof ItemBlock) { - if(Block.getBlockFromItem(stack.getItem()) != Blocks.bedrock) + if(Block.getBlockFromItem(stack.getItem()) != Blocks.BEDROCK) { toUse = stack.copy(); toUse.stackSize = 1; diff --git a/src/main/java/mekanism/client/render/MekanismRenderer.java b/src/main/java/mekanism/client/render/MekanismRenderer.java index 828f0717a..1b136b542 100644 --- a/src/main/java/mekanism/client/render/MekanismRenderer.java +++ b/src/main/java/mekanism/client/render/MekanismRenderer.java @@ -238,7 +238,7 @@ public class MekanismRenderer public boolean[] renderSides = new boolean[] {true, true, true, true, true, true, false}; - public Block baseBlock = Blocks.sand; + public Block baseBlock = Blocks.SAND; public final void setBlockBounds(double xNeg, double yNeg, double zNeg, double xPos, double yPos, double zPos) { @@ -503,7 +503,7 @@ public class MekanismRenderer public static ResourceLocation getBlocksTexture() { - return TextureMap.locationBlocksTexture; + return TextureMap.LOCATION_BLOCKS_TEXTURE; } public static interface ICustomBlockIcon diff --git a/src/main/java/mekanism/client/render/RenderResizableCuboid.java b/src/main/java/mekanism/client/render/RenderResizableCuboid.java index eb894621f..dd235eed1 100644 --- a/src/main/java/mekanism/client/render/RenderResizableCuboid.java +++ b/src/main/java/mekanism/client/render/RenderResizableCuboid.java @@ -9,6 +9,7 @@ import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -20,6 +21,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing.Axis; import net.minecraft.util.EnumFacing.AxisDirection; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; import net.minecraft.world.IBlockAccess; @@ -35,12 +37,12 @@ import com.google.common.collect.Maps; public class RenderResizableCuboid { protected RenderManager manager = Minecraft.getMinecraft().getRenderManager(); - public static final Vec3 VEC_ONE = vec3(1); - public static final Vec3 VEC_ZERO = vec3(0); - public static final Vec3 VEC_HALF = vec3(0.5); + public static final Vec3d VEC_ONE = vec3(1); + public static final Vec3d VEC_ZERO = vec3(0); + public static final Vec3d VEC_HALF = vec3(0.5); public interface IBlockLocation { - Vec3 transformToWorld(Vec3 vec); + Vec3d transformToWorld(Vec3d vec); } public interface IFacingLocation { @@ -99,7 +101,7 @@ public class RenderResizableCuboid { public static final RenderResizableCuboid INSTANCE = new RenderResizableCuboid(); /** The AO map assumes that each direction in the world has a different amount of light going towards it. */ - private static final Map aoMap = Maps.newEnumMap(EnumFacing.class); + private static final Map aoMap = Maps.newEnumMap(EnumFacing.class); private static final int U_MIN = 0; private static final int U_MAX = 1; @@ -141,15 +143,15 @@ public class RenderResizableCuboid { flips = new int[6]; } - Vec3 textureStart = new Vec3(cube.textureStartX / 16D, cube.textureStartY / 16D, cube.textureStartZ / 16D); - Vec3 textureSize = new Vec3(cube.textureSizeX / 16D, cube.textureSizeY / 16D, cube.textureSizeZ / 16D); - Vec3 textureOffset = new Vec3(cube.textureOffsetX / 16D, cube.textureOffsetY / 16D, cube.textureOffsetZ / 16D); - Vec3 size = new Vec3(cube.sizeX(), cube.sizeY(), cube.sizeZ()); + Vec3d textureStart = new Vec3d(cube.textureStartX / 16D, cube.textureStartY / 16D, cube.textureStartZ / 16D); + Vec3d textureSize = new Vec3d(cube.textureSizeX / 16D, cube.textureSizeY / 16D, cube.textureSizeZ / 16D); + Vec3d textureOffset = new Vec3d(cube.textureOffsetX / 16D, cube.textureOffsetY / 16D, cube.textureOffsetZ / 16D); + Vec3d size = new Vec3d(cube.sizeX(), cube.sizeY(), cube.sizeZ()); - manager.renderEngine.bindTexture(TextureMap.locationBlocksTexture); + manager.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); Tessellator tess = Tessellator.getInstance(); - WorldRenderer wr = tess.getWorldRenderer(); + VertexBuffer wr = tess.getBuffer(); GlStateManager.enableAlpha(); GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F); @@ -168,15 +170,15 @@ public class RenderResizableCuboid { GlStateManager.enableFog(); } - private void renderCuboidFace(WorldRenderer wr, EnumFacing face, TextureAtlasSprite[] sprites, int[] flips, Vec3 textureStart, Vec3 textureSize, - Vec3 size, Vec3 textureOffset, EnumShadeArgument shadeTypes, IBlockLocation locationFormula, IFacingLocation faceFormula, + private void renderCuboidFace(VertexBuffer wr, EnumFacing face, TextureAtlasSprite[] sprites, int[] flips, Vec3d textureStart, Vec3d textureSize, + Vec3d size, Vec3d textureOffset, EnumShadeArgument shadeTypes, IBlockLocation locationFormula, IFacingLocation faceFormula, IBlockAccess access) { int ordinal = face.ordinal(); if (sprites[ordinal] == null) { return; } - Vec3 textureEnd = textureStart.add(textureSize); + Vec3d textureEnd = textureStart.add(textureSize); float[] uv = getUVArray(sprites[ordinal], flips[ordinal], face, textureStart, textureEnd); List renderInfoList = getRenderInfos(uv, face, size, textureSize, textureOffset); @@ -203,19 +205,19 @@ public class RenderResizableCuboid { } } - public static Vec3 withValue(Vec3 vector, Axis axis, double value) { - if (axis == Axis.X) return new Vec3(value, vector.yCoord, vector.zCoord); - else if (axis == Axis.Y) return new Vec3(vector.xCoord, value, vector.zCoord); - else if (axis == Axis.Z) return new Vec3(vector.xCoord, vector.yCoord, value); + public static Vec3d withValue(Vec3d vector, Axis axis, double value) { + if (axis == Axis.X) return new Vec3d(value, vector.yCoord, vector.zCoord); + else if (axis == Axis.Y) return new Vec3d(vector.xCoord, value, vector.zCoord); + else if (axis == Axis.Z) return new Vec3d(vector.xCoord, vector.yCoord, value); else throw new RuntimeException("Was given a null axis! That was probably not intentional, consider this a bug! (Vector = " + vector + ")"); } - private void renderPoint(WorldRenderer wr, EnumFacing face, Axis u, Axis v, double other, RenderInfo ri, boolean minU, boolean minV, + private void renderPoint(VertexBuffer wr, EnumFacing face, Axis u, Axis v, double other, RenderInfo ri, boolean minU, boolean minV, IBlockLocation locationFormula, IFacingLocation faceFormula, IBlockAccess access, EnumShadeArgument shadeTypes) { int U_ARRAY = minU ? U_MIN : U_MAX; int V_ARRAY = minV ? V_MIN : V_MAX; - Vec3 vertex = withValue(VEC_ZERO, u, ri.xyz[U_ARRAY]); + Vec3d vertex = withValue(VEC_ZERO, u, ri.xyz[U_ARRAY]); vertex = withValue(vertex, v, ri.xyz[V_ARRAY]); vertex = withValue(vertex, face.getAxis(), other); @@ -229,7 +231,7 @@ public class RenderResizableCuboid { if (shadeTypes.isEnabled(EnumShadeType.AMBIENT_OCCLUSION)) { applyLocalAO(wr, faceFormula.transformToWorld(face), locationFormula, access, shadeTypes, vertex); } else if (shadeTypes.isEnabled(EnumShadeType.LIGHT)) { - Vec3 transVertex = locationFormula.transformToWorld(vertex); + Vec3d transVertex = locationFormula.transformToWorld(vertex); BlockPos pos = convertFloor(transVertex); Block block = access.getBlockState(pos).getBlock(); int combindedLight = block.getMixedBrightnessForBlock(access, pos); @@ -239,19 +241,19 @@ public class RenderResizableCuboid { wr.endVertex(); } - public static BlockPos convertFloor(Vec3 vec) { + public static BlockPos convertFloor(Vec3d vec) { return new BlockPos(vec.xCoord, vec.yCoord, vec.zCoord); } - public static Vec3 convert(Vec3i vec3i) { - return new Vec3(vec3i.getX(), vec3i.getY(), vec3i.getZ()); + public static Vec3d convert(Vec3i vec3i) { + return new Vec3d(vec3i.getX(), vec3i.getY(), vec3i.getZ()); } - public static Vec3 convert(EnumFacing face) { + public static Vec3d convert(EnumFacing face) { if (face == null) { return VEC_ZERO; } - return new Vec3(face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ()); + return new Vec3d(face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ()); } @@ -267,8 +269,8 @@ public class RenderResizableCuboid { return faces; } - private void applyLocalAO(WorldRenderer wr, EnumFacing face, IBlockLocation locationFormula, IBlockAccess access, EnumShadeArgument shadeTypes, - Vec3 vertex) { + private void applyLocalAO(VertexBuffer wr, EnumFacing face, IBlockLocation locationFormula, IBlockAccess access, EnumShadeArgument shadeTypes, + Vec3d vertex) { // This doesn't work. At all. boolean allAround = false; @@ -278,7 +280,7 @@ public class RenderResizableCuboid { float[] colorMultiplier = new float[numPositions]; double[] distances = new double[numPositions]; double totalDist = 0; - Vec3 transVertex = locationFormula.transformToWorld(vertex); + Vec3d transVertex = locationFormula.transformToWorld(vertex); BlockPos pos = convertFloor(transVertex); Block block = access.getBlockState(pos).getBlock(); int combindedLight = block.getMixedBrightnessForBlock(access, pos); @@ -291,7 +293,7 @@ public class RenderResizableCuboid { int index = 0; EnumFacing[] testArray = allAround ? EnumFacing.values() : getNeighbours(face); for (EnumFacing otherFace : testArray) { - Vec3 nearestOther = vertex.add(convert(otherFace)); + Vec3d nearestOther = vertex.add(convert(otherFace)); pos = convertFloor(locationFormula.transformToWorld(nearestOther)); block = access.getBlockState(pos).getBlock(); combindedLight = block.getMixedBrightnessForBlock(access, pos); @@ -322,7 +324,7 @@ public class RenderResizableCuboid { wr.lightmap(capBlockLight, capSkyLight); } - Vec3 color; + Vec3d color; if (shadeTypes.isEnabled(EnumShadeType.FACE)) { color = aoMap.get(face); } else { @@ -332,19 +334,19 @@ public class RenderResizableCuboid { setWorldRendererRGB(wr, color); } - public static void setWorldRendererRGB(WorldRenderer wr, Vec3 color) { + public static void setWorldRendererRGB(VertexBuffer wr, Vec3d color) { wr.color((float) color.xCoord, (float) color.yCoord, (float) color.zCoord, 1f); } - public static Vec3 vec3(double value) { - return new Vec3(value, value, value); + public static Vec3d vec3(double value) { + return new Vec3d(value, value, value); } - public static Vec3 multiply(Vec3 vec, double multiple) { - return new Vec3(vec.xCoord * multiple, vec.yCoord * multiple, vec.zCoord * multiple); + public static Vec3d multiply(Vec3d vec, double multiple) { + return new Vec3d(vec.xCoord * multiple, vec.yCoord * multiple, vec.zCoord * multiple); } - public static Vec3 convertMiddle(Vec3i vec3i) { + public static Vec3d convertMiddle(Vec3i vec3i) { return convert(vec3i).add(VEC_HALF); } @@ -515,7 +517,7 @@ public class RenderResizableCuboid { return uvarray; } - private float[] getUVArray(TextureAtlasSprite sprite, int flips, EnumFacing face, Vec3 start, Vec3 end) { + private float[] getUVArray(TextureAtlasSprite sprite, int flips, EnumFacing face, Vec3d start, Vec3d end) { Axis u = face.getAxis() == Axis.X ? Axis.Z : Axis.X; Axis v = face.getAxis() == Axis.Y ? Axis.Z : Axis.Y; @@ -538,7 +540,7 @@ public class RenderResizableCuboid { return uvarray; } - private List getRenderInfos(float[] uv, EnumFacing face, Vec3 size, Vec3 texSize, Vec3 texOffset) { + private List getRenderInfos(float[] uv, EnumFacing face, Vec3d size, Vec3d texSize, Vec3d texOffset) { Axis u = face.getAxis() == Axis.X ? Axis.Z : Axis.X; Axis v = face.getAxis() == Axis.Y ? Axis.Z : Axis.Y; @@ -552,7 +554,7 @@ public class RenderResizableCuboid { return getRenderInfos(uv, sizeU, sizeV, textureSizeU, textureSizeV, textureOffsetU, textureOffsetV); } - public static double getValue(Vec3 vector, Axis axis) { + public static double getValue(Vec3d vector, Axis axis) { if (axis == Axis.X) return vector.xCoord; else if (axis == Axis.Y) return vector.yCoord; else if (axis == Axis.Z) return vector.zCoord; diff --git a/src/main/java/mekanism/client/render/RenderTickHandler.java b/src/main/java/mekanism/client/render/RenderTickHandler.java index dd75c39aa..4fdcd5272 100644 --- a/src/main/java/mekanism/client/render/RenderTickHandler.java +++ b/src/main/java/mekanism/client/render/RenderTickHandler.java @@ -17,6 +17,7 @@ import mekanism.common.util.MekanismUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.particle.Particle; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; @@ -229,7 +230,7 @@ public class RenderTickHandler public void spawnAndSetParticle(EnumParticleTypes s, World world, double x, double y, double z, double velX, double velY, double velZ) { - EntityFX fx = null; + Particle fx = null; if(s.equals(EnumParticleTypes.FLAME)) { diff --git a/src/main/java/mekanism/client/render/particle/EntityJetpackFlameFX.java b/src/main/java/mekanism/client/render/particle/EntityJetpackFlameFX.java index 3fcf43daa..0c8c06f4f 100644 --- a/src/main/java/mekanism/client/render/particle/EntityJetpackFlameFX.java +++ b/src/main/java/mekanism/client/render/particle/EntityJetpackFlameFX.java @@ -1,6 +1,8 @@ package mekanism.client.render.particle; import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.ParticleFlame; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -8,7 +10,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class EntityJetpackFlameFX extends EntityFlameFX +public class EntityJetpackFlameFX extends ParticleFlame { private static Minecraft mc = FMLClientHandler.instance().getClient(); @@ -26,7 +28,7 @@ public class EntityJetpackFlameFX extends EntityFlameFX } @Override - public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) { if(particleAge > 0) { diff --git a/src/main/java/mekanism/client/render/particle/EntityJetpackSmokeFX.java b/src/main/java/mekanism/client/render/particle/EntityJetpackSmokeFX.java index 2d6006431..1017ac9b5 100644 --- a/src/main/java/mekanism/client/render/particle/EntityJetpackSmokeFX.java +++ b/src/main/java/mekanism/client/render/particle/EntityJetpackSmokeFX.java @@ -1,6 +1,8 @@ package mekanism.client.render.particle; import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.ParticleSmokeNormal; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -8,7 +10,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class EntityJetpackSmokeFX extends EntitySmokeFX +public class EntityJetpackSmokeFX extends ParticleSmokeNormal { private static Minecraft mc = FMLClientHandler.instance().getClient(); @@ -26,7 +28,7 @@ public class EntityJetpackSmokeFX extends EntitySmokeFX } @Override - public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) { if(particleAge > 0) { diff --git a/src/main/java/mekanism/client/render/particle/EntityScubaBubbleFX.java b/src/main/java/mekanism/client/render/particle/EntityScubaBubbleFX.java index 49a44c689..e52b65170 100644 --- a/src/main/java/mekanism/client/render/particle/EntityScubaBubbleFX.java +++ b/src/main/java/mekanism/client/render/particle/EntityScubaBubbleFX.java @@ -1,6 +1,8 @@ package mekanism.client.render.particle; import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.ParticleBubble; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.entity.Entity; import net.minecraft.world.World; import net.minecraftforge.fml.client.FMLClientHandler; @@ -8,7 +10,7 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class EntityScubaBubbleFX extends EntityBubbleFX +public class EntityScubaBubbleFX extends ParticleBubble { private static Minecraft mc = FMLClientHandler.instance().getClient(); @@ -29,7 +31,7 @@ public class EntityScubaBubbleFX extends EntityBubbleFX } @Override - public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) + public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) { if(particleAge > 0) { diff --git a/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java b/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java index ec7814782..fe4abe8e5 100644 --- a/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java +++ b/src/main/java/mekanism/client/render/tileentity/RenderConfigurableMachine.java @@ -45,7 +45,7 @@ public class RenderConfigurableMachine> chunkRegenMap; + private HashMap> chunkRegenMap; - public void addRegenChunk(int dimensionId, ChunkCoordIntPair chunkCoord) + public void addRegenChunk(int dimensionId, ChunkPos chunkCoord) { if(chunkRegenMap == null) { - chunkRegenMap = new HashMap>(); + chunkRegenMap = new HashMap>(); } if(!chunkRegenMap.containsKey(dimensionId)) { - LinkedList list = new LinkedList(); + LinkedList list = new LinkedList(); list.add(chunkCoord); chunkRegenMap.put(dimensionId, list); } @@ -87,17 +88,17 @@ public class CommonWorldTickHandler return; } - int dimensionId = world.provider.getDimensionId(); + int dimensionId = world.provider.getDimension(); //Credit to E. Beef if(chunkRegenMap.containsKey(dimensionId)) { - Queue chunksToGen = chunkRegenMap.get(dimensionId); + Queue chunksToGen = chunkRegenMap.get(dimensionId); long startTime = System.nanoTime(); while(System.nanoTime() - startTime < maximumDeltaTimeNanoSecs && !chunksToGen.isEmpty()) { - ChunkCoordIntPair nextChunk = chunksToGen.poll(); + ChunkPos nextChunk = chunksToGen.poll(); if(nextChunk == null) { diff --git a/src/main/java/mekanism/common/LaserManager.java b/src/main/java/mekanism/common/LaserManager.java index 4a5871e5f..7028dd563 100644 --- a/src/main/java/mekanism/common/LaserManager.java +++ b/src/main/java/mekanism/common/LaserManager.java @@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.MinecraftForge; @@ -30,7 +31,7 @@ public class LaserManager { Pos3D to = from.clone().translate(direction, general.laserRange - 0.002); - MovingObjectPosition mop = world.rayTraceBlocks(from, to); + RayTraceResult mop = world.rayTraceBlocks(from, to); if(mop != null) { @@ -100,20 +101,20 @@ public class LaserManager blockHit.breakBlock(world, blockCoord.getPos(), state); world.setBlockToAir(blockCoord.getPos()); - world.playAuxSFX(2001, blockCoord.getPos(), Block.getIdFromBlock(blockHit)); + world.playEvent(2001, blockCoord.getPos(), Block.getStateId(state)); return ret; } - public static MovingObjectPosition fireLaserClient(TileEntity from, EnumFacing direction, double energy, World world) + public static RayTraceResult fireLaserClient(TileEntity from, EnumFacing direction, double energy, World world) { return fireLaserClient(new Pos3D(from).centre().translate(direction, 0.501), direction, energy, world); } - public static MovingObjectPosition fireLaserClient(Pos3D from, EnumFacing direction, double energy, World world) + public static RayTraceResult fireLaserClient(Pos3D from, EnumFacing direction, double energy, World world) { Pos3D to = from.clone().translate(direction, general.laserRange - 0.002); - MovingObjectPosition mop = world.rayTraceBlocks(from, to); + RayTraceResult mop = world.rayTraceBlocks(from, to); if(mop != null) { @@ -128,11 +129,11 @@ public class LaserManager public static class LaserInfo { - public MovingObjectPosition movingPos; + public RayTraceResult movingPos; public boolean foundEntity; - public LaserInfo(MovingObjectPosition mop, boolean b) + public LaserInfo(RayTraceResult mop, boolean b) { movingPos = mop; foundEntity = b; diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index affab0272..48170ab59 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -114,6 +114,9 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeProvider; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.config.Configuration; @@ -244,9 +247,9 @@ public class Mekanism { //Storage Recipes CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 1, 3), - "***", "***", "***", Character.valueOf('*'), new ItemStack(Items.coal, 1, 1) + "***", "***", "***", Character.valueOf('*'), new ItemStack(Items.COAL, 1, 1) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Items.coal, 9, 1), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Items.COAL, 9, 1), "*", Character.valueOf('*'), new ItemStack(MekanismBlocks.BasicBlock, 1, 3) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 1, 2), @@ -297,10 +300,10 @@ public class Mekanism //Base Recipes CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.ObsidianTNT, 1), - "***", "XXX", "***", Character.valueOf('*'), Blocks.obsidian, Character.valueOf('X'), Blocks.tnt + "***", "XXX", "***", Character.valueOf('*'), Blocks.OBSIDIAN, Character.valueOf('X'), Blocks.TNT )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.ElectricBow.getUnchargedItem(), - " AB", "E B", " AB", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('B'), Items.string, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() + " AB", "E B", " AB", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('B'), Items.STRING, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.EnergyTablet.getUnchargedItem(), "RCR", "ECE", "RCR", Character.valueOf('C'), "ingotGold", Character.valueOf('R'), "dustRedstone", Character.valueOf('E'), MekanismItems.EnrichedAlloy @@ -309,13 +312,13 @@ public class Mekanism "RCR", "iIi", "RCR", Character.valueOf('i'), "ingotIron", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('R'), "alloyBasic", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); BlockStateMachine.MachineType.OSMIUM_COMPRESSOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 1), - "ECE", "BIB", "ECE", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('B'), Items.bucket, Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) + "ECE", "BIB", "ECE", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('B'), Items.BUCKET, Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); BlockStateMachine.MachineType.COMBINER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 2), - "RCR", "SIS", "RCR", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('R'), "alloyElite", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) + "RCR", "SIS", "RCR", Character.valueOf('S'), Blocks.COBBLESTONE, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('R'), "alloyElite", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); BlockStateMachine.MachineType.CRUSHER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 3), - "RCR", "LIL", "RCR", Character.valueOf('R'), "dustRedstone", Character.valueOf('L'), Items.lava_bucket, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) + "RCR", "LIL", "RCR", Character.valueOf('R'), "dustRedstone", Character.valueOf('L'), Items.LAVA_BUCKET, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.SpeedUpgrade), " G ", "ADA", " G ", Character.valueOf('G'), "blockGlass", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('D'), "dustOsmium" @@ -336,10 +339,10 @@ public class Mekanism "AEA", "ACA", " O ", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismItems.AtomicAlloy, Character.valueOf('O'), "ingotRefinedObsidian" )); BlockStateMachine.MachineType.METALLURGIC_INFUSER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 8), - "IFI", "ROR", "IFI", Character.valueOf('I'), "ingotIron", Character.valueOf('F'), Blocks.furnace, Character.valueOf('R'), "dustRedstone", Character.valueOf('O'), "ingotOsmium" + "IFI", "ROR", "IFI", Character.valueOf('I'), "ingotIron", Character.valueOf('F'), Blocks.FURNACE, Character.valueOf('R'), "dustRedstone", Character.valueOf('O'), "ingotOsmium" )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.TeleportationCore), - "LAL", "GDG", "LAL", Character.valueOf('L'), new ItemStack(Items.dye, 1, 4), Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('G'), "ingotGold", Character.valueOf('D'), Items.diamond + "LAL", "GDG", "LAL", Character.valueOf('L'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('G'), "ingotGold", Character.valueOf('D'), Items.DIAMOND )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.PortableTeleporter.getUnchargedItem(), " E ", "CTC", " E ", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('T'), MekanismItems.TeleportationCore @@ -351,7 +354,7 @@ public class Mekanism "ECE", "ORO", "ECE", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('E'), "alloyAdvanced", Character.valueOf('O'), "ingotOsmium", Character.valueOf('R'), new ItemStack(MekanismBlocks.MachineBlock, 1, 0) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.Configurator.getUnchargedItem(), - " L ", "AEA", " S ", Character.valueOf('L'), new ItemStack(Items.dye, 1, 4), Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('S'), Items.stick + " L ", "AEA", " S ", Character.valueOf('L'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('S'), Items.STICK )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 9, 7), "OOO", "OGO", "OOO", Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('G'), "ingotRefinedGlowstone" @@ -363,13 +366,13 @@ public class Mekanism "RCR", "GIG", "RCR", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('R'), "alloyBasic", Character.valueOf('G'), "blockGlass", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); BlockStateMachine.MachineType.ELECTRIC_PUMP.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 12), - " B ", "ECE", "OOO", Character.valueOf('B'), Items.bucket, Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('O'), "ingotOsmium" + " B ", "ECE", "OOO", Character.valueOf('B'), Items.BUCKET, Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('O'), "ingotOsmium" )); BlockStateMachine.MachineType.PERSONAL_CHEST.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 13), - "SGS", "CcC", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), Blocks.chest, Character.valueOf('c'), MekanismUtils.getControlCircuit(BaseTier.BASIC) + "SGS", "CcC", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), Blocks.CHEST, Character.valueOf('c'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 4, 9), - " I ", "IBI", " I ", Character.valueOf('I'), "ingotSteel", Character.valueOf('B'), Items.bucket + " I ", "IBI", " I ", Character.valueOf('I'), "ingotSteel", Character.valueOf('B'), Items.BUCKET )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 4, 10), " I ", "IGI", " I ", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9), Character.valueOf('G'), "blockGlass" @@ -378,7 +381,7 @@ public class Mekanism " I ", "ICI", " I ", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 9), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); BlockStateMachine.MachineType.CHARGEPAD.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 14), - "PPP", "SES", Character.valueOf('P'), Blocks.stone_pressure_plate, Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() + "PPP", "SES", Character.valueOf('P'), Blocks.STONE_PRESSURE_PLATE, Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem() )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.Robit.getUnchargedItem(), " S ", "ECE", "OIO", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismItems.AtomicAlloy, Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('I'), new ItemStack(MekanismBlocks.MachineBlock, 1, 13) @@ -390,7 +393,7 @@ public class Mekanism " O", "SCS", " S ", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); BlockStateMachine.MachineType.LOGISTICAL_SORTER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 15), - "IPI", "ICI", "III", Character.valueOf('I'), "ingotIron", Character.valueOf('P'), Blocks.piston, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) + "IPI", "ICI", "III", Character.valueOf('I'), "ingotIron", Character.valueOf('P'), Blocks.PISTON, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); BlockStateMachine.MachineType.DIGITAL_MINER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock, 1, 4), "ACA", "SES", "TIT", Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('S'), new ItemStack(MekanismBlocks.MachineBlock, 1, 15), Character.valueOf('E'), MekanismItems.Robit.getUnchargedItem(), @@ -404,7 +407,7 @@ public class Mekanism "SCS", "TGT", " T ", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('T'), "ingotTin", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.Dictionary), - "C", "B", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('B'), Items.book + "C", "B", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('B'), Items.BOOK )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GasMask), " S ", "GCG", "S S", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) @@ -430,14 +433,14 @@ public class Mekanism CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.CardboardBox), "SS", "SS", Character.valueOf('S'), "pulpWood" )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Items.paper, 6), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Items.PAPER, 6), "SSS", Character.valueOf('S'), MekanismItems.Sawdust )); BlockStateMachine.MachineType.PRECISION_SAWMILL.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 5), "ICI", "ASA", "ICI", Character.valueOf('I'), "ingotIron", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 1, 14), - "CGC", "IBI", "III", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('G'), "paneGlass", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock2, 1, 0), Character.valueOf('B'), Items.bucket + "CGC", "IBI", "III", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('G'), "paneGlass", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock2, 1, 0), Character.valueOf('B'), Items.BUCKET )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock, 1, 15), " I ", "ICI", " I ", Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock2, 1, 0), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED) @@ -449,7 +452,7 @@ public class Mekanism "CGC", "EAE", "CGC", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('E'), MekanismItems.EnrichedAlloy )); BlockStateMachine.MachineType.CHEMICAL_WASHER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 7), - "CWC", "EIE", "CGC", Character.valueOf('W'), Items.bucket, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) + "CWC", "EIE", "CGC", Character.valueOf('W'), Items.BUCKET, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); BlockStateMachine.MachineType.CHEMICAL_CRYSTALLIZER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 8), "CGC", "ASA", "CGC", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), MekanismItems.AtomicAlloy, Character.valueOf('S'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) @@ -464,10 +467,10 @@ public class Mekanism " A ", "ACA", " A ", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.SeismicReader.getUnchargedItem(), - "SLS", "STS", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('L'), new ItemStack(Items.dye, 1, 4), Character.valueOf('T'), MekanismItems.EnergyTablet.getUnchargedItem() + "SLS", "STS", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('L'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('T'), MekanismItems.EnergyTablet.getUnchargedItem() )); BlockStateMachine.MachineType.SEISMIC_VIBRATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 9), - "TLT", "CIC", "TTT", Character.valueOf('T'), "ingotTin", Character.valueOf('L'), new ItemStack(Items.dye, 1, 4), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) + "TLT", "CIC", "TTT", Character.valueOf('T'), "ingotTin", Character.valueOf('L'), new ItemStack(Items.DYE, 1, 4), Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) )); BlockStateMachine.MachineType.PRESSURIZED_REACTION_CHAMBER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 10), "TET", "CIC", "GFG", Character.valueOf('S'), "ingotSteel", Character.valueOf('E'), MekanismItems.EnrichedAlloy, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), @@ -476,11 +479,11 @@ public class Mekanism BlockStateMachine.MachineType.FLUIDIC_PLENISHER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 12), "TTT", "CPC", "TTT", Character.valueOf('P'), new ItemStack(MekanismBlocks.MachineBlock, 1, 12), Character.valueOf('T'), "ingotTin", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Blocks.rail, 24), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(Blocks.RAIL, 24), "O O", "OSO", "O O", Character.valueOf('O'), "ingotOsmium", Character.valueOf('S'), "stickWood" )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.Flamethrower.getEmptyItem(), - "TTT", "TGS", "BCB", Character.valueOf('T'), "ingotTin", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('S'), Items.flint_and_steel, Character.valueOf('B'), "ingotBronze", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED) + "TTT", "TGS", "BCB", Character.valueOf('T'), "ingotTin", Character.valueOf('G'), MekanismUtils.getEmptyGasTank(GasTankTier.BASIC), Character.valueOf('S'), Items.FLINT_AND_STEEL, Character.valueOf('B'), "ingotBronze", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismItems.GaugeDropper.getEmptyItem(), " O ", "G G", "GGG", Character.valueOf('O'), "ingotOsmium", Character.valueOf('G'), "paneGlass" @@ -504,7 +507,7 @@ public class Mekanism "RCR", "gWg", "RCR", Character.valueOf('R'), "alloyElite", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('g'), "ingotGold", Character.valueOf('W'), "plankWood" )); BlockStateMachine.MachineType.OREDICTIONIFICATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 3), - "SGS", "CBC", "SWS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "paneGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('B'), MekanismItems.Dictionary, Character.valueOf('W'), Blocks.chest + "SGS", "CBC", "SWS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "paneGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('B'), MekanismItems.Dictionary, Character.valueOf('W'), Blocks.CHEST )); BlockStateMachine.MachineType.LASER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 13), "RE ", "RCD", "RE ", Character.valueOf('R'), "alloyElite", Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('D'), "gemDiamond" @@ -515,10 +518,10 @@ public class Mekanism BlockStateMachine.MachineType.LASER_TRACTOR_BEAM.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock2, 1, 15), "C", "F", Character.valueOf('C'), new ItemStack(MekanismBlocks.MachineBlock, 1, 13), Character.valueOf('F'), new ItemStack(MekanismBlocks.MachineBlock2, 1, 14) )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 1, 6), - "SFS", "FAF", "SFS", Character.valueOf('S'), "ingotSteel", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('F'), Blocks.iron_bars + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 1, 6), + "SFS", "FAF", "SFS", Character.valueOf('S'), "ingotSteel", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('F'), Blocks.IRON_BARS )); - CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 4, 7), + CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 4, 7), " S ", "SIS", " S ", Character.valueOf('S'), "ingotSteel", Character.valueOf('I'), "ingotIron" )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 2, 8), @@ -534,17 +537,17 @@ public class Mekanism "OCO", "ATA", "OCO", Character.valueOf('O'), "ingotRefinedObsidian", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), MekanismItems.TeleportationCore })); MachineType.FORMULAIC_ASSEMBLICATOR.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 5), new Object[] { - "STS", "BIB", "SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('T'), Blocks.crafting_table, Character.valueOf('B'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('C'), Blocks.chest + "STS", "BIB", "SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('T'), Blocks.CRAFTING_TABLE, Character.valueOf('B'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('C'), Blocks.CHEST })); CraftingManager.getInstance().getRecipeList().add(new ShapelessMekanismRecipe(new ItemStack(MekanismItems.CraftingFormula), new Object[] { - Items.paper, MekanismUtils.getControlCircuit(BaseTier.BASIC) + Items.PAPER, MekanismUtils.getControlCircuit(BaseTier.BASIC) })); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.BasicBlock2, 1, 9), new Object[] { "SGS", "CIC", "STS", Character.valueOf('S'), "ingotSteel", Character.valueOf('G'), "blockGlass", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('I'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8), Character.valueOf('T'), MekanismItems.TeleportationCore })); MachineType.FUELWOOD_HEATER.addRecipe(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.MachineBlock3, 1, 6), new Object[] { - "SCS", "FHF", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('F'), Blocks.furnace, Character.valueOf('H'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) + "SCS", "FHF", "SSS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('F'), Blocks.FURNACE, Character.valueOf('H'), new ItemStack(MekanismBlocks.BasicBlock, 1, 8) })); //Energy Cube recipes @@ -591,16 +594,16 @@ public class Mekanism //Bin recipes CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.BASIC), new Object[] { - "SCS", "A A", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), "alloyBasic" + "SCS", "A A", "SSS", Character.valueOf('S'), Blocks.COBBLESTONE, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.BASIC), Character.valueOf('A'), "alloyBasic" })); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.ADVANCED), new Object[] { - "SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('A'), "alloyAdvanced", Character.valueOf('B'), MekanismUtils.getBin(BinTier.BASIC) + "SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.COBBLESTONE, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ADVANCED), Character.valueOf('A'), "alloyAdvanced", Character.valueOf('B'), MekanismUtils.getBin(BinTier.BASIC) })); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.ELITE), new Object[] { - "SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('A'), "alloyElite", Character.valueOf('B'), MekanismUtils.getBin(BinTier.ADVANCED) + "SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.COBBLESTONE, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ELITE), Character.valueOf('A'), "alloyElite", Character.valueOf('B'), MekanismUtils.getBin(BinTier.ADVANCED) })); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(MekanismUtils.getBin(BinTier.ULTIMATE), new Object[] { - "SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.cobblestone, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('A'), "alloyUltimate", Character.valueOf('B'), MekanismUtils.getBin(BinTier.ELITE) + "SCS", "ABA", "SSS", Character.valueOf('S'), Blocks.COBBLESTONE, Character.valueOf('C'), MekanismUtils.getControlCircuit(BaseTier.ULTIMATE), Character.valueOf('A'), "alloyUltimate", Character.valueOf('B'), MekanismUtils.getBin(BinTier.ELITE) })); //Induction Cell recipes @@ -673,7 +676,7 @@ public class Mekanism "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 2) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 4), - "SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Items.bucket + "SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Items.BUCKET )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 5), "TTT", "TET", "TTT", Character.valueOf('E'), "alloyAdvanced", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 4) @@ -709,10 +712,10 @@ public class Mekanism "TTT", "TAT", "TTT", Character.valueOf('A'), "alloyUltimate", Character.valueOf('T'), new ItemStack(MekanismItems.PartTransmitter, 1, 14) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 16), - "SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.iron_bars + "SBS", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.IRON_BARS )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 2, 17), - "RRR", "SBS", "RRR", Character.valueOf('R'), "dustRedstone", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.iron_bars + "RRR", "SBS", "RRR", Character.valueOf('R'), "dustRedstone", Character.valueOf('S'), "ingotSteel", Character.valueOf('B'), Blocks.IRON_BARS )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.PartTransmitter, 8, 18), "SCS", Character.valueOf('S'), "ingotSteel", Character.valueOf('C'), "ingotCopper" @@ -741,7 +744,7 @@ public class Mekanism "SSS", "S S", "SSS", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GlowPanel, 2, 15), - "PSP", "S S", "GSG", Character.valueOf('P'), "paneGlass", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('G'), Items.glowstone_dust + "PSP", "S S", "GSG", Character.valueOf('P'), "paneGlass", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('G'), Items.GLOWSTONE_DUST )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.PlasticFence, 3, 15), "BSB", "BSB", Character.valueOf('B'), new ItemStack(MekanismBlocks.PlasticBlock, 1, 15), Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 3) @@ -753,14 +756,14 @@ public class Mekanism "SSS", "SDS", "SSS", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismItems.GlowPanel, 2, i), - "PSP", "SDS", "GSG", Character.valueOf('P'), "paneGlass", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName, Character.valueOf('G'), Items.glowstone_dust + "PSP", "SDS", "GSG", Character.valueOf('P'), "paneGlass", Character.valueOf('S'), new ItemStack(MekanismItems.Polyethene, 1, 2), Character.valueOf('D'), "dye" + EnumColor.DYES[i].dyeName, Character.valueOf('G'), Items.GLOWSTONE_DUST )); } for(int i = 0; i < EnumColor.DYES.length; i++) { CraftingManager.getInstance().getRecipeList().add(new ShapelessMekanismRecipe(new ItemStack(MekanismItems.Balloon, 2, i), - Items.leather, Items.string, "dye" + EnumColor.DYES[i].dyeName + Items.LEATHER, Items.STRING, "dye" + EnumColor.DYES[i].dyeName )); for(int j = 0; j < EnumColor.DYES.length; j++) @@ -787,13 +790,13 @@ public class Mekanism } CraftingManager.getInstance().getRecipeList().add(new ShapelessMekanismRecipe(new ItemStack(MekanismBlocks.GlowPlasticBlock, 3, i), - new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(Items.glowstone_dust) + new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), new ItemStack(Items.GLOWSTONE_DUST) )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.ReinforcedPlasticBlock, 4, i), " P ", "POP", " P ", Character.valueOf('P'), new ItemStack(MekanismBlocks.PlasticBlock, 1, i), Character.valueOf('O'), "dustOsmium" )); CraftingManager.getInstance().getRecipeList().add(new ShapedMekanismRecipe(new ItemStack(MekanismBlocks.RoadPlasticBlock, 3, i), - "SSS", "PPP", "SSS", Character.valueOf('S'), Blocks.sand, Character.valueOf('P'), new ItemStack(MekanismBlocks.SlickPlasticBlock, 1, i) + "SSS", "PPP", "SSS", Character.valueOf('S'), Blocks.SAND, Character.valueOf('P'), new ItemStack(MekanismBlocks.SlickPlasticBlock, 1, i) )); } @@ -802,33 +805,33 @@ public class Mekanism FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismBlocks.OreBlock, 1, 1), new ItemStack(MekanismItems.Ingot, 1, 5), 1.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismBlocks.OreBlock, 1, 2), new ItemStack(MekanismItems.Ingot, 1, 6), 1.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.Dust, 1, Resource.OSMIUM.ordinal()), new ItemStack(MekanismItems.Ingot, 1, 1), 0.0F); - FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.Dust, 1, Resource.IRON.ordinal()), new ItemStack(Items.iron_ingot), 0.0F); - FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.Dust, 1, Resource.GOLD.ordinal()), new ItemStack(Items.gold_ingot), 0.0F); + FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.Dust, 1, Resource.IRON.ordinal()), new ItemStack(Items.IRON_INGOT), 0.0F); + FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.Dust, 1, Resource.GOLD.ordinal()), new ItemStack(Items.GOLD_INGOT), 0.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.OtherDust, 1, 1), new ItemStack(MekanismItems.Ingot, 1, 4), 0.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.Dust, 1, Resource.COPPER.ordinal()), new ItemStack(MekanismItems.Ingot, 1, 5), 0.0F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(MekanismItems.Dust, 1, Resource.TIN.ordinal()), new ItemStack(MekanismItems.Ingot, 1, 6), 0.0F); //Enrichment Chamber Recipes - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 12)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.obsidian), new ItemStack(MekanismItems.OtherDust, 2, 6)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.coal, 1, 0), new ItemStack(MekanismItems.CompressedCarbon)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.coal, 1, 1), new ItemStack(MekanismItems.CompressedCarbon)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.redstone), new ItemStack(MekanismItems.CompressedRedstone)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(Items.dye, 12, 4)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.coal_ore), new ItemStack(Items.coal, 2)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.diamond_ore), new ItemStack(Items.diamond, 2)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.mossy_cobblestone), new ItemStack(Blocks.cobblestone)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.stonebrick, 1, 2)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.sand), new ItemStack(Blocks.gravel)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.gravel), new ItemStack(Blocks.cobblestone)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.gunpowder), new ItemStack(Items.flint)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.stonebrick, 1, 2), new ItemStack(Blocks.stonebrick, 1, 0)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 3)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.stonebrick, 1, 1), new ItemStack(Blocks.stonebrick, 1, 0)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.glowstone), new ItemStack(Items.glowstone_dust, 4)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.clay), new ItemStack(Items.clay_ball, 4)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.REDSTONE_ORE), new ItemStack(Items.REDSTONE, 12)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.OBSIDIAN), new ItemStack(MekanismItems.OtherDust, 2, 6)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.COAL, 1, 0), new ItemStack(MekanismItems.CompressedCarbon)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.COAL, 1, 1), new ItemStack(MekanismItems.CompressedCarbon)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.REDSTONE), new ItemStack(MekanismItems.CompressedRedstone)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.LAPIS_ORE), new ItemStack(Items.DYE, 12, 4)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.COAL_ORE), new ItemStack(Items.COAL, 2)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.DIAMOND_ORE), new ItemStack(Items.DIAMOND, 2)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.MOSSY_COBBLESTONE), new ItemStack(Blocks.COBBLESTONE)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.STONE), new ItemStack(Blocks.STONEBRICK, 1, 2)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.SAND), new ItemStack(Blocks.GRAVEL)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Blocks.COBBLESTONE)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.GUNPOWDER), new ItemStack(Items.FLINT)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.STONEBRICK, 1, 2), new ItemStack(Blocks.STONEBRICK, 1, 0)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.STONEBRICK, 1, 0), new ItemStack(Blocks.STONEBRICK, 1, 3)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.STONEBRICK, 1, 1), new ItemStack(Blocks.STONEBRICK, 1, 0)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Blocks.CLAY), new ItemStack(Items.CLAY_BALL, 4)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(MekanismBlocks.SaltBlock), new ItemStack(MekanismItems.Salt, 4)); - RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.diamond), new ItemStack(MekanismItems.CompressedDiamond)); + RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(Items.DIAMOND), new ItemStack(MekanismItems.CompressedDiamond)); RecipeHandler.addEnrichmentChamberRecipe(new ItemStack(MekanismItems.Polyethene, 3, 0), new ItemStack(MekanismItems.Polyethene, 1, 2)); for(int i = 0; i < EnumColor.DYES.length; i++) @@ -837,12 +840,12 @@ public class Mekanism } //Combiner recipes - RecipeHandler.addCombinerRecipe(new ItemStack(Items.redstone, 16), new ItemStack(Blocks.redstone_ore)); - RecipeHandler.addCombinerRecipe(new ItemStack(Items.dye, 16, 4), new ItemStack(Blocks.lapis_ore)); - RecipeHandler.addCombinerRecipe(new ItemStack(Items.flint), new ItemStack(Blocks.gravel)); + RecipeHandler.addCombinerRecipe(new ItemStack(Items.REDSTONE, 16), new ItemStack(Blocks.REDSTONE_ORE)); + RecipeHandler.addCombinerRecipe(new ItemStack(Items.DYE, 16, 4), new ItemStack(Blocks.LAPIS_ORE)); + RecipeHandler.addCombinerRecipe(new ItemStack(Items.FLINT), new ItemStack(Blocks.GRAVEL)); //Osmium Compressor Recipes - RecipeHandler.addOsmiumCompressorRecipe(new ItemStack(Items.glowstone_dust), new ItemStack(MekanismItems.Ingot, 1, 3)); + RecipeHandler.addOsmiumCompressorRecipe(new ItemStack(Items.GLOWSTONE_DUST), new ItemStack(MekanismItems.Ingot, 1, 3)); //Crusher Recipes RecipeHandler.addCrusherRecipe(new ItemStack(Items.diamond), new ItemStack(MekanismItems.OtherDust, 1, 0)); @@ -878,45 +881,45 @@ public class Mekanism RecipeHandler.addCrusherRecipe(new ItemStack(Blocks.pumpkin), new ItemStack(MekanismItems.BioFuel, 6)); //Purification Chamber Recipes - RecipeHandler.addPurificationChamberRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint)); + RecipeHandler.addPurificationChamberRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT)); //Chemical Injection Chamber Recipes - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.dirt), "water", new ItemStack(Blocks.clay)); - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.hardened_clay), "water", new ItemStack(Blocks.clay)); - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.brick), "water", new ItemStack(Items.clay_ball)); - RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.gunpowder), "hydrogenChloride", new ItemStack(MekanismItems.OtherDust, 1, 3)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.DIRT), "water", new ItemStack(Blocks.CLAY)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.HARDENED_CLAY), "water", new ItemStack(Blocks.CLAY)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.BRICK), "water", new ItemStack(Items.CLAY_BALL)); + RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.GUNPOWDER), "hydrogenChloride", new ItemStack(MekanismItems.OtherDust, 1, 3)); //Precision Sawmill Recipes - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.ladder, 3), new ItemStack(Items.stick, 7)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.torch, 4), new ItemStack(Items.stick), new ItemStack(Items.coal), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.chest), new ItemStack(Blocks.planks, 8)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.trapdoor), new ItemStack(Blocks.planks, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.boat), new ItemStack(Blocks.planks, 5)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.bed), new ItemStack(Blocks.planks, 3), new ItemStack(Blocks.wool, 3), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.oak_door), new ItemStack(Blocks.planks, 6, 0)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.spruce_door), new ItemStack(Blocks.planks, 6, 1)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.birch_door), new ItemStack(Blocks.planks, 6, 2)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.jungle_door), new ItemStack(Blocks.planks, 6, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.acacia_door), new ItemStack(Blocks.planks, 6, 4)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.dark_oak_door), new ItemStack(Blocks.planks, 6, 5)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jukebox), new ItemStack(Blocks.planks, 8), new ItemStack(Items.diamond), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.bookshelf), new ItemStack(Blocks.planks, 6), new ItemStack(Items.book, 3), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.wooden_pressure_plate), new ItemStack(Blocks.planks, 2)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.oak_fence), new ItemStack(Items.stick, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.spruce_fence), new ItemStack(Items.stick, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.birch_fence), new ItemStack(Items.stick, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jungle_fence), new ItemStack(Items.stick, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.acacia_fence), new ItemStack(Items.stick, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.dark_oak_fence), new ItemStack(Items.stick, 3)); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.oak_fence_gate), new ItemStack(Blocks.planks, 2, 0), new ItemStack(Items.stick, 4), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.spruce_fence_gate), new ItemStack(Blocks.planks, 2, 1), new ItemStack(Items.stick, 4), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.birch_fence_gate), new ItemStack(Blocks.planks, 2, 2), new ItemStack(Items.stick, 4), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jungle_fence_gate), new ItemStack(Blocks.planks, 2, 3), new ItemStack(Items.stick, 4), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.acacia_fence_gate), new ItemStack(Blocks.planks, 2, 4), new ItemStack(Items.stick, 4), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.dark_oak_fence_gate), new ItemStack(Blocks.planks, 2, 5), new ItemStack(Items.stick, 4), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.noteblock), new ItemStack(Blocks.planks, 8), new ItemStack(Items.redstone), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.redstone_torch), new ItemStack(Items.stick), new ItemStack(Items.redstone), 1); - RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.crafting_table), new ItemStack(Blocks.planks, 4)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.LADDER, 3), new ItemStack(Items.STICK, 7)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.TORCH, 4), new ItemStack(Items.STICK), new ItemStack(Items.coal), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.CHEST), new ItemStack(Blocks.PLANKS, 8)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.TRAPDOOR), new ItemStack(Blocks.PLANKS, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.BOAT), new ItemStack(Blocks.PLANKS, 5)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.BED), new ItemStack(Blocks.PLANKS, 3), new ItemStack(Blocks.wool, 3), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.OAK_DOOR), new ItemStack(Blocks.PLANKS, 6, 0)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.SPRUCE_DOOR), new ItemStack(Blocks.PLANKS, 6, 1)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.BIRCH_DOOR), new ItemStack(Blocks.PLANKS, 6, 2)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.JUNGLE_DOOR), new ItemStack(Blocks.PLANKS, 6, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.acacia_door), new ItemStack(Blocks.PLANKS, 6, 4)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.dark_oak_door), new ItemStack(Blocks.PLANKS, 6, 5)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jukebox), new ItemStack(Blocks.PLANKS, 8), new ItemStack(Items.diamond), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.bookshelf), new ItemStack(Blocks.PLANKS, 6), new ItemStack(Items.book, 3), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.wooden_pressure_plate), new ItemStack(Blocks.PLANKS, 2)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.oak_fence), new ItemStack(Items.STICK, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.spruce_fence), new ItemStack(Items.STICK, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.birch_fence), new ItemStack(Items.STICK, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jungle_fence), new ItemStack(Items.STICK, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.acacia_fence), new ItemStack(Items.STICK, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.dark_oak_fence), new ItemStack(Items.STICK, 3)); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.oak_fence_gate), new ItemStack(Blocks.PLANKS, 2, 0), new ItemStack(Items.STICK, 4), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.spruce_fence_gate), new ItemStack(Blocks.PLANKS, 2, 1), new ItemStack(Items.STICK, 4), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.birch_fence_gate), new ItemStack(Blocks.PLANKS, 2, 2), new ItemStack(Items.STICK, 4), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jungle_fence_gate), new ItemStack(Blocks.PLANKS, 2, 3), new ItemStack(Items.STICK, 4), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.acacia_fence_gate), new ItemStack(Blocks.PLANKS, 2, 4), new ItemStack(Items.STICK, 4), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.dark_oak_fence_gate), new ItemStack(Blocks.PLANKS, 2, 5), new ItemStack(Items.STICK, 4), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.noteblock), new ItemStack(Blocks.PLANKS, 8), new ItemStack(Items.redstone), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.redstone_torch), new ItemStack(Items.STICK), new ItemStack(Items.redstone), 1); + RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.crafting_table), new ItemStack(Blocks.PLANKS, 4)); //Metallurgic Infuser Recipes RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 10, new ItemStack(Items.iron_ingot), new ItemStack(MekanismItems.EnrichedIron)); @@ -1033,7 +1036,7 @@ public class Mekanism OreDictionary.registerOre("blockSalt", MekanismBlocks.SaltBlock); //Alloys! - OreDictionary.registerOre("alloyBasic", new ItemStack(Items.redstone)); + OreDictionary.registerOre("alloyBasic", new ItemStack(Items.REDSTONE)); OreDictionary.registerOre("alloyAdvanced", new ItemStack(MekanismItems.EnrichedAlloy)); OreDictionary.registerOre("alloyElite", new ItemStack(MekanismItems.ReinforcedAlloy)); OreDictionary.registerOre("alloyUltimate", new ItemStack(MekanismItems.AtomicAlloy)); @@ -1365,7 +1368,7 @@ public class Mekanism //Add baby skeleton spawner if(general.spawnBabySkeletons) { - for(BiomeGenBase biome : WorldChunkManager.allowedBiomes) + for(Biome biome : BiomeProvider.allowedBiomes) { if(biome.getSpawnableList(EnumCreatureType.MONSTER) != null && biome.getSpawnableList(EnumCreatureType.MONSTER).size() > 0) { @@ -1487,19 +1490,19 @@ public class Mekanism { MekanismAPI.addBoxBlacklist(MekanismBlocks.CardboardBox, OreDictionary.WILDCARD_VALUE); MekanismAPI.addBoxBlacklist(MekanismBlocks.BoundingBlock, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.bedrock, 0); - MekanismAPI.addBoxBlacklist(Blocks.portal, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.end_portal, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.end_portal_frame, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.bed, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.oak_door, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.spruce_door, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.birch_door, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.jungle_door, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.acacia_door, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.dark_oak_door, OreDictionary.WILDCARD_VALUE); - MekanismAPI.addBoxBlacklist(Blocks.iron_door, OreDictionary.WILDCARD_VALUE); -// MekanismAPI.addBoxBlacklist(MultipartProxy.block(), OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.BEDROCK, 0); + MekanismAPI.addBoxBlacklist(Blocks.PORTAL, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.END_PORTAL, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.END_PORTAL_FRAME, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.BED, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.OAK_DOOR, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.SPRUCE_DOOR, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.BIRCH_DOOR, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.JUNGLE_DOOR, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.ACACIA_DOOR, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.DARK_OAK_DOOR, OreDictionary.WILDCARD_VALUE); + MekanismAPI.addBoxBlacklist(Blocks.IRON_DOOR, OreDictionary.WILDCARD_VALUE); + //MekanismAPI.addBoxBlacklist(MultipartProxy.block(), OreDictionary.WILDCARD_VALUE); TODO BoxBlacklistParser.load(); } @@ -1507,7 +1510,7 @@ public class Mekanism @SubscribeEvent public synchronized void onChunkLoad(ChunkEvent.Load event) { - if(event.getChunk() != null && !event.world.isRemote) + if(event.getChunk() != null && !event.getWorld().isRemote) { Map copy = (Map)((HashMap)event.getChunk().getTileEntityMap()).clone(); @@ -1535,7 +1538,7 @@ public class Mekanism @SubscribeEvent public void chunkSave(ChunkDataEvent.Save event) { - if(!event.world.isRemote) + if(!event.getWorld().isRemote) { NBTTagCompound nbtTags = event.getData(); @@ -1547,7 +1550,7 @@ public class Mekanism @SubscribeEvent public synchronized void onChunkDataLoad(ChunkDataEvent.Load event) { - if(!event.world.isRemote) + if(!event.getWorld().isRemote) { if(general.enableWorldRegeneration) { @@ -1558,8 +1561,8 @@ public class Mekanism return; } - ChunkCoordIntPair coordPair = event.getChunk().getChunkCoordIntPair(); - worldTickHandler.addRegenChunk(event.world.provider.getDimensionId(), coordPair); + ChunkPos coordPair = event.getChunk().getChunkCoordIntPair(); + worldTickHandler.addRegenChunk(event.getWorld().provider.getDimension(), coordPair); } } } @@ -1567,7 +1570,7 @@ public class Mekanism @SubscribeEvent public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) { - if(event.modID.equals("Mekanism")) + if(event.getModID().equals("Mekanism")) { proxy.loadConfiguration(); proxy.onConfigSync(false); diff --git a/src/main/java/mekanism/common/PacketHandler.java b/src/main/java/mekanism/common/PacketHandler.java index 25db94866..bda8b5259 100644 --- a/src/main/java/mekanism/common/PacketHandler.java +++ b/src/main/java/mekanism/common/PacketHandler.java @@ -76,6 +76,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.server.MinecraftServer; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; @@ -278,9 +280,9 @@ public class PacketHandler */ public void sendToAll(IMessage message) { - MinecraftServer server = MinecraftServer.getServer(); + MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); - for(EntityPlayerMP player : server.getConfigurationManager().playerEntityList) + for(EntityPlayerMP player : server.getPlayerList().getPlayerList()) { sendTo(message, player); } @@ -324,13 +326,13 @@ public class PacketHandler */ public void sendToCuboid(IMessage message, AxisAlignedBB cuboid, int dimId) { - MinecraftServer server = MinecraftServer.getServer(); + MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if(server != null && cuboid != null) { - for(EntityPlayerMP player : (List)server.getConfigurationManager().playerEntityList) + for(EntityPlayerMP player : (List)server.getPlayerList().getPlayerList()) { - if(player.dimension == dimId && cuboid.isVecInside(new Vec3(player.posX, player.posY, player.posZ))) + if(player.dimension == dimId && cuboid.isVecInside(new Vec3d(player.posX, player.posY, player.posZ))) { sendTo(message, player); } @@ -340,11 +342,11 @@ public class PacketHandler public void sendToReceivers(IMessage message, Range4D range) { - MinecraftServer server = MinecraftServer.getServer(); + MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance(); if(server != null) { - for(EntityPlayerMP player : (List)server.getConfigurationManager().playerEntityList) + for(EntityPlayerMP player : (List)server.getPlayerList().getPlayerList()) { if(player.dimension == range.dimensionId && Range4D.getChunkRange(player).intersects(range)) { diff --git a/src/main/java/mekanism/common/block/BlockBasic.java b/src/main/java/mekanism/common/block/BlockBasic.java index 8622ae61f..bf286c6df 100644 --- a/src/main/java/mekanism/common/block/BlockBasic.java +++ b/src/main/java/mekanism/common/block/BlockBasic.java @@ -397,7 +397,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock if(!world.isRemote && type == BasicBlockType.BIN) { TileEntityBin bin = (TileEntityBin)world.getTileEntity(pos); - MovingObjectPosition mop = MekanismUtils.rayTrace(world, player); + RayTraceResult mop = MekanismUtils.rayTrace(world, player); if(mop != null && mop.sideHit == bin.facing) { @@ -850,7 +850,7 @@ public abstract class BlockBasic extends Block implements ICTMBlock } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { IBlockState state = world.getBlockState(pos); BasicBlockType type = BasicBlockType.get(state); diff --git a/src/main/java/mekanism/common/block/BlockBounding.java b/src/main/java/mekanism/common/block/BlockBounding.java index 28bddece2..07fb6ad2a 100644 --- a/src/main/java/mekanism/common/block/BlockBounding.java +++ b/src/main/java/mekanism/common/block/BlockBounding.java @@ -66,7 +66,7 @@ public class BlockBounding extends Block } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { try { TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock)world.getTileEntity(pos); diff --git a/src/main/java/mekanism/common/block/BlockCardboardBox.java b/src/main/java/mekanism/common/block/BlockCardboardBox.java index 1715de5ef..1634bb5f7 100644 --- a/src/main/java/mekanism/common/block/BlockCardboardBox.java +++ b/src/main/java/mekanism/common/block/BlockCardboardBox.java @@ -148,7 +148,7 @@ public class BlockCardboardBox extends BlockContainer } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getTileEntity(pos); IBlockState state = world.getBlockState(pos); diff --git a/src/main/java/mekanism/common/block/BlockEnergyCube.java b/src/main/java/mekanism/common/block/BlockEnergyCube.java index 38f9d0b55..efb5b8b33 100644 --- a/src/main/java/mekanism/common/block/BlockEnergyCube.java +++ b/src/main/java/mekanism/common/block/BlockEnergyCube.java @@ -278,7 +278,7 @@ public class BlockEnergyCube extends BlockContainer } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntityEnergyCube tileEntity = (TileEntityEnergyCube)world.getTileEntity(pos); ItemStack itemStack = new ItemStack(MekanismBlocks.EnergyCube); diff --git a/src/main/java/mekanism/common/block/BlockGasTank.java b/src/main/java/mekanism/common/block/BlockGasTank.java index 9cfb5b3fb..53202c3a5 100644 --- a/src/main/java/mekanism/common/block/BlockGasTank.java +++ b/src/main/java/mekanism/common/block/BlockGasTank.java @@ -259,7 +259,7 @@ public class BlockGasTank extends BlockContainer } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntityGasTank tileEntity = (TileEntityGasTank)world.getTileEntity(pos); ItemStack itemStack = new ItemStack(MekanismBlocks.GasTank); diff --git a/src/main/java/mekanism/common/block/BlockMachine.java b/src/main/java/mekanism/common/block/BlockMachine.java index cf3d89f71..fb848f5a5 100644 --- a/src/main/java/mekanism/common/block/BlockMachine.java +++ b/src/main/java/mekanism/common/block/BlockMachine.java @@ -832,7 +832,7 @@ public abstract class BlockMachine extends BlockContainer implements ICTMBlock } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); IBlockState state = world.getBlockState(pos); diff --git a/src/main/java/mekanism/common/entity/EntityFlame.java b/src/main/java/mekanism/common/entity/EntityFlame.java index b05e6c35b..ecb857ad0 100644 --- a/src/main/java/mekanism/common/entity/EntityFlame.java +++ b/src/main/java/mekanism/common/entity/EntityFlame.java @@ -109,7 +109,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData { Vec3 localVec = new Vec3(posX, posY, posZ); Vec3 motionVec = new Vec3(posX + motionX*2, posY + motionY*2, posZ + motionZ*2); - MovingObjectPosition mop = worldObj.rayTraceBlocks(localVec, motionVec, true, false, false); + RayTraceResult mop = worldObj.rayTraceBlocks(localVec, motionVec, true, false, false); localVec = new Vec3(posX, posY, posZ); motionVec = new Vec3(posX + motionX, posY + motionY, posZ + motionZ); @@ -129,11 +129,11 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData { float boundsScale = 0.3F; AxisAlignedBB newBounds = entity1.getEntityBoundingBox().expand((double)boundsScale, (double)boundsScale, (double)boundsScale); - MovingObjectPosition movingobjectposition1 = newBounds.calculateIntercept(localVec, motionVec); + RayTraceResult RayTraceResult1 = newBounds.calculateIntercept(localVec, motionVec); - if(movingobjectposition1 != null) + if(RayTraceResult1 != null) { - double dist = localVec.distanceTo(movingobjectposition1.hitVec); + double dist = localVec.distanceTo(RayTraceResult1.hitVec); if(dist < entityDist || entityDist == 0) { @@ -146,7 +146,7 @@ public class EntityFlame extends Entity implements IEntityAdditionalSpawnData if(entity != null) { - mop = new MovingObjectPosition(entity); + mop = new RayTraceResult(entity); } if(mop != null && mop.entityHit instanceof EntityPlayer) diff --git a/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java b/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java index bd797683e..f91b6ff93 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerEnergyCube.java @@ -71,7 +71,7 @@ public class ContainerEnergyCube extends Container if(ChargeUtils.canBeCharged(slotStack) || ChargeUtils.canBeDischarged(slotStack)) { - if(slotStack.getItem() == Items.redstone) + if(slotStack.getItem() == Items.REDSTONE) { if(slotID != 1) { diff --git a/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java b/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java index 8fdd4534f..d2db3283d 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerInductionMatrix.java @@ -70,7 +70,7 @@ public class ContainerInductionMatrix extends Container if(ChargeUtils.canBeCharged(slotStack) || ChargeUtils.canBeDischarged(slotStack)) { - if(slotStack.getItem() == Items.redstone) + if(slotStack.getItem() == Items.REDSTONE) { if(slotID != 1) { diff --git a/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java b/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java index 3114ac6ef..4d1e0f048 100644 --- a/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java +++ b/src/main/java/mekanism/common/inventory/container/ContainerPersonalChest.java @@ -6,6 +6,7 @@ import mekanism.common.inventory.slot.SlotPersonalChest; import mekanism.common.tile.TileEntityPersonalChest; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; @@ -137,9 +138,9 @@ public class ContainerPersonalChest extends Container } @Override - public ItemStack slotClick(int slotNumber, int destSlot, int modifier, EntityPlayer player) + public ItemStack slotClick(int slotNumber, int destSlot, ClickType clickType, EntityPlayer player) { - if(modifier == 2 && destSlot >= 0 && destSlot < 9) + if(destSlot >= 0 && destSlot < 9) { ItemStack itemStack = player.inventory.getStackInSlot(destSlot); @@ -149,6 +150,6 @@ public class ContainerPersonalChest extends Container } } - return super.slotClick(slotNumber, destSlot, modifier, player); + return super.slotClick(slotNumber, destSlot, clickType, player); } } diff --git a/src/main/java/mekanism/common/item/ItemBlockMachine.java b/src/main/java/mekanism/common/item/ItemBlockMachine.java index b26a71ed3..d570bf0d1 100644 --- a/src/main/java/mekanism/common/item/ItemBlockMachine.java +++ b/src/main/java/mekanism/common/item/ItemBlockMachine.java @@ -500,14 +500,14 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec { if(SecurityUtils.canAccess(entityplayer, itemstack)) { - MovingObjectPosition pos = getMovingObjectPositionFromPlayer(world, entityplayer, !entityplayer.isSneaking()); + RayTraceResult pos = getRayTraceResultFromPlayer(world, entityplayer, !entityplayer.isSneaking()); if(pos == null) { return itemstack; } else { - if(pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if(pos.typeOfHit == RayTraceResult.MovingObjectType.BLOCK) { Coord4D coord = new Coord4D(pos.getBlockPos(), world); diff --git a/src/main/java/mekanism/common/multipart/PartSidedPipe.java b/src/main/java/mekanism/common/multipart/PartSidedPipe.java index 5dd483c11..b7c913c07 100644 --- a/src/main/java/mekanism/common/multipart/PartSidedPipe.java +++ b/src/main/java/mekanism/common/multipart/PartSidedPipe.java @@ -463,13 +463,13 @@ public abstract class PartSidedPipe extends Multipart implements IOccludingPart, } @Override - public void addHitEffects(MovingObjectPosition hit, EffectRenderer effectRenderer) + public void addHitEffects(RayTraceResult hit, EffectRenderer effectRenderer) { IconHitEffects.addHitEffects(this, hit, effectRenderer); } @Override - public void addDestroyEffects(MovingObjectPosition mop, EffectRenderer effectRenderer) + public void addDestroyEffects(RayTraceResult mop, EffectRenderer effectRenderer) { IconHitEffects.addDestroyEffects(this, effectRenderer, false); } diff --git a/src/main/java/mekanism/common/tile/TileEntityContainerBlock.java b/src/main/java/mekanism/common/tile/TileEntityContainerBlock.java index 722963854..ebf6c9845 100644 --- a/src/main/java/mekanism/common/tile/TileEntityContainerBlock.java +++ b/src/main/java/mekanism/common/tile/TileEntityContainerBlock.java @@ -13,6 +13,8 @@ import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants.NBT; @@ -284,8 +286,8 @@ public abstract class TileEntityContainerBlock extends TileEntityBasicBlock impl public void clear() {} @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { - return new ChatComponentText(getName()); + return new TextComponentString(getName()); } } diff --git a/src/main/java/mekanism/common/tile/TileEntityLaser.java b/src/main/java/mekanism/common/tile/TileEntityLaser.java index 0641c75ab..6e4913553 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLaser.java +++ b/src/main/java/mekanism/common/tile/TileEntityLaser.java @@ -21,6 +21,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.fml.common.FMLCommonHandler; public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IActiveState @@ -47,7 +48,7 @@ public class TileEntityLaser extends TileEntityNoisyElectricBlock implements IAc { if(isActive) { - MovingObjectPosition mop = LaserManager.fireLaserClient(this, facing, usage.laserUsage, worldObj); + RayTraceResult mop = LaserManager.fireLaserClient(this, facing, usage.laserUsage, worldObj); Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj); if(hitCoord == null || !hitCoord.equals(digging)) diff --git a/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java b/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java index cfc1e4324..45bf44122 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java +++ b/src/main/java/mekanism/common/tile/TileEntityLaserAmplifier.java @@ -75,7 +75,7 @@ public class TileEntityLaserAmplifier extends TileEntityContainerBlock implement { if(on) { - MovingObjectPosition mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj); + RayTraceResult mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj); Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj); if(hitCoord == null || !hitCoord.equals(digging)) diff --git a/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java b/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java index 14edd25e3..fbc557f68 100644 --- a/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java +++ b/src/main/java/mekanism/common/tile/TileEntityLaserTractorBeam.java @@ -63,7 +63,7 @@ public class TileEntityLaserTractorBeam extends TileEntityContainerBlock impleme { if(on) { - MovingObjectPosition mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj); + RayTraceResult mop = LaserManager.fireLaserClient(this, facing, lastFired, worldObj); Coord4D hitCoord = mop == null ? null : new Coord4D(mop, worldObj); if(hitCoord == null || !hitCoord.equals(digging)) diff --git a/src/main/java/mekanism/common/tile/TileEntityTeleporter.java b/src/main/java/mekanism/common/tile/TileEntityTeleporter.java index 2cd6f2eac..3a5ff459c 100644 --- a/src/main/java/mekanism/common/tile/TileEntityTeleporter.java +++ b/src/main/java/mekanism/common/tile/TileEntityTeleporter.java @@ -749,7 +749,7 @@ public class TileEntityTeleporter extends TileEntityElectricBlock implements ICo releaseChunks(); chunkTicket = ticket; - ForgeChunkManager.forceChunk(chunkTicket, new Chunk3D(Coord4D.get(this)).toPair()); + ForgeChunkManager.forceChunk(chunkTicket, new Chunk3D(Coord4D.get(this)).getPos()); } public void releaseChunks() diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index 614393a0e..07dbd71d4 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -1087,7 +1087,7 @@ public final class MekanismUtils * @param player - player to raytrace * @return raytraced value */ - public static MovingObjectPosition rayTrace(World world, EntityPlayer player) + public static RayTraceResult rayTrace(World world, EntityPlayer player) { double reach = Mekanism.proxy.getReach(player); diff --git a/src/main/java/mekanism/generators/common/block/BlockGenerator.java b/src/main/java/mekanism/generators/common/block/BlockGenerator.java index 27ee3119d..c87eb64e3 100644 --- a/src/main/java/mekanism/generators/common/block/BlockGenerator.java +++ b/src/main/java/mekanism/generators/common/block/BlockGenerator.java @@ -615,7 +615,7 @@ public abstract class BlockGenerator extends BlockContainer implements ICTMBlock } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) + public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getTileEntity(pos); IBlockState state = world.getBlockState(pos); diff --git a/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java b/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java index 631e5bf46..2967cd8d6 100644 --- a/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java +++ b/src/main/java/mekanism/generators/common/tile/TileEntitySolarGenerator.java @@ -11,6 +11,7 @@ import mekanism.common.util.MekanismUtils; import micdoodle8.mods.galacticraft.api.world.ISolarLevel; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; +import net.minecraft.world.biome.BiomeDesert; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -84,7 +85,7 @@ public class TileEntitySolarGenerator extends TileEntityGenerator public boolean isDesert() { - return worldObj.provider.getBiomeGenForCoords(getPos()).getBiomeClass() == BiomeGenDesert.class; + return worldObj.provider.getBiomeForCoords(getPos()).getBiomeClass() == BiomeDesert.class; } @Override diff --git a/src/main/java/mekanism/tools/item/ItemMekanismPaxel.java b/src/main/java/mekanism/tools/item/ItemMekanismPaxel.java index efea0a048..93bcecbf6 100644 --- a/src/main/java/mekanism/tools/item/ItemMekanismPaxel.java +++ b/src/main/java/mekanism/tools/item/ItemMekanismPaxel.java @@ -16,18 +16,18 @@ public class ItemMekanismPaxel extends ItemMekanismTool @Override public float getDigSpeed(ItemStack stack, IBlockState blockState) { - return blockState.getBlock() != Blocks.bedrock ? efficiencyOnProperMaterial : 1.0F; + return blockState.getBlock() != Blocks.BEDROCK ? efficiencyOnProperMaterial : 1.0F; } @Override public boolean canHarvestBlock(Block block, ItemStack stack) { - if(block == Blocks.obsidian) + if(block == Blocks.OBSIDIAN) { return toolMaterial.getHarvestLevel() == 3; } - if(block == Blocks.diamond_block || block == Blocks.diamond_ore) + if(block == Blocks.DIAMOND_BLOCK || block == Blocks.DIAMOND_ORE) { return toolMaterial.getHarvestLevel() >= 2; }