migrated to Minecraft 1.7

This commit is contained in:
SpaceToad 2014-02-16 12:10:01 +01:00
commit 90f2532278
563 changed files with 7509 additions and 5552 deletions

View file

@ -19,12 +19,13 @@
<property name="mcpsrc.dir" value="${mcp.dir}/src"/>
<property name="mc.version" value="1.6.4"/>
<property name="forge.version" value="9.11.1.949"/>
<property name="forge.version" value="9.11.1.965"/>
<!-- <property name="project.version" value="0.0.0"/>-->
<property name="buildcraft.name" value="buildcraft"/>
<property name="forge.name" value="minecraftforge-src-${mc.version}-${forge.version}.zip"/>
<property name="forge.name" value="forge-${mc.version}-${forge.version}-src.zip"/>
<property name="forge.url" value="maven/net/minecraftforge/forge/${mc.version}-${forge.version}"/>
<available property="forge-exists" file="${download.dir}/${forge.name}"/>
<available file="${src.dir}/.git" type="dir" property="git.present"/>
@ -99,7 +100,7 @@
<!-- Download forge (if it doesn't exist) -->
<target name="download-forge" unless="forge-exists">
<get src="http://files.minecraftforge.net/${forge.name}" dest="${download.dir}" usetimestamp="True"/>
<get src="http://files.minecraftforge.net/${forge.url}/${forge.name}" dest="${download.dir}" usetimestamp="True"/>
</target>
<!-- Setup mcp and forge -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View file

@ -57,10 +57,11 @@ gate.trigger.engine.blue=Engine Blue
gate.trigger.engine.green=Engine Green
gate.trigger.engine.yellow=Engine Yellow
gate.trigger.engine.red=Engine Red
gate.trigger.fluid.emtpy=Tank Empty
gate.trigger.fluid.empty=Tank Empty
gate.trigger.fluid.contains=Fluid in Tank
gate.trigger.fluid.space=Space for Fluid
gate.trigger.fluid.full=Tank Full
gate.trigger.fluidlevel.below=Contains < %d%%
gate.trigger.inventory.empty=Inventory Empty
gate.trigger.inventory.contains=Items in Inventory
gate.trigger.inventory.space=Space in Inventory

View file

@ -69,6 +69,7 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.blueprints.BptPlayerIndex;
import buildcraft.core.blueprints.BptRootIndex;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.BCLog;
import cpw.mods.fml.common.Mod;
@ -78,7 +79,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
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.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@ -91,18 +92,18 @@ import java.util.LinkedList;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.Property;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.common.config.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)
public class BuildCraftBuilders {
public class BuildCraftBuilders extends BuildCraftMod {
public static final char BPT_SEP_CHARACTER = '-';
public static final int LIBRARY_PAGE_SIZE = 12;
@ -145,12 +146,16 @@ public class BuildCraftBuilders {
@EventHandler
public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-BUILDERS", new PacketHandlerBuilders());
// Register gui handler
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// Register save handler
MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders());
/*
new BptBlock(0); // default bpt block
new BptBlockIgnore(Block.snow.blockID);
@ -236,7 +241,7 @@ public class BuildCraftBuilders {
new BptBlockInventory(libraryBlock.blockID);
new BptBlockWallSide(markerBlock.blockID);
new BptBlockWallSide(pathMarkerBlock.blockID);
new BptBlockWallSide(pathMarkerBlock.blockID);*/
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
@ -246,16 +251,6 @@ public class BuildCraftBuilders {
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
Property templateItemId = BuildCraftCore.mainConfiguration.getItem("templateItem.id", DefaultProps.TEMPLATE_ITEM_ID);
Property blueprintItemId = BuildCraftCore.mainConfiguration.getItem("blueprintItem.id", DefaultProps.BLUEPRINT_ITEM_ID);
Property markerId = BuildCraftCore.mainConfiguration.getBlock("marker.id", DefaultProps.MARKER_ID);
Property pathMarkerId = BuildCraftCore.mainConfiguration.getBlock("pathMarker.id", DefaultProps.PATH_MARKER_ID);
Property fillerId = BuildCraftCore.mainConfiguration.getBlock("filler.id", DefaultProps.FILLER_ID);
Property builderId = BuildCraftCore.mainConfiguration.getBlock("builder.id", DefaultProps.BUILDER_ID);
Property architectId = BuildCraftCore.mainConfiguration.getBlock("architect.id", DefaultProps.ARCHITECT_ID);
Property libraryId = BuildCraftCore.mainConfiguration.getBlock("blueprintLibrary.id", DefaultProps.BLUEPRINT_LIBRARY_ID);
Property urbanistId = BuildCraftCore.mainConfiguration.getBlock("urbanist.id", DefaultProps.URBANIST_ID);
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);
@ -268,42 +263,43 @@ public class BuildCraftBuilders {
fillerLifespanNormalProp.comment = "Lifespan in ticks of items dropped by the filler from non-tough blocks (those that can be broken by hand)";
fillerLifespanNormal = fillerLifespanNormalProp.getInt(DefaultProps.FILLER_LIFESPAN_NORMAL);
templateItem = new ItemBlueprintTemplate(templateItemId.getInt());
templateItem = new ItemBlueprintTemplate();
templateItem.setUnlocalizedName("templateItem");
LanguageRegistry.addName(templateItem, "Template");
CoreProxy.proxy.registerItem(templateItem);
blueprintItem = new ItemBlueprintStandard(blueprintItemId.getInt());
blueprintItem = new ItemBlueprintStandard();
blueprintItem.setUnlocalizedName("blueprintItem");
LanguageRegistry.addName(blueprintItem, "Blueprint");
CoreProxy.proxy.registerItem(blueprintItem);
markerBlock = new BlockMarker(markerId.getInt());
CoreProxy.proxy.registerBlock(markerBlock.setUnlocalizedName("markerBlock"));
markerBlock = new BlockMarker();
CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock"));
CoreProxy.proxy.addName(markerBlock, "Land Mark");
pathMarkerBlock = new BlockPathMarker(pathMarkerId.getInt());
CoreProxy.proxy.registerBlock(pathMarkerBlock.setUnlocalizedName("pathMarkerBlock"));
pathMarkerBlock = new BlockPathMarker();
CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock"));
CoreProxy.proxy.addName(pathMarkerBlock, "Path Mark");
fillerBlock = new BlockFiller(fillerId.getInt());
CoreProxy.proxy.registerBlock(fillerBlock.setUnlocalizedName("fillerBlock"));
fillerBlock = new BlockFiller();
CoreProxy.proxy.registerBlock(fillerBlock.setBlockName("fillerBlock"));
CoreProxy.proxy.addName(fillerBlock, "Filler");
builderBlock = new BlockBuilder(builderId.getInt());
CoreProxy.proxy.registerBlock(builderBlock.setUnlocalizedName("builderBlock"));
builderBlock = new BlockBuilder();
CoreProxy.proxy.registerBlock(builderBlock.setBlockName("builderBlock"));
CoreProxy.proxy.addName(builderBlock, "Builder");
architectBlock = new BlockArchitect(architectId.getInt());
CoreProxy.proxy.registerBlock(architectBlock.setUnlocalizedName("architectBlock"));
architectBlock = new BlockArchitect();
CoreProxy.proxy.registerBlock(architectBlock.setBlockName("architectBlock"));
CoreProxy.proxy.addName(architectBlock, "Architect Table");
libraryBlock = new BlockBlueprintLibrary(libraryId.getInt());
CoreProxy.proxy.registerBlock(libraryBlock.setUnlocalizedName("libraryBlock"));
libraryBlock = new BlockBlueprintLibrary();
CoreProxy.proxy.registerBlock(libraryBlock.setBlockName("libraryBlock"));
CoreProxy.proxy.addName(libraryBlock, "Blueprint Library");
urbanistBlock = new BlockUrbanist (urbanistId.getInt());
CoreProxy.proxy.registerBlock(urbanistBlock.setUnlocalizedName("urbanistBlock"));
urbanistBlock = new BlockUrbanist ();
CoreProxy.proxy.registerBlock(urbanistBlock.setBlockName("urbanistBlock"));
CoreProxy.proxy.addName(urbanistBlock, "Urbanist");
CoreProxy.proxy.registerTileEntity(TileUrbanist.class, "net.minecraft.src.builders.TileUrbanist");
@ -347,17 +343,17 @@ public class BuildCraftBuilders {
// new ItemStack(Item.dyePowder, 1, 0), 'p', Item.paper});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(blueprintItem, 1), new Object[]{"ppp", "pip", "ppp", 'i',
new ItemStack(Item.dyePowder, 1, 4), 'p', Item.paper});
new ItemStack(Items.dye, 1, 4), 'p', Items.paper});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(markerBlock, 1), new Object[]{"l ", "r ", 'l',
new ItemStack(Item.dyePowder, 1, 4), 'r', Block.torchRedstoneActive});
new ItemStack(Items.dye, 1, 4), 'r', Blocks.redstone_torch});
// CoreProxy.proxy.addCraftingRecipe(new ItemStack(pathMarkerBlock, 1), new Object[]{"l ", "r ", 'l',
// new ItemStack(Item.dyePowder, 1, 2), 'r', Block.torchRedstoneActive});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(fillerBlock, 1), new Object[]{"btb", "ycy", "gCg", 'b',
new ItemStack(Item.dyePowder, 1, 0), 't', markerBlock, 'y', new ItemStack(Item.dyePowder, 1, 11),
'c', Block.workbench, 'g', BuildCraftCore.goldGearItem, 'C', Block.chest});
new ItemStack(Items.dye, 1, 0), 't', markerBlock, 'y', new ItemStack(Items.dye, 1, 11),
'c', Blocks.crafting_table, 'g', BuildCraftCore.goldGearItem, 'C', Blocks.chest});
// CoreProxy.proxy.addCraftingRecipe(new ItemStack(builderBlock, 1), new Object[]{"btb", "ycy", "gCg", 'b',
// new ItemStack(Item.dyePowder, 1, 0), 't', markerBlock, 'y', new ItemStack(Item.dyePowder, 1, 11),
@ -369,7 +365,7 @@ public class BuildCraftBuilders {
// new ItemStack(templateItem, 1)});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(libraryBlock, 1), new Object[]{"bbb", "bBb", "bbb", 'b',
new ItemStack(blueprintItem), 'B', Block.bookShelf});
new ItemStack(blueprintItem), 'B', Blocks.bookshelf});
}
@EventHandler
@ -411,8 +407,8 @@ public class BuildCraftBuilders {
return rootBptIndex;
}
public static ItemStack getBptItemStack(int id, int damage, String name) {
ItemStack stack = new ItemStack(id, 1, damage);
public static ItemStack getBptItemStack(Item item, int damage, String name) {
ItemStack stack = new ItemStack(item, 1, damage);
NBTTagCompound nbt = new NBTTagCompound();
if (name != null && !"".equals(name)) {
nbt.setString("BptName", name);
@ -432,20 +428,20 @@ public class BuildCraftBuilders {
TilePathMarker.clearAvailableMarkersList();
}
@ForgeSubscribe
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre evt) {
if (evt.map.textureType == 0) {
if (evt.map.getTextureType() == 0) {
for (FillerPattern pattern : FillerPattern.patterns.values()) {
pattern.registerIcon(evt.map);
}
}
}
@ForgeSubscribe
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Pre event) {
if (event.map.textureType == 1) {
if (event.map.getTextureType() == 1) {
UrbanistToolsIconProvider.INSTANCE.registerIcons(event.map);
}
}

View file

@ -8,22 +8,30 @@
*/
package buildcraft;
import static buildcraft.BuildCraftEnergy.spawnOilSprings;
import java.io.File;
import java.util.EnumMap;
import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.network.Packet;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.Property;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.fluids.BlockFluidBase;
import net.minecraftforge.fluids.IFluidBlock;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.core.IIconProvider;
@ -48,6 +56,7 @@ import buildcraft.core.SpringPopulate;
import buildcraft.core.TickHandlerCoreClient;
import buildcraft.core.Version;
import buildcraft.core.blueprints.BptItem;
import buildcraft.core.network.BuildCraftPacket;
import buildcraft.core.network.EntityIds;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.network.PacketUpdate;
@ -61,6 +70,7 @@ import buildcraft.core.triggers.BCTrigger;
import buildcraft.core.triggers.DefaultActionProvider;
import buildcraft.core.triggers.DefaultTriggerProvider;
import buildcraft.core.triggers.TriggerFluidContainer;
import buildcraft.core.triggers.TriggerFluidContainerLevel;
import buildcraft.core.triggers.TriggerInventory;
import buildcraft.core.triggers.TriggerInventoryLevel;
import buildcraft.core.triggers.TriggerMachine;
@ -73,6 +83,7 @@ import buildcraft.core.robots.EntityRobot;
import buildcraft.core.robots.EntityRobotBuilder;
import buildcraft.core.robots.EntityRobotPicker;
import buildcraft.core.triggers.TriggerRedstoneInput;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -81,19 +92,17 @@ import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
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.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", acceptedMinecraftVersions = "[1.6.4,1.7)", dependencies = "required-after:Forge@[9.11.1.953,)")
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandler.class, clientSideRequired = true, serverSideRequired = true)
public class BuildCraftCore {
@Mod(name = "BuildCraft", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Core", acceptedMinecraftVersions = "[1.7.2,1.8)", dependencies = "required-after:Forge@[10.12.0.1024,)")
public class BuildCraftCore extends BuildCraftMod {
public static enum RenderMode {
Full, NoDynamic
};
public static RenderMode render = RenderMode.Full;
@ -105,7 +114,10 @@ public class BuildCraftCore {
public static int updateFactor = 10;
public static long longUpdateFactor = 40;
public static BuildCraftConfiguration mainConfiguration;
// TODO: This doesn't seem used anymore. Remove if it's the case.
public static TreeMap<BlockIndex, PacketUpdate> bufferedDescriptions = new TreeMap<BlockIndex, PacketUpdate>();
public static final int trackedPassiveEntityId = 156;
public static boolean continuousCurrentModel;
public static Block springBlock;
@ -120,19 +132,18 @@ public class BuildCraftCore {
public static Item robotBuilderItem;
public static Item robotPickerItem;
@SideOnly(Side.CLIENT)
public static Icon redLaserTexture;
public static IIcon redLaserTexture;
@SideOnly(Side.CLIENT)
public static Icon blueLaserTexture;
public static IIcon blueLaserTexture;
@SideOnly(Side.CLIENT)
public static Icon stripesLaserTexture;
public static IIcon stripesLaserTexture;
@SideOnly(Side.CLIENT)
public static Icon transparentTexture;
public static IIcon transparentTexture;
@SideOnly(Side.CLIENT)
public static IIconProvider iconProvider;
public static int blockByEntityModel;
public static int legacyPipeModel;
public static int markerModel;
public static int oilModel;
public static BCTrigger triggerMachineActive = new TriggerMachine(true);
public static BCTrigger triggerMachineInactive = new TriggerMachine(false);
public static BCTrigger triggerEmptyInventory = new TriggerInventory(TriggerInventory.State.Empty);
@ -148,6 +159,9 @@ public class BuildCraftCore {
public static BCTrigger triggerInventoryBelow25 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_25);
public static BCTrigger triggerInventoryBelow50 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_50);
public static BCTrigger triggerInventoryBelow75 = new TriggerInventoryLevel(TriggerInventoryLevel.TriggerType.BELOW_75);
public static BCTrigger triggerFluidContainerBelow25 = new TriggerFluidContainerLevel(TriggerFluidContainerLevel.TriggerType.BELOW_25);
public static BCTrigger triggerFluidContainerBelow50 = new TriggerFluidContainerLevel(TriggerFluidContainerLevel.TriggerType.BELOW_50);
public static BCTrigger triggerFluidContainerBelow75 = new TriggerFluidContainerLevel(TriggerFluidContainerLevel.TriggerType.BELOW_75);
public static BCAction actionRedstone = new ActionRedstoneOutput();
public static BCAction actionOn = new ActionMachineControl(Mode.On);
public static BCAction actionOff = new ActionMachineControl(Mode.Off);
@ -155,7 +169,7 @@ public class BuildCraftCore {
public static boolean loadDefaultRecipes = true;
public static boolean forcePneumaticPower = true;
public static boolean consumeWaterSources = false;
public static BptItem[] itemBptProps = new BptItem[Item.itemsList.length];
//public static BptItem[] itemBptProps = new BptItem[Item.itemsList.length];
@Instance("BuildCraft|Core")
public static BuildCraftCore instance;
@ -202,30 +216,17 @@ public class BuildCraftCore {
longFactor.comment = "delay between full client sync packets, increasing it saves bandwidth, decreasing makes for better client syncronization.";
longUpdateFactor = longFactor.getInt(40);
Property wrenchId = BuildCraftCore.mainConfiguration.getItem("wrench.id", DefaultProps.WRENCH_ID);
wrenchItem = (new ItemWrench(wrenchId.getInt(DefaultProps.WRENCH_ID))).setUnlocalizedName("wrenchItem");
wrenchItem = (new ItemWrench()).setUnlocalizedName("wrenchItem");
LanguageRegistry.addName(wrenchItem, "Wrench");
CoreProxy.proxy.registerItem(wrenchItem);
int springId = BuildCraftCore.mainConfiguration.getBlock("springBlock.id", DefaultProps.SPRING_ID).getInt(DefaultProps.SPRING_ID);
Property woodenGearId = BuildCraftCore.mainConfiguration.getItem("woodenGearItem.id", DefaultProps.WOODEN_GEAR_ID);
Property stoneGearId = BuildCraftCore.mainConfiguration.getItem("stoneGearItem.id", DefaultProps.STONE_GEAR_ID);
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 redstoneCrystalId = BuildCraftCore.mainConfiguration.getItem("redstoneCrystalItem.id", DefaultProps.REDSTONE_CRYSTAL_ID);
Property robotBaseItemId = BuildCraftCore.mainConfiguration.getItem("robotBaseItem.id", DefaultProps.ROBOT_BASE_ITEM_ID);
Property robotBuilderItemId = BuildCraftCore.mainConfiguration.getItem("robotBuilderItem.id", DefaultProps.ROBOT_BUILDER_ITEM_ID);
Property robotPickerItemId = BuildCraftCore.mainConfiguration.getItem("robotPickerItem.id", DefaultProps.ROBOT_PICKER_ITEM_ID);
Property modifyWorldProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "modifyWorld", true);
modifyWorldProp.comment = "set to false if BuildCraft should not generate custom blocks (e.g. oil)";
modifyWorld = modifyWorldProp.getBoolean(true);
if (BuildCraftCore.modifyWorld && springId > 0) {
if (BuildCraftCore.modifyWorld) {
BlockSpring.EnumSpring.WATER.canGen = BuildCraftCore.mainConfiguration.get("worldgen", "waterSpring", true).getBoolean(true);
springBlock = new BlockSpring(springId).setUnlocalizedName("eternalSpring");
springBlock = new BlockSpring().setBlockName("eternalSpring");
CoreProxy.proxy.registerBlock(springBlock, ItemSpring.class);
}
@ -233,53 +234,36 @@ public class BuildCraftCore {
consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
consumeWater.comment = "set to true if the Pump should consume water";
woodenGearItem = (new ItemBuildCraft(woodenGearId.getInt())).setUnlocalizedName("woodenGearItem");
woodenGearItem = (new ItemBuildCraft()).setUnlocalizedName("woodenGearItem");
LanguageRegistry.addName(woodenGearItem, "Wooden Gear");
CoreProxy.proxy.registerItem(woodenGearItem);
OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));
stoneGearItem = (new ItemBuildCraft(stoneGearId.getInt())).setUnlocalizedName("stoneGearItem");
stoneGearItem = (new ItemBuildCraft()).setUnlocalizedName("stoneGearItem");
LanguageRegistry.addName(stoneGearItem, "Stone Gear");
CoreProxy.proxy.registerItem(stoneGearItem);
OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem));
ironGearItem = (new ItemBuildCraft(ironGearId.getInt())).setUnlocalizedName("ironGearItem");
ironGearItem = (new ItemBuildCraft()).setUnlocalizedName("ironGearItem");
LanguageRegistry.addName(ironGearItem, "Iron Gear");
CoreProxy.proxy.registerItem(ironGearItem);
OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem));
goldGearItem = (new ItemBuildCraft(goldenGearId.getInt())).setUnlocalizedName("goldGearItem");
goldGearItem = (new ItemBuildCraft()).setUnlocalizedName("goldGearItem");
LanguageRegistry.addName(goldGearItem, "Gold Gear");
CoreProxy.proxy.registerItem(goldGearItem);
OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem));
diamondGearItem = (new ItemBuildCraft(diamondGearId.getInt())).setUnlocalizedName("diamondGearItem");
diamondGearItem = (new ItemBuildCraft()).setUnlocalizedName("diamondGearItem");
LanguageRegistry.addName(diamondGearItem, "Diamond Gear");
CoreProxy.proxy.registerItem(diamondGearItem);
OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem));
redstoneCrystal = (new ItemBuildCraft(redstoneCrystalId.getInt())).setUnlocalizedName("redstoneCrystal");
redstoneCrystal = (new ItemBuildCraft()).setUnlocalizedName("redstoneCrystal");
LanguageRegistry.addName(redstoneCrystal, "Redstone Crystal");
CoreProxy.proxy.registerItem(redstoneCrystal);
OreDictionary.registerOre("redstoneCrystal", new ItemStack(redstoneCrystal));
robotBaseItem = (new ItemRobot(robotBaseItemId.getInt(), EntityRobot.class)).setUnlocalizedName("robotBaseItem");
LanguageRegistry.addName(robotBaseItem, "Base Robot");
CoreProxy.proxy.registerItem(robotBaseItem);
robotBuilderItem = (new ItemRobot(robotBuilderItemId.getInt(), EntityRobotBuilder.class)).setUnlocalizedName("robotBuilderItem");
LanguageRegistry.addName(robotBuilderItem, "Builder Robot");
CoreProxy.proxy.registerItem(robotBuilderItem);
robotPickerItem = (new ItemRobot(robotPickerItemId.getInt(), EntityRobotPicker.class)).setUnlocalizedName("robotPickerItem");
LanguageRegistry.addName(robotPickerItem, "Picker Robot");
CoreProxy.proxy.registerItem(robotPickerItem);
Property colorBlindProp = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "client.colorblindmode", false);
colorBlindProp.comment = "Set to true to enable alternate textures";
colorBlindMode = colorBlindProp.getBoolean(false);
MinecraftForge.EVENT_BUS.register(this);
} finally {
if (mainConfiguration.hasChanged()) {
@ -291,7 +275,9 @@ public class BuildCraftCore {
@EventHandler
public void initialize(FMLInitializationEvent evt) {
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-CORE", new PacketHandler());
ActionManager.registerTriggerProvider(new DefaultTriggerProvider());
ActionManager.registerActionProvider(new DefaultActionProvider());
@ -325,17 +311,19 @@ public class BuildCraftCore {
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
for (Block block : Block.blocksList) {
if (block instanceof BlockFluid || block instanceof IFluidBlock || block instanceof IPlantable) {
BuildCraftAPI.softBlocks[block.blockID] = true;
for (Object o : Block.blockRegistry) {
Block block = (Block) o;
if (block instanceof BlockFluidBase || block instanceof IFluidBlock || block instanceof IPlantable) {
BuildCraftAPI.softBlocks.add(block);
}
}
BuildCraftAPI.softBlocks[Block.snow.blockID] = true;
BuildCraftAPI.softBlocks[Block.vine.blockID] = true;
BuildCraftAPI.softBlocks[Block.fire.blockID] = true;
TickRegistry.registerTickHandler(new TickHandlerCoreClient(), Side.CLIENT);
BuildCraftAPI.softBlocks.add(Blocks.snow);
BuildCraftAPI.softBlocks.add(Blocks.vine);
BuildCraftAPI.softBlocks.add(Blocks.fire);
FMLCommonHandler.instance().bus().register(new TickHandlerCoreClient());
}
@EventHandler
@ -343,14 +331,14 @@ public class BuildCraftCore {
event.registerServerCommand(new CommandBuildCraft());
}
@ForgeSubscribe
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Pre event) {
if (event.map.textureType == 1) {
if (event.map.getTextureType() == 1) {
iconProvider = new CoreIconProvider();
iconProvider.registerIcons(event.map);
ActionTriggerIconProvider.INSTANCE.registerIcons(event.map);
} else if (event.map.textureType == 0) {
} else if (event.map.getTextureType() == 0) {
BuildCraftCore.redLaserTexture = event.map.registerIcon("buildcraft:blockRedLaser");
BuildCraftCore.blueLaserTexture = event.map.registerIcon("buildcraft:blockBlueLaser");
BuildCraftCore.stripesLaserTexture = event.map.registerIcon("buildcraft:blockStripesLaser");
@ -360,13 +348,13 @@ public class BuildCraftCore {
}
public void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", 'I', Item.ingotIron, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", 'I', Items.iron_ingot, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(woodenGearItem), " S ", "S S", " S ", 'S', "stickWood");
CoreProxy.proxy.addCraftingRecipe(new ItemStack(stoneGearItem), " I ", "IGI", " I ", 'I', "cobblestone", 'G',
woodenGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(ironGearItem), " I ", "IGI", " I ", 'I', Item.ingotIron, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(goldGearItem), " I ", "IGI", " I ", 'I', Item.ingotGold, 'G', ironGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(diamondGearItem), " I ", "IGI", " I ", 'I', Item.diamond, 'G', goldGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(ironGearItem), " I ", "IGI", " I ", 'I', Items.iron_ingot, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(goldGearItem), " I ", "IGI", " I ", 'I', Items.gold_ingot, 'G', ironGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(diamondGearItem), " I ", "IGI", " I ", 'I', Items.diamond, 'G', goldGearItem);
}
@EventHandler

View file

@ -37,6 +37,7 @@ import buildcraft.energy.worldgen.BiomeGenOilDesert;
import buildcraft.energy.worldgen.BiomeGenOilOcean;
import buildcraft.energy.worldgen.BiomeInitializer;
import buildcraft.energy.worldgen.OilPopulate;
import buildcraft.transport.network.PacketHandlerTransport;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -44,7 +45,7 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
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.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
@ -54,22 +55,22 @@ import java.util.TreeMap;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.Property;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE)
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, clientSideRequired = true, serverSideRequired = true)
public class BuildCraftEnergy {
public class BuildCraftEnergy extends BuildCraftMod {
public final static int ENERGY_REMOVE_BLOCK = 25;
public final static int ENERGY_EXTRACT_ITEM = 2;
@ -104,21 +105,6 @@ public class BuildCraftEnergy {
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
Property engineId = BuildCraftCore.mainConfiguration.getBlock("engine.id", DefaultProps.ENGINE_ID);
// Update oil tag
int defaultOilId = DefaultProps.OIL_ID;
if (BuildCraftCore.mainConfiguration.hasKey(Configuration.CATEGORY_BLOCK, "oilStill.id")) {
defaultOilId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_BLOCK, "oilStill.id", defaultOilId).getInt(defaultOilId);
BuildCraftCore.mainConfiguration.getCategory(Configuration.CATEGORY_BLOCK).remove("oilStill.id");
}
int blockOilId = BuildCraftCore.mainConfiguration.getBlock("oil.id", defaultOilId).getInt(defaultOilId);
int blockFuelId = BuildCraftCore.mainConfiguration.getBlock("fuel.id", DefaultProps.FUEL_ID).getInt(DefaultProps.FUEL_ID);
int blockRedplasmaId = BuildCraftCore.mainConfiguration.getBlock("redPlasma.id", DefaultProps.REDPLASMA_ID).getInt(DefaultProps.REDPLASMA_ID);
int bucketOilId = BuildCraftCore.mainConfiguration.getItem("bucketOil.id", DefaultProps.BUCKET_OIL_ID).getInt(DefaultProps.BUCKET_OIL_ID);
int bucketFuelId = BuildCraftCore.mainConfiguration.getItem("bucketFuel.id", DefaultProps.BUCKET_FUEL_ID).getInt(DefaultProps.BUCKET_FUEL_ID);
int bucketRedPlasmaId = BuildCraftCore.mainConfiguration.getItem("bucketRedPlasma.id", DefaultProps.BUCKET_REDPLASMA_ID).getInt(DefaultProps.BUCKET_REDPLASMA_ID);
int oilDesertBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "oilDesert", DefaultProps.BIOME_OIL_DESERT).getInt(DefaultProps.BIOME_OIL_DESERT);
int oilOceanBiomeId = BuildCraftCore.mainConfiguration.get("biomes", "oilOcean", DefaultProps.BIOME_OIL_OCEAN).getInt(DefaultProps.BIOME_OIL_OCEAN);
canOilBurn = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "burnOil", true, "Can oil burn?").getBoolean(true);
@ -136,21 +122,21 @@ public class BuildCraftEnergy {
}
if (oilDesertBiomeId > 0) {
if (BiomeGenBase.biomeList[oilDesertBiomeId] != null) {
if (BiomeGenBase.getBiomeGenArray () [oilDesertBiomeId] != null) {
throw new BiomeIdException("oilDesert", oilDesertBiomeId);
}
biomeOilDesert = BiomeGenOilDesert.makeBiome(oilDesertBiomeId);
}
if (oilOceanBiomeId > 0) {
if (BiomeGenBase.biomeList[oilOceanBiomeId] != null) {
if (BiomeGenBase.getBiomeGenArray () [oilOceanBiomeId] != null) {
throw new BiomeIdException("oilOcean", oilOceanBiomeId);
}
biomeOilOcean = BiomeGenOilOcean.makeBiome(oilOceanBiomeId);
}
engineBlock = new BlockEngine(engineId.getInt(DefaultProps.ENGINE_ID));
engineBlock = new BlockEngine();
CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class);
LanguageRegistry.addName(new ItemStack(engineBlock, 1, 0), "Redstone Engine");
@ -171,18 +157,14 @@ public class BuildCraftEnergy {
FluidRegistry.registerFluid(buildcraftFluidRedPlasma);
fluidRedPlasma = FluidRegistry.getFluid("redplasma");
//buildcraftFluidRedPlasma = new BCFluid("fuel");
if (fluidOil.getBlockID() == -1) {
if (blockOilId > 0) {
blockOil = new BlockBuildcraftFluid(blockOilId, fluidOil, Material.water).setFlammable(canOilBurn).setFlammability(0);
blockOil.setUnlocalizedName("blockOil");
if (fluidOil.getBlock() == null) {
blockOil = new BlockBuildcraftFluid(fluidOil, Material.water).setFlammable(canOilBurn).setFlammability(0);
blockOil.setBlockName("blockOil");
CoreProxy.proxy.addName(blockOil, "Oil");
CoreProxy.proxy.registerBlock(blockOil);
fluidOil.setBlockID(blockOil);
}
fluidOil.setBlock(blockOil);
} else {
blockOil = Block.blocksList[fluidOil.getBlockID()];
blockOil = fluidOil.getBlock();
}
if (blockOil != null) {
@ -191,60 +173,57 @@ public class BuildCraftEnergy {
BlockSpring.EnumSpring.OIL.liquidBlock = blockOil;
}
if (fluidFuel.getBlockID() == -1) {
if (blockFuelId > 0) {
blockFuel = new BlockBuildcraftFluid(blockFuelId, fluidFuel, Material.water).setFlammable(true).setFlammability(5).setParticleColor(0.7F, 0.7F, 0.0F);
blockFuel.setUnlocalizedName("blockFuel");
if (fluidFuel.getBlock() == null) {
blockFuel = new BlockBuildcraftFluid(fluidFuel, Material.water).setFlammable(true).setFlammability(5).setParticleColor(0.7F, 0.7F, 0.0F);
blockFuel.setBlockName("blockFuel");
CoreProxy.proxy.addName(blockFuel, "Fuel");
CoreProxy.proxy.registerBlock(blockFuel);
fluidFuel.setBlockID(blockFuel);
}
fluidFuel.setBlock(blockFuel);
} else {
blockFuel = Block.blocksList[fluidFuel.getBlockID()];
blockFuel = fluidFuel.getBlock();
}
if (fluidRedPlasma.getBlockID() == -1) {
if (blockRedplasmaId > 0) {
blockRedPlasma = new BlockBuildcraftFluid(blockRedplasmaId, fluidRedPlasma, Material.water).setFlammable(false).setParticleColor(0.9F, 0, 0);
blockRedPlasma.setUnlocalizedName("blockRedPlasma");
if (fluidRedPlasma.getBlock() == null) {
blockRedPlasma = new BlockBuildcraftFluid(fluidRedPlasma, Material.water).setFlammable(false).setParticleColor(0.9F, 0, 0);
blockRedPlasma.setBlockName("blockRedPlasma");
CoreProxy.proxy.addName(blockRedPlasma, "Red Plasma");
CoreProxy.proxy.registerBlock(blockRedPlasma);
fluidRedPlasma.setBlockID(blockRedPlasma);
}
fluidRedPlasma.setBlock(blockRedPlasma);
} else {
blockRedPlasma = Block.blocksList[fluidRedPlasma.getBlockID()];
blockRedPlasma = fluidRedPlasma.getBlock();
}
// Buckets
if (blockOil != null && bucketOilId > 0) {
bucketOil = new ItemBucketBuildcraft(bucketOilId, blockOil.blockID);
bucketOil.setUnlocalizedName("bucketOil").setContainerItem(Item.bucketEmpty);
if (blockOil != null) {
bucketOil = new ItemBucketBuildcraft(blockOil);
bucketOil.setUnlocalizedName("bucketOil").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketOil, "Oil Bucket");
CoreProxy.proxy.registerItem(bucketOil);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("oil", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketOil), new ItemStack(Item.bucketEmpty));
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("oil", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketOil), new ItemStack(Items.bucket));
}
if (blockFuel != null && bucketFuelId > 0) {
bucketFuel = new ItemBucketBuildcraft(bucketFuelId, blockFuel.blockID);
bucketFuel.setUnlocalizedName("bucketFuel").setContainerItem(Item.bucketEmpty);
if (blockFuel != null) {
bucketFuel = new ItemBucketBuildcraft(blockFuel);
bucketFuel.setUnlocalizedName("bucketFuel").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketFuel, "Fuel Bucket");
CoreProxy.proxy.registerItem(bucketFuel);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fuel", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Item.bucketEmpty));
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("fuel", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketFuel), new ItemStack(Items.bucket));
}
if (blockRedPlasma != null && bucketRedPlasmaId > 0) {
bucketRedPlasma = new ItemBucketBuildcraft(bucketRedPlasmaId, blockRedPlasma.blockID);
bucketRedPlasma.setUnlocalizedName("bucketRedPlasma").setContainerItem(Item.bucketEmpty);
if (blockRedPlasma != null) {
bucketRedPlasma = new ItemBucketBuildcraft(blockRedPlasma);
bucketRedPlasma.setUnlocalizedName("bucketRedPlasma").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketRedPlasma, "Red Plasma Bucket");
CoreProxy.proxy.registerItem(bucketRedPlasma);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("redplasma", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketRedPlasma), new ItemStack(Item.bucketEmpty));
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("redplasma", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(bucketRedPlasma), new ItemStack(Items.bucket));
}
BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
BucketHandler.INSTANCE.buckets.put(blockRedPlasma, bucketRedPlasma);
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
// TODO: Are these still really necessary? If not, remove the
// BucketHandler class as well.
//BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
//BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel);
//MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
BuildcraftRecipes.refinery.addRecipe(new FluidStack(fluidOil, 1), new FluidStack(fluidFuel, 1), 12, 1);
@ -255,19 +234,17 @@ public class BuildCraftEnergy {
// Iron Engine Coolants
IronEngineCoolant.addCoolant(FluidRegistry.getFluid("water"), 0.0023F);
IronEngineCoolant.addCoolant(Block.ice.blockID, 0, FluidRegistry.getFluidStack("water", FluidContainerRegistry.BUCKET_VOLUME * 2));
IronEngineCoolant.addCoolant(Blocks.ice, 0, FluidRegistry.getFluidStack("water", FluidContainerRegistry.BUCKET_VOLUME * 2));
// Receiver / emitter
Property emitterId = BuildCraftCore.mainConfiguration.getBlock("energyEmitter.id", DefaultProps.EMITTER_ID);
emitterBlock = new BlockEnergyEmitter (emitterId.getInt());
CoreProxy.proxy.registerBlock(emitterBlock.setUnlocalizedName("energyEmitterBlock"));
emitterBlock = new BlockEnergyEmitter ();
CoreProxy.proxy.registerBlock(emitterBlock.setBlockName("energyEmitterBlock"));
CoreProxy.proxy.addName(emitterBlock, "Energy Emitter");
CoreProxy.proxy.registerTileEntity(TileEnergyEmitter.class, "net.minecraft.src.builders.TileEnergyEmitter");
Property receiverId = BuildCraftCore.mainConfiguration.getBlock("energyReceiver.id", DefaultProps.RECEIVER_ID);
receiverBlock = new BlockEnergyReceiver (receiverId.getInt());
CoreProxy.proxy.registerBlock(receiverBlock.setUnlocalizedName("energyReceiverBlock"));
receiverBlock = new BlockEnergyReceiver ();
CoreProxy.proxy.registerBlock(receiverBlock.setBlockName("energyReceiverBlock"));
CoreProxy.proxy.addName(receiverBlock, "Energy Receiver");
CoreProxy.proxy.registerTileEntity(TileEnergyReceiver.class, "net.minecraft.src.builders.TileEnergyReceiver");
@ -276,9 +253,12 @@ public class BuildCraftEnergy {
@EventHandler
public void init(FMLInitializationEvent evt) {
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new PacketHandlerTransport());
new BptBlockEngine(engineBlock.blockID);
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
//new BptBlockEngine(engineBlock.blockID);
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
@ -295,10 +275,10 @@ public class BuildCraftEnergy {
}
}
@ForgeSubscribe
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Post event) {
if (event.map.textureType == 0) {
if (event.map.getTextureType() == 0) {
buildcraftFluidOil.setIcons(blockOil.getBlockTextureFromSide(1), blockOil.getBlockTextureFromSide(2));
buildcraftFluidFuel.setIcons(blockFuel.getBlockTextureFromSide(1), blockFuel.getBlockTextureFromSide(2));
buildcraftFluidRedPlasma.setIcons(blockRedPlasma.getBlockTextureFromSide(1), blockRedPlasma.getBlockTextureFromSide(2));
@ -307,116 +287,16 @@ public class BuildCraftEnergy {
public static void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0),
new Object[]{"www", " g ", "GpG", 'w', "plankWood", 'g', Block.glass, 'G',
BuildCraftCore.woodenGearItem, 'p', Block.pistonBase});
new Object[]{"www", " g ", "GpG", 'w', "plankWood", 'g', Blocks.glass, 'G',
BuildCraftCore.woodenGearItem, 'p', Blocks.piston});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), new Object[]{"www", " g ", "GpG", 'w', "cobblestone",
'g', Block.glass, 'G', BuildCraftCore.stoneGearItem, 'p', Block.pistonBase});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), new Object[]{"www", " g ", "GpG", 'w', Item.ingotIron,
'g', Block.glass, 'G', BuildCraftCore.ironGearItem, 'p', Block.pistonBase});
'g', Blocks.glass, 'G', BuildCraftCore.stoneGearItem, 'p', Blocks.piston});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), new Object[]{"www", " g ", "GpG", 'w', Items.iron_ingot,
'g', Blocks.glass, 'G', BuildCraftCore.ironGearItem, 'p', Blocks.piston});
}
@EventHandler
public void processIMCRequests(FMLInterModComms.IMCEvent event) {
InterModComms.processIMC(event);
}
// public static int createPollution (World world, int i, int j, int k, int
// saturation) {
// int remainingSaturation = saturation;
//
// if (world.rand.nextFloat() > 0.7) {
// // Try to place an item on the sides
//
// LinkedList<BlockIndex> orientations = new LinkedList<BlockIndex>();
//
// for (int id = -1; id <= 1; id += 2) {
// for (int kd = -1; kd <= 1; kd += 2) {
// if (canPollute(world, i + id, j, k + kd)) {
// orientations.add(new BlockIndex(i + id, j, k + kd));
// }
// }
// }
//
// if (orientations.size() > 0) {
// BlockIndex toPollute =
// orientations.get(world.rand.nextInt(orientations.size()));
//
// int x = toPollute.i;
// int y = toPollute.j;
// int z = toPollute.k;
//
// if (world.getBlockId(x, y, z) == 0) {
// world.setBlock(x, y, z,
// BuildCraftEnergy.pollution.blockID,
// saturation * 16 / 100);
//
// saturationStored.put(new BlockIndex(x, y, z), new Integer(
// saturation));
// remainingSaturation = 0;
// } else if (world.getBlockTileEntity(z, y, z) instanceof TilePollution) {
// remainingSaturation = updateExitingPollution(world, x, y, z, saturation);
// }
// }
// }
//
// if (remainingSaturation > 0) {
// if (world.getBlockId(i, j + 1, k) == 0) {
// if (j + 1 < 128) {
// world.setBlock(i, j + 1, k,
// BuildCraftEnergy.pollution.blockID,
// saturation * 16 / 100);
// saturationStored.put(new BlockIndex(i, j + 1, k),
// new Integer(remainingSaturation));
// }
//
// remainingSaturation = 0;
// } else if (world.getBlockTileEntity(i, j + 1, k) instanceof
// TilePollution) {
// remainingSaturation = updateExitingPollution(world, i, j + 1,
// k, remainingSaturation);
// }
// }
//
// if (remainingSaturation == 0) {
// System.out.println ("EXIT 1");
// return 0;
// } else if (remainingSaturation == saturation) {
// System.out.println ("EXIT 2");
// return saturation;
// } else {
// System.out.println ("EXIT 3");
// return createPollution (world, i, j, k, remainingSaturation);
// }
// }
//
// private static int updateExitingPollution (World world, int i, int j, int
// k, int saturation) {
// int remainingSaturation = saturation;
//
// TilePollution tile = (TilePollution) world.getBlockTileEntity(
// i, j, k);
//
// if (tile.saturation + saturation <= 100) {
// remainingSaturation = 0;
// tile.saturation += saturation;
// } else {
// remainingSaturation = (tile.saturation + saturation) - 100;
// tile.saturation += saturation - remainingSaturation;
// }
//
// world.setBlockMetadata(i, j, k, saturation * 16 / 100);
// world.markBlockNeedsUpdate(i, j, k);
//
// return remainingSaturation;
// }
//
// private static boolean canPollute (World world, int i, int j, int k) {
// if (world.getBlockId(i, j, k) == 0) {
// return true;
// } else {
// TileEntity tile = world.getBlockTileEntity(i, j, k);
//
// return (tile instanceof TilePollution && ((TilePollution)
// tile).saturation < 100);
// }
// }
}

