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="mcpsrc.dir" value="${mcp.dir}/src"/>
<property name="mc.version" value="1.6.4"/> <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="project.version" value="0.0.0"/>-->
<property name="buildcraft.name" value="buildcraft"/> <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 property="forge-exists" file="${download.dir}/${forge.name}"/>
<available file="${src.dir}/.git" type="dir" property="git.present"/> <available file="${src.dir}/.git" type="dir" property="git.present"/>
@ -99,7 +100,7 @@
<!-- Download forge (if it doesn't exist) --> <!-- Download forge (if it doesn't exist) -->
<target name="download-forge" unless="forge-exists"> <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> </target>
<!-- Setup mcp and forge --> <!-- 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.green=Engine Green
gate.trigger.engine.yellow=Engine Yellow gate.trigger.engine.yellow=Engine Yellow
gate.trigger.engine.red=Engine Red 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.contains=Fluid in Tank
gate.trigger.fluid.space=Space for Fluid gate.trigger.fluid.space=Space for Fluid
gate.trigger.fluid.full=Tank Full gate.trigger.fluid.full=Tank Full
gate.trigger.fluidlevel.below=Contains < %d%%
gate.trigger.inventory.empty=Inventory Empty gate.trigger.inventory.empty=Inventory Empty
gate.trigger.inventory.contains=Items in Inventory gate.trigger.inventory.contains=Items in Inventory
gate.trigger.inventory.space=Space 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.Version;
import buildcraft.core.blueprints.BptPlayerIndex; import buildcraft.core.blueprints.BptPlayerIndex;
import buildcraft.core.blueprints.BptRootIndex; import buildcraft.core.blueprints.BptRootIndex;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.BCLog; import buildcraft.core.utils.BCLog;
import cpw.mods.fml.common.Mod; 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.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent; 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.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
@ -91,18 +92,18 @@ import java.util.LinkedList;
import java.util.TreeMap; import java.util.TreeMap;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.client.event.TextureStitchEvent; 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.MinecraftForge;
import net.minecraftforge.common.Property; import net.minecraftforge.common.config.Property;
import net.minecraftforge.event.ForgeSubscribe;
@Mod(name = "BuildCraft Builders", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE) @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 extends BuildCraftMod {
public class BuildCraftBuilders {
public static final char BPT_SEP_CHARACTER = '-'; public static final char BPT_SEP_CHARACTER = '-';
public static final int LIBRARY_PAGE_SIZE = 12; public static final int LIBRARY_PAGE_SIZE = 12;
@ -145,12 +146,16 @@ public class BuildCraftBuilders {
@EventHandler @EventHandler
public void init(FMLInitializationEvent evt) { public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-BUILDERS", new PacketHandlerBuilders());
// Register gui handler // Register gui handler
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
// Register save handler // Register save handler
MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders()); MinecraftForge.EVENT_BUS.register(new EventHandlerBuilders());
/*
new BptBlock(0); // default bpt block new BptBlock(0); // default bpt block
new BptBlockIgnore(Block.snow.blockID); new BptBlockIgnore(Block.snow.blockID);
@ -236,7 +241,7 @@ public class BuildCraftBuilders {
new BptBlockInventory(libraryBlock.blockID); new BptBlockInventory(libraryBlock.blockID);
new BptBlockWallSide(markerBlock.blockID); new BptBlockWallSide(markerBlock.blockID);
new BptBlockWallSide(pathMarkerBlock.blockID); new BptBlockWallSide(pathMarkerBlock.blockID);*/
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();
@ -246,16 +251,6 @@ public class BuildCraftBuilders {
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent evt) { 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); 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."; fillerDestroyProp.comment = "If true, Filler will destroy blocks instead of breaking them.";
fillerDestroy = fillerDestroyProp.getBoolean(DefaultProps.FILLER_DESTROY); 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)"; 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); fillerLifespanNormal = fillerLifespanNormalProp.getInt(DefaultProps.FILLER_LIFESPAN_NORMAL);
templateItem = new ItemBlueprintTemplate(templateItemId.getInt());
templateItem = new ItemBlueprintTemplate();
templateItem.setUnlocalizedName("templateItem"); templateItem.setUnlocalizedName("templateItem");
LanguageRegistry.addName(templateItem, "Template"); LanguageRegistry.addName(templateItem, "Template");
CoreProxy.proxy.registerItem(templateItem); CoreProxy.proxy.registerItem(templateItem);
blueprintItem = new ItemBlueprintStandard(blueprintItemId.getInt()); blueprintItem = new ItemBlueprintStandard();
blueprintItem.setUnlocalizedName("blueprintItem"); blueprintItem.setUnlocalizedName("blueprintItem");
LanguageRegistry.addName(blueprintItem, "Blueprint"); LanguageRegistry.addName(blueprintItem, "Blueprint");
CoreProxy.proxy.registerItem(blueprintItem); CoreProxy.proxy.registerItem(blueprintItem);
markerBlock = new BlockMarker(markerId.getInt()); markerBlock = new BlockMarker();
CoreProxy.proxy.registerBlock(markerBlock.setUnlocalizedName("markerBlock")); CoreProxy.proxy.registerBlock(markerBlock.setBlockName("markerBlock"));
CoreProxy.proxy.addName(markerBlock, "Land Mark"); CoreProxy.proxy.addName(markerBlock, "Land Mark");
pathMarkerBlock = new BlockPathMarker(pathMarkerId.getInt()); pathMarkerBlock = new BlockPathMarker();
CoreProxy.proxy.registerBlock(pathMarkerBlock.setUnlocalizedName("pathMarkerBlock")); CoreProxy.proxy.registerBlock(pathMarkerBlock.setBlockName("pathMarkerBlock"));
CoreProxy.proxy.addName(pathMarkerBlock, "Path Mark"); CoreProxy.proxy.addName(pathMarkerBlock, "Path Mark");
fillerBlock = new BlockFiller(fillerId.getInt()); fillerBlock = new BlockFiller();
CoreProxy.proxy.registerBlock(fillerBlock.setUnlocalizedName("fillerBlock")); CoreProxy.proxy.registerBlock(fillerBlock.setBlockName("fillerBlock"));
CoreProxy.proxy.addName(fillerBlock, "Filler"); CoreProxy.proxy.addName(fillerBlock, "Filler");
builderBlock = new BlockBuilder(builderId.getInt()); builderBlock = new BlockBuilder();
CoreProxy.proxy.registerBlock(builderBlock.setUnlocalizedName("builderBlock")); CoreProxy.proxy.registerBlock(builderBlock.setBlockName("builderBlock"));
CoreProxy.proxy.addName(builderBlock, "Builder"); CoreProxy.proxy.addName(builderBlock, "Builder");
architectBlock = new BlockArchitect(architectId.getInt()); architectBlock = new BlockArchitect();
CoreProxy.proxy.registerBlock(architectBlock.setUnlocalizedName("architectBlock")); CoreProxy.proxy.registerBlock(architectBlock.setBlockName("architectBlock"));
CoreProxy.proxy.addName(architectBlock, "Architect Table"); CoreProxy.proxy.addName(architectBlock, "Architect Table");
libraryBlock = new BlockBlueprintLibrary(libraryId.getInt()); libraryBlock = new BlockBlueprintLibrary();
CoreProxy.proxy.registerBlock(libraryBlock.setUnlocalizedName("libraryBlock")); CoreProxy.proxy.registerBlock(libraryBlock.setBlockName("libraryBlock"));
CoreProxy.proxy.addName(libraryBlock, "Blueprint Library"); CoreProxy.proxy.addName(libraryBlock, "Blueprint Library");
urbanistBlock = new BlockUrbanist (urbanistId.getInt()); urbanistBlock = new BlockUrbanist ();
CoreProxy.proxy.registerBlock(urbanistBlock.setUnlocalizedName("urbanistBlock")); CoreProxy.proxy.registerBlock(urbanistBlock.setBlockName("urbanistBlock"));
CoreProxy.proxy.addName(urbanistBlock, "Urbanist"); CoreProxy.proxy.addName(urbanistBlock, "Urbanist");
CoreProxy.proxy.registerTileEntity(TileUrbanist.class, "net.minecraft.src.builders.TileUrbanist"); 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}); // new ItemStack(Item.dyePowder, 1, 0), 'p', Item.paper});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(blueprintItem, 1), new Object[]{"ppp", "pip", "ppp", 'i', 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', 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', // CoreProxy.proxy.addCraftingRecipe(new ItemStack(pathMarkerBlock, 1), new Object[]{"l ", "r ", 'l',
// new ItemStack(Item.dyePowder, 1, 2), 'r', Block.torchRedstoneActive}); // new ItemStack(Item.dyePowder, 1, 2), 'r', Block.torchRedstoneActive});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(fillerBlock, 1), new Object[]{"btb", "ycy", "gCg", 'b', 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), new ItemStack(Items.dye, 1, 0), 't', markerBlock, 'y', new ItemStack(Items.dye, 1, 11),
'c', Block.workbench, 'g', BuildCraftCore.goldGearItem, 'C', Block.chest}); 'c', Blocks.crafting_table, 'g', BuildCraftCore.goldGearItem, 'C', Blocks.chest});
// CoreProxy.proxy.addCraftingRecipe(new ItemStack(builderBlock, 1), new Object[]{"btb", "ycy", "gCg", 'b', // 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), // 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)}); // new ItemStack(templateItem, 1)});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(libraryBlock, 1), new Object[]{"bbb", "bBb", "bbb", 'b', 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 @EventHandler
@ -411,8 +407,8 @@ public class BuildCraftBuilders {
return rootBptIndex; return rootBptIndex;
} }
public static ItemStack getBptItemStack(int id, int damage, String name) { public static ItemStack getBptItemStack(Item item, int damage, String name) {
ItemStack stack = new ItemStack(id, 1, damage); ItemStack stack = new ItemStack(item, 1, damage);
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
if (name != null && !"".equals(name)) { if (name != null && !"".equals(name)) {
nbt.setString("BptName", name); nbt.setString("BptName", name);
@ -432,20 +428,20 @@ public class BuildCraftBuilders {
TilePathMarker.clearAvailableMarkersList(); TilePathMarker.clearAvailableMarkersList();
} }
@ForgeSubscribe @SubscribeEvent
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre evt) { public void loadTextures(TextureStitchEvent.Pre evt) {
if (evt.map.textureType == 0) { if (evt.map.getTextureType() == 0) {
for (FillerPattern pattern : FillerPattern.patterns.values()) { for (FillerPattern pattern : FillerPattern.patterns.values()) {
pattern.registerIcon(evt.map); pattern.registerIcon(evt.map);
} }
} }
} }
@ForgeSubscribe @SubscribeEvent
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Pre event) { public void textureHook(TextureStitchEvent.Pre event) {
if (event.map.textureType == 1) { if (event.map.getTextureType() == 1) {
UrbanistToolsIconProvider.INSTANCE.registerIcons(event.map); UrbanistToolsIconProvider.INSTANCE.registerIcons(event.map);
} }
} }

View file

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

View file

@ -37,6 +37,7 @@ import buildcraft.energy.worldgen.BiomeGenOilDesert;
import buildcraft.energy.worldgen.BiomeGenOilOcean; import buildcraft.energy.worldgen.BiomeGenOilOcean;
import buildcraft.energy.worldgen.BiomeInitializer; import buildcraft.energy.worldgen.BiomeInitializer;
import buildcraft.energy.worldgen.OilPopulate; import buildcraft.energy.worldgen.OilPopulate;
import buildcraft.transport.network.PacketHandlerTransport;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; 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.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; 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.network.NetworkRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
@ -54,22 +55,22 @@ import java.util.TreeMap;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; 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.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.client.event.TextureStitchEvent; 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.MinecraftForge;
import net.minecraftforge.common.Property; import net.minecraftforge.common.config.Property;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@Mod(name = "BuildCraft Energy", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Energy", dependencies = DefaultProps.DEPENDENCY_CORE) @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 extends BuildCraftMod {
public class BuildCraftEnergy {
public final static int ENERGY_REMOVE_BLOCK = 25; public final static int ENERGY_REMOVE_BLOCK = 25;
public final static int ENERGY_EXTRACT_ITEM = 2; public final static int ENERGY_EXTRACT_ITEM = 2;
@ -103,22 +104,7 @@ public class BuildCraftEnergy {
public static BuildCraftEnergy instance; public static BuildCraftEnergy instance;
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent evt) { 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 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); 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); 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 (oilDesertBiomeId > 0) {
if (BiomeGenBase.biomeList[oilDesertBiomeId] != null) { if (BiomeGenBase.getBiomeGenArray () [oilDesertBiomeId] != null) {
throw new BiomeIdException("oilDesert", oilDesertBiomeId); throw new BiomeIdException("oilDesert", oilDesertBiomeId);
} }
biomeOilDesert = BiomeGenOilDesert.makeBiome(oilDesertBiomeId); biomeOilDesert = BiomeGenOilDesert.makeBiome(oilDesertBiomeId);
} }
if (oilOceanBiomeId > 0) { if (oilOceanBiomeId > 0) {
if (BiomeGenBase.biomeList[oilOceanBiomeId] != null) { if (BiomeGenBase.getBiomeGenArray () [oilOceanBiomeId] != null) {
throw new BiomeIdException("oilOcean", oilOceanBiomeId); throw new BiomeIdException("oilOcean", oilOceanBiomeId);
} }
biomeOilOcean = BiomeGenOilOcean.makeBiome(oilOceanBiomeId); biomeOilOcean = BiomeGenOilOcean.makeBiome(oilOceanBiomeId);
} }
engineBlock = new BlockEngine(engineId.getInt(DefaultProps.ENGINE_ID)); engineBlock = new BlockEngine();
CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class); CoreProxy.proxy.registerBlock(engineBlock, ItemEngine.class);
LanguageRegistry.addName(new ItemStack(engineBlock, 1, 0), "Redstone Engine"); LanguageRegistry.addName(new ItemStack(engineBlock, 1, 0), "Redstone Engine");
@ -171,18 +157,14 @@ public class BuildCraftEnergy {
FluidRegistry.registerFluid(buildcraftFluidRedPlasma); FluidRegistry.registerFluid(buildcraftFluidRedPlasma);
fluidRedPlasma = FluidRegistry.getFluid("redplasma"); fluidRedPlasma = FluidRegistry.getFluid("redplasma");
//buildcraftFluidRedPlasma = new BCFluid("fuel"); if (fluidOil.getBlock() == null) {
blockOil = new BlockBuildcraftFluid(fluidOil, Material.water).setFlammable(canOilBurn).setFlammability(0);
if (fluidOil.getBlockID() == -1) { blockOil.setBlockName("blockOil");
if (blockOilId > 0) { CoreProxy.proxy.addName(blockOil, "Oil");
blockOil = new BlockBuildcraftFluid(blockOilId, fluidOil, Material.water).setFlammable(canOilBurn).setFlammability(0); CoreProxy.proxy.registerBlock(blockOil);
blockOil.setUnlocalizedName("blockOil"); fluidOil.setBlock(blockOil);
CoreProxy.proxy.addName(blockOil, "Oil");
CoreProxy.proxy.registerBlock(blockOil);
fluidOil.setBlockID(blockOil);
}
} else { } else {
blockOil = Block.blocksList[fluidOil.getBlockID()]; blockOil = fluidOil.getBlock();
} }
if (blockOil != null) { if (blockOil != null) {
@ -191,60 +173,57 @@ public class BuildCraftEnergy {
BlockSpring.EnumSpring.OIL.liquidBlock = blockOil; BlockSpring.EnumSpring.OIL.liquidBlock = blockOil;
} }
if (fluidFuel.getBlockID() == -1) { if (fluidFuel.getBlock() == null) {
if (blockFuelId > 0) { blockFuel = new BlockBuildcraftFluid(fluidFuel, Material.water).setFlammable(true).setFlammability(5).setParticleColor(0.7F, 0.7F, 0.0F);
blockFuel = new BlockBuildcraftFluid(blockFuelId, fluidFuel, Material.water).setFlammable(true).setFlammability(5).setParticleColor(0.7F, 0.7F, 0.0F); blockFuel.setBlockName("blockFuel");
blockFuel.setUnlocalizedName("blockFuel"); CoreProxy.proxy.addName(blockFuel, "Fuel");
CoreProxy.proxy.addName(blockFuel, "Fuel"); CoreProxy.proxy.registerBlock(blockFuel);
CoreProxy.proxy.registerBlock(blockFuel); fluidFuel.setBlock(blockFuel);
fluidFuel.setBlockID(blockFuel);
}
} else { } else {
blockFuel = Block.blocksList[fluidFuel.getBlockID()]; blockFuel = fluidFuel.getBlock();
} }
if (fluidRedPlasma.getBlockID() == -1) { if (fluidRedPlasma.getBlock() == null) {
if (blockRedplasmaId > 0) { blockRedPlasma = new BlockBuildcraftFluid(fluidRedPlasma, Material.water).setFlammable(false).setParticleColor(0.9F, 0, 0);
blockRedPlasma = new BlockBuildcraftFluid(blockRedplasmaId, fluidRedPlasma, Material.water).setFlammable(false).setParticleColor(0.9F, 0, 0); blockRedPlasma.setBlockName("blockRedPlasma");
blockRedPlasma.setUnlocalizedName("blockRedPlasma"); CoreProxy.proxy.addName(blockRedPlasma, "Red Plasma");
CoreProxy.proxy.addName(blockRedPlasma, "Red Plasma"); CoreProxy.proxy.registerBlock(blockRedPlasma);
CoreProxy.proxy.registerBlock(blockRedPlasma); fluidRedPlasma.setBlock(blockRedPlasma);
fluidRedPlasma.setBlockID(blockRedPlasma);
}
} else { } else {
blockRedPlasma = Block.blocksList[fluidRedPlasma.getBlockID()]; blockRedPlasma = fluidRedPlasma.getBlock();
} }
// Buckets // Buckets
if (blockOil != null && bucketOilId > 0) { if (blockOil != null) {
bucketOil = new ItemBucketBuildcraft(bucketOilId, blockOil.blockID); bucketOil = new ItemBucketBuildcraft(blockOil);
bucketOil.setUnlocalizedName("bucketOil").setContainerItem(Item.bucketEmpty); bucketOil.setUnlocalizedName("bucketOil").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketOil, "Oil Bucket"); LanguageRegistry.addName(bucketOil, "Oil Bucket");
CoreProxy.proxy.registerItem(bucketOil); 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) { if (blockFuel != null) {
bucketFuel = new ItemBucketBuildcraft(bucketFuelId, blockFuel.blockID); bucketFuel = new ItemBucketBuildcraft(blockFuel);
bucketFuel.setUnlocalizedName("bucketFuel").setContainerItem(Item.bucketEmpty); bucketFuel.setUnlocalizedName("bucketFuel").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketFuel, "Fuel Bucket"); LanguageRegistry.addName(bucketFuel, "Fuel Bucket");
CoreProxy.proxy.registerItem(bucketFuel); 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) { if (blockRedPlasma != null) {
bucketRedPlasma = new ItemBucketBuildcraft(bucketRedPlasmaId, blockRedPlasma.blockID); bucketRedPlasma = new ItemBucketBuildcraft(blockRedPlasma);
bucketRedPlasma.setUnlocalizedName("bucketRedPlasma").setContainerItem(Item.bucketEmpty); bucketRedPlasma.setUnlocalizedName("bucketRedPlasma").setContainerItem(Items.bucket);
LanguageRegistry.addName(bucketRedPlasma, "Red Plasma Bucket"); LanguageRegistry.addName(bucketRedPlasma, "Red Plasma Bucket");
CoreProxy.proxy.registerItem(bucketRedPlasma); 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); // TODO: Are these still really necessary? If not, remove the
BucketHandler.INSTANCE.buckets.put(blockFuel, bucketFuel); // BucketHandler class as well.
BucketHandler.INSTANCE.buckets.put(blockRedPlasma, bucketRedPlasma); //BucketHandler.INSTANCE.buckets.put(blockOil, bucketOil);
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); //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); BuildcraftRecipes.refinery.addRecipe(new FluidStack(fluidOil, 1), new FluidStack(fluidFuel, 1), 12, 1);
@ -255,19 +234,17 @@ public class BuildCraftEnergy {
// Iron Engine Coolants // Iron Engine Coolants
IronEngineCoolant.addCoolant(FluidRegistry.getFluid("water"), 0.0023F); 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 // Receiver / emitter
Property emitterId = BuildCraftCore.mainConfiguration.getBlock("energyEmitter.id", DefaultProps.EMITTER_ID); emitterBlock = new BlockEnergyEmitter ();
emitterBlock = new BlockEnergyEmitter (emitterId.getInt()); CoreProxy.proxy.registerBlock(emitterBlock.setBlockName("energyEmitterBlock"));
CoreProxy.proxy.registerBlock(emitterBlock.setUnlocalizedName("energyEmitterBlock"));
CoreProxy.proxy.addName(emitterBlock, "Energy Emitter"); CoreProxy.proxy.addName(emitterBlock, "Energy Emitter");
CoreProxy.proxy.registerTileEntity(TileEnergyEmitter.class, "net.minecraft.src.builders.TileEnergyEmitter"); CoreProxy.proxy.registerTileEntity(TileEnergyEmitter.class, "net.minecraft.src.builders.TileEnergyEmitter");
Property receiverId = BuildCraftCore.mainConfiguration.getBlock("energyReceiver.id", DefaultProps.RECEIVER_ID); receiverBlock = new BlockEnergyReceiver ();
receiverBlock = new BlockEnergyReceiver (receiverId.getInt()); CoreProxy.proxy.registerBlock(receiverBlock.setBlockName("energyReceiverBlock"));
CoreProxy.proxy.registerBlock(receiverBlock.setUnlocalizedName("energyReceiverBlock"));
CoreProxy.proxy.addName(receiverBlock, "Energy Receiver"); CoreProxy.proxy.addName(receiverBlock, "Energy Receiver");
CoreProxy.proxy.registerTileEntity(TileEnergyReceiver.class, "net.minecraft.src.builders.TileEnergyReceiver"); CoreProxy.proxy.registerTileEntity(TileEnergyReceiver.class, "net.minecraft.src.builders.TileEnergyReceiver");
@ -276,9 +253,12 @@ public class BuildCraftEnergy {
@EventHandler @EventHandler
public void init(FMLInitializationEvent evt) { public void init(FMLInitializationEvent evt) {
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler()); channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new PacketHandlerTransport());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
new BptBlockEngine(engineBlock.blockID); //new BptBlockEngine(engineBlock.blockID);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();
@ -295,10 +275,10 @@ public class BuildCraftEnergy {
} }
} }
@ForgeSubscribe @SubscribeEvent
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Post event) { public void textureHook(TextureStitchEvent.Post event) {
if (event.map.textureType == 0) { if (event.map.getTextureType() == 0) {
buildcraftFluidOil.setIcons(blockOil.getBlockTextureFromSide(1), blockOil.getBlockTextureFromSide(2)); buildcraftFluidOil.setIcons(blockOil.getBlockTextureFromSide(1), blockOil.getBlockTextureFromSide(2));
buildcraftFluidFuel.setIcons(blockFuel.getBlockTextureFromSide(1), blockFuel.getBlockTextureFromSide(2)); buildcraftFluidFuel.setIcons(blockFuel.getBlockTextureFromSide(1), blockFuel.getBlockTextureFromSide(2));
buildcraftFluidRedPlasma.setIcons(blockRedPlasma.getBlockTextureFromSide(1), blockRedPlasma.getBlockTextureFromSide(2)); buildcraftFluidRedPlasma.setIcons(blockRedPlasma.getBlockTextureFromSide(1), blockRedPlasma.getBlockTextureFromSide(2));
@ -307,116 +287,16 @@ public class BuildCraftEnergy {
public static void loadRecipes() { public static void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0), CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0),
new Object[]{"www", " g ", "GpG", 'w', "plankWood", 'g', Block.glass, 'G', new Object[]{"www", " g ", "GpG", 'w', "plankWood", 'g', Blocks.glass, 'G',
BuildCraftCore.woodenGearItem, 'p', Block.pistonBase}); BuildCraftCore.woodenGearItem, 'p', Blocks.piston});
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), new Object[]{"www", " g ", "GpG", 'w', "cobblestone", CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), new Object[]{"www", " g ", "GpG", 'w', "cobblestone",
'g', Block.glass, 'G', BuildCraftCore.stoneGearItem, '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', Item.ingotIron, CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), new Object[]{"www", " g ", "GpG", 'w', Items.iron_ingot,
'g', Block.glass, 'G', BuildCraftCore.ironGearItem, 'p', Block.pistonBase}); 'g', Blocks.glass, 'G', BuildCraftCore.ironGearItem, 'p', Blocks.piston});
} }
@EventHandler @EventHandler
public void processIMCRequests(FMLInterModComms.IMCEvent event) { public void processIMCRequests(FMLInterModComms.IMCEvent event) {
InterModComms.processIMC(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.DefaultProps;
import buildcraft.core.InterModComms; import buildcraft.core.InterModComms;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.ConfigUtils; import buildcraft.core.utils.ConfigUtils;
import buildcraft.factory.BlockAutoWorkbench; import buildcraft.factory.BlockAutoWorkbench;
@ -40,7 +41,9 @@ import buildcraft.factory.TileQuarry;
import buildcraft.factory.TileRefinery; import buildcraft.factory.TileRefinery;
import buildcraft.factory.TileTank; import buildcraft.factory.TileTank;
import buildcraft.factory.network.PacketHandlerFactory; import buildcraft.factory.network.PacketHandlerFactory;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; 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.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; 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.network.NetworkRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap; 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.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.event.TextureStitchEvent; 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;
import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.common.ForgeChunkManager.Ticket;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.Property; import net.minecraftforge.common.config.Property;
import net.minecraftforge.event.ForgeSubscribe;
@Mod(name = "BuildCraft Factory", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Factory", dependencies = DefaultProps.DEPENDENCY_CORE) @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 extends BuildCraftMod {
public class BuildCraftFactory {
public static final int MINING_MJ_COST_PER_BLOCK = 64; public static final int MINING_MJ_COST_PER_BLOCK = 64;
public static BlockQuarry quarryBlock; public static BlockQuarry quarryBlock;
@ -103,7 +108,7 @@ public class BuildCraftFactory {
int quarryX = ticket.getModData().getInteger("quarryX"); int quarryX = ticket.getModData().getInteger("quarryX");
int quarryY = ticket.getModData().getInteger("quarryY"); int quarryY = ticket.getModData().getInteger("quarryY");
int quarryZ = ticket.getModData().getInteger("quarryZ"); 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); tq.forceChunkLoading(ticket);
} }
@ -117,8 +122,8 @@ public class BuildCraftFactory {
int quarryY = ticket.getModData().getInteger("quarryY"); int quarryY = ticket.getModData().getInteger("quarryY");
int quarryZ = ticket.getModData().getInteger("quarryZ"); int quarryZ = ticket.getModData().getInteger("quarryZ");
int blId = world.getBlockId(quarryX, quarryY, quarryZ); Block block = world.getBlock(quarryX, quarryY, quarryZ);
if (blId == quarryBlock.blockID) { if (block == quarryBlock) {
validTickets.add(ticket); validTickets.add(ticket);
} }
} }
@ -128,7 +133,7 @@ public class BuildCraftFactory {
@EventHandler @EventHandler
public void load(FMLInitializationEvent evt) { 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); // EntityRegistry.registerModEntity(EntityMechanicalArm.class, "bcMechanicalArm", EntityIds.MECHANICAL_ARM, instance, 50, 1, true);
@ -143,10 +148,10 @@ public class BuildCraftFactory {
FactoryProxy.proxy.initializeTileEntities(); FactoryProxy.proxy.initializeTileEntities();
new BptBlockAutoWorkbench(autoWorkbenchBlock.blockID); //new BptBlockAutoWorkbench(autoWorkbenchBlock.blockID);
new BptBlockFrame(frameBlock.blockID); //new BptBlockFrame(frameBlock.blockID);
new BptBlockRefinery(refineryBlock.blockID); //new BptBlockRefinery(refineryBlock.blockID);
new BptBlockTank(tankBlock.blockID); //new BptBlockTank(tankBlock.blockID);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();
@ -155,6 +160,9 @@ public class BuildCraftFactory {
@EventHandler @EventHandler
public void initialize(FMLPreInitializationEvent evt) { 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); ConfigUtils genCat = new ConfigUtils(BuildCraftCore.mainConfiguration, Configuration.CATEGORY_GENERAL);
allowMining = genCat.get("mining.enabled", true, "disables the recipes for automated mining machines"); allowMining = genCat.get("mining.enabled", true, "disables the recipes for automated mining machines");
@ -168,72 +176,52 @@ public class BuildCraftFactory {
+ "Entries are comma seperated, banned fluids have precedence over allowed ones." + "Entries are comma seperated, banned fluids have precedence over allowed ones."
+ "Default is \"+/*/*,+/-1/Lava\" - the second redundant entry (\"+/-1/lava\") is there to show the format."; + "Default is \"+/*/*,+/-1/Lava\" - the second redundant entry (\"+/-1/lava\") is there to show the format.";
pumpDimensionList = new PumpDimensionList(pumpList.getString()); 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()) { if (BuildCraftCore.mainConfiguration.hasChanged()) {
BuildCraftCore.mainConfiguration.save(); BuildCraftCore.mainConfiguration.save();
} }
if (miningWellId > 0) {
miningWellBlock = new BlockMiningWell(miningWellId); miningWellBlock = new BlockMiningWell();
CoreProxy.proxy.registerBlock(miningWellBlock.setUnlocalizedName("miningWellBlock")); CoreProxy.proxy.registerBlock(miningWellBlock.setBlockName("miningWellBlock"));
CoreProxy.proxy.addName(miningWellBlock, "Mining Well"); CoreProxy.proxy.addName(miningWellBlock, "Mining Well");
}
if (plainPipeId > 0) { plainPipeBlock = new BlockPlainPipe();
plainPipeBlock = new BlockPlainPipe(plainPipeId); CoreProxy.proxy.registerBlock(plainPipeBlock.setBlockName("plainPipeBlock"));
CoreProxy.proxy.registerBlock(plainPipeBlock.setUnlocalizedName("plainPipeBlock")); CoreProxy.proxy.addName(plainPipeBlock, "Mining Pipe");
CoreProxy.proxy.addName(plainPipeBlock, "Mining Pipe");
} autoWorkbenchBlock = new BlockAutoWorkbench();
if (autoWorkbenchId > 0) { CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setBlockName("autoWorkbenchBlock"));
autoWorkbenchBlock = new BlockAutoWorkbench(autoWorkbenchId); CoreProxy.proxy.addName(autoWorkbenchBlock, "Automatic Crafting Table");
CoreProxy.proxy.registerBlock(autoWorkbenchBlock.setUnlocalizedName("autoWorkbenchBlock"));
CoreProxy.proxy.addName(autoWorkbenchBlock, "Automatic Crafting Table"); frameBlock = new BlockFrame();
} CoreProxy.proxy.registerBlock(frameBlock.setBlockName("frameBlock"));
if (frameId > 0) { CoreProxy.proxy.addName(frameBlock, "Frame");
frameBlock = new BlockFrame(frameId);
CoreProxy.proxy.registerBlock(frameBlock.setUnlocalizedName("frameBlock")); quarryBlock = new BlockQuarry();
CoreProxy.proxy.addName(frameBlock, "Frame"); CoreProxy.proxy.registerBlock(quarryBlock.setBlockName("machineBlock"));
} CoreProxy.proxy.addName(quarryBlock, "Quarry");
if (quarryId > 0) {
quarryBlock = new BlockQuarry(quarryId); tankBlock = new BlockTank();
CoreProxy.proxy.registerBlock(quarryBlock.setUnlocalizedName("machineBlock")); CoreProxy.proxy.registerBlock(tankBlock.setBlockName("tankBlock"));
CoreProxy.proxy.addName(quarryBlock, "Quarry"); CoreProxy.proxy.addName(tankBlock, "Tank");
}
if (tankId > 0) { pumpBlock = new BlockPump();
tankBlock = new BlockTank(tankId); CoreProxy.proxy.registerBlock(pumpBlock.setBlockName("pumpBlock"));
CoreProxy.proxy.registerBlock(tankBlock.setUnlocalizedName("tankBlock")); CoreProxy.proxy.addName(pumpBlock, "Pump");
CoreProxy.proxy.addName(tankBlock, "Tank");
} floodGateBlock = new BlockFloodGate();
if (pumpId > 0) { CoreProxy.proxy.registerBlock(floodGateBlock.setBlockName("floodGateBlock"));
pumpBlock = new BlockPump(pumpId); CoreProxy.proxy.addName(floodGateBlock, "Flood Gate");
CoreProxy.proxy.registerBlock(pumpBlock.setUnlocalizedName("pumpBlock"));
CoreProxy.proxy.addName(pumpBlock, "Pump"); refineryBlock = new BlockRefinery();
} CoreProxy.proxy.registerBlock(refineryBlock.setBlockName("refineryBlock"));
if (floodGateId > 0) { CoreProxy.proxy.addName(refineryBlock, "Refinery");
floodGateBlock = new BlockFloodGate(floodGateId);
CoreProxy.proxy.registerBlock(floodGateBlock.setUnlocalizedName("floodGateBlock")); hopperBlock = new BlockHopper();
CoreProxy.proxy.addName(floodGateBlock, "Flood Gate"); CoreProxy.proxy.registerBlock(hopperBlock.setBlockName("blockHopper"));
} CoreProxy.proxy.addName(hopperBlock, "Hopper");
if (refineryId > 0) {
refineryBlock = new BlockRefinery(refineryId);
CoreProxy.proxy.registerBlock(refineryBlock.setUnlocalizedName("refineryBlock"));
CoreProxy.proxy.addName(refineryBlock, "Refinery");
}
if (hopperId > 0) {
hopperBlock = new BlockHopper(hopperId);
CoreProxy.proxy.registerBlock(hopperBlock.setUnlocalizedName("blockHopper"));
CoreProxy.proxy.addName(hopperBlock, "Hopper");
}
FactoryProxy.proxy.initializeEntityRenders(); FactoryProxy.proxy.initializeEntityRenders();
if (BuildCraftCore.mainConfiguration.hasChanged()) { if (BuildCraftCore.mainConfiguration.hasChanged()) {
@ -251,10 +239,10 @@ public class BuildCraftFactory {
"ipi", "ipi",
"igi", "igi",
"iPi", "iPi",
'p', Item.redstone, 'p', Items.redstone,
'i', Item.ingotIron, 'i', Items.iron_ingot,
'g', BuildCraftCore.ironGearItem, 'g', BuildCraftCore.ironGearItem,
'P', Item.pickaxeIron); 'P', Items.iron_pickaxe);
if (quarryBlock != null) if (quarryBlock != null)
CoreProxy.proxy.addCraftingRecipe( CoreProxy.proxy.addCraftingRecipe(
@ -263,16 +251,16 @@ public class BuildCraftFactory {
"gig", "gig",
"dDd", "dDd",
'i', BuildCraftCore.ironGearItem, 'i', BuildCraftCore.ironGearItem,
'p', Item.redstone, 'p', Items.redstone,
'g', BuildCraftCore.goldGearItem, 'g', BuildCraftCore.goldGearItem,
'd', BuildCraftCore.diamondGearItem, 'd', BuildCraftCore.diamondGearItem,
'D', Item.pickaxeDiamond); 'D', Items.diamond_pickaxe);
if (pumpBlock != null && miningWellBlock != null) if (pumpBlock != null && miningWellBlock != null)
CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock), CoreProxy.proxy.addCraftingRecipe(new ItemStack(pumpBlock),
"T", "T",
"W", "W",
'T', tankBlock != null ? tankBlock : Block.glass, 'T', tankBlock != null ? tankBlock : Blocks.glass,
'W', miningWellBlock); 'W', miningWellBlock);
} }
@ -282,9 +270,9 @@ public class BuildCraftFactory {
"iri", "iri",
"iTi", "iTi",
"gpg", "gpg",
'r', Item.redstone, 'r', Items.redstone,
'i', Item.ingotIron, 'i', Items.iron_ingot,
'T', tankBlock != null ? tankBlock : Block.glass, 'T', tankBlock != null ? tankBlock : Blocks.glass,
'g', BuildCraftCore.ironGearItem, 'g', BuildCraftCore.ironGearItem,
'p', BuildCraftTransport.pipeFluidsGold); 'p', BuildCraftTransport.pipeFluidsGold);
} }
@ -294,7 +282,7 @@ public class BuildCraftFactory {
" g ", " g ",
"gwg", "gwg",
" g ", " g ",
'w', Block.workbench, 'w', Blocks.crafting_table,
'g', BuildCraftCore.woodenGearItem); 'g', BuildCraftCore.woodenGearItem);
@ -303,23 +291,23 @@ public class BuildCraftFactory {
"ggg", "ggg",
"g g", "g g",
"ggg", "ggg",
'g', Block.glass); 'g', Blocks.glass);
if (refineryBlock != null) if (refineryBlock != null)
CoreProxy.proxy.addCraftingRecipe(new ItemStack(refineryBlock), CoreProxy.proxy.addCraftingRecipe(new ItemStack(refineryBlock),
"RTR", "RTR",
"TGT", "TGT",
'T', tankBlock != null ? tankBlock : Block.glass, 'T', tankBlock != null ? tankBlock : Blocks.glass,
'G', BuildCraftCore.diamondGearItem, 'G', BuildCraftCore.diamondGearItem,
'R', Block.torchRedstoneActive); 'R', Blocks.redstone_torch);
if (hopperBlock != null) if (hopperBlock != null)
CoreProxy.proxy.addCraftingRecipe(new ItemStack(hopperBlock), CoreProxy.proxy.addCraftingRecipe(new ItemStack(hopperBlock),
"ICI", "ICI",
"IGI", "IGI",
" I ", " I ",
'I', Item.ingotIron, 'I', Items.iron_ingot,
'C', Block.chest, 'C', Blocks.chest,
'G', BuildCraftCore.stoneGearItem); 'G', BuildCraftCore.stoneGearItem);
if (floodGateBlock != null) if (floodGateBlock != null)
@ -327,10 +315,10 @@ public class BuildCraftFactory {
"IGI", "IGI",
"FTF", "FTF",
"IFI", "IFI",
'I', Item.ingotIron, 'I', Items.iron_ingot,
'T', tankBlock != null ? tankBlock : Block.glass, 'T', tankBlock != null ? tankBlock : Blocks.glass,
'G', BuildCraftCore.ironGearItem, 'G', BuildCraftCore.ironGearItem,
'F', new ItemStack(Block.fenceIron)); 'F', new ItemStack(Blocks.iron_bars));
} }
@EventHandler @EventHandler
@ -338,10 +326,10 @@ public class BuildCraftFactory {
InterModComms.processIMC(event); InterModComms.processIMC(event);
} }
@ForgeSubscribe @SubscribeEvent
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void loadTextures(TextureStitchEvent.Pre evt) { public void loadTextures(TextureStitchEvent.Pre evt) {
if (evt.map.textureType == 0) { if (evt.map.getTextureType() == 0) {
TextureMap terrainTextures = evt.map; TextureMap terrainTextures = evt.map;
FactoryProxyClient.pumpTexture = terrainTextures.registerIcon("buildcraft:pump_tube"); FactoryProxyClient.pumpTexture = terrainTextures.registerIcon("buildcraft:pump_tube");
FactoryProxyClient.drillTexture = terrainTextures.registerIcon("buildcraft:blockDrillTexture"); 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;
import buildcraft.silicon.ItemRedstoneChipset.Chipset; import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.silicon.BlockLaser; import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.BlockLaserTable; 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.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; 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.network.NetworkRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; 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) @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 extends BuildCraftMod {
public class BuildCraftSilicon {
public static ItemRedstoneChipset redstoneChipset; public static ItemRedstoneChipset redstoneChipset;
public static BlockLaser laserBlock; public static BlockLaser laserBlock;
@ -64,27 +67,21 @@ public class BuildCraftSilicon {
public static BuildCraftSilicon instance; public static BuildCraftSilicon instance;
@EventHandler @EventHandler
public void preInit(FMLPreInitializationEvent evt) { 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(); BuildCraftCore.mainConfiguration.save();
laserBlock = new BlockLaser(laserId.getInt()); laserBlock = new BlockLaser();
CoreProxy.proxy.addName(laserBlock.setUnlocalizedName("laserBlock"), "Laser"); CoreProxy.proxy.addName(laserBlock.setBlockName("laserBlock"), "Laser");
CoreProxy.proxy.registerBlock(laserBlock); CoreProxy.proxy.registerBlock(laserBlock);
assemblyTableBlock = new BlockLaserTable(assemblyTableId.getInt()); assemblyTableBlock = new BlockLaserTable();
CoreProxy.proxy.registerBlock(assemblyTableBlock, ItemLaserTable.class); CoreProxy.proxy.registerBlock(assemblyTableBlock, ItemLaserTable.class);
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 0), "Assembly Table"); 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, 1), "Advanced Crafting Table");
LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 2), "Integration Table"); LanguageRegistry.addName(new ItemStack(assemblyTableBlock, 0, 2), "Integration Table");
redstoneChipset = new ItemRedstoneChipset(redstoneChipsetId.getInt()); redstoneChipset = new ItemRedstoneChipset();
redstoneChipset.setUnlocalizedName("redstoneChipset"); redstoneChipset.setUnlocalizedName("redstoneChipset");
CoreProxy.proxy.registerItem(redstoneChipset); CoreProxy.proxy.registerItem(redstoneChipset);
redstoneChipset.registerItemStacks(); redstoneChipset.registerItemStacks();
@ -92,14 +89,17 @@ public class BuildCraftSilicon {
@EventHandler @EventHandler
public void init(FMLInitializationEvent evt) { 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(TileLaser.class, "net.minecraft.src.buildcraft.factory.TileLaser");
CoreProxy.proxy.registerTileEntity(TileAssemblyTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyTable"); 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(TileAdvancedCraftingTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench");
CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class, "net.minecraft.src.buildcraft.factory.TileIntegrationTable"); CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class, "net.minecraft.src.buildcraft.factory.TileIntegrationTable");
new BptBlockRotateMeta(laserBlock.blockID, new int[]{2, 5, 3, 4}, true); //new BptBlockRotateMeta(laserBlock.blockID, new int[]{2, 5, 3, 4}, true);
new BptBlockInventory(assemblyTableBlock.blockID); //new BptBlockInventory(assemblyTableBlock.blockID);
if (BuildCraftCore.loadDefaultRecipes) { if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes(); loadRecipes();
@ -115,51 +115,51 @@ public class BuildCraftSilicon {
"ORR", "ORR",
"DDR", "DDR",
"ORR", "ORR",
'O', Block.obsidian, 'O', Blocks.obsidian,
'R', Item.redstone, 'R', Items.redstone,
'D', Item.diamond); 'D', Items.diamond);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0), CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0),
"ORO", "ORO",
"ODO", "ODO",
"OGO", "OGO",
'O', Block.obsidian, 'O', Blocks.obsidian,
'R', Item.redstone, 'R', Items.redstone,
'D', Item.diamond, 'D', Items.diamond,
'G', BuildCraftCore.diamondGearItem); 'G', BuildCraftCore.diamondGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1), CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1),
"OWO", "OWO",
"OCO", "OCO",
"ORO", "ORO",
'O', Block.obsidian, 'O', Blocks.obsidian,
'W', Block.workbench, 'W', Blocks.crafting_table,
'C', Block.chest, 'C', Blocks.chest,
'R', new ItemStack(redstoneChipset, 1, 0)); 'R', new ItemStack(redstoneChipset, 1, 0));
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 2), CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 2),
"ORO", "ORO",
"OCO", "OCO",
"OGO", "OGO",
'O', Block.obsidian, 'O', Blocks.obsidian,
'R', Item.redstone, 'R', Items.redstone,
'C', new ItemStack(redstoneChipset, 1, 0), 'C', new ItemStack(redstoneChipset, 1, 0),
'G', BuildCraftCore.diamondGearItem); 'G', BuildCraftCore.diamondGearItem);
// PIPE WIRE // PIPE WIRE
BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.RED.getStack(8), "dyeRed", 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, Item.redstone, Item.ingotIron); 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, Item.redstone, Item.ingotIron); 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, Item.redstone, Item.ingotIron); BuildcraftRecipes.assemblyTable.addRecipe(500, PipeWire.YELLOW.getStack(8), "dyeYellow", 1, Items.redstone, Items.iron_ingot);
// CHIPSETS // CHIPSETS
BuildcraftRecipes.assemblyTable.addRecipe(10000, Chipset.RED.getStack(), Item.redstone); BuildcraftRecipes.assemblyTable.addRecipe(10000, Chipset.RED.getStack(), Items.redstone);
BuildcraftRecipes.assemblyTable.addRecipe(20000, Chipset.IRON.getStack(), Item.redstone, Item.ingotIron); BuildcraftRecipes.assemblyTable.addRecipe(20000, Chipset.IRON.getStack(), Items.redstone, Items.iron_ingot);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.GOLD.getStack(), Item.redstone, Item.ingotGold); BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.GOLD.getStack(), Items.redstone, Items.gold_ingot);
BuildcraftRecipes.assemblyTable.addRecipe(80000, Chipset.DIAMOND.getStack(), Item.redstone, Item.diamond); BuildcraftRecipes.assemblyTable.addRecipe(80000, Chipset.DIAMOND.getStack(), Items.redstone, Items.diamond);
BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.PULSATING.getStack(2), Item.redstone, Item.enderPearl); BuildcraftRecipes.assemblyTable.addRecipe(40000, Chipset.PULSATING.getStack(2), Items.redstone, Items.ender_pearl);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.QUARTZ.getStack(), Item.redstone, Item.netherQuartz); BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.QUARTZ.getStack(), Items.redstone, Items.quartz);
BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.COMP.getStack(), Item.redstone, Item.comparator); BuildcraftRecipes.assemblyTable.addRecipe(60000, Chipset.COMP.getStack(), Items.redstone, Items.comparator);
// GATES // GATES
BuildcraftRecipes.assemblyTable.addRecipe(10000, ItemGate.makeGateItem(GateMaterial.REDSTONE, GateLogic.AND), Chipset.RED.getStack(), PipeWire.RED.getStack()); 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.InterModComms;
import buildcraft.core.ItemBuildCraft; import buildcraft.core.ItemBuildCraft;
import buildcraft.core.Version; import buildcraft.core.Version;
import buildcraft.core.network.PacketHandler;
import buildcraft.core.proxy.CoreProxy; import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.BCAction; import buildcraft.core.triggers.BCAction;
import buildcraft.core.triggers.BCTrigger; import buildcraft.core.triggers.BCTrigger;
@ -46,7 +47,7 @@ import buildcraft.transport.ItemPipeWire;
import buildcraft.transport.gates.GateExpansionRedstoneFader; import buildcraft.transport.gates.GateExpansionRedstoneFader;
import buildcraft.transport.gates.GateExpansionTimer; import buildcraft.transport.gates.GateExpansionTimer;
import buildcraft.transport.network.PacketHandlerTransport; import buildcraft.transport.network.PacketHandlerTransport;
import buildcraft.transport.network.TransportConnectionHandler; import buildcraft.transport.network.PacketPipeTransportTraveler;
import buildcraft.transport.pipes.PipeFluidsCobblestone; import buildcraft.transport.pipes.PipeFluidsCobblestone;
import buildcraft.transport.pipes.PipeFluidsEmerald; import buildcraft.transport.pipes.PipeFluidsEmerald;
import buildcraft.transport.pipes.PipeFluidsGold; 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.FMLInterModComms.IMCEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; 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.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.common.registry.LanguageRegistry;
@ -108,17 +108,18 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.Property; import net.minecraftforge.common.config.Property;
@Mod(version = Version.VERSION, modid = "BuildCraft|Transport", name = "Buildcraft Transport", dependencies = DefaultProps.DEPENDENCY_CORE) @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 extends BuildCraftMod {
public class BuildCraftTransport {
public static BlockGenericPipe genericPipeBlock; public static BlockGenericPipe genericPipeBlock;
public static float pipeDurability; public static float pipeDurability;
@ -210,22 +211,24 @@ public class BuildCraftTransport {
return testStrings(liquids, world, i, j, k); return testStrings(liquids, world, i, j, k);
} }
private boolean testStrings(String[] excludedBlocks, World world, int i, int j, int k) { private boolean testStrings(String[] excludedBlocks, World world, int i, int j, int k) {
int id = world.getBlockId(i, j, k); Block block = world.getBlock(i, j, k);
Block block = Block.blocksList[id];
if (block == null) if (block == null)
return false; return false;
int meta = world.getBlockMetadata(i, j, k); 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())) if (excluded.equals(block.getUnlocalizedName()))
return false; return false;
String[] tokens = excluded.split(":"); String[] tokens = excluded.split(":");
if (tokens[0].equals(Integer.toString(id)) && (tokens.length == 1 || tokens[1].equals(Integer.toString(meta)))) if (tokens[0].equals(Integer.toString(id)) && (tokens.length == 1 || tokens[1].equals(Integer.toString(meta))))
return false; return false;
} }*/
return true; return true;
} }
} }
@ -238,7 +241,7 @@ public class BuildCraftTransport {
durability.comment = "How long a pipe will take to break"; durability.comment = "How long a pipe will take to break";
pipeDurability = (float) durability.getDouble(DefaultProps.PIPES_DURABILITY); 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(); String[] excludedItemBlocks = exclusionItemList.getStringList();
if (excludedItemBlocks != null) { if (excludedItemBlocks != null) {
@ -248,7 +251,7 @@ public class BuildCraftTransport {
} else } else
excludedItemBlocks = new String[0]; 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(); String[] excludedFluidBlocks = exclusionFluidList.getStringList();
if (excludedFluidBlocks != null) { 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"; groupItemsTriggerProp.comment = "when reaching this amount of objects in a pipes, items will be automatically grouped";
groupItemsTrigger = groupItemsTriggerProp.getInt(); groupItemsTrigger = groupItemsTriggerProp.getInt();
pipeWaterproof = new ItemBuildCraft();
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.setUnlocalizedName("pipeWaterproof"); pipeWaterproof.setUnlocalizedName("pipeWaterproof");
LanguageRegistry.addName(pipeWaterproof, "Pipe Sealant"); LanguageRegistry.addName(pipeWaterproof, "Pipe Sealant");
CoreProxy.proxy.registerItem(pipeWaterproof); CoreProxy.proxy.registerItem(pipeWaterproof);
genericPipeBlock = new BlockGenericPipe(genericPipeId.getInt()); genericPipeBlock = new BlockGenericPipe();
CoreProxy.proxy.registerBlock(genericPipeBlock.setUnlocalizedName("pipeBlock"), ItemBlock.class); CoreProxy.proxy.registerBlock(genericPipeBlock.setBlockName("pipeBlock"), ItemBlock.class);
pipeItemsWood = buildPipe(DefaultProps.PIPE_ITEMS_WOOD_ID, PipeItemsWood.class, "Wooden Transport Pipe", "plankWood", Block.glass, "plankWood"); 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", Item.emerald, Block.glass, Item.emerald); 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", Block.glass, "cobblestone"); 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", Block.glass, "stone"); 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", Block.blockNetherQuartz, Block.glass, Block.blockNetherQuartz); 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", Item.ingotIron, Block.glass, Item.ingotIron); 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", Item.ingotGold, Block.glass, Item.ingotGold); 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", Item.diamond, Block.glass, Item.diamond); 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", Block.obsidian, Block.glass, Block.obsidian); 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", Block.blockLapis, Block.glass, Block.blockLapis); 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", Block.blockLapis, Block.glass, Item.diamond); 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", Block.sandStone, Block.glass, Block.sandStone); 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", Block.glass, Item.redstone); 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", Block.blockLapis, Block.glass, Item.emerald); 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); 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); pipeFluidsCobblestone = buildPipe(DefaultProps.PIPE_LIQUIDS_COBBLESTONE_ID, PipeFluidsCobblestone.class, "Cobblestone Waterproof Pipe", pipeWaterproof, pipeItemsCobblestone);
@ -305,51 +303,77 @@ public class BuildCraftTransport {
pipeFluidsSandstone = buildPipe(DefaultProps.PIPE_LIQUIDS_SANDSTONE_ID, PipeFluidsSandstone.class, "Sandstone Waterproof Pipe", pipeWaterproof, pipeItemsSandstone); 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); 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); 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", Item.redstone, pipeItemsCobblestone); 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", Item.redstone, pipeItemsStone); 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", Item.redstone, pipeItemsQuartz); 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", Item.redstone, pipeItemsIron); 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", Item.redstone, pipeItemsGold); 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", Item.redstone, pipeItemsDiamond); 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", Block.furnaceIdle, 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 // Fix the recipe
// pipeItemsStipes = createPipe(DefaultProps.PIPE_ITEMS_STRIPES_ID, PipeItemsStripes.class, "Stripes Transport Pipe", new ItemStack(Item.dyePowder, // 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)); // 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();
pipeWire = new ItemPipeWire(pipeWireId);
LanguageRegistry.addName(pipeWire, "Pipe Wire"); LanguageRegistry.addName(pipeWire, "Pipe Wire");
CoreProxy.proxy.registerItem(pipeWire); CoreProxy.proxy.registerItem(pipeWire);
PipeWire.item = pipeWire; PipeWire.item = pipeWire;
Property pipeGateId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeGate.id", DefaultProps.GATE_ID); pipeGate = new ItemGate();
pipeGate = new ItemGate(pipeGateId.getInt());
pipeGate.setUnlocalizedName("pipeGate"); pipeGate.setUnlocalizedName("pipeGate");
CoreProxy.proxy.registerItem(pipeGate); CoreProxy.proxy.registerItem(pipeGate);
Property pipeFacadeId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipeFacade.id", DefaultProps.PIPE_FACADE_ID); facadeItem = new ItemFacade();
facadeItem = new ItemFacade(pipeFacadeId.getInt());
facadeItem.setUnlocalizedName("pipeFacade"); facadeItem.setUnlocalizedName("pipeFacade");
CoreProxy.proxy.registerItem(facadeItem); CoreProxy.proxy.registerItem(facadeItem);
Property pipePlugId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "pipePlug.id", DefaultProps.PIPE_PLUG_ID); plugItem = new ItemPlug();
plugItem = new ItemPlug(pipePlugId.getInt());
plugItem.setUnlocalizedName("pipePlug"); plugItem.setUnlocalizedName("pipePlug");
CoreProxy.proxy.registerItem(plugItem); CoreProxy.proxy.registerItem(plugItem);
Property robotStationId = BuildCraftCore.mainConfiguration.get(Configuration.CATEGORY_ITEM, "robotStation.id", DefaultProps.ROBOT_STATION_ID); robotStationItem = new ItemRobotStation();
robotStationItem = new ItemRobotStation(robotStationId.getInt());
robotStationItem.setUnlocalizedName("robotStation"); robotStationItem.setUnlocalizedName("robotStation");
CoreProxy.proxy.registerItem(robotStationItem); CoreProxy.proxy.registerItem(robotStationItem);
Property filteredBufferId = BuildCraftCore.mainConfiguration.getBlock("filteredBuffer.id", DefaultProps.FILTERED_BUFFER_ID); filteredBufferBlock = new BlockFilteredBuffer();
filteredBufferBlock = new BlockFilteredBuffer(filteredBufferId.getInt()); CoreProxy.proxy.registerBlock(filteredBufferBlock.setBlockName("filteredBufferBlock"));
CoreProxy.proxy.registerBlock(filteredBufferBlock.setUnlocalizedName("filteredBufferBlock"));
CoreProxy.proxy.addName(filteredBufferBlock, "Filtered Buffer"); CoreProxy.proxy.addName(filteredBufferBlock, "Filtered Buffer");
for (PipeContents kind : PipeContents.values()) {
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
}
for (PipeWire wire : PipeWire.values()) {
triggerPipeWireActive[wire.ordinal()] = new TriggerPipeSignal(true, wire);
triggerPipeWireInactive[wire.ordinal()] = new TriggerPipeSignal(false, wire);
actionPipeWire[wire.ordinal()] = new ActionSignalOutput(wire);
}
for (Time time : TriggerClockTimer.Time.VALUES) {
triggerTimer[time.ordinal()] = new TriggerClockTimer(time);
}
for (int level = 0; level < triggerRedstoneLevel.length; level++) {
triggerRedstoneLevel[level] = new TriggerRedstoneFaderInput(level + 1);
actionRedstoneLevel[level] = new ActionRedstoneFaderOutput(level + 1);
}
for (EnumColor color : EnumColor.VALUES) {
actionPipeColor[color.ordinal()] = new ActionPipeColor(color);
}
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
actionPipeDirection[direction.ordinal()] = new ActionPipeDirection(direction);
}
for (PowerMode limit : PowerMode.VALUES) {
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(limit);
}
} finally { } finally {
BuildCraftCore.mainConfiguration.save(); BuildCraftCore.mainConfiguration.save();
} }
@ -357,6 +381,9 @@ public class BuildCraftTransport {
@EventHandler @EventHandler
public void init(FMLInitializationEvent evt) { public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel
(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", new PacketHandlerTransport());
// Register connection handler // Register connection handler
// MinecraftForge.registerConnectionHandler(new ConnectionHandler()); // MinecraftForge.registerConnectionHandler(new ConnectionHandler());
@ -374,14 +401,14 @@ public class BuildCraftTransport {
// ModLoader.RegisterTileEntity(TileDockingStation.class, // ModLoader.RegisterTileEntity(TileDockingStation.class,
// "net.minecraft.src.buildcraft.TileDockingStation"); // "net.minecraft.src.buildcraft.TileDockingStation");
new BptBlockPipe(genericPipeBlock.blockID); //new BptBlockPipe(genericPipeBlock.blockID);
BuildCraftCore.itemBptProps[pipeItemsWood.itemID] = new BptItemPipeWooden(); //BuildCraftCore.itemBptProps[pipeItemsWood.itemID] = new BptItemPipeWooden();
BuildCraftCore.itemBptProps[pipeFluidsWood.itemID] = new BptItemPipeWooden(); //BuildCraftCore.itemBptProps[pipeFluidsWood.itemID] = new BptItemPipeWooden();
BuildCraftCore.itemBptProps[pipeItemsIron.itemID] = new BptItemPipeIron(); //BuildCraftCore.itemBptProps[pipeItemsIron.itemID] = new BptItemPipeIron();
BuildCraftCore.itemBptProps[pipeFluidsIron.itemID] = new BptItemPipeIron(); //BuildCraftCore.itemBptProps[pipeFluidsIron.itemID] = new BptItemPipeIron();
BuildCraftCore.itemBptProps[pipeItemsDiamond.itemID] = new BptItemPipeDiamond(); //BuildCraftCore.itemBptProps[pipeItemsDiamond.itemID] = new BptItemPipeDiamond();
BuildCraftCore.itemBptProps[pipeItemsEmerald.itemID] = new BptItemPipeEmerald(); //BuildCraftCore.itemBptProps[pipeItemsEmerald.itemID] = new BptItemPipeEmerald();
ActionManager.registerTriggerProvider(new PipeTriggerProvider()); ActionManager.registerTriggerProvider(new PipeTriggerProvider());
@ -390,49 +417,18 @@ public class BuildCraftTransport {
} }
TransportProxy.proxy.registerRenderers(); TransportProxy.proxy.registerRenderers();
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler()); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
} }
@EventHandler @EventHandler
public void postInit(FMLPostInitializationEvent evt) { public void postInit(FMLPostInitializationEvent evt) {
ItemFacade.initialize(); ItemFacade.initialize();
for (PipeContents kind : PipeContents.values()) {
triggerPipe[kind.ordinal()] = new TriggerPipeContents(kind);
}
for (PipeWire wire : PipeWire.values()) {
triggerPipeWireActive[wire.ordinal()] = new TriggerPipeSignal(true, wire);
triggerPipeWireInactive[wire.ordinal()] = new TriggerPipeSignal(false, wire);
actionPipeWire[wire.ordinal()] = new ActionSignalOutput(wire);
}
for (Time time : TriggerClockTimer.Time.VALUES) {
triggerTimer[time.ordinal()] = new TriggerClockTimer(time);
}
for (int level = 0; level < triggerRedstoneLevel.length; level++) {
triggerRedstoneLevel[level] = new TriggerRedstoneFaderInput(level + 1);
actionRedstoneLevel[level] = new ActionRedstoneFaderOutput(level + 1);
}
for (EnumColor color : EnumColor.VALUES) {
actionPipeColor[color.ordinal()] = new ActionPipeColor(color);
}
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
actionPipeDirection[direction.ordinal()] = new ActionPipeDirection(direction);
}
for (PowerMode limit : PowerMode.VALUES) {
actionPowerLimiter[limit.ordinal()] = new ActionPowerLimiter(limit);
}
} }
public void loadRecipes() { public void loadRecipes() {
// Add base recipe for pipe waterproof. // 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 // Add pipe recipes
for (PipeRecipe pipe : pipeRecipes) { for (PipeRecipe pipe : pipeRecipes) {
@ -445,8 +441,8 @@ public class BuildCraftTransport {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(filteredBufferBlock, 1), CoreProxy.proxy.addCraftingRecipe(new ItemStack(filteredBufferBlock, 1),
new Object[]{"wdw", "wcw", "wpw", 'w', "plankWood", 'd', new Object[]{"wdw", "wcw", "wpw", 'w', "plankWood", 'd',
BuildCraftTransport.pipeItemsDiamond, 'c', Block.chest, 'p', BuildCraftTransport.pipeItemsDiamond, 'c', Blocks.chest, 'p',
Block.pistonBase}); Blocks.piston});
//Facade turning helper //Facade turning helper
GameRegistry.addRecipe(facadeItem.new FacadeRecipe()); 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) { 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); String name = Character.toLowerCase(clas.getSimpleName().charAt(0)) + clas.getSimpleName().substring(1);
Property prop = BuildCraftCore.mainConfiguration.getItem(name + ".id", defaultID); ItemPipe res = BlockGenericPipe.registerPipe(clas);
int id = prop.getInt(defaultID);
ItemPipe res = BlockGenericPipe.registerPipe(id, clas);
res.setUnlocalizedName(clas.getSimpleName()); res.setUnlocalizedName(clas.getSimpleName());
LanguageRegistry.addName(res, descr); LanguageRegistry.addName(res, descr);
@ -495,4 +488,5 @@ public class BuildCraftTransport {
return res; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
public class BlockSignature { 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; package buildcraft.api.blueprints;
import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.core.BuildCraftAPI;
@ -8,14 +16,14 @@ import net.minecraft.item.ItemStack;
@Deprecated @Deprecated
public class BlueprintManager { 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) { public static ItemSignature getItemSignature(Item item) {
ItemSignature sig = new ItemSignature(); ItemSignature sig = new ItemSignature();
if (item.itemID >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) { //if (item.itemID >= Block.blocksList.length + BuildCraftAPI.LAST_ORIGINAL_ITEM) {
sig.itemClassName = item.getClass().getSimpleName(); // sig.itemClassName = item.getClass().getSimpleName();
} //}
sig.itemName = item.getUnlocalizedName(new ItemStack(item)); sig.itemName = item.getUnlocalizedName(new ItemStack(item));
@ -23,13 +31,14 @@ public class BlueprintManager {
} }
public static BlockSignature getBlockSignature(Block block) { public static BlockSignature getBlockSignature(Block block) {
return BlueprintManager.blockBptProps[0].getSignature(block); //return BlueprintManager.blockBptProps[0].getSignature(block);
return null;
} }
static { static {
// Initialize defaults for block properties. // Initialize defaults for block properties.
for (int i = 0; i < BlueprintManager.blockBptProps.length; ++i) { //for (int i = 0; i < BlueprintManager.blockBptProps.length; ++i) {
new BptBlock(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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
import buildcraft.api.core.BuildCraftAPI; import buildcraft.api.core.BuildCraftAPI;
@ -49,7 +48,7 @@ public class BptBlock {
public BptBlock(int blockId) { public BptBlock(int blockId) {
this.blockId = blockId; this.blockId = blockId;
BlueprintManager.blockBptProps[blockId] = this; //BlueprintManager.blockBptProps[blockId] = this;
} }
/** /**
@ -57,11 +56,11 @@ public class BptBlock {
* buildBlock. * buildBlock.
*/ */
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
if (slot.blockId != 0) { if (slot.block != null) {
if (slot.storedRequirements.size() != 0) { if (slot.storedRequirements.size() != 0) {
requirements.addAll(slot.storedRequirements); requirements.addAll(slot.storedRequirements);
} else { } 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) { if (stack.stackSize == 0 && stack.getItem().getContainerItem() != null) {
Item container = stack.getItem().getContainerItem(); Item container = stack.getItem().getContainerItem();
stack.itemID = container.itemID; //stack.itemID = container.itemID;
stack.stackSize = 1; stack.stackSize = 1;
stack.setItemDamage(0); stack.setItemDamage(0);
} }
@ -117,7 +116,8 @@ public class BptBlock {
* Added metadata sensitivity //Krapht * Added metadata sensitivity //Krapht
*/ */
public boolean isValid(BptSlotInfo slot, IBptContext context) { 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) { public void buildBlock(BptSlotInfo slot, IBptContext context) {
// Meta needs to be specified twice, depending on the block behavior // 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().setBlock(slot.x, slot.y, slot.z, slot.block, slot.meta, 0);
context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,3); //context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,3);
if (Block.blocksList[slot.blockId] instanceof BlockContainer) { if (slot.block instanceof BlockContainer) {
TileEntity tile = context.world().getBlockTileEntity(slot.x, slot.y, slot.z); TileEntity tile = context.world().getTileEntity(slot.x, slot.y, slot.z);
slot.cpt.setInteger("x", slot.x); //slot.cpt.setInteger("x", slot.x);
slot.cpt.setInteger("y", slot.y); //slot.cpt.setInteger("y", slot.y);
slot.cpt.setInteger("z", slot.z); //slot.cpt.setInteger("z", slot.z);
if (tile != null) { //if (tile != null) {
tile.readFromNBT(slot.cpt); // 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. * 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) { public void initializeFromWorld(BptSlotInfo slot, IBptContext context, int x, int y, int z) {
if (Block.blocksList[slot.blockId] instanceof BlockContainer) { /*if (Block.blocksList[slot.blockId] instanceof BlockContainer) {
TileEntity tile = context.world().getBlockTileEntity(x, y, z); TileEntity tile = context.world().getTileEntity(x, y, z);
if (tile != null) { if (tile != null) {
tile.writeToNBT(slot.cpt); tile.writeToNBT(slot.cpt);
@ -176,7 +176,7 @@ public class BptBlock {
if (req != null) { if (req != null) {
slot.storedRequirements.addAll(req); slot.storedRequirements.addAll(req);
} }
} }*/
} }
/** /**
@ -194,7 +194,7 @@ public class BptBlock {
public BlockSignature getSignature(Block block) { public BlockSignature getSignature(Block block) {
BlockSignature sig = new BlockSignature(); BlockSignature sig = new BlockSignature();
if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) { /*if (block.blockID > BuildCraftAPI.LAST_ORIGINAL_BLOCK) {
sig.blockClassName = block.getClass().getSimpleName(); sig.blockClassName = block.getClass().getSimpleName();
if (block instanceof BlockContainer) { if (block instanceof BlockContainer) {
@ -205,7 +205,7 @@ public class BptBlock {
sig.tileClassName = tile.getClass().getSimpleName(); sig.tileClassName = tile.getClass().getSimpleName();
} }
} }
} }*/
sig.blockName = block.getUnlocalizedName(); sig.blockName = block.getUnlocalizedName();
sig.replaceNullWithStar(); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
import java.util.LinkedList; import java.util.LinkedList;
@ -55,11 +54,11 @@ public class BptBlockUtils {
ItemStack stacks[] = new ItemStack[list.tagCount()]; ItemStack stacks[] = new ItemStack[list.tagCount()];
for (int i = 0; i < list.tagCount(); ++i) { 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) { //if (stack != null && stack.itemID != 0 && stack.stackSize > 0) {
stacks[i] = context.mapItemStack(stack); // stacks[i] = context.mapItemStack(stack);
} //}
} }
return stacks; return stacks;
@ -75,7 +74,7 @@ public class BptBlockUtils {
if (stack != null && stack.stackSize != 0) { if (stack != null && stack.stackSize != 0) {
stack.writeToNBT(cpt); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -20,7 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
@Deprecated @Deprecated
public class BptSlotInfo { public class BptSlotInfo {
public int blockId = 0; public Block block = null;
public int meta = 0; public int meta = 0;
public int x; public int x;
public int y; public int y;
@ -44,7 +45,7 @@ public class BptSlotInfo {
obj.x = x; obj.x = x;
obj.y = y; obj.y = y;
obj.z = z; obj.z = z;
obj.blockId = blockId; obj.block = block;
obj.meta = meta; obj.meta = meta;
obj.cpt = (NBTTagCompound) cpt.copy(); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
import buildcraft.api.core.IBox; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.blueprints; package buildcraft.api.blueprints;
@Deprecated @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
import buildcraft.api.blueprints.BptSlotInfo; import buildcraft.api.blueprints.BptSlotInfo;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBptContext;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -26,7 +28,7 @@ public class BptBlockBed extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
if ((slot.meta & 8) == 0) { 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) if ((slot.meta & 8) != 0)
return; 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 x2 = slot.x;
int z2 = slot.z; int z2 = slot.z;
@ -76,7 +78,7 @@ public class BptBlockBed extends BptBlock {
break; 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 @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BlueprintManager; import buildcraft.api.blueprints.BlueprintManager;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
import buildcraft.api.blueprints.BptSlotInfo; import buildcraft.api.blueprints.BptSlotInfo;
import buildcraft.api.blueprints.IBptContext; import buildcraft.api.blueprints.IBptContext;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@Deprecated @Deprecated
public class BptBlockDelegate extends BptBlock { 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); super(blockId);
this.delegateTo = delegateTo; this.delegateTo = delegateTo;
@ -30,36 +32,38 @@ public class BptBlockDelegate extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
BptSlotInfo newSlot = slot.clone(); BptSlotInfo newSlot = slot.clone();
slot.blockId = delegateTo; slot.block = delegateTo;
if (BlueprintManager.blockBptProps[delegateTo] != null) { //if (BlueprintManager.blockBptProps[delegateTo] != null) {
BlueprintManager.blockBptProps[delegateTo].addRequirements(newSlot, context, requirements); // BlueprintManager.blockBptProps[delegateTo].addRequirements(newSlot, context, requirements);
} else { //} else {
super.addRequirements(newSlot, context, requirements); // super.addRequirements(newSlot, context, requirements);
} //}
} }
@Override @Override
public boolean isValid(BptSlotInfo slot, IBptContext context) { public boolean isValid(BptSlotInfo slot, IBptContext context) {
BptSlotInfo newSlot = slot.clone(); BptSlotInfo newSlot = slot.clone();
slot.blockId = delegateTo; slot.block = delegateTo;
if (BlueprintManager.blockBptProps[delegateTo] != null) //if (BlueprintManager.blockBptProps[delegateTo] != null)
return BlueprintManager.blockBptProps[delegateTo].isValid(newSlot, context); // return BlueprintManager.blockBptProps[delegateTo].isValid(newSlot, context);
else //else
return super.isValid(newSlot, context); // return super.isValid(newSlot, context);
return false;
} }
@Override @Override
public void rotateLeft(BptSlotInfo slot, IBptContext context) { public void rotateLeft(BptSlotInfo slot, IBptContext context) {
BptSlotInfo newSlot = slot.clone(); BptSlotInfo newSlot = slot.clone();
slot.blockId = delegateTo; slot.block = delegateTo;
if (BlueprintManager.blockBptProps[delegateTo] != null) { //if (BlueprintManager.blockBptProps[delegateTo] != null) {
BlueprintManager.blockBptProps[delegateTo].rotateLeft(newSlot, context); // BlueprintManager.blockBptProps[delegateTo].rotateLeft(newSlot, context);
} else { //} else {
super.rotateLeft(newSlot, context); // 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -25,18 +24,19 @@ public class BptBlockDirt extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Block.dirt)); //requirements.add(new ItemStack(Block.dirt));
} }
@Override @Override
public void buildBlock(BptSlotInfo slot, IBptContext context) { 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 @Override
public boolean isValid(BptSlotInfo slot, IBptContext context) { 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -61,8 +60,8 @@ public class BptBlockDoor extends BptBlock {
@Override @Override
public void buildBlock(BptSlotInfo slot, IBptContext context) { 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, 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 + 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 + 1, slot.z, slot.meta + 8,1);
context.world().setBlockMetadataWithNotify(slot.x, slot.y, slot.z, slot.meta,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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -35,9 +34,9 @@ public class BptBlockFluid extends BptBlock {
@Override @Override
public boolean isValid(BptSlotInfo slot, IBptContext context) { public boolean isValid(BptSlotInfo slot, IBptContext context) {
if (slot.meta == 0) //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; // return slot.blockId == context.world().getBlockId(slot.x, slot.y, slot.z) && context.world().getBlockMetadata(slot.x, slot.y, slot.z) == 0;
else //else
return true; return true;
} }
@ -53,9 +52,9 @@ public class BptBlockFluid extends BptBlock {
@Override @Override
public void buildBlock(BptSlotInfo slot, IBptContext context) { public void buildBlock(BptSlotInfo slot, IBptContext context) {
if (slot.meta == 0) { //if (slot.meta == 0) {
context.world().setBlock(slot.x, slot.y, slot.z, slot.blockId, 0,1); // 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -24,7 +23,7 @@ public class BptBlockIgnore extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { 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 @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -24,11 +23,12 @@ public class BptBlockIgnoreMeta extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { 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 @Override
public boolean isValid(BptSlotInfo slot, IBptContext context) { 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; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -17,7 +26,7 @@ public class BptBlockInventory extends BptBlock {
public void buildBlock(BptSlotInfo slot, IBptContext context) { public void buildBlock(BptSlotInfo slot, IBptContext context) {
super.buildBlock(slot, 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) { for (int i = 0; i < inv.getSizeInventory(); ++i) {
inv.setInventorySlotContents(i, null); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptSlotInfo; import buildcraft.api.blueprints.BptSlotInfo;
@ -23,7 +22,7 @@ public class BptBlockLever extends BptBlockWallSide {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { 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 @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptSlotInfo; import buildcraft.api.blueprints.BptSlotInfo;
@ -23,7 +22,7 @@ public class BptBlockPiston extends BptBlockRotateMeta {
public void buildBlock(BptSlotInfo slot, IBptContext context) { public void buildBlock(BptSlotInfo slot, IBptContext context) {
int meta = slot.meta & 7; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -24,12 +23,13 @@ public class BptBlockPumpkin extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { 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 @Override
public boolean isValid(BptSlotInfo slot, IBptContext context) { 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 @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -25,7 +24,7 @@ public class BptBlockRedstoneRepeater extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Item.redstoneRepeater)); //requirements.add(new ItemStack(Item.redstoneRepeater));
} }
@Override @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; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptSlotInfo; import buildcraft.api.blueprints.BptSlotInfo;
@ -16,7 +24,7 @@ public class BptBlockRotateInventory extends BptBlockRotateMeta {
public void buildBlock(BptSlotInfo slot, IBptContext context) { public void buildBlock(BptSlotInfo slot, IBptContext context) {
super.buildBlock(slot, 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) { for (int i = 0; i < inv.getSizeInventory(); ++i) {
inv.setInventorySlotContents(i, null); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -43,12 +42,13 @@ public class BptBlockRotateMeta extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { 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 @Override
public boolean isValid(BptSlotInfo slot, IBptContext context) { 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 @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BlockSignature; import buildcraft.api.blueprints.BlockSignature;
@ -31,7 +30,7 @@ public class BptBlockSign extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) {
requirements.add(new ItemStack(Item.sign)); //requirements.add(new ItemStack(Item.sign));
} }
@Override @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -24,12 +23,13 @@ public class BptBlockStairs extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { 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 @Override
public boolean isValid(BptSlotInfo slot, IBptContext context) { 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 @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.bptblocks; package buildcraft.api.bptblocks;
import buildcraft.api.blueprints.BptBlock; import buildcraft.api.blueprints.BptBlock;
@ -24,7 +23,7 @@ public class BptBlockWallSide extends BptBlock {
@Override @Override
public void addRequirements(BptSlotInfo slot, IBptContext context, LinkedList<ItemStack> requirements) { 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 @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; package buildcraft.api.builder;
import java.util.ArrayList; import java.util.ArrayList;
@ -5,8 +13,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import buildcraft.builders.blueprints.IBlueprintBuilderAgent;
import buildcraft.builders.blueprints.BlueprintBuilder.SchematicBuilder;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -14,7 +20,9 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; 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 * 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 * To implement your own, you should extend this class and override the
* functions as needed. * functions as needed.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/ */
public class BlockHandler { 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; private final int id;
public static BlockHandler get(Item item) { public static BlockHandler get(Item item) {
if (item == null) if (item == null) {
return null; return null;
return get(item.itemID); } else {
return get(item);
}
} }
public static BlockHandler get(Block block) { public static BlockHandler get(Block block) {
if (block == null) if (block == null) {
return null; return null;
return get(block.blockID); } else {
return get(block);
}
} }
public static BlockHandler get(int id) { public static BlockHandler get(int id) {
BlockHandler handler = handlers.get(id); BlockHandler handler = handlers.get(id);
if (handler == null) { if (handler == null) {
handler = new BlockHandler(id); handler = new BlockHandler(id);
registerHandler(id, handler); registerHandler(id, handler);
} }
return handler; return handler;
} }
public static void registerHandler(Block block, BlockHandler 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) { 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) { 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. * We will also skip any blocks that drop actual items like Ore blocks.
*/ */
public boolean canSaveToSchematic(World world, int x, int y, int z) { public boolean canSaveToSchematic(World world, int x, int y, int z) {
if (!(Item.itemsList[id] instanceof ItemBlock)) Block block = Block.getBlockById(id);
return false;
Block block = Block.blocksList[id]; if (block == null) {
if (block == null)
return false; return false;
}
int meta = world.getBlockMetadata(x, y, z); 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) { } catch (NullPointerException ex) {
return false; return false;
} }
return !block.hasTileEntity(meta); return !block.hasTileEntity(meta);
} }
@ -105,21 +118,24 @@ public class BlockHandler {
* We will also skip any blocks that drop actual items like Ore blocks. * We will also skip any blocks that drop actual items like Ore blocks.
*/ */
public boolean canSaveToSchematic(ItemStack stack) { public boolean canSaveToSchematic(ItemStack stack) {
if (stack == null) if (stack == null) {
return false;
if (!(stack.getItem() instanceof ItemBlock))
return false; return false;
}
if (id > Block.blocksList.length) if (!(stack.getItem() instanceof ItemBlock)) {
return false; return false;
}
Block block = Block.blocksList[id]; Block block = Block.getBlockById(id);
if (block == null)
if (block == null) {
return false; return false;
}
try { try {
if (block.idDropped(stack.getItemDamage(), null, 0) != id) if (block.getItemDropped(stack.getItemDamage(), null, 0) != Item.getItemFromBlock(block)) {
return false; return false;
}
} catch (NullPointerException ex) { } catch (NullPointerException ex) {
return false; return false;
} }
@ -159,8 +175,9 @@ public class BlockHandler {
*/ */
public List<ItemStack> getCostForSchematic(NBTTagCompound data) { public List<ItemStack> getCostForSchematic(NBTTagCompound data) {
List<ItemStack> cost = new ArrayList<ItemStack>(); List<ItemStack> cost = new ArrayList<ItemStack>();
Block block = Block.blocksList[id]; Block block = Block.getBlockById(id);
cost.add(new ItemStack(block.idDropped(data.getByte("blockMeta"), BlueprintHelpers.RANDOM, 0), 1, block.damageDropped(data.getByte("blockMeta")))); cost.add(new ItemStack(block.getItemDropped(data.getByte("blockMeta"), BlueprintHelpers.RANDOM, 0), 1, block.damageDropped(data.getByte("blockMeta"))));
return cost; return cost;
} }
@ -203,8 +220,10 @@ public class BlockHandler {
if (builderInventory != null) { if (builderInventory != null) {
List<ItemStack> requiredItems = getCostForSchematic(builder.schematic.data); List<ItemStack> requiredItems = getCostForSchematic(builder.schematic.data);
List<Integer> slotsToConsume = new ArrayList<Integer>(); List<Integer> slotsToConsume = new ArrayList<Integer>();
for (ItemStack cost : requiredItems) { for (ItemStack cost : requiredItems) {
boolean found = false; boolean found = false;
for (int slot = 0; slot < builderInventory.getSizeInventory(); slot++) { for (int slot = 0; slot < builderInventory.getSizeInventory(); slot++) {
if (areItemsEqual(builderInventory.getStackInSlot(slot), cost)) { if (areItemsEqual(builderInventory.getStackInSlot(slot), cost)) {
slotsToConsume.add(slot); slotsToConsume.add(slot);
@ -212,22 +231,26 @@ public class BlockHandler {
break; break;
} }
} }
if (!found)
if (!found) {
return false; return false;
}
} }
for (Integer slot : slotsToConsume) { for (Integer slot : slotsToConsume) {
builderInventory.setInventorySlotContents(slot, BlueprintHelpers.consumeItem(builderInventory.getStackInSlot(slot))); 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. * Checks if the block matches the schematic.
*/ */
public boolean doesBlockMatchSchematic(World world, int x, int y, int z, ForgeDirection blueprintOrientation, NBTTagCompound data) { 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 false;
}
return !data.hasKey("blockMeta") || data.getByte("blockMeta") == world.getBlockMetadata(x, y, z); 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; package buildcraft.api.builder;
import java.util.Random; import java.util.Random;
import net.minecraft.item.ItemStack; 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. * A collection of helpful functions to make your life easier.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/ */
public class BlueprintHelpers { public class BlueprintHelpers {
@ -43,7 +49,7 @@ public class BlueprintHelpers {
public static ItemStack consumeItem(ItemStack stack) { public static ItemStack consumeItem(ItemStack stack) {
if (stack.stackSize == 1) { if (stack.stackSize == 1) {
if (stack.getItem().hasContainerItem()) { if (stack.getItem().hasContainerItem()) {
return stack.getItem().getContainerItemStack(stack); return stack.getItem().getContainerItem(stack);
} else { } else {
return null; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.core; package buildcraft.api.core;
import java.util.HashSet;
import java.util.Set;
import net.minecraft.block.Block; import net.minecraft.block.Block;
public class BuildCraftAPI { public class BuildCraftAPI {
@ -16,5 +18,5 @@ public class BuildCraftAPI {
public static final int LAST_ORIGINAL_BLOCK = 122; public static final int LAST_ORIGINAL_BLOCK = 122;
public static final int LAST_ORIGINAL_ITEM = 126; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.core; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.core; package buildcraft.api.core;
import net.minecraft.world.World; 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; package buildcraft.api.core;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
public interface IIconProvider { public interface IIconProvider {
@ -12,13 +20,13 @@ public interface IIconProvider {
* @return * @return
*/ */
@SideOnly(Side.CLIENT) @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 * 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 * @param iconRegister
*/ */
@SideOnly(Side.CLIENT) @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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.core; package buildcraft.api.core;
public enum LaserKind { 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.core; package buildcraft.api.core;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class Position { 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.core; package buildcraft.api.core;

View file

@ -1,19 +1,16 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.core; package buildcraft.api.core;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public class StackWrapper { public class StackWrapper {
public final ItemStack stack; public final ItemStack stack;
@ -25,10 +22,15 @@ public class StackWrapper {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 5; int hash = 5;
hash = 67 * hash + stack.itemID;
hash = 67 * hash + stack.getItem().hashCode();
hash = 67 * hash + stack.getItemDamage(); hash = 67 * hash + stack.getItemDamage();
if (stack.stackTagCompound != null)
if (stack.stackTagCompound != null) {
hash = 67 * hash + stack.stackTagCompound.hashCode(); hash = 67 * hash + stack.stackTagCompound.hashCode();
}
return hash; return hash;
} }
@ -39,7 +41,7 @@ public class StackWrapper {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
final StackWrapper other = (StackWrapper) obj; final StackWrapper other = (StackWrapper) obj;
if (stack.itemID != other.stack.itemID) if (stack.getItem() != other.stack.getItem())
return false; return false;
if (stack.getHasSubtypes() && stack.getItemDamage() != other.stack.getItemDamage()) if (stack.getHasSubtypes() && stack.getItemDamage() != other.stack.getItemDamage())
return false; 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; package buildcraft.api.filler;
public class FillerManager { 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; package buildcraft.api.filler;
import buildcraft.api.core.IBox; import buildcraft.api.core.IBox;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public interface IFillerPattern { public interface IFillerPattern {
@ -23,7 +31,7 @@ public interface IFillerPattern {
public IPatternIterator createPatternIterator(TileEntity tile, IBox box, ForgeDirection orientation); public IPatternIterator createPatternIterator(TileEntity tile, IBox box, ForgeDirection orientation);
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Icon getIcon(); public IIcon getIcon();
public String getDisplayName(); 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; package buildcraft.api.filler;
import buildcraft.api.gates.IAction; import buildcraft.api.gates.IAction;

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -10,10 +10,6 @@ package buildcraft.api.filler;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IPatternIterator { public interface IPatternIterator {
public boolean iteratePattern(ItemStack stackToPlace); 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.fuels; package buildcraft.api.fuels;
import buildcraft.api.core.StackWrapper; import buildcraft.api.core.StackWrapper;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
@ -60,7 +64,7 @@ public final class IronEngineCoolant {
* @param coolant * @param coolant
*/ */
public static void addCoolant(final ItemStack stack, final FluidStack 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); solidCoolants.put(new StackWrapper(stack), coolant);
} }
} }
@ -73,8 +77,12 @@ public final class IronEngineCoolant {
* @param stack * @param stack
* @param coolant * @param coolant
*/ */
public static void addCoolant(final int itemId, final int metadata, final FluidStack coolant) { public static void addCoolant(final Item item, final int metadata, final FluidStack coolant) {
addCoolant(new ItemStack(itemId, 1, metadata), 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) { 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.fuels; 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; package buildcraft.api.gates;
import buildcraft.api.transport.IPipeTile; import buildcraft.api.transport.IPipeTile;

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -12,10 +12,6 @@ import java.util.List;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public abstract class GateExpansionController { public abstract class GateExpansionController {
public final IGateExpansion type; public final IGateExpansion type;

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -15,10 +15,6 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public final class GateExpansions { public final class GateExpansions {
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>(); 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; package buildcraft.api.gates;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
public interface IAction { public interface IAction {
String getUniqueTag(); String getUniqueTag();
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
Icon getIcon(); IIcon getIcon();
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
void registerIcons(IconRegister iconRegister); void registerIcons(IIconRegister iconRegister);
boolean hasParameter(); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.gates; package buildcraft.api.gates;
import java.util.LinkedList; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.gates; package buildcraft.api.gates;
public interface IActionReceptor { public interface IActionReceptor {

View file

@ -1,21 +1,17 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.gates; 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.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IGateExpansion { public interface IGateExpansion {
String getUniqueIdentifier(); String getUniqueIdentifier();
@ -24,11 +20,11 @@ public interface IGateExpansion {
GateExpansionController makeController(TileEntity pipeTile); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.gates; package buildcraft.api.gates;
import java.util.LinkedList; import java.util.LinkedList;

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -9,12 +9,8 @@
package buildcraft.api.gates; package buildcraft.api.gates;
import net.minecraft.tileentity.TileEntity; 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 { 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; package buildcraft.api.gates;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
public interface ITrigger { public interface ITrigger {
@ -16,10 +24,10 @@ public interface ITrigger {
String getUniqueTag(); String getUniqueTag();
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
Icon getIcon(); IIcon getIcon();
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
void registerIcons(IconRegister iconRegister); void registerIcons(IIconRegister iconRegister);
/** /**
* Return true if this trigger can accept parameters * 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; package buildcraft.api.gates;
import net.minecraft.item.ItemStack; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.gates; package buildcraft.api.gates;
import buildcraft.api.transport.IPipeTile; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.gates; package buildcraft.api.gates;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -49,7 +49,7 @@ public class TriggerParameter implements ITriggerParameter {
if (stack != null) { if (stack != null) {
NBTTagCompound tagCompound = new NBTTagCompound(); NBTTagCompound tagCompound = new NBTTagCompound();
stack.writeToNBT(tagCompound); 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 // Legacy code to prevent existing gates from losing their contents
int itemID = compound.getInteger("itemID"); int itemID = compound.getInteger("itemID");
if (itemID != 0) { if (itemID != 0) {
stack = new ItemStack(itemID, 1, compound.getInteger("itemDMG")); stack = new ItemStack((Item) Item.itemRegistry.getObject(itemID), 1, compound.getInteger("itemDMG"));
return; 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; package buildcraft.api.inventory;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
@Deprecated
public interface ISpecialInventory extends IInventory { public interface ISpecialInventory extends IInventory {
/** /**

View file

@ -1,18 +1,13 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.power; package buildcraft.api.power;
/**
* Specifies a Tile Entity that can receive power via laser beam.
*
* @author cpw
*/
public interface ILaserTarget { public interface ILaserTarget {
/** /**

View file

@ -1,22 +1,20 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.power; package buildcraft.api.power;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
/** /**
* Essentially only used for Wooden Power Pipe connection rules. * Essentially only used for Wooden Power Pipe connection rules.
* *
* This Tile Entity interface allows you to indicate that a block can emit power * This Tile Entity interface allows you to indicate that a block can emit power
* from a specific side. * from a specific side.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/ */
public interface IPowerEmitter { 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.power; package buildcraft.api.power;
import net.minecraft.world.World; 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 * This interface should be implemented by any Tile Entity that wishes to be
* able to receive power. * able to receive power.
*
* @author CovertJaguar <http://www.railcraft.info/>
*/ */
public interface IPowerReceptor { 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.power; package buildcraft.api.power;
import buildcraft.api.core.SafeTimeTracker; import buildcraft.api.core.SafeTimeTracker;
import net.minecraft.nbt.NBTTagCompound; 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 * 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 IPowerReceptor
* @see IPowerEmitter * @see IPowerEmitter
*
* @author CovertJaguar <http://www.railcraft.info/>
*/ */
public final class PowerHandler { public final class PowerHandler {
@ -335,7 +334,7 @@ public final class PowerHandler {
public void writeToNBT(NBTTagCompound data, String tag) { public void writeToNBT(NBTTagCompound data, String tag) {
NBTTagCompound nbt = new NBTTagCompound(); NBTTagCompound nbt = new NBTTagCompound();
nbt.setDouble("energyStored", energyStored); nbt.setDouble("energyStored", energyStored);
data.setCompoundTag(tag, nbt); data.setTag(tag, nbt);
} }
public final class PowerReceiver { public final class PowerReceiver {

View file

@ -1,17 +1,13 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.recipes; package buildcraft.api.recipes;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public final class BuildcraftRecipes { public final class BuildcraftRecipes {
public static IAssemblyRecipeManager assemblyTable; public static IAssemblyRecipeManager assemblyTable;

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -11,10 +11,6 @@ package buildcraft.api.recipes;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IAssemblyRecipeManager { public interface IAssemblyRecipeManager {
public static interface IAssemblyRecipe { public static interface IAssemblyRecipe {

View file

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

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -11,10 +11,6 @@ package buildcraft.api.recipes;
import java.util.SortedSet; import java.util.SortedSet;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IRefineryRecipeManager { public interface IRefineryRecipeManager {
void addRecipe(FluidStack ingredient, FluidStack result, int energy, int delay); 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; package buildcraft.api.tools;
import net.minecraft.item.ItemStack; 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; package buildcraft.api.tools;
import net.minecraft.entity.player.EntityPlayer; 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; package buildcraft.api.transport;
import net.minecraft.world.World; 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.transport; package buildcraft.api.transport;
import buildcraft.api.transport.IPipeTile.PipeType; import buildcraft.api.transport.IPipeTile.PipeType;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public interface IPipeConnection { public interface IPipeConnection {

View file

@ -1,30 +1,26 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.transport; 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.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public interface IPipeDefinition { public interface IPipeDefinition {
String getUniqueTag(); 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); 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.api.transport; package buildcraft.api.transport;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public interface IPipeTile { public interface IPipeTile {

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -11,12 +11,8 @@ package buildcraft.api.transport;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; 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 abstract class PipeBehavior {
public final TileEntity tile; 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; package buildcraft.api.transport;
import java.util.ArrayList; import java.util.ArrayList;

View file

@ -1,7 +1,7 @@
/* /**
* Copyright (c) SpaceToad, 2011-2012 * Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
@ -12,10 +12,6 @@ import java.util.Locale;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
/**
*
* @author CovertJaguar <http://www.railcraft.info/>
*/
public enum PipeWire { public enum PipeWire {
RED, BLUE, GREEN, YELLOW; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftBuilders;
@ -18,36 +17,39 @@ import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; 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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class BlockArchitect extends BlockContainer { public class BlockArchitect extends BlockContainer {
Icon blockTextureSides; IIcon blockTextureSides;
Icon blockTextureFront; IIcon blockTextureFront;
Icon blockTextureTopPos; IIcon blockTextureTopPos;
Icon blockTextureTopNeg; IIcon blockTextureTopNeg;
Icon blockTextureTopArchitect; IIcon blockTextureTopArchitect;
public BlockArchitect(int i) { public BlockArchitect() {
super(i, Material.iron); super(Material.iron);
setHardness(5F); setHardness(5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get()); setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
} }
@Override @Override
public TileEntity createNewTileEntity(World var1) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileArchitect(); return new TileArchitect();
} }
@ -84,7 +86,7 @@ public class BlockArchitect extends BlockContainer {
return true; return true;
} else { } else {
if (!CoreProxy.proxy.isRenderWorld(world)) { if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k); entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.ARCHITECT_TABLE, world, i, j, k);
} }
return true; return true;
@ -93,10 +95,10 @@ public class BlockArchitect extends BlockContainer {
} }
@Override @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); Utils.preDestroyBlock(world, i, j, k);
super.breakBlock(world, i, j, k, par5, par6); super.breakBlock(world, i, j, k, block, par6);
} }
@Override @Override
@ -109,7 +111,8 @@ public class BlockArchitect extends BlockContainer {
} }
@SuppressWarnings({ "all" }) @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); int m = iblockaccess.getBlockMetadata(i, j, k);
if (l == 1) if (l == 1)
@ -119,7 +122,7 @@ public class BlockArchitect extends BlockContainer {
} }
@Override @Override
public Icon getIcon(int i, int j) { public IIcon getIcon(int i, int j) {
if (j == 0 && i == 3) if (j == 0 && i == 3)
return blockTextureFront; return blockTextureFront;
@ -132,15 +135,9 @@ public class BlockArchitect extends BlockContainer {
return blockTextureSides; return blockTextureSides;
} }
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerBlockIcons(IIconRegister par1IconRegister)
{ {
blockTextureSides = par1IconRegister.registerIcon("buildcraft:architect_sides"); blockTextureSides = par1IconRegister.registerIcon("buildcraft:architect_sides");
blockTextureTopNeg = par1IconRegister.registerIcon("buildcraft:architect_top_neg"); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftBuilders;
@ -20,21 +19,21 @@ import java.util.ArrayList;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; 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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockBlueprintLibrary extends BlockContainer { public class BlockBlueprintLibrary extends BlockContainer {
private Icon textureTop; private IIcon textureTop;
private Icon textureSide; private IIcon textureSide;
public BlockBlueprintLibrary(int i) { public BlockBlueprintLibrary() {
super(i, Material.wood); super(Material.wood);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get()); setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
setHardness(5F); setHardness(5F);
} }
@ -47,10 +46,10 @@ public class BlockBlueprintLibrary extends BlockContainer {
if (entityplayer.isSneaking()) if (entityplayer.isSneaking())
return false; 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 (!tile.locked || entityplayer.getDisplayName().equals(tile.owner))
if (!CoreProxy.proxy.isRenderWorld(world)) { if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k); entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BLUEPRINT_LIBRARY, world, i, j, k);
} }
@ -58,12 +57,12 @@ public class BlockBlueprintLibrary extends BlockContainer {
} }
@Override @Override
public TileEntity createNewTileEntity(World var1) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileBlueprintLibrary(); return new TileBlueprintLibrary();
} }
@Override @Override
public Icon getIcon(int i, int j) { public IIcon getIcon(int i, int j) {
switch (i) { switch (i) {
case 0: case 0:
case 1: case 1:
@ -75,21 +74,15 @@ public class BlockBlueprintLibrary extends BlockContainer {
@Override @Override
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) { public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityliving, ItemStack stack) {
if (CoreProxy.proxy.isSimulating(world) && entityliving instanceof EntityPlayer) { if (!world.isRemote && entityliving instanceof EntityPlayer) {
TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getBlockTileEntity(i, j, k); TileBlueprintLibrary tile = (TileBlueprintLibrary) world.getTileEntity(i, j, k);
tile.owner = ((EntityPlayer) entityliving).username; tile.owner = ((EntityPlayer) entityliving).getDisplayName();
} }
} }
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerBlockIcons(IIconRegister par1IconRegister)
{ {
textureTop = par1IconRegister.registerIcon("buildcraft:library_topbottom"); textureTop = par1IconRegister.registerIcon("buildcraft:library_topbottom");
textureSide = par1IconRegister.registerIcon("buildcraft:library_side"); textureSide = par1IconRegister.registerIcon("buildcraft:library_side");

View file

@ -19,37 +19,38 @@ import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; 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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class BlockBuilder extends BlockContainer { public class BlockBuilder extends BlockContainer {
Icon blockTextureTop; IIcon blockTextureTop;
Icon blockTextureSide; IIcon blockTextureSide;
Icon blockTextureFront; IIcon blockTextureFront;
public BlockBuilder(int i) { public BlockBuilder() {
super(i, Material.iron); super(Material.iron);
setHardness(5F); setHardness(5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get()); setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
} }
@Override @Override
public TileEntity createNewTileEntity(World var1) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileBuilder(); return new TileBuilder();
} }
@Override @Override
public Icon getIcon(int i, int j) { public IIcon getIcon(int i, int j) {
if (j == 0 && i == 3) if (j == 0 && i == 3)
return blockTextureFront; return blockTextureFront;
@ -97,7 +98,7 @@ public class BlockBuilder extends BlockContainer {
return true; return true;
} else { } else {
if (!CoreProxy.proxy.isRenderWorld(world)) { if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k); entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.BUILDER, world, i, j, k);
} }
return true; return true;
@ -114,20 +115,14 @@ public class BlockBuilder extends BlockContainer {
} }
@Override @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); Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6); super.breakBlock(world, x, y, z, block, par6);
}
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) { public void registerBlockIcons(IIconRegister par1IconRegister) {
blockTextureTop = par1IconRegister.registerIcon("buildcraft:builder_top"); blockTextureTop = par1IconRegister.registerIcon("buildcraft:builder_top");
blockTextureSide = par1IconRegister.registerIcon("buildcraft:builder_side"); blockTextureSide = par1IconRegister.registerIcon("buildcraft:builder_side");
blockTextureFront = par1IconRegister.registerIcon("buildcraft:builder_front"); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
import buildcraft.BuildCraftBuilders; import buildcraft.BuildCraftBuilders;
@ -17,26 +16,29 @@ import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFiller extends BlockContainer { public class BlockFiller extends BlockContainer {
Icon textureSides; IIcon textureSides;
Icon textureTopOn; IIcon textureTopOn;
Icon textureTopOff; IIcon textureTopOff;
public IFillerPattern currentPattern; public IFillerPattern currentPattern;
public BlockFiller(int i) { public BlockFiller() {
super(i, Material.iron); super(Material.iron);
setHardness(5F); setHardness(5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get()); setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
@ -49,7 +51,7 @@ public class BlockFiller extends BlockContainer {
if (entityplayer.isSneaking()) if (entityplayer.isSneaking())
return false; return false;
if (!CoreProxy.proxy.isRenderWorld(world)) { if (!world.isRemote) {
entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k); entityplayer.openGui(BuildCraftBuilders.instance, GuiIds.FILLER, world, i, j, k);
} }
return true; return true;
@ -57,9 +59,9 @@ public class BlockFiller extends BlockContainer {
} }
@Override @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); 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) { if (tile != null && tile instanceof TileFiller) {
TileFiller filler = (TileFiller) tile; TileFiller filler = (TileFiller) tile;
@ -78,7 +80,7 @@ public class BlockFiller extends BlockContainer {
} }
@Override @Override
public Icon getIcon(int i, int j) { public IIcon getIcon(int i, int j) {
if (i == 0 || i == 1) if (i == 0 || i == 1)
return textureTopOn; return textureTopOn;
else else
@ -86,25 +88,19 @@ public class BlockFiller extends BlockContainer {
} }
@Override @Override
public TileEntity createNewTileEntity(World var1) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileFiller(); return new TileFiller();
} }
@Override @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); Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6); super.breakBlock(world, x, y, z, block, par6);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) { public void registerBlockIcons(IIconRegister par1IconRegister) {
textureTopOn = par1IconRegister.registerIcon("buildcraft:blockFillerTopOn"); textureTopOn = par1IconRegister.registerIcon("buildcraft:blockFillerTopOn");
textureTopOff = par1IconRegister.registerIcon("buildcraft:blockFillerTopOff"); textureTopOff = par1IconRegister.registerIcon("buildcraft:blockFillerTopOff");
textureSides = par1IconRegister.registerIcon("buildcraft:blockFillerSides"); 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
@ -13,24 +14,27 @@ import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; 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.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class BlockMarker extends BlockContainer { public class BlockMarker extends BlockContainer {
public BlockMarker(int i) { public BlockMarker() {
super(i, Material.circuits); super(Material.circuits);
setLightValue(0.5F); setLightLevel(0.5F);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get()); setCreativeTab(CreativeTabBuildCraft.MACHINES.get());
} }
@ -80,20 +84,20 @@ public class BlockMarker extends BlockContainer {
} }
@Override @Override
public TileEntity createNewTileEntity(World var1) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TileMarker(); return new TileMarker();
} }
@Override @Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) { 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; return true;
} }
@Override @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); Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6); super.breakBlock(world, x, y, z, block, par6);
} }
@Override @Override
@ -112,8 +116,8 @@ public class BlockMarker extends BlockContainer {
} }
@Override @Override
public void onNeighborBlockChange(World world, int x, int y, int z, int blockId) { public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
((TileMarker) world.getBlockTileEntity(x, y, z)).updateSignals(); ((TileMarker) world.getTileEntity(x, y, z)).updateSignals();
dropTorchIfCantStay(world, x, y, z); 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) { private void dropTorchIfCantStay(World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z); int meta = world.getBlockMetadata(x, y, z);
if (!canPlaceBlockOnSide(world, x, y, z, meta)) { if (!canPlaceBlockOnSide(world, x, y, z, meta)) {
dropBlockAsItem(world, x, y, z, BuildCraftBuilders.markerBlock.blockID, 0); dropBlockAsItem(world, x, y, z, 0, 0);
world.setBlock(x, y, z, 0); world.setBlockToAir(x, y, z);
} }
} }
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) { public void registerBlockIcons(IIconRegister iconRegister) {
this.blockIcon = iconRegister.registerIcon("buildcraft:blockMarker"); 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
import buildcraft.core.utils.Utils; import buildcraft.core.utils.Utils;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; 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.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockPathMarker extends BlockMarker { public class BlockPathMarker extends BlockMarker {
private Icon activeMarker; private IIcon activeMarker;
public BlockPathMarker(int i) { public BlockPathMarker() {
super(i);
} }
@Override @Override
public TileEntity createNewTileEntity(World var1) { public TileEntity createNewTileEntity(World world, int metadata) {
return new TilePathMarker(); return new TilePathMarker();
} }
@Override @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); Utils.preDestroyBlock(world, x, y, z);
super.breakBlock(world, x, y, z, par5, par6); super.breakBlock(world, x, y, z, block, par6);
} }
@SuppressWarnings({ "all" }) @SuppressWarnings({ "all" })
// @Override (client only) // @Override (client only)
public Icon getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l) { public IIcon getIcon(IBlockAccess iblockaccess, int i, int j, int k, int l) {
TilePathMarker marker = (TilePathMarker) iblockaccess.getBlockTileEntity(i, j, k); TilePathMarker marker = (TilePathMarker) iblockaccess.getTileEntity(i, j, k);
if (l == 1 || (marker != null && marker.tryingToConnect)) if (l == 1 || (marker != null && marker.tryingToConnect))
return activeMarker; return activeMarker;
else else
return super.getBlockTexture(iblockaccess, i, j, k, l); return super.getIcon(iblockaccess, i, j, k, l);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) public void registerBlockIcons(IIconRegister par1IconRegister)
{ {
blockIcon = par1IconRegister.registerIcon("buildcraft:blockPathMarker"); blockIcon = par1IconRegister.registerIcon("buildcraft:blockPathMarker");
activeMarker = par1IconRegister.registerIcon("buildcraft:blockPathMarkerActive"); 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; package buildcraft.builders;
import cpw.mods.fml.common.SidedProxy; 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; package buildcraft.builders;
import buildcraft.BuildCraftBuilders; 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 * http://www.mod-buildcraft.com
* *
* BuildCraft is distributed under the terms of the Minecraft Mod Public * 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 * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -15,7 +14,7 @@ import net.minecraft.world.World;
public class BuildersProxy { public class BuildersProxy {
public static boolean canPlaceTorch(World world, int i, int j, int k) { 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()) if (block == null || !block.renderAsNormalBlock())
return false; 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; package buildcraft.builders;
import buildcraft.BuildCraftBuilders; 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.event.world.WorldEvent;
public class EventHandlerBuilders { public class EventHandlerBuilders {
@ForgeSubscribe @SubscribeEvent
public void handleWorldLoad(WorldEvent.Load event) { public void handleWorldLoad(WorldEvent.Load event) {
// Temporary solution // Temporary solution
// Please remove the world Load event when world Unload event gets implimented // 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) { public void handleWorldUnload(WorldEvent.Unload event) {
// When a world unloads clean from the list of available markers the ones // When a world unloads clean from the list of available markers the ones
// that were on the unloaded world // 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; package buildcraft.builders;
import buildcraft.builders.gui.ContainerBlueprintLibrary; import buildcraft.builders.gui.ContainerBlueprintLibrary;
@ -25,7 +33,7 @@ public class GuiHandler implements IGuiHandler {
if (!world.blockExists(x, y, z)) if (!world.blockExists(x, y, z))
return null; return null;
TileEntity tile = world.getBlockTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) { switch (ID) {
@ -67,7 +75,7 @@ public class GuiHandler implements IGuiHandler {
if (!world.blockExists(x, y, z)) if (!world.blockExists(x, y, z))
return null; return null;
TileEntity tile = world.getBlockTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
switch (ID) { switch (ID) {
@ -92,10 +100,11 @@ public class GuiHandler implements IGuiHandler {
return new ContainerFiller(player.inventory, (TileFiller) tile); return new ContainerFiller(player.inventory, (TileFiller) tile);
case GuiIds.URBANIST: 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; return null;
return new ContainerUrbanist(player.inventory, (TileUrbanist) tile); } else {
return new ContainerUrbanist(player.inventory, (TileUrbanist) tile);
}
default: default:
return null; 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; package buildcraft.builders;
import buildcraft.core.blueprints.BptRootIndex; 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
@ -23,8 +24,8 @@ import buildcraft.builders.blueprints.BlueprintId;
public abstract class ItemBlueprint extends ItemBuildCraft { public abstract class ItemBlueprint extends ItemBuildCraft {
public ItemBlueprint(int i) { public ItemBlueprint() {
super(i); super();
setMaxStackSize(1); setMaxStackSize(1);
setCreativeTab(CreativeTabBuildCraft.MACHINES.get()); 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 * BuildCraft is distributed under the terms of the Minecraft Mod Public
* 1.0, or MMPL. Please check the contents of the license located in * License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt * http://www.mod-buildcraft.com/MMPL-1.0.txt
*/ */
package buildcraft.builders; package buildcraft.builders;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
public class ItemBlueprintStandard extends ItemBlueprint { public class ItemBlueprintStandard extends ItemBlueprint {
private Icon cleanBlueprint; private IIcon cleanBlueprint;
private Icon usedBlueprint; private IIcon usedBlueprint;
public ItemBlueprintStandard(int i) { public ItemBlueprintStandard() {
super(i); super();
} }
@Override @Override
public Icon getIconFromDamage(int damage) { public IIcon getIconFromDamage(int damage) {
if (damage == 0) if (damage == 0)
return cleanBlueprint; return cleanBlueprint;
else else
@ -31,7 +32,7 @@ public class ItemBlueprintStandard extends ItemBlueprint {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) { public void registerIcons(IIconRegister par1IconRegister) {
cleanBlueprint = par1IconRegister.registerIcon("buildcraft:blueprint_clean"); cleanBlueprint = par1IconRegister.registerIcon("buildcraft:blueprint_clean");
usedBlueprint = par1IconRegister.registerIcon("buildcraft:blueprint_used"); 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; package buildcraft.builders;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.Icon; import net.minecraft.util.IIcon;
public class ItemBlueprintTemplate extends ItemBlueprint { public class ItemBlueprintTemplate extends ItemBptBase {
private IIcon usedTemplate;
private Icon usedTemplate; public ItemBlueprintTemplate() {
super();
public ItemBlueprintTemplate(int i) {
super(i);
} }
@Override @Override
public Icon getIconFromDamage(int i) { public IIcon getIconFromDamage(int i) {
if (i == 0) if (i == 0)
return itemIcon; return itemIcon;
else else
@ -23,7 +30,7 @@ public class ItemBlueprintTemplate extends ItemBlueprint {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1IconRegister) { public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = par1IconRegister.registerIcon("buildcraft:template_clean"); itemIcon = par1IconRegister.registerIcon("buildcraft:template_clean");
usedTemplate = par1IconRegister.registerIcon("buildcraft:template_used"); usedTemplate = par1IconRegister.registerIcon("buildcraft:template_used");
} }

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