Merge branch '6.0.x' into 6.1.x

This commit is contained in:
SpaceToad 2014-05-09 18:18:23 +02:00
commit 515060fff3
34 changed files with 657 additions and 245 deletions

View file

@ -16,6 +16,9 @@ import java.util.Arrays;
import java.util.List;
public class JavaTools {
public static double bounds(double value, double min, double max) {
return Math.max(min, Math.min(value, max));
}
public static <T> T[] concat(T[] first, T[] second) {
T[] result = Arrays.copyOf(first, first.length + second.length);

View file

@ -0,0 +1,158 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.mj;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.logging.Level;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.JavaTools;
/**
* A battery object is a wrapper around a battery field in an object. This
* battery field is of type double, and is the only piece of data specific to
* this object. Others are class-wide.
*/
public class BatteryObject implements IBatteryObject {
protected Field energyStored;
protected Object obj;
protected MjBattery batteryData;
/**
* {@inheritDoc}
*/
@Override
public double getEnergyRequested() {
try {
return JavaTools.bounds(batteryData.maxCapacity() - energyStored.getDouble(obj),
batteryData.minimumConsumption(), batteryData.maxReceivedPerCycle());
} catch (IllegalAccessException e) {
BCLog.logger.log(Level.WARNING, "can't get energy requested", e);
}
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public double addEnergy(double mj) {
return addEnergy(mj, false);
}
/**
* {@inheritDoc}
*/
@Override
public double addEnergy(double mj, boolean ignoreCycleLimit) {
try {
double contained = energyStored.getDouble(obj);
double maxAccepted = batteryData.maxCapacity() - contained + batteryData.minimumConsumption();
if (!ignoreCycleLimit && maxAccepted > batteryData.maxReceivedPerCycle()) {
maxAccepted = batteryData.maxReceivedPerCycle();
}
double used = Math.min(maxAccepted, mj);
if (used > 0) {
energyStored.setDouble(obj, Math.min(contained + used, batteryData.maxCapacity()));
return used;
}
} catch (IllegalAccessException e) {
BCLog.logger.log(Level.WARNING, "can't add energy", e);
}
return 0;
}
/**
* {@inheritDoc}
*/
@Override
public double getEnergyStored() {
try {
return energyStored.getDouble(obj);
} catch (IllegalAccessException e) {
BCLog.logger.log(Level.WARNING, "can't get return energy stored", e);
return 0;
}
}
/**
* {@inheritDoc}
*/
@Override
public void setEnergyStored(double mj) {
try {
energyStored.setDouble(obj, mj);
} catch (IllegalAccessException e) {
BCLog.logger.log(Level.WARNING, "can't set energy stored", e);
throw new RuntimeException(e);
}
}
/**
* {@inheritDoc}
*/
@Override
public double maxCapacity() {
return batteryData.maxCapacity();
}
/**
* {@inheritDoc}
*/
@Override
public double minimumConsumption() {
return batteryData.minimumConsumption();
}
/**
* {@inheritDoc}
*/
@Override
public double maxReceivedPerCycle() {
return batteryData.maxReceivedPerCycle();
}
/**
* {@inheritDoc}
*/
@Override
public BatteryObject reconfigure(final double maxCapacity, final double maxReceivedPerCycle,
final double minimumConsumption) {
batteryData = new MjBattery() {
@Override
public double maxCapacity() {
return maxCapacity;
}
@Override
public double maxReceivedPerCycle() {
return maxReceivedPerCycle;
}
@Override
public double minimumConsumption() {
return minimumConsumption;
}
@Override
public Class<? extends Annotation> annotationType() {
return MjBattery.class;
}
@Override
public String kind() {
return MjAPI.DEFAULT_POWER_FRAMEWORK;
}
};
return this;
}
}

View file

@ -0,0 +1,78 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.mj;
public interface IBatteryObject {
/**
* @return Current energy requirement for keeping machine state
*/
double getEnergyRequested();
/**
* Add energy to this battery
*
* @param mj Energy amount
* @return Used energy
*/
double addEnergy(double mj);
/**
* Add energy to this battery
*
* @param mj Energy amount
* @param ignoreCycleLimit Force add all energy even if "maxReceivedPerCycle" limit is reached
* @return Used energy
*/
double addEnergy(double mj, boolean ignoreCycleLimit);
/**
* @return Current stored energy amount in this battery
*/
double getEnergyStored();
/**
* Set current stored energy amount.
* Doesn't use it for your machines! Decrease your battery field directly.
*
* @param mj New energy amount
*/
void setEnergyStored(double mj);
/**
* Can be overrided via {@link #reconfigure(double, double, double)}
*
* @return Maximal energy amount for this battery.
*/
double maxCapacity();
/**
* Can be overrided via {@link #reconfigure(double, double, double)}
*
* @return Minimal energy amount for keep your machine in active state
*/
double minimumConsumption();
/**
* Can be overrided via {@link #reconfigure(double, double, double)}
*
* @return Maximal energy received per one tick
*/
double maxReceivedPerCycle();
/**
* Allow to dynamically reconfigure your battery.
* Usually it's not very good change battery parameters for already present machines, but if you want...
*
* @param maxCapacity {@link #maxCapacity()}
* @param maxReceivedPerCycle {@link #maxReceivedPerCycle()}
* @param minimumConsumption {@link #minimumConsumption()}
* @return Current battery object instance
*/
IBatteryObject reconfigure(final double maxCapacity, final double maxReceivedPerCycle, final double minimumConsumption);
}

View file

@ -0,0 +1,13 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.mj;
public interface IBatteryProvider {
IBatteryObject getMjBattery();
}

View file

@ -8,17 +8,112 @@
*/
package buildcraft.api.mj;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import buildcraft.api.core.BCLog;
import buildcraft.api.core.JavaTools;
import buildcraft.api.power.PowerHandler;
/**
* The class MjAPI provides services to the Minecraft Joules power framework.
* BuildCraft implements a default power model on top of this, the "kinesis"
* power model. Third party mods may provide they own version of Minecraft
* Joules batteries and provide different models.
*/
public final class MjAPI {
public static final String DEFAULT_POWER_FRAMEWORK = "buildcraft.kinesis";
private static Map<Class, BatteryField> mjBatteries = new HashMap<Class, BatteryField>();
private static Map<String, Class<? extends BatteryObject>> mjBatteryKinds = new HashMap<String, Class<? extends BatteryObject>>();
static Map<Class, BatteryField> MjBatteries = new HashMap<Class, BatteryField>();
/**
* Deactivate constructor
*/
private MjAPI() {
}
/**
* Returns the default battery related to the object given in parameter. For
* performance optimization, it's good to cache this object in the providing
* power framework if possible.
*/
public static IBatteryObject getMjBattery(Object o) {
return getMjBattery(o, DEFAULT_POWER_FRAMEWORK);
}
/**
* Returns the battery related to the object given in parameter. For
* performance optimization, it's good to cache this object in the providing
* power framework if possible.
*/
public static IBatteryObject getMjBattery(Object o, String kind) {
if (o == null) {
return null;
}
if (o instanceof IBatteryProvider) {
IBatteryObject battery = ((IBatteryProvider) o).getMjBattery();
if (battery != null) {
return battery;
}
}
BatteryField f = getMjBatteryField(o.getClass());
if (f == null) {
return null;
} else if (!mjBatteryKinds.containsKey(kind)) {
return null;
} else if (f.kind == BatteryKind.Value) {
try {
BatteryObject obj = mjBatteryKinds.get(kind).newInstance();
obj.obj = o;
obj.energyStored = f.field;
obj.batteryData = f.battery;
return obj;
} catch (InstantiationException e) {
BCLog.logger.log(Level.WARNING, "can't instantiate class for energy kind \"" + kind + "\"");
return null;
} catch (IllegalAccessException e) {
BCLog.logger.log(Level.WARNING, "can't instantiate class for energy kind \"" + kind + "\"");
return null;
}
} else {
try {
return getMjBattery(f.field.get(o));
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
}
}
}
public static IBatteryObject[] getAllMjBatteries(Object o) {
IBatteryObject[] result = new IBatteryObject[mjBatteries.size()];
int id = 0;
for (String kind : mjBatteryKinds.keySet()) {
result[id] = getMjBattery(o, kind);
id++;
}
return result;
}
public static void registerMJBatteryKind(String kind, Class<? extends BatteryObject> clas) {
if (!mjBatteryKinds.containsKey(kind)) {
mjBatteryKinds.put(kind, clas);
} else {
BCLog.logger.log(Level.WARNING,
"energy kind \"" + kind + "\" already registered with " + clas.getCanonicalName());
}
}
private enum BatteryKind {
Value, Container
@ -30,147 +125,16 @@ public final class MjAPI {
public BatteryKind kind;
}
public static class BatteryObject {
Field f;
Object o;
MjBattery b;
private static BatteryField getMjBatteryField(Class c) {
BatteryField bField = mjBatteries.get(c);
public double getEnergyRequested() {
try {
double contained = f.getDouble(o);
double left = contained + b.maxReceivedPerCycle() > b
.maxCapacity() ? b.maxCapacity() - contained : b
.maxReceivedPerCycle();
if (left > 0) {
return left;
} else {
return b.minimumConsumption();
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return 0;
}
public double addEnergy(double watts) {
try {
double e = f.getDouble(o);
double max = b.maxCapacity();
double used = e + watts <= max ? watts : max - e;
f.setDouble(o, e + used);
return used;
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return 0;
}
public double getEnergyStored() {
try {
return f.getDouble(o);
} catch (IllegalAccessException e) {
e.printStackTrace();
return 0;
}
}
public void setEnergyStored(double watts) {
try {
f.setDouble(o, watts);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
public double maxCapacity() {
return b.maxCapacity();
}
public double minimumConsumption() {
return b.minimumConsumption();
}
public double maxReceivedPerCycle() {
return b.maxReceivedPerCycle();
}
public BatteryObject reconfigure(final double maxCapacity, final double maxReceivedPerCycle, final double minimumConsumption) {
b = new MjBattery() {
@Override
public double maxCapacity() {
return maxCapacity;
}
@Override
public double maxReceivedPerCycle() {
return maxReceivedPerCycle;
}
@Override
public double minimumConsumption() {
return minimumConsumption;
}
@Override
public Class<? extends Annotation> annotationType() {
return MjBattery.class;
}
};
return this;
}
}
/**
* Deactivate constructor
*/
private MjAPI() {
}
public static BatteryObject getMjBattery(Object o) {
if (o == null) {
return null;
}
if (o.getClass() == PowerHandler.class) {
return ((PowerHandler) o).getMjBattery();
}
BatteryField f = getMjBattery(o.getClass());
if (f == null) {
return null;
} else if (f.kind == BatteryKind.Value) {
BatteryObject obj = new BatteryObject();
obj.o = o;
obj.f = f.field;
obj.b = f.battery;
return obj;
} else {
try {
return getMjBattery(f.field.get(o));
} catch (IllegalAccessException e) {
e.printStackTrace();
return null;
}
}
}
private static BatteryField getMjBattery(Class c) {
if (!MjBatteries.containsKey(c)) {
if (bField == null) {
for (Field f : JavaTools.getAllFields(c)) {
MjBattery battery = f.getAnnotation(MjBattery.class);
if (battery != null) {
f.setAccessible(true);
BatteryField bField = new BatteryField();
bField = new BatteryField();
bField.field = f;
bField.battery = battery;
@ -183,18 +147,20 @@ public final class MjAPI {
bField.kind = BatteryKind.Container;
}
MjBatteries.put(c, bField);
mjBatteries.put(c, bField);
return bField;
}
}
MjBatteries.put(c, null);
return null;
} else {
return MjBatteries.get(c);
mjBatteries.put(c, null);
}
return bField;
}
static {
mjBatteryKinds.put(MjAPI.DEFAULT_POWER_FRAMEWORK, BatteryObject.class);
}
}

View file

@ -20,7 +20,7 @@ public class MjAPILegacy implements IPowerReceptor {
private final PowerHandler powerHandler;
private final World world;
protected MjAPILegacy(World world, MjAPI.BatteryObject battery, PowerHandler.Type type) {
protected MjAPILegacy(World world, IBatteryObject battery, PowerHandler.Type type) {
if (battery == null) {
throw new NullPointerException();
}
@ -28,7 +28,7 @@ public class MjAPILegacy implements IPowerReceptor {
this.powerHandler = new PowerHandler(this, type, battery);
}
public static MjAPILegacy from(World world, MjAPI.BatteryObject battery, PowerHandler.Type type) {
public static MjAPILegacy from(World world, IBatteryObject battery, PowerHandler.Type type) {
return new MjAPILegacy(world, battery, type);
}
@ -40,8 +40,8 @@ public class MjAPILegacy implements IPowerReceptor {
return new MjAPILegacy(tileEntity.getWorldObj(), battery(tileEntity), type);
}
private static MjAPI.BatteryObject battery(Object object) {
MjAPI.BatteryObject battery = MjAPI.getMjBattery(object);
private static IBatteryObject battery(Object object) {
IBatteryObject battery = MjAPI.getMjBattery(object);
if (battery == null) {
throw new IllegalArgumentException(String.format("Object %s not using MjAPI, can't create legacy wrapper", object));
}

View file

@ -17,12 +17,12 @@ import java.lang.annotation.Target;
/**
* This annotation is used for tiles that need to interface with BuildCraft
* energy framework, a.k.a MinecraftJoule or MJ. In order to receive power,
* tiles, need to declare a *public* double field, with the annotation
* tiles, need to declare a double field, with the annotation
* MjBattery. BuildCraft machines able to provide power will then connect to
* these tiles, and feed energy up to max capacity. It's the responsibilty
* these tiles, and feed energy up to max capacity. It's the responsibility
* of the implementer to manually decrease the value of the energy, as he
* simulates energy consumption. On each cycle, per power input, machines can
* receive up to "maxReceivedPerCyle" units of energy. As an optional behavior,
* receive up to "maxReceivedPerCycle" units of energy. As an optional behavior,
* the system can have a minimum amount of energy consumed even if the system
* is at max capacity, modelized by the "minimumConsumption" value.
*
@ -34,11 +34,25 @@ import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Inherited
public @interface MjBattery {
/**
* @return Max energy capacity of battery
*/
double maxCapacity() default 100.0;
/**
* @return Max energy received per one tick
*/
double maxReceivedPerCycle() default 10.0;
/**
* @return Minimal energy for keep machine is active
*/
double minimumConsumption() default 0.1;
/**
* @return The kind of battery stored. Specific power systems can be created
* through this system, as several battery of different kind can
* coexist in the same tile.
*/
String kind() default MjAPI.DEFAULT_POWER_FRAMEWORK;
}

View file

@ -13,6 +13,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.api.mj.BatteryObject;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.IBatteryProvider;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.mj.MjBattery;
@ -32,7 +35,7 @@ import buildcraft.api.mj.MjBattery;
* @see IPowerReceptor
* @see IPowerEmitter
*/
public final class PowerHandler {
public final class PowerHandler implements IBatteryProvider {
public static enum Type {
@ -132,7 +135,7 @@ public final class PowerHandler {
private PerditionCalculator perdition;
private final PowerReceiver receiver;
private final Type type;
private MjAPI.BatteryObject battery;
private IBatteryObject battery;
// Tracking
private double averageLostPower = 0;
private double averageReceivedPower = 0;
@ -148,8 +151,8 @@ public final class PowerHandler {
this.receiver = new PowerReceiver();
this.perdition = DEFAULT_PERDITION;
if (battery instanceof MjAPI.BatteryObject) {
this.battery = (MjAPI.BatteryObject) battery;
if (battery instanceof IBatteryObject) {
this.battery = (BatteryObject) battery;
} else if (battery != null) {
this.battery = MjAPI.getMjBattery(battery);
} else {
@ -181,7 +184,8 @@ public final class PowerHandler {
return battery.getEnergyStored();
}
public MjAPI.BatteryObject getMjBattery() {
@Override
public IBatteryObject getMjBattery() {
return battery;
}

View file

@ -247,6 +247,7 @@ public class BuildCraftBuilders extends BuildCraftMod {
SchematicRegistry.registerSchematicBlock(Blocks.snow, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.tallgrass, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.double_plant, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.ice, SchematicIgnore.class);
SchematicRegistry.registerSchematicBlock(Blocks.piston_head, SchematicIgnore.class);
@ -311,10 +312,10 @@ public class BuildCraftBuilders extends BuildCraftMod {
SchematicRegistry.registerSchematicBlock(Blocks.melon_stem, SchematicCustomStack.class, new ItemStack(Items.melon_seeds));
SchematicRegistry.registerSchematicBlock(Blocks.glowstone, SchematicCustomStack.class, new ItemStack(Blocks.glowstone));
SchematicRegistry.registerSchematicBlock(Blocks.powered_repeater, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicBlock(Blocks.unpowered_repeater, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicBlock(Blocks.powered_comparator, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicBlock(Blocks.unpowered_comparator, SchematicRedstoneDiode.class);
SchematicRegistry.registerSchematicBlock(Blocks.powered_repeater, SchematicRedstoneDiode.class, Items.repeater);
SchematicRegistry.registerSchematicBlock(Blocks.unpowered_repeater, SchematicRedstoneDiode.class, Items.repeater);
SchematicRegistry.registerSchematicBlock(Blocks.powered_comparator, SchematicRedstoneDiode.class, Items.comparator);
SchematicRegistry.registerSchematicBlock(Blocks.unpowered_comparator, SchematicRedstoneDiode.class, Items.comparator);
SchematicRegistry.registerSchematicBlock(Blocks.water, SchematicFluid.class, new ItemStack(Items.water_bucket));
SchematicRegistry.registerSchematicBlock(Blocks.flowing_water, SchematicFluid.class, new ItemStack(Items.water_bucket));
@ -528,4 +529,20 @@ public class BuildCraftBuilders extends BuildCraftMod {
UrbanistToolsIconProvider.INSTANCE.registerIcons(event.map);
}
}
@Mod.EventHandler
public void whiteListAppliedEnergetics(FMLInitializationEvent event) {
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileMarker.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileFiller.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileBuilder.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileArchitect.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TilePathMarker.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileBlueprintLibrary.class.getCanonicalName());
}
}

View file

@ -480,5 +480,4 @@ public class BuildCraftCore extends BuildCraftMod {
BuildcraftAchievements = new AchievementPage("Buildcraft", woodenGearAchievement, stoneGearAchievement, ironGearAchievement, goldGearAchievement, diamondGearAchievement, wrenchAchievement, engineAchievement1, engineAchievement2, engineAchievement3, aLotOfCraftingAchievement, straightDownAchievement, chunkDestroyerAchievement, fasterFillingAchievement, timeForSomeLogicAchievement, refineAndRedefineAchievement, tinglyLaserAchievement, architectAchievement, builderAchievement, blueprintAchievement, templateAchievement, libraryAchievement);
AchievementPage.registerAchievementPage(BuildcraftAchievements);
}
}

View file

@ -69,6 +69,7 @@ import buildcraft.energy.SchematicEngine;
import buildcraft.energy.TileEnergyConverter;
import buildcraft.energy.TileEnergyEmitter;
import buildcraft.energy.TileEnergyReceiver;
import buildcraft.energy.TileEngine;
import buildcraft.energy.TileEngine.EnergyStage;
import buildcraft.energy.triggers.TriggerEngineHeat;
import buildcraft.energy.worldgen.BiomeGenOilDesert;
@ -397,4 +398,10 @@ public class BuildCraftEnergy extends BuildCraftMod {
public void processIMCRequests(FMLInterModComms.IMCEvent event) {
InterModComms.processIMC(event);
}
@Mod.EventHandler
public void whiteListAppliedEnergetics(FMLInitializationEvent event) {
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileEngine.class.getCanonicalName());
}
}

View file

@ -333,4 +333,24 @@ public class BuildCraftFactory extends BuildCraftMod {
FactoryProxyClient.drillHeadTexture = terrainTextures.registerIcon("buildcraft:blockDrillHeadTexture");
}
}
@Mod.EventHandler
public void whiteListAppliedEnergetics(FMLInitializationEvent event) {
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileQuarry.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TileMiningWell.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileAutoWorkbench.class.getCanonicalName());
//FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
// TilePump.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileFloodGate.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileTank.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileRefinery.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileHopper.class.getCanonicalName());
}
}

View file

@ -192,4 +192,16 @@ public class BuildCraftSilicon extends BuildCraftMod {
public void processIMCRequests(FMLInterModComms.IMCEvent event) {
InterModComms.processIMC(event);
}
@Mod.EventHandler
public void whiteListAppliedEnergetics(FMLInitializationEvent event) {
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileLaser.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileAssemblyTable.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileAdvancedCraftingTable.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileIntegrationTable.class.getCanonicalName());
}
}

View file

@ -20,6 +20,7 @@ import net.minecraft.world.World;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@ -60,6 +61,8 @@ import buildcraft.transport.ItemRobotStation;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTriggerProvider;
import buildcraft.transport.TileFilteredBuffer;
import buildcraft.transport.TileGenericPipe;
import buildcraft.transport.TransportProxy;
import buildcraft.transport.WireIconProvider;
import buildcraft.transport.blueprints.BptItemPipeFilters;
@ -524,4 +527,12 @@ public class BuildCraftTransport extends BuildCraftMod {
return res;
}
@Mod.EventHandler
public void whiteListAppliedEnergetics(FMLInitializationEvent event) {
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileGenericPipe.class.getCanonicalName());
FMLInterModComms.sendMessage("appliedenergistics2", "whitelist-spatial",
TileFilteredBuffer.class.getCanonicalName());
}
}

View file

@ -43,7 +43,7 @@ public class GuiHandler implements IGuiHandler {
if (!(tile instanceof TileArchitect)) {
return null;
}
return new GuiArchitect(player.inventory, (TileArchitect) tile);
return new GuiArchitect(player, (TileArchitect) tile);
case GuiIds.BLUEPRINT_LIBRARY:
if (!(tile instanceof TileBlueprintLibrary)) {
@ -91,7 +91,7 @@ public class GuiHandler implements IGuiHandler {
if (!(tile instanceof TileArchitect)) {
return null;
}
return new ContainerArchitect(player.inventory, (TileArchitect) tile);
return new ContainerArchitect(player, (TileArchitect) tile);
case GuiIds.BLUEPRINT_LIBRARY:
if (!(tile instanceof TileBlueprintLibrary)) {

View file

@ -139,14 +139,15 @@ public abstract class TileAbstractBuilder extends TileBuildCraft implements ITil
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
mjStored = nbttagcompound.getDouble("mjStored");
nbttagcompound.setDouble("mjStored", mjStored);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
nbttagcompound.setDouble("mjStored", mjStored);
mjStored = nbttagcompound.getDouble("mjStored");
mjPrev = mjStored;
mjUnchangedCycles = 0;
}

View file

@ -51,7 +51,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
public EntityPlayer uploadingPlayer = null;
public EntityPlayer downloadingPlayer = null;
private int pageId = 0;
public int pageId = 0;
public TileBlueprintLibrary() {

View file

@ -40,6 +40,7 @@ import buildcraft.core.blueprints.BptBuilderBase;
import buildcraft.core.blueprints.BptBuilderBlueprint;
import buildcraft.core.blueprints.BptBuilderTemplate;
import buildcraft.core.blueprints.BptContext;
import buildcraft.core.inventory.InvUtils;
import buildcraft.core.network.RPC;
import buildcraft.core.network.RPCHandler;
import buildcraft.core.network.RPCSide;
@ -397,12 +398,17 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
}
if (done) {
boolean dropBlueprint = true;
for (int i = 1; i < items.length; ++i) {
if (items[i] == null) {
items[i] = items[0];
dropBlueprint = false;
break;
}
}
if (dropBlueprint) {
InvUtils.dropItems(getWorld(), items[0], xCoord, yCoord, zCoord);
}
items[0] = null;
box.reset();
@ -732,4 +738,4 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
}
}
}
}

View file

@ -12,9 +12,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import buildcraft.builders.TileArchitect;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.slots.SlotArchitect;
import buildcraft.core.gui.slots.SlotOutput;
public class ContainerArchitect extends BuildCraftContainer {
@ -23,23 +24,23 @@ public class ContainerArchitect extends BuildCraftContainer {
protected TileArchitect architect;
protected int computingTime = 0;
public ContainerArchitect(IInventory playerInventory, TileArchitect template) {
public ContainerArchitect(EntityPlayer player, TileArchitect template) {
super(template.getSizeInventory());
this.playerIInventory = playerInventory;
this.playerIInventory = player.inventory;
this.architect = template;
addSlotToContainer(new Slot(template, 0, 135, 35));
addSlotToContainer(new SlotArchitect(template, player, 0, 135, 35));
addSlotToContainer(new SlotOutput(template, 1, 194, 35));
for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 9; k1++) {
addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 88 + k1 * 18, 84 + l * 18));
addSlotToContainer(new Slot(player.inventory, k1 + l * 9 + 9, 88 + k1 * 18, 84 + l * 18));
}
}
for (int i1 = 0; i1 < 9; i1++) {
addSlotToContainer(new Slot(playerInventory, i1, 88 + i1 * 18, 142));
addSlotToContainer(new Slot(player.inventory, i1, 88 + i1 * 18, 142));
}
}
@ -77,14 +78,4 @@ public class ContainerArchitect extends BuildCraftContainer {
public boolean canInteractWith(EntityPlayer entityplayer) {
return architect.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
if (slotNum == 0) {
architect.currentAuthorName = player.getDisplayName();
}
return super.slotClick(slotNum, mouseButton, modifier, player);
}
}

View file

@ -12,10 +12,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import buildcraft.builders.TileBlueprintLibrary;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.slots.SlotBlueprintLibrary;
import buildcraft.core.gui.slots.SlotOutput;
public class ContainerBlueprintLibrary extends BuildCraftContainer {
@ -30,10 +30,10 @@ public class ContainerBlueprintLibrary extends BuildCraftContainer {
this.playerInventory = player.inventory;
this.library = library;
addSlotToContainer(new Slot(library, 0, 211, 61));
addSlotToContainer(new SlotBlueprintLibrary(library, player, 0, 211, 61));
addSlotToContainer(new SlotOutput(library, 1, 167, 61));
addSlotToContainer(new Slot(library, 2, 167, 79));
addSlotToContainer(new SlotBlueprintLibrary(library, player, 2, 167, 79));
addSlotToContainer(new SlotOutput(library, 3, 211, 79));
// Player inventory
@ -48,23 +48,6 @@ public class ContainerBlueprintLibrary extends BuildCraftContainer {
}
}
@Override
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
// When downloading or uploading a blueprint, the server needs to know
// who requested it. The way to do it so far is by recording the last
// player that clicks on the slots. To be improved if the method is
// not robust enough (e.g. what if the player is not logged anymore?
// is that robust against race conditions? etc.)
if (slotNum == 0) {
library.uploadingPlayer = player;
} else if (slotNum == 2) {
library.downloadingPlayer = player;
}
return super.slotClick(slotNum, mouseButton, modifier, player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();

View file

@ -13,6 +13,7 @@ import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
@ -45,9 +46,9 @@ public class GuiArchitect extends GuiBuildCraft {
private GuiTextField textField;
public GuiArchitect(IInventory playerInventory, TileArchitect architect) {
super(new ContainerArchitect(playerInventory, architect), architect, TEXTURE);
this.playerInventory = playerInventory;
public GuiArchitect(EntityPlayer player, TileArchitect architect) {
super(new ContainerArchitect(player, architect), architect, TEXTURE);
this.playerInventory = player.inventory;
this.architect = architect;
xSize = 256;
ySize = 166;

View file

@ -59,6 +59,9 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
deleteButton = new GuiButton(2, j + 158, k + 114, 25, 20, StringUtils.localize("gui.del"));
buttonList.add(deleteButton);
checkDelete();
checkPages();
}
@Override
@ -141,5 +144,30 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
}
}
}
checkDelete();
checkPages();
}
protected void checkDelete() {
if (library.selected != -1) {
deleteButton.enabled = true;
} else {
deleteButton.enabled = false;
}
}
protected void checkPages() {
if (library.pageId != 0) {
prevPageButton.enabled = true;
} else {
prevPageButton.enabled = false;
}
if (library.pageId < BuildCraftBuilders.clientDB.getPageNumber() - 1) {
nextPageButton.enabled = true;
} else {
nextPageButton.enabled = false;
}
}
}

View file

@ -10,17 +10,22 @@ package buildcraft.builders.schematics;
import java.util.LinkedList;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import buildcraft.api.blueprints.IBuilderContext;
import buildcraft.api.blueprints.SchematicBlock;
public class SchematicRedstoneDiode extends SchematicBlock {
private Item baseItem;
public SchematicRedstoneDiode(Item baseItem) {
this.baseItem = baseItem;
}
@Override
public void writeRequirementsToBuilder(IBuilderContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Items.repeater));
requirements.add(new ItemStack(baseItem));
}
@Override

View file

@ -0,0 +1,35 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.gui.slots;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import buildcraft.builders.TileArchitect;
public class SlotArchitect extends SlotBase {
private TileArchitect architect;
private EntityPlayer player;
private int slot;
public SlotArchitect(IInventory iinventory, EntityPlayer player, int slotIndex, int posX, int posY) {
super(iinventory, slotIndex, posX, posY);
this.architect = (TileArchitect) iinventory;
this.slot = slotIndex;
this.player = player;
}
@Override
public void onSlotChanged() {
if (slot == 0) {
architect.currentAuthorName = player.getDisplayName();
}
this.inventory.markDirty();
}
}

View file

@ -0,0 +1,44 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.gui.slots;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import buildcraft.builders.TileBlueprintLibrary;
public class SlotBlueprintLibrary extends SlotBase {
private TileBlueprintLibrary library;
private EntityPlayer player;
private int slot;
public SlotBlueprintLibrary(IInventory iinventory, EntityPlayer player, int slotIndex, int posX, int posY) {
super(iinventory, slotIndex, posX, posY);
this.library = (TileBlueprintLibrary) iinventory;
this.slot = slotIndex;
this.player = player;
}
@Override
public void onSlotChanged() {
// When downloading or uploading a blueprint, the server needs to know
// who requested it. The way to do it so far is by recording the last
// player that clicks on the slots. To be improved if the method is
// not robust enough (e.g. what if the player is not logged anymore?
// is that robust against race conditions? etc.)
if (slot == 0) {
library.uploadingPlayer = player;
} else if (slot == 2) {
library.downloadingPlayer = player;
}
this.inventory.markDirty();
}
}

View file

@ -18,6 +18,7 @@ import net.minecraft.util.ChatComponentText;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.NetworkData;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.mj.MjBattery;
import buildcraft.api.power.IPowerReceptor;
@ -121,7 +122,7 @@ public class TileEnergyConverter extends TileBuildCraft implements IPowerRecepto
if (tile instanceof TileEnergyConverter) {
continue;
}
MjAPI.BatteryObject object = MjAPI.getMjBattery(tile);
IBatteryObject object = MjAPI.getMjBattery(tile);
if (object != null && mjStored > 0) {
double wantToUse = Math.min(mjStored, object.getEnergyRequested());
object.addEnergy(wantToUse);

View file

@ -14,8 +14,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.mj.MjAPI.BatteryObject;
import buildcraft.api.power.IPowerEmitter;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
@ -74,7 +74,7 @@ public class TileEnergyReceiver extends TileBuildCraft implements IPipeConnectio
energyStored = 0;
}
} else if (tile != null) {
BatteryObject battery = MjAPI.getMjBattery(tile);
IBatteryObject battery = MjAPI.getMjBattery(tile);
if (battery != null) {
battery.addEnergy(energyStored);

View file

@ -22,8 +22,8 @@ import buildcraft.BuildCraftEnergy;
import buildcraft.api.core.NetworkData;
import buildcraft.api.gates.IOverrideDefaultTriggers;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.mj.MjAPI.BatteryObject;
import buildcraft.api.power.IPowerEmitter;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler;
@ -307,7 +307,7 @@ public abstract class TileEngine extends TileBuildCraft implements IPowerRecepto
extractEnergy(receptor.getMinEnergyReceived(), needed, true);
}
} else {
BatteryObject battery = MjAPI.getMjBattery(tile);
IBatteryObject battery = MjAPI.getMjBattery(tile);
battery.addEnergy(extractEnergy(0, battery.maxReceivedPerCycle(),
true));

View file

@ -541,13 +541,11 @@ public class BlockGenericPipe extends BlockBuildCraft {
}
public static void removePipe(Pipe pipe) {
if (pipe == null) {
if (!isValid(pipe)) {
return;
}
if (isValid(pipe)) {
pipe.onBlockRemoval();
}
pipe.onBlockRemoval();
World world = pipe.container.getWorldObj();

View file

@ -21,8 +21,8 @@ import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftTransport;
import buildcraft.api.core.SafeTimeTracker;
import buildcraft.api.gates.ITrigger;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.mj.MjAPI.BatteryObject;
import buildcraft.api.power.IPowerEmitter;
import buildcraft.api.power.IPowerReceptor;
import buildcraft.api.power.PowerHandler.PowerReceiver;
@ -202,7 +202,7 @@ public class PipeTransportPower extends PipeTransport {
internalPower[i] -= watts;
} else if (tiles[j] != null) {
// Look for the simplified power framework
BatteryObject battery = MjAPI.getMjBattery(tiles [j]);
IBatteryObject battery = MjAPI.getMjBattery(tiles [j]);
if (battery != null) {
watts = (internalPower[i] / totalPowerQuery)
@ -250,7 +250,7 @@ public class PipeTransportPower extends PipeTransport {
}
if (tile != null) {
BatteryObject battery = MjAPI.getMjBattery(tile);
IBatteryObject battery = MjAPI.getMjBattery(tile);
if (battery != null) {
requestEnergy(dir, battery.getEnergyRequested());

View file

@ -13,7 +13,6 @@ import java.util.Map;
import com.google.common.collect.MapMaker;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -217,13 +216,6 @@ public class TravelingItem {
ItemStack stack = getItemStack();
EntityItem entity = new EntityItem(container.getWorldObj(), xCoord, yCoord, zCoord, getItemStack());
if (stack.getItem().hasCustomEntity(stack)) {
Entity e = stack.getItem().createEntity(container.getWorldObj(), entity, stack);
if (e instanceof EntityItem) {
entity = (EntityItem) e;
}
}
entity.lifespan = BuildCraftCore.itemLifespan;
entity.delayBeforeCanPickup = 10;

View file

@ -17,8 +17,8 @@ import buildcraft.BuildCraftTransport;
import buildcraft.api.gates.GateExpansionController;
import buildcraft.api.gates.IAction;
import buildcraft.api.gates.IGateExpansion;
import buildcraft.api.mj.IBatteryObject;
import buildcraft.api.mj.MjAPI;
import buildcraft.api.mj.MjAPI.BatteryObject;
import buildcraft.transport.TileGenericPipe;
import buildcraft.transport.triggers.ActionEnergyPulsar;
import buildcraft.transport.triggers.ActionSingleEnergyPulse;
@ -97,7 +97,7 @@ public final class GateExpansionPulsar extends GateExpansionBuildcraft implement
return;
}
BatteryObject battery = MjAPI.getMjBattery(pipeTile);
IBatteryObject battery = MjAPI.getMjBattery(pipeTile);
if (battery != null && (!singlePulse || !hasPulsed)) {
((TileGenericPipe) pipeTile).pipe.gate.setPulsing(true);

View file

@ -29,6 +29,7 @@ import buildcraft.core.gui.GuiAdvancedInterface;
import buildcraft.core.triggers.BCAction;
import buildcraft.core.utils.StringUtils;
import buildcraft.transport.Pipe;
import buildcraft.transport.gates.GateDefinition;
public class GuiGateInterface extends GuiAdvancedInterface {
@ -36,6 +37,8 @@ public class GuiGateInterface extends GuiAdvancedInterface {
private final ContainerGateInterface container;
private final Pipe pipe;
private int numSlots;
private TriggerSlot[] triggerSlots;
private TriggerParameterSlot[] triggerParameterSlots;
class TriggerSlot extends AdvancedSlot {
@ -189,20 +192,27 @@ public class GuiGateInterface extends GuiAdvancedInterface {
if (numSlots == 1) {
slots = new AdvancedSlot[2];
slots[0] = new TriggerSlot(62, 26, pipe, 0);
triggerSlots = new TriggerSlot[1];
triggerParameterSlots = new TriggerParameterSlot[0];
slots[0] = triggerSlots[0] = new TriggerSlot(62, 26, pipe, 0);
slots[1] = new ActionSlot(98, 26, pipe, 0);
} else if (numSlots == 2) {
slots = new AdvancedSlot[4];
triggerSlots = new TriggerSlot[2];
triggerParameterSlots = new TriggerParameterSlot[0];
slots[0] = new TriggerSlot(62, 26, pipe, 0);
slots[1] = new TriggerSlot(62, 44, pipe, 1);
slots[0] = triggerSlots[0] = new TriggerSlot(62, 26, pipe, 0);
slots[1] = triggerSlots[1] = new TriggerSlot(62, 44, pipe, 1);
slots[2] = new ActionSlot(98, 26, pipe, 0);
slots[3] = new ActionSlot(98, 44, pipe, 1);
} else if (numSlots == 4) {
slots = new AdvancedSlot[12];
triggerSlots = new TriggerSlot[4];
triggerParameterSlots = new TriggerParameterSlot[4];
for (int k = 0; k < 4; ++k) {
slots[position] = new TriggerSlot(53, 26 + 18 * k, pipe, position);
slots[position] = triggerSlots[position] = new TriggerSlot(53, 26 + 18 * k, pipe, position);
position++;
}
@ -212,17 +222,19 @@ public class GuiGateInterface extends GuiAdvancedInterface {
}
for (int k = 0; k < 4; ++k) {
slots[position] = new TriggerParameterSlot(71, 26 + 18 * k, pipe, position - 8);
slots[position] = triggerParameterSlots[position - 8] = new TriggerParameterSlot(71, 26 + 18 * k, pipe, position - 8);
position++;
}
} else if (numSlots == 8) {
slots = new AdvancedSlot[24];
triggerSlots = new TriggerSlot[8];
triggerParameterSlots = new TriggerParameterSlot[8];
for (int k = 0; k < 4; ++k) {
slots[position] = new TriggerSlot(8, 26 + 18 * k, pipe, position);
slots[position] = triggerSlots[position] = new TriggerSlot(8, 26 + 18 * k, pipe, position);
position++;
slots[position] = new TriggerSlot(98, 26 + 18 * k, pipe, position);
slots[position] = triggerSlots[position] = new TriggerSlot(98, 26 + 18 * k, pipe, position);
position++;
}
@ -234,9 +246,9 @@ public class GuiGateInterface extends GuiAdvancedInterface {
}
for (int k = 0; k < 4; ++k) {
slots[position] = new TriggerParameterSlot(26, 26 + 18 * k, pipe, position - 16);
slots[position] = triggerParameterSlots[position - 16] = new TriggerParameterSlot(26, 26 + 18 * k, pipe, position - 16);
position++;
slots[position] = new TriggerParameterSlot(116, 26 + 18 * k, pipe, position - 16);
slots[position] = triggerParameterSlots[position - 16] = new TriggerParameterSlot(116, 26 + 18 * k, pipe, position - 16);
position++;
}
}
@ -273,13 +285,14 @@ public class GuiGateInterface extends GuiAdvancedInterface {
if (slot instanceof TriggerSlot) {
ITrigger trigger = ((TriggerSlot) slot).getTrigger();
boolean halfWidth = pipe.gate.logic == GateDefinition.GateLogic.AND && !isAllTriggersActive();
if (pipe.gate.material.hasParameterSlot) {
if (container.triggerState[triggerTracker++]) {
mc.renderEngine.bindTexture(texture);
drawTexturedModalRect(cornerX + slot.x + 35, cornerY + slot.y + 6, 176, 18, 18, 4);
drawTexturedModalRect(cornerX + slot.x + 35, cornerY + slot.y + 6, 176, 18, halfWidth ? 9 : 18, 4);
}
if (trigger == null || !trigger.hasParameter()) {
@ -290,7 +303,7 @@ public class GuiGateInterface extends GuiAdvancedInterface {
} else if (container.triggerState[triggerTracker++]) {
mc.renderEngine.bindTexture(texture);
drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y + 6, 176, 18, 18, 4);
drawTexturedModalRect(cornerX + slot.x + 17, cornerY + slot.y + 6, 176, 18, halfWidth ? 9 : 18, 4);
}
} else if (slot instanceof TriggerParameterSlot) {
TriggerParameterSlot paramSlot = (TriggerParameterSlot) slot;
@ -309,6 +322,18 @@ public class GuiGateInterface extends GuiAdvancedInterface {
drawBackgroundSlots();
}
private boolean isAllTriggersActive() {
for (int i = 0; i < triggerSlots.length; i++) {
TriggerSlot slot = triggerSlots[i];
ITrigger trigger = slot.getTrigger();
ITriggerParameter parameter = triggerParameterSlots.length > i ? triggerParameterSlots[i].getTriggerParameter() : null;
if (trigger != null && !container.isNearbyTriggerActive(trigger, parameter)) {
return false;
}
}
return true;
}
@Override
protected void mouseClicked(int i, int j, int k) {
super.mouseClicked(i, j, k);

View file

@ -128,9 +128,9 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> {
entityArrow.setPosition(p.x + 0.5d, p.y + 0.5d, p.z + 0.5d);
entityArrow.setDamage(3);
entityArrow.setKnockbackStrength(1);
entityArrow.setVelocity(direction.offsetX * 1.8d + getWorld().rand.nextGaussian() * 0.007499999832361937D,
direction.offsetY * 1.8d + getWorld().rand.nextGaussian() * 0.007499999832361937D,
direction.offsetZ * 1.8d + getWorld().rand.nextGaussian() * 0.007499999832361937D);
entityArrow.motionX = direction.offsetX * 1.8d + getWorld().rand.nextGaussian() * 0.007499999832361937D;
entityArrow.motionY = direction.offsetY * 1.8d + getWorld().rand.nextGaussian() * 0.007499999832361937D;
entityArrow.motionZ = direction.offsetZ * 1.8d + getWorld().rand.nextGaussian() * 0.007499999832361937D;
getWorld().spawnEntityInWorld(entityArrow);
} else if ((stack.getItem() == Items.potionitem && ItemPotion.isSplash(stack.getItemDamage()))
|| stack.getItem() == Items.egg