View file

@ -11,6 +11,7 @@ package buildcraft;
import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.ConfigUtils;
import buildcraft.factory.BlockAutoWorkbench;
@ -40,7 +41,9 @@ import buildcraft.factory.TileQuarry;
import buildcraft.factory.TileRefinery;
import buildcraft.factory.TileTank;
import buildcraft.factory.network.PacketHandlerFactory;
import com.google.common.collect.Lists;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@ -48,27 +51,29 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
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.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.Property;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.common.config.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)
public class BuildCraftFactory {
public class BuildCraftFactory extends BuildCraftMod {
public static final int MINING_MJ_COST_PER_BLOCK = 64;
public static BlockQuarry quarryBlock;
@ -103,7 +108,7 @@ public class BuildCraftFactory {
int quarryX = ticket.getModData().getInteger("quarryX");
int quarryY = ticket.getModData().getInteger("quarryY");
int quarryZ = ticket.getModData().getInteger("quarryZ");
TileQuarry tq = (TileQuarry) world.getBlockTileEntity(quarryX, quarryY, quarryZ);
TileQuarry tq = (TileQuarry) world.getTileEntity(quarryX, quarryY, quarryZ);
tq.forceChunkLoading(ticket);
}
@ -117,8 +122,8 @@ public class BuildCraftFactory {
int quarryY = ticket.getModData().getInteger("quarryY");
int quarryZ = ticket.getModData().getInteger("quarryZ");
int blId = world.getBlockId(quarryX, quarryY, quarryZ);
if (blId == quarryBlock.blockID) {
Block block = world.getBlock(quarryX, quarryY, quarryZ);
if (block == quarryBlock) {
validTickets.add(ticket);
}
}
@ -128,7 +133,7 @@ public class BuildCraftFactory {
@EventHandler
public void load(FMLInitializationEvent evt) {
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, instance, 50, 1, true);
@ -143,10 +148,10 @@ public class BuildCraftFactory {
FactoryProxy.proxy.initializeTileEntities();
new BptBlockAutoWorkbench(autoWorkbenchBlock.blockID);
new BptBlockFrame(frameBlock.blockID);
new BptBlockRefinery(refineryBlock.blockID);
new BptBlockTank(tankBlock.blockID);
//new BptBlockAutoWorkbench(autoWorkbenchBlock.blockID);
//new BptBlockFrame(frameBlock.blockID);
//new BptBlockRefinery(refineryBlock.blockID);
//new BptBlockTank(tankBlock.blockID);
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
@ -155,6 +160,9 @@ public class BuildCraftFactory {
@EventHandler
public void initialize(FMLPreInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new PacketHandlerFactory());
ConfigUtils genCat = new ConfigUtils(BuildCraftCore.mainConfiguration, Configuration.CATEGORY_GENERAL);
allowMining = genCat.get("mining.enabled", true, "disables the recipes for automated mining machines");
@ -169,71 +177,51 @@ public class BuildCraftFactory {
+ "Default is \"+/*/*,+/-1/Lava\" - the second redundant entry (\"+/-1/lava\") is there to show the format.";
pumpDimensionList = new PumpDimensionList(pumpList.getString());
int miningWellId = BuildCraftCore.mainConfiguration.getBlock("miningWell.id", DefaultProps.MINING_WELL_ID).getInt(DefaultProps.MINING_WELL_ID);
int plainPipeId = BuildCraftCore.mainConfiguration.getBlock("drill.id", DefaultProps.DRILL_ID).getInt(DefaultProps.DRILL_ID);
int autoWorkbenchId = BuildCraftCore.mainConfiguration.getBlock("autoWorkbench.id", DefaultProps.AUTO_WORKBENCH_ID).getInt(DefaultProps.AUTO_WORKBENCH_ID);
int frameId = BuildCraftCore.mainConfiguration.getBlock("frame.id", DefaultProps.FRAME_ID).getInt(DefaultProps.FRAME_ID);
int quarryId = BuildCraftCore.mainConfiguration.getBlock("quarry.id", DefaultProps.QUARRY_ID).getInt(DefaultProps.QUARRY_ID);
int pumpId = BuildCraftCore.mainConfiguration.getBlock("pump.id", DefaultProps.PUMP_ID).getInt(DefaultProps.PUMP_ID);
int floodGateId = BuildCraftCore.mainConfiguration.getBlock("floodGate.id", DefaultProps.FLOOD_GATE_ID).getInt(DefaultProps.FLOOD_GATE_ID);
int tankId = BuildCraftCore.mainConfiguration.getBlock("tank.id", DefaultProps.TANK_ID).getInt(DefaultProps.TANK_ID);
int refineryId = BuildCraftCore.mainConfiguration.getBlock("refinery.id", DefaultProps.REFINERY_ID).getInt(DefaultProps.REFINERY_ID);
int hopperId = BuildCraftCore.mainConfiguration.getBlock("hopper.id", DefaultProps.HOPPER_ID).getInt(DefaultProps.HOPPER_ID);
if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save();
}
if (miningWellId > 0) {
miningWellBlock = new BlockMiningWell(miningWellId);
CoreProxy.proxy.registerBlock(miningWellBlock.setUnlocalizedName("miningWellBlock"));
miningWellBlock = new BlockMiningWell();
CoreProxy.proxy.registerBlock(miningWellBlock.setBlockName("miningWellBlock"));
CoreProxy.proxy.addName(miningWellBlock, "Mining Well");
}
if (plainPipeId > 0) {
plainPipeBlock = new BlockPlainPipe(plainPipeId);
CoreProxy.proxy.registerBlock(plainPipeBlock.setUnlocalizedName("plainPipeBlock"));
plainPipeBlock = new BlockPlainPipe();
CoreProxy.proxy.registerBlock(plainPipeBlock.setBlockName("plainPipeBlock"));
CoreProxy.proxy.addName(plainPipeBlock, "Mining Pipe");
}
if (autoWorkbenchId > 0) {
autoWorkbenchBlock = new BlockAutoWorkbench(autoWorkbenchId);
CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setUnlocalizedName("autoWorkbenchBlock"));
autoWorkbenchBlock = new BlockAutoWorkbench();
CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setBlockName("autoWorkbenchBlock"));
CoreProxy.proxy.addName(autoWorkbenchBlock, "Automatic Crafting Table");
}
if (frameId > 0) {
frameBlock = new BlockFrame(frameId);
CoreProxy.proxy.registerBlock(frameBlock.setUnlocalizedName("frameBlock"));
frameBlock = new BlockFrame();
CoreProxy.proxy.registerBlock(frameBlock.setBlockName("frameBlock"));
CoreProxy.proxy.addName(frameBlock, "Frame");
}
if (quarryId > 0) {
quarryBlock = new BlockQuarry(quarryId);
CoreProxy.proxy.registerBlock(quarryBlock.setUnlocalizedName("machineBlock"));
quarryBlock = new BlockQuarry();
CoreProxy.proxy.registerBlock(quarryBlock.setBlockName("machineBlock"));
CoreProxy.proxy.addName(quarryBlock, "Quarry");
}
if (tankId > 0) {
tankBlock = new BlockTank(tankId);
CoreProxy.proxy.registerBlock(tankBlock.setUnlocalizedName("tankBlock"));
tankBlock = new BlockTank();
CoreProxy.proxy.registerBlock(tankBlock.setBlockName("tankBlock"));
CoreProxy.proxy.addName(tankBlock, "Tank");
}
if (pumpId > 0) {
pumpBlock = new BlockPump(pumpId);
CoreProxy.proxy.registerBlock(pumpBlock.setUnlocalizedName("pumpBlock"));
pumpBlock = new BlockPump();
CoreProxy.proxy.registerBlock(pumpBlock.setBlockName("pumpBlock"));
CoreProxy.proxy.addName(pumpBlock, "Pump");
}
if (floodGateId > 0) {
floodGateBlock = new BlockFloodGate(floodGateId);
CoreProxy.proxy.registerBlock(floodGateBlock.setUnlocalizedName("floodGateBlock"));
floodGateBlock = new BlockFloodGate();
CoreProxy.proxy.registerBlock(floodGateBlock.setBlockName("floodGateBlock"));
CoreProxy.proxy.addName(floodGateBlock, "Flood Gate");
}
if (refineryId > 0) {
refineryBlock = new BlockRefinery(refineryId);
CoreProxy.proxy.registerBlock(refineryBlock.setUnlocalizedName("refineryBlock"));
refineryBlock = new BlockRefinery();
CoreProxy.proxy.registerBlock(refineryBlock.setBlockName("refineryBlock"));
CoreProxy.proxy.addName(refineryBlock, "Refinery");
}
if (hopperId > 0) {
hopperBlock = new BlockHopper(hopperId);
CoreProxy.proxy.registerBlock(hopperBlock.setUnlocalizedName("blockHopper"));
hopperBlock = new BlockHopper();
CoreProxy.proxy.registerBlock(hopperBlock.setBlockName("blockHopper"));
CoreProxy.proxy.addName(hopperBlock, "Hopper");
}
FactoryProxy.proxy.initializeEntityRenders();
if (BuildCraftCore.mainConfiguration.hasChanged()) {
@ -251,10 +239,10 @@ public class BuildCraftFactory {
"ipi",
"igi",
"iPi",
'p', Item.redstone,
'i', Item.ingotIron,
'p', Items.redstone,
'i', Items.iron_ingot,
'g', BuildCraftCore.ironGearItem,
'P', Item.pickaxeIron);
'P', Items.iron_pickaxe);
if (quarryBlock != null)
CoreProxy.proxy.addCraftingRecipe(
@ -263,16 +251,16 @@ public class BuildCraftFactory {
"gig",
"dDd",
'i', BuildCraftCore.ironGearItem,
'p', Item.redstone,
'p', Items.redstone,
'g', BuildCraftCore.goldGearItem,
'd', BuildCraftCore.diamondGearItem,
'D', Item.pickaxeDiamond);
'D', Items.diamond_pickaxe);
if (pumpBlock != null && miningWellBlock != null)
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock),
"T",
"W",
'T', tankBlock != null ? tankBlock : Block.glass,
'T', tankBlock != null ? tankBlock : Blocks.glass,
'W', miningWellBlock);
}
@ -282,9 +270,9 @@ public class BuildCraftFactory {
"iri",
"iTi",
"gpg",
'r', Item.redstone,
'i', Item.ingotIron,
'T', tankBlock != null ? tankBlock : Block.glass,
'r', Items.redstone,
'i', Items.iron_ingot,
'T', tankBlock != null ? tankBlock : Blocks.glass,
'g', BuildCraftCore.ironGearItem,
'p', BuildCraftTransport.pipeFluidsGold);
}
@ -294,7 +282,7 @@ public class BuildCraftFactory {
" g ",
"gwg",
" g ",
'w', Block.workbench,
'w', Blocks.crafting_table,
'g', BuildCraftCore.woodenGearItem);
@ -303,23 +291,23 @@ public class BuildCraftFactory {
"ggg",
"g g",
"ggg",
'g', Block.glass);
'g', Blocks.glass);
if (refineryBlock != null)
CoreProxy.proxy.addCraftingRecipe(new ItemStack(refineryBlock),
"RTR",
"TGT",
'T', tankBlock != null ? tankBlock : Block.glass,
'T', tankBlock != null ? tankBlock : Blocks.glass,
'G', BuildCraftCore.diamondGearItem,
'R', Block.torchRedstoneActive);
'R', Blocks.redstone_torch);
if (hopperBlock != null)
CoreProxy.proxy.addCraftingRecipe(new ItemStack(hopperBlock),
"ICI",
"IGI",
" I ",
'I', Item.ingotIron,
'C', Block.chest,
'I', Items.iron_ingot,
'C', Blocks.chest,
'G', BuildCraftCore.stoneGearItem);
if (floodGateBlock != null)
@ -327,10 +315,10 @@ public class BuildCraftFactory {
"IGI",
"FTF",
"IFI",
'I', Item.ingotIron,
'T', tankBlock != null ? tankBlock : Block.glass,
'I', Items.iron_ingot,
'T', tankBlock != null ? tankBlock : Blocks.glass,
'G', BuildCraftCore.ironGearItem,
'F', new ItemStack(Block.fenceIron));
'F', new ItemStack(Blocks.iron_bars));
}
@EventHandler
@ -338,10 +326,10 @@ public class BuildCraftFactory {
InterModComms.processIMC(event);
}
@ForgeSubscribe
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre evt) {
if (evt.map.textureType == 0) {
if (evt.map.getTextureType() == 0) {
TextureMap terrainTextures = evt.map;
FactoryProxyClient.pumpTexture = terrainTextures.registerIcon("buildcraft:pump_tube");
FactoryProxyClient.drillTexture = terrainTextures.registerIcon("buildcraft:blockDrillTexture");

View file

@ -0,0 +1,46 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft;
import java.util.EnumMap;
import cpw.mods.fml.common.network.FMLEmbeddedChannel;
import cpw.mods.fml.common.network.FMLOutboundHandler;
import cpw.mods.fml.common.network.FMLOutboundHandler.OutboundTarget;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
import buildcraft.core.network.BuildCraftPacket;
public class BuildCraftMod {
public EnumMap<Side, FMLEmbeddedChannel> channels;
public void sendToPlayers(Packet packet, World world, int x, int y, int z, int maxDistance) {
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
channels.get(Side.SERVER).writeOutbound(packet);
}
public void sendToPlayers(BuildCraftPacket packet, World world, int x, int y, int z, int maxDistance) {
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.ALL);
channels.get(Side.SERVER).writeOutbound(packet);
}
public void sendToPlayer(EntityPlayer entityplayer, BuildCraftPacket packet) {
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.PLAYER);
channels.get(Side.SERVER).attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).set(entityplayer);
channels.get(Side.SERVER).writeOutbound(packet);
}
public void sendToServer(BuildCraftPacket packet) {
channels.get(Side.CLIENT).attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.TOSERVER);
channels.get(Side.CLIENT).writeOutbound(packet);
}
}

