Refactor/cleanup.
This commit is contained in:
parent
6ed78f37b2
commit
e42c71e9a3
324 changed files with 5221 additions and 5042 deletions
|
@ -13,18 +13,13 @@ import java.io.IOException;
|
|||
import java.util.LinkedList;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.Property;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.bptblocks.BptBlockBed;
|
||||
import buildcraft.api.bptblocks.BptBlockCustomStack;
|
||||
|
@ -76,17 +71,20 @@ import buildcraft.core.Version;
|
|||
import buildcraft.core.blueprints.BptPlayerIndex;
|
||||
import buildcraft.core.blueprints.BptRootIndex;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.Property;
|
||||
|
||||
@Mod(name="BuildCraft Builders", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerBuilders.class, clientSideRequired = true, serverSideRequired = true)
|
||||
@Mod(name = "BuildCraft Builders", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandlerBuilders.class, clientSideRequired = true, serverSideRequired = true)
|
||||
public class BuildCraftBuilders {
|
||||
|
||||
public static final int LIBRARY_PAGE_SIZE = 12;
|
||||
|
@ -161,7 +159,7 @@ public class BuildCraftBuilders {
|
|||
new BptBlockCustomStack(Block.stone.blockID, new ItemStack(Block.stone));
|
||||
new BptBlockCustomStack(Block.redstoneWire.blockID, new ItemStack(Item.redstone));
|
||||
// FIXME: Not sure what this has become
|
||||
//new BptBlockCustomStack(Block.stairDouble.blockID, new ItemStack(Block.stairSingle, 2));
|
||||
// new BptBlockCustomStack(Block.stairDouble.blockID, new ItemStack(Block.stairSingle, 2));
|
||||
new BptBlockCustomStack(Block.cake.blockID, new ItemStack(Item.cake));
|
||||
new BptBlockCustomStack(Block.crops.blockID, new ItemStack(Item.seeds));
|
||||
new BptBlockCustomStack(Block.pumpkinStem.blockID, new ItemStack(Item.pumpkinSeeds));
|
||||
|
@ -211,8 +209,7 @@ public class BuildCraftBuilders {
|
|||
new BptBlockWallSide(pathMarkerBlock.blockID);
|
||||
new BptBlockFiller(fillerBlock.blockID);
|
||||
|
||||
if (BuildCraftCore.loadDefaultRecipes)
|
||||
{
|
||||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
|
||||
|
@ -229,7 +226,7 @@ public class BuildCraftBuilders {
|
|||
Property architectId = BuildCraftCore.mainConfiguration.getBlock("architect.id", DefaultProps.ARCHITECT_ID);
|
||||
Property libraryId = BuildCraftCore.mainConfiguration.getBlock("blueprintLibrary.id", DefaultProps.BLUEPRINT_LIBRARY_ID);
|
||||
|
||||
Property fillerDestroyProp = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"filler.destroy", DefaultProps.FILLER_DESTROY);
|
||||
Property fillerDestroyProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "filler.destroy", DefaultProps.FILLER_DESTROY);
|
||||
fillerDestroyProp.comment = "If true, Filler will destroy blocks instead of breaking them.";
|
||||
fillerDestroy = fillerDestroyProp.getBoolean(DefaultProps.FILLER_DESTROY);
|
||||
|
||||
|
@ -298,69 +295,65 @@ public class BuildCraftBuilders {
|
|||
new ItemStack(Item.dyePowder, 1, 2), Character.valueOf('r'), Block.torchRedstoneActive });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(fillerBlock, 1), new Object[] { "btb", "ycy", "gCg", Character.valueOf('b'),
|
||||
new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('t'), markerBlock, Character.valueOf('y'),
|
||||
new ItemStack(Item.dyePowder, 1, 11), Character.valueOf('c'), Block.workbench, Character.valueOf('g'),
|
||||
BuildCraftCore.goldGearItem, Character.valueOf('C'), Block.chest });
|
||||
new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('t'), markerBlock, Character.valueOf('y'), new ItemStack(Item.dyePowder, 1, 11),
|
||||
Character.valueOf('c'), Block.workbench, Character.valueOf('g'), BuildCraftCore.goldGearItem, Character.valueOf('C'), Block.chest });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(builderBlock, 1), new Object[] { "btb", "ycy", "gCg", Character.valueOf('b'),
|
||||
new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('t'), markerBlock, Character.valueOf('y'),
|
||||
new ItemStack(Item.dyePowder, 1, 11), Character.valueOf('c'), Block.workbench, Character.valueOf('g'),
|
||||
BuildCraftCore.diamondGearItem, Character.valueOf('C'), Block.chest });
|
||||
new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('t'), markerBlock, Character.valueOf('y'), new ItemStack(Item.dyePowder, 1, 11),
|
||||
Character.valueOf('c'), Block.workbench, Character.valueOf('g'), BuildCraftCore.diamondGearItem, Character.valueOf('C'), Block.chest });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(architectBlock, 1), new Object[] { "btb", "ycy", "gCg", Character.valueOf('b'),
|
||||
new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('t'), markerBlock, Character.valueOf('y'),
|
||||
new ItemStack(Item.dyePowder, 1, 11), Character.valueOf('c'), Block.workbench, Character.valueOf('g'),
|
||||
BuildCraftCore.diamondGearItem, Character.valueOf('C'), new ItemStack(templateItem, 1) });
|
||||
new ItemStack(Item.dyePowder, 1, 0), Character.valueOf('t'), markerBlock, Character.valueOf('y'), new ItemStack(Item.dyePowder, 1, 11),
|
||||
Character.valueOf('c'), Block.workbench, Character.valueOf('g'), BuildCraftCore.diamondGearItem, Character.valueOf('C'),
|
||||
new ItemStack(templateItem, 1) });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(libraryBlock, 1), new Object[] { "bbb", "bBb", "bbb", Character.valueOf('b'),
|
||||
new ItemStack(blueprintItem), Character.valueOf('B'), Block.bookShelf });
|
||||
// / INIT FILLER PATTERNS
|
||||
FillerManager.registry.addRecipe(new FillerFillAll(), new Object[] { "bbb", "bbb", "bbb", Character.valueOf('b'),
|
||||
new ItemStack(Block.brick, 1) });
|
||||
FillerManager.registry.addRecipe(new FillerFillAll(), new Object[] { "bbb", "bbb", "bbb", Character.valueOf('b'), new ItemStack(Block.brick, 1) });
|
||||
|
||||
FillerManager.registry.addRecipe(new FillerFlattener(), new Object[] { " ", "ggg", "bbb", Character.valueOf('g'),
|
||||
Block.glass, Character.valueOf('b'), Block.brick });
|
||||
FillerManager.registry.addRecipe(new FillerFlattener(), new Object[] { " ", "ggg", "bbb", Character.valueOf('g'), Block.glass,
|
||||
Character.valueOf('b'), Block.brick });
|
||||
|
||||
FillerManager.registry.addRecipe(new FillerRemover(), new Object[] { "ggg", "ggg", "ggg", Character.valueOf('g'),
|
||||
Block.glass });
|
||||
FillerManager.registry.addRecipe(new FillerRemover(), new Object[] { "ggg", "ggg", "ggg", Character.valueOf('g'), Block.glass });
|
||||
|
||||
FillerManager.registry.addRecipe(new FillerFillWalls(), new Object[] { "bbb", "b b", "bbb", Character.valueOf('b'),
|
||||
Block.brick });
|
||||
FillerManager.registry.addRecipe(new FillerFillWalls(), new Object[] { "bbb", "b b", "bbb", Character.valueOf('b'), Block.brick });
|
||||
|
||||
FillerManager.registry.addRecipe(new FillerFillPyramid(), new Object[] { " ", " b ", "bbb", Character.valueOf('b'),
|
||||
Block.brick });
|
||||
FillerManager.registry.addRecipe(new FillerFillPyramid(), new Object[] { " ", " b ", "bbb", Character.valueOf('b'), Block.brick });
|
||||
|
||||
FillerManager.registry.addRecipe(new FillerFillStairs(), new Object[] { " b", " bb", "bbb", Character.valueOf('b'),
|
||||
Block.brick });
|
||||
FillerManager.registry.addRecipe(new FillerFillStairs(), new Object[] { " b", " bb", "bbb", Character.valueOf('b'), Block.brick });
|
||||
}
|
||||
|
||||
public static BptPlayerIndex getPlayerIndex(String name) {
|
||||
BptRootIndex rootIndex = getBptRootIndex();
|
||||
|
||||
if (!playerLibrary.containsKey(name))
|
||||
if (!playerLibrary.containsKey(name)) {
|
||||
try {
|
||||
playerLibrary.put(name, new BptPlayerIndex(name + ".list", rootIndex));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return playerLibrary.get(name);
|
||||
}
|
||||
|
||||
public static BptRootIndex getBptRootIndex() {
|
||||
if (rootBptIndex == null)
|
||||
if (rootBptIndex == null) {
|
||||
try {
|
||||
rootBptIndex = new BptRootIndex("index.txt");
|
||||
rootBptIndex.loadIndex();
|
||||
|
||||
for (IBuilderHook hook : hooks)
|
||||
for (IBuilderHook hook : hooks) {
|
||||
hook.rootIndexInitialized(rootBptIndex);
|
||||
}
|
||||
|
||||
rootBptIndex.importNewFiles();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return rootBptIndex;
|
||||
}
|
||||
|
@ -368,7 +361,7 @@ public class BuildCraftBuilders {
|
|||
public static ItemStack getBptItemStack(int id, int damage, String name) {
|
||||
ItemStack stack = new ItemStack(id, 1, damage);
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
if(name != null && !"".equals(name)) {
|
||||
if (name != null && !"".equals(name)) {
|
||||
nbt.setString("BptName", name);
|
||||
stack.setTagCompound(nbt);
|
||||
}
|
||||
|
@ -376,8 +369,9 @@ public class BuildCraftBuilders {
|
|||
}
|
||||
|
||||
public static void addHook(IBuilderHook hook) {
|
||||
if (!hooks.contains(hook))
|
||||
if (!hooks.contains(hook)) {
|
||||
hooks.add(hook);
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.ServerStopping
|
||||
|
|
|
@ -12,23 +12,15 @@ import java.io.File;
|
|||
import java.util.TreeMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.ServerStarting;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFluid;
|
||||
import net.minecraft.command.CommandHandler;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.Property;
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import buildcraft.api.gates.Action;
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
|
@ -52,29 +44,35 @@ import buildcraft.core.network.PacketHandler;
|
|||
import buildcraft.core.network.PacketUpdate;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.triggers.ActionMachineControl;
|
||||
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
||||
import buildcraft.core.triggers.ActionRedstoneOutput;
|
||||
import buildcraft.core.triggers.DefaultActionProvider;
|
||||
import buildcraft.core.triggers.DefaultTriggerProvider;
|
||||
import buildcraft.core.triggers.TriggerInventory;
|
||||
import buildcraft.core.triggers.TriggerLiquidContainer;
|
||||
import buildcraft.core.triggers.TriggerMachine;
|
||||
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
||||
import buildcraft.core.utils.Localization;
|
||||
import buildcraft.transport.triggers.TriggerRedstoneInput;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.Mod.ServerStarting;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockFluid;
|
||||
import net.minecraft.command.CommandHandler;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.common.Property;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
|
||||
@Mod(name="BuildCraft", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", dependencies="required-after:Forge@[6.3.0.0,)")
|
||||
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
|
||||
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", dependencies = "required-after:Forge@[6.3.0.0,)")
|
||||
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
|
||||
public class BuildCraftCore {
|
||||
public static enum RenderMode {
|
||||
Full, NoDynamic
|
||||
|
@ -91,7 +89,7 @@ public class BuildCraftCore {
|
|||
public static int itemLifespan = 1200;
|
||||
|
||||
public static int updateFactor = 10;
|
||||
|
||||
|
||||
public static long longUpdateFactor = 40;
|
||||
|
||||
public static BuildCraftConfiguration mainConfiguration;
|
||||
|
@ -159,8 +157,7 @@ public class BuildCraftCore {
|
|||
bcLog.info("http://www.mod-buildcraft.com");
|
||||
|
||||
mainConfiguration = new BuildCraftConfiguration(new File(evt.getModConfigurationDirectory(), "buildcraft/main.conf"));
|
||||
try
|
||||
{
|
||||
try {
|
||||
mainConfiguration.load();
|
||||
|
||||
redLaserTexture = 0 * 16 + 2;
|
||||
|
@ -168,36 +165,38 @@ public class BuildCraftCore {
|
|||
stripesLaserTexture = 0 * 16 + 3;
|
||||
transparentTexture = 0 * 16 + 0;
|
||||
|
||||
Property continuousCurrent = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "current.continuous", DefaultProps.CURRENT_CONTINUOUS);
|
||||
Property continuousCurrent = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "current.continuous",
|
||||
DefaultProps.CURRENT_CONTINUOUS);
|
||||
continuousCurrent.comment = "set to true for allowing machines to be driven by continuous current";
|
||||
continuousCurrentModel = continuousCurrent.getBoolean(DefaultProps.CURRENT_CONTINUOUS);
|
||||
|
||||
Property trackNetwork = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "trackNetworkUsage", false);
|
||||
Property trackNetwork = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "trackNetworkUsage", false);
|
||||
trackNetworkUsage = trackNetwork.getBoolean(false);
|
||||
|
||||
Property dropBlock = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"dropBrokenBlocks", true);
|
||||
Property dropBlock = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "dropBrokenBlocks", true);
|
||||
dropBlock.comment = "set to false to prevent fillers from dropping blocks.";
|
||||
dropBrokenBlocks = dropBlock.getBoolean(true);
|
||||
|
||||
Property lifespan = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL, "itemLifespan", itemLifespan);
|
||||
Property lifespan = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "itemLifespan", itemLifespan);
|
||||
lifespan.comment = "the lifespan in ticks of items dropped on the ground by pipes and machines, vanilla = 6000, default = 1200";
|
||||
itemLifespan = lifespan.getInt(itemLifespan);
|
||||
if(itemLifespan < 100)
|
||||
if (itemLifespan < 100) {
|
||||
itemLifespan = 100;
|
||||
}
|
||||
|
||||
Property powerFrameworkClass = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"power.framework", "buildcraft.energy.PneumaticPowerFramework");
|
||||
Property powerFrameworkClass = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "power.framework",
|
||||
"buildcraft.energy.PneumaticPowerFramework");
|
||||
|
||||
Property factor = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"network.updateFactor", 10);
|
||||
Property factor = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "network.updateFactor", 10);
|
||||
factor.comment = "increasing this number will decrease network update frequency, useful for overloaded servers";
|
||||
updateFactor = factor.getInt(10);
|
||||
|
||||
Property longFactor = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"network.stateRefreshPeriod", 40);
|
||||
|
||||
Property longFactor = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "network.stateRefreshPeriod", 40);
|
||||
longFactor.comment = "delay between full client sync packets, increasing it saves bandwidth, decreasing makes for better client syncronization.";
|
||||
longUpdateFactor = longFactor.getInt(40);
|
||||
|
||||
String powerFrameworkClassName = "buildcraft.energy.PneumaticPowerFramework";
|
||||
if (!forcePneumaticPower)
|
||||
{
|
||||
if (!forcePneumaticPower) {
|
||||
powerFrameworkClassName = powerFrameworkClass.value;
|
||||
}
|
||||
try {
|
||||
|
@ -217,7 +216,7 @@ public class BuildCraftCore {
|
|||
Property ironGearId = BuildCraftCore.mainConfiguration.getItem("ironGearItem.id", DefaultProps.IRON_GEAR_ID);
|
||||
Property goldenGearId = BuildCraftCore.mainConfiguration.getItem("goldenGearItem.id", DefaultProps.GOLDEN_GEAR_ID);
|
||||
Property diamondGearId = BuildCraftCore.mainConfiguration.getItem("diamondGearItem.id", DefaultProps.DIAMOND_GEAR_ID);
|
||||
Property modifyWorld = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"modifyWorld", true);
|
||||
Property modifyWorld = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "modifyWorld", true);
|
||||
modifyWorld.comment = "set to false if BuildCraft should not generate custom blocks (e.g. oil)";
|
||||
|
||||
BuildCraftCore.modifyWorld = modifyWorld.getBoolean(true);
|
||||
|
@ -236,21 +235,18 @@ public class BuildCraftCore {
|
|||
|
||||
diamondGearItem = (new ItemBuildCraft(Integer.parseInt(diamondGearId.value))).setIconIndex(1 * 16 + 4).setItemName("diamondGearItem");
|
||||
LanguageRegistry.addName(diamondGearItem, "Diamond Gear");
|
||||
}
|
||||
finally
|
||||
{
|
||||
} finally {
|
||||
mainConfiguration.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Init
|
||||
public void initialize(FMLInitializationEvent evt) {
|
||||
//MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
||||
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
||||
ActionManager.registerTriggerProvider(new DefaultTriggerProvider());
|
||||
ActionManager.registerActionProvider(new DefaultActionProvider());
|
||||
|
||||
if (BuildCraftCore.loadDefaultRecipes)
|
||||
{
|
||||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
EntityRegistry.registerModEntity(EntityRobot.class, "bcRobot", EntityIds.ROBOT, instance, 50, 1, true);
|
||||
|
@ -271,9 +267,9 @@ public class BuildCraftCore {
|
|||
}
|
||||
|
||||
@PostInit
|
||||
public void postInit(FMLPostInitializationEvent event){
|
||||
for(Block block : Block.blocksList) {
|
||||
if(block instanceof BlockFluid || block instanceof IPlantable){
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
for (Block block : Block.blocksList) {
|
||||
if (block instanceof BlockFluid || block instanceof IPlantable) {
|
||||
BuildCraftAPI.softBlocks[block.blockID] = true;
|
||||
}
|
||||
}
|
||||
|
@ -281,20 +277,21 @@ public class BuildCraftCore {
|
|||
BuildCraftAPI.softBlocks[Block.snow.blockID] = true;
|
||||
TickRegistry.registerTickHandler(new TickHandlerCoreClient(), Side.CLIENT);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ServerStarting
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
CommandHandler commandManager = (CommandHandler)event.getServer().getCommandManager();
|
||||
CommandHandler commandManager = (CommandHandler) event.getServer().getCommandManager();
|
||||
commandManager.registerCommand(new CommandBuildCraft());
|
||||
}
|
||||
|
||||
public void loadRecipes() {
|
||||
GameRegistry.addRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", Character.valueOf('I'), Item.ingotIron, Character.valueOf('G'), stoneGearItem);
|
||||
GameRegistry.addRecipe(new ItemStack(woodenGearItem), " S ", "S S", " S ", Character.valueOf('S'), Item.stick);
|
||||
GameRegistry.addRecipe(new ItemStack(stoneGearItem), " I ", "IGI", " I ", Character.valueOf('I'), Block.cobblestone, Character.valueOf('G'), woodenGearItem);
|
||||
GameRegistry.addRecipe(new ItemStack(stoneGearItem), " I ", "IGI", " I ", Character.valueOf('I'), Block.cobblestone, Character.valueOf('G'),
|
||||
woodenGearItem);
|
||||
GameRegistry.addRecipe(new ItemStack(ironGearItem), " I ", "IGI", " I ", Character.valueOf('I'), Item.ingotIron, Character.valueOf('G'), stoneGearItem);
|
||||
GameRegistry.addRecipe(new ItemStack(goldGearItem), " I ", "IGI", " I ", Character.valueOf('I'), Item.ingotGold, Character.valueOf('G'), ironGearItem);
|
||||
GameRegistry.addRecipe(new ItemStack(diamondGearItem), " I ", "IGI", " I ", Character.valueOf('I'),Item.diamond, Character.valueOf('G'), goldGearItem);
|
||||
GameRegistry.addRecipe(new ItemStack(diamondGearItem), " I ", "IGI", " I ", Character.valueOf('I'), Item.diamond, Character.valueOf('G'), goldGearItem);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,17 +10,18 @@ package buildcraft;
|
|||
|
||||
import java.util.TreeMap;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.Property;
|
||||
import net.minecraftforge.liquids.LiquidContainerData;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import buildcraft.api.fuels.IronEngineCoolant;
|
||||
import buildcraft.api.fuels.IronEngineFuel;
|
||||
import buildcraft.api.gates.Trigger;
|
||||
|
@ -36,29 +37,26 @@ import buildcraft.energy.BlockOilFlowing;
|
|||
import buildcraft.energy.BlockOilStill;
|
||||
import buildcraft.energy.BptBlockEngine;
|
||||
import buildcraft.energy.EnergyProxy;
|
||||
import buildcraft.energy.Engine.EnergyStage;
|
||||
import buildcraft.energy.GuiHandler;
|
||||
import buildcraft.energy.ItemBucketOil;
|
||||
import buildcraft.energy.ItemEngine;
|
||||
import buildcraft.energy.OilBucketHandler;
|
||||
import buildcraft.energy.OilPopulate;
|
||||
import buildcraft.energy.TriggerEngineHeat;
|
||||
import buildcraft.energy.Engine.EnergyStage;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.Property;
|
||||
import net.minecraftforge.liquids.LiquidContainerData;
|
||||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidDictionary;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
@Mod(name="BuildCraft Energy", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
|
||||
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
|
||||
public class BuildCraftEnergy {
|
||||
|
||||
public final static int ENERGY_REMOVE_BLOCK = 25;
|
||||
|
@ -72,17 +70,15 @@ public class BuildCraftEnergy {
|
|||
public static Item bucketFuel;
|
||||
|
||||
public static Item fuel;
|
||||
|
||||
|
||||
public static LiquidStack oilLiquid;
|
||||
public static LiquidStack fuelLiquid;
|
||||
|
||||
public static TreeMap<BlockIndex, Integer> saturationStored = new TreeMap<BlockIndex, Integer>();
|
||||
|
||||
public static Trigger triggerBlueEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_BLUE_ENGINE_HEAT, EnergyStage.Blue);
|
||||
public static Trigger triggerGreenEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_GREEN_ENGINE_HEAT,
|
||||
EnergyStage.Green);
|
||||
public static Trigger triggerYellowEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_YELLOW_ENGINE_HEAT,
|
||||
EnergyStage.Yellow);
|
||||
public static Trigger triggerGreenEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_GREEN_ENGINE_HEAT, EnergyStage.Green);
|
||||
public static Trigger triggerYellowEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_YELLOW_ENGINE_HEAT, EnergyStage.Yellow);
|
||||
public static Trigger triggerRedEngineHeat = new TriggerEngineHeat(DefaultProps.TRIGGER_RED_ENGINE_HEAT, EnergyStage.Red);
|
||||
|
||||
@Instance("BuildCraft|Energy")
|
||||
|
@ -95,8 +91,7 @@ public class BuildCraftEnergy {
|
|||
|
||||
new BptBlockEngine(engineBlock.blockID);
|
||||
|
||||
if (BuildCraftCore.loadDefaultRecipes)
|
||||
{
|
||||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
EnergyProxy.proxy.registerBlockRenderers();
|
||||
|
@ -109,9 +104,9 @@ public class BuildCraftEnergy {
|
|||
Property engineId = BuildCraftCore.mainConfiguration.getBlock("engine.id", DefaultProps.ENGINE_ID);
|
||||
Property oilStillId = BuildCraftCore.mainConfiguration.getBlock("oilStill.id", DefaultProps.OIL_STILL_ID);
|
||||
Property oilMovingId = BuildCraftCore.mainConfiguration.getBlock("oilMoving.id", DefaultProps.OIL_MOVING_ID);
|
||||
Property bucketOilId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"bucketOil.id", DefaultProps.BUCKET_OIL_ID);
|
||||
Property bucketFuelId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"bucketFuel.id", DefaultProps.BUCKET_FUEL_ID);
|
||||
Property itemFuelId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"fuel.id", DefaultProps.FUEL_ID);
|
||||
Property bucketOilId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "bucketOil.id", DefaultProps.BUCKET_OIL_ID);
|
||||
Property bucketFuelId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "bucketFuel.id", DefaultProps.BUCKET_FUEL_ID);
|
||||
Property itemFuelId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "fuel.id", DefaultProps.FUEL_ID);
|
||||
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
|
||||
|
@ -132,9 +127,7 @@ public class BuildCraftEnergy {
|
|||
|
||||
// Oil and fuel
|
||||
if (oilMoving.blockID + 1 != oilStill.blockID)
|
||||
{
|
||||
throw new RuntimeException("Oil Still id must be Oil Moving id + 1");
|
||||
}
|
||||
|
||||
fuel = new ItemBuildCraft(itemFuelId.getInt(DefaultProps.FUEL_ID)).setItemName("fuel");
|
||||
LanguageRegistry.addName(fuel, "Fuel");
|
||||
|
@ -147,7 +140,7 @@ public class BuildCraftEnergy {
|
|||
bucketFuel = new ItemBuildCraft(Integer.parseInt(bucketFuelId.value)).setItemName("bucketFuel").setContainerItem(Item.bucketEmpty);
|
||||
bucketFuel.setIconIndex(0 * 16 + 3).setMaxStackSize(1).setCreativeTab(CreativeTabs.tabMisc);
|
||||
LanguageRegistry.addName(bucketFuel, "Fuel Bucket");
|
||||
|
||||
|
||||
oilLiquid = LiquidDictionary.getOrCreateLiquid("Oil", new LiquidStack(oilStill, 1));
|
||||
fuelLiquid = LiquidDictionary.getOrCreateLiquid("Fuel", new LiquidStack(fuel, 1));
|
||||
|
||||
|
@ -161,20 +154,20 @@ public class BuildCraftEnergy {
|
|||
// Iron Engine Coolants
|
||||
IronEngineCoolant.coolants.add(new IronEngineCoolant(new LiquidStack(Block.waterStill, LiquidContainerRegistry.BUCKET_VOLUME), 1.0f));
|
||||
|
||||
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Oil", LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketOil), new ItemStack(Item.bucketEmpty)));
|
||||
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Fuel", LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Item.bucketEmpty)));
|
||||
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Oil", LiquidContainerRegistry.BUCKET_VOLUME), new ItemStack(
|
||||
bucketOil), new ItemStack(Item.bucketEmpty)));
|
||||
LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getLiquid("Fuel", LiquidContainerRegistry.BUCKET_VOLUME),
|
||||
new ItemStack(bucketFuel), new ItemStack(Item.bucketEmpty)));
|
||||
}
|
||||
|
||||
public static void loadRecipes() {
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0), new Object[] { "www", " g ", "GpG", Character.valueOf('w'),
|
||||
Block.planks, Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.woodenGearItem,
|
||||
Character.valueOf('p'), Block.pistonBase });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), new Object[] { "www", " g ", "GpG", Character.valueOf('w'),
|
||||
Block.cobblestone, Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.stoneGearItem,
|
||||
Character.valueOf('p'), Block.pistonBase });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), new Object[] { "www", " g ", "GpG", Character.valueOf('w'),
|
||||
Item.ingotIron, Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.ironGearItem,
|
||||
Character.valueOf('p'), Block.pistonBase });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0),
|
||||
new Object[] { "www", " g ", "GpG", Character.valueOf('w'), Block.planks, Character.valueOf('g'), Block.glass, Character.valueOf('G'),
|
||||
BuildCraftCore.woodenGearItem, Character.valueOf('p'), Block.pistonBase });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), new Object[] { "www", " g ", "GpG", Character.valueOf('w'), Block.cobblestone,
|
||||
Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.stoneGearItem, Character.valueOf('p'), Block.pistonBase });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), new Object[] { "www", " g ", "GpG", Character.valueOf('w'), Item.ingotIron,
|
||||
Character.valueOf('g'), Block.glass, Character.valueOf('G'), BuildCraftCore.ironGearItem, Character.valueOf('p'), Block.pistonBase });
|
||||
}
|
||||
|
||||
// public static int createPollution (World world, int i, int j, int k, int
|
||||
|
|
|
@ -10,18 +10,14 @@ package buildcraft;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.Property;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.Version;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
@ -48,17 +44,22 @@ import buildcraft.factory.TileQuarry;
|
|||
import buildcraft.factory.TileRefinery;
|
||||
import buildcraft.factory.TileTank;
|
||||
import buildcraft.factory.network.PacketHandlerFactory;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.Property;
|
||||
|
||||
@Mod(name="BuildCraft Factory", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerFactory.class, clientSideRequired = true, serverSideRequired = true)
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
|
||||
@Mod(name = "BuildCraft Factory", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandlerFactory.class, clientSideRequired = true, serverSideRequired = true)
|
||||
public class BuildCraftFactory {
|
||||
|
||||
public static BlockQuarry quarryBlock;
|
||||
|
@ -82,15 +83,13 @@ public class BuildCraftFactory {
|
|||
@PostInit
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
FactoryProxy.proxy.initializeNEIIntegration();
|
||||
ForgeChunkManager.setForcedChunkLoadingCallback(instance,new QuarryChunkloadCallback());
|
||||
ForgeChunkManager.setForcedChunkLoadingCallback(instance, new QuarryChunkloadCallback());
|
||||
}
|
||||
|
||||
public class QuarryChunkloadCallback implements ForgeChunkManager.OrderedLoadingCallback
|
||||
{
|
||||
public class QuarryChunkloadCallback implements ForgeChunkManager.OrderedLoadingCallback {
|
||||
@Override
|
||||
public void ticketsLoaded(List<Ticket> tickets, World world) {
|
||||
for (Ticket ticket : tickets)
|
||||
{
|
||||
for (Ticket ticket : tickets) {
|
||||
int quarryX = ticket.getModData().getInteger("quarryX");
|
||||
int quarryY = ticket.getModData().getInteger("quarryY");
|
||||
int quarryZ = ticket.getModData().getInteger("quarryZ");
|
||||
|
@ -103,15 +102,13 @@ public class BuildCraftFactory {
|
|||
@Override
|
||||
public List<Ticket> ticketsLoaded(List<Ticket> tickets, World world, int maxTicketCount) {
|
||||
List<Ticket> validTickets = Lists.newArrayList();
|
||||
for (Ticket ticket : tickets)
|
||||
{
|
||||
for (Ticket ticket : tickets) {
|
||||
int quarryX = ticket.getModData().getInteger("quarryX");
|
||||
int quarryY = ticket.getModData().getInteger("quarryY");
|
||||
int quarryZ = ticket.getModData().getInteger("quarryZ");
|
||||
|
||||
int blId = world.getBlockId(quarryX, quarryY, quarryZ);
|
||||
if (blId == quarryBlock.blockID)
|
||||
{
|
||||
if (blId == quarryBlock.blockID) {
|
||||
validTickets.add(ticket);
|
||||
}
|
||||
}
|
||||
|
@ -119,11 +116,12 @@ public class BuildCraftFactory {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Init
|
||||
public void load(FMLInitializationEvent evt) {
|
||||
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
|
||||
|
||||
// EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, instance, 50, 1, true);
|
||||
// EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, instance, 50, 1, true);
|
||||
|
||||
CoreProxy.proxy.registerTileEntity(TileQuarry.class, "Machine");
|
||||
CoreProxy.proxy.registerTileEntity(TileMiningWell.class, "MiningWell");
|
||||
|
@ -145,13 +143,14 @@ public class BuildCraftFactory {
|
|||
new BptBlockRefinery(refineryBlock.blockID);
|
||||
new BptBlockTank(tankBlock.blockID);
|
||||
|
||||
if (BuildCraftCore.loadDefaultRecipes)
|
||||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
}
|
||||
|
||||
@PreInit
|
||||
public void initialize(FMLPreInitializationEvent evt) {
|
||||
allowMining = Boolean.parseBoolean(BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"mining.enabled", true).value);
|
||||
allowMining = Boolean.parseBoolean(BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "mining.enabled", true).value);
|
||||
|
||||
Property minigWellId = BuildCraftCore.mainConfiguration.getBlock("miningWell.id", DefaultProps.MINING_WELL_ID);
|
||||
Property plainPipeId = BuildCraftCore.mainConfiguration.getBlock("drill.id", DefaultProps.DRILL_ID);
|
||||
|
@ -162,7 +161,7 @@ public class BuildCraftFactory {
|
|||
Property tankId = BuildCraftCore.mainConfiguration.getBlock("tank.id", DefaultProps.TANK_ID);
|
||||
Property refineryId = BuildCraftCore.mainConfiguration.getBlock("refinery.id", DefaultProps.REFINERY_ID);
|
||||
Property hopperId = BuildCraftCore.mainConfiguration.getBlock("hopper.id", DefaultProps.HOPPER_ID);
|
||||
Property hopperDisable = BuildCraftCore.mainConfiguration.get( "Block Savers","hopper.disabled", false);
|
||||
Property hopperDisable = BuildCraftCore.mainConfiguration.get("Block Savers", "hopper.disabled", false);
|
||||
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
|
||||
|
@ -211,32 +210,32 @@ public class BuildCraftFactory {
|
|||
public static void loadRecipes() {
|
||||
|
||||
if (allowMining) {
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(miningWellBlock, 1),
|
||||
new Object[] { "ipi", "igi", "iPi", Character.valueOf('p'), Item.redstone, Character.valueOf('i'),
|
||||
Item.ingotIron, Character.valueOf('g'), BuildCraftCore.ironGearItem, Character.valueOf('P'),
|
||||
Item.pickaxeSteel });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(miningWellBlock, 1), new Object[] { "ipi", "igi", "iPi", Character.valueOf('p'), Item.redstone,
|
||||
Character.valueOf('i'), Item.ingotIron, Character.valueOf('g'), BuildCraftCore.ironGearItem, Character.valueOf('P'), Item.pickaxeSteel });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(quarryBlock), new Object[] { "ipi", "gig", "dDd", Character.valueOf('i'),
|
||||
BuildCraftCore.ironGearItem, Character.valueOf('p'), Item.redstone, Character.valueOf('g'),
|
||||
BuildCraftCore.goldGearItem, Character.valueOf('d'), BuildCraftCore.diamondGearItem, Character.valueOf('D'),
|
||||
Item.pickaxeDiamond, });
|
||||
CoreProxy.proxy.addCraftingRecipe(
|
||||
new ItemStack(quarryBlock),
|
||||
new Object[] { "ipi", "gig", "dDd", Character.valueOf('i'), BuildCraftCore.ironGearItem, Character.valueOf('p'), Item.redstone,
|
||||
Character.valueOf('g'), BuildCraftCore.goldGearItem, Character.valueOf('d'), BuildCraftCore.diamondGearItem,
|
||||
Character.valueOf('D'), Item.pickaxeDiamond, });
|
||||
}
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(autoWorkbenchBlock), new Object[] { " g ", "gwg", " g ", Character.valueOf('w'),
|
||||
Block.workbench, Character.valueOf('g'), BuildCraftCore.woodenGearItem });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(autoWorkbenchBlock), new Object[] { " g ", "gwg", " g ", Character.valueOf('w'), Block.workbench,
|
||||
Character.valueOf('g'), BuildCraftCore.woodenGearItem });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock), new Object[] { "T ", "W ", Character.valueOf('T'), tankBlock,
|
||||
Character.valueOf('W'), miningWellBlock, });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock), new Object[] { "T ", "W ", Character.valueOf('T'), tankBlock, Character.valueOf('W'),
|
||||
miningWellBlock, });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(tankBlock), new Object[] { "ggg", "g g", "ggg", Character.valueOf('g'),
|
||||
Block.glass, });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(tankBlock), new Object[] { "ggg", "g g", "ggg", Character.valueOf('g'), Block.glass, });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(refineryBlock), new Object[] { " ", "RTR", "TGT", Character.valueOf('T'),
|
||||
tankBlock, Character.valueOf('G'), BuildCraftCore.diamondGearItem, Character.valueOf('R'),
|
||||
Block.torchRedstoneActive, });
|
||||
CoreProxy.proxy.addCraftingRecipe(
|
||||
new ItemStack(refineryBlock),
|
||||
new Object[] { " ", "RTR", "TGT", Character.valueOf('T'), tankBlock, Character.valueOf('G'), BuildCraftCore.diamondGearItem,
|
||||
Character.valueOf('R'), Block.torchRedstoneActive, });
|
||||
if (!hopperDisabled) {
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(hopperBlock), new Object[] { "ICI", "IGI", " I ", Character.valueOf('I'),
|
||||
Item.ingotIron, Character.valueOf('C'), Block.chest, Character.valueOf('G'), BuildCraftCore.stoneGearItem });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(hopperBlock),
|
||||
new Object[] { "ICI", "IGI", " I ", Character.valueOf('I'), Item.ingotIron, Character.valueOf('C'), Block.chest, Character.valueOf('G'),
|
||||
BuildCraftCore.stoneGearItem });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
|||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(name="BuildCraft Silicon", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
|
||||
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerSilicon.class, clientSideRequired = true, serverSideRequired = true)
|
||||
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
|
||||
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandlerSilicon.class, clientSideRequired = true, serverSideRequired = true)
|
||||
public class BuildCraftSilicon {
|
||||
public static Item redstoneChipset;
|
||||
public static BlockLaser laserBlock;
|
||||
|
@ -59,8 +59,9 @@ public class BuildCraftSilicon {
|
|||
new BptBlockRotateMeta(laserBlock.blockID, new int[] { 2, 5, 3, 4 }, true);
|
||||
new BptBlockInventory(assemblyTableBlock.blockID);
|
||||
|
||||
if (BuildCraftCore.loadDefaultRecipes)
|
||||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
|
||||
SiliconProxy.proxy.registerRenderers();
|
||||
}
|
||||
|
@ -82,8 +83,8 @@ public class BuildCraftSilicon {
|
|||
assemblyTableBlock = new BlockAssemblyTable(Integer.parseInt(assemblyTableId.value));
|
||||
GameRegistry.registerBlock(assemblyTableBlock, ItemAssemblyTable.class);
|
||||
|
||||
LanguageRegistry.addName(new ItemStack(assemblyTableBlock,0,0),"Assembly Table");
|
||||
LanguageRegistry.addName(new ItemStack(assemblyTableBlock,0,1),"Advanced Crafting Table");
|
||||
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 0), "Assembly Table");
|
||||
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 1), "Advanced Crafting Table");
|
||||
|
||||
redstoneChipset = new ItemRedstoneChipset(Integer.parseInt(redstoneChipsetId.value));
|
||||
redstoneChipset.setItemName("redstoneChipset");
|
||||
|
@ -92,141 +93,137 @@ public class BuildCraftSilicon {
|
|||
|
||||
public static void loadRecipes() {
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock), new Object[] { "ORR", "DDR", "ORR", Character.valueOf('O'),
|
||||
Block.obsidian, Character.valueOf('R'), Item.redstone, Character.valueOf('D'), Item.diamond, });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock),
|
||||
new Object[] { "ORR", "DDR", "ORR", Character.valueOf('O'), Block.obsidian, Character.valueOf('R'), Item.redstone, Character.valueOf('D'),
|
||||
Item.diamond, });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0),
|
||||
new Object[] { "ORO", "ODO", "OGO", Character.valueOf('O'), Block.obsidian, Character.valueOf('R'),
|
||||
Item.redstone, Character.valueOf('D'), Item.diamond, Character.valueOf('G'),
|
||||
BuildCraftCore.diamondGearItem, });
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0), new Object[] { "ORO", "ODO", "OGO", Character.valueOf('O'), Block.obsidian,
|
||||
Character.valueOf('R'), Item.redstone, Character.valueOf('D'), Item.diamond, Character.valueOf('G'), BuildCraftCore.diamondGearItem, });
|
||||
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1),
|
||||
new Object[] { "OWO", "OCO", "ORO", Character.valueOf('O'), Block.obsidian, Character.valueOf('W'),
|
||||
Block.workbench, Character.valueOf('C'), Block.chest, Character.valueOf('R'),
|
||||
new ItemStack(redstoneChipset, 1, 0), });
|
||||
//Add reverse recipies for all gates
|
||||
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1), new Object[] { "OWO", "OCO", "ORO", Character.valueOf('O'), Block.obsidian,
|
||||
Character.valueOf('W'), Block.workbench, Character.valueOf('C'), Block.chest, Character.valueOf('R'), new ItemStack(redstoneChipset, 1, 0), });
|
||||
// Add reverse recipies for all gates
|
||||
|
||||
//Iron
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 2),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGate, 1, 1)});
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 1),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGate, 1, 2)});
|
||||
// Iron
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 2), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 1) });
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 1), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 2) });
|
||||
|
||||
//Gold
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 4),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGate, 1, 3)});
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 3),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGate, 1, 4)});
|
||||
// Gold
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 4), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 3) });
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 3), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 4) });
|
||||
|
||||
//Diamond
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 6),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGate, 1, 5)});
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 5),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGate, 1, 6)});
|
||||
// Diamond
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 6), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 5) });
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGate, 1, 5), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 6) });
|
||||
|
||||
//Iron - Autarchic
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1)});
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2)});
|
||||
// Iron - Autarchic
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1) });
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2) });
|
||||
|
||||
//Gold - Autarchic
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3)});
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4)});
|
||||
// Gold - Autarchic
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3) });
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4) });
|
||||
|
||||
//Diamond - Autarchic
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5)});
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5),
|
||||
new Object[]{new ItemStack(redstoneChipset, 1, 0), new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6)});
|
||||
// Diamond - Autarchic
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5) });
|
||||
CoreProxy.proxy.addShapelessRecipe(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5), new Object[] { new ItemStack(redstoneChipset, 1, 0),
|
||||
new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6) });
|
||||
|
||||
// / REDSTONE CHIPSETS
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone) }, 10000,
|
||||
new ItemStack(redstoneChipset, 1, 0)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone) }, 10000, new ItemStack(redstoneChipset, 1, 0)));
|
||||
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 0), "Redstone Chipset");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone),
|
||||
new ItemStack(Item.ingotIron) }, 20000, new ItemStack(redstoneChipset, 1, 1)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone), new ItemStack(Item.ingotIron) }, 20000,
|
||||
new ItemStack(redstoneChipset, 1, 1)));
|
||||
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 1), "Redstone Iron Chipset");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone),
|
||||
new ItemStack(Item.ingotGold) }, 40000, new ItemStack(redstoneChipset, 1, 2)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone), new ItemStack(Item.ingotGold) }, 40000,
|
||||
new ItemStack(redstoneChipset, 1, 2)));
|
||||
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 2), "Redstone Golden Chipset");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone),
|
||||
new ItemStack(Item.diamond) }, 80000, new ItemStack(redstoneChipset, 1, 3)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone), new ItemStack(Item.diamond) }, 80000,
|
||||
new ItemStack(redstoneChipset, 1, 3)));
|
||||
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 3), "Redstone Diamond Chipset");
|
||||
// PULSATING CHIPSETS
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone),
|
||||
new ItemStack(Item.enderPearl) }, 40000, new ItemStack(redstoneChipset, 2, 4)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.redstone), new ItemStack(Item.enderPearl) }, 40000,
|
||||
new ItemStack(redstoneChipset, 2, 4)));
|
||||
CoreProxy.proxy.addName(new ItemStack(redstoneChipset, 1, 4), "Pulsating Chipset");
|
||||
|
||||
// / REDSTONE GATES
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 0) }, 20000,
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 0)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 0) }, 20000, new ItemStack(
|
||||
BuildCraftTransport.pipeGate, 1, 0)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 0), "Gate");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 0), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 10000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 0)));
|
||||
AssemblyRecipe.assemblyRecipes
|
||||
.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeGate, 1, 0), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 10000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 0)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 0), "Autarchic Gate");
|
||||
|
||||
// / IRON AND GATES
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 1),
|
||||
new ItemStack(BuildCraftTransport.redPipeWire) }, 40000, new ItemStack(BuildCraftTransport.pipeGate, 1, 1)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 1), "Iron AND Gate");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 1), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 20000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1)));
|
||||
AssemblyRecipe.assemblyRecipes
|
||||
.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeGate, 1, 1), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 20000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 1), "Autarchic Iron AND Gate");
|
||||
|
||||
// / IRON OR GATES
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 1),
|
||||
new ItemStack(BuildCraftTransport.redPipeWire) }, 40000, new ItemStack(BuildCraftTransport.pipeGate, 1, 2)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 2), "Iron OR Gate");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 2), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 20000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2)));
|
||||
AssemblyRecipe.assemblyRecipes
|
||||
.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeGate, 1, 2), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 20000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 2), "Autarchic Iron OR Gate");
|
||||
|
||||
// / GOLD AND GATES
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 2),
|
||||
new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire) }, 80000,
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 3)));
|
||||
new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire) }, 80000, new ItemStack(
|
||||
BuildCraftTransport.pipeGate, 1, 3)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 3), "Gold AND Gate");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 3), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 40000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3)));
|
||||
AssemblyRecipe.assemblyRecipes
|
||||
.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeGate, 1, 3), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 40000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 3), "Autarchic Gold AND Gate");
|
||||
|
||||
// / GOLD OR GATES
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 2),
|
||||
new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire) }, 80000,
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 4)));
|
||||
new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire) }, 80000, new ItemStack(
|
||||
BuildCraftTransport.pipeGate, 1, 4)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 4), "Gold OR Gate");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 4), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 40000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4)));
|
||||
AssemblyRecipe.assemblyRecipes
|
||||
.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeGate, 1, 4), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 40000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 4), "Autarchic Gold OR Gate");
|
||||
|
||||
// / DIAMOND AND GATES
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 3),
|
||||
new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire),
|
||||
new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire) }, 160000,
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 5)));
|
||||
new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire) }, 160000, new ItemStack(
|
||||
BuildCraftTransport.pipeGate, 1, 5)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 5), "Diamond AND Gate");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 5), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 80000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5)));
|
||||
AssemblyRecipe.assemblyRecipes
|
||||
.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeGate, 1, 5), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 80000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 5), "Autarchic Diamond AND Gate");
|
||||
|
||||
// / DIAMOND OR GATES
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(redstoneChipset, 1, 3),
|
||||
new ItemStack(BuildCraftTransport.redPipeWire), new ItemStack(BuildCraftTransport.bluePipeWire),
|
||||
new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire) }, 160000,
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 6)));
|
||||
new ItemStack(BuildCraftTransport.greenPipeWire), new ItemStack(BuildCraftTransport.yellowPipeWire) }, 160000, new ItemStack(
|
||||
BuildCraftTransport.pipeGate, 1, 6)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGate, 1, 6), "Diamond OR Gate");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] {
|
||||
new ItemStack(BuildCraftTransport.pipeGate, 1, 6), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 80000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6)));
|
||||
AssemblyRecipe.assemblyRecipes
|
||||
.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(BuildCraftTransport.pipeGate, 1, 6), new ItemStack(redstoneChipset, 1, 4),
|
||||
new ItemStack(redstoneChipset, 1, 1) }, 80000, new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6)));
|
||||
CoreProxy.proxy.addName(new ItemStack(BuildCraftTransport.pipeGateAutarchic, 1, 6), "Autarchic Diamond OR Gate");
|
||||
|
||||
}
|
||||
|
|
|
@ -12,32 +12,19 @@ import java.util.LinkedList;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.IMCCallback;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
import buildcraft.api.gates.Action;
|
||||
import buildcraft.api.gates.ActionManager;
|
||||
import buildcraft.api.gates.Trigger;
|
||||
import buildcraft.api.recipes.AssemblyRecipe;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.IExtractionHandler;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
import buildcraft.api.transport.PipeManager;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
|
@ -78,19 +65,31 @@ import buildcraft.transport.pipes.PipeStructureCobblestone;
|
|||
import buildcraft.transport.triggers.ActionEnergyPulser;
|
||||
import buildcraft.transport.triggers.ActionSignalOutput;
|
||||
import buildcraft.transport.triggers.TriggerPipeContents;
|
||||
import buildcraft.transport.triggers.TriggerPipeSignal;
|
||||
import buildcraft.transport.triggers.TriggerPipeContents.Kind;
|
||||
import buildcraft.transport.triggers.TriggerPipeSignal;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
||||
@Mod(version = Version.VERSION, modid="BuildCraft|Transport", name = "Buildcraft Transport", dependencies=DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels={DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerTransport.class)
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.IMCCallback;
|
||||
import cpw.mods.fml.common.Mod.Init;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.PostInit;
|
||||
import cpw.mods.fml.common.Mod.PreInit;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkMod;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE)
|
||||
@NetworkMod(channels = { DefaultProps.NET_CHANNEL_NAME }, packetHandler = PacketHandlerTransport.class)
|
||||
public class BuildCraftTransport {
|
||||
public static BlockGenericPipe genericPipeBlock;
|
||||
|
||||
|
@ -133,7 +132,7 @@ public class BuildCraftTransport {
|
|||
|
||||
public static Item facadeItem;
|
||||
|
||||
//public static Item pipeItemsStipes;
|
||||
// public static Item pipeItemsStipes;
|
||||
public static Item pipeStructureCobblestone;
|
||||
public static int groupItemsTrigger;
|
||||
|
||||
|
@ -166,87 +165,84 @@ public class BuildCraftTransport {
|
|||
}
|
||||
|
||||
private static class ExtractionHandler implements IExtractionHandler {
|
||||
private final String[] items;
|
||||
private final String[] liquids;
|
||||
private final String[] items;
|
||||
private final String[] liquids;
|
||||
|
||||
public ExtractionHandler(String[] items, String[] liquids){
|
||||
this.items = items;
|
||||
this.liquids = liquids;
|
||||
}
|
||||
public ExtractionHandler(String[] items, String[] liquids) {
|
||||
this.items = items;
|
||||
this.liquids = liquids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItems(IPipe pipe, World world, int i, int j, int k) {
|
||||
return testStrings(items, world, i, j, k);
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractItems(IPipe pipe, World world, int i, int j, int k) {
|
||||
return testStrings(items, world, i, j, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k) {
|
||||
return testStrings(liquids, world, i, j, k);
|
||||
}
|
||||
@Override
|
||||
public boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k) {
|
||||
return testStrings(liquids, world, i, j, k);
|
||||
}
|
||||
|
||||
private boolean testStrings(String[] excludedBlocks, World world, int i, int j, int k) {
|
||||
int id = world.getBlockId(i, j, k);
|
||||
Block block = Block.blocksList[id];
|
||||
if(block == null)
|
||||
private boolean testStrings(String[] excludedBlocks, World world, int i, int j, int k) {
|
||||
int id = world.getBlockId(i, j, k);
|
||||
Block block = Block.blocksList[id];
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
||||
for (String excluded : excludedBlocks) {
|
||||
if (excluded.equals(block.getBlockName()))
|
||||
return false;
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
||||
for (String excluded : excludedBlocks) {
|
||||
if (excluded.equals(block.getBlockName()))
|
||||
return false;
|
||||
|
||||
String[] tokens = excluded.split(":");
|
||||
if(tokens[0].equals(Integer.toString(id)) && (tokens.length == 1 || tokens[1].equals(Integer.toString(meta))))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
String[] tokens = excluded.split(":");
|
||||
if (tokens[0].equals(Integer.toString(id)) && (tokens.length == 1 || tokens[1].equals(Integer.toString(meta))))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private static LinkedList<PipeRecipe> pipeRecipes = new LinkedList<PipeRecipe>();
|
||||
|
||||
@PreInit
|
||||
public void preInitialize(FMLPreInitializationEvent evt)
|
||||
{
|
||||
try
|
||||
{
|
||||
Property alwaysConnect = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"pipes.alwaysConnect", DefaultProps.PIPES_ALWAYS_CONNECT);
|
||||
public void preInitialize(FMLPreInitializationEvent evt) {
|
||||
try {
|
||||
Property alwaysConnect = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.alwaysConnect",
|
||||
DefaultProps.PIPES_ALWAYS_CONNECT);
|
||||
alwaysConnect.comment = "set to false to deactivate pipe connection rules, true by default";
|
||||
alwaysConnectPipes = alwaysConnect.getBoolean(DefaultProps.PIPES_ALWAYS_CONNECT);
|
||||
|
||||
Property pipeLoss = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"power.usePipeLoss", DefaultProps.USE_PIPELOSS);
|
||||
Property pipeLoss = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "power.usePipeLoss", DefaultProps.USE_PIPELOSS);
|
||||
pipeLoss.comment = "Set to false to turn off energy loss over distance on all power pipes";
|
||||
usePipeLoss = pipeLoss.getBoolean(DefaultProps.USE_PIPELOSS);
|
||||
|
||||
Property durability = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.durability", DefaultProps.PIPES_DURABILITY);
|
||||
durability.comment = "How long a pipe will take to break";
|
||||
pipeDurability = (float)durability.getDouble(DefaultProps.PIPES_DURABILITY);
|
||||
|
||||
Property exclusionItemList = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_BLOCK,"woodenPipe.item.exclusion", "");
|
||||
pipeDurability = (float) durability.getDouble(DefaultProps.PIPES_DURABILITY);
|
||||
|
||||
Property exclusionItemList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_BLOCK, "woodenPipe.item.exclusion", "");
|
||||
|
||||
String[] excludedItemBlocks = exclusionItemList.value.split(",");
|
||||
for (int j = 0; j < excludedItemBlocks.length; ++j)
|
||||
{
|
||||
for (int j = 0; j < excludedItemBlocks.length; ++j) {
|
||||
excludedItemBlocks[j] = excludedItemBlocks[j].trim();
|
||||
}
|
||||
|
||||
Property exclusionLiquidList = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_BLOCK,"woodenPipe.liquid.exclusion", "");
|
||||
Property exclusionLiquidList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_BLOCK, "woodenPipe.liquid.exclusion", "");
|
||||
|
||||
String[] excludedLiquidBlocks = exclusionLiquidList.value.split(",");
|
||||
for (int j = 0; j < excludedLiquidBlocks.length; ++j)
|
||||
{
|
||||
for (int j = 0; j < excludedLiquidBlocks.length; ++j) {
|
||||
excludedLiquidBlocks[j] = excludedLiquidBlocks[j].trim();
|
||||
}
|
||||
|
||||
PipeManager.registerExtractionHandler(new ExtractionHandler(excludedItemBlocks, excludedLiquidBlocks));
|
||||
|
||||
Property maxItemInPipesProp = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"pipes.maxItems", 100);
|
||||
Property maxItemInPipesProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.maxItems", 100);
|
||||
maxItemInPipesProp.comment = "pipes containing more than this amount of items will explode, not dropping any item";
|
||||
|
||||
maxItemsInPipes = Integer.parseInt(maxItemInPipesProp.value);
|
||||
|
||||
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_GENERAL,"pipes.groupItemsTrigger", 32);
|
||||
Property groupItemsTriggerProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "pipes.groupItemsTrigger", 32);
|
||||
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
|
||||
|
||||
groupItemsTrigger = Integer.parseInt(groupItemsTriggerProp.value);
|
||||
|
@ -264,18 +260,26 @@ public class BuildCraftTransport {
|
|||
|
||||
// Fixing retro-compatiblity
|
||||
pipeItemsWood = createPipe(DefaultProps.PIPE_ITEMS_WOOD_ID, PipeItemsWood.class, "Wooden Transport Pipe", Block.planks, Block.glass, Block.planks);
|
||||
pipeItemsCobblestone = createPipe(DefaultProps.PIPE_ITEMS_COBBLESTONE_ID, PipeItemsCobblestone.class, "Cobblestone Transport Pipe", Block.cobblestone, Block.glass, Block.cobblestone);
|
||||
pipeItemsCobblestone = createPipe(DefaultProps.PIPE_ITEMS_COBBLESTONE_ID, PipeItemsCobblestone.class, "Cobblestone Transport Pipe",
|
||||
Block.cobblestone, Block.glass, Block.cobblestone);
|
||||
pipeItemsStone = createPipe(DefaultProps.PIPE_ITEMS_STONE_ID, PipeItemsStone.class, "Stone Transport Pipe", Block.stone, Block.glass, Block.stone);
|
||||
pipeItemsIron = createPipe(DefaultProps.PIPE_ITEMS_IRON_ID, PipeItemsIron.class, "Iron Transport Pipe", Item.ingotIron, Block.glass, Item.ingotIron);
|
||||
pipeItemsGold = createPipe(DefaultProps.PIPE_ITEMS_GOLD_ID, PipeItemsGold.class, "Golden Transport Pipe", Item.ingotGold, Block.glass, Item.ingotGold);
|
||||
pipeItemsDiamond = createPipe(DefaultProps.PIPE_ITEMS_DIAMOND_ID, PipeItemsDiamond.class, "Diamond Transport Pipe", Item.diamond, Block.glass, Item.diamond);
|
||||
pipeItemsObsidian = createPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Block.obsidian, Block.glass, Block.obsidian);
|
||||
pipeItemsGold = createPipe(DefaultProps.PIPE_ITEMS_GOLD_ID, PipeItemsGold.class, "Golden Transport Pipe", Item.ingotGold, Block.glass,
|
||||
Item.ingotGold);
|
||||
pipeItemsDiamond = createPipe(DefaultProps.PIPE_ITEMS_DIAMOND_ID, PipeItemsDiamond.class, "Diamond Transport Pipe", Item.diamond, Block.glass,
|
||||
Item.diamond);
|
||||
pipeItemsObsidian = createPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Block.obsidian,
|
||||
Block.glass, Block.obsidian);
|
||||
|
||||
pipeLiquidsWood = createPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeLiquidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood, null);
|
||||
pipeLiquidsCobblestone = createPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeLiquidsCobblestone.class, "Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone, null);
|
||||
pipeLiquidsStone = createPipe(DefaultProps.PIPE_LIQUIDS_STONE_ID, PipeLiquidsStone.class, "Stone Waterproof Pipe", pipeWaterproof, pipeItemsStone, null);
|
||||
pipeLiquidsWood = createPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeLiquidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood,
|
||||
null);
|
||||
pipeLiquidsCobblestone = createPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeLiquidsCobblestone.class, "Cobblestone Waterproof Pipe",
|
||||
pipeWaterproof, pipeItemsCobblestone, null);
|
||||
pipeLiquidsStone = createPipe(DefaultProps.PIPE_LIQUIDS_STONE_ID, PipeLiquidsStone.class, "Stone Waterproof Pipe", pipeWaterproof, pipeItemsStone,
|
||||
null);
|
||||
pipeLiquidsIron = createPipe(DefaultProps.PIPE_LIQUIDS_IRON_ID, PipeLiquidsIron.class, "Iron Waterproof Pipe", pipeWaterproof, pipeItemsIron, null);
|
||||
pipeLiquidsGold = createPipe(DefaultProps.PIPE_LIQUIDS_GOLD_ID, PipeLiquidsGold.class, "Golden Waterproof Pipe", pipeWaterproof, pipeItemsGold, null);
|
||||
pipeLiquidsGold = createPipe(DefaultProps.PIPE_LIQUIDS_GOLD_ID, PipeLiquidsGold.class, "Golden Waterproof Pipe", pipeWaterproof, pipeItemsGold,
|
||||
null);
|
||||
// diamond
|
||||
// obsidian
|
||||
|
||||
|
@ -288,21 +292,24 @@ public class BuildCraftTransport {
|
|||
// obsidian
|
||||
|
||||
// Fix name and recipe (Structure pipe insteand of Signal?)
|
||||
pipeStructureCobblestone = createPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe", Block.gravel, pipeItemsCobblestone, null);
|
||||
pipeStructureCobblestone = createPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe",
|
||||
Block.gravel, pipeItemsCobblestone, null);
|
||||
|
||||
// Fix the recipe
|
||||
//pipeItemsStipes = createPipe(DefaultProps.PIPE_ITEMS_STRIPES_ID, PipeItemsStripes.class, "Stripes Transport Pipe", new ItemStack(Item.dyePowder, 1, 0), Block.glass, new ItemStack(Item.dyePowder, 1, 11));
|
||||
// pipeItemsStipes = createPipe(DefaultProps.PIPE_ITEMS_STRIPES_ID, PipeItemsStripes.class, "Stripes Transport Pipe", new ItemStack(Item.dyePowder,
|
||||
// 1, 0), Block.glass, new ItemStack(Item.dyePowder, 1, 11));
|
||||
|
||||
pipeItemsVoid = createPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe", new ItemStack(Item.dyePowder, 1, 0), Block.glass, Item.redstone);
|
||||
pipeItemsVoid = createPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe", new ItemStack(Item.dyePowder, 1, 0),
|
||||
Block.glass, Item.redstone);
|
||||
|
||||
pipeLiquidsVoid = createPipe(DefaultProps.PIPE_LIQUIDS_VOID_ID, PipeLiquidsVoid.class, "Void Waterproof Pipe", pipeWaterproof, pipeItemsVoid, null);
|
||||
|
||||
pipeItemsSandstone = createPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe", Block.sandStone, Block.glass, Block.sandStone);
|
||||
pipeItemsSandstone = createPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe", Block.sandStone,
|
||||
Block.glass, Block.sandStone);
|
||||
|
||||
pipeLiquidsSandstone = createPipe(DefaultProps.PIPE_LIQUIDS_SANDSTONE_ID, PipeLiquidsSandstone.class, "Sandstone Waterproof Pipe", pipeWaterproof, pipeItemsSandstone, null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
pipeLiquidsSandstone = createPipe(DefaultProps.PIPE_LIQUIDS_SANDSTONE_ID, PipeLiquidsSandstone.class, "Sandstone Waterproof Pipe", pipeWaterproof,
|
||||
pipeItemsSandstone, null);
|
||||
} finally {
|
||||
BuildCraftCore.mainConfiguration.save();
|
||||
}
|
||||
}
|
||||
|
@ -310,10 +317,10 @@ public class BuildCraftTransport {
|
|||
@Init
|
||||
public void load(FMLInitializationEvent evt) {
|
||||
// Register connection handler
|
||||
//MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
||||
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());
|
||||
|
||||
// Register gui handler
|
||||
//MinecraftForge.setGuiHandler(mod_BuildCraftTransport.instance, new GuiHandler());
|
||||
// MinecraftForge.setGuiHandler(mod_BuildCraftTransport.instance, new GuiHandler());
|
||||
|
||||
TransportProxy.proxy.registerTileEntities();
|
||||
|
||||
|
@ -326,48 +333,48 @@ public class BuildCraftTransport {
|
|||
// ModLoader.RegisterTileEntity(TileDockingStation.class,
|
||||
// "net.minecraft.src.buildcraft.TileDockingStation");
|
||||
|
||||
for (int j = 0; j < 6; ++j)
|
||||
{
|
||||
for (int j = 0; j < 6; ++j) {
|
||||
diamondTextures[j] = 1 * 16 + 6 + j;
|
||||
}
|
||||
|
||||
Property redPipeWireId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"redPipeWire.id", DefaultProps.RED_PIPE_WIRE);
|
||||
Property redPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "redPipeWire.id", DefaultProps.RED_PIPE_WIRE);
|
||||
redPipeWire = new ItemBuildCraft(Integer.parseInt(redPipeWireId.value)).setIconIndex(4 * 16 + 0).setCreativeTab(CreativeTabs.tabRedstone);
|
||||
redPipeWire.setItemName("redPipeWire");
|
||||
LanguageRegistry.addName(redPipeWire, "Red Pipe Wire");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 1),
|
||||
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(redPipeWire, 8)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 1), new ItemStack(Item.redstone, 1),
|
||||
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(redPipeWire, 8)));
|
||||
|
||||
Property bluePipeWireId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"bluePipeWire.id", DefaultProps.BLUE_PIPE_WIRE);
|
||||
Property bluePipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "bluePipeWire.id", DefaultProps.BLUE_PIPE_WIRE);
|
||||
bluePipeWire = new ItemBuildCraft(Integer.parseInt(bluePipeWireId.value)).setIconIndex(4 * 16 + 1).setCreativeTab(CreativeTabs.tabRedstone);
|
||||
bluePipeWire.setItemName("bluePipeWire");
|
||||
LanguageRegistry.addName(bluePipeWire, "Blue Pipe Wire");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4),
|
||||
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(bluePipeWire, 8)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.redstone, 1),
|
||||
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(bluePipeWire, 8)));
|
||||
|
||||
Property greenPipeWireId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"greenPipeWire.id", DefaultProps.GREEN_PIPE_WIRE);
|
||||
Property greenPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "greenPipeWire.id", DefaultProps.GREEN_PIPE_WIRE);
|
||||
greenPipeWire = new ItemBuildCraft(Integer.parseInt(greenPipeWireId.value)).setIconIndex(4 * 16 + 2).setCreativeTab(CreativeTabs.tabRedstone);
|
||||
greenPipeWire.setItemName("greenPipeWire");
|
||||
LanguageRegistry.addName(greenPipeWire, "Green Pipe Wire");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 2),
|
||||
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(greenPipeWire, 8)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 2), new ItemStack(Item.redstone, 1),
|
||||
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(greenPipeWire, 8)));
|
||||
|
||||
Property yellowPipeWireId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"yellowPipeWire.id", DefaultProps.YELLOW_PIPE_WIRE);
|
||||
Property yellowPipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "yellowPipeWire.id", DefaultProps.YELLOW_PIPE_WIRE);
|
||||
yellowPipeWire = new ItemBuildCraft(Integer.parseInt(yellowPipeWireId.value)).setIconIndex(4 * 16 + 3).setCreativeTab(CreativeTabs.tabRedstone);
|
||||
yellowPipeWire.setItemName("yellowPipeWire");
|
||||
LanguageRegistry.addName(yellowPipeWire, "Yellow Pipe Wire");
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 11),
|
||||
new ItemStack(Item.redstone, 1), new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(yellowPipeWire, 8)));
|
||||
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(new ItemStack[] { new ItemStack(Item.dyePowder, 1, 11), new ItemStack(Item.redstone, 1),
|
||||
new ItemStack(Item.ingotIron, 1) }, 500, new ItemStack(yellowPipeWire, 8)));
|
||||
|
||||
Property pipeGateId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"pipeGate.id", DefaultProps.GATE_ID);
|
||||
Property pipeGateId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGate.id", DefaultProps.GATE_ID);
|
||||
pipeGate = new ItemGate(Integer.parseInt(pipeGateId.value), 0).setIconIndex(2 * 16 + 3);
|
||||
pipeGate.setItemName("pipeGate");
|
||||
|
||||
Property pipeGateAutarchicId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"pipeGateAutarchic.id", DefaultProps.GATE_AUTARCHIC_ID);
|
||||
Property pipeGateAutarchicId = BuildCraftCore.mainConfiguration
|
||||
.get(Configuration.CATEGORY_ITEM, "pipeGateAutarchic.id", DefaultProps.GATE_AUTARCHIC_ID);
|
||||
pipeGateAutarchic = new ItemGate(Integer.parseInt(pipeGateAutarchicId.value), 1).setIconIndex(2 * 16 + 3);
|
||||
pipeGateAutarchic.setItemName("pipeGateAutarchic");
|
||||
|
||||
Property pipeFacadeId = BuildCraftCore.mainConfiguration.get( Configuration.CATEGORY_ITEM,"pipeFacade.id", DefaultProps.PIPE_FACADE_ID);
|
||||
Property pipeFacadeId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeFacade.id", DefaultProps.PIPE_FACADE_ID);
|
||||
facadeItem = new ItemFacade(Integer.parseInt(pipeFacadeId.value));
|
||||
facadeItem.setItemName("pipeFacade");
|
||||
|
||||
|
@ -383,8 +390,7 @@ public class BuildCraftTransport {
|
|||
|
||||
ActionManager.registerTriggerProvider(new PipeTriggerProvider());
|
||||
|
||||
if (BuildCraftCore.loadDefaultRecipes)
|
||||
{
|
||||
if (BuildCraftCore.loadDefaultRecipes) {
|
||||
loadRecipes();
|
||||
}
|
||||
|
||||
|
@ -403,14 +409,10 @@ public class BuildCraftTransport {
|
|||
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Item.dyePowder, 1, 2));
|
||||
|
||||
// Add pipe recipes
|
||||
for (PipeRecipe pipe : pipeRecipes)
|
||||
{
|
||||
if (pipe.isShapeless)
|
||||
{
|
||||
for (PipeRecipe pipe : pipeRecipes) {
|
||||
if (pipe.isShapeless) {
|
||||
GameRegistry.addShapelessRecipe(pipe.result, pipe.input);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GameRegistry.addRecipe(pipe.result, pipe.input);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package buildcraft.api.blueprints;
|
||||
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
|
||||
public class BlueprintManager {
|
||||
|
||||
|
@ -11,20 +11,20 @@ public class BlueprintManager {
|
|||
|
||||
public static ItemSignature getItemSignature(Item item) {
|
||||
ItemSignature sig = new ItemSignature();
|
||||
|
||||
|
||||
if (item.shiftedIndex >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) {
|
||||
sig.itemClassName = item.getClass().getSimpleName();
|
||||
}
|
||||
|
||||
|
||||
sig.itemName = item.getItemNameIS(new ItemStack(item));
|
||||
|
||||
|
||||
return sig;
|
||||
}
|
||||
|
||||
public static BlockSignature getBlockSignature(Block block) {
|
||||
return BlueprintManager.blockBptProps[0].getSignature(block);
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
// Initialize defaults for block properties.
|
||||
for (int i = 0; i < BlueprintManager.blockBptProps.length; ++i) {
|
||||
|
|
|
@ -12,46 +12,34 @@ package buildcraft.api.blueprints;
|
|||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.BuildCraftAPI;
|
||||
|
||||
/**
|
||||
* This class allow to specify specific behavior for blocks stored in
|
||||
* blueprints:
|
||||
* This class allow to specify specific behavior for blocks stored in blueprints:
|
||||
*
|
||||
* - what items needs to be used to create that block - how the block has to be
|
||||
* built on the world - how to rotate the block - what extra data to store /
|
||||
* load in the blueprint
|
||||
* - what items needs to be used to create that block - how the block has to be built on the world - how to rotate the block - what extra data to store / load
|
||||
* in the blueprint
|
||||
*
|
||||
* Default implementations of this can be seen in the package
|
||||
* buildcraft.api.bptblocks. The class BptBlockUtils provide
|
||||
* some additional utilities.
|
||||
* Default implementations of this can be seen in the package buildcraft.api.bptblocks. The class BptBlockUtils provide some additional utilities.
|
||||
*
|
||||
* Blueprints perform "id translation" in case the block ids between a blueprint
|
||||
* and the world installation are different. In order to translate block ids,
|
||||
* blocks needs to be uniquely identified. By default, this identification is
|
||||
* done by:
|
||||
* Blueprints perform "id translation" in case the block ids between a blueprint and the world installation are different. In order to translate block ids,
|
||||
* blocks needs to be uniquely identified. By default, this identification is done by:
|
||||
*
|
||||
* - the block simple class name - the tile simple class name (if any) - the
|
||||
* block name
|
||||
* - the block simple class name - the tile simple class name (if any) - the block name
|
||||
*
|
||||
* In certain circumstances, the above is not enough (e.g. if several blocks
|
||||
* share the same class and the same name, with no tile). In this case,
|
||||
* additional data may be provided by children of this class:
|
||||
* In certain circumstances, the above is not enough (e.g. if several blocks share the same class and the same name, with no tile). In this case, additional
|
||||
* data may be provided by children of this class:
|
||||
*
|
||||
* - mod name - custom signature
|
||||
*
|
||||
* At blueprint load time, BuildCraft will check that each block id of the
|
||||
* blueprint corresponds to the block id in the installation. If not, it will
|
||||
* perform a search through the block list, and upon matching signature, it will
|
||||
* translate all blocks ids of the blueprint to the installation ones. If no
|
||||
* such block id is found, BuildCraft will assume that the block is not
|
||||
* installed and will not load the blueprint.
|
||||
* At blueprint load time, BuildCraft will check that each block id of the blueprint corresponds to the block id in the installation. If not, it will perform a
|
||||
* search through the block list, and upon matching signature, it will translate all blocks ids of the blueprint to the installation ones. If no such block id
|
||||
* is found, BuildCraft will assume that the block is not installed and will not load the blueprint.
|
||||
*/
|
||||
public class BptBlock {
|
||||
|
||||
|
@ -64,9 +52,8 @@ public class BptBlock {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the requirements needed to build this block. When the
|
||||
* requirements are met, they will be removed all at once from the builder,
|
||||
* before calling buildBlock.
|
||||
* Returns the requirements needed to build this block. When the requirements are met, they will be removed all at once from the builder, before calling
|
||||
* buildBlock.
|
||||
*/
|
||||
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
|
||||
if (slot.blockId != 0) {
|
||||
|
@ -79,18 +66,13 @@ public class BptBlock {
|
|||
}
|
||||
|
||||
/**
|
||||
* This is called each time an item matches a reqquirement, that is: (req id
|
||||
* == stack id) for damageable items (req id == stack id && req dmg == stack
|
||||
* dmg) for other items by default, it will increase damage of damageable
|
||||
* items by the amount of damage of the requirement, and remove the intended
|
||||
* amount of non damageable item.
|
||||
* This is called each time an item matches a reqquirement, that is: (req id == stack id) for damageable items (req id == stack id && req dmg == stack dmg)
|
||||
* for other items by default, it will increase damage of damageable items by the amount of damage of the requirement, and remove the intended amount of non
|
||||
* damageable item.
|
||||
*
|
||||
* Client may override this behavior for default items. Note that this
|
||||
* subprogram may be called twice with the same parameters, once with a copy
|
||||
* of requirements and stack to check if the entire requirements can be
|
||||
* fullfilled, and once with the real inventory. Implementer is responsible
|
||||
* for updating req (with the remaining requirements if any) and stack
|
||||
* (after usage)
|
||||
* Client may override this behavior for default items. Note that this subprogram may be called twice with the same parameters, once with a copy of
|
||||
* requirements and stack to check if the entire requirements can be fullfilled, and once with the real inventory. Implementer is responsible for updating
|
||||
* req (with the remaining requirements if any) and stack (after usage)
|
||||
*
|
||||
* returns: what was used (similer to req, but created from stack, so that any NBT based differences are drawn from the correct source)
|
||||
*/
|
||||
|
@ -128,15 +110,13 @@ public class BptBlock {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if the block on the world correspond to the block stored in
|
||||
* the blueprint at the location given by the slot. By default, this
|
||||
* subprogram is permissive and doesn't take into account metadata.
|
||||
* Return true if the block on the world correspond to the block stored in the blueprint at the location given by the slot. By default, this subprogram is
|
||||
* permissive and doesn't take into account metadata.
|
||||
*
|
||||
* Added metadata sensitivity //Krapht
|
||||
*/
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z)
|
||||
&& slot.meta == context.world().getBlockMetadata(slot.x, slot.y, slot.z);
|
||||
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z) && slot.meta == context.world().getBlockMetadata(slot.x, slot.y, slot.z);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,21 +148,17 @@ public class BptBlock {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return true if the block should not be placed to the world. Requirements
|
||||
* will not be asked on such a block, and building will not be called.
|
||||
* Return true if the block should not be placed to the world. Requirements will not be asked on such a block, and building will not be called.
|
||||
*/
|
||||
public boolean ignoreBuilding(BptSlotInfo slot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a slot from the blueprint according to an objet placed on {x,
|
||||
* y, z} on the world. This typically means adding entries in slot.cpt. Note
|
||||
* that "id" and "meta" will be set automatically, corresponding to the
|
||||
* block id and meta.
|
||||
* Initializes a slot from the blueprint according to an objet placed on {x, y, z} on the world. This typically means adding entries in slot.cpt. Note that
|
||||
* "id" and "meta" will be set automatically, corresponding to the block id and meta.
|
||||
*
|
||||
* By default, if the block is a BlockContainer, tile information will be to
|
||||
* save / load the block.
|
||||
* By default, if the block is a BlockContainer, tile information will be to save / load the block.
|
||||
*/
|
||||
public void initializeFromWorld(BptSlotInfo slot, IBptContext context, int x, int y, int z) {
|
||||
if (Block.blocksList[slot.blockId] instanceof BlockContainer) {
|
||||
|
@ -194,8 +170,7 @@ public class BptBlock {
|
|||
}
|
||||
|
||||
if (Block.blocksList[slot.blockId] != null) {
|
||||
ArrayList<ItemStack> req = Block.blocksList[slot.blockId].getBlockDropped(context.world(), x, y, z, context.world()
|
||||
.getBlockMetadata(x, y, z), 0);
|
||||
ArrayList<ItemStack> req = Block.blocksList[slot.blockId].getBlockDropped(context.world(), x, y, z, context.world().getBlockMetadata(x, y, z), 0);
|
||||
|
||||
if (req != null) {
|
||||
slot.storedRequirements.addAll(req);
|
||||
|
@ -204,19 +179,16 @@ public class BptBlock {
|
|||
}
|
||||
|
||||
/**
|
||||
* Called on a block when the blueprint has finished to place all the
|
||||
* blocks. This may be useful to adjust variable depending on surrounding
|
||||
* blocks that may not be there already at initial building.
|
||||
* Called on a block when the blueprint has finished to place all the blocks. This may be useful to adjust variable depending on surrounding blocks that may
|
||||
* not be there already at initial building.
|
||||
*/
|
||||
public void postProcessing(BptSlotInfo slot, IBptContext context) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, block class name, block tile name and block name are used to
|
||||
* define block signature. Overriding this subprogram may allow to replace
|
||||
* some of these with stars, specify the mod that this block kind is coming
|
||||
* from or add custom data to the signature.
|
||||
* By default, block class name, block tile name and block name are used to define block signature. Overriding this subprogram may allow to replace some of
|
||||
* these with stars, specify the mod that this block kind is coming from or add custom data to the signature.
|
||||
*/
|
||||
public BlockSignature getSignature(Block block) {
|
||||
BlockSignature sig = new BlockSignature();
|
||||
|
@ -225,7 +197,7 @@ public class BptBlock {
|
|||
sig.blockClassName = block.getClass().getSimpleName();
|
||||
|
||||
if (block instanceof BlockContainer) {
|
||||
//TODO: Try to see if we can get a world instance to call with instead of null
|
||||
// TODO: Try to see if we can get a world instance to call with instead of null
|
||||
TileEntity tile = ((BlockContainer) block).createNewTileEntity(null);
|
||||
|
||||
if (tile != null) {
|
||||
|
@ -241,23 +213,18 @@ public class BptBlock {
|
|||
}
|
||||
|
||||
/**
|
||||
* By default, block name, block and tile classes, mod name and custom
|
||||
* signature are matched to verify if a blueprint block corresponds to the
|
||||
* installation block - except for the default blocks which don't check for
|
||||
* classes. For any value, * means match with anything. For compatibilty and
|
||||
* evolution reasons, mods may want to write a different policy, allowing to
|
||||
* migrate one format to the other.
|
||||
* By default, block name, block and tile classes, mod name and custom signature are matched to verify if a blueprint block corresponds to the installation
|
||||
* block - except for the default blocks which don't check for classes. For any value, * means match with anything. For compatibilty and evolution reasons,
|
||||
* mods may want to write a different policy, allowing to migrate one format to the other.
|
||||
*/
|
||||
public boolean match(Block block, BlockSignature sig) {
|
||||
if (block == null) {
|
||||
if (block == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
BlockSignature inst = BlueprintManager.getBlockSignature(block);
|
||||
|
||||
return starMatch(sig.blockName, inst.blockName) && starMatch(sig.blockClassName, inst.blockClassName)
|
||||
&& starMatch(sig.tileClassName, inst.tileClassName) && starMatch(sig.customField, inst.customField)
|
||||
&& starMatch(sig.mod, inst.mod);
|
||||
&& starMatch(sig.tileClassName, inst.tileClassName) && starMatch(sig.customField, inst.customField) && starMatch(sig.mod, inst.mod);
|
||||
}
|
||||
|
||||
private boolean starMatch(String s1, String s2) {
|
||||
|
|
|
@ -11,7 +11,6 @@ package buildcraft.api.blueprints;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -50,9 +49,8 @@ public class BptBlockUtils {
|
|||
public static ItemStack[] getItemStacks(BptSlotInfo slot, IBptContext context) {
|
||||
NBTTagList list = (NBTTagList) slot.cpt.getTag("inv");
|
||||
|
||||
if (list == null) {
|
||||
if (list == null)
|
||||
return new ItemStack[0];
|
||||
}
|
||||
|
||||
ItemStack stacks[] = new ItemStack[list.tagCount()];
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* This class records a slot, either from a blueprint or from a block placed in
|
||||
* the world.
|
||||
* This class records a slot, either from a blueprint or from a block placed in the world.
|
||||
*/
|
||||
public class BptSlotInfo {
|
||||
|
||||
|
@ -27,17 +26,13 @@ public class BptSlotInfo {
|
|||
public int z;
|
||||
|
||||
/**
|
||||
* This field contains requirements for a given block when stored in the
|
||||
* blueprint. Modders can either rely on this list or compute their own int
|
||||
* BptBlock.
|
||||
* This field contains requirements for a given block when stored in the blueprint. Modders can either rely on this list or compute their own int BptBlock.
|
||||
*/
|
||||
public LinkedList<ItemStack> storedRequirements = new LinkedList<ItemStack>();
|
||||
|
||||
/**
|
||||
* This tree contains additional data to be stored in the blueprint. By
|
||||
* default, it will be initialized from BptBlock.initializeFromWorld with
|
||||
* the standard readNBT function of the corresponding tile (if any) and will
|
||||
* be loaded from BptBlock.buildBlock using the standard writeNBT function.
|
||||
* This tree contains additional data to be stored in the blueprint. By default, it will be initialized from BptBlock.initializeFromWorld with the standard
|
||||
* readNBT function of the corresponding tile (if any) and will be loaded from BptBlock.buildBlock using the standard writeNBT function.
|
||||
*/
|
||||
public NBTTagCompound cpt = new NBTTagCompound();
|
||||
|
||||
|
|
|
@ -9,39 +9,32 @@
|
|||
|
||||
package buildcraft.api.blueprints;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.core.Position;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.core.Position;
|
||||
|
||||
/**
|
||||
* This interface provide contextual information when building or initializing
|
||||
* blueprint slots.
|
||||
* This interface provide contextual information when building or initializing blueprint slots.
|
||||
*/
|
||||
public interface IBptContext {
|
||||
|
||||
/**
|
||||
* If bptItemStack is an ItemStack extracted from the blueprint containing
|
||||
* this mapping, this will return an item stack with the id of the current
|
||||
* world
|
||||
* If bptItemStack is an ItemStack extracted from the blueprint containing this mapping, this will return an item stack with the id of the current world
|
||||
*/
|
||||
public ItemStack mapItemStack(ItemStack bptItemStack);
|
||||
|
||||
/**
|
||||
* Blueprints may be created in a world with a given id setting, and then
|
||||
* ported to a world with different ids. Heuristics are used to retreive
|
||||
* these new ids automatically. This interface provide services to map ids
|
||||
* from a blueprints to current ids in the world, and should be used
|
||||
* whenever storing block numbers or item stacks in blueprints..
|
||||
* Blueprints may be created in a world with a given id setting, and then ported to a world with different ids. Heuristics are used to retreive these new
|
||||
* ids automatically. This interface provide services to map ids from a blueprints to current ids in the world, and should be used whenever storing block
|
||||
* numbers or item stacks in blueprints..
|
||||
*/
|
||||
public int mapWorldId(int bptWorldId);
|
||||
|
||||
/**
|
||||
* This asks the id mapping to store a mapping from this Id, which may be
|
||||
* either an itemId or a blockId. In effect, the blueprint will record it
|
||||
* and make it available upon blueprint load. Note that block present in the
|
||||
* blueprint are automatically stored upon blueprint save, so this is really
|
||||
* only needed when writing ids that are e.g. in inventory stacks.
|
||||
* This asks the id mapping to store a mapping from this Id, which may be either an itemId or a blockId. In effect, the blueprint will record it and make it
|
||||
* available upon blueprint load. Note that block present in the blueprint are automatically stored upon blueprint save, so this is really only needed when
|
||||
* writing ids that are e.g. in inventory stacks.
|
||||
*/
|
||||
public void storeId(int worldId);
|
||||
|
||||
|
|
|
@ -11,13 +11,12 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockBed extends BptBlock {
|
||||
|
||||
public BptBlockBed(int blockId) {
|
||||
|
@ -54,9 +53,8 @@ public class BptBlockBed extends BptBlock {
|
|||
|
||||
@Override
|
||||
public void buildBlock(BptSlotInfo slot, IBptContext context) {
|
||||
if ((slot.meta & 8) != 0) {
|
||||
if ((slot.meta & 8) != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
context.world().setBlockAndMetadataWithNotify(slot.x, slot.y, slot.z, slot.blockId, slot.meta);
|
||||
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockCustomStack extends BptBlock {
|
||||
|
||||
final ItemStack customStack;
|
||||
|
|
|
@ -11,13 +11,12 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BlueprintManager;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockDelegate extends BptBlock {
|
||||
|
||||
final int delegateTo;
|
||||
|
@ -45,11 +44,10 @@ public class BptBlockDelegate extends BptBlock {
|
|||
BptSlotInfo newSlot = slot.clone();
|
||||
slot.blockId = delegateTo;
|
||||
|
||||
if (BlueprintManager.blockBptProps[delegateTo] != null) {
|
||||
if (BlueprintManager.blockBptProps[delegateTo] != null)
|
||||
return BlueprintManager.blockBptProps[delegateTo].isValid(newSlot, context);
|
||||
} else {
|
||||
else
|
||||
return super.isValid(newSlot, context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,13 +11,12 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockDirt extends BptBlock {
|
||||
|
||||
public BptBlockDirt(int blockId) {
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockDoor extends BptBlock {
|
||||
|
||||
final ItemStack stack;
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockIgnore extends BptBlock {
|
||||
|
||||
public BptBlockIgnore(int blockId) {
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockIgnoreMeta extends BptBlock {
|
||||
|
||||
public BptBlockIgnoreMeta(int blockId) {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package buildcraft.api.bptblocks;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class BptBlockInventory extends BptBlock {
|
||||
|
||||
|
|
|
@ -11,11 +11,10 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockLever extends BptBlockWallSide {
|
||||
|
||||
public BptBlockLever(int blockId) {
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockLiquid extends BptBlock {
|
||||
|
||||
private final ItemStack bucketStack;
|
||||
|
@ -36,12 +35,10 @@ public class BptBlockLiquid extends BptBlock {
|
|||
|
||||
@Override
|
||||
public boolean isValid(BptSlotInfo slot, IBptContext context) {
|
||||
if (slot.meta == 0) {
|
||||
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z)
|
||||
&& context.world().getBlockMetadata(slot.x, slot.y, slot.z) == 0;
|
||||
} else {
|
||||
if (slot.meta == 0)
|
||||
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z) && context.world().getBlockMetadata(slot.x, slot.y, slot.z) == 0;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockPumpkin extends BptBlock {
|
||||
|
||||
public BptBlockPumpkin(int blockId) {
|
||||
|
|
|
@ -11,13 +11,12 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockRedstoneRepeater extends BptBlock {
|
||||
|
||||
public BptBlockRedstoneRepeater(int blockId) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package buildcraft.api.bptblocks;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class BptBlockRotateInventory extends BptBlockRotateMeta {
|
||||
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockRotateMeta extends BptBlock {
|
||||
|
||||
int[] rot;
|
||||
|
|
|
@ -11,15 +11,14 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BlockSignature;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockSign extends BptBlock {
|
||||
|
||||
boolean isWall;
|
||||
|
@ -45,7 +44,7 @@ public class BptBlockSign extends BptBlock {
|
|||
}
|
||||
slot.meta = (int) (angle / 360.0 * 16.0);
|
||||
} else {
|
||||
// slot.meta = ForgeDirection.values()[slot.meta].rotateLeft().ordinal();
|
||||
// slot.meta = ForgeDirection.values()[slot.meta].rotateLeft().ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockStairs extends BptBlock {
|
||||
|
||||
public BptBlockStairs(int blockId) {
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.api.bptblocks;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptSlotInfo;
|
||||
import buildcraft.api.blueprints.IBptContext;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BptBlockWallSide extends BptBlock {
|
||||
|
||||
public BptBlockWallSide(int blockId) {
|
||||
|
|
|
@ -21,7 +21,7 @@ public class BuildCraftAPI {
|
|||
public static final int LAST_ORIGINAL_ITEM = 126;
|
||||
|
||||
public static final boolean[] softBlocks = new boolean[Block.blocksList.length];
|
||||
|
||||
|
||||
@Deprecated
|
||||
// To be removed
|
||||
public static boolean softBlock(int blockId) {
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
package buildcraft.api.core;
|
||||
|
||||
/**
|
||||
* To be implemented by TileEntities able to provide a square area on the world,
|
||||
* typically BuildCraft markers.
|
||||
* To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers.
|
||||
*/
|
||||
public interface IAreaProvider {
|
||||
|
||||
|
|
|
@ -16,13 +16,11 @@ public class SafeTimeTracker {
|
|||
private long lastMark = 0;
|
||||
|
||||
/**
|
||||
* Return true if a given delay has passed since last time marked was called
|
||||
* successfully.
|
||||
* Return true if a given delay has passed since last time marked was called successfully.
|
||||
*/
|
||||
public boolean markTimeIfDelay(World world, long delay) {
|
||||
if (world == null) {
|
||||
if (world == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
long currentTime = world.getWorldTime();
|
||||
|
||||
|
@ -32,9 +30,8 @@ public class SafeTimeTracker {
|
|||
} else if (lastMark + delay <= currentTime) {
|
||||
lastMark = world.getWorldTime();
|
||||
return true;
|
||||
} else {
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package buildcraft.api.filler;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.IBox;
|
||||
|
||||
public interface IFillerPattern {
|
||||
|
||||
|
|
|
@ -4,31 +4,29 @@ import java.util.LinkedList;
|
|||
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
|
||||
|
||||
public class IronEngineCoolant {
|
||||
|
||||
|
||||
public static LinkedList<IronEngineCoolant> coolants = new LinkedList<IronEngineCoolant>();
|
||||
|
||||
public static IronEngineCoolant getCoolantForLiquid(LiquidStack liquid) {
|
||||
if(liquid == null)
|
||||
if (liquid == null)
|
||||
return null;
|
||||
if(liquid.itemID <= 0)
|
||||
if (liquid.itemID <= 0)
|
||||
return null;
|
||||
|
||||
for(IronEngineCoolant coolant : coolants)
|
||||
if(coolant.liquid.isLiquidEqual(liquid))
|
||||
|
||||
for (IronEngineCoolant coolant : coolants)
|
||||
if (coolant.liquid.isLiquidEqual(liquid))
|
||||
return coolant;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public final LiquidStack liquid;
|
||||
public final float coolingPerUnit;
|
||||
|
||||
|
||||
public IronEngineCoolant(LiquidStack liquid, float coolingPerUnit) {
|
||||
this.liquid = liquid;
|
||||
this.coolingPerUnit = coolingPerUnit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,25 +14,23 @@ import java.util.LinkedList;
|
|||
import net.minecraftforge.liquids.LiquidContainerRegistry;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
|
||||
|
||||
public class IronEngineFuel {
|
||||
|
||||
public static LinkedList<IronEngineFuel> fuels = new LinkedList<IronEngineFuel>();
|
||||
|
||||
|
||||
public static IronEngineFuel getFuelForLiquid(LiquidStack liquid) {
|
||||
if(liquid == null)
|
||||
if (liquid == null)
|
||||
return null;
|
||||
if(liquid.itemID <= 0)
|
||||
if (liquid.itemID <= 0)
|
||||
return null;
|
||||
|
||||
for(IronEngineFuel fuel : fuels)
|
||||
if(fuel.liquid.isLiquidEqual(liquid))
|
||||
|
||||
for (IronEngineFuel fuel : fuels)
|
||||
if (fuel.liquid.isLiquidEqual(liquid))
|
||||
return fuel;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public final LiquidStack liquid;
|
||||
public final float powerPerCycle;
|
||||
public final int totalBurningTime;
|
||||
|
@ -40,6 +38,7 @@ public class IronEngineFuel {
|
|||
public IronEngineFuel(int liquidId, float powerPerCycle, int totalBurningTime) {
|
||||
this(new LiquidStack(liquidId, LiquidContainerRegistry.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime);
|
||||
}
|
||||
|
||||
public IronEngineFuel(LiquidStack liquid, float powerPerCycle, int totalBurningTime) {
|
||||
this.liquid = liquid;
|
||||
this.powerPerCycle = powerPerCycle;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package buildcraft.api.gates;
|
||||
|
||||
|
||||
public abstract class Action implements IAction {
|
||||
|
||||
protected int id;
|
||||
|
@ -23,7 +22,7 @@ public abstract class Action implements IAction {
|
|||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public abstract String getTexture();
|
||||
|
||||
|
|
|
@ -2,10 +2,9 @@ package buildcraft.api.gates;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public class ActionManager {
|
||||
|
||||
|
@ -81,5 +80,4 @@ public class ActionManager {
|
|||
return triggers;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,13 @@ package buildcraft.api.gates;
|
|||
public interface IAction {
|
||||
|
||||
int getId();
|
||||
|
||||
String getTexture();
|
||||
|
||||
int getIndexInTexture();
|
||||
|
||||
boolean hasParameter();
|
||||
|
||||
String getDescription();
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package buildcraft.api.gates;
|
||||
|
||||
|
||||
public interface IActionReceptor {
|
||||
|
||||
public void actionActivated(IAction action);
|
||||
|
|
|
@ -11,11 +11,8 @@ package buildcraft.api.gates;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
|
||||
/**
|
||||
* This interface has to be implemented by a TileEntity or a Pipe that wants to
|
||||
* provide triggers different from the ones installed by default with
|
||||
* BuildCraft.
|
||||
* This interface has to be implemented by a TileEntity or a Pipe that wants to provide triggers different from the ones installed by default with BuildCraft.
|
||||
*/
|
||||
public interface IOverrideDefaultTriggers {
|
||||
|
||||
|
|
|
@ -27,14 +27,12 @@ public interface ITrigger {
|
|||
public abstract String getDescription();
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given
|
||||
* the parameters.
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
public abstract boolean isTriggerActive(TileEntity tile, ITriggerParameter parameter);
|
||||
|
||||
/**
|
||||
* Create parameters for the trigger. As for now, there is only one kind of
|
||||
* trigger parameter available so this subprogram is final.
|
||||
* Create parameters for the trigger. As for now, there is only one kind of trigger parameter available so this subprogram is final.
|
||||
*/
|
||||
public abstract ITriggerParameter createParameter();
|
||||
|
||||
|
|
|
@ -6,15 +6,13 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
// TODO: Merge with ITrigger
|
||||
|
||||
/**
|
||||
* This interface was added to expand on the existing Trigger interface without
|
||||
* breaking the API. At some point when it is safe to break the API, this
|
||||
* function should replace the one in ITrigger.
|
||||
* This interface was added to expand on the existing Trigger interface without breaking the API. At some point when it is safe to break the API, this function
|
||||
* should replace the one in ITrigger.
|
||||
*/
|
||||
public interface ITriggerDirectional extends ITrigger {
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given
|
||||
* the parameters.
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
public abstract boolean isTriggerActive(ForgeDirection side, TileEntity tile, ITriggerParameter parameter);
|
||||
}
|
||||
|
|
|
@ -11,16 +11,14 @@ package buildcraft.api.gates;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface ITriggerProvider {
|
||||
|
||||
/**
|
||||
* Returns the list of triggers that are available from the pipe holding the
|
||||
* gate.
|
||||
* Returns the list of triggers that are available from the pipe holding the gate.
|
||||
*/
|
||||
public abstract LinkedList<ITrigger> getPipeTriggers(IPipe pipe);
|
||||
|
||||
|
|
|
@ -12,9 +12,8 @@ package buildcraft.api.gates;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* This class has to be implemented to create new triggers kinds to BuildCraft
|
||||
* gates. There is an instance per kind, which will get called wherever the
|
||||
* trigger can be active.
|
||||
* This class has to be implemented to create new triggers kinds to BuildCraft gates. There is an instance per kind, which will get called wherever the trigger
|
||||
* can be active.
|
||||
*/
|
||||
public abstract class Trigger implements ITrigger {
|
||||
|
||||
|
@ -28,21 +27,27 @@ public abstract class Trigger implements ITrigger {
|
|||
ActionManager.triggers[id] = this;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#getId()
|
||||
*/
|
||||
@Override
|
||||
public int getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#getTextureFile()
|
||||
*/
|
||||
@Override
|
||||
public abstract String getTextureFile();
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#getIndexInTexture()
|
||||
*/
|
||||
@Override
|
||||
|
@ -50,7 +55,9 @@ public abstract class Trigger implements ITrigger {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#hasParameter()
|
||||
*/
|
||||
@Override
|
||||
|
@ -58,7 +65,9 @@ public abstract class Trigger implements ITrigger {
|
|||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#getDescription()
|
||||
*/
|
||||
@Override
|
||||
|
@ -66,15 +75,20 @@ public abstract class Trigger implements ITrigger {
|
|||
return "";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#isTriggerActive(net.minecraft.src.TileEntity, net.minecraft.src.buildcraft.api.gates.TriggerParameter)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#isTriggerActive(net.minecraft.src.TileEntity,
|
||||
* net.minecraft.src.buildcraft.api.gates.TriggerParameter)
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, ITriggerParameter parameter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITrigger#createParameter()
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -16,15 +16,19 @@ public class TriggerParameter implements ITriggerParameter {
|
|||
|
||||
protected ItemStack stack;
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#getItemStack()
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#set(net.minecraft.src.ItemStack)
|
||||
*/
|
||||
@Override
|
||||
|
@ -35,7 +39,9 @@ public class TriggerParameter implements ITriggerParameter {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#writeToNBT(net.minecraft.src.NBTTagCompound)
|
||||
*/
|
||||
@Override
|
||||
|
@ -46,7 +52,9 @@ public class TriggerParameter implements ITriggerParameter {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#readFromNBT(net.minecraft.src.NBTTagCompound)
|
||||
*/
|
||||
@Override
|
||||
|
@ -58,7 +66,9 @@ public class TriggerParameter implements ITriggerParameter {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see net.minecraft.src.buildcraft.api.gates.ITriggerParameter#getItem()
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -3,18 +3,21 @@ package buildcraft.api.inventory;
|
|||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface ISecuredInventory {
|
||||
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return true if the user/player with the given name has access permissions on this machine.
|
||||
*/
|
||||
boolean canAccess(String name);
|
||||
|
||||
|
||||
/**
|
||||
* Informs the inventory with whose permissions the next item or liquid transaction will be performed. It is up to the inventory to determine the effect.
|
||||
* @param orientation Orientation the transaction will be performed from.
|
||||
* @param name Name of the user/player who owns the transaction.
|
||||
*
|
||||
* @param orientation
|
||||
* Orientation the transaction will be performed from.
|
||||
* @param name
|
||||
* Name of the user/player who owns the transaction.
|
||||
*/
|
||||
void prepareTransaction(ForgeDirection orientation, String name);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,22 @@
|
|||
package buildcraft.api.inventory;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface ISelectiveInventory extends ISpecialInventory {
|
||||
/**
|
||||
* Requests specified items to be extracted from the inventory
|
||||
* @param desired Array which can contain ItemStacks, Items, or classes describing the type of item accepted or excluded.
|
||||
* @param exclusion If true desired items are not eligible for returning.
|
||||
* @param doRemove If false no actual extraction may occur.
|
||||
* @param from Orientation the ItemStack is requested from.
|
||||
* @param maxItemCount Maximum amount of items to extract (spread over all returned item stacks)
|
||||
*
|
||||
* @param desired
|
||||
* Array which can contain ItemStacks, Items, or classes describing the type of item accepted or excluded.
|
||||
* @param exclusion
|
||||
* If true desired items are not eligible for returning.
|
||||
* @param doRemove
|
||||
* If false no actual extraction may occur.
|
||||
* @param from
|
||||
* Orientation the ItemStack is requested from.
|
||||
* @param maxItemCount
|
||||
* Maximum amount of items to extract (spread over all returned item stacks)
|
||||
* @return Array of item stacks extracted from the inventory
|
||||
*/
|
||||
ItemStack[] extractItem(Object[] desired, boolean exclusion, boolean doRemove, ForgeDirection from, int maxItemCount);
|
||||
|
|
|
@ -1,26 +1,35 @@
|
|||
package buildcraft.api.inventory;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface ISpecialInventory extends IInventory {
|
||||
|
||||
|
||||
/**
|
||||
* Offers an ItemStack for addition to the inventory.
|
||||
* @param stack ItemStack offered for addition. Do not manipulate this!
|
||||
* @param doAdd If false no actual addition should take place.
|
||||
* @param from Orientation the ItemStack is offered from.
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack offered for addition. Do not manipulate this!
|
||||
* @param doAdd
|
||||
* If false no actual addition should take place.
|
||||
* @param from
|
||||
* Orientation the ItemStack is offered from.
|
||||
* @return Amount of items used from the passed stack.
|
||||
*/
|
||||
int addItem(ItemStack stack, boolean doAdd, ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Requests items to be extracted from the inventory
|
||||
* @param doRemove If false no actual extraction may occur.
|
||||
* @param from Orientation the ItemStack is requested from.
|
||||
* @param maxItemCount Maximum amount of items to extract (spread over all returned item stacks)
|
||||
*
|
||||
* @param doRemove
|
||||
* If false no actual extraction may occur.
|
||||
* @param from
|
||||
* Orientation the ItemStack is requested from.
|
||||
* @param maxItemCount
|
||||
* Maximum amount of items to extract (spread over all returned item stacks)
|
||||
* @return Array of item stacks extracted from the inventory
|
||||
*/
|
||||
ItemStack[] extractItem(boolean doRemove, ForgeDirection from, int maxItemCount);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package buildcraft.api.power;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface IPowerProvider {
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package buildcraft.api.power;
|
||||
|
||||
|
||||
public interface IPowerReceptor {
|
||||
|
||||
public void setPowerProvider(IPowerProvider provider);
|
||||
|
|
|
@ -37,9 +37,8 @@ public abstract class PowerFramework {
|
|||
|
||||
IPowerProvider provider = receptor.getPowerProvider();
|
||||
|
||||
if (provider == null) {
|
||||
if (provider == null)
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound cpt = new NBTTagCompound();
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
package buildcraft.api.power;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
|
||||
public abstract class PowerProvider implements IPowerProvider {
|
||||
|
||||
|
@ -31,16 +31,42 @@ public abstract class PowerProvider implements IPowerProvider {
|
|||
|
||||
public int[] powerSources = { 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
@Override public SafeTimeTracker getTimeTracker() { return this.timeTracker; }
|
||||
|
||||
@Override public int getLatency() { return this.latency; }
|
||||
@Override public int getMinEnergyReceived() { return this.minEnergyReceived; }
|
||||
@Override public int getMaxEnergyReceived() { return this.maxEnergyReceived; }
|
||||
@Override public int getMaxEnergyStored() { return this.maxEnergyStored; }
|
||||
@Override public int getActivationEnergy() { return this.minActivationEnergy; }
|
||||
@Override public float getEnergyStored() { return this.energyStored; }
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public SafeTimeTracker getTimeTracker() {
|
||||
return this.timeTracker;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLatency() {
|
||||
return this.latency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinEnergyReceived() {
|
||||
return this.minEnergyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyReceived() {
|
||||
return this.maxEnergyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
return this.maxEnergyStored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActivationEnergy() {
|
||||
return this.minActivationEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getEnergyStored() {
|
||||
return this.energyStored;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(int latency, int minEnergyReceived, int maxEnergyReceived, int minActivationEnergy, int maxStoredEnergy) {
|
||||
this.latency = latency;
|
||||
this.minEnergyReceived = minEnergyReceived;
|
||||
|
@ -49,7 +75,7 @@ public abstract class PowerProvider implements IPowerProvider {
|
|||
this.minActivationEnergy = minActivationEnergy;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void configurePowerPerdition(int powerLoss, int powerLossRegularity) {
|
||||
this.powerLoss = powerLoss;
|
||||
this.powerLossRegularity = powerLossRegularity;
|
||||
|
@ -57,9 +83,8 @@ public abstract class PowerProvider implements IPowerProvider {
|
|||
|
||||
@Override
|
||||
public boolean update(IPowerReceptor receptor) {
|
||||
if (!preConditions(receptor)) {
|
||||
if (!preConditions(receptor))
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = (TileEntity) receptor;
|
||||
boolean result = false;
|
||||
|
@ -119,7 +144,7 @@ public abstract class PowerProvider implements IPowerProvider {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
latency = nbttagcompound.getInteger("latency");
|
||||
minEnergyReceived = nbttagcompound.getInteger("minEnergyReceived");
|
||||
|
@ -134,7 +159,7 @@ public abstract class PowerProvider implements IPowerProvider {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setInteger("latency", latency);
|
||||
nbttagcompound.setInteger("minEnergyReceived", minEnergyReceived);
|
||||
|
|
|
@ -22,18 +22,21 @@ public class AssemblyRecipe {
|
|||
|
||||
for (ItemStack in : input) {
|
||||
|
||||
if (in == null)
|
||||
if (in == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int found = 0; // Amount of ingredient found in inventory
|
||||
|
||||
for (ItemStack item : items) {
|
||||
if (item == null)
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.isItemEqual(in))
|
||||
if (item.isItemEqual(in)) {
|
||||
found += item.stackSize; // Adds quantity of stack to amount
|
||||
// found
|
||||
}
|
||||
}
|
||||
|
||||
if (found < in.stackSize)
|
||||
|
|
|
@ -14,12 +14,10 @@ import java.util.TreeSet;
|
|||
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
|
||||
|
||||
public class RefineryRecipe implements Comparable<RefineryRecipe> {
|
||||
|
||||
private static SortedSet<RefineryRecipe> recipes = new TreeSet<RefineryRecipe>();
|
||||
|
||||
|
||||
public static void registerRefineryRecipe(RefineryRecipe recipe) {
|
||||
if (!recipes.contains(recipe)) {
|
||||
recipes.add(recipe);
|
||||
|
@ -27,130 +25,124 @@ public class RefineryRecipe implements Comparable<RefineryRecipe> {
|
|||
}
|
||||
|
||||
public static RefineryRecipe findRefineryRecipe(LiquidStack liquid1, LiquidStack liquid2) {
|
||||
for(RefineryRecipe recipe : recipes)
|
||||
if(recipe.matches(liquid1, liquid2))
|
||||
for (RefineryRecipe recipe : recipes)
|
||||
if (recipe.matches(liquid1, liquid2))
|
||||
return recipe;
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public final LiquidStack ingredient1;
|
||||
public final LiquidStack ingredient2;
|
||||
public final LiquidStack result;
|
||||
|
||||
|
||||
public final int energy;
|
||||
public final int delay;
|
||||
|
||||
public RefineryRecipe(int ingredientId1, int ingredientQty1, int ingredientId2, int ingredientQty2, int resultId, int resultQty,
|
||||
int energy, int delay) {
|
||||
this(new LiquidStack(ingredientId1, ingredientQty1, 0), new LiquidStack(ingredientId2, ingredientQty2, 0), new LiquidStack(resultId, resultQty, 0), energy, delay);
|
||||
public RefineryRecipe(int ingredientId1, int ingredientQty1, int ingredientId2, int ingredientQty2, int resultId, int resultQty, int energy, int delay) {
|
||||
this(new LiquidStack(ingredientId1, ingredientQty1, 0), new LiquidStack(ingredientId2, ingredientQty2, 0), new LiquidStack(resultId, resultQty, 0),
|
||||
energy, delay);
|
||||
}
|
||||
|
||||
public RefineryRecipe(LiquidStack ingredient1, LiquidStack ingredient2, LiquidStack result, int energy, int delay) {
|
||||
|
||||
|
||||
// Sort starting materials.
|
||||
if(ingredient1 != null && ingredient2 != null) {
|
||||
if( (ingredient1.itemID > ingredient2.itemID) || (ingredient1.itemID == ingredient2.itemID && ingredient1.itemMeta > ingredient2.itemMeta) ) {
|
||||
if (ingredient1 != null && ingredient2 != null) {
|
||||
if ((ingredient1.itemID > ingredient2.itemID) || (ingredient1.itemID == ingredient2.itemID && ingredient1.itemMeta > ingredient2.itemMeta)) {
|
||||
this.ingredient1 = ingredient2;
|
||||
this.ingredient2 = ingredient1;
|
||||
} else {
|
||||
this.ingredient1 = ingredient1;
|
||||
this.ingredient2 = ingredient2;
|
||||
}
|
||||
} else if(ingredient2 != null) {
|
||||
} else if (ingredient2 != null) {
|
||||
this.ingredient1 = ingredient2;
|
||||
this.ingredient2 = ingredient1;
|
||||
} else {
|
||||
this.ingredient1 = ingredient1;
|
||||
this.ingredient2 = ingredient2;
|
||||
}
|
||||
|
||||
|
||||
this.result = result;
|
||||
this.energy = energy;
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public boolean matches(LiquidStack liquid1, LiquidStack liquid2) {
|
||||
|
||||
|
||||
// No inputs, return.
|
||||
if(liquid1 == null && liquid2 == null)
|
||||
if (liquid1 == null && liquid2 == null)
|
||||
return false;
|
||||
|
||||
// Return if two ingredients are required but only one was supplied.
|
||||
if((ingredient1 != null && ingredient2 != null)
|
||||
&& (liquid1 == null || liquid2 == null))
|
||||
if ((ingredient1 != null && ingredient2 != null) && (liquid1 == null || liquid2 == null))
|
||||
return false;
|
||||
|
||||
if(ingredient1 != null) {
|
||||
|
||||
if(ingredient2 == null)
|
||||
|
||||
if (ingredient1 != null) {
|
||||
|
||||
if (ingredient2 == null)
|
||||
return ingredient1.isLiquidEqual(liquid1) || ingredient1.isLiquidEqual(liquid2);
|
||||
else
|
||||
return (ingredient1.isLiquidEqual(liquid1) && ingredient2.isLiquidEqual(liquid2))
|
||||
|| (ingredient2.isLiquidEqual(liquid1) && ingredient1.isLiquidEqual(liquid2));
|
||||
|
||||
} else if(ingredient2 != null)
|
||||
|
||||
} else if (ingredient2 != null)
|
||||
return ingredient2.isLiquidEqual(liquid1) || ingredient2.isLiquidEqual(liquid2);
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Compares to only the types of source materials.
|
||||
// We consider non-null < null in order that one-ingredient recipe is checked after
|
||||
// the failure of matching two-ingredient recipes which include that liquid.
|
||||
@Override
|
||||
public int compareTo(RefineryRecipe other) {
|
||||
|
||||
if(other == null) {
|
||||
|
||||
if (other == null)
|
||||
return -1;
|
||||
} else if (ingredient1 == null) {
|
||||
if(other.ingredient1 == null) {
|
||||
else if (ingredient1 == null) {
|
||||
if (other.ingredient1 == null)
|
||||
return 0;
|
||||
} else {
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
} else if(other.ingredient1 == null) {
|
||||
} else if (other.ingredient1 == null)
|
||||
return -1;
|
||||
} else if(ingredient1.itemID != other.ingredient1.itemID) {
|
||||
else if (ingredient1.itemID != other.ingredient1.itemID)
|
||||
return ingredient1.itemID - other.ingredient1.itemID;
|
||||
} else if(ingredient1.itemMeta != other.ingredient1.itemMeta) {
|
||||
else if (ingredient1.itemMeta != other.ingredient1.itemMeta)
|
||||
return ingredient1.itemMeta - other.ingredient1.itemMeta;
|
||||
} else if(ingredient2 == null) {
|
||||
if(other.ingredient2 == null) {
|
||||
else if (ingredient2 == null) {
|
||||
if (other.ingredient2 == null)
|
||||
return 0;
|
||||
} else {
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
} else if(other.ingredient2 == null) {
|
||||
} else if (other.ingredient2 == null)
|
||||
return -1;
|
||||
} else if(ingredient2.itemID != other.ingredient2.itemID) {
|
||||
else if (ingredient2.itemID != other.ingredient2.itemID)
|
||||
return ingredient2.itemID - other.ingredient2.itemID;
|
||||
} else if(ingredient2.itemMeta != other.ingredient2.itemMeta) {
|
||||
else if (ingredient2.itemMeta != other.ingredient2.itemMeta)
|
||||
return ingredient2.itemMeta - other.ingredient2.itemMeta;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// equals() should be consistent with compareTo().
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj != null && obj instanceof RefineryRecipe) {
|
||||
return this.compareTo((RefineryRecipe)obj) == 0;
|
||||
}
|
||||
if (obj != null && obj instanceof RefineryRecipe)
|
||||
return this.compareTo((RefineryRecipe) obj) == 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// hashCode() should be overridden because equals() was overridden.
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if(ingredient1 == null) {
|
||||
if (ingredient1 == null)
|
||||
return 0;
|
||||
} else if(ingredient2 == null) {
|
||||
else if (ingredient2 == null)
|
||||
return ingredient1.itemID ^ ingredient1.itemMeta;
|
||||
}
|
||||
|
||||
|
||||
return ingredient1.itemID ^ ingredient1.itemMeta ^ ingredient2.itemID ^ ingredient2.itemMeta;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,27 +4,33 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
public interface IToolPipette {
|
||||
|
||||
|
||||
/**
|
||||
* @param pipette ItemStack of the pipette.
|
||||
* @param pipette
|
||||
* ItemStack of the pipette.
|
||||
* @return Capacity of the pipette.
|
||||
*/
|
||||
int getCapacity(ItemStack pipette);
|
||||
|
||||
/**
|
||||
* @param pipette
|
||||
* @return true if the pipette can pipette.
|
||||
*/
|
||||
boolean canPipette(ItemStack pipette);
|
||||
|
||||
/**
|
||||
* Fills the pipette with the given liquid stack.
|
||||
*
|
||||
* @param pipette
|
||||
* @param liquid
|
||||
* @param doFill
|
||||
* @return Amount of liquid used in filling the pipette.
|
||||
*/
|
||||
int fill(ItemStack pipette, LiquidStack liquid, boolean doFill);
|
||||
|
||||
/**
|
||||
* Drains liquid from the pipette
|
||||
*
|
||||
* @param pipette
|
||||
* @param maxDrain
|
||||
* @param doDrain
|
||||
|
|
|
@ -3,14 +3,12 @@ package buildcraft.api.tools;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/***
|
||||
* Implement this interface on subclasses of Item to have that item work as a
|
||||
* wrench for buildcraft
|
||||
* Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft
|
||||
*/
|
||||
public interface IToolWrench {
|
||||
|
||||
/***
|
||||
* Called to ensure that the wrench can be used. To get the ItemStack that
|
||||
* is used, check player.inventory.getCurrentItem()
|
||||
* Called to ensure that the wrench can be used. To get the ItemStack that is used, check player.inventory.getCurrentItem()
|
||||
*
|
||||
* @param player
|
||||
* - The player doing the wrenching
|
||||
|
@ -22,9 +20,8 @@ public interface IToolWrench {
|
|||
public boolean canWrench(EntityPlayer player, int x, int y, int z);
|
||||
|
||||
/***
|
||||
* Callback after the wrench has been used. This can be used to decrease
|
||||
* durability or for other purposes. To get the ItemStack that was used,
|
||||
* check player.inventory.getCurrentItem()
|
||||
* Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get the ItemStack that was used, check
|
||||
* player.inventory.getCurrentItem()
|
||||
*
|
||||
* @param player
|
||||
* - The player doing the wrenching
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
package buildcraft.api.transport;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FacadeManager
|
||||
{
|
||||
private static Method addFacade;
|
||||
public class FacadeManager {
|
||||
private static Method addFacade;
|
||||
|
||||
public static void addFacade(ItemStack is) {
|
||||
try {
|
||||
if(addFacade == null) {
|
||||
Class facade = Class.forName("buildcraft.transport.ItemFacade");
|
||||
addFacade = facade.getMethod("addFacade", ItemStack.class);
|
||||
}
|
||||
addFacade.invoke(null, is);
|
||||
} catch(Exception ex) {
|
||||
}
|
||||
}
|
||||
public static void addFacade(ItemStack is) {
|
||||
try {
|
||||
if (addFacade == null) {
|
||||
Class facade = Class.forName("buildcraft.transport.ItemFacade");
|
||||
addFacade = facade.getMethod("addFacade", ItemStack.class);
|
||||
}
|
||||
addFacade.invoke(null, is);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,13 @@ import net.minecraft.world.World;
|
|||
*/
|
||||
public interface IExtractionHandler {
|
||||
|
||||
/**
|
||||
* Can this pipe extract items from the block located at these coordinates?
|
||||
*/
|
||||
/**
|
||||
* Can this pipe extract items from the block located at these coordinates?
|
||||
*/
|
||||
boolean canExtractItems(IPipe pipe, World world, int i, int j, int k);
|
||||
|
||||
/**
|
||||
* Can this pipe extract liquids from the block located at these coordinates?
|
||||
*/
|
||||
|
||||
/**
|
||||
* Can this pipe extract liquids from the block located at these coordinates?
|
||||
*/
|
||||
boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraftforge.common.ForgeDirection;
|
|||
public interface IPipeEntry {
|
||||
|
||||
void entityEntering(ItemStack payload, ForgeDirection orientation);
|
||||
|
||||
void entityEntering(IPipedItem item, ForgeDirection orientation);
|
||||
|
||||
boolean acceptItems();
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.core.SafeTimeTracker;
|
||||
|
||||
public interface IPipedItem {
|
||||
|
||||
|
@ -26,7 +26,8 @@ public interface IPipedItem {
|
|||
public abstract float getSpeed();
|
||||
|
||||
/**
|
||||
* @param speed the speed to set
|
||||
* @param speed
|
||||
* the speed to set
|
||||
*/
|
||||
public abstract void setSpeed(float speed);
|
||||
|
||||
|
@ -36,7 +37,8 @@ public interface IPipedItem {
|
|||
public abstract ItemStack getItemStack();
|
||||
|
||||
/**
|
||||
* @param item the item to set
|
||||
* @param item
|
||||
* the item to set
|
||||
*/
|
||||
public abstract void setItemStack(ItemStack item);
|
||||
|
||||
|
@ -46,7 +48,8 @@ public interface IPipedItem {
|
|||
public abstract TileEntity getContainer();
|
||||
|
||||
/**
|
||||
* @param container the container to set
|
||||
* @param container
|
||||
* the container to set
|
||||
*/
|
||||
public abstract void setContainer(TileEntity container);
|
||||
|
||||
|
@ -57,7 +60,8 @@ public interface IPipedItem {
|
|||
public abstract SafeTimeTracker getSynchroTracker();
|
||||
|
||||
/**
|
||||
* @param synchroTracker the synchroTracker to set
|
||||
* @param synchroTracker
|
||||
* the synchroTracker to set
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void setSynchroTracker(SafeTimeTracker synchroTracker);
|
||||
|
@ -69,7 +73,8 @@ public interface IPipedItem {
|
|||
public abstract int getDeterministicRandomization();
|
||||
|
||||
/**
|
||||
* @param deterministicRandomization the deterministicRandomization to set
|
||||
* @param deterministicRandomization
|
||||
* the deterministicRandomization to set
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void setDeterministicRandomization(int deterministicRandomization);
|
||||
|
@ -80,7 +85,8 @@ public interface IPipedItem {
|
|||
public abstract int getEntityId();
|
||||
|
||||
/**
|
||||
* @param entityId the entityId to set
|
||||
* @param entityId
|
||||
* the entityId to set
|
||||
*/
|
||||
public abstract void setEntityId(int entityId);
|
||||
|
||||
|
|
|
@ -1,19 +1,18 @@
|
|||
package buildcraft.api.transport;
|
||||
|
||||
import java.util.TreeMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Side;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class PipeManager {
|
||||
|
||||
@Deprecated
|
||||
@Deprecated
|
||||
private static TreeMap<Integer, IPipedItem> allServerEntities = new TreeMap<Integer, IPipedItem>();
|
||||
@Deprecated
|
||||
@Deprecated
|
||||
private static TreeMap<Integer, IPipedItem> allClientEntities = new TreeMap<Integer, IPipedItem>();
|
||||
|
||||
public static List<IExtractionHandler> extractionHandlers = new ArrayList<IExtractionHandler>();
|
||||
|
@ -23,26 +22,25 @@ public abstract class PipeManager {
|
|||
}
|
||||
|
||||
public static boolean canExtractItems(IPipe pipe, World world, int i, int j, int k) {
|
||||
for(IExtractionHandler handler : extractionHandlers)
|
||||
if(!handler.canExtractItems(pipe, world, i, j, k))
|
||||
for (IExtractionHandler handler : extractionHandlers)
|
||||
if (!handler.canExtractItems(pipe, world, i, j, k))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean canExtractLiquids(IPipe pipe, World world, int i, int j, int k) {
|
||||
for(IExtractionHandler handler : extractionHandlers)
|
||||
if(!handler.canExtractLiquids(pipe, world, i, j, k))
|
||||
for (IExtractionHandler handler : extractionHandlers)
|
||||
if (!handler.canExtractLiquids(pipe, world, i, j, k))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public static TreeMap<Integer, IPipedItem> getAllEntities(){
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
|
||||
public static TreeMap<Integer, IPipedItem> getAllEntities() {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
return allClientEntities;
|
||||
}
|
||||
return allServerEntities;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,17 +12,17 @@ package buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
@ -30,7 +30,6 @@ import buildcraft.core.GuiIds;
|
|||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
|
||||
public class BlockArchitect extends BlockContainer {
|
||||
|
||||
int blockTextureSides;
|
||||
|
@ -93,8 +92,9 @@ public class BlockArchitect extends BlockContainer {
|
|||
return true;
|
||||
} else {
|
||||
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -111,8 +111,7 @@ public class BlockArchitect extends BlockContainer {
|
|||
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
|
||||
super.onBlockPlacedBy(world, i, j, k, entityliving);
|
||||
|
||||
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ),
|
||||
new Position(i, j, k));
|
||||
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));
|
||||
|
||||
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal());
|
||||
}
|
||||
|
@ -121,41 +120,22 @@ public class BlockArchitect extends BlockContainer {
|
|||
public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int m = iblockaccess.getBlockMetadata(i, j, k);
|
||||
|
||||
if (l == 1) {
|
||||
// boolean isPowered = false;
|
||||
//
|
||||
// if (iblockaccess == null) {
|
||||
// return getBlockTextureFromSideAndMetadata(l, m);
|
||||
// } else if (iblockaccess instanceof World) {
|
||||
// isPowered = ((World) iblockaccess)
|
||||
// .isBlockIndirectlyGettingPowered(i, j, k);
|
||||
// }
|
||||
//
|
||||
// if (!isPowered) {
|
||||
// return blockTextureTopPos;
|
||||
// } else {
|
||||
// return blockTextureTopNeg;
|
||||
// }
|
||||
|
||||
if (l == 1)
|
||||
return blockTextureTopArchitect;
|
||||
}
|
||||
|
||||
return getBlockTextureFromSideAndMetadata(l, m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockTextureFromSideAndMetadata(int i, int j) {
|
||||
if (j == 0 && i == 3) {
|
||||
if (j == 0 && i == 3)
|
||||
return blockTextureFront;
|
||||
}
|
||||
|
||||
if (i == 1) {
|
||||
if (i == 1)
|
||||
return blockTextureTopArchitect;
|
||||
}
|
||||
|
||||
if (i == j) {
|
||||
if (i == j)
|
||||
return blockTextureFront;
|
||||
}
|
||||
|
||||
return blockTextureSides;
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ package buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
|
@ -24,7 +24,6 @@ import buildcraft.core.DefaultProps;
|
|||
import buildcraft.core.GuiIds;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
|
||||
public class BlockBlueprintLibrary extends BlockContainer {
|
||||
|
||||
public BlockBlueprintLibrary(int i) {
|
||||
|
@ -49,13 +48,13 @@ public class BlockBlueprintLibrary extends BlockContainer {
|
|||
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getBlockTileEntity(i, j, k);
|
||||
|
||||
if (!tile.locked || entityplayer.username.equals(tile.owner))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1) {
|
||||
return new TileBlueprintLibrary();
|
||||
|
|
|
@ -12,16 +12,16 @@ package buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
@ -29,7 +29,6 @@ import buildcraft.core.GuiIds;
|
|||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
|
||||
public class BlockBuilder extends BlockContainer {
|
||||
|
||||
int blockTextureTop;
|
||||
|
@ -57,13 +56,11 @@ public class BlockBuilder extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public int getBlockTextureFromSideAndMetadata(int i, int j) {
|
||||
if (j == 0 && i == 3) {
|
||||
if (j == 0 && i == 3)
|
||||
return blockTextureFront;
|
||||
}
|
||||
|
||||
if (i == j) {
|
||||
if (i == j)
|
||||
return blockTextureFront;
|
||||
}
|
||||
|
||||
switch (i) {
|
||||
case 1:
|
||||
|
@ -106,8 +103,9 @@ public class BlockBuilder extends BlockContainer {
|
|||
return true;
|
||||
} else {
|
||||
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -116,8 +114,7 @@ public class BlockBuilder extends BlockContainer {
|
|||
@Override
|
||||
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving) {
|
||||
super.onBlockPlacedBy(world, i, j, k, entityliving);
|
||||
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ),
|
||||
new Position(i, j, k));
|
||||
ForgeDirection orientation = Utils.get2dOrientation(new Position(entityliving.posX, entityliving.posY, entityliving.posZ), new Position(i, j, k));
|
||||
|
||||
world.setBlockMetadataWithNotify(i, j, k, orientation.getOpposite().ordinal());
|
||||
}
|
||||
|
|
|
@ -12,12 +12,12 @@ package buildcraft.builders;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
|
@ -26,7 +26,6 @@ import buildcraft.core.GuiIds;
|
|||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
|
||||
public class BlockFiller extends BlockContainer {
|
||||
|
||||
int textureSides;
|
||||
|
@ -52,8 +51,9 @@ public class BlockFiller extends BlockContainer {
|
|||
if (entityplayer.isSneaking())
|
||||
return false;
|
||||
|
||||
if (!CoreProxy.proxy.isRenderWorld(world))
|
||||
if (!CoreProxy.proxy.isRenderWorld(world)) {
|
||||
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -62,25 +62,22 @@ public class BlockFiller extends BlockContainer {
|
|||
public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
int m = iblockaccess.getBlockMetadata(i, j, k);
|
||||
|
||||
if (iblockaccess == null) {
|
||||
if (iblockaccess == null)
|
||||
return getBlockTextureFromSideAndMetadata(i, m);
|
||||
}
|
||||
|
||||
TileEntity tile = iblockaccess.getBlockTileEntity(i, j, k);
|
||||
|
||||
if (tile != null && tile instanceof TileFiller) {
|
||||
TileFiller filler = (TileFiller) tile;
|
||||
if (l == 1 || l == 0) {
|
||||
if (!filler.isActive()) {
|
||||
if (!filler.isActive())
|
||||
return textureTopOff;
|
||||
} else {
|
||||
else
|
||||
return textureTopOn;
|
||||
}
|
||||
} else if (filler.currentPattern != null) {
|
||||
} else if (filler.currentPattern != null)
|
||||
return filler.currentPattern.getTextureIndex();
|
||||
} else {
|
||||
else
|
||||
return textureSides;
|
||||
}
|
||||
}
|
||||
|
||||
return getBlockTextureFromSideAndMetadata(l, m);
|
||||
|
@ -88,11 +85,10 @@ public class BlockFiller extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public int getBlockTextureFromSide(int i) {
|
||||
if (i == 0 || i == 1) {
|
||||
if (i == 0 || i == 1)
|
||||
return textureTopOn;
|
||||
} else {
|
||||
else
|
||||
return textureSides;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,24 +11,21 @@ package buildcraft.builders;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.builders.BuildersProxy;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class BlockMarker extends BlockContainer {
|
||||
|
||||
|
@ -145,27 +142,22 @@ public class BlockMarker extends BlockContainer {
|
|||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, int i, int j, int k) {
|
||||
if (BuildersProxy.canPlaceTorch(world, i - 1, j, k)) {
|
||||
if (BuildersProxy.canPlaceTorch(world, i - 1, j, k))
|
||||
return true;
|
||||
}
|
||||
if (BuildersProxy.canPlaceTorch(world, i + 1, j, k)) {
|
||||
if (BuildersProxy.canPlaceTorch(world, i + 1, j, k))
|
||||
return true;
|
||||
}
|
||||
if (BuildersProxy.canPlaceTorch(world, i, j, k - 1)) {
|
||||
if (BuildersProxy.canPlaceTorch(world, i, j, k - 1))
|
||||
return true;
|
||||
}
|
||||
if (BuildersProxy.canPlaceTorch(world, i, j, k + 1)) {
|
||||
if (BuildersProxy.canPlaceTorch(world, i, j, k + 1))
|
||||
return true;
|
||||
}
|
||||
if (BuildersProxy.canPlaceTorch(world, i, j - 1, k)) {
|
||||
if (BuildersProxy.canPlaceTorch(world, i, j - 1, k))
|
||||
return true;
|
||||
}
|
||||
|
||||
return BuildersProxy.canPlaceTorch(world, i, j + 1, k);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int func_85104_a(World world, int x, int y, int z, int side, float par6, float par7, float par8, int meta) {
|
||||
public int func_85104_a(World world, int x, int y, int z, int side, float par6, float par7, float par8, int meta) {
|
||||
super.func_85104_a(world, x, y, z, side, par6, par7, par8, meta);
|
||||
|
||||
if (side == 1 && BuildersProxy.canPlaceTorch(world, x, y - 1, z)) {
|
||||
|
@ -216,9 +208,8 @@ public class BlockMarker extends BlockContainer {
|
|||
dropBlockAsItem(world, i, j, k, BuildCraftBuilders.markerBlock.blockID, 0);
|
||||
world.setBlockWithNotify(i, j, k, 0);
|
||||
return false;
|
||||
} else {
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,12 +11,11 @@ package buildcraft.builders;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class BlockPathMarker extends BlockMarker {
|
||||
|
||||
|
@ -30,23 +29,22 @@ public class BlockPathMarker extends BlockMarker {
|
|||
public TileEntity createNewTileEntity(World var1) {
|
||||
return new TilePathMarker();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
|
||||
Utils.preDestroyBlock(world, x, y, z);
|
||||
super.breakBlock(world, x, y, z, par5, par6);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
// @Override (client only)
|
||||
public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
TilePathMarker marker = (TilePathMarker) iblockaccess.getBlockTileEntity(i, j, k);
|
||||
|
||||
if (l == 1 || (marker != null && marker.tryingToConnect)) {
|
||||
if (l == 1 || (marker != null && marker.tryingToConnect))
|
||||
return 3 * 16 + 11;
|
||||
} else {
|
||||
else
|
||||
return 3 * 16 + 10;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
|
|
|
@ -11,6 +11,8 @@ package buildcraft.builders;
|
|||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.blueprints.BptBlock;
|
||||
import buildcraft.api.blueprints.BptBlockUtils;
|
||||
|
@ -20,9 +22,6 @@ import buildcraft.api.core.LaserKind;
|
|||
import buildcraft.api.core.Position;
|
||||
import buildcraft.core.Box;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class BptBlockFiller extends BptBlock {
|
||||
|
||||
public BptBlockFiller(int blockId) {
|
||||
|
|
|
@ -6,8 +6,7 @@ public class BuilderProxy {
|
|||
@SidedProxy(clientSide = "buildcraft.builders.BuilderProxyClient", serverSide = "buildcraft.builders.BuilderProxy")
|
||||
public static BuilderProxy proxy;
|
||||
|
||||
public void registerClientHook()
|
||||
{
|
||||
public void registerClientHook() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package buildcraft.builders;
|
|||
import java.io.IOException;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.IBuilderHook;
|
||||
import buildcraft.core.blueprints.BptPlayerIndex;
|
||||
import buildcraft.core.blueprints.BptRootIndex;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Side;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Side;
|
||||
|
||||
public class EventHandlerBuilders {
|
||||
|
||||
@ForgeSubscribe
|
||||
public void handleWorldLoad(WorldEvent.Load event) {
|
||||
//Temporary solution
|
||||
//Please remove the world Load event when world Unload event gets implimented
|
||||
// Temporary solution
|
||||
// Please remove the world Load event when world Unload event gets implimented
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||
TilePathMarker.clearAvailableMarkersList(event.world);
|
||||
}
|
||||
|
@ -32,5 +32,5 @@ public class EventHandlerBuilders {
|
|||
TilePathMarker.clearAvailableMarkersList(event.world);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
||||
public class FillerFillAll extends FillerPattern {
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
||||
public class FillerFillPyramid extends FillerPattern {
|
||||
|
||||
|
@ -47,9 +47,8 @@ public class FillerFillPyramid extends FillerPattern {
|
|||
}
|
||||
|
||||
while (step <= xSize / 2 && step <= zSize / 2 && height >= yMin && height <= yMax) {
|
||||
if (fill(xMin + step, height, zMin + step, xMax - step, height, zMax - step, stackToPlace, tile.worldObj)) {
|
||||
if (fill(xMin + step, height, zMin + step, xMax - step, height, zMax - step, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
step++;
|
||||
height += stepY;
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
||||
public class FillerFillStairs extends FillerPattern {
|
||||
|
||||
|
@ -120,9 +120,8 @@ public class FillerFillStairs extends FillerPattern {
|
|||
if (kind == 0) {
|
||||
while (x2 - x1 + 1 > 0 && z2 - z1 + 1 > 0 && x2 - x1 < sizeX && z2 - z1 < sizeZ && height >= yMin && height <= yMax) {
|
||||
|
||||
if (fill(x1, height, z1, x2, height, z2, stackToPlace, tile.worldObj)) {
|
||||
if (fill(x1, height, z1, x2, height, z2, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (heightStep == 1) {
|
||||
x1 += steps[0];
|
||||
|
@ -176,9 +175,8 @@ public class FillerFillStairs extends FillerPattern {
|
|||
|
||||
}
|
||||
|
||||
if (fill(x1, height, z1, x2, height, z2, stackToPlace, tile.worldObj)) {
|
||||
if (fill(x1, height, z1, x2, height, z2, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
dimX += stepDiagX;
|
||||
dimZ += stepDiagZ;
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
||||
public class FillerFillWalls extends FillerPattern {
|
||||
|
||||
|
@ -26,29 +26,23 @@ public class FillerFillWalls extends FillerPattern {
|
|||
int yMax = (int) box.pMax().y;
|
||||
int zMax = (int) box.pMax().z;
|
||||
|
||||
if (fill(xMin, yMin, zMin, xMax, yMin, zMax, stackToPlace, tile.worldObj)) {
|
||||
if (fill(xMin, yMin, zMin, xMax, yMin, zMax, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fill(xMin, yMin, zMin, xMin, yMax, zMax, stackToPlace, tile.worldObj)) {
|
||||
if (fill(xMin, yMin, zMin, xMin, yMax, zMax, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fill(xMin, yMin, zMin, xMax, yMax, zMin, stackToPlace, tile.worldObj)) {
|
||||
if (fill(xMin, yMin, zMin, xMax, yMax, zMin, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fill(xMax, yMin, zMin, xMax, yMax, zMax, stackToPlace, tile.worldObj)) {
|
||||
if (fill(xMax, yMin, zMin, xMax, yMax, zMax, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fill(xMin, yMin, zMax, xMax, yMax, zMax, stackToPlace, tile.worldObj)) {
|
||||
if (fill(xMin, yMin, zMax, xMax, yMax, zMax, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fill(xMin, yMax, zMin, xMax, yMax, zMax, stackToPlace, tile.worldObj)) {
|
||||
if (fill(xMin, yMax, zMin, xMax, yMax, zMax, stackToPlace, tile.worldObj))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.BlockUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class FillerFlattener extends FillerPattern {
|
||||
|
||||
|
@ -45,9 +45,8 @@ public class FillerFlattener extends FillerPattern {
|
|||
found = false;
|
||||
for (int x = xMin; x <= xMax; ++x) {
|
||||
for (int z = zMin; z <= zMax; ++z) {
|
||||
if(!BlockUtil.canChangeBlock(tile.worldObj, x, y, z)){
|
||||
if (!BlockUtil.canChangeBlock(tile.worldObj, x, y, z))
|
||||
return true;
|
||||
}
|
||||
if (!blockedColumns[x - xMin][z - zMin]) {
|
||||
if (!BlockUtil.isSoftBlock(tile.worldObj, x, y, z)) {
|
||||
blockedColumns[x - xMin][z - zMin] = true;
|
||||
|
@ -67,13 +66,12 @@ public class FillerFlattener extends FillerPattern {
|
|||
}
|
||||
|
||||
if (lastX != Integer.MAX_VALUE && stackToPlace != null) {
|
||||
stackToPlace.getItem().onItemUse(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(tile.worldObj), tile.worldObj,
|
||||
lastX, lastY - 1, lastZ, 1, 0.0f, 0.0f, 0.0f);
|
||||
stackToPlace.getItem().onItemUse(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(tile.worldObj), tile.worldObj, lastX, lastY - 1, lastZ, 1, 0.0f,
|
||||
0.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (lastX != Integer.MAX_VALUE) {
|
||||
if (lastX != Integer.MAX_VALUE)
|
||||
return false;
|
||||
}
|
||||
|
||||
return !empty(xMin, yMin, zMin, xMax, 64 * 2, zMax, tile.worldObj);
|
||||
}
|
||||
|
|
|
@ -9,23 +9,22 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.BlockUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class FillerPattern implements IFillerPattern {
|
||||
|
||||
protected int id;
|
||||
|
||||
/**
|
||||
* stackToPlace contains the next item that can be place in the world. Null
|
||||
* if there is none. IteratePattern is responsible to decrementing the stack
|
||||
* size if needed. Return true when the iteration process is finished.
|
||||
* stackToPlace contains the next item that can be place in the world. Null if there is none. IteratePattern is responsible to decrementing the stack size
|
||||
* if needed. Return true when the iteration process is finished.
|
||||
*/
|
||||
@Override
|
||||
public abstract boolean iteratePattern(TileEntity tile, IBox box, ItemStack stackToPlace);
|
||||
|
@ -48,9 +47,9 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
|
||||
/**
|
||||
* Attempt to fill blocks in the area.
|
||||
*
|
||||
*
|
||||
* Return false if the process failed.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public boolean fill(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, ItemStack stackToPlace, World world) {
|
||||
boolean found = false;
|
||||
|
@ -59,9 +58,8 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
for (int y = yMin; y <= yMax && !found; ++y) {
|
||||
for (int x = xMin; x <= xMax && !found; ++x) {
|
||||
for (int z = zMin; z <= zMax && !found; ++z) {
|
||||
if(!BlockUtil.canChangeBlock(world, x, y, z)){
|
||||
if (!BlockUtil.canChangeBlock(world, x, y, z))
|
||||
return false;
|
||||
}
|
||||
if (BlockUtil.isSoftBlock(world, x, y, z)) {
|
||||
xSlot = x;
|
||||
ySlot = y;
|
||||
|
@ -74,8 +72,7 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
}
|
||||
|
||||
if (found && stackToPlace != null) {
|
||||
stackToPlace.getItem().onItemUse(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(world), world, xSlot, ySlot - 1,
|
||||
zSlot, 1, 0.0f, 0.0f, 0.0f);
|
||||
stackToPlace.getItem().onItemUse(stackToPlace, CoreProxy.proxy.getBuildCraftPlayer(world), world, xSlot, ySlot - 1, zSlot, 1, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
return found;
|
||||
|
@ -83,9 +80,9 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
|
||||
/**
|
||||
* Attempt to remove the blocks in the area.
|
||||
*
|
||||
*
|
||||
* Return false if is the process failed.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public boolean empty(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, World world) {
|
||||
boolean found = false;
|
||||
|
@ -95,9 +92,8 @@ public abstract class FillerPattern implements IFillerPattern {
|
|||
found = false;
|
||||
for (int x = xMin; x <= xMax; ++x) {
|
||||
for (int z = zMin; z <= zMax; ++z) {
|
||||
if(!BlockUtil.canChangeBlock(world, x, y, z)){
|
||||
if (!BlockUtil.canChangeBlock(world, x, y, z))
|
||||
return false;
|
||||
}
|
||||
if (!BlockUtil.isSoftBlock(world, x, y, z)) {
|
||||
found = true;
|
||||
lastX = x;
|
||||
|
|
|
@ -12,13 +12,12 @@ package buildcraft.builders;
|
|||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.api.filler.IFillerRegistry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.api.filler.IFillerPattern;
|
||||
import buildcraft.api.filler.IFillerRegistry;
|
||||
|
||||
public class FillerRegistry implements IFillerRegistry {
|
||||
|
||||
|
@ -39,12 +38,10 @@ public class FillerRegistry implements IFillerRegistry {
|
|||
public boolean matches(IInventory inventorycrafting) {
|
||||
for (int i = 0; i <= 3 - recipeWidth; i++) {
|
||||
for (int j = 0; j <= 3 - recipeHeight; j++) {
|
||||
if (func_21137_a(inventorycrafting, i, j, true)) {
|
||||
if (func_21137_a(inventorycrafting, i, j, true))
|
||||
return true;
|
||||
}
|
||||
if (func_21137_a(inventorycrafting, i, j, false)) {
|
||||
if (func_21137_a(inventorycrafting, i, j, false))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,15 +66,12 @@ public class FillerRegistry implements IFillerRegistry {
|
|||
if (itemstack1 == null && itemstack == null) {
|
||||
continue;
|
||||
}
|
||||
if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) {
|
||||
if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null)
|
||||
return false;
|
||||
}
|
||||
if (itemstack.itemID != itemstack1.itemID) {
|
||||
if (itemstack.itemID != itemstack1.itemID)
|
||||
return false;
|
||||
}
|
||||
if (itemstack.getItemDamage() != -1 && itemstack.getItemDamage() != itemstack1.getItemDamage()) {
|
||||
if (itemstack.getItemDamage() != -1 && itemstack.getItemDamage() != itemstack1.getItemDamage())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -144,9 +138,8 @@ public class FillerRegistry implements IFillerRegistry {
|
|||
public IFillerPattern findMatchingRecipe(IInventory inventorycrafting) {
|
||||
for (int i = 0; i < recipes.size(); i++) {
|
||||
ShapedPatternRecipe irecipe = recipes.get(i);
|
||||
if (irecipe.matches(inventorycrafting)) {
|
||||
if (irecipe.matches(inventorycrafting))
|
||||
return irecipe.recipeOutput;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -157,10 +150,8 @@ public class FillerRegistry implements IFillerRegistry {
|
|||
int i = 0;
|
||||
|
||||
for (ShapedPatternRecipe recipe : recipes) {
|
||||
if (recipe.recipeOutput == pattern) {
|
||||
|
||||
if (recipe.recipeOutput == pattern)
|
||||
return i;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
@ -170,9 +161,8 @@ public class FillerRegistry implements IFillerRegistry {
|
|||
|
||||
@Override
|
||||
public IFillerPattern getPattern(int n) {
|
||||
if (n <= 0) {
|
||||
if (n <= 0)
|
||||
return null;
|
||||
}
|
||||
|
||||
return recipes.get(n - 1).recipeOutput;
|
||||
}
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import buildcraft.api.core.IBox;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
||||
public class FillerRemover extends FillerPattern {
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package buildcraft.builders;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.builders.gui.ContainerBlueprintLibrary;
|
||||
import buildcraft.builders.gui.ContainerBuilder;
|
||||
import buildcraft.builders.gui.ContainerFiller;
|
||||
|
@ -10,9 +12,7 @@ import buildcraft.builders.gui.GuiBuilder;
|
|||
import buildcraft.builders.gui.GuiFiller;
|
||||
import buildcraft.builders.gui.GuiTemplate;
|
||||
import buildcraft.core.GuiIds;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
|
@ -53,8 +53,7 @@ public class GuiHandler implements IGuiHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world,
|
||||
int x, int y, int z) {
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (!world.blockExists(x, y, z))
|
||||
return null;
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.io.IOException;
|
|||
|
||||
import buildcraft.core.blueprints.BptRootIndex;
|
||||
|
||||
|
||||
public interface IBuilderHook {
|
||||
|
||||
public void rootIndexInitialized(BptRootIndex rootBptIndex) throws IOException;
|
||||
|
|
|
@ -11,16 +11,15 @@ package buildcraft.builders;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.core.ItemBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
public abstract class ItemBptBase extends ItemBuildCraft {
|
||||
|
||||
|
@ -44,19 +43,18 @@ public abstract class ItemBptBase extends ItemBuildCraft {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if(CoreProxy.proxy.isSimulating(world)) {
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
|
||||
if (CoreProxy.proxy.isSimulating(world)) {
|
||||
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(itemStack.getItemDamage());
|
||||
if(bpt != null) {
|
||||
return BuildCraftBuilders
|
||||
.getBptItemStack(itemStack.itemID, itemStack.getItemDamage(), bpt.getName());
|
||||
}
|
||||
if (bpt != null)
|
||||
return BuildCraftBuilders.getBptItemStack(itemStack.itemID, itemStack.getItemDamage(), bpt.getName());
|
||||
}
|
||||
return itemStack;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) {}
|
||||
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag) {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,10 +17,9 @@ public class ItemBptBluePrint extends ItemBptBase {
|
|||
|
||||
@Override
|
||||
public int getIconFromDamage(int i) {
|
||||
if (i == 0) {
|
||||
if (i == 0)
|
||||
return 5 * 16 + 2;
|
||||
} else {
|
||||
else
|
||||
return 5 * 16 + 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,9 @@ public class ItemBptTemplate extends ItemBptBase {
|
|||
|
||||
@Override
|
||||
public int getIconFromDamage(int i) {
|
||||
if (i == 0) {
|
||||
if (i == 0)
|
||||
return 5 * 16 + 0;
|
||||
} else {
|
||||
else
|
||||
return 5 * 16 + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,15 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.core.LaserKind;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
|
@ -23,11 +28,6 @@ import buildcraft.core.network.PacketUpdate;
|
|||
import buildcraft.core.network.TileNetworkData;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class TileArchitect extends TileBuildCraft implements IInventory {
|
||||
|
||||
|
@ -39,7 +39,8 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
private boolean isComputing = false;
|
||||
public int computingTime = 0;
|
||||
|
||||
public @TileNetworkData String name = "";
|
||||
public @TileNetworkData
|
||||
String name = "";
|
||||
|
||||
// Use that field to avoid creating several times the same template if
|
||||
// they're the same!
|
||||
|
@ -80,9 +81,8 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
}
|
||||
|
||||
public void createBpt() {
|
||||
if (!box.isInitialized() || items[1] != null) {
|
||||
if (!box.isInitialized() || items[1] != null)
|
||||
return;
|
||||
}
|
||||
|
||||
BptBase result;
|
||||
BptContext context = null;
|
||||
|
@ -173,14 +173,16 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void handleClientInput(char c){
|
||||
|
||||
public void handleClientInput(char c) {
|
||||
if (c == 8) {
|
||||
if (name.length() > 0)
|
||||
if (name.length() > 0) {
|
||||
name = name.substring(0, name.length() - 1);
|
||||
}
|
||||
} else if (Character.isLetterOrDigit(c) || c == ' ') {
|
||||
if (name.length() < BuildCraftBuilders.MAX_BLUEPRINTS_NAME_SIZE)
|
||||
if (name.length() < BuildCraftBuilders.MAX_BLUEPRINTS_NAME_SIZE) {
|
||||
name += c;
|
||||
}
|
||||
}
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
@ -312,9 +314,9 @@ public class TileArchitect extends TileBuildCraft implements IInventory {
|
|||
}
|
||||
|
||||
private void initializeComputing() {
|
||||
if (!box.isInitialized()) {
|
||||
if (!box.isInitialized())
|
||||
return;
|
||||
} else if (!isComputing) {
|
||||
else if (!isComputing) {
|
||||
if (items[0] != null && items[0].getItem() instanceof ItemBptBase && items[1] == null) {
|
||||
isComputing = true;
|
||||
computingTime = 0;
|
||||
|
|
|
@ -3,8 +3,11 @@ package buildcraft.builders;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.builders.BuildersProxy;
|
||||
import buildcraft.core.TileBuildCraft;
|
||||
import buildcraft.core.blueprints.BptBase;
|
||||
import buildcraft.core.blueprints.BptPlayerIndex;
|
||||
|
@ -12,16 +15,8 @@ import buildcraft.core.network.TileNetworkData;
|
|||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
||||
public static final int COMMAND_NEXT = 1,
|
||||
COMMAND_PREV = 2,
|
||||
COMMAND_LOCK_UPDATE = 3,
|
||||
COMMAND_DELETE = 4;
|
||||
public static final int COMMAND_NEXT = 1, COMMAND_PREV = 2, COMMAND_LOCK_UPDATE = 3, COMMAND_DELETE = 4;
|
||||
|
||||
public ItemStack[] stack = new ItemStack[4];
|
||||
|
||||
|
@ -32,13 +27,16 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
|
||||
private ArrayList<BptBase> currentPage;
|
||||
|
||||
public @TileNetworkData(staticSize=BuildCraftBuilders.LIBRARY_PAGE_SIZE) String[] currentNames = new String[BuildCraftBuilders.LIBRARY_PAGE_SIZE];
|
||||
public @TileNetworkData int selected = -1;
|
||||
public @TileNetworkData(staticSize = BuildCraftBuilders.LIBRARY_PAGE_SIZE)
|
||||
String[] currentNames = new String[BuildCraftBuilders.LIBRARY_PAGE_SIZE];
|
||||
public @TileNetworkData
|
||||
int selected = -1;
|
||||
|
||||
public @TileNetworkData boolean locked = false;
|
||||
|
||||
public TileBlueprintLibrary(){
|
||||
for(int i = 0; i < currentNames.length; i++){
|
||||
public @TileNetworkData
|
||||
boolean locked = false;
|
||||
|
||||
public TileBlueprintLibrary() {
|
||||
for (int i = 0; i < currentNames.length; i++) {
|
||||
currentNames[i] = "";
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +44,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
@Override
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
if(CoreProxy.proxy.isSimulating(worldObj)){
|
||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
||||
setCurrentPage(getNextPage(null));
|
||||
}
|
||||
}
|
||||
|
@ -98,28 +96,28 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void updateCurrentNames(){
|
||||
|
||||
public void updateCurrentNames() {
|
||||
currentNames = new String[BuildCraftBuilders.LIBRARY_PAGE_SIZE];
|
||||
for(int i = 0; i < currentPage.size(); i++){
|
||||
for (int i = 0; i < currentPage.size(); i++) {
|
||||
currentNames[i] = currentPage.get(i).getName();
|
||||
}
|
||||
for(int i = currentPage.size(); i < currentNames.length; i++){
|
||||
for (int i = currentPage.size(); i < currentNames.length; i++) {
|
||||
currentNames[i] = "";
|
||||
}
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
||||
public ArrayList<BptBase> getCurrentPage(){
|
||||
|
||||
public ArrayList<BptBase> getCurrentPage() {
|
||||
return currentPage;
|
||||
}
|
||||
|
||||
public void setCurrentPage(ArrayList<BptBase> newPage){
|
||||
|
||||
public void setCurrentPage(ArrayList<BptBase> newPage) {
|
||||
currentPage = newPage;
|
||||
selected = -1;
|
||||
updateCurrentNames();
|
||||
}
|
||||
|
||||
|
||||
public void setCurrentPage(boolean nextPage) {
|
||||
int index = 0;
|
||||
if (nextPage) {
|
||||
|
@ -131,8 +129,8 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
setCurrentPage(getNextPage(null));
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteSelectedBpt(){
|
||||
|
||||
public void deleteSelectedBpt() {
|
||||
BptPlayerIndex index = BuildCraftBuilders.getPlayerIndex(BuildersProxy.getOwner(this));
|
||||
if (selected > -1 && selected < currentPage.size()) {
|
||||
index.deleteBluePrint(currentPage.get(selected).file.getName());
|
||||
|
@ -178,9 +176,8 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if (stack[i] == null) {
|
||||
if (stack[i] == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack res = stack[i].splitStack(j);
|
||||
|
||||
|
@ -237,16 +234,19 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void openChest() {}
|
||||
public void openChest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest() {}
|
||||
public void closeChest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
if(CoreProxy.proxy.isRenderWorld(worldObj)) return;
|
||||
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
|
||||
if (progressIn > 0 && progressIn < 100) {
|
||||
progressIn++;
|
||||
}
|
||||
|
@ -276,8 +276,7 @@ public class TileBlueprintLibrary extends TileBuildCraft implements IInventory {
|
|||
if (progressOut == 100 && stack[3] == null) {
|
||||
if (selected > -1 && selected < currentPage.size()) {
|
||||
BptBase bpt = currentPage.get(selected);
|
||||
setInventorySlotContents(3,
|
||||
BuildCraftBuilders.getBptItemStack(stack[2].itemID, bpt.position, bpt.getName()));
|
||||
setInventorySlotContents(3, BuildCraftBuilders.getBptItemStack(stack[2].itemID, bpt.position, bpt.getName()));
|
||||
} else {
|
||||
setInventorySlotContents(3, BuildCraftBuilders.getBptItemStack(stack[2].itemID, 0, null));
|
||||
}
|
||||
|
|
|
@ -13,9 +13,15 @@ import java.util.Collection;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.LaserKind;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.power.IPowerProvider;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
@ -41,13 +47,6 @@ import buildcraft.core.proxy.CoreProxy;
|
|||
import buildcraft.core.utils.SurroundingInventory;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IPowerReceptor, IMachine {
|
||||
|
||||
private final ItemStack items[] = new ItemStack[28];
|
||||
|
@ -124,9 +123,8 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
bpt = instanciateBluePrint(newX, newY, newZ, o);
|
||||
|
||||
if (bpt == null) {
|
||||
if (bpt == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
AxisAlignedBB boundingBox = bpt.getBoundingBox();
|
||||
|
||||
|
@ -134,9 +132,8 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
oldBoundingBox = boundingBox;
|
||||
|
||||
if (bpt != null) {
|
||||
if (bpt != null)
|
||||
return bpt;
|
||||
}
|
||||
}
|
||||
|
||||
ix += cx;
|
||||
|
@ -145,9 +142,9 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
double distance = (ix - to.i) * (ix - to.i) + (iy - to.j) * (iy - to.j) + (iz - to.k) * (iz - to.k);
|
||||
|
||||
if (distance > lastDistance) {
|
||||
if (distance > lastDistance)
|
||||
return null;
|
||||
} else {
|
||||
else {
|
||||
lastDistance = distance;
|
||||
}
|
||||
}
|
||||
|
@ -159,21 +156,17 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
next.oldBoundingBox = oldBoundingBox;
|
||||
|
||||
return next;
|
||||
} else {
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean collision(AxisAlignedBB left, AxisAlignedBB right) {
|
||||
if (left.maxX < right.minX || left.minX > right.maxX) {
|
||||
if (left.maxX < right.minX || left.minX > right.maxX)
|
||||
return false;
|
||||
}
|
||||
if (left.maxY < right.minY || left.minY > right.maxY) {
|
||||
if (left.maxY < right.minY || left.minY > right.maxY)
|
||||
return false;
|
||||
}
|
||||
if (left.maxZ < right.minZ || left.minZ > right.maxZ) {
|
||||
if (left.maxZ < right.minZ || left.minZ > right.maxZ)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +188,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
|
||||
|
||||
for (int x = xCoord - 1; x <= xCoord + 1; ++x) {
|
||||
for (int y = yCoord - 1; y <= yCoord + 1; ++y) {
|
||||
for (int z = zCoord - 1; z <= zCoord + 1; ++z) {
|
||||
|
@ -207,8 +200,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
for (BlockIndex b : path) {
|
||||
worldObj.setBlockWithNotify(b.i, b.j, b.k, 0);
|
||||
|
||||
BuildCraftBuilders.pathMarkerBlock.dropBlockAsItem(worldObj, b.i, b.j, b.k,
|
||||
BuildCraftBuilders.pathMarkerBlock.blockID, 0);
|
||||
BuildCraftBuilders.pathMarkerBlock.dropBlockAsItem(worldObj, b.i, b.j, b.k, BuildCraftBuilders.pathMarkerBlock.blockID, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -234,11 +226,10 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
for (BlockIndex b : path) {
|
||||
if (previous != null) {
|
||||
|
||||
EntityPowerLaser laser = new EntityPowerLaser(worldObj,
|
||||
new Position(previous.i + 0.5, previous.j + 0.5, previous.k + 0.5),
|
||||
new Position(b.i + 0.5, b.j + 0.5, b.k + 0.5));
|
||||
|
||||
|
||||
EntityPowerLaser laser = new EntityPowerLaser(worldObj, new Position(previous.i + 0.5, previous.j + 0.5, previous.k + 0.5), new Position(
|
||||
b.i + 0.5, b.j + 0.5, b.k + 0.5));
|
||||
|
||||
laser.setTexture(DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_1.png");
|
||||
laser.show();
|
||||
worldObj.spawnEntityInWorld(laser);
|
||||
|
@ -252,9 +243,8 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
public BptBuilderBase instanciateBluePrint(int x, int y, int z, ForgeDirection o) {
|
||||
BptBase bpt = BuildCraftBuilders.getBptRootIndex().getBluePrint(items[0].getItemDamage());
|
||||
|
||||
if (bpt == null) {
|
||||
if (bpt == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
bpt = bpt.clone();
|
||||
|
||||
|
@ -273,32 +263,27 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
bpt.rotateLeft(context);
|
||||
}
|
||||
|
||||
if (items[0].getItem() instanceof ItemBptTemplate) {
|
||||
if (items[0].getItem() instanceof ItemBptTemplate)
|
||||
return new BptBuilderTemplate(bpt, worldObj, x, y, z);
|
||||
} else if (items[0].getItem() instanceof ItemBptBluePrint) {
|
||||
else if (items[0].getItem() instanceof ItemBptBluePrint)
|
||||
return new BptBuilderBlueprint((BptBlueprint) bpt, worldObj, x, y, z);
|
||||
} else {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doWork() {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
}
|
||||
|
||||
if (done) {
|
||||
if (done)
|
||||
return;
|
||||
}
|
||||
|
||||
if (builderRobot != null && !builderRobot.readyToBuild()) {
|
||||
if (builderRobot != null && !builderRobot.readyToBuild())
|
||||
return;
|
||||
}
|
||||
|
||||
if (powerProvider.useEnergy(25, 25, true) < 25) {
|
||||
if (powerProvider.useEnergy(25, 25, true) < 25)
|
||||
return;
|
||||
}
|
||||
|
||||
iterateBpt();
|
||||
|
||||
|
@ -314,8 +299,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
box.createLasers(worldObj, LaserKind.Stripes);
|
||||
|
||||
builderRobot.scheduleContruction(
|
||||
bluePrintBuilder.getNextBlock(worldObj, new SurroundingInventory(worldObj, xCoord, yCoord, zCoord)),
|
||||
builderRobot.scheduleContruction(bluePrintBuilder.getNextBlock(worldObj, new SurroundingInventory(worldObj, xCoord, yCoord, zCoord)),
|
||||
bluePrintBuilder.getContext());
|
||||
}
|
||||
}
|
||||
|
@ -575,11 +559,10 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
if ((bluePrintBuilder != null || currentPathIterator != null) && !done) {
|
||||
if ((bluePrintBuilder != null || currentPathIterator != null) && !done)
|
||||
return powerProvider.getMaxEnergyReceived();
|
||||
} else {
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -587,8 +570,7 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
|
||||
super.updateEntity();
|
||||
|
||||
if ((bluePrintBuilder == null || bluePrintBuilder.done) && box.isInitialized()
|
||||
&& (builderRobot == null || builderRobot.done())) {
|
||||
if ((bluePrintBuilder == null || bluePrintBuilder.done) && box.isInitialized() && (builderRobot == null || builderRobot.done())) {
|
||||
|
||||
box.deleteLasers();
|
||||
box.reset();
|
||||
|
@ -636,11 +618,10 @@ public class TileBuilder extends TileBuildCraft implements IBuilderInventory, IP
|
|||
}
|
||||
|
||||
public Collection<ItemStack> getNeededItems() {
|
||||
if (bluePrintBuilder instanceof BptBuilderBlueprint) {
|
||||
if (bluePrintBuilder instanceof BptBuilderBlueprint)
|
||||
return ((BptBuilderBlueprint) bluePrintBuilder).neededItems;
|
||||
} else {
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
import buildcraft.BuildCraftCore;
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.core.LaserKind;
|
||||
|
@ -28,11 +33,6 @@ import buildcraft.core.proxy.CoreProxy;
|
|||
import buildcraft.core.triggers.ActionMachineControl;
|
||||
import buildcraft.core.triggers.ActionMachineControl.Mode;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.common.ISidedInventory;
|
||||
|
||||
public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowerReceptor, IMachine, IActionReceptor {
|
||||
|
||||
|
@ -89,9 +89,8 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
if (done) {
|
||||
if (lastMode == Mode.Loop) {
|
||||
done = false;
|
||||
} else {
|
||||
} else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (powerProvider.getEnergyStored() >= 25) {
|
||||
|
@ -101,17 +100,14 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
|
||||
@Override
|
||||
public void doWork() {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastMode == Mode.Off) {
|
||||
if (lastMode == Mode.Off)
|
||||
return;
|
||||
}
|
||||
|
||||
if (powerProvider.useEnergy(25, 25, true) < 25) {
|
||||
if (powerProvider.useEnergy(25, 25, true) < 25)
|
||||
return;
|
||||
}
|
||||
|
||||
if (box.isInitialized() && currentPattern != null && !done) {
|
||||
ItemStack stack = null;
|
||||
|
@ -155,15 +151,13 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
}
|
||||
|
||||
public void computeRecipe() {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
}
|
||||
|
||||
IFillerPattern newPattern = FillerManager.registry.findMatchingRecipe(this);
|
||||
|
||||
if (newPattern == currentPattern) {
|
||||
if (newPattern == currentPattern)
|
||||
return;
|
||||
}
|
||||
|
||||
currentPattern = newPattern;
|
||||
|
||||
|
@ -212,9 +206,8 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
computeRecipe();
|
||||
|
||||
return itemstack1;
|
||||
} else {
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -281,9 +274,8 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) {
|
||||
if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
return false;
|
||||
}
|
||||
return entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64D;
|
||||
}
|
||||
|
||||
|
@ -365,11 +357,10 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
|
||||
@Override
|
||||
public int powerRequest() {
|
||||
if (isActive()) {
|
||||
if (isActive())
|
||||
return powerProvider.getMaxEnergyReceived();
|
||||
} else {
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -390,22 +381,26 @@ public class TileFiller extends TileBuildCraft implements ISidedInventory, IPowe
|
|||
|
||||
/**
|
||||
* Get the start of the side inventory.
|
||||
* @param side The global side to get the start of range.
|
||||
*
|
||||
* @param side
|
||||
* The global side to get the start of range.
|
||||
*/
|
||||
public int getStartInventorySide(ForgeDirection side) {
|
||||
if(side == ForgeDirection.UP)
|
||||
if (side == ForgeDirection.UP)
|
||||
return 0;
|
||||
return 9;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of the side inventory.
|
||||
* @param side The global side.
|
||||
*
|
||||
* @param side
|
||||
* The global side.
|
||||
*/
|
||||
public int getSizeInventorySide(ForgeDirection side) {
|
||||
if(side == ForgeDirection.UP)
|
||||
if (side == ForgeDirection.UP)
|
||||
return 9;
|
||||
return getSizeInventory()-9;
|
||||
return getSizeInventory() - 9;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.BuildCraftBuilders;
|
||||
import buildcraft.api.core.IAreaProvider;
|
||||
import buildcraft.api.core.LaserKind;
|
||||
|
@ -19,8 +21,6 @@ import buildcraft.core.network.PacketUpdate;
|
|||
import buildcraft.core.network.TileNetworkData;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
import buildcraft.core.utils.Utils;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
||||
|
||||
|
@ -50,9 +50,8 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
}
|
||||
|
||||
public TileMarker getMarker(World world) {
|
||||
if (!isSet()) {
|
||||
if (!isSet())
|
||||
return null;
|
||||
}
|
||||
|
||||
if (marker == null) {
|
||||
marker = (TileMarker) world.getBlockTileEntity(x, y, z);
|
||||
|
@ -87,7 +86,8 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
|
||||
private EntityBlock[] lasers;
|
||||
private EntityBlock[] signals;
|
||||
public @TileNetworkData boolean showSignals = false;
|
||||
public @TileNetworkData
|
||||
boolean showSignals = false;
|
||||
|
||||
public void updateSignals() {
|
||||
if (CoreProxy.proxy.isSimulating(worldObj)) {
|
||||
|
@ -95,8 +95,8 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
sendNetworkUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private void switchSignals(){
|
||||
|
||||
private void switchSignals() {
|
||||
if (signals != null) {
|
||||
for (EntityBlock b : signals) {
|
||||
if (b != null) {
|
||||
|
@ -105,27 +105,27 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
}
|
||||
signals = null;
|
||||
}
|
||||
if(showSignals){
|
||||
if (showSignals) {
|
||||
signals = new EntityBlock[6];
|
||||
if (!origin.isSet() || !origin.vect[0].isSet()) {
|
||||
signals[0] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord + maxSize - 1,
|
||||
yCoord, zCoord), LaserKind.Blue);
|
||||
signals[1] = Utils.createLaser(worldObj, new Position(xCoord - maxSize + 1, yCoord, zCoord), new Position(xCoord,
|
||||
yCoord, zCoord), LaserKind.Blue);
|
||||
signals[0] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord + maxSize - 1, yCoord, zCoord),
|
||||
LaserKind.Blue);
|
||||
signals[1] = Utils.createLaser(worldObj, new Position(xCoord - maxSize + 1, yCoord, zCoord), new Position(xCoord, yCoord, zCoord),
|
||||
LaserKind.Blue);
|
||||
}
|
||||
|
||||
if (!origin.isSet() || !origin.vect[1].isSet()) {
|
||||
signals[2] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord, yCoord
|
||||
+ maxSize - 1, zCoord), LaserKind.Blue);
|
||||
signals[3] = Utils.createLaser(worldObj, new Position(xCoord, yCoord - maxSize + 1, zCoord), new Position(xCoord,
|
||||
yCoord, zCoord), LaserKind.Blue);
|
||||
signals[2] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord, yCoord + maxSize - 1, zCoord),
|
||||
LaserKind.Blue);
|
||||
signals[3] = Utils.createLaser(worldObj, new Position(xCoord, yCoord - maxSize + 1, zCoord), new Position(xCoord, yCoord, zCoord),
|
||||
LaserKind.Blue);
|
||||
}
|
||||
|
||||
if (!origin.isSet() || !origin.vect[2].isSet()) {
|
||||
signals[4] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord, yCoord,
|
||||
zCoord + maxSize - 1), LaserKind.Blue);
|
||||
signals[5] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord - maxSize + 1), new Position(xCoord,
|
||||
yCoord, zCoord), LaserKind.Blue);
|
||||
signals[4] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord), new Position(xCoord, yCoord, zCoord + maxSize - 1),
|
||||
LaserKind.Blue);
|
||||
signals[5] = Utils.createLaser(worldObj, new Position(xCoord, yCoord, zCoord - maxSize + 1), new Position(xCoord, yCoord, zCoord),
|
||||
LaserKind.Blue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,18 +145,15 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (initVect[i] != null) {
|
||||
linkTo((TileMarker) worldObj
|
||||
.getBlockTileEntity((int) initVect[i].x, (int) initVect[i].y, (int) initVect[i].z),
|
||||
i);
|
||||
linkTo((TileMarker) worldObj.getBlockTileEntity((int) initVect[i].x, (int) initVect[i].y, (int) initVect[i].z), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void tryConnection() {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj)) {
|
||||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
}
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
if (!origin.isSet() || !origin.vect[j].isSet()) {
|
||||
|
@ -209,13 +206,11 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
}
|
||||
|
||||
private boolean linkTo(TileMarker marker, int n) {
|
||||
if (marker == null) {
|
||||
if (marker == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (origin.isSet() && marker.origin.isSet()) {
|
||||
if (origin.isSet() && marker.origin.isSet())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!origin.isSet() && !marker.origin.isSet()) {
|
||||
origin = new Origin();
|
||||
|
@ -287,49 +282,43 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
|
||||
@Override
|
||||
public int xMin() {
|
||||
if (origin.isSet()) {
|
||||
if (origin.isSet())
|
||||
return origin.xMin;
|
||||
}
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yMin() {
|
||||
if (origin.isSet()) {
|
||||
if (origin.isSet())
|
||||
return origin.yMin;
|
||||
}
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int zMin() {
|
||||
if (origin.isSet()) {
|
||||
if (origin.isSet())
|
||||
return origin.zMin;
|
||||
}
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xMax() {
|
||||
if (origin.isSet()) {
|
||||
if (origin.isSet())
|
||||
return origin.xMax;
|
||||
}
|
||||
return xCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yMax() {
|
||||
if (origin.isSet()) {
|
||||
if (origin.isSet())
|
||||
return origin.yMax;
|
||||
}
|
||||
return yCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int zMax() {
|
||||
if (origin.isSet()) {
|
||||
if (origin.isSet())
|
||||
return origin.zMax;
|
||||
}
|
||||
return zCoord;
|
||||
}
|
||||
|
||||
|
@ -361,7 +350,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
TileMarker mark = m.getMarker(worldObj);
|
||||
|
||||
if (mark != null) {
|
||||
if(mark.lasers != null) {
|
||||
if (mark.lasers != null) {
|
||||
for (EntityBlock entity : mark.lasers) {
|
||||
if (entity != null) {
|
||||
entity.setDead();
|
||||
|
@ -376,7 +365,6 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (markerOrigin != this) {
|
||||
markerOrigin.origin = new Origin();
|
||||
}
|
||||
|
@ -409,9 +397,8 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
|
||||
@Override
|
||||
public void removeFromWorld() {
|
||||
if (!origin.isSet()) {
|
||||
if (!origin.isSet())
|
||||
return;
|
||||
}
|
||||
|
||||
Origin o = origin;
|
||||
|
||||
|
@ -419,15 +406,13 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
if (m.isSet()) {
|
||||
worldObj.setBlockWithNotify(m.x, m.y, m.z, 0);
|
||||
|
||||
BuildCraftBuilders.markerBlock
|
||||
.dropBlockAsItem(worldObj, m.x, m.y, m.z, BuildCraftBuilders.markerBlock.blockID, 0);
|
||||
BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, m.x, m.y, m.z, BuildCraftBuilders.markerBlock.blockID, 0);
|
||||
}
|
||||
}
|
||||
|
||||
worldObj.setBlockWithNotify(o.vectO.x, o.vectO.y, o.vectO.z, 0);
|
||||
|
||||
BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, o.vectO.x, o.vectO.y, o.vectO.z,
|
||||
BuildCraftBuilders.markerBlock.blockID, 0);
|
||||
BuildCraftBuilders.markerBlock.dropBlockAsItem(worldObj, o.vectO.x, o.vectO.y, o.vectO.z, BuildCraftBuilders.markerBlock.blockID, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -470,7 +455,7 @@ public class TileMarker extends TileBuildCraft implements IAreaProvider {
|
|||
@Override
|
||||
public void postPacketHandling(PacketUpdate packet) {
|
||||
super.postPacketHandling(packet);
|
||||
|
||||
|
||||
switchSignals();
|
||||
|
||||
if (origin.vectO.isSet()) {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
package buildcraft.builders;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.core.BlockIndex;
|
||||
import buildcraft.core.DefaultProps;
|
||||
|
@ -14,26 +16,22 @@ import buildcraft.core.network.PacketUpdate;
|
|||
import buildcraft.core.network.TileNetworkData;
|
||||
import buildcraft.core.proxy.CoreProxy;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TilePathMarker extends TileMarker {
|
||||
|
||||
public EntityLaser lasers[] = new EntityLaser[2];
|
||||
|
||||
public int x0, y0, z0, x1, y1, z1;
|
||||
public boolean loadLink0 = false, loadLink1 = false;
|
||||
public @TileNetworkData boolean tryingToConnect = false;
|
||||
public @TileNetworkData
|
||||
boolean tryingToConnect = false;
|
||||
|
||||
public TilePathMarker links[] = new TilePathMarker[2];
|
||||
public static int searchSize = 64; //TODO: this should be moved to default props
|
||||
public static int searchSize = 64; // TODO: this should be moved to default props
|
||||
|
||||
//A list with the pathMarkers that aren't fully connected
|
||||
//It only contains markers within the loaded chunks
|
||||
// A list with the pathMarkers that aren't fully connected
|
||||
// It only contains markers within the loaded chunks
|
||||
private static LinkedList<TilePathMarker> availableMarkers = new LinkedList<TilePathMarker>();
|
||||
|
||||
|
||||
public boolean isFullyConnected() {
|
||||
return lasers[0] != null && lasers[1] != null;
|
||||
}
|
||||
|
@ -51,8 +49,9 @@ public class TilePathMarker extends TileMarker {
|
|||
links[1] = marker;
|
||||
}
|
||||
|
||||
if (isFullyConnected())
|
||||
if (isFullyConnected()) {
|
||||
availableMarkers.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void createLaserAndConnect(TilePathMarker pathMarker) {
|
||||
|
@ -60,7 +59,8 @@ public class TilePathMarker extends TileMarker {
|
|||
if (CoreProxy.proxy.isRenderWorld(worldObj))
|
||||
return;
|
||||
|
||||
EntityPowerLaser laser = new EntityPowerLaser(worldObj, new Position(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new Position(pathMarker.xCoord + 0.5, pathMarker.yCoord + 0.5, pathMarker.zCoord + 0.5));
|
||||
EntityPowerLaser laser = new EntityPowerLaser(worldObj, new Position(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5), new Position(pathMarker.xCoord + 0.5,
|
||||
pathMarker.yCoord + 0.5, pathMarker.zCoord + 0.5));
|
||||
laser.show();
|
||||
|
||||
laser.setTexture(DefaultProps.TEXTURE_PATH_ENTITIES + "/laser_1.png");
|
||||
|
@ -70,19 +70,21 @@ public class TilePathMarker extends TileMarker {
|
|||
pathMarker.connect(this, laser);
|
||||
}
|
||||
|
||||
//Searches the availableMarkers list for the nearest available that is within searchSize
|
||||
// Searches the availableMarkers list for the nearest available that is within searchSize
|
||||
private TilePathMarker findNearestAvailablePathMarker() {
|
||||
TilePathMarker nearestAvailable = null;
|
||||
double nearestDistance = 0, distance; //The initialization of nearestDistance is only to make the compiler shut up
|
||||
double nearestDistance = 0, distance; // The initialization of nearestDistance is only to make the compiler shut up
|
||||
|
||||
for (TilePathMarker t : availableMarkers) {
|
||||
if (t == this || t == this.links[0] || t == this.links[1] || t.worldObj.provider.dimensionId != this.worldObj.provider.dimensionId)
|
||||
if (t == this || t == this.links[0] || t == this.links[1] || t.worldObj.provider.dimensionId != this.worldObj.provider.dimensionId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
distance = Math.sqrt(Math.pow(this.xCoord - t.xCoord, 2) + Math.pow(this.yCoord - t.yCoord, 2) + Math.pow(this.zCoord - t.zCoord, 2));
|
||||
|
||||
if (distance > searchSize)
|
||||
if (distance > searchSize) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nearestAvailable == null || distance < nearestDistance) {
|
||||
nearestAvailable = t;
|
||||
|
@ -99,7 +101,7 @@ public class TilePathMarker extends TileMarker {
|
|||
if (CoreProxy.proxy.isRenderWorld(worldObj) || isFullyConnected())
|
||||
return;
|
||||
|
||||
tryingToConnect = !tryingToConnect; //Allow the user to stop the path marker from searching for new path markers to connect
|
||||
tryingToConnect = !tryingToConnect; // Allow the user to stop the path marker from searching for new path markers to connect
|
||||
sendNetworkUpdate();
|
||||
}
|
||||
|
||||
|
@ -133,9 +135,11 @@ public class TilePathMarker extends TileMarker {
|
|||
visitedPaths.add(b);
|
||||
res.add(b);
|
||||
|
||||
if (nextTile.links[0] != null && !visitedPaths.contains(new BlockIndex(nextTile.links[0].xCoord, nextTile.links[0].yCoord, nextTile.links[0].zCoord))) {
|
||||
if (nextTile.links[0] != null
|
||||
&& !visitedPaths.contains(new BlockIndex(nextTile.links[0].xCoord, nextTile.links[0].yCoord, nextTile.links[0].zCoord))) {
|
||||
nextTile = nextTile.links[0];
|
||||
} else if (nextTile.links[1] != null && !visitedPaths.contains(new BlockIndex(nextTile.links[1].xCoord, nextTile.links[1].yCoord, nextTile.links[1].zCoord))) {
|
||||
} else if (nextTile.links[1] != null
|
||||
&& !visitedPaths.contains(new BlockIndex(nextTile.links[1].xCoord, nextTile.links[1].yCoord, nextTile.links[1].zCoord))) {
|
||||
nextTile = nextTile.links[1];
|
||||
} else {
|
||||
nextTile = null;
|
||||
|
@ -168,8 +172,9 @@ public class TilePathMarker extends TileMarker {
|
|||
public void initialize() {
|
||||
super.initialize();
|
||||
|
||||
if (CoreProxy.proxy.isSimulating(worldObj) && !isFullyConnected())
|
||||
availableMarkers.add(this);
|
||||
if (CoreProxy.proxy.isSimulating(worldObj) && !isFullyConnected()) {
|
||||
availableMarkers.add(this);
|
||||
}
|
||||
|
||||
if (loadLink0) {
|
||||
TileEntity e0 = worldObj.getBlockTileEntity(x0, y0, z0);
|
||||
|
@ -203,8 +208,9 @@ public class TilePathMarker extends TileMarker {
|
|||
links[1] = null;
|
||||
}
|
||||
|
||||
if (!isFullyConnected() && !availableMarkers.contains(this) && CoreProxy.proxy.isSimulating(worldObj))
|
||||
if (!isFullyConnected() && !availableMarkers.contains(this) && CoreProxy.proxy.isSimulating(worldObj)) {
|
||||
availableMarkers.add(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,19 +9,18 @@
|
|||
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import buildcraft.builders.TileBlueprintLibrary;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
|
||||
public class ContainerBlueprintLibrary extends BuildCraftContainer {
|
||||
|
||||
|
||||
protected IInventory playerInventory;
|
||||
protected TileBlueprintLibrary library;
|
||||
|
||||
|
||||
private int progressIn, progressOut;
|
||||
|
||||
public ContainerBlueprintLibrary(EntityPlayer player, TileBlueprintLibrary library) {
|
||||
|
@ -38,12 +37,15 @@ public class ContainerBlueprintLibrary extends BuildCraftContainer {
|
|||
addSlotToContainer(new Slot(library, 3, 153, 79));
|
||||
|
||||
// Player inventory
|
||||
for (int l = 0; l < 3; l++)
|
||||
for (int k1 = 0; k1 < 9; k1++)
|
||||
for (int l = 0; l < 3; l++) {
|
||||
for (int k1 = 0; k1 < 9; k1++) {
|
||||
addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 140 + l * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < 9; i1++)
|
||||
for (int i1 = 0; i1 < 9; i1++) {
|
||||
addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 198));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,25 +53,27 @@ public class ContainerBlueprintLibrary extends BuildCraftContainer {
|
|||
super.updateCraftingResults();
|
||||
for (int i = 0; i < crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) crafters.get(i);
|
||||
if (progressIn != library.progressIn)
|
||||
if (progressIn != library.progressIn) {
|
||||
icrafting.sendProgressBarUpdate(this, 0, library.progressIn);
|
||||
if (progressOut != library.progressOut)
|
||||
}
|
||||
if (progressOut != library.progressOut) {
|
||||
icrafting.sendProgressBarUpdate(this, 1, library.progressOut);
|
||||
}
|
||||
}
|
||||
|
||||
progressIn = library.progressIn;
|
||||
progressOut = library.progressOut;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if (i == 0)
|
||||
if (i == 0) {
|
||||
library.progressIn = j;
|
||||
else if(i == 1)
|
||||
} else if (i == 1) {
|
||||
library.progressOut = j;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return library.isUseableByPlayer(entityplayer);
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import buildcraft.builders.TileBuilder;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import buildcraft.builders.TileBuilder;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
|
||||
public class ContainerBuilder extends BuildCraftContainer {
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
|
||||
public class ContainerFiller extends BuildCraftContainer {
|
||||
|
||||
|
@ -66,10 +66,11 @@ public class ContainerFiller extends BuildCraftContainer {
|
|||
return null;
|
||||
} else if (!mergeItemStack(itemstack1, 9, getInventorySize(), false))
|
||||
return null;
|
||||
if (itemstack1.stackSize == 0)
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack(null);
|
||||
else
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import buildcraft.builders.TileArchitect;
|
||||
import buildcraft.core.gui.BuildCraftContainer;
|
||||
|
||||
public class ContainerTemplate extends BuildCraftContainer {
|
||||
|
||||
|
@ -44,20 +44,18 @@ public class ContainerTemplate extends BuildCraftContainer {
|
|||
|
||||
// FIXME: This is not called anymore
|
||||
/*
|
||||
@Override
|
||||
public void onCraftGuiOpened(ICrafting icrafting) {
|
||||
super.onCraftGuiOpened(icrafting);
|
||||
icrafting.updateCraftingInventoryInfo(this, 0, template.computingTime);
|
||||
}
|
||||
*/
|
||||
* @Override public void onCraftGuiOpened(ICrafting icrafting) { super.onCraftGuiOpened(icrafting); icrafting.updateCraftingInventoryInfo(this, 0,
|
||||
* template.computingTime); }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void updateCraftingResults() {
|
||||
super.updateCraftingResults();
|
||||
for (int i = 0; i < crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) crafters.get(i);
|
||||
if (computingTime != template.computingTime)
|
||||
if (computingTime != template.computingTime) {
|
||||
icrafting.sendProgressBarUpdate(this, 0, template.computingTime);
|
||||
}
|
||||
}
|
||||
|
||||
computingTime = template.computingTime;
|
||||
|
@ -65,8 +63,9 @@ public class ContainerTemplate extends BuildCraftContainer {
|
|||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if (i == 0)
|
||||
if (i == 0) {
|
||||
template.computingTime = j;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
package buildcraft.builders.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -90,8 +90,10 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
String[] currentNames = library.currentNames;
|
||||
for (int i = 0; i < currentNames.length; i++) {
|
||||
String name = currentNames[i];
|
||||
if(name == null) break;
|
||||
if(name.length() > BuildCraftBuilders.MAX_BLUEPRINTS_NAME_SIZE){
|
||||
if (name == null) {
|
||||
break;
|
||||
}
|
||||
if (name.length() > BuildCraftBuilders.MAX_BLUEPRINTS_NAME_SIZE) {
|
||||
name = name.substring(0, BuildCraftBuilders.MAX_BLUEPRINTS_NAME_SIZE);
|
||||
}
|
||||
|
||||
|
@ -130,7 +132,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen(){
|
||||
public void updateScreen() {
|
||||
if (library.locked) {
|
||||
lockButton.displayString = StringUtil.localize("gui.unlock");
|
||||
} else {
|
||||
|
@ -140,8 +142,7 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
PacketLibraryAction packet = new PacketLibraryAction(PacketIds.LIBRARY_ACTION,
|
||||
library.xCoord, library.yCoord, library.zCoord);
|
||||
PacketLibraryAction packet = new PacketLibraryAction(PacketIds.LIBRARY_ACTION, library.xCoord, library.yCoord, library.zCoord);
|
||||
if (button == nextPageButton) {
|
||||
packet.actionId = TileBlueprintLibrary.COMMAND_NEXT;
|
||||
} else if (button == prevPageButton) {
|
||||
|
@ -167,12 +168,11 @@ public class GuiBlueprintLibrary extends GuiBuildCraft {
|
|||
if (x >= 8 && x <= 88) {
|
||||
int ySlot = (y - 24) / 9;
|
||||
|
||||
if (ySlot >= 0 && ySlot <= 11){
|
||||
if (ySlot < library.currentNames.length){
|
||||
if (ySlot >= 0 && ySlot <= 11) {
|
||||
if (ySlot < library.currentNames.length) {
|
||||
PacketPayload payload = new PacketPayload();
|
||||
payload.intPayload = new int[]{ySlot};
|
||||
PacketLibraryAction packet = new PacketLibraryAction(PacketIds.LIBRARY_SELECT,
|
||||
library.xCoord, library.yCoord, library.zCoord);
|
||||
payload.intPayload = new int[] { ySlot };
|
||||
PacketLibraryAction packet = new PacketLibraryAction(PacketIds.LIBRARY_SELECT, library.xCoord, library.yCoord, library.zCoord);
|
||||
packet.actionId = ySlot;
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
}
|
||||
|
|
|
@ -35,9 +35,11 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
|
||||
slots = new AdvancedSlot[7 * 4];
|
||||
|
||||
for (int i = 0; i < 7; ++i)
|
||||
for (int j = 0; j < 4; ++j)
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
slots[i * 4 + j] = new ItemSlot(179 + j * 18, 18 + i * 18);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,8 +51,9 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
fontRenderer.drawString(StringUtil.localize("gui.building.resources"), 8, 60, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 97, 0x404040);
|
||||
|
||||
if (builder.isBuildingBlueprint())
|
||||
if (builder.isBuildingBlueprint()) {
|
||||
fontRenderer.drawString(StringUtil.localize("gui.needed"), 185, 7, 0x404040);
|
||||
}
|
||||
|
||||
drawForegroundSelection(par1, par2);
|
||||
}
|
||||
|
@ -75,8 +78,9 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
|
||||
drawTexturedModalRect(j, k, 0, 0, realXSize, ySize);
|
||||
|
||||
for (int s = 0; s < slots.length; ++s)
|
||||
for (int s = 0; s < slots.length; ++s) {
|
||||
((ItemSlot) slots[s]).stack = null;
|
||||
}
|
||||
|
||||
Collection<ItemStack> needs = builder.getNeededItems();
|
||||
|
||||
|
@ -84,8 +88,9 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
int s = 0;
|
||||
|
||||
for (ItemStack stack : needs) {
|
||||
if (s >= slots.length)
|
||||
if (s >= slots.length) {
|
||||
break;
|
||||
}
|
||||
|
||||
((ItemSlot) slots[s]).stack = stack.copy();
|
||||
s++;
|
||||
|
|
|
@ -38,8 +38,9 @@ public class GuiFiller extends GuiBuildCraft {
|
|||
fontRenderer.drawString(StringUtil.localize("gui.filling.resources"), 8, 74, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, 142, 0x404040);
|
||||
|
||||
if (filler.currentPattern != null)
|
||||
if (filler.currentPattern != null) {
|
||||
drawForegroundSelection(filler.currentPattern.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,10 +45,11 @@ public class GuiTemplate extends GuiBuildCraft {
|
|||
fontRenderer.drawString(title, getCenteredOffset(title), 6, 0x404040);
|
||||
fontRenderer.drawString(StringUtil.localize("gui.inventory"), 8, ySize - 152, 0x404040);
|
||||
|
||||
if (editMode && ((new Date()).getTime() / 100) % 8 >= 4)
|
||||
if (editMode && ((new Date()).getTime() / 100) % 8 >= 4) {
|
||||
fontRenderer.drawString(template.name + "|", 51, 62, 0x404040);
|
||||
else
|
||||
} else {
|
||||
fontRenderer.drawString(template.name, 51, 62, 0x404040);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,10 +74,11 @@ public class GuiTemplate extends GuiBuildCraft {
|
|||
int x = i - xMin;
|
||||
int y = j - yMin;
|
||||
|
||||
if (editMode)
|
||||
if (editMode) {
|
||||
editMode = false;
|
||||
else if (x >= 50 && y >= 61 && x <= 137 && y <= 139)
|
||||
} else if (x >= 50 && y >= 61 && x <= 137 && y <= 139) {
|
||||
editMode = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,9 +89,8 @@ public class GuiTemplate extends GuiBuildCraft {
|
|||
return;
|
||||
}
|
||||
PacketPayload payload = new PacketPayload();
|
||||
payload.intPayload = new int[]{c};
|
||||
PacketUpdate packet = new PacketUpdate(PacketIds.ARCHITECT_NAME,
|
||||
template.xCoord, template.yCoord, template.zCoord, payload);
|
||||
payload.intPayload = new int[] { c };
|
||||
PacketUpdate packet = new PacketUpdate(PacketIds.ARCHITECT_NAME, template.xCoord, template.yCoord, template.zCoord, payload);
|
||||
CoreProxy.proxy.sendToServer(packet.getPacket());
|
||||
} else {
|
||||
super.keyTyped(c, i);
|
||||
|
|
|
@ -26,17 +26,17 @@ public class PacketHandlerBuilders implements IPacketHandler {
|
|||
case PacketIds.ARCHITECT_NAME:
|
||||
PacketUpdate packetA = new PacketUpdate();
|
||||
packetA.readData(data);
|
||||
onArchitectName((EntityPlayer)player, packetA);
|
||||
onArchitectName((EntityPlayer) player, packetA);
|
||||
break;
|
||||
case PacketIds.LIBRARY_ACTION:
|
||||
PacketLibraryAction packetB = new PacketLibraryAction();
|
||||
packetB.readData(data);
|
||||
onLibraryAction((EntityPlayer)player, packetB);
|
||||
onLibraryAction((EntityPlayer) player, packetB);
|
||||
break;
|
||||
case PacketIds.LIBRARY_SELECT:
|
||||
PacketLibraryAction packetC = new PacketLibraryAction();
|
||||
packetC.readData(data);
|
||||
onLibrarySelect((EntityPlayer)player, packetC);
|
||||
onLibrarySelect((EntityPlayer) player, packetC);
|
||||
break;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
@ -46,19 +46,17 @@ public class PacketHandlerBuilders implements IPacketHandler {
|
|||
}
|
||||
|
||||
private void onArchitectName(EntityPlayer player, PacketUpdate packet) {
|
||||
TileEntity te = player.worldObj.getBlockTileEntity(packet.posX,
|
||||
packet.posY, packet.posZ);
|
||||
if(te instanceof TileArchitect){
|
||||
TileEntity te = player.worldObj.getBlockTileEntity(packet.posX, packet.posY, packet.posZ);
|
||||
if (te instanceof TileArchitect) {
|
||||
((TileArchitect) te).handleClientInput((char) packet.payload.intPayload[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private void onLibraryAction(EntityPlayer player, PacketLibraryAction packet) {
|
||||
TileEntity te = player.worldObj.getBlockTileEntity(packet.posX,
|
||||
packet.posY, packet.posZ);
|
||||
if(te instanceof TileBlueprintLibrary) {
|
||||
TileEntity te = player.worldObj.getBlockTileEntity(packet.posX, packet.posY, packet.posZ);
|
||||
if (te instanceof TileBlueprintLibrary) {
|
||||
TileBlueprintLibrary tbl = (TileBlueprintLibrary) te;
|
||||
switch(packet.actionId){
|
||||
switch (packet.actionId) {
|
||||
case TileBlueprintLibrary.COMMAND_DELETE:
|
||||
tbl.deleteSelectedBpt();
|
||||
break;
|
||||
|
@ -77,12 +75,11 @@ public class PacketHandlerBuilders implements IPacketHandler {
|
|||
}
|
||||
|
||||
private void onLibrarySelect(EntityPlayer player, PacketLibraryAction packet) {
|
||||
TileEntity te = player.worldObj.getBlockTileEntity(packet.posX,
|
||||
packet.posY, packet.posZ);
|
||||
if(te instanceof TileBlueprintLibrary){
|
||||
TileEntity te = player.worldObj.getBlockTileEntity(packet.posX, packet.posY, packet.posZ);
|
||||
if (te instanceof TileBlueprintLibrary) {
|
||||
TileBlueprintLibrary tbl = (TileBlueprintLibrary) te;
|
||||
int ySlot = packet.actionId;
|
||||
if (ySlot < tbl.getCurrentPage().size()){
|
||||
if (ySlot < tbl.getCurrentPage().size()) {
|
||||
tbl.selected = ySlot;
|
||||
}
|
||||
tbl.sendNetworkUpdate();
|
||||
|
|
|
@ -9,13 +9,14 @@ import buildcraft.core.network.PacketCoordinates;
|
|||
public class PacketLibraryAction extends PacketCoordinates {
|
||||
|
||||
public int actionId;
|
||||
|
||||
public PacketLibraryAction() {}
|
||||
|
||||
public PacketLibraryAction() {
|
||||
}
|
||||
|
||||
public PacketLibraryAction(int packetId, int x, int y, int z) {
|
||||
super(packetId, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {
|
||||
data.writeInt(actionId);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue