mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
added MassFab and Lamp
This commit is contained in:
parent
8da6b4bd98
commit
704bb64ce1
40
src/main/java/li/cil/occ/mods/ic2/DriverMassFab.java
Normal file
40
src/main/java/li/cil/occ/mods/ic2/DriverMassFab.java
Normal file
@ -0,0 +1,40 @@
|
||||
package li.cil.occ.mods.ic2;
|
||||
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import li.cil.oc.api.network.Arguments;
|
||||
import li.cil.oc.api.network.Callback;
|
||||
import li.cil.oc.api.network.Context;
|
||||
import li.cil.oc.api.prefab.DriverTileEntity;
|
||||
import li.cil.oc.api.prefab.ManagedEnvironment;
|
||||
import li.cil.occ.mods.ManagedTileEntityEnvironment;
|
||||
import li.cil.occ.util.Reflection;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DriverMassFab extends DriverTileEntity {
|
||||
private static final Class<?> TileController = Reflection.getClass("ic2.core.block.machine.tileentity.TileEntityMatter");
|
||||
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return TileController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
|
||||
return new Environment(world.getBlockTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static final class Environment extends ManagedTileEntityEnvironment<TileEntity> {
|
||||
public Environment(final TileEntity tileEntity) {
|
||||
super(tileEntity, "mass_fab");
|
||||
}
|
||||
|
||||
@Callback
|
||||
public Object[] getProgress(final Context context, final Arguments args) {
|
||||
double energy = (Double) Reflection.get(tileEntity, "energy");
|
||||
return new Object[]{Math.min(energy / 100000, 100)};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ public final class ModIndustrialCraft2 implements IMod {
|
||||
Driver.add(new DriverEnergyConductor());
|
||||
Driver.add(new DriverEnergySink());
|
||||
Driver.add(new DriverEnergySource());
|
||||
Driver.add(new DriverMassFab());
|
||||
Driver.add(new DriverEnergyStorage());
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
package li.cil.occ.mods.thermalexpansion;
|
||||
|
||||
|
||||
import li.cil.oc.api.network.Arguments;
|
||||
import li.cil.oc.api.network.Callback;
|
||||
import li.cil.oc.api.network.Context;
|
||||
import li.cil.oc.api.prefab.DriverTileEntity;
|
||||
import li.cil.oc.api.prefab.ManagedEnvironment;
|
||||
import li.cil.occ.mods.ManagedTileEntityEnvironment;
|
||||
import li.cil.occ.util.Reflection;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DriverLamp extends DriverTileEntity {
|
||||
private static final Class<?> TileLamp = Reflection.getClass("thermalexpansion.block.lamp.TileLamp");
|
||||
|
||||
@Override
|
||||
public Class<?> getTileEntityClass() {
|
||||
return TileLamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedEnvironment createEnvironment(final World world, final int x, final int y, final int z) {
|
||||
return new Environment(world.getBlockTileEntity(x, y, z));
|
||||
}
|
||||
|
||||
public static final class Environment extends ManagedTileEntityEnvironment<TileEntity> {
|
||||
public Environment(final TileEntity tileEntity) {
|
||||
super(tileEntity, "Lamp");
|
||||
}
|
||||
|
||||
@Callback
|
||||
public Object[] setColor(final Context context, final Arguments args) {
|
||||
try {
|
||||
return new Object[]{Reflection.invoke(tileEntity, "setColor", args.checkInteger(0))};
|
||||
} catch (Throwable t) {
|
||||
return new Object[]{null, "Error"};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@ public final class ModThermalExpansion implements IMod {
|
||||
public void initialize() {
|
||||
Driver.add(new DriverEnderAttuned());
|
||||
Driver.add(new DriverEnergyHandler());
|
||||
Driver.add(new DriverLamp());
|
||||
Driver.add(new DriverEnergyInfo());
|
||||
Driver.add(new DriverRedstoneControl());
|
||||
Driver.add(new DriverSecureTile());
|
||||
|
Loading…
x
Reference in New Issue
Block a user