View file

@ -17,6 +17,7 @@ import buildcraft.core.InterModComms;
import buildcraft.silicon.ItemRedstoneChipset;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.BlockLaserTable;
@ -42,20 +43,22 @@ import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
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.LanguageRegistry;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Property;
import net.minecraftforge.common.config.Property;
@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 class BuildCraftSilicon extends BuildCraftMod {
public static ItemRedstoneChipset redstoneChipset;
public static BlockLaser laserBlock;
@ -65,26 +68,20 @@ public class BuildCraftSilicon {
@EventHandler
public void preInit(FMLPreInitializationEvent evt) {
Property laserId = BuildCraftCore.mainConfiguration.getBlock("laser.id", DefaultProps.LASER_ID);
Property assemblyTableId = BuildCraftCore.mainConfiguration.getBlock("assemblyTable.id", DefaultProps.ASSEMBLY_TABLE_ID);
Property redstoneChipsetId = BuildCraftCore.mainConfiguration.getItem("redstoneChipset.id", DefaultProps.REDSTONE_CHIPSET);
BuildCraftCore.mainConfiguration.save();
laserBlock = new BlockLaser(laserId.getInt());
CoreProxy.proxy.addName(laserBlock.setUnlocalizedName("laserBlock"), "Laser");
laserBlock = new BlockLaser();
CoreProxy.proxy.addName(laserBlock.setBlockName("laserBlock"), "Laser");
CoreProxy.proxy.registerBlock(laserBlock);
assemblyTableBlock = new BlockLaserTable(assemblyTableId.getInt());
assemblyTableBlock = new BlockLaserTable();
CoreProxy.proxy.registerBlock(assemblyTableBlock, ItemLaserTable.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, 2), "Integration Table");
redstoneChipset = new ItemRedstoneChipset(redstoneChipsetId.getInt());
redstoneChipset = new ItemRedstoneChipset();
redstoneChipset.setUnlocalizedName("redstoneChipset");
CoreProxy.proxy.registerItem(redstoneChipset);
redstoneChipset.registerItemStacks();
@ -92,14 +89,17 @@ public class BuildCraftSilicon {
@EventHandler
public void init(FMLInitializationEvent evt) {
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new PacketHandlerSilicon());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
CoreProxy.proxy.registerTileEntity(TileLaser.class, "net.minecraft.src.buildcraft.factory.TileLaser");
CoreProxy.proxy.registerTileEntity(TileAssemblyTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyTable");
CoreProxy.proxy.registerTileEntity(TileAdvancedCraftingTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench");
CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class, "net.minecraft.src.buildcraft.factory.TileIntegrationTable");
new BptBlockRotateMeta(laserBlock.blockID, new int[]{2, 5, 3, 4}, true);
new BptBlockInventory(assemblyTableBlock.blockID);
//new BptBlockRotateMeta(laserBlock.blockID, new int[]{2, 5, 3, 4}, true);
//new BptBlockInventory(assemblyTableBlock.blockID);
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
@ -115,51 +115,51 @@ public class BuildCraftSilicon {
"ORR",
"DDR",
"ORR",
'O', Block.obsidian,
'R', Item.redstone,
'D', Item.diamond);
'O', Blocks.obsidian,
'R', Items.redstone,
'D', Items.diamond);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0),
"ORO",
"ODO",
"OGO",
'O', Block.obsidian,
'R', Item.redstone,
'D', Item.diamond,
'O', Blocks.obsidian,
'R', Items.redstone,
'D', Items.diamond,
'G', BuildCraftCore.diamondGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1),
"OWO",
"OCO",
"ORO",
'O', Block.obsidian,
'W', Block.workbench,
'C', Block.chest,
'O', Blocks.obsidian,
'W', Blocks.crafting_table,
'C', Blocks.chest,
'R', new ItemStack(redstoneChipset, 1, 0));
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 2),
"ORO",
"OCO",
"OGO",
'O', Block.obsidian,
'R', Item.redstone,
'O', Blocks.obsidian,
'R', Items.redstone,
'C', new ItemStack(redstoneChipset, 1, 0),
'G', BuildCraftCore.diamondGearItem);
// PIPE WIRE
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.RED.getStack(8), "dyeRed", 1, Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.BLUE.getStack(8), "dyeBlue", 1, Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.GREEN.getStack(8), "dyeGreen", 1, Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.YELLOW.getStack(8), "dyeYellow", 1, Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.RED.getStack(8), "dyeRed", 1, Items.redstone, Items.iron_ingot);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.BLUE.getStack(8), "dyeBlue", 1, Items.redstone, Items.iron_ingot);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.GREEN.getStack(8), "dyeGreen", 1, Items.redstone, Items.iron_ingot);
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.YELLOW.getStack(8), "dyeYellow", 1, Items.redstone, Items.iron_ingot);
// CHIPSETS
BuildcraftRecipes.assemblyTable.addRecipe(10000, Chipset.RED.getStack(), Item.redstone);
BuildcraftRecipes.assemblyTable.addRecipe(20000, Chipset.IRON.getStack(), Item.redstone, Item.ingotIron);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.GOLD.getStack(), Item.redstone, Item.ingotGold);
BuildcraftRecipes.assemblyTable.addRecipe(80000, Chipset.DIAMOND.getStack(), Item.redstone, Item.diamond);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.PULSATING.getStack(2), Item.redstone, Item.enderPearl);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.QUARTZ.getStack(), Item.redstone, Item.netherQuartz);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.COMP.getStack(), Item.redstone, Item.comparator);
BuildcraftRecipes.assemblyTable.addRecipe(10000, Chipset.RED.getStack(), Items.redstone);
BuildcraftRecipes.assemblyTable.addRecipe(20000, Chipset.IRON.getStack(), Items.redstone, Items.iron_ingot);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.GOLD.getStack(), Items.redstone, Items.gold_ingot);
BuildcraftRecipes.assemblyTable.addRecipe(80000, Chipset.DIAMOND.getStack(), Items.redstone, Items.diamond);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.PULSATING.getStack(2), Items.redstone, Items.ender_pearl);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.QUARTZ.getStack(), Items.redstone, Items.quartz);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.COMP.getStack(), Items.redstone, Items.comparator);
// GATES
BuildcraftRecipes.assemblyTable.addRecipe(10000, ItemGate.makeGateItem(GateMaterial.REDSTONE, GateLogic.AND), Chipset.RED.getStack(), PipeWire.RED.getStack());

