Started porting to MC1.8. Starts for now, but rendering is still broken as hell.

This commit is contained in:
Florian Nücke 2014-12-26 01:07:41 +01:00
parent 166e3a6b0f
commit 3b578e71a6
424 changed files with 5118 additions and 5197 deletions

View File

@ -61,6 +61,7 @@ runServer {
}
repositories {
/*
maven {
name = "bc"
url = "http://mod-buildcraft.com/"
@ -127,6 +128,7 @@ repositories {
name 'Railcraft'
artifactPattern "http://addons.cursecdn.com/files/${config.rc.cf}/[module]_[revision].[ext]"
}
*/
}
configurations {
@ -136,6 +138,7 @@ configurations {
}
dependencies {
/*
provided "api:rotarycraft:${config.rotc.version}"
provided "appeng:appliedenergistics2:${config.ae2.version}:dev"
provided "codechicken:CodeChickenLib:${config.minecraft.version}-${config.ccl.version}:dev"
@ -161,7 +164,7 @@ dependencies {
provided name: 'ComputerCraft', version: config.cc.version, ext: 'jar'
provided name: 'EnderIO', version: config.eio.version, ext: 'jar'
provided name: 'Railcraft', version: config.rc.version, ext: 'jar'
*/
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
embedded files('libs/OpenComputers-JNLua.jar', 'libs/OpenComputers-LuaJ.jar')
@ -170,8 +173,43 @@ dependencies {
idea.module.scopes.PROVIDED.plus += configurations.provided
eclipse.classpath.plusConfigurations += configurations.provided
sourceSets {
main {
scala {
srcDir 'src'
exclude 'li/cil/oc/integration/appeng/**'
exclude 'li/cil/oc/integration/buildcraft/**'
exclude 'li/cil/oc/integration/cofh/**'
exclude 'li/cil/oc/integration/computercraft/**'
exclude 'li/cil/oc/integration/enderstorage/**'
exclude 'li/cil/oc/integration/fmp/**'
exclude 'li/cil/oc/integration/forestry/**'
exclude 'li/cil/oc/integration/gregtech/**'
exclude 'li/cil/oc/integration/ic2/**'
exclude 'li/cil/oc/integration/mfr/**'
exclude 'li/cil/oc/integration/mystcraft/**'
exclude 'li/cil/oc/integration/nei/**'
exclude 'li/cil/oc/integration/railcraft/**'
exclude 'li/cil/oc/integration/stargatetech2/**'
exclude 'li/cil/oc/integration/tcon/**'
exclude 'li/cil/oc/integration/thermalexpansion/**'
exclude 'li/cil/oc/integration/thaumcraft/**'
exclude 'li/cil/oc/integration/tmechworks/**'
exclude 'li/cil/oc/integration/versionchecker/**'
exclude 'li/cil/oc/integration/waila/**'
exclude 'li/cil/oc/integration/wrcbe/**'
exclude 'li/cil/oc/integration/wrsve/**'
}
}
}
minecraft {
version = "${config.minecraft.version}-${config.forge.version}"
runDir = "run"
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
mappings = "snapshot_20141130"
replaceIn "li/cil/oc/OpenComputers.scala"
replace "@VERSION@", project.simpleVersion

View File

@ -1,7 +1,7 @@
minecraft.version=1.7.10
forge.version=10.13.2.1236
minecraft.version=1.8
forge.version=11.14.0.1280-1.8
oc.version=1.4.3
oc.version=2.0.0
oc.subversion=dev
ae2.version=rv1-stable-1

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Fri Mar 07 00:48:03 EST 2014
#Wed Jul 02 15:54:47 CDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip

View File

@ -5,6 +5,7 @@ import li.cil.oc.api.driver.Converter;
import li.cil.oc.api.driver.EnvironmentHost;
import li.cil.oc.api.driver.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.Collection;
@ -86,14 +87,12 @@ public final class Driver {
* get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}.
*
* @param world the world containing the block.
* @param x the X coordinate of the block.
* @param y the Y coordinate of the block.
* @param z the Z coordinate of the block.
* @param pos the position of the block.
* @return a driver for the block, or <tt>null</tt> if there is none.
*/
public static Block driverFor(World world, int x, int y, int z) {
public static Block driverFor(World world, BlockPos pos) {
if (API.driver != null)
return API.driver.driverFor(world, x, y, z);
return API.driver.driverFor(world, pos);
return null;
}

View File

@ -107,24 +107,6 @@ public final class FileSystem {
return null;
}
/**
* Creates a new file system based on a ComputerCraft mount.
* <p/>
* This supports read-only and writable mounts from either CC 1.5x or
* CC 1.6x. The argument is kept untyped to avoid having the OC API
* depend on the CC API.
* <p/>
* If the passed type is unsupported, this will throw an exception.
*
* @param mount the mount to wrap with a file system.
* @return a file system wrapping the specified mount.
*/
public static li.cil.oc.api.fs.FileSystem fromComputerCraft(final Object mount) {
if (API.fileSystem != null)
return API.fileSystem.fromComputerCraft(mount);
return null;
}
/**
* Creates a network node that makes the specified file system available via
* the common file system driver.

View File

@ -1,7 +1,7 @@
package li.cil.oc.api.component;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import li.cil.oc.api.Persistable;
import li.cil.oc.api.network.ManagedEnvironment;
import net.minecraft.entity.player.EntityPlayer;

View File

@ -5,7 +5,7 @@
* components, which would otherwise require reflection or linking against the
* mod itself.
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Component",
apiVersion = API.VERSION)

View File

@ -5,6 +5,7 @@ import li.cil.oc.api.driver.Converter;
import li.cil.oc.api.driver.EnvironmentHost;
import li.cil.oc.api.driver.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.Collection;
@ -60,12 +61,10 @@ public interface DriverAPI {
* get actual instances of drivers registered via {@link #add(li.cil.oc.api.driver.Block)}.
*
* @param world the world containing the block.
* @param x the X coordinate of the block.
* @param y the Y coordinate of the block.
* @param z the Z coordinate of the block.
* @param pos the position of the block.
* @return a driver for the block, or <tt>null</tt> if there is none.
*/
Block driverFor(World world, int x, int y, int z);
Block driverFor(World world, BlockPos pos);
/**
* Looks up a driver for the specified item stack.

View File

@ -67,20 +67,6 @@ public interface FileSystemAPI {
*/
FileSystem fromMemory(long capacity);
/**
* Creates a new file system based on a read-only ComputerCraft mount.
* <p/>
* This supports read-only and writable mounts from either CC 1.5x or
* CC 1.6x. The argument is kept untyped to avoid having the OC API
* depend on the CC API.
* <p/>
* If the passed type is unsupported, this will return <tt>null</tt>.
*
* @param mount the mount to wrap with a file system.
* @return a file system wrapping the specified mount.
*/
FileSystem fromComputerCraft(Object mount);
/**
* Creates a network node that makes the specified file system available via
* the common file system driver.

View File

@ -1,6 +1,7 @@
package li.cil.oc.api.driver;
import li.cil.oc.api.network.ManagedEnvironment;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
/**
@ -32,12 +33,10 @@ public interface Block {
* can force this by sending a neighbor block change notification.
*
* @param world the world in which the block to check lives.
* @param x the X coordinate of the block to check.
* @param y the Y coordinate of the block to check.
* @param z the Z coordinate of the block to check.
* @param pos the position coordinate of the block to check.
* @return <tt>true</tt> if the block is supported; <tt>false</tt> otherwise.
*/
boolean worksWith(World world, int x, int y, int z);
boolean worksWith(World world, BlockPos pos);
/**
* Create a new managed environment interfacing the specified block.
@ -53,10 +52,8 @@ public interface Block {
* <tt>Adapter</tt> block that caused its creation.
*
* @param world the world containing the block to get the environment for.
* @param x the X coordinate of the block to get the environment for.
* @param y the Y coordinate of the block to get the environment for.
* @param z the Z coordinate of the block to get the environment for.
* @param pos the position of the block to get the environment for.
* @return the environment for the block at that location.
*/
ManagedEnvironment createEnvironment(World world, int x, int y, int z);
ManagedEnvironment createEnvironment(World world, BlockPos pos);
}

View File

@ -15,7 +15,7 @@ package li.cil.oc.api.driver;
* suppress inventory functionality if your TileEntity implements IInventory.
* <p/>
* To do so, implement this interface in the <em>environment</em> that you
* return from your driver's {@link Block#createEnvironment(net.minecraft.world.World, int, int, int)}
* return from your driver's {@link Block#createEnvironment(net.minecraft.world.World, net.minecraft.util.BlockPos)}
* method, and provide the names of the allowed methods from {@link #whitelistedMethods()}.
* <p/>
* <em>Important</em>: if multiple drivers apply to a single block that each

View File

@ -7,7 +7,7 @@ package li.cil.oc.api.driver;
* <p/>
* 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, int, int, int)}
* {@link Block#createEnvironment(net.minecraft.world.World, net.minecraft.util.BlockPos)}
* method instead.
*/
public interface NamedBlock {

View File

@ -4,7 +4,7 @@
* These interfaces allow specializing item drivers to provide static data,
* that is without creating an actual environment.
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Driver|Item",
apiVersion = API.VERSION)

View File

@ -4,7 +4,7 @@
* Drivers are used to add items and third party blocks to the internal network,
* which is mostly used to make components wrapping them available to computers.
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Driver",
apiVersion = API.VERSION)

View File

@ -1,7 +1,7 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import li.cil.oc.api.network.Node;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@ -44,10 +44,10 @@ public class FileSystemAccessEvent extends Event {
*/
protected FileSystemAccessEvent(String sound, TileEntity tileEntity, NBTTagCompound data) {
this.sound = sound;
this.world = tileEntity.getWorldObj();
this.x = tileEntity.xCoord + 0.5;
this.y = tileEntity.yCoord + 0.5;
this.z = tileEntity.zCoord + 0.5;
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;
}

View File

@ -1,9 +1,9 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
import li.cil.oc.api.driver.EnvironmentHost;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import java.util.HashMap;
import java.util.Map;
@ -73,14 +73,14 @@ public abstract class GeolyzerEvent extends Event {
/**
* The side of the geolyzer on which the block to scan is located.
*/
public final ForgeDirection side;
public final EnumFacing side;
/**
* The retrieved data for the block being scanned.
*/
public final Map<String, Object> data = new HashMap<String, Object>();
public Analyze(EnvironmentHost host, Map<?, ?> options, ForgeDirection side) {
public Analyze(EnvironmentHost host, Map<?, ?> options, EnumFacing side) {
super(host, options);
this.side = side;
}

View File

@ -1,6 +1,6 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import li.cil.oc.api.internal.Robot;
import net.minecraft.entity.Entity;

View File

@ -1,8 +1,9 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import li.cil.oc.api.internal.Robot;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
public abstract class RobotBreakBlockEvent extends RobotEvent {
protected RobotBreakBlockEvent(Robot robot) {
@ -24,19 +25,17 @@ public abstract class RobotBreakBlockEvent extends RobotEvent {
/**
* The coordinates at which the block will be broken.
*/
public final int x, y, z;
public final BlockPos pos;
/**
* The time it takes to break the block.
*/
private double breakTime;
public Pre(Robot robot, World world, int x, int y, int z, double breakTime) {
public Pre(Robot robot, World world, BlockPos pos, double breakTime) {
super(robot);
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.pos = pos;
this.breakTime = breakTime;
}

View File

@ -1,6 +1,6 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Event;
import li.cil.oc.api.internal.Robot;
/**

View File

@ -1,16 +1,16 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import li.cil.oc.api.internal.Robot;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public abstract class RobotMoveEvent extends RobotEvent {
/**
* The direction in which the robot will be moving.
*/
public final ForgeDirection direction;
public final EnumFacing direction;
protected RobotMoveEvent(Robot robot, ForgeDirection direction) {
protected RobotMoveEvent(Robot robot, EnumFacing direction) {
super(robot);
this.direction = direction;
}
@ -22,7 +22,7 @@ public abstract class RobotMoveEvent extends RobotEvent {
*/
@Cancelable
public static class Pre extends RobotMoveEvent {
public Pre(Robot robot, ForgeDirection direction) {
public Pre(Robot robot, EnumFacing direction) {
super(robot, direction);
}
}
@ -31,7 +31,7 @@ public abstract class RobotMoveEvent extends RobotEvent {
* Fired after a robot moved.
*/
public static class Post extends RobotMoveEvent {
public Post(Robot robot, ForgeDirection direction) {
public Post(Robot robot, EnumFacing direction) {
super(robot, direction);
}
}

View File

@ -1,6 +1,7 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import li.cil.oc.api.internal.Robot;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
@ -19,15 +20,13 @@ public abstract class RobotPlaceBlockEvent extends RobotEvent {
/**
* The coordinates at which the block will be placed.
*/
public final int x, y, z;
public final BlockPos pos;
protected RobotPlaceBlockEvent(Robot robot, ItemStack stack, World world, int x, int y, int z) {
protected RobotPlaceBlockEvent(Robot robot, ItemStack stack, World world, BlockPos pos) {
super(robot);
this.stack = stack;
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.pos = pos;
}
/**
@ -37,8 +36,8 @@ public abstract class RobotPlaceBlockEvent extends RobotEvent {
*/
@Cancelable
public static class Pre extends RobotPlaceBlockEvent {
public Pre(Robot robot, ItemStack stack, World world, int x, int y, int z) {
super(robot, stack, world, x, y, z);
public Pre(Robot robot, ItemStack stack, World world, BlockPos pos) {
super(robot, stack, world, pos);
}
}
@ -46,8 +45,8 @@ public abstract class RobotPlaceBlockEvent extends RobotEvent {
* Fired after a robot placed a block.
*/
public static class Post extends RobotPlaceBlockEvent {
public Post(Robot robot, ItemStack stack, World world, int x, int y, int z) {
super(robot, stack, world, x, y, z);
public Post(Robot robot, ItemStack stack, World world, BlockPos pos) {
super(robot, stack, world, pos);
}
}
}

View File

@ -1,6 +1,6 @@
package li.cil.oc.api.event;
import cpw.mods.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import li.cil.oc.api.internal.Robot;
import org.lwjgl.util.vector.Vector3f;
import org.lwjgl.util.vector.Vector4f;

View File

@ -2,7 +2,7 @@
* Events dispatched by OpenComputers to allow other mods to hook into some
* of its functionality.
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Event",
apiVersion = API.VERSION)

View File

@ -13,7 +13,7 @@
* that can be added as component nodes to the network, so they can be used
* from computers).
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|FileSystem",
apiVersion = API.VERSION)

View File

@ -1,5 +1,7 @@
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.
@ -14,12 +16,12 @@ public interface Colored {
*
* @return the current color value.
*/
int getColor();
EnumDyeColor getColor();
/**
* Set the color value.
*
* @param value the new color value.
*/
void setColor(int value);
void setColor(EnumDyeColor value);
}

View File

@ -1,6 +1,6 @@
package li.cil.oc.api.internal;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
/**
* This interface is implemented by the computer case and robot tile entities
@ -31,7 +31,7 @@ public interface Rotatable {
*
* @return the current facing.
*/
ForgeDirection facing();
EnumFacing facing();
/**
* Converts a facing relative to the block's <em>local</em> coordinate
@ -44,7 +44,7 @@ public interface Rotatable {
* @param value the value to translate.
* @return the translated orientation.
*/
ForgeDirection toGlobal(ForgeDirection value);
EnumFacing toGlobal(EnumFacing value);
/**
* Converts a <tt>global</tt> orientation to a facing relative to the
@ -57,5 +57,5 @@ public interface Rotatable {
* @param value the value to translate.
* @return the translated orientation.
*/
ForgeDirection toLocal(ForgeDirection value);
EnumFacing toLocal(EnumFacing value);
}

View File

@ -13,7 +13,7 @@
* used inside the specified environment (where the environment class may
* be assignable to one of the interfaces in this package).
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Internal",
apiVersion = API.VERSION)

View File

@ -16,7 +16,7 @@
* implemented, but merely to allow accessing some mod internals in a regulated
* fashion, such as {@link li.cil.oc.api.internal.Robot}.
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Machine",
apiVersion = API.VERSION)

View File

@ -1,6 +1,7 @@
package li.cil.oc.api.network;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
/**
* Allows defining a callback for when a block is right-clicked with an
@ -30,5 +31,5 @@ public interface Analyzable {
* @return the nodes to display information for, usually an environment's
* main node (i.e. <tt>this.node()</tt>).
*/
Node[] onAnalyze(EntityPlayer player, int side, float hitX, float hitY, float hitZ);
Node[] onAnalyze(EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ);
}

View File

@ -1,9 +1,9 @@
package li.cil.oc.api.network;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
/**
* This interface is like {@link net.minecraft.inventory.ISidedInventory} is to
@ -32,7 +32,7 @@ public interface SidedEnvironment {
* @return the node for the specified side.
* @see li.cil.oc.api.network.Environment#node
*/
Node sidedNode(ForgeDirection side);
Node sidedNode(EnumFacing side);
/**
* Whether the environment provides a node to connect to on the specified
@ -51,5 +51,5 @@ public interface SidedEnvironment {
* @return whether the environment provides a node for the specified side.
*/
@SideOnly(Side.CLIENT)
boolean canConnect(ForgeDirection side);
boolean canConnect(EnumFacing side);
}

View File

@ -4,7 +4,7 @@
* This mainly involves the (purely server-side!) network that is spanned over
* all of OpenComputers' components, including blocks and items alike.
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Network",
apiVersion = API.VERSION)

View File

@ -34,7 +34,7 @@
* </dd>
* </dl>
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Core",
apiVersion = API.VERSION)

View File

@ -1,8 +1,10 @@
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.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
@ -29,15 +31,17 @@ public abstract class DriverBlock implements li.cil.oc.api.driver.Block {
}
@Override
public boolean worksWith(final World world, final int x, final int y, final int z) {
return worksWith(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
public boolean worksWith(final World world, final BlockPos pos) {
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.field_150939_a;
final Block supportedBlock = item.getBlock();
final int supportedMetadata = item.getMetadata(stack.getItemDamage());
if (referenceBlock == supportedBlock && (referenceMetadata == supportedMetadata || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE)) {
return true;

View File

@ -1,20 +1,21 @@
package li.cil.oc.api.prefab;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public abstract class DriverTileEntity implements li.cil.oc.api.driver.Block {
public abstract Class<?> getTileEntityClass();
@Override
public boolean worksWith(final World world, final int x, final int y, final int z) {
public boolean worksWith(final World world, final BlockPos pos) {
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(x, y, z);
final TileEntity tileEntity = world.getTileEntity(pos);
return tileEntity != null && filter.isAssignableFrom(tileEntity.getClass());
}
}

View File

@ -6,6 +6,7 @@ import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
import li.cil.oc.api.network.Visibility;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
/**
@ -17,7 +18,7 @@ import net.minecraft.tileentity.TileEntity;
* network as an index structure to find other nodes connected to them.
*/
@SuppressWarnings("UnusedDeclaration")
public abstract class TileEntityEnvironment extends TileEntity implements Environment {
public abstract class TileEntityEnvironment extends TileEntity implements Environment, IUpdatePlayerListBox {
/**
* This must be set in subclasses to the node that is used to represent
* this tile entity.
@ -96,8 +97,7 @@ public abstract class TileEntityEnvironment extends TileEntity implements Enviro
// ----------------------------------------------------------------------- //
@Override
public void updateEntity() {
super.updateEntity();
public void update() {
// On the first update, try to add our node to nearby networks. We do
// this in the update logic, not in validate() because we need to access
// neighboring tile entities, which isn't possible in validate().

View File

@ -4,8 +4,9 @@ import li.cil.oc.api.Network;
import li.cil.oc.api.network.Node;
import li.cil.oc.api.network.SidedEnvironment;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
/**
* TileEntities can implement the {@link li.cil.oc.api.network.SidedEnvironment}
@ -18,7 +19,7 @@ import net.minecraftforge.common.util.ForgeDirection;
* network as an index structure to find other nodes connected to them.
*/
@SuppressWarnings("UnusedDeclaration")
public abstract class TileEntitySidedEnvironment extends TileEntity implements SidedEnvironment {
public abstract class TileEntitySidedEnvironment extends TileEntity implements SidedEnvironment, IUpdatePlayerListBox {
// See constructor.
protected Node[] nodes = new Node[6];
@ -71,15 +72,14 @@ public abstract class TileEntitySidedEnvironment extends TileEntity implements S
// exists for a side won't work on the client.
@Override
public Node sidedNode(final ForgeDirection side) {
return side == ForgeDirection.UNKNOWN ? null : nodes[side.ordinal()];
public Node sidedNode(final EnumFacing side) {
return nodes[side.ordinal()];
}
// ----------------------------------------------------------------------- //
@Override
public void updateEntity() {
super.updateEntity();
public void update() {
// On the first update, try to add our node to nearby networks. We do
// this in the update logic, not in validate() because we need to access
// neighboring tile entities, which isn't possible in validate().

View File

@ -7,7 +7,7 @@
* while leaving them in the same package with the same name and then ship them
* with your mod!
*/
@cpw.mods.fml.common.API(
@net.minecraftforge.fml.common.API(
owner = API.ID_OWNER,
provides = "OpenComputersAPI|Prefab",
apiVersion = API.VERSION)

View File

@ -1,7 +1,7 @@
package li.cil.oc.common.asm;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import li.cil.oc.api.Network;
import li.cil.oc.util.SideTracker;
import net.minecraft.tileentity.TileEntity;

View File

@ -1,6 +1,6 @@
package li.cil.oc.util;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLCommonHandler;
import java.util.Collections;
import java.util.Set;

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:accessPoint" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:adapter" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:capacitor" }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:case" },
"facing=south": { "model": "opencomputers:case", "y": 180 },
"facing=west": { "model": "opencomputers:case", "y": 270 },
"facing=east": { "model": "opencomputers:case", "y": 90 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:case" },
"facing=south": { "model": "opencomputers:case", "y": 180 },
"facing=west": { "model": "opencomputers:case", "y": 270 },
"facing=east": { "model": "opencomputers:case", "y": 90 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:case" },
"facing=south": { "model": "opencomputers:case", "y": 180 },
"facing=west": { "model": "opencomputers:case", "y": 270 },
"facing=east": { "model": "opencomputers:case", "y": 90 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:case" },
"facing=south": { "model": "opencomputers:case", "y": 180 },
"facing=west": { "model": "opencomputers:case", "y": 270 },
"facing=east": { "model": "opencomputers:case", "y": 90 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:charger" },
"facing=south": { "model": "opencomputers:charger", "y": 180 },
"facing=west": { "model": "opencomputers:charger", "y": 270 },
"facing=east": { "model": "opencomputers:charger", "y": 90 }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:disassembler" }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:diskDrive" },
"facing=south": { "model": "opencomputers:diskDrive", "y": 180 },
"facing=west": { "model": "opencomputers:diskDrive", "y": 270 },
"facing=east": { "model": "opencomputers:diskDrive", "y": 90 }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:geolyzer" }
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"facing=north,up=up": { "model": "opencomputers:keyboard" },
"facing=south,up=up": { "model": "opencomputers:keyboard", "y": 180 },
"facing=west,up=up": { "model": "opencomputers:keyboard", "y": 270 },
"facing=east,up=up": { "model": "opencomputers:keyboard", "y": 90 },
"facing=up,up=north": { "model": "opencomputers:keyboard", "x": 90 },
"facing=up,up=south": { "model": "opencomputers:keyboard", "x": 90, "y": 180 },
"facing=up,up=east": { "model": "opencomputers:keyboard", "x": 90, "y": 270 },
"facing=up,up=west": { "model": "opencomputers:keyboard", "x": 90, "y": 90 },
"facing=down,up=north": { "model": "opencomputers:keyboard", "x": -90 },
"facing=down,up=south": { "model": "opencomputers:keyboard", "x": -90, "y": 180 },
"facing=down,up=east": { "model": "opencomputers:keyboard", "x": -90, "y": 270 },
"facing=down,up=west": { "model": "opencomputers:keyboard", "x": -90, "y": 90 }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:microcontroller" },
"facing=south": { "model": "opencomputers:microcontroller", "y": 180 },
"facing=west": { "model": "opencomputers:microcontroller", "y": 270 },
"facing=east": { "model": "opencomputers:microcontroller", "y": 90 }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:motionSensor" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:powerConverter" }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:powerDistributor" }
}
}

View File

@ -0,0 +1,8 @@
{
"variants": {
"facing=north": { "model": "opencomputers:raid" },
"facing=south": { "model": "opencomputers:raid", "y": 180 },
"facing=west": { "model": "opencomputers:raid", "y": 270 },
"facing=east": { "model": "opencomputers:raid", "y": 90 }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:redstone" }
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"facing=north,up=up": { "model": "opencomputers:screen" },
"facing=south,up=up": { "model": "opencomputers:screen", "y": 180 },
"facing=west,up=up": { "model": "opencomputers:screen", "y": 270 },
"facing=east,up=up": { "model": "opencomputers:screen", "y": 90 },
"facing=up,up=north": { "model": "opencomputers:screen", "x": 90 },
"facing=up,up=south": { "model": "opencomputers:screen", "x": 90, "y": 180 },
"facing=up,up=east": { "model": "opencomputers:screen", "x": 90, "y": 270 },
"facing=up,up=west": { "model": "opencomputers:screen", "x": 90, "y": 90 },
"facing=down,up=north": { "model": "opencomputers:screen", "x": -90 },
"facing=down,up=south": { "model": "opencomputers:screen", "x": -90, "y": 180 },
"facing=down,up=east": { "model": "opencomputers:screen", "x": -90, "y": 270 },
"facing=down,up=west": { "model": "opencomputers:screen", "x": -90, "y": 90 }
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"facing=north,up=up": { "model": "opencomputers:screen" },
"facing=south,up=up": { "model": "opencomputers:screen", "y": 180 },
"facing=west,up=up": { "model": "opencomputers:screen", "y": 270 },
"facing=east,up=up": { "model": "opencomputers:screen", "y": 90 },
"facing=up,up=north": { "model": "opencomputers:screen", "x": 90 },
"facing=up,up=south": { "model": "opencomputers:screen", "x": 90, "y": 180 },
"facing=up,up=east": { "model": "opencomputers:screen", "x": 90, "y": 270 },
"facing=up,up=west": { "model": "opencomputers:screen", "x": 90, "y": 90 },
"facing=down,up=north": { "model": "opencomputers:screen", "x": -90 },
"facing=down,up=south": { "model": "opencomputers:screen", "x": -90, "y": 180 },
"facing=down,up=east": { "model": "opencomputers:screen", "x": -90, "y": 270 },
"facing=down,up=west": { "model": "opencomputers:screen", "x": -90, "y": 90 }
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"facing=north,up=up": { "model": "opencomputers:screen" },
"facing=south,up=up": { "model": "opencomputers:screen", "y": 180 },
"facing=west,up=up": { "model": "opencomputers:screen", "y": 270 },
"facing=east,up=up": { "model": "opencomputers:screen", "y": 90 },
"facing=up,up=north": { "model": "opencomputers:screen", "x": 90 },
"facing=up,up=south": { "model": "opencomputers:screen", "x": 90, "y": 180 },
"facing=up,up=east": { "model": "opencomputers:screen", "x": 90, "y": 270 },
"facing=up,up=west": { "model": "opencomputers:screen", "x": 90, "y": 90 },
"facing=down,up=north": { "model": "opencomputers:screen", "x": -90 },
"facing=down,up=south": { "model": "opencomputers:screen", "x": -90, "y": 180 },
"facing=down,up=east": { "model": "opencomputers:screen", "x": -90, "y": 270 },
"facing=down,up=west": { "model": "opencomputers:screen", "x": -90, "y": 90 }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "opencomputers:switch" }
}
}

View File

@ -40,7 +40,7 @@ do
local w, h
if gpu and screen then
component.invoke(gpu, "bind", screen)
w, h = component.invoke(gpu, "getResolution")
w, h = component.invoke(gpu, "maxResolution")
component.invoke(gpu, "setResolution", w, h)
component.invoke(gpu, "setBackground", 0x000000)
component.invoke(gpu, "setForeground", 0xFFFFFF)

View File

@ -0,0 +1,6 @@
{
"parent": "opencomputers:block/switch",
"textures": {
"top": "opencomputers:blocks/accessPoint_top"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"bottom": "opencomputers:blocks/generic_top",
"top": "opencomputers:blocks/adapter_top",
"side": "opencomputers:blocks/adapter_side"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"bottom": "opencomputers:blocks/generic_top",
"top": "opencomputers:blocks/capacitor_top",
"side": "opencomputers:blocks/capacitor_side"
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "block/orientable",
"textures": {
"top": "opencomputers:blocks/case_top",
"bottom": "opencomputers:blocks/case_top",
"side": "opencomputers:blocks/case_side",
"south": "opencomputers:blocks/case_back",
"front": "opencomputers:blocks/case_front"
}
}

View File

@ -0,0 +1,9 @@
{
"parent": "block/orientable",
"textures": {
"bottom": "opencomputers:blocks/generic_top",
"top": "opencomputers:blocks/generic_top",
"side": "opencomputers:blocks/charger_side",
"front": "opencomputers:blocks/charger_front"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"bottom": "opencomputers:blocks/generic_top",
"top": "opencomputers:blocks/disassembler_top",
"side": "opencomputers:blocks/disassembler_side"
}
}

View File

@ -0,0 +1,9 @@
{
"parent": "block/orientable",
"textures": {
"top": "opencomputers:blocks/generic_top",
"bottom": "opencomputers:blocks/generic_top",
"side": "opencomputers:blocks/diskDrive_side",
"front": "opencomputers:blocks/diskDrive_front"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"top": "opencomputers:blocks/geolyzer_top",
"bottom": "opencomputers:blocks/generic_top",
"side": "opencomputers:blocks/geolyzer_side"
}
}

View File

@ -0,0 +1,18 @@
{
"textures": {
"all": "opencomputers:blocks/keyboard"
},
"elements": [
{ "from": [ 1, 0, 4 ],
"to": [ 15, 1, 12 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#all" }
}
}
]
}

View File

@ -0,0 +1,9 @@
{
"parent": "block/orientable",
"textures": {
"top": "opencomputers:blocks/microcontroller_top",
"bottom": "opencomputers:blocks/microcontroller_top",
"side": "opencomputers:blocks/microcontroller_side",
"front": "opencomputers:blocks/microcontroller_front"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "opencomputers:blocks/motionSensor_top",
"side": "opencomputers:blocks/motionSensor_side"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "opencomputers:blocks/generic_top",
"side": "opencomputers:blocks/powerConverter_side"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"top": "opencomputers:blocks/powerDistributor_top",
"bottom": "opencomputers:blocks/generic_top",
"side": "opencomputers:blocks/powerDistributor_side"
}
}

View File

@ -0,0 +1,9 @@
{
"parent": "block/orientable",
"textures": {
"top": "opencomputers:blocks/generic_top",
"bottom": "opencomputers:blocks/generic_top",
"side": "opencomputers:blocks/raid_side",
"front": "opencomputers:blocks/raid_front"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "opencomputers:blocks/redstone_top",
"side": "opencomputers:blocks/redstone_side"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/orientable",
"textures": {
"top": "opencomputers:blocks/screen_side",
"side": "opencomputers:blocks/screen_side",
"front": "opencomputers:blocks/screen_front"
}
}

View File

@ -0,0 +1,8 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"top": "opencomputers:blocks/switch_top",
"bottom": "opencomputers:blocks/generic_top",
"side": "opencomputers:blocks/switch_side"
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/accessPoint",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/adapter",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/assembler",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/capacitor",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/case",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/case",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/case",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/case",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/charger",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/disassembler",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/diskDrive",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/geolyzer",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/microcontroller",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/motionSensor",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/powerConverter",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/powerDistributor",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/raid",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/redstone",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/screen",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "opencomputers:block/screen",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

Some files were not shown because too many files have changed in this diff Show More