View file

@ -17,6 +17,7 @@ import buildcraft.core.DefaultProps;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCAction;
import buildcraft.core.triggers.BCTrigger;
@ -46,7 +47,7 @@ import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.network.PacketHandlerTransport;
import buildcraft.transport.network.TransportConnectionHandler;
import buildcraft.transport.network.PacketPipeTransportTraveler;
import buildcraft.transport.pipes.PipeFluidsCobblestone;
import buildcraft.transport.pipes.PipeFluidsEmerald;
import buildcraft.transport.pipes.PipeFluidsGold;
@ -100,7 +101,6 @@ import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
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;
@ -108,17 +108,18 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.Property;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.config.Property;
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE)
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerTransport.class, connectionHandler = TransportConnectionHandler.class)
public class BuildCraftTransport {
public class BuildCraftTransport extends BuildCraftMod {
public static BlockGenericPipe genericPipeBlock;
public static float pipeDurability;
@ -211,21 +212,23 @@ public class BuildCraftTransport {
}
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];
Block block = world.getBlock(i, j, k);
if (block == null)
return false;
int meta = world.getBlockMetadata(i, j, k);
for (String excluded : excludedBlocks) {
// TODO: the exculded list is not taken into account. This probably
// needs to be migrated to an implementation based on names instead
// of ids, low priority for now.
/*for (String excluded : excludedBlocks) {
if (excluded.equals(block.getUnlocalizedName()))
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;
}
}
@ -238,7 +241,7 @@ public class BuildCraftTransport {
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", new String[0]);
Property exclusionItemList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "woodenPipe.item.exclusion", new String[0]);
String[] excludedItemBlocks = exclusionItemList.getStringList();
if (excludedItemBlocks != null) {
@ -248,7 +251,7 @@ public class BuildCraftTransport {
} else
excludedItemBlocks = new String[0];
Property exclusionFluidList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_BLOCK, "woodenPipe.liquid.exclusion", new String[0]);
Property exclusionFluidList = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_GENERAL, "woodenPipe.liquid.exclusion", new String[0]);
String[] excludedFluidBlocks = exclusionFluidList.getStringList();
if (excludedFluidBlocks != null) {
@ -268,33 +271,28 @@ public class BuildCraftTransport {
groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
groupItemsTrigger = groupItemsTriggerProp.getInt();
Property genericPipeId = BuildCraftCore.mainConfiguration.getBlock("pipe.id", DefaultProps.GENERIC_PIPE_ID);
Property pipeWaterproofId = BuildCraftCore.mainConfiguration.getItem("pipeWaterproof.id", DefaultProps.PIPE_WATERPROOF_ID);
pipeWaterproof = new ItemBuildCraft(pipeWaterproofId.getInt());
pipeWaterproof = new ItemBuildCraft();
pipeWaterproof.setUnlocalizedName("pipeWaterproof");
LanguageRegistry.addName(pipeWaterproof, "Pipe Sealant");
CoreProxy.proxy.registerItem(pipeWaterproof);
genericPipeBlock = new BlockGenericPipe(genericPipeId.getInt());
CoreProxy.proxy.registerBlock(genericPipeBlock.setUnlocalizedName("pipeBlock"), ItemBlock.class);
genericPipeBlock = new BlockGenericPipe();
CoreProxy.proxy.registerBlock(genericPipeBlock.setBlockName("pipeBlock"), ItemBlock.class);
pipeItemsWood = buildPipe(DefaultProps.PIPE_ITEMS_WOOD_ID, PipeItemsWood.class, "Wooden Transport Pipe", "plankWood", Block.glass, "plankWood");
pipeItemsEmerald = buildPipe(DefaultProps.PIPE_ITEMS_EMERALD_ID, PipeItemsEmerald.class, "Emerald Transport Pipe", Item.emerald, Block.glass, Item.emerald);
pipeItemsCobblestone = buildPipe(DefaultProps.PIPE_ITEMS_COBBLESTONE_ID, PipeItemsCobblestone.class, "Cobblestone Transport Pipe", "cobblestone", Block.glass, "cobblestone");
pipeItemsStone = buildPipe(DefaultProps.PIPE_ITEMS_STONE_ID, PipeItemsStone.class, "Stone Transport Pipe", "stone", Block.glass, "stone");
pipeItemsQuartz = buildPipe(DefaultProps.PIPE_ITEMS_QUARTZ_ID, PipeItemsQuartz.class, "Quartz Transport Pipe", Block.blockNetherQuartz, Block.glass, Block.blockNetherQuartz);
pipeItemsIron = buildPipe(DefaultProps.PIPE_ITEMS_IRON_ID, PipeItemsIron.class, "Iron Transport Pipe", Item.ingotIron, Block.glass, Item.ingotIron);
pipeItemsGold = buildPipe(DefaultProps.PIPE_ITEMS_GOLD_ID, PipeItemsGold.class, "Golden Transport Pipe", Item.ingotGold, Block.glass, Item.ingotGold);
pipeItemsDiamond = buildPipe(DefaultProps.PIPE_ITEMS_DIAMOND_ID, PipeItemsDiamond.class, "Diamond Transport Pipe", Item.diamond, Block.glass, Item.diamond);
pipeItemsObsidian = buildPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Block.obsidian, Block.glass, Block.obsidian);
pipeItemsLapis = buildPipe(DefaultProps.PIPE_ITEMS_LAPIS_ID, PipeItemsLapis.class, "Lapis Transport Pipe", Block.blockLapis, Block.glass, Block.blockLapis);
pipeItemsDaizuli = buildPipe(DefaultProps.PIPE_ITEMS_DAIZULI_ID, PipeItemsDaizuli.class, "Daizuli Transport Pipe", Block.blockLapis, Block.glass, Item.diamond);
pipeItemsSandstone = buildPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe", Block.sandStone, Block.glass, Block.sandStone);
pipeItemsVoid = buildPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe", "dyeBlack", Block.glass, Item.redstone);
pipeItemsEmzuli = buildPipe(DefaultProps.PIPE_ITEMS_EMZULI_ID, PipeItemsEmzuli.class, "Emzuli Transport Pipe", Block.blockLapis, Block.glass, Item.emerald);
pipeItemsWood = buildPipe(DefaultProps.PIPE_ITEMS_WOOD_ID, PipeItemsWood.class, "Wooden Transport Pipe", "plankWood", Blocks.glass, "plankWood");
pipeItemsEmerald = buildPipe(DefaultProps.PIPE_ITEMS_EMERALD_ID, PipeItemsEmerald.class, "Emerald Transport Pipe", Items.emerald, Blocks.glass, Items.emerald);
pipeItemsCobblestone = buildPipe(DefaultProps.PIPE_ITEMS_COBBLESTONE_ID, PipeItemsCobblestone.class, "Cobblestone Transport Pipe", "cobblestone", Blocks.glass, "cobblestone");
pipeItemsStone = buildPipe(DefaultProps.PIPE_ITEMS_STONE_ID, PipeItemsStone.class, "Stone Transport Pipe", "stone", Blocks.glass, "stone");
pipeItemsQuartz = buildPipe(DefaultProps.PIPE_ITEMS_QUARTZ_ID, PipeItemsQuartz.class, "Quartz Transport Pipe", Blocks.quartz_block, Blocks.glass, Blocks.quartz_block);
pipeItemsIron = buildPipe(DefaultProps.PIPE_ITEMS_IRON_ID, PipeItemsIron.class, "Iron Transport Pipe", Items.iron_ingot, Blocks.glass, Items.iron_ingot);
pipeItemsGold = buildPipe(DefaultProps.PIPE_ITEMS_GOLD_ID, PipeItemsGold.class, "Golden Transport Pipe", Items.gold_ingot, Blocks.glass, Items.gold_ingot);
pipeItemsDiamond = buildPipe(DefaultProps.PIPE_ITEMS_DIAMOND_ID, PipeItemsDiamond.class, "Diamond Transport Pipe", Items.diamond, Blocks.glass, Items.diamond);
pipeItemsObsidian = buildPipe(DefaultProps.PIPE_ITEMS_OBSIDIAN_ID, PipeItemsObsidian.class, "Obsidian Transport Pipe", Blocks.obsidian, Blocks.glass, Blocks.obsidian);
pipeItemsLapis = buildPipe(DefaultProps.PIPE_ITEMS_LAPIS_ID, PipeItemsLapis.class, "Lapis Transport Pipe", Blocks.lapis_block, Blocks.glass, Blocks.lapis_block);
pipeItemsDaizuli = buildPipe(DefaultProps.PIPE_ITEMS_DAIZULI_ID, PipeItemsDaizuli.class, "Daizuli Transport Pipe", Blocks.lapis_block, Blocks.glass, Items.diamond);
pipeItemsSandstone = buildPipe(DefaultProps.PIPE_ITEMS_SANDSTONE_ID, PipeItemsSandstone.class, "Sandstone Transport Pipe", Blocks.sandstone, Blocks.glass, Blocks.sandstone);
pipeItemsVoid = buildPipe(DefaultProps.PIPE_ITEMS_VOID_ID, PipeItemsVoid.class, "Void Transport Pipe", "dyeBlack", Blocks.glass, Items.redstone);
pipeItemsEmzuli = buildPipe(DefaultProps.PIPE_ITEMS_EMZULI_ID, PipeItemsEmzuli.class, "Emzuli Transport Pipe", Blocks.lapis_block, Blocks.glass, Items.emerald);
pipeFluidsWood = buildPipe(DefaultProps.PIPE_LIQUIDS_WOOD_ID, PipeFluidsWood.class, "Wooden Waterproof Pipe", pipeWaterproof, pipeItemsWood);
pipeFluidsCobblestone = buildPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeFluidsCobblestone.class, "Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone);
@ -305,97 +303,46 @@ public class BuildCraftTransport {
pipeFluidsSandstone = buildPipe(DefaultProps.PIPE_LIQUIDS_SANDSTONE_ID, PipeFluidsSandstone.class, "Sandstone Waterproof Pipe", pipeWaterproof, pipeItemsSandstone);
pipeFluidsVoid = buildPipe(DefaultProps.PIPE_LIQUIDS_VOID_ID, PipeFluidsVoid.class, "Void Waterproof Pipe", pipeWaterproof, pipeItemsVoid);
pipePowerWood = buildPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Kinesis Pipe", Item.redstone, pipeItemsWood);
pipePowerCobblestone = buildPipe(DefaultProps.PIPE_POWER_COBBLESTONE_ID, PipePowerCobblestone.class, "Cobblestone Kinesis Pipe", Item.redstone, pipeItemsCobblestone);
pipePowerStone = buildPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Kinesis Pipe", Item.redstone, pipeItemsStone);
pipePowerQuartz = buildPipe(DefaultProps.PIPE_POWER_QUARTZ_ID, PipePowerQuartz.class, "Quartz Kinesis Pipe", Item.redstone, pipeItemsQuartz);
pipePowerIron = buildPipe(DefaultProps.PIPE_POWER_IRON_ID, PipePowerIron.class, "Iron Kinesis Pipe", Item.redstone, pipeItemsIron);
pipePowerGold = buildPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Kinesis Pipe", Item.redstone, pipeItemsGold);
pipePowerDiamond = buildPipe(DefaultProps.PIPE_POWER_DIAMOND_ID, PipePowerDiamond.class, "Diamond Kinesis Pipe", Item.redstone, pipeItemsDiamond);
pipePowerHeat = buildPipe(DefaultProps.PIPE_POWER_HEAT_ID, PipePowerHeat.class, "Heat Kinesis Pipe", Block.furnaceIdle, pipeItemsDiamond);
pipePowerWood = buildPipe(DefaultProps.PIPE_POWER_WOOD_ID, PipePowerWood.class, "Wooden Kinesis Pipe", Items.redstone, pipeItemsWood);
pipePowerCobblestone = buildPipe(DefaultProps.PIPE_POWER_COBBLESTONE_ID, PipePowerCobblestone.class, "Cobblestone Kinesis Pipe", Items.redstone, pipeItemsCobblestone);
pipePowerStone = buildPipe(DefaultProps.PIPE_POWER_STONE_ID, PipePowerStone.class, "Stone Kinesis Pipe", Items.redstone, pipeItemsStone);
pipePowerQuartz = buildPipe(DefaultProps.PIPE_POWER_QUARTZ_ID, PipePowerQuartz.class, "Quartz Kinesis Pipe", Items.redstone, pipeItemsQuartz);
pipePowerIron = buildPipe(DefaultProps.PIPE_POWER_IRON_ID, PipePowerIron.class, "Iron Kinesis Pipe", Items.redstone, pipeItemsIron);
pipePowerGold = buildPipe(DefaultProps.PIPE_POWER_GOLD_ID, PipePowerGold.class, "Golden Kinesis Pipe", Items.redstone, pipeItemsGold);
pipePowerDiamond = buildPipe(DefaultProps.PIPE_POWER_DIAMOND_ID, PipePowerDiamond.class, "Diamond Kinesis Pipe", Items.redstone, pipeItemsDiamond);
pipePowerHeat = buildPipe(DefaultProps.PIPE_POWER_HEAT_ID, PipePowerHeat.class, "Heat Kinesis Pipe", Blocks.furnace, pipeItemsDiamond);
pipeStructureCobblestone = buildPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe", Block.gravel, pipeItemsCobblestone);
pipeStructureCobblestone = buildPipe(DefaultProps.PIPE_STRUCTURE_COBBLESTONE_ID, PipeStructureCobblestone.class, "Cobblestone Structure Pipe", Blocks.gravel, pipeItemsCobblestone);
// 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));
int pipeWireId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeWire.id", DefaultProps.PIPE_WIRE).getInt(DefaultProps.PIPE_WIRE);
pipeWire = new ItemPipeWire(pipeWireId);
pipeWire = new ItemPipeWire();
LanguageRegistry.addName(pipeWire, "Pipe Wire");
CoreProxy.proxy.registerItem(pipeWire);
PipeWire.item = pipeWire;
Property pipeGateId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGate.id", DefaultProps.GATE_ID);
pipeGate = new ItemGate(pipeGateId.getInt());
pipeGate = new ItemGate();
pipeGate.setUnlocalizedName("pipeGate");
CoreProxy.proxy.registerItem(pipeGate);
Property pipeFacadeId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeFacade.id", DefaultProps.PIPE_FACADE_ID);
facadeItem = new ItemFacade(pipeFacadeId.getInt());
facadeItem = new ItemFacade();
facadeItem.setUnlocalizedName("pipeFacade");
CoreProxy.proxy.registerItem(facadeItem);
Property pipePlugId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipePlug.id", DefaultProps.PIPE_PLUG_ID);
plugItem = new ItemPlug(pipePlugId.getInt());
plugItem = new ItemPlug();
plugItem.setUnlocalizedName("pipePlug");
CoreProxy.proxy.registerItem(plugItem);
Property robotStationId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "robotStation.id", DefaultProps.ROBOT_STATION_ID);
robotStationItem = new ItemRobotStation(robotStationId.getInt());
robotStationItem = new ItemRobotStation();
robotStationItem.setUnlocalizedName("robotStation");
CoreProxy.proxy.registerItem(robotStationItem);
Property filteredBufferId = BuildCraftCore.mainConfiguration.getBlock("filteredBuffer.id", DefaultProps.FILTERED_BUFFER_ID);
filteredBufferBlock = new BlockFilteredBuffer(filteredBufferId.getInt());
CoreProxy.proxy.registerBlock(filteredBufferBlock.setUnlocalizedName("filteredBufferBlock"));
filteredBufferBlock = new BlockFilteredBuffer();
CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
CoreProxy.proxy.addName(filteredBufferBlock, "Filtered Buffer");
} finally {
BuildCraftCore.mainConfiguration.save();
}
}
@EventHandler
public void init(FMLInitializationEvent evt) {
// Register connection handler
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());
// Register GUI handler
// MinecraftForge.setGuiHandler(mod_BuildCraftTransport.instance, new GuiHandler());
TransportProxy.proxy.registerTileEntities();
// dockingStationBlock = new
// BlockDockingStation(Integer.parseInt(dockingStationId.value));
// ModLoader.registerBlock(dockingStationBlock);
// CoreProxy.addName(dockingStationBlock.setBlockName("dockingStation"),
// "Docking Station");
// ModLoader.RegisterTileEntity(TileDockingStation.class,
// "net.minecraft.src.buildcraft.TileDockingStation");
new BptBlockPipe(genericPipeBlock.blockID);
BuildCraftCore.itemBptProps[pipeItemsWood.itemID] = new BptItemPipeWooden();
BuildCraftCore.itemBptProps[pipeFluidsWood.itemID] = new BptItemPipeWooden();
BuildCraftCore.itemBptProps[pipeItemsIron.itemID] = new BptItemPipeIron();
BuildCraftCore.itemBptProps[pipeFluidsIron.itemID] = new BptItemPipeIron();
BuildCraftCore.itemBptProps[pipeItemsDiamond.itemID] = new BptItemPipeDiamond();
BuildCraftCore.itemBptProps[pipeItemsEmerald.itemID] = new BptItemPipeEmerald();
ActionManager.registerTriggerProvider(new PipeTriggerProvider());
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
TransportProxy.proxy.registerRenderers();
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
}
@EventHandler
public void postInit(FMLPostInitializationEvent evt) {
ItemFacade.initialize();
for (PipeContents kind : PipeContents.values()) {
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
@ -427,12 +374,61 @@ public class BuildCraftTransport {
for (PowerMode limit : PowerMode.VALUES) {
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(limit);
}
} finally {
BuildCraftCore.mainConfiguration.save();
}
}
@EventHandler
public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", new PacketHandlerTransport());
// Register connection handler
// MinecraftForge.registerConnectionHandler(new ConnectionHandler());
// Register GUI handler
// MinecraftForge.setGuiHandler(mod_BuildCraftTransport.instance, new GuiHandler());
TransportProxy.proxy.registerTileEntities();
// dockingStationBlock = new
// BlockDockingStation(Integer.parseInt(dockingStationId.value));
// ModLoader.registerBlock(dockingStationBlock);
// CoreProxy.addName(dockingStationBlock.setBlockName("dockingStation"),
// "Docking Station");
// ModLoader.RegisterTileEntity(TileDockingStation.class,
// "net.minecraft.src.buildcraft.TileDockingStation");
//new BptBlockPipe(genericPipeBlock.blockID);
//BuildCraftCore.itemBptProps[pipeItemsWood.itemID] = new BptItemPipeWooden();
//BuildCraftCore.itemBptProps[pipeFluidsWood.itemID] = new BptItemPipeWooden();
//BuildCraftCore.itemBptProps[pipeItemsIron.itemID] = new BptItemPipeIron();
//BuildCraftCore.itemBptProps[pipeFluidsIron.itemID] = new BptItemPipeIron();
//BuildCraftCore.itemBptProps[pipeItemsDiamond.itemID] = new BptItemPipeDiamond();
//BuildCraftCore.itemBptProps[pipeItemsEmerald.itemID] = new BptItemPipeEmerald();
ActionManager.registerTriggerProvider(new PipeTriggerProvider());
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
TransportProxy.proxy.registerRenderers();
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
}
@EventHandler
public void postInit(FMLPostInitializationEvent evt) {
ItemFacade.initialize();
}
public void loadRecipes() {
// Add base recipe for pipe waterproof.
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Item.dyePowder, 1, 2));
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.dye, 1, 2));
// Add pipe recipes
for (PipeRecipe pipe : pipeRecipes) {
@ -445,8 +441,8 @@ public class BuildCraftTransport {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(filteredBufferBlock, 1),
new Object[]{"wdw", "wcw", "wpw", 'w', "plankWood", 'd',
BuildCraftTransport.pipeItemsDiamond, 'c', Block.chest, 'p',
Block.pistonBase});
BuildCraftTransport.pipeItemsDiamond, 'c', Blocks.chest, 'p',
Blocks.piston});
//Facade turning helper
GameRegistry.addRecipe(facadeItem.new FacadeRecipe());
@ -462,10 +458,7 @@ public class BuildCraftTransport {
public static Item buildPipe(int defaultID, Class<? extends Pipe> clas, String descr, Object... ingredients) {
String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);
Property prop = BuildCraftCore.mainConfiguration.getItem(name + ".id", defaultID);
int id = prop.getInt(defaultID);
ItemPipe res = BlockGenericPipe.registerPipe(id, clas);
ItemPipe res = BlockGenericPipe.registerPipe(clas);
res.setUnlocalizedName(clas.getSimpleName());
LanguageRegistry.addName(res, descr);
@ -495,4 +488,5 @@ public class BuildCraftTransport {
return res;
}
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
public class BlockSignature {

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import buildcraft.api.core.BuildCraftAPI;
@ -8,14 +16,14 @@ import net.minecraft.item.ItemStack;
@Deprecated
public class BlueprintManager {
public static BptBlock[] blockBptProps = new BptBlock[Block.blocksList.length];
//public static BptBlock[] blockBptProps = new BptBlock[Block.blocksList.length];
public static ItemSignature getItemSignature(Item item) {
ItemSignature sig = new ItemSignature();
if (item.itemID >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) {
sig.itemClassName = item.getClass().getSimpleName();
}
//if (item.itemID >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) {
// sig.itemClassName = item.getClass().getSimpleName();
//}
sig.itemName = item.getUnlocalizedName(new ItemStack(item));
@ -23,13 +31,14 @@ public class BlueprintManager {
}
public static BlockSignature getBlockSignature(Block block) {
return BlueprintManager.blockBptProps[0].getSignature(block);
//return BlueprintManager.blockBptProps[0].getSignature(block);
return null;
}
static {
// Initialize defaults for block properties.
for (int i = 0; i < BlueprintManager.blockBptProps.length; ++i) {
new BptBlock(i);
}
//for (int i = 0; i < BlueprintManager.blockBptProps.length; ++i) {
// new BptBlock(i);
//}
}
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import buildcraft.api.core.BuildCraftAPI;
@ -49,7 +48,7 @@ public class BptBlock {
public BptBlock(int blockId) {
this.blockId = blockId;
BlueprintManager.blockBptProps[blockId] = this;
//BlueprintManager.blockBptProps[blockId] = this;
}
/**
@ -57,11 +56,11 @@ public class BptBlock {
* buildBlock.
*/
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
if (slot.blockId != 0) {
if (slot.block != null) {
if (slot.storedRequirements.size() != 0) {
requirements.addAll(slot.storedRequirements);
} else {
requirements.add(new ItemStack(slot.blockId, 1, slot.meta));
// requirements.add(new ItemStack(slot.blockId, 1, slot.meta));
}
}
}
@ -103,7 +102,7 @@ public class BptBlock {
if (stack.stackSize == 0 && stack.getItem().getContainerItem() != null) {
Item container = stack.getItem().getContainerItem();
stack.itemID = container.itemID;
//stack.itemID = container.itemID;
stack.stackSize = 1;
stack.setItemDamage(0);
}
@ -117,7 +116,8 @@ public class BptBlock {
* 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);
return false;
}
/**
@ -132,19 +132,19 @@ public class BptBlock {
*/
public void buildBlock(BptSlotInfo slot, IBptContext context) {
// Meta needs to be specified twice, depending on the block behavior
context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, slot.meta,3);
context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,3);
context.world().setBlock(slot.x, slot.y, slot.z, slot.block, slot.meta, 0);
//context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,3);
if (Block.blocksList[slot.blockId] instanceof BlockContainer) {
TileEntity tile = context.world().getBlockTileEntity(slot.x, slot.y, slot.z);
if (slot.block instanceof BlockContainer) {
TileEntity tile = context.world().getTileEntity(slot.x, slot.y, slot.z);
slot.cpt.setInteger("x", slot.x);
slot.cpt.setInteger("y", slot.y);
slot.cpt.setInteger("z", slot.z);
//slot.cpt.setInteger("x", slot.x);
//slot.cpt.setInteger("y", slot.y);
//slot.cpt.setInteger("z", slot.z);
if (tile != null) {
tile.readFromNBT(slot.cpt);
}
//if (tile != null) {
// tile.readFromNBT(slot.cpt);
//}
}
}
@ -162,8 +162,8 @@ public class BptBlock {
* 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) {
TileEntity tile = context.world().getBlockTileEntity(x, y, z);
/*if (Block.blocksList[slot.blockId] instanceof BlockContainer) {
TileEntity tile = context.world().getTileEntity(x, y, z);
if (tile != null) {
tile.writeToNBT(slot.cpt);
@ -176,7 +176,7 @@ public class BptBlock {
if (req != null) {
slot.storedRequirements.addAll(req);
}
}
}*/
}
/**
@ -194,7 +194,7 @@ public class BptBlock {
public BlockSignature getSignature(Block block) {
BlockSignature sig = new BlockSignature();
if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) {
/*if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) {
sig.blockClassName = block.getClass().getSimpleName();
if (block instanceof BlockContainer) {
@ -205,7 +205,7 @@ public class BptBlock {
sig.tileClassName = tile.getClass().getSimpleName();
}
}
}
}*/
sig.blockName = block.getUnlocalizedName();
sig.replaceNullWithStar();

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import java.util.LinkedList;
@ -55,11 +54,11 @@ public class BptBlockUtils {
ItemStack stacks[] = new ItemStack[list.tagCount()];
for (int i = 0; i < list.tagCount(); ++i) {
ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) list.tagAt(i));
//ItemStack stack = ItemStack.loadItemStackFromNBT((NBTTagCompound) list.tagAt(i));
if (stack != null && stack.itemID != 0 && stack.stackSize > 0) {
stacks[i] = context.mapItemStack(stack);
}
//if (stack != null && stack.itemID != 0 && stack.stackSize > 0) {
// stacks[i] = context.mapItemStack(stack);
//}
}
return stacks;
@ -75,7 +74,7 @@ public class BptBlockUtils {
if (stack != null && stack.stackSize != 0) {
stack.writeToNBT(cpt);
context.storeId(stack.itemID);
//context.storeId(stack.itemID);
}
}

View file

@ -1,15 +1,16 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -20,7 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
@Deprecated
public class BptSlotInfo {
public int blockId = 0;
public Block block = null;
public int meta = 0;
public int x;
public int y;
@ -44,7 +45,7 @@ public class BptSlotInfo {
obj.x = x;
obj.y = y;
obj.z = z;
obj.blockId = blockId;
obj.block = block;
obj.meta = meta;
obj.cpt = (NBTTagCompound) cpt.copy();

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
import buildcraft.api.core.IBox;

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.blueprints;
@Deprecated

View file

@ -1,18 +1,20 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
import buildcraft.api.blueprints.BptSlotInfo;
import buildcraft.api.blueprints.IBptContext;
import java.util.LinkedList;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -26,7 +28,7 @@ public class BptBlockBed extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
if ((slot.meta & 8) == 0) {
requirements.add(new ItemStack(Item.bed));
requirements.add(new ItemStack(Items.bed));
}
}
@ -56,7 +58,7 @@ public class BptBlockBed extends BptBlock {
if ((slot.meta & 8) != 0)
return;
context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, slot.meta,1);
//context.world().setBlock(slot.x, slot.y, slot.z, slot.block, slot.meta,1);
int x2 = slot.x;
int z2 = slot.z;
@ -76,7 +78,7 @@ public class BptBlockBed extends BptBlock {
break;
}
context.world().setBlock(x2, slot.y, z2, slot.blockId, slot.meta + 8,1);
//context.world().setBlock(x2, slot.y, z2, slot.block, slot.meta + 8,1);
}
@Override

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;

View file

@ -1,27 +1,29 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BlueprintManager;
import buildcraft.api.blueprints.BptBlock;
import buildcraft.api.blueprints.BptSlotInfo;
import buildcraft.api.blueprints.IBptContext;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@Deprecated
public class BptBlockDelegate extends BptBlock {
final int delegateTo;
final Block delegateTo;
public BptBlockDelegate(int blockId, int delegateTo) {
public BptBlockDelegate(int blockId, Block delegateTo) {
super(blockId);
this.delegateTo = delegateTo;
@ -30,36 +32,38 @@ public class BptBlockDelegate extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
BptSlotInfo newSlot = slot.clone();
slot.blockId = delegateTo;
slot.block = delegateTo;
if (BlueprintManager.blockBptProps[delegateTo] != null) {
BlueprintManager.blockBptProps[delegateTo].addRequirements(newSlot, context, requirements);
} else {
super.addRequirements(newSlot, context, requirements);
}
//if (BlueprintManager.blockBptProps[delegateTo] != null) {
// BlueprintManager.blockBptProps[delegateTo].addRequirements(newSlot, context, requirements);
//} else {
// super.addRequirements(newSlot, context, requirements);
//}
}
@Override
public boolean isValid(BptSlotInfo slot, IBptContext context) {
BptSlotInfo newSlot = slot.clone();
slot.blockId = delegateTo;
slot.block = delegateTo;
if (BlueprintManager.blockBptProps[delegateTo] != null)
return BlueprintManager.blockBptProps[delegateTo].isValid(newSlot, context);
else
return super.isValid(newSlot, context);
//if (BlueprintManager.blockBptProps[delegateTo] != null)
// return BlueprintManager.blockBptProps[delegateTo].isValid(newSlot, context);
//else
// return super.isValid(newSlot, context);
return false;
}
@Override
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
BptSlotInfo newSlot = slot.clone();
slot.blockId = delegateTo;
slot.block = delegateTo;
if (BlueprintManager.blockBptProps[delegateTo] != null) {
BlueprintManager.blockBptProps[delegateTo].rotateLeft(newSlot, context);
} else {
super.rotateLeft(newSlot, context);
}
//if (BlueprintManager.blockBptProps[delegateTo] != null) {
// BlueprintManager.blockBptProps[delegateTo].rotateLeft(newSlot, context);
//} else {
// super.rotateLeft(newSlot, context);
//}
}
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -25,18 +24,19 @@ public class BptBlockDirt extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Block.dirt));
//requirements.add(new ItemStack(Block.dirt));
}
@Override
public void buildBlock(BptSlotInfo slot, IBptContext context) {
context.world().setBlock(slot.x, slot.y, slot.z, Block.dirt.blockID, slot.meta,1);
//context.world().setBlock(slot.x, slot.y, slot.z, Block.dirt.blockID, slot.meta,1);
}
@Override
public boolean isValid(BptSlotInfo slot, IBptContext context) {
int id = context.world().getBlockId(slot.x, slot.y, slot.z);
//int id = context.world().getBlockId(slot.x, slot.y, slot.z);
return id == Block.dirt.blockID || id == Block.grass.blockID || id == Block.tilledField.blockID;
//return id == Block.dirt.blockID || id == Block.grass.blockID || id == Block.tilledField.blockID;
return false;
}
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -61,8 +60,8 @@ public class BptBlockDoor extends BptBlock {
@Override
public void buildBlock(BptSlotInfo slot, IBptContext context) {
context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, slot.meta,1);
context.world().setBlock(slot.x, slot.y + 1, slot.z, slot.blockId, slot.meta + 8,1);
//context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, slot.meta,1);
//context.world().setBlock(slot.x, slot.y + 1, slot.z, slot.blockId, slot.meta + 8,1);
context.world().setBlockMetadataWithNotify(slot.x, slot.y + 1, slot.z, slot.meta + 8,1);
context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,1);

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -35,9 +34,9 @@ public class BptBlockFluid 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;
}
@ -53,9 +52,9 @@ public class BptBlockFluid extends BptBlock {
@Override
public void buildBlock(BptSlotInfo slot, IBptContext context) {
if (slot.meta == 0) {
context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, 0,1);
}
//if (slot.meta == 0) {
// context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, 0,1);
//}
}
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -24,7 +23,7 @@ public class BptBlockIgnore extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(slot.blockId, 0, 0));
//requirements.add(new ItemStack(slot.blockId, 0, 0));
}
@Override

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -24,11 +23,12 @@ public class BptBlockIgnoreMeta extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(slot.blockId, 1, 0));
//requirements.add(new ItemStack(slot.blockId, 1, 0));
}
@Override
public boolean isValid(BptSlotInfo slot, IBptContext context) {
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
return false;
}
}

View file

@ -1,3 +1,12 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -17,7 +26,7 @@ public class BptBlockInventory extends BptBlock {
public void buildBlock(BptSlotInfo slot, IBptContext context) {
super.buildBlock(slot, context);
IInventory inv = (IInventory) context.world().getBlockTileEntity(slot.x, slot.y, slot.z);
IInventory inv = (IInventory) context.world().getTileEntity(slot.x, slot.y, slot.z);
for (int i = 0; i < inv.getSizeInventory(); ++i) {
inv.setInventorySlotContents(i, null);

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptSlotInfo;
@ -23,7 +22,7 @@ public class BptBlockLever extends BptBlockWallSide {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(slot.blockId, 1, 0));
//requirements.add(new ItemStack(slot.blockId, 1, 0));
}
@Override

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptSlotInfo;
@ -23,7 +22,7 @@ public class BptBlockPiston extends BptBlockRotateMeta {
public void buildBlock(BptSlotInfo slot, IBptContext context) {
int meta = slot.meta & 7;
context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, meta,1);
//context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, meta,1);
}
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -24,12 +23,13 @@ public class BptBlockPumpkin extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(slot.blockId, 1, 0));
//requirements.add(new ItemStack(slot.blockId, 1, 0));
}
@Override
public boolean isValid(BptSlotInfo slot, IBptContext context) {
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
return false;
}
@Override

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -25,7 +24,7 @@ public class BptBlockRedstoneRepeater extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Item.redstoneRepeater));
//requirements.add(new ItemStack(Item.redstoneRepeater));
}
@Override

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptSlotInfo;
@ -16,7 +24,7 @@ public class BptBlockRotateInventory extends BptBlockRotateMeta {
public void buildBlock(BptSlotInfo slot, IBptContext context) {
super.buildBlock(slot, context);
IInventory inv = (IInventory) context.world().getBlockTileEntity(slot.x, slot.y, slot.z);
IInventory inv = (IInventory) context.world().getTileEntity(slot.x, slot.y, slot.z);
for (int i = 0; i < inv.getSizeInventory(); ++i) {
inv.setInventorySlotContents(i, null);

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -43,12 +42,13 @@ public class BptBlockRotateMeta extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(slot.blockId, 1, 0));
//requirements.add(new ItemStack(slot.blockId, 1, 0));
}
@Override
public boolean isValid(BptSlotInfo slot, IBptContext context) {
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
return false;
}
@Override

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BlockSignature;
@ -31,7 +30,7 @@ public class BptBlockSign extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Item.sign));
//requirements.add(new ItemStack(Item.sign));
}
@Override

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -24,12 +23,13 @@ public class BptBlockStairs extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(slot.blockId, 1, 0));
//requirements.add(new ItemStack(slot.blockId, 1, 0));
}
@Override
public boolean isValid(BptSlotInfo slot, IBptContext context) {
return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
//return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z);
return false;
}
@Override

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock;
@ -24,7 +23,7 @@ public class BptBlockWallSide extends BptBlock {
@Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(slot.blockId, 1, 0));
//requirements.add(new ItemStack(slot.blockId, 1, 0));
}
@Override

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.builder;
import java.util.ArrayList;
@ -5,8 +13,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import buildcraft.builders.blueprints.IBlueprintBuilderAgent;
import buildcraft.builders.blueprints.BlueprintBuilder.SchematicBuilder;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@ -14,7 +20,9 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.builders.blueprints.BlueprintBuilder.SchematicBuilder;
import buildcraft.builders.blueprints.IBlueprintBuilderAgent;
/**
* BlockHandlers are used to serialize blocks for saving/loading from
@ -22,41 +30,45 @@ import net.minecraftforge.common.ForgeDirection;
*
* To implement your own, you should extend this class and override the
* functions as needed.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class BlockHandler {
private static final Map<Integer, BlockHandler> handlers = new HashMap<Integer, BlockHandler>();
private static final Map<Object, BlockHandler> handlers = new HashMap<Object, BlockHandler>();
private final int id;
public static BlockHandler get(Item item) {
if (item == null)
if (item == null) {
return null;
return get(item.itemID);
} else {
return get(item);
}
}
public static BlockHandler get(Block block) {
if (block == null)
if (block == null) {
return null;
return get(block.blockID);
} else {
return get(block);
}
}
public static BlockHandler get(int id) {
BlockHandler handler = handlers.get(id);
if (handler == null) {
handler = new BlockHandler(id);
registerHandler(id, handler);
}
return handler;
}
public static void registerHandler(Block block, BlockHandler handler) {
handlers.put(block.blockID, handler);
handlers.put(block, handler);
}
public static void registerHandler(Item item, BlockHandler handler) {
handlers.put(item.itemID, handler);
handlers.put(item, handler);
}
public static void registerHandler(int id, BlockHandler handler) {
@ -79,21 +91,22 @@ public class BlockHandler {
* We will also skip any blocks that drop actual items like Ore blocks.
*/
public boolean canSaveToSchematic(World world, int x, int y, int z) {
if (!(Item.itemsList[id] instanceof ItemBlock))
return false;
Block block = Block.getBlockById(id);
Block block = Block.blocksList[id];
if (block == null)
if (block == null) {
return false;
}
int meta = world.getBlockMetadata(x, y, z);
try {
if (block.idDropped(meta, null, 0) != id)
return false;
try {
if (block.getItemDropped(meta, null, 0) != Item.getItemFromBlock(block)) {
return false;
}
} catch (NullPointerException ex) {
return false;
}
return !block.hasTileEntity(meta);
}
@ -105,21 +118,24 @@ public class BlockHandler {
* We will also skip any blocks that drop actual items like Ore blocks.
*/
public boolean canSaveToSchematic(ItemStack stack) {
if (stack == null)
return false;
if (!(stack.getItem() instanceof ItemBlock))
if (stack == null) {
return false;
}
if (id > Block.blocksList.length)
if (!(stack.getItem() instanceof ItemBlock)) {
return false;
}
Block block = Block.blocksList[id];
if (block == null)
Block block = Block.getBlockById(id);
if (block == null) {
return false;
}
try {
if (block.idDropped(stack.getItemDamage(), null, 0) != id)
if (block.getItemDropped(stack.getItemDamage(), null, 0) != Item.getItemFromBlock(block)) {
return false;
}
} catch (NullPointerException ex) {
return false;
}
@ -159,8 +175,9 @@ public class BlockHandler {
*/
public List<ItemStack> getCostForSchematic(NBTTagCompound data) {
List<ItemStack> cost = new ArrayList<ItemStack>();
Block block = Block.blocksList[id];
cost.add(new ItemStack(block.idDropped(data.getByte("blockMeta"), BlueprintHelpers.RANDOM, 0), 1, block.damageDropped(data.getByte("blockMeta"))));
Block block = Block.getBlockById(id);
cost.add(new ItemStack(block.getItemDropped(data.getByte("blockMeta"), BlueprintHelpers.RANDOM, 0), 1, block.damageDropped(data.getByte("blockMeta"))));
return cost;
}
@ -203,8 +220,10 @@ public class BlockHandler {
if (builderInventory != null) {
List<ItemStack> requiredItems = getCostForSchematic(builder.schematic.data);
List<Integer> slotsToConsume = new ArrayList<Integer>();
for (ItemStack cost : requiredItems) {
boolean found = false;
for (int slot = 0; slot < builderInventory.getSizeInventory(); slot++) {
if (areItemsEqual(builderInventory.getStackInSlot(slot), cost)) {
slotsToConsume.add(slot);
@ -212,22 +231,26 @@ public class BlockHandler {
break;
}
}
if (!found)
if (!found) {
return false;
}
}
for (Integer slot : slotsToConsume) {
builderInventory.setInventorySlotContents(slot, BlueprintHelpers.consumeItem(builderInventory.getStackInSlot(slot)));
}
}
return world.setBlock(builder.getX(), builder.getY(), builder.getZ(), Block.blocksList[id].blockID, builder.schematic.data.getByte("blockMeta"), 3);
return world.setBlock(builder.getX(), builder.getY(), builder.getZ(), Block.getBlockById(id), 0, 3);
}
/**
* Checks if the block matches the schematic.
*/
public boolean doesBlockMatchSchematic(World world, int x, int y, int z, ForgeDirection blueprintOrientation, NBTTagCompound data) {
if (id != world.getBlockId(x, y, z))
if (Block.getBlockById(id) != world.getBlock(x, y, z)) {
return false;
}
return !data.hasKey("blockMeta") || data.getByte("blockMeta") == world.getBlockMetadata(x, y, z);
}

View file

@ -1,13 +1,19 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.builder;
import java.util.Random;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
/**
* A collection of helpful functions to make your life easier.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class BlueprintHelpers {
@ -43,7 +49,7 @@ public class BlueprintHelpers {
public static ItemStack consumeItem(ItemStack stack) {
if (stack.stackSize == 1) {
if (stack.getItem().hasContainerItem()) {
return stack.getItem().getContainerItemStack(stack);
return stack.getItem().getContainerItem(stack);
} else {
return null;
}

View file

@ -1,14 +1,16 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.block.Block;
public class BuildCraftAPI {
@ -16,5 +18,5 @@ public class BuildCraftAPI {
public static final int LAST_ORIGINAL_BLOCK = 122;
public static final int LAST_ORIGINAL_ITEM = 126;
public static final boolean[] softBlocks = new boolean[Block.blocksList.length];
public static final Set <Block> softBlocks = new HashSet<Block>();
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;
/**

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;
import net.minecraft.world.World;

View file

@ -1,9 +1,17 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public interface IIconProvider {
@ -12,13 +20,13 @@ public interface IIconProvider {
* @return
*/
@SideOnly(Side.CLIENT)
public Icon getIcon(int iconIndex);
public IIcon getIcon(int iconIndex);
/**
* A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider
* @param iconRegister
*/
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister);
public void registerIcons(IIconRegister iconRegister);
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;
public enum LaserKind {

View file

@ -1,17 +1,16 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
public class Position {

View file

@ -1,8 +1,9 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -8,12 +8,9 @@
*/
package buildcraft.api.core;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class StackWrapper {
public final ItemStack stack;
@ -25,10 +22,15 @@ public class StackWrapper {
@Override
public int hashCode() {
int hash = 5;
hash = 67 * hash + stack.itemID;
hash = 67 * hash + stack.getItem().hashCode();
hash = 67 * hash + stack.getItemDamage();
if (stack.stackTagCompound != null)
if (stack.stackTagCompound != null) {
hash = 67 * hash + stack.stackTagCompound.hashCode();
}
return hash;
}
@ -39,7 +41,7 @@ public class StackWrapper {
if (getClass() != obj.getClass())
return false;
final StackWrapper other = (StackWrapper) obj;
if (stack.itemID != other.stack.itemID)
if (stack.getItem() != other.stack.getItem())
return false;
if (stack.getHasSubtypes() && stack.getItemDamage() != other.stack.getItemDamage())
return false;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.filler;
public class FillerManager {

View file

@ -1,11 +1,19 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.filler;
import buildcraft.api.core.IBox;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraftforge.common.ForgeDirection;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
public interface IFillerPattern {
@ -23,7 +31,7 @@ public interface IFillerPattern {
public IPatternIterator createPatternIterator(TileEntity tile, IBox box, ForgeDirection orientation);
@SideOnly(Side.CLIENT)
public Icon getIcon();
public IIcon getIcon();
public String getDisplayName();
}

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.filler;
import buildcraft.api.gates.IAction;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -10,10 +10,6 @@ package buildcraft.api.filler;
import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IPatternIterator {
public boolean iteratePattern(ItemStack stackToPlace);

View file

@ -1,15 +1,19 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.fuels;
import buildcraft.api.core.StackWrapper;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
@ -60,7 +64,7 @@ public final class IronEngineCoolant {
* @param coolant
*/
public static void addCoolant(final ItemStack stack, final FluidStack coolant) {
if (stack != null && Item.itemsList[stack.itemID] != null && coolant != null) {
if (stack != null && stack.getItem() != null && coolant != null) {
solidCoolants.put(new StackWrapper(stack), coolant);
}
}
@ -73,8 +77,12 @@ public final class IronEngineCoolant {
* @param stack
* @param coolant
*/
public static void addCoolant(final int itemId, final int metadata, final FluidStack coolant) {
addCoolant(new ItemStack(itemId, 1, metadata), coolant);
public static void addCoolant(final Item item, final int metadata, final FluidStack coolant) {
addCoolant(new ItemStack(item, 1, metadata), coolant);
}
public static void addCoolant(final Block block, final int metadata, final FluidStack coolant) {
addCoolant(new ItemStack(block, 1, metadata), coolant);
}
public static boolean isCoolant(Fluid fluid) {

View file

@ -1,8 +1,9 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.fuels;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import buildcraft.api.transport.IPipeTile;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -12,10 +12,6 @@ import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public abstract class GateExpansionController {
public final IGateExpansion type;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -15,10 +15,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public final class GateExpansions {
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();

View file

@ -1,19 +1,27 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public interface IAction {
String getUniqueTag();
@SideOnly(Side.CLIENT)
Icon getIcon();
IIcon getIcon();
@SideOnly(Side.CLIENT)
void registerIcons(IconRegister iconRegister);
void registerIcons(IIconRegister iconRegister);
boolean hasParameter();

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import java.util.LinkedList;

View file

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

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -8,14 +8,10 @@
*/
package buildcraft.api.gates;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IGateExpansion {
String getUniqueIdentifier();
@ -24,11 +20,11 @@ public interface IGateExpansion {
GateExpansionController makeController(TileEntity pipeTile);
void registerBlockOverlay(IconRegister iconRegister);
void registerBlockOverlay(IIconRegister iconRegister);
void registerItemOverlay(IconRegister iconRegister);
void registerItemOverlay(IIconRegister iconRegister);
Icon getOverlayBlock();
IIcon getOverlayBlock();
Icon getOverlayItem();
IIcon getOverlayItem();
}

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import java.util.LinkedList;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -9,12 +9,8 @@
package buildcraft.api.gates;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface ITileTrigger extends ITrigger {
/**

View file

@ -1,9 +1,17 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public interface ITrigger {
@ -16,10 +24,10 @@ public interface ITrigger {
String getUniqueTag();
@SideOnly(Side.CLIENT)
Icon getIcon();
IIcon getIcon();
@SideOnly(Side.CLIENT)
void registerIcons(IconRegister iconRegister);
void registerIcons(IIconRegister iconRegister);
/**
* Return true if this trigger can accept parameters

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import net.minecraft.item.ItemStack;

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import buildcraft.api.transport.IPipeTile;

View file

@ -1,14 +1,14 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.gates;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -49,7 +49,7 @@ public class TriggerParameter implements ITriggerParameter {
if (stack != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
stack.writeToNBT(tagCompound);
compound.setCompoundTag("stack", tagCompound);
compound.setTag("stack", tagCompound);
}
}
@ -63,7 +63,7 @@ public class TriggerParameter implements ITriggerParameter {
// Legacy code to prevent existing gates from losing their contents
int itemID = compound.getInteger("itemID");
if (itemID != 0) {
stack = new ItemStack(itemID, 1, compound.getInteger("itemDMG"));
stack = new ItemStack((Item) Item.itemRegistry.getObject(itemID), 1, compound.getInteger("itemDMG"));
return;
}

View file

@ -1,9 +1,18 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.inventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public interface ISpecialInventory extends IInventory {
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -8,11 +8,6 @@
*/
package buildcraft.api.power;
/**
* Specifies a Tile Entity that can receive power via laser beam.
*
* @author cpw
*/
public interface ILaserTarget {
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -8,15 +8,13 @@
*/
package buildcraft.api.power;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Essentially only used for Wooden Power Pipe connection rules.
*
* This Tile Entity interface allows you to indicate that a block can emit power
* from a specific side.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IPowerEmitter {

View file

@ -1,20 +1,19 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.power;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
/**
* This interface should be implemented by any Tile Entity that wishes to be
* able to receive power.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IPowerReceptor {

View file

@ -1,15 +1,16 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.power;
import buildcraft.api.core.SafeTimeTracker;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
/**
* The PowerHandler is similar to FluidTank in that it holds your power and
@ -26,8 +27,6 @@ import net.minecraftforge.common.ForgeDirection;
*
* @see IPowerReceptor
* @see IPowerEmitter
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public final class PowerHandler {
@ -335,7 +334,7 @@ public final class PowerHandler {
public void writeToNBT(NBTTagCompound data, String tag) {
NBTTagCompound nbt = new NBTTagCompound();
nbt.setDouble("energyStored", energyStored);
data.setCompoundTag(tag, nbt);
data.setTag(tag, nbt);
}
public final class PowerReceiver {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -8,10 +8,6 @@
*/
package buildcraft.api.recipes;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public final class BuildcraftRecipes {
public static IAssemblyRecipeManager assemblyTable;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -11,10 +11,6 @@ package buildcraft.api.recipes;
import java.util.List;
import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IAssemblyRecipeManager {
public static interface IAssemblyRecipe {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -15,8 +15,6 @@ import net.minecraft.item.ItemStack;
* The Integration Table's primary purpose is to modify an input item's NBT
* data. As such its not a "traditional" type of recipe. Rather than predefined
* inputs and outputs, it takes an input and transforms it.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IIntegrationRecipeManager {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -11,10 +11,6 @@ package buildcraft.api.recipes;
import java.util.SortedSet;
import net.minecraftforge.fluids.FluidStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IRefineryRecipeManager {
void addRecipe(FluidStack ingredient, FluidStack result, int energy, int delay);

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.tools;
import net.minecraft.item.ItemStack;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.tools;
import net.minecraft.entity.player.EntityPlayer;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.transport;
import net.minecraft.world.World;

View file

@ -1,14 +1,15 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.transport;
import buildcraft.api.transport.IPipeTile.PipeType;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
public interface IPipeConnection {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -8,23 +8,19 @@
*/
package buildcraft.api.transport;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IPipeDefinition {
String getUniqueTag();
void registerIcons(IconRegister iconRegister);
void registerIcons(IIconRegister iconRegister);
Icon getIcon(int index);
IIcon getIcon(int index);
Icon getItemIcon();
IIcon getItemIcon();
PipeBehavior makePipeBehavior(TileEntity tile);
}

View file

@ -1,14 +1,15 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.transport;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
public interface IPipeTile {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -11,12 +11,8 @@ package buildcraft.api.transport;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public abstract class PipeBehavior {
public final TileEntity tile;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.transport;
import java.util.ArrayList;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) SpaceToad, 2011-2012
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
@ -12,10 +12,6 @@ import java.util.Locale;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public enum PipeWire {
RED, BLUE, GREEN, YELLOW;

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.BuildCraftBuilders;
@ -18,36 +17,39 @@ import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockArchitect extends BlockContainer {
Icon blockTextureSides;
Icon blockTextureFront;
Icon blockTextureTopPos;
Icon blockTextureTopNeg;
Icon blockTextureTopArchitect;
IIcon blockTextureSides;
IIcon blockTextureFront;
IIcon blockTextureTopPos;
IIcon blockTextureTopNeg;
IIcon blockTextureTopArchitect;
public BlockArchitect(int i) {
super(i, Material.iron);
public BlockArchitect() {
super(Material.iron);
setHardness(5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileArchitect();
}
@ -84,7 +86,7 @@ public class BlockArchitect extends BlockContainer {
return true;
} else {
if (!CoreProxy.proxy.isRenderWorld(world)) {
if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k);
}
return true;
@ -93,10 +95,10 @@ public class BlockArchitect extends BlockContainer {
}
@Override
public void breakBlock(World world, int i, int j, int k, int par5, int par6) {
public void breakBlock(World world, int i, int j, int k, Block block, int par6) {
Utils.preDestroyBlock(world, i, j, k);
super.breakBlock(world, i, j, k, par5, par6);
super.breakBlock(world, i, j, k, block, par6);
}
@Override
@ -109,7 +111,8 @@ public class BlockArchitect extends BlockContainer {
}
@SuppressWarnings({ "all" })
public Icon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
@Override
public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int m = iblockaccess.getBlockMetadata(i, j, k);
if (l == 1)
@ -119,7 +122,7 @@ public class BlockArchitect extends BlockContainer {
}
@Override
public Icon getIcon(int i, int j) {
public IIcon getIcon(int i, int j) {
if (j == 0 && i == 3)
return blockTextureFront;
@ -132,15 +135,9 @@ public class BlockArchitect extends BlockContainer {
return blockTextureSides;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
blockTextureSides = par1IconRegister.registerIcon("buildcraft:architect_sides");
blockTextureTopNeg = par1IconRegister.registerIcon("buildcraft:architect_top_neg");

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.BuildCraftBuilders;
@ -20,21 +19,21 @@ import java.util.ArrayList;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
public class BlockBlueprintLibrary extends BlockContainer {
private Icon textureTop;
private Icon textureSide;
private IIcon textureTop;
private IIcon textureSide;
public BlockBlueprintLibrary(int i) {
super(i, Material.wood);
public BlockBlueprintLibrary() {
super(Material.wood);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
setHardness(5F);
}
@ -47,10 +46,10 @@ public class BlockBlueprintLibrary extends BlockContainer {
if (entityplayer.isSneaking())
return false;
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getBlockTileEntity(i, j, k);
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
if (!tile.locked || entityplayer.username.equals(tile.owner))
if (!CoreProxy.proxy.isRenderWorld(world)) {
if (!tile.locked || entityplayer.getDisplayName().equals(tile.owner))
if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
}
@ -58,12 +57,12 @@ public class BlockBlueprintLibrary extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileBlueprintLibrary();
}
@Override
public Icon getIcon(int i, int j) {
public IIcon getIcon(int i, int j) {
switch (i) {
case 0:
case 1:
@ -75,21 +74,15 @@ public class BlockBlueprintLibrary extends BlockContainer {
@Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
if (CoreProxy.proxy.isSimulating(world) && entityliving instanceof EntityPlayer) {
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getBlockTileEntity(i, j, k);
tile.owner = ((EntityPlayer) entityliving).username;
if (!world.isRemote && entityliving instanceof EntityPlayer) {
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
tile.owner = ((EntityPlayer) entityliving).getDisplayName();
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
textureTop = par1IconRegister.registerIcon("buildcraft:library_topbottom");
textureSide = par1IconRegister.registerIcon("buildcraft:library_side");

View file

@ -19,37 +19,38 @@ import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockBuilder extends BlockContainer {
Icon blockTextureTop;
Icon blockTextureSide;
Icon blockTextureFront;
IIcon blockTextureTop;
IIcon blockTextureSide;
IIcon blockTextureFront;
public BlockBuilder(int i) {
super(i, Material.iron);
public BlockBuilder() {
super(Material.iron);
setHardness(5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileBuilder();
}
@Override
public Icon getIcon(int i, int j) {
public IIcon getIcon(int i, int j) {
if (j == 0 && i == 3)
return blockTextureFront;
@ -97,7 +98,7 @@ public class BlockBuilder extends BlockContainer {
return true;
} else {
if (!CoreProxy.proxy.isRenderWorld(world)) {
if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k);
}
return true;
@ -114,20 +115,14 @@ public class BlockBuilder extends BlockContainer {
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
super.breakBlock(world, x, y, z, block, par6);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
public void registerBlockIcons(IIconRegister par1IconRegister) {
blockTextureTop = par1IconRegister.registerIcon("buildcraft:builder_top");
blockTextureSide = par1IconRegister.registerIcon("buildcraft:builder_side");
blockTextureFront = par1IconRegister.registerIcon("buildcraft:builder_front");

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.BuildCraftBuilders;
@ -17,26 +16,29 @@ import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockFiller extends BlockContainer {
Icon textureSides;
Icon textureTopOn;
Icon textureTopOff;
IIcon textureSides;
IIcon textureTopOn;
IIcon textureTopOff;
public IFillerPattern currentPattern;
public BlockFiller(int i) {
super(i, Material.iron);
public BlockFiller() {
super(Material.iron);
setHardness(5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
@ -49,7 +51,7 @@ public class BlockFiller extends BlockContainer {
if (entityplayer.isSneaking())
return false;
if (!CoreProxy.proxy.isRenderWorld(world)) {
if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
}
return true;
@ -57,9 +59,9 @@ public class BlockFiller extends BlockContainer {
}
@Override
public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side) {
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
int m = world.getBlockMetadata(x, y, z);
TileEntity tile = world.getBlockTileEntity(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof TileFiller) {
TileFiller filler = (TileFiller) tile;
@ -78,7 +80,7 @@ public class BlockFiller extends BlockContainer {
}
@Override
public Icon getIcon(int i, int j) {
public IIcon getIcon(int i, int j) {
if (i == 0 || i == 1)
return textureTopOn;
else
@ -86,25 +88,19 @@ public class BlockFiller extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileFiller();
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
super.breakBlock(world, x, y, z, block, par6);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
public void registerBlockIcons(IIconRegister par1IconRegister) {
textureTopOn = par1IconRegister.registerIcon("buildcraft:blockFillerTopOn");
textureTopOff = par1IconRegister.registerIcon("buildcraft:blockFillerTopOff");
textureSides = par1IconRegister.registerIcon("buildcraft:blockFillerSides");

View file

@ -1,8 +1,9 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
@ -13,24 +14,27 @@ import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.util.ForgeDirection;
public class BlockMarker extends BlockContainer {
public BlockMarker(int i) {
super(i, Material.circuits);
public BlockMarker() {
super(Material.circuits);
setLightValue(0.5F);
setLightLevel(0.5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}
@ -80,20 +84,20 @@ public class BlockMarker extends BlockContainer {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileMarker();
}
@Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
((TileMarker) world.getBlockTileEntity(i, j, k)).tryConnection();
((TileMarker) world.getTileEntity(i, j, k)).tryConnection();
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
super.breakBlock(world, x, y, z, block, par6);
}
@Override
@ -112,8 +116,8 @@ public class BlockMarker extends BlockContainer {
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, int blockId) {
((TileMarker) world.getBlockTileEntity(x, y, z)).updateSignals();
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
((TileMarker) world.getTileEntity(x, y, z)).updateSignals();
dropTorchIfCantStay(world, x, y, z);
}
@ -137,20 +141,14 @@ public class BlockMarker extends BlockContainer {
private void dropTorchIfCantStay(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
if (!canPlaceBlockOnSide(world, x, y, z, meta)) {
dropBlockAsItem(world, x, y, z, BuildCraftBuilders.markerBlock.blockID, 0);
world.setBlock(x, y, z, 0);
dropBlockAsItem(world, x, y, z, 0, 0);
world.setBlockToAir(x, y, z);
}
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("buildcraft:blockMarker");
}
}

View file

@ -1,64 +1,59 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockPathMarker extends BlockMarker {
private Icon activeMarker;
private IIcon activeMarker;
public BlockPathMarker(int i) {
super(i);
public BlockPathMarker() {
}
@Override
public TileEntity createNewTileEntity(World var1) {
public TileEntity createNewTileEntity(World world, int metadata) {
return new TilePathMarker();
}
@Override
public void breakBlock(World world, int x, int y, int z, int par5, int par6) {
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6);
super.breakBlock(world, x, y, z, block, par6);
}
@SuppressWarnings({ "all" })
// @Override (client only)
public Icon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) {
TilePathMarker marker = (TilePathMarker) iblockaccess.getBlockTileEntity(i, j, k);
public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
TilePathMarker marker = (TilePathMarker) iblockaccess.getTileEntity(i, j, k);
if (l == 1 || (marker != null && marker.tryingToConnect))
return activeMarker;
else
return super.getBlockTexture(iblockaccess, i, j, k, l);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
return super.getIcon(iblockaccess, i, j, k, l);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
blockIcon = par1IconRegister.registerIcon("buildcraft:blockPathMarker");
activeMarker = par1IconRegister.registerIcon("buildcraft:blockPathMarkerActive");

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import cpw.mods.fml.common.SidedProxy;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.BuildCraftBuilders;

View file

@ -1,12 +1,11 @@
/**
* Copyright (c) SpaceToad, 2011
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import net.minecraft.block.Block;
@ -15,7 +14,7 @@ import net.minecraft.world.World;
public class BuildersProxy {
public static boolean canPlaceTorch(World world, int i, int j, int k) {
Block block = Block.blocksList[world.getBlockId(i, j, k)];
Block block = world.getBlock(i, j, k);
if (block == null || !block.renderAsNormalBlock())
return false;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.BuildCraftBuilders;

View file

@ -1,21 +1,21 @@
/**
* Copyright (c) SpaceToad, 2011 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.WorldEvent;
public class EventHandlerBuilders {
@ForgeSubscribe
@SubscribeEvent
public void handleWorldLoad(WorldEvent.Load event) {
// Temporary solution
// Please remove the world Load event when world Unload event gets implimented
@ -24,7 +24,7 @@ public class EventHandlerBuilders {
}
}
@ForgeSubscribe
@SubscribeEvent
public void handleWorldUnload(WorldEvent.Unload event) {
// When a world unloads clean from the list of available markers the ones
// that were on the unloaded world

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.builders.gui.ContainerBlueprintLibrary;
@ -25,7 +33,7 @@ public class GuiHandler implements IGuiHandler {
if (!world.blockExists(x, y, z))
return null;
TileEntity tile = world.getBlockTileEntity(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) {
@ -67,7 +75,7 @@ public class GuiHandler implements IGuiHandler {
if (!world.blockExists(x, y, z))
return null;
TileEntity tile = world.getBlockTileEntity(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) {
@ -92,10 +100,11 @@ public class GuiHandler implements IGuiHandler {
return new ContainerFiller(player.inventory, (TileFiller) tile);
case GuiIds.URBANIST:
System.out.println ("CREATE U FROM SERVER: " + CoreProxy.proxy.isSimulating(tile.worldObj));
if (!(tile instanceof TileUrbanist))
if (!(tile instanceof TileUrbanist)) {
return null;
} else {
return new ContainerUrbanist(player.inventory, (TileUrbanist) tile);
}
default:
return null;

View file

@ -1,3 +1,11 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import buildcraft.core.blueprints.BptRootIndex;

View file

@ -1,8 +1,9 @@
/**
* Copyright (c) SpaceToad, 2011-2012 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
@ -23,8 +24,8 @@ import buildcraft.builders.blueprints.BlueprintId;
public abstract class ItemBlueprint extends ItemBuildCraft {
public ItemBlueprint(int i) {
super(i);
public ItemBlueprint() {
super();
setMaxStackSize(1);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
}

View file

@ -1,28 +1,29 @@
/**
* Copyright (c) SpaceToad, 2011-2012 http://www.mod-buildcraft.com
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public License
* 1.0, or MMPL. Please check the contents of the license located in
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public class ItemBlueprintStandard extends ItemBlueprint {
private Icon cleanBlueprint;
private Icon usedBlueprint;
private IIcon cleanBlueprint;
private IIcon usedBlueprint;
public ItemBlueprintStandard(int i) {
super(i);
public ItemBlueprintStandard() {
super();
}
@Override
public Icon getIconFromDamage(int damage) {
public IIcon getIconFromDamage(int damage) {
if (damage == 0)
return cleanBlueprint;
else
@ -31,7 +32,7 @@ public class ItemBlueprintStandard extends ItemBlueprint {
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
public void registerIcons(IIconRegister par1IconRegister) {
cleanBlueprint = par1IconRegister.registerIcon("buildcraft:blueprint_clean");
usedBlueprint = par1IconRegister.registerIcon("buildcraft:blueprint_used");
}

View file

@ -1,20 +1,27 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.builders;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
public class ItemBlueprintTemplate extends ItemBlueprint {
public class ItemBlueprintTemplate extends ItemBptBase {
private IIcon usedTemplate;
private Icon usedTemplate;
public ItemBlueprintTemplate(int i) {
super(i);
public ItemBlueprintTemplate() {
super();
}
@Override
public Icon getIconFromDamage(int i) {
public IIcon getIconFromDamage(int i) {
if (i == 0)
return itemIcon;
else
@ -23,7 +30,7 @@ public class ItemBlueprintTemplate extends ItemBlueprint {
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) {
public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = par1IconRegister.registerIcon("buildcraft:template_clean");
usedTemplate = par1IconRegister.registerIcon("buildcraft:template_used");
}

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