Merge branch '6.1.x-research' into 6.1.x

This commit is contained in:
SpaceToad 2014-07-27 23:06:13 +02:00
commit 149700c721
40 changed files with 2042 additions and 57 deletions

View file

@ -140,6 +140,7 @@ gui.pipes.emzuli.title=Extraction Presets
gui.pipes.emzuli.paint=Paint Items %s
gui.pipes.emzuli.nopaint=Don't Paint Items
item.scienceBook.name=Engineering Science Book
item.bucketFuel.name=Fuel Bucket
item.bucketOil.name=Oil Bucket
item.woodenGearItem.name=Wood Gear

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

View file

@ -27,6 +27,7 @@ import net.minecraft.launchwrapper.Launch;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -127,6 +128,8 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.blueprints.RealBlueprintDeployer;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.science.TechnoSimpleItem;
import buildcraft.core.science.Tier;
@Mod(name = "BuildCraft Builders", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Builders", dependencies = DefaultProps.DEPENDENCY_CORE)
public class BuildCraftBuilders extends BuildCraftMod {
@ -145,6 +148,18 @@ public class BuildCraftBuilders extends BuildCraftMod {
public static BlockUrbanist urbanistBlock;
public static ItemBlueprintTemplate templateItem;
public static ItemBlueprintStandard blueprintItem;
public static TechnoSimpleItem technoMarkerBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoPathMarkerBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoConstructionMarkerBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoFillerBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoBuilderBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoArchitectBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoLibraryBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoUrbanistBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoTemplateItem = new TechnoSimpleItem();
public static TechnoSimpleItem technoBlueprintItem = new TechnoSimpleItem();
public static ActionFiller[] fillerActions;
@Mod.Instance("BuildCraft|Builders")
public static BuildCraftBuilders instance;
@ -483,6 +498,63 @@ public class BuildCraftBuilders extends BuildCraftMod {
StatementManager.registerActionProvider(new BuildersActionProvider());
}
@Mod.EventHandler
public void loadTechnology(FMLPostInitializationEvent evt) {
// technoBuildToolBlock
technoFillerBlock.initialize(
Tier.GoldenGear,
fillerBlock,
new ItemStack(BuildCraftCore.goldGearItem, 10)
/* Machines Technology */
/* Building Technology */);
technoMarkerBlock.initialize(
Tier.GoldenGear,
markerBlock,
new ItemStack(BuildCraftCore.goldGearItem, 5)
/* Localisation Technology */);
technoPathMarkerBlock.initialize(
Tier.DiamondGear,
pathMarkerBlock,
new ItemStack(BuildCraftCore.diamondGearItem, 2),
technoMarkerBlock
/* Localisation Technology */);
// technoConstructionMarkerBlock;
technoBuilderBlock.initialize(
Tier.DiamondGear,
builderBlock,
new ItemStack(BuildCraftCore.diamondGearItem, 5),
technoFillerBlock);
technoTemplateItem.initialize(
Tier.DiamondGear,
templateItem,
new ItemStack(BuildCraftCore.diamondGearItem, 2),
technoBuilderBlock);
technoBlueprintItem.initialize(
Tier.DiamondGear,
blueprintItem,
new ItemStack(BuildCraftCore.diamondGearItem, 5),
technoTemplateItem);
technoArchitectBlock.initialize(
Tier.EmeraldGear,
architectBlock,
new ItemStack(BuildCraftCore.diamondGearItem /* emerald gear */, 8),
technoBuilderBlock);
technoLibraryBlock.initialize(
Tier.RedstoneCrystalGear,
libraryBlock,
new ItemStack(BuildCraftCore.diamondGearItem /* redstone gear */, 2),
technoArchitectBlock);
}
public static void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(templateItem, 1), "ppp", "pip", "ppp", 'i',
new ItemStack(Items.dye, 1, 0), 'p', Items.paper);

View file

@ -75,13 +75,15 @@ import buildcraft.core.BuildCraftConfiguration;
import buildcraft.core.CommandBuildCraft;
import buildcraft.core.CoreIconProvider;
import buildcraft.core.DefaultProps;
import buildcraft.core.GuiHandler;
import buildcraft.core.InterModComms;
import buildcraft.core.ItemBuildCraft;
import buildcraft.core.ItemGear;
import buildcraft.core.ItemMapLocation;
import buildcraft.core.ItemScienceBook;
import buildcraft.core.ItemSpring;
import buildcraft.core.ItemWrench;
import buildcraft.core.SpringPopulate;
import buildcraft.core.TickHandlerCoreClient;
import buildcraft.core.TickHandlerCore;
import buildcraft.core.Version;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.network.EntityIds;
@ -94,6 +96,8 @@ import buildcraft.core.recipes.IntegrationRecipeManager;
import buildcraft.core.recipes.RefineryRecipeManager;
import buildcraft.core.render.BlockHighlightHandler;
import buildcraft.core.robots.EntityRobot;
import buildcraft.core.science.TechnoSimpleItem;
import buildcraft.core.science.Tier;
import buildcraft.core.triggers.ActionMachineControl;
import buildcraft.core.triggers.ActionMachineControl.Mode;
import buildcraft.core.triggers.ActionRedstoneOutput;
@ -139,6 +143,7 @@ public class BuildCraftCore extends BuildCraftMod {
public static final int trackedPassiveEntityId = 156;
public static Block springBlock;
public static Item scienceBookItem;
public static Item woodenGearItem;
public static Item stoneGearItem;
public static Item ironGearItem;
@ -183,9 +188,10 @@ public class BuildCraftCore extends BuildCraftMod {
public static IAction actionOn = new ActionMachineControl(Mode.On);
public static IAction actionOff = new ActionMachineControl(Mode.Off);
public static IAction actionLoop = new ActionMachineControl(Mode.Loop);
public static boolean loadDefaultRecipes = true;
public static boolean consumeWaterSources = false;
//public static BptItem[] itemBptProps = new BptItem[Item.itemsList.length];
@Mod.Instance("BuildCraft|Core")
public static BuildCraftCore instance;
@ -220,6 +226,8 @@ public class BuildCraftCore extends BuildCraftMod {
public static GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("buildcraft.core".getBytes()), "[BuildCraft]");
private static TechnoSimpleItem technoWrenchItem = new TechnoSimpleItem();
private static FloatBuffer modelviewF;
private static FloatBuffer projectionF;
private static IntBuffer viewport;
@ -285,23 +293,26 @@ public class BuildCraftCore extends BuildCraftMod {
consumeWaterSources = consumeWater.getBoolean(consumeWaterSources);
consumeWater.comment = "set to true if the Pump should consume water";
woodenGearItem = (new ItemBuildCraft()).setUnlocalizedName("woodenGearItem");
scienceBookItem = (new ItemScienceBook()).setUnlocalizedName("scienceBook");
CoreProxy.proxy.registerItem(scienceBookItem);
woodenGearItem = (new ItemGear(10 * 20)).setUnlocalizedName("woodenGearItem");
CoreProxy.proxy.registerItem(woodenGearItem);
OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));
stoneGearItem = (new ItemBuildCraft()).setUnlocalizedName("stoneGearItem");
stoneGearItem = (new ItemGear(20 * 20)).setUnlocalizedName("stoneGearItem");
CoreProxy.proxy.registerItem(stoneGearItem);
OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem));
ironGearItem = (new ItemBuildCraft()).setUnlocalizedName("ironGearItem");
ironGearItem = (new ItemGear(40 * 20)).setUnlocalizedName("ironGearItem");
CoreProxy.proxy.registerItem(ironGearItem);
OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem));
goldGearItem = (new ItemBuildCraft()).setUnlocalizedName("goldGearItem");
goldGearItem = (new ItemGear(80 * 20)).setUnlocalizedName("goldGearItem");
CoreProxy.proxy.registerItem(goldGearItem);
OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem));
diamondGearItem = (new ItemBuildCraft()).setUnlocalizedName("diamondGearItem");
diamondGearItem = (new ItemGear(160 * 20)).setUnlocalizedName("diamondGearItem");
CoreProxy.proxy.registerItem(diamondGearItem);
OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem));
@ -352,6 +363,7 @@ public class BuildCraftCore extends BuildCraftMod {
CoreProxy.proxy.initializeRendering();
CoreProxy.proxy.initializeEntityRendering();
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
}
@Mod.EventHandler
@ -369,7 +381,7 @@ public class BuildCraftCore extends BuildCraftMod {
BuildCraftAPI.softBlocks.add(Blocks.fire);
BuildCraftAPI.softBlocks.add(Blocks.air);
FMLCommonHandler.instance().bus().register(new TickHandlerCoreClient());
FMLCommonHandler.instance().bus().register(new TickHandlerCore());
BuildCraftAPI.isSoftProperty = new WorldPropertyIsSoft();
BuildCraftAPI.isWoodProperty = new WorldPropertyIsWood();
@ -404,14 +416,35 @@ public class BuildCraftCore extends BuildCraftMod {
}
@Mod.EventHandler
public void loadTechnology(FMLPostInitializationEvent evt) {
Tier.initializeTechnologies();
technoWrenchItem.initialize(
Tier.StoneGear,
wrenchItem,
new ItemStack(stoneGearItem, 10));
}
public void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(scienceBookItem), "R ", "B ", 'R', Blocks.redstone_torch, 'B',
Items.book);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(wrenchItem), "I I", " G ", " I ", 'I', Items.iron_ingot, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(woodenGearItem), " S ", "S S", " S ", 'S', "stickWood");
CoreProxy.proxy.addCraftingRecipe(new ItemStack(stoneGearItem), " I ", "IGI", " I ", 'I', "cobblestone", 'G',
CoreProxy.proxy.addCraftingRecipe(Tier.WoodenGear.getTechnology(), new ItemStack(woodenGearItem), " S ", "S S",
" S ", 'S',
"stickWood");
CoreProxy.proxy.addCraftingRecipe(Tier.StoneGear.getTechnology(), new ItemStack(stoneGearItem), " I ", "IGI",
" I ", 'I',
"cobblestone", 'G',
woodenGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(ironGearItem), " I ", "IGI", " I ", 'I', Items.iron_ingot, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(goldGearItem), " I ", "IGI", " I ", 'I', Items.gold_ingot, 'G', ironGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(diamondGearItem), " I ", "IGI", " I ", 'I', Items.diamond, 'G', goldGearItem);
CoreProxy.proxy.addCraftingRecipe(Tier.IronGear.getTechnology(), new ItemStack(ironGearItem), " I ", "IGI",
" I ", 'I',
Items.iron_ingot, 'G', stoneGearItem);
CoreProxy.proxy.addCraftingRecipe(Tier.GoldenGear.getTechnology(), new ItemStack(goldGearItem), " I ", "IGI",
" I ", 'I',
Items.gold_ingot, 'G', ironGearItem);
CoreProxy.proxy.addCraftingRecipe(Tier.DiamondGear.getTechnology(),
new ItemStack(diamondGearItem), " I ", "IGI", " I ", 'I', Items.diamond, 'G', goldGearItem);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(mapLocationItem), "ppp", "pYp", "ppp", 'p', Items.paper, 'Y', new ItemStack(Items.dye, 1, 11));
}

View file

@ -55,6 +55,8 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.science.TechnoSimpleItem;
import buildcraft.core.science.Tier;
import buildcraft.core.triggers.BCTrigger;
import buildcraft.energy.BlockBuildcraftFluid;
import buildcraft.energy.BlockEnergyConverter;
@ -102,6 +104,11 @@ public class BuildCraftEnergy extends BuildCraftMod {
public static Item bucketFuel;
public static Item bucketRedPlasma;
public static Item fuel;
public static TechnoSimpleItem technoRedstoneEngine = new TechnoSimpleItem();
public static TechnoSimpleItem technoStoneEngine = new TechnoSimpleItem();
public static TechnoSimpleItem technoIronEngine = new TechnoSimpleItem();
public static boolean canOilBurn;
public static double oilWellScalar = 1.0;
public static Set<Integer> oilBiomeIDs = new HashSet<Integer>();
@ -341,6 +348,7 @@ public class BuildCraftEnergy extends BuildCraftMod {
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
EnergyProxy.proxy.registerBlockRenderers();
EnergyProxy.proxy.registerTileEntities();
}
@ -363,13 +371,28 @@ public class BuildCraftEnergy extends BuildCraftMod {
}
}
@Mod.EventHandler
public void loadTechnology(FMLPostInitializationEvent evt) {
technoRedstoneEngine.initialize(Tier.WoodenGear, new ItemStack(engineBlock, 1, 0),
new ItemStack(BuildCraftCore.woodenGearItem, 5));
technoStoneEngine.initialize(Tier.StoneGear, new ItemStack(engineBlock, 1, 1),
new ItemStack(BuildCraftCore.stoneGearItem, 10), technoRedstoneEngine);
technoIronEngine.initialize(Tier.IronGear, new ItemStack(engineBlock, 1, 2),
new ItemStack(BuildCraftCore.ironGearItem, 20), technoStoneEngine);
}
public static void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 0),
CoreProxy.proxy.addCraftingRecipe(technoRedstoneEngine,
new ItemStack(engineBlock, 1, 0),
"www", " g ", "GpG", 'w', "plankWood", 'g', Blocks.glass, 'G',
BuildCraftCore.woodenGearItem, 'p', Blocks.piston);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 1), "www", " g ", "GpG", 'w', "cobblestone",
CoreProxy.proxy.addCraftingRecipe(technoStoneEngine,
new ItemStack(engineBlock, 1, 1), "www", " g ", "GpG", 'w', "cobblestone",
'g', Blocks.glass, 'G', BuildCraftCore.stoneGearItem, 'p', Blocks.piston);
CoreProxy.proxy.addCraftingRecipe(new ItemStack(engineBlock, 1, 2), "www", " g ", "GpG", 'w', Items.iron_ingot,
CoreProxy.proxy.addCraftingRecipe(technoIronEngine,
new ItemStack(engineBlock, 1, 2), "www", " g ", "GpG", 'w', Items.iron_ingot,
'g', Blocks.glass, 'G', BuildCraftCore.ironGearItem, 'p', Blocks.piston);
if (blockEnergyConverter != null) {

View file

@ -43,6 +43,8 @@ import buildcraft.core.InterModComms;
import buildcraft.core.Version;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.science.TechnoSimpleItem;
import buildcraft.core.science.Tier;
import buildcraft.core.utils.ConfigUtils;
import buildcraft.factory.BlockAutoWorkbench;
import buildcraft.factory.BlockFloodGate;
@ -85,6 +87,16 @@ public class BuildCraftFactory extends BuildCraftMod {
public static BlockTank tankBlock;
public static BlockRefinery refineryBlock;
public static BlockHopper hopperBlock;
public static TechnoSimpleItem technoQuarryBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoMiningWellBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoAutoWorkbench = new TechnoSimpleItem();
public static TechnoSimpleItem technoPumpBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoFloodGateBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoTankBlock = new TechnoSimpleItem();
public static TechnoSimpleItem techoRefineryBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoHopperBlock = new TechnoSimpleItem();
public static boolean allowMining = true;
public static boolean quarryOneTimeUse = false;
public static float miningMultiplier = 1;
@ -222,8 +234,62 @@ public class BuildCraftFactory extends BuildCraftMod {
MinecraftForge.EVENT_BUS.register(this);
}
public static void loadRecipes() {
@Mod.EventHandler
public void loadTechnology(FMLPostInitializationEvent evt) {
technoAutoWorkbench.initialize(
Tier.WoodenGear,
autoWorkbenchBlock,
new ItemStack(BuildCraftCore.woodenGearItem, 10),
BuildCraftEnergy.technoRedstoneEngine,
BuildCraftTransport.technoPipeItemsWood);
technoTankBlock.initialize(
Tier.WoodenGear,
tankBlock,
new ItemStack(BuildCraftCore.woodenGearItem, 15));
technoHopperBlock.initialize(
Tier.StoneGear,
hopperBlock,
new ItemStack(BuildCraftCore.stoneGearItem, 10),
BuildCraftTransport.technoPipeItemsStone);
technoMiningWellBlock.initialize(
Tier.IronGear,
miningWellBlock,
new ItemStack(BuildCraftCore.ironGearItem, 5),
BuildCraftTransport.technoPipeItemsIron);
technoPumpBlock.initialize(
Tier.IronGear,
pumpBlock,
new ItemStack(BuildCraftCore.ironGearItem, 5),
BuildCraftTransport.technoPipeFluidsIron,
technoMiningWellBlock);
technoFloodGateBlock.initialize(
Tier.IronGear,
floodGateBlock,
new ItemStack(BuildCraftCore.ironGearItem, 10),
BuildCraftTransport.technoPipeFluidsStone);
techoRefineryBlock.initialize(
Tier.DiamondGear,
refineryBlock,
new ItemStack(BuildCraftCore.diamondGearItem, 2),
technoPumpBlock,
technoTankBlock);
technoQuarryBlock.initialize(
Tier.DiamondGear,
quarryBlock,
new ItemStack(BuildCraftCore.diamondGearItem, 5),
technoMiningWellBlock,
BuildCraftTransport.technoPipeStructureCobblestone
/* TODO: add generic building here */);
}
public static void loadRecipes() {
if (allowMining) {
if (miningWellBlock != null) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(miningWellBlock, 1),
@ -273,7 +339,7 @@ public class BuildCraftFactory extends BuildCraftMod {
}
if (autoWorkbenchBlock != null) {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(autoWorkbenchBlock),
CoreProxy.proxy.addCraftingRecipe(technoAutoWorkbench, new ItemStack(autoWorkbenchBlock),
" g ",
"gwg",
" g ",

View file

@ -19,6 +19,7 @@ import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
@ -57,6 +58,8 @@ import buildcraft.core.robots.boards.BoardRobotMinerNBT;
import buildcraft.core.robots.boards.BoardRobotPickerNBT;
import buildcraft.core.robots.boards.BoardRobotPlanterNBT;
import buildcraft.core.robots.boards.BoardRobotShovelmanNBT;
import buildcraft.core.science.TechnoSimpleItem;
import buildcraft.core.science.Tier;
import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.BlockLaserTable;
import buildcraft.silicon.GuiHandler;
@ -98,15 +101,14 @@ import buildcraft.transport.triggers.TriggerParameterSignal;
@Mod(name = "BuildCraft Silicon", version = Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
public class BuildCraftSilicon extends BuildCraftMod {
@Mod.Instance("BuildCraft|Silicon")
public static BuildCraftSilicon instance;
public static ItemRedstoneChipset redstoneChipset;
public static ItemRedstoneBoard redstoneBoard;
public static BlockLaser laserBlock;
public static BlockLaserTable assemblyTableBlock;
public static BlockZonePlan zonePlanBlock;
@Mod.Instance("BuildCraft|Silicon")
public static BuildCraftSilicon instance;
public static Item redstoneCrystal;
public static Item robotItem;
@ -121,6 +123,15 @@ public class BuildCraftSilicon extends BuildCraftMod {
public static ITrigger triggerRobotSleep = new TriggerRobotSleep();
public static TechnoSimpleItem technoRedstoneBoard = new TechnoSimpleItem();
public static TechnoSimpleItem technoLaserBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoAssemblyTableBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoAdvancedCraftingTableBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoIntegrationTableBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoZonePlanBlock = new TechnoSimpleItem();
public static TechnoSimpleItem technoRedstoneCrystal = new TechnoSimpleItem();
public static TechnoSimpleItem technoRobotItem = new TechnoSimpleItem();
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent evt) {
SchematicRegistry.declareBlueprintSupport("BuildCraft|Silicon");
@ -200,6 +211,49 @@ public class BuildCraftSilicon extends BuildCraftMod {
StatementManager.registerParameterClass("buildcraft:pipeWireAction", ActionParameterSignal.class);
}
@Mod.EventHandler
public void loadTechnology(FMLPostInitializationEvent evt) {
technoLaserBlock.initialize(
Tier.EmeraldGear,
laserBlock,
new ItemStack(BuildCraftCore.diamondGearItem /* emerald */, 5));
technoAssemblyTableBlock.initialize(
Tier.EmeraldGear,
new ItemStack(assemblyTableBlock, 1, 0),
new ItemStack(BuildCraftCore.diamondGearItem /* emerald */, 5));
technoRedstoneCrystal.initialize(
Tier.EmeraldGear,
redstoneCrystal,
new ItemStack(BuildCraftCore.diamondGearItem /* emerald */, 10));
technoAdvancedCraftingTableBlock.initialize(
Tier.RedstoneCrystalGear,
new ItemStack(assemblyTableBlock, 1, 1),
new ItemStack(BuildCraftCore.diamondGearItem /* emerald */, 5));
technoIntegrationTableBlock.initialize(
Tier.RedstoneCrystalGear,
new ItemStack(assemblyTableBlock, 1, 2),
new ItemStack(BuildCraftCore.diamondGearItem /* emerald */, 5));
technoRedstoneBoard.initialize(
Tier.DiamondChipset,
redstoneBoard,
new ItemStack(BuildCraftCore.diamondGearItem /* */, 5));
technoRobotItem.initialize(
Tier.DiamondChipset,
robotItem,
new ItemStack(BuildCraftCore.diamondGearItem /* */, 5));
technoZonePlanBlock.initialize(
Tier.RedstoneCrystalChipset,
zonePlanBlock,
new ItemStack(BuildCraftCore.diamondGearItem /* */, 5));
}
public static void loadRecipes() {
// TABLES

View file

@ -51,6 +51,8 @@ import buildcraft.core.ItemBuildCraft;
import buildcraft.core.Version;
import buildcraft.core.network.BuildCraftChannelHandler;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.science.TechnoSimpleItem;
import buildcraft.core.science.Tier;
import buildcraft.core.triggers.ActionPipeClose;
import buildcraft.transport.BlockFilteredBuffer;
import buildcraft.transport.BlockGenericPipe;
@ -161,7 +163,6 @@ public class BuildCraftTransport extends BuildCraftMod {
public static Item pipePowerIron;
public static Item pipePowerGold;
public static Item pipePowerDiamond;
public static Item pipePowerHeat;
public static ItemFacade facadeItem;
public static Item plugItem;
public static Item robotStationItem;
@ -188,6 +189,40 @@ public class BuildCraftTransport extends BuildCraftMod {
public static IAction actionExtractionPresetGreen = new ActionExtractionPreset(EnumColor.GREEN);
public static IAction actionExtractionPresetYellow = new ActionExtractionPreset(EnumColor.YELLOW);
public static TechnoSimpleItem technoPipeItemsWood = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsEmerald = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsStone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsCobblestone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsIron = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsQuartz = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsGold = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsDiamond = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsObsidian = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsLapis = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsDaizuli = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsVoid = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsSandstone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsEmzuli = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeItemsStripes = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeStructureCobblestone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsWood = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsCobblestone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsStone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsIron = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsGold = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsVoid = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsSandstone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipeFluidsEmerald = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipePowerWood = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipePowerCobblestone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipePowerStone = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipePowerQuartz = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipePowerIron = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipePowerGold = new TechnoSimpleItem();
public static TechnoSimpleItem technoPipePowerDiamond = new TechnoSimpleItem();
@Mod.Instance("BuildCraft|Transport")
public static BuildCraftTransport instance;
@ -460,8 +495,216 @@ public class BuildCraftTransport extends BuildCraftMod {
ItemFacade.initialize();
}
public void loadRecipes() {
@Mod.EventHandler
public void loadTechnology(FMLPostInitializationEvent evt) {
// Item pipes
technoPipeItemsWood.initialize(
Tier.WoodenGear,
pipeItemsWood,
new ItemStack(BuildCraftCore.woodenGearItem, 5));
technoPipeItemsCobblestone.initialize(
Tier.WoodenGear,
pipeItemsCobblestone,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsWood);
technoPipeItemsStone.initialize(
Tier.WoodenGear,
pipeItemsStone,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsWood);
technoPipeItemsSandstone.initialize(
Tier.WoodenGear,
pipeItemsSandstone,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsWood);
technoPipeItemsQuartz.initialize(
Tier.WoodenGear,
pipeItemsQuartz,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsWood);
technoPipeStructureCobblestone.initialize(
Tier.WoodenGear,
pipeStructureCobblestone,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsCobblestone);
technoPipeItemsIron.initialize(
Tier.StoneGear,
pipeItemsIron,
new ItemStack(BuildCraftCore.stoneGearItem, 5),
technoPipeItemsStone);
technoPipeItemsGold.initialize(
Tier.StoneGear,
pipeItemsGold,
new ItemStack(BuildCraftCore.stoneGearItem, 5),
technoPipeItemsStone);
technoPipeItemsObsidian.initialize(
Tier.StoneGear,
pipeItemsObsidian,
new ItemStack(BuildCraftCore.stoneGearItem, 5),
technoPipeItemsStone);
technoPipeItemsVoid.initialize(
Tier.StoneGear,
pipeItemsVoid,
new ItemStack(BuildCraftCore.stoneGearItem, 5),
technoPipeItemsObsidian);
technoPipeItemsDiamond.initialize(
Tier.IronGear,
pipeItemsDiamond,
new ItemStack(BuildCraftCore.ironGearItem, 5),
technoPipeItemsIron);
technoPipeItemsDaizuli.initialize(
Tier.IronGear,
pipeItemsDaizuli,
new ItemStack(BuildCraftCore.ironGearItem, 5),
technoPipeItemsDiamond);
technoPipeItemsLapis.initialize(
Tier.IronGear,
pipeItemsLapis,
new ItemStack(BuildCraftCore.ironGearItem, 5),
technoPipeItemsDiamond);
technoPipeItemsEmerald.initialize(
Tier.GoldenGear,
pipeItemsEmerald,
new ItemStack(BuildCraftCore.goldGearItem, 5),
technoPipeItemsDiamond);
technoPipeItemsStripes.initialize(
Tier.GoldenGear,
pipeItemsStripes,
new ItemStack(BuildCraftCore.goldGearItem, 5),
technoPipeItemsObsidian);
technoPipeItemsEmzuli.initialize(
Tier.GoldenGear,
pipeItemsEmzuli,
new ItemStack(BuildCraftCore.goldGearItem, 5),
technoPipeItemsDiamond);
// Fluid pipes
technoPipeFluidsWood.initialize(
Tier.WoodenGear,
pipeFluidsWood,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsWood,
BuildCraftFactory.technoTankBlock);
technoPipeFluidsCobblestone.initialize(
Tier.WoodenGear,
pipeFluidsCobblestone,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsCobblestone,
technoPipeFluidsWood);
technoPipeFluidsStone.initialize(
Tier.WoodenGear,
pipeFluidsStone,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsStone,
technoPipeFluidsWood);
technoPipeFluidsSandstone.initialize(
Tier.WoodenGear,
pipeFluidsSandstone,
new ItemStack(BuildCraftCore.woodenGearItem, 5),
technoPipeItemsSandstone,
technoPipeFluidsWood);
technoPipeFluidsIron.initialize(
Tier.StoneGear,
pipeFluidsIron,
new ItemStack(BuildCraftCore.stoneGearItem, 5),
technoPipeItemsIron,
technoPipeFluidsStone);
technoPipeFluidsGold.initialize(
Tier.StoneGear,
pipeFluidsGold,
new ItemStack(BuildCraftCore.stoneGearItem, 5),
technoPipeItemsGold,
technoPipeFluidsStone);
technoPipeFluidsVoid.initialize(
Tier.StoneGear,
pipeFluidsVoid,
new ItemStack(BuildCraftCore.stoneGearItem, 5),
technoPipeItemsVoid,
technoPipeFluidsStone);
technoPipeFluidsEmerald.initialize(
Tier.GoldenGear,
pipeFluidsEmerald,
new ItemStack(BuildCraftCore.goldGearItem, 2),
technoPipeItemsDiamond,
technoPipeFluidsStone);
// Power pipes
technoPipePowerWood.initialize(
Tier.IronGear,
pipePowerWood,
new ItemStack(BuildCraftCore.ironGearItem, 5),
technoPipeItemsWood);
technoPipePowerCobblestone.initialize(
Tier.IronGear,
pipePowerCobblestone,
new ItemStack(BuildCraftCore.ironGearItem, 5),
technoPipeItemsWood,
technoPipePowerWood);
technoPipePowerStone.initialize(
Tier.IronGear,
pipePowerStone,
new ItemStack(BuildCraftCore.ironGearItem, 5),
technoPipeItemsStone,
technoPipePowerWood);
technoPipePowerQuartz.initialize(
Tier.IronGear,
pipePowerQuartz,
new ItemStack(BuildCraftCore.ironGearItem, 5),
technoPipeItemsQuartz,
technoPipePowerWood);
technoPipePowerIron.initialize(
Tier.GoldenGear,
pipePowerIron,
new ItemStack(BuildCraftCore.goldGearItem, 5),
technoPipeItemsIron,
technoPipePowerWood);
technoPipePowerGold.initialize(
Tier.GoldenGear,
pipePowerGold,
new ItemStack(BuildCraftCore.goldGearItem, 5),
technoPipeItemsGold,
technoPipePowerWood);
technoPipePowerDiamond.initialize(
Tier.GoldenGear,
pipePowerDiamond,
new ItemStack(BuildCraftCore.goldGearItem, 5),
technoPipeItemsDiamond,
technoPipePowerWood);
}
public void loadRecipes() {
// Add base recipe for pipe waterproof.
GameRegistry.addShapelessRecipe(new ItemStack(pipeWaterproof, 1), new ItemStack(Items.dye, 1, 2));

View file

@ -0,0 +1,38 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import buildcraft.core.gui.ContainerScienceBook;
import buildcraft.core.gui.GuiScienceBook;
public class GuiHandler implements IGuiHandler {
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id == GuiIds.SCIENCE_BOOK) {
return new GuiScienceBook(player);
}
return null;
}
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id == GuiIds.SCIENCE_BOOK) {
return new ContainerScienceBook(player);
}
return null;
}
}

View file

@ -35,6 +35,8 @@ public final class GuiIds {
public static final int REDSTONE_BOARD = 70;
public static final int SCIENCE_BOOK = 70;
/**
* Deactivate constructor
*/

View file

@ -0,0 +1,26 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core;
import buildcraft.core.science.IItemTechnologyProvider;
public class ItemGear extends ItemBuildCraft implements IItemTechnologyProvider {
private int processTime;
public ItemGear(int iProcessTime) {
processTime = iProcessTime;
}
@Override
public int timeToProcess() {
return processTime;
}
}

View file

@ -0,0 +1,43 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.BuildCraftCore;
public class ItemScienceBook extends ItemBuildCraft {
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = par1IconRegister.registerIcon("buildcraft:science_book");
}
@Override
public int getItemStackLimit(ItemStack stack) {
return 1;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World world, EntityPlayer entityPlayer) {
if (!world.isRemote) {
entityPlayer.openGui(BuildCraftCore.instance, GuiIds.SCIENCE_BOOK, world, 0, 0, 0);
}
return par1ItemStack;
}
}

View file

@ -9,6 +9,7 @@
package buildcraft.core;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@ -16,21 +17,28 @@ import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.science.TechnologyNBT;
import buildcraft.core.utils.NBTUtils;
public class TickHandlerCoreClient {
public class TickHandlerCore {
public static Integer startSynchronousComputation = new Integer(0);
private boolean nagged;
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void tickEnd(PlayerTickEvent evt) {
public void synchonizationControl(PlayerTickEvent evt) {
synchronized (startSynchronousComputation) {
startSynchronousComputation.notify();
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void checkUpToDate(PlayerTickEvent evt) {
if (nagged) {
return;
}
@ -56,4 +64,23 @@ public class TickHandlerCoreClient {
nagged = true;
}
@SubscribeEvent
public void updateScienceBooks(PlayerTickEvent evt) {
if (evt.player.worldObj.isRemote) {
return;
}
for (IInvSlot slot : InventoryIterator.getIterable(evt.player.inventory)) {
if (slot.getStackInSlot() != null
&& slot.getStackInSlot().getItem() instanceof ItemScienceBook) {
ItemStack stack = slot.getStackInSlot();
TechnologyNBT techno = TechnologyNBT.getTechnology(evt.player, stack);
techno.update();
techno.writeToNBT(NBTUtils.getItemData(stack));
}
}
}
}

View file

@ -94,17 +94,10 @@ public abstract class AdvancedSlot {
}
public void drawStack(ItemStack item) {
Minecraft mc = Minecraft.getMinecraft();
int cornerX = (gui.width - gui.getXSize()) / 2;
int cornerY = (gui.height - gui.getYSize()) / 2;
if (item != null) {
int cornerX = (gui.width - gui.getXSize()) / 2;
int cornerY = (gui.height - gui.getYSize()) / 2;
GuiAdvancedInterface.getItemRenderer().zLevel = 200F;
GuiAdvancedInterface.getItemRenderer().renderItemAndEffectIntoGUI(gui.getFontRenderer (), mc.renderEngine, item, cornerX + x, cornerY + y);
GuiAdvancedInterface.getItemRenderer().renderItemOverlayIntoGUI(gui.getFontRenderer (), mc.renderEngine, item, cornerX + x, cornerY + y);
GuiAdvancedInterface.getItemRenderer().zLevel = 0.0F;
}
gui.drawStack(item, cornerX + x, cornerY + y);
}
public void selected () {

View file

@ -0,0 +1,92 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import buildcraft.core.gui.slots.SlotHidden;
import buildcraft.core.gui.slots.SlotUntouchable;
import buildcraft.core.network.RPC;
import buildcraft.core.network.RPCHandler;
import buildcraft.core.network.RPCSide;
import buildcraft.core.science.Technology;
import buildcraft.core.science.TechnologyNBT;
import buildcraft.core.utils.NBTUtils;
public class ContainerScienceBook extends BuildCraftContainer {
public float progress = 0;
public TechnologyNBT book;
private EntityPlayer player;
public ContainerScienceBook(EntityPlayer iPlayer) {
super(iPlayer.inventory.getSizeInventory());
player = iPlayer;
book = TechnologyNBT.getTechnology(player, player.getHeldItem());
for (int sy = 0; sy < 3; sy++) {
for (int sx = 0; sx < 9; sx++) {
addSlotToContainer(new SlotHidden(player.inventory, sx + sy * 9 + 9, 19 + sx * 18, 101 + sy * 18));
}
}
for (int sx = 0; sx < 9; sx++) {
addSlotToContainer(new SlotHidden(player.inventory, sx, 19 + sx * 18, 159));
}
for (int sx = 0; sx < 3; sx++) {
addSlotToContainer(new Slot(book.inventory, sx, 198 + sx * 18, 99));
}
for (int sx = 0; sx < 3; sx++) {
addSlotToContainer(new SlotUntouchable(book.leftToCompute, sx, 198 + sx * 18, 54));
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
return true;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
if (player.worldObj.getTotalWorldTime() % 5 == 0) {
RPCHandler.rpcPlayer(player, this, "updateProgress", book.getProgress());
}
}
@RPC(RPCSide.CLIENT)
private void updateProgress(float iProgress) {
progress = iProgress;
book.loadFromNBT(NBTUtils.getItemData(player.getHeldItem()));
}
public void startResearch(Technology t) {
RPCHandler.rpcServer(this, "rpcStartResearch", t.getID());
}
@RPC(RPCSide.SERVER)
private void rpcStartResearch(String id) {
Technology t = Technology.getTechnology(id);
book.startResearch(t);
book.writeToNBT(NBTUtils.getItemData(player.getHeldItem()));
}
}

View file

@ -10,6 +10,7 @@ package buildcraft.core.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
@ -28,7 +29,8 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
public int getSlotAtLocation(int i, int j) {
for (int position = 0; position < slots.length; ++position) {
AdvancedSlot s = slots[position];
if (i >= s.x && i <= s.x + 16 && j >= s.y && j <= s.y + 16) {
if (s != null && i >= s.x && i <= s.x + 16 && j >= s.y && j <= s.y + 16) {
return position;
}
}
@ -48,9 +50,11 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, i1 / 1.0F, k1 / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
for (AdvancedSlot slot : slots) {
if (slot != null) {
slot.drawSprite(cornerX, cornerY);
if (slots != null) {
for (AdvancedSlot slot : slots) {
if (slot != null) {
slot.drawSprite(cornerX, cornerY);
}
}
}
@ -100,4 +104,43 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
public void renderToolTip(ItemStack stack, int x, int y) {
super.renderToolTip(stack, x, y);
}
public void drawStack(ItemStack item, int x, int y) {
Minecraft mc = Minecraft.getMinecraft();
if (item != null) {
GL11.glEnable(GL11.GL_LIGHTING);
float prevZ = GuiAdvancedInterface.getItemRenderer().zLevel;
GuiAdvancedInterface.getItemRenderer().zLevel = 200F;
GuiAdvancedInterface.getItemRenderer().renderItemAndEffectIntoGUI(getFontRenderer(), mc.renderEngine, item, x, y);
GuiAdvancedInterface.getItemRenderer().renderItemOverlayIntoGUI(getFontRenderer(), mc.renderEngine, item, x, y);
GuiAdvancedInterface.getItemRenderer().zLevel = prevZ;
GL11.glDisable(GL11.GL_LIGHTING);
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
int position = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
AdvancedSlot slot = null;
if (position < 0) {
return;
}
if (slots[position].isDefined()) {
slotClicked(slots[position]);
}
}
// TODO: Use this for all children of this class
protected void slotClicked(AdvancedSlot slot) {
}
}

View file

@ -42,8 +42,8 @@ public abstract class GuiBuildCraft extends GuiContainer {
public static final ResourceLocation LEDGER_TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/ledger.png");
public final LedgerManager ledgerManager = new LedgerManager(this);
public final TileEntity tile;
public final ResourceLocation texture;
public final BuildCraftContainer container;
public ResourceLocation texture;
public GuiBuildCraft(BuildCraftContainer container, IInventory inventory, ResourceLocation texture) {
super(container);

View file

@ -0,0 +1,369 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.gui;
import java.util.Collection;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import buildcraft.core.DefaultProps;
import buildcraft.core.gui.slots.SlotHidden;
import buildcraft.core.science.Technology;
import buildcraft.core.science.TechnologyNBT;
import buildcraft.core.science.Tier;
public class GuiScienceBook extends GuiAdvancedInterface {
private static final ResourceLocation TEXTURE_BASE = new ResourceLocation(
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_gui.png");
private static final ResourceLocation TEXTURE_FOCUS = new ResourceLocation(
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_focus_gui.png");
private static final ResourceLocation TEXTURE_ICONS = new ResourceLocation(
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_icons.png");
private static final int EXTRA_ADVANCED_SLOTS = 1;
private Tier currentTier = null;
private Technology inFocus = null;
private GuiButton startResearch;
static class EmptySlot extends AdvancedSlot {
public EmptySlot(GuiAdvancedInterface gui, int x, int y) {
super(gui, x, y);
}
}
static class TechnologySlot extends AdvancedSlot {
private Technology techno;
public TechnologySlot(GuiAdvancedInterface gui, int x, int y, Technology iTechno) {
super(gui, x, y);
techno = iTechno;
}
@Override
public IIcon getIcon() {
return techno.getIcon();
}
@Override
public ItemStack getItemStack() {
return techno.getStackToDisplay();
}
@Override
public void drawSprite(int cornerX, int cornerY) {
super.drawSprite(cornerX, cornerY);
if (!getBook().isKnown(techno)) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
int j1 = cornerX + x;
int k1 = cornerY + y;
GL11.glColorMask(true, true, true, false);
int color;
if (getBook().canBeResearched(techno)) {
color = 0x550000FF;
} else {
color = 0x55FF0000;
}
((GuiScienceBook) gui).drawGradientRect(j1, k1, j1 + 16, k1 + 16, color, color);
GL11.glColorMask(true, true, true, true);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
}
public TechnologyNBT getBook() {
return ((ContainerScienceBook) gui.getContainer()).book;
}
}
static class ResearchedSlot extends AdvancedSlot {
public ResearchedSlot(GuiAdvancedInterface gui, int x, int y) {
super(gui, x, y);
}
@Override
public IIcon getIcon() {
Technology t = getResearchedTechnology();
if (t != null) {
return t.getIcon();
} else {
return null;
}
}
@Override
public ItemStack getItemStack() {
Technology t = getResearchedTechnology();
if (t != null) {
return t.getStackToDisplay();
} else {
return null;
}
}
public Technology getResearchedTechnology() {
return ((ContainerScienceBook) gui.getContainer()).book.getResearchedTechnology();
}
}
public GuiScienceBook(EntityPlayer player) {
super(new ContainerScienceBook(player), player.inventory, TEXTURE_BASE);
xSize = 256;
ySize = 181;
slots = new AdvancedSlot[50];
setTier(Tier.WoodenGear);
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
int j = (width - xSize) / 2;
int k = (height - ySize) / 2;
startResearch = new GuiButton(0, j + 10, k + 145, 70, 20, "Start");
}
@Override
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
bindTexture(TEXTURE_ICONS);
for (int i = 0; i < 7; ++i) {
if (inFocus != null || currentTier.ordinal() != i) {
drawTexturedModalRect(cornerX + 28 * i, cornerY - 28, 28 * i, 1, 29, 32);
}
if (inFocus != null || currentTier.ordinal() != i + 7) {
drawTexturedModalRect(cornerX + 28 * i, cornerY + ySize - 4, 28 * i, 62, 29, 32);
}
}
if (inFocus == null) {
texture = TEXTURE_BASE;
} else {
texture = TEXTURE_FOCUS;
}
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
bindTexture(TEXTURE_ICONS);
for (int i = 0; i < 7; ++i) {
if (inFocus == null && currentTier.ordinal() == i) {
drawTexturedModalRect(cornerX + 28 * i, cornerY - 28, 28 * i, 32, 29, 32);
}
if (inFocus == null && currentTier.ordinal() == i + 7) {
drawTexturedModalRect(cornerX + 28 * i, cornerY + ySize - 4, 28 * i, 96, 29, 32);
}
}
int arrowHeight = (int) (22 * getContainer().progress);
drawTexturedModalRect(
cornerX + 215,
cornerY + 73 + (22 - arrowHeight),
0,
128 + (22 - arrowHeight),
16,
arrowHeight);
for (int i = 0; i < 7; ++i) {
drawStack(Tier.values()[i].getStackToDisplay(), cornerX + 28 * i + 6, cornerY - 28 + 9);
drawStack(Tier.values()[i + 7].getStackToDisplay(), cornerX + 28 * i + 6, cornerY + ySize - 4 + 7);
}
drawBackgroundSlots();
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
super.drawGuiContainerForegroundLayer(par1, par2);
drawTooltipForSlotAt(par1, par2);
}
@Override
protected void actionPerformed(GuiButton button) {
if (button == startResearch) {
getContainer().startResearch(inFocus);
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
super.mouseClicked(mouseX, mouseY, mouseButton);
int cornerX = (width - xSize) / 2;
int cornerY = (height - ySize) / 2;
for (int i = 0; i < 7; ++i) {
int x1 = cornerX + 28 * i;
int x2 = x1 + 29;
int y1 = cornerY - 30;
int y2 = y1 + 32;
if (mouseX >= x1 && mouseX <= x2 && mouseY >= y1 && mouseY <= y2) {
setTier(Tier.values()[i]);
return;
}
y1 = cornerY + ySize - 2;
y2 = y1 + 32;
if (mouseX >= x1 && mouseX <= x2 && mouseY >= y1 && mouseY <= y2) {
setTier(Tier.values()[i + 7]);
return;
}
}
}
@Override
protected void slotClicked(AdvancedSlot slot) {
super.slotClicked(slot);
if (slot instanceof TechnologySlot) {
setFocus(((TechnologySlot) slot).techno);
}
}
private void setTier(Tier newTier) {
if (inFocus != null || newTier != currentTier) {
slots = new AdvancedSlot[50 + EXTRA_ADVANCED_SLOTS];
currentTier = newTier;
int id = 0;
Collection<Technology> technos = Technology.getTechnologies(currentTier);
for (Technology t : technos) {
int j = id / 10;
int i = id - j * 10;
slots[id] = new TechnologySlot(this, 9 + i * 18, 7 + j * 18, t);
id++;
}
while (id < 50) {
int j = id / 10;
int i = id - j * 10;
slots[id] = new EmptySlot(this, 9 + i * 18, 7 + j * 18);
id++;
}
}
inFocus = null;
for (Object s : container.inventorySlots) {
if (s instanceof SlotHidden) {
SlotHidden h = (SlotHidden) s;
h.show();
}
}
buttonList.clear();
setExtraAdvancedSlots();
}
private void setFocus(Technology techno) {
inFocus = techno;
for (Object s : container.inventorySlots) {
if (s instanceof SlotHidden) {
SlotHidden h = (SlotHidden) s;
h.hide();
}
}
slots = new AdvancedSlot[5 + 3 + 1 + 10 + EXTRA_ADVANCED_SLOTS];
int id = 0;
for (int i = 0; i < 5; ++i) {
if (techno.getPrerequisites().size() > i
&& techno.getPrerequisites().get(i) != null) {
slots[id++] = new TechnologySlot(this, 33, 43 + 18 * i, techno.getPrerequisites().get(i));
} else {
id++;
}
}
for (int i = 0; i < 3; ++i) {
if (techno.getRequirements() != null) {
slots[id++] = new ItemSlot(this, 71 + 18 * i, 115, techno.getRequirements()[i]);
} else {
id++;
}
}
slots[id++] = new TechnologySlot(this, 89, 79, techno);
for (int i = 0; i < 5; ++i) {
for (int j = 0; j < 2; ++j) {
int followupId = i * 2 + j;
if (techno.getFollowups().size() > followupId
&& techno.getFollowups().get(followupId) != null) {
slots[id++] = new TechnologySlot(this, 145 + 18 * j, 43 + 18 * i, techno.getFollowups().get(
followupId));
} else {
id++;
}
}
}
buttonList.clear();
if (getContainer().book.canBeResearched(techno)) {
buttonList.add(startResearch);
}
setExtraAdvancedSlots();
}
@Override
protected ContainerScienceBook getContainer() {
return (ContainerScienceBook) super.getContainer();
}
public void setExtraAdvancedSlots() {
slots[slots.length - 1] = new ResearchedSlot(this, 216, 28);
}
@Override
public void drawGradientRect(int p1, int p2, int p3, int p4, int p5, int p6) {
super.drawGradientRect(p1, p2, p3, p4, p5, p6);
}
}

View file

@ -18,6 +18,12 @@ public class ItemSlot extends AdvancedSlot {
super(gui, x, y);
}
public ItemSlot(GuiAdvancedInterface gui, int x, int y, ItemStack iStack) {
super(gui, x, y);
stack = iStack;
}
@Override
public ItemStack getItemStack() {
return stack;

View file

@ -0,0 +1,35 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.gui.slots;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
public class SlotHidden extends Slot {
private int saveX;
private int saveY;
public SlotHidden(IInventory inv, int index, int x, int y) {
super(inv, index, x, y);
saveX = x;
saveY = y;
}
public void show() {
xDisplayPosition = saveX;
yDisplayPosition = saveY;
}
public void hide() {
xDisplayPosition = 9999;
yDisplayPosition = 9999;
}
}

View file

@ -12,6 +12,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlotUntouchable extends SlotBase implements IPhantomSlot {
public SlotUntouchable(IInventory contents, int id, int x, int y) {
@ -37,4 +40,10 @@ public class SlotUntouchable extends SlotBase implements IPhantomSlot {
public boolean canShift() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean func_111238_b() {
return false;
}
}

View file

@ -23,6 +23,10 @@ public final class InventoryIterator {
private InventoryIterator() {
}
public static Iterable<IInvSlot> getIterable(IInventory inv) {
return getIterable(inv, ForgeDirection.UNKNOWN);
}
/**
* Returns an Iterable object for the specified side of the inventory.
*

View file

@ -40,6 +40,8 @@ import buildcraft.api.core.ICoreProxy;
import buildcraft.core.EntityBlock;
import buildcraft.core.ItemBlockBuildCraft;
import buildcraft.core.LaserKind;
import buildcraft.core.recipes.BuildCraftRecipe;
import buildcraft.core.science.Technology;
public class CoreProxy implements ICoreProxy {
@ -108,6 +110,17 @@ public class CoreProxy implements ICoreProxy {
stack.onCrafting(world, player, stack.stackSize);
}
@SuppressWarnings("unchecked")
public void addCraftingRecipe(Technology techno, ItemStack result, Object... recipe) {
String name = Item.itemRegistry.getNameForObject(result.getItem());
if (BuildCraftCore.recipesBlacklist.contains(name)) {
return;
}
CraftingManager.getInstance().getRecipeList().add(new BuildCraftRecipe(techno, result, recipe));
}
@SuppressWarnings("unchecked")
public void addCraftingRecipe(ItemStack result, Object... recipe) {
String name = Item.itemRegistry.getNameForObject(result.getItem());

View file

@ -0,0 +1,64 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.recipes;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe;
import buildcraft.core.science.Technology;
public class BuildCraftRecipe extends ShapedOreRecipe {
Technology techno;
public BuildCraftRecipe(Technology iTechno, ItemStack result, Object[] recipe) {
super(result, recipe);
techno = iTechno;
}
@Override
public boolean matches(InventoryCrafting inv, World world) {
try {
Field f = InventoryCrafting.class.getDeclaredField("eventHandler");
if (!f.isAccessible()) {
f.setAccessible(true);
}
Container container = (Container) f.get(inv);
f = Container.class.getDeclaredField("crafters");
if (!f.isAccessible()) {
f.setAccessible(true);
}
List crafters = (List) f.get(container);
for (Object p : crafters) {
EntityPlayer player = (EntityPlayer) p;
System.out.println(player.getEntityId());
}
} catch (Throwable e) {
e.printStackTrace();
}
return super.matches(inv, world);
}
}

View file

@ -19,7 +19,7 @@ import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.TickHandlerCoreClient;
import buildcraft.core.TickHandlerCore;
import buildcraft.core.inventory.filters.IStackFilter;
import buildcraft.core.robots.AIRobotFetchAndEquipItemStack;
import buildcraft.core.robots.AIRobotGotoBlock;
@ -123,9 +123,9 @@ public class BoardRobotFarmer extends RedstoneBoardRobot {
}
private boolean isAirAbove(World world, int x, int y, int z) {
synchronized (TickHandlerCoreClient.startSynchronousComputation) {
synchronized (TickHandlerCore.startSynchronousComputation) {
try {
TickHandlerCoreClient.startSynchronousComputation.wait();
TickHandlerCore.startSynchronousComputation.wait();
return world.isAirBlock(x, y + 1, z);
} catch (InterruptedException e) {

View file

@ -22,7 +22,7 @@ import buildcraft.api.gates.ActionParameterItemStack;
import buildcraft.api.gates.IActionParameter;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.TickHandlerCoreClient;
import buildcraft.core.TickHandlerCore;
import buildcraft.core.inventory.filters.IStackFilter;
import buildcraft.core.robots.AIRobotBreak;
import buildcraft.core.robots.AIRobotFetchAndEquipItemStack;
@ -144,9 +144,9 @@ public abstract class BoardRobotGenericBreakBlock extends RedstoneBoardRobot {
return true;
}
synchronized (TickHandlerCoreClient.startSynchronousComputation) {
synchronized (TickHandlerCore.startSynchronousComputation) {
try {
TickHandlerCoreClient.startSynchronousComputation.wait();
TickHandlerCore.startSynchronousComputation.wait();
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);

View file

@ -25,7 +25,7 @@ import buildcraft.api.core.BlockIndex;
import buildcraft.api.core.BuildCraftAPI;
import buildcraft.api.robots.AIRobot;
import buildcraft.api.robots.EntityRobotBase;
import buildcraft.core.TickHandlerCoreClient;
import buildcraft.core.TickHandlerCore;
import buildcraft.core.inventory.filters.ArrayStackFilter;
import buildcraft.core.inventory.filters.CompositeFilter;
import buildcraft.core.inventory.filters.IStackFilter;
@ -142,9 +142,9 @@ public class BoardRobotPlanter extends RedstoneBoardRobot {
}
private boolean isAirAbove(World world, int x, int y, int z) {
synchronized (TickHandlerCoreClient.startSynchronousComputation) {
synchronized (TickHandlerCore.startSynchronousComputation) {
try {
TickHandlerCoreClient.startSynchronousComputation.wait();
TickHandlerCore.startSynchronousComputation.wait();
return world.isAirBlock(x, y + 1, z);
} catch (InterruptedException e) {

View file

@ -0,0 +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.core.science;
/**
* This interface is implemented by items that provide specific research points.
* In particular, it gives how many cycles are required to process the items
*/
public interface IItemTechnologyProvider {
int timeToProcess();
}

View file

@ -0,0 +1,80 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.science;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TechnoField extends Technology {
IIcon icon;
String iconResource;
String unlocalizedName;
public void initialize(Tier iTier,
String iconResource,
String unlocalizedName,
ItemStack requirement,
Technology... iPrerequisites) {
initialize(iTier, iconResource, unlocalizedName, requirement, null, null, iPrerequisites);
}
public void initialize(Tier iTier,
String iconResource,
String unlocalizedName,
ItemStack requirement1,
ItemStack requirement2,
Technology... iPrerequisites) {
initialize(iTier, iconResource, unlocalizedName, requirement1, requirement2, null, iPrerequisites);
}
public void initialize(Tier iTier,
String iIconResource,
String iUnlocalizedName,
ItemStack requirement1,
ItemStack requirement2,
ItemStack requirement3,
Technology... iPrerequisites) {
super.initialize("field:" + iUnlocalizedName,
iTier, requirement1, requirement2, requirement3, iPrerequisites);
unlocalizedName = iUnlocalizedName;
iconResource = iIconResource;
}
@Override
public String getLocalizedName() {
return "";
}
public static ItemStack toStack(Object obj) {
if (obj instanceof ItemStack) {
return (ItemStack) obj;
} else if (obj instanceof Item) {
return new ItemStack((Item) obj);
} else if (obj instanceof Block) {
return new ItemStack((Block) obj);
} else {
return null;
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
}
}

View file

@ -0,0 +1,68 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.science;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class TechnoSimpleItem extends Technology {
private ItemStack itemToDisplay;
public void initialize(Tier iTier,
Object iItemToDisplay,
ItemStack requirement,
Technology... iPrerequisites) {
initialize(iTier, iItemToDisplay, requirement, null, null, iPrerequisites);
}
public void initialize(Tier iTier,
Object iItemToDisplay,
ItemStack requirement1,
ItemStack requirement2,
Technology... iPrerequisites) {
initialize(iTier, iItemToDisplay, requirement1, requirement2, null, iPrerequisites);
}
public void initialize(Tier iTier,
Object iItemToDisplay,
ItemStack requirement1,
ItemStack requirement2,
ItemStack requirement3,
Technology... iPrerequisites) {
super.initialize("item:" + toStack(iItemToDisplay).getUnlocalizedName(),
iTier, requirement1, requirement2, requirement3, iPrerequisites);
itemToDisplay = toStack(iItemToDisplay);
}
@Override
public ItemStack getStackToDisplay() {
return itemToDisplay;
}
@Override
public String getLocalizedName() {
return "";
}
public static ItemStack toStack(Object obj) {
if (obj instanceof ItemStack) {
return (ItemStack) obj;
} else if (obj instanceof Item) {
return new ItemStack((Item) obj);
} else if (obj instanceof Block) {
return new ItemStack((Block) obj);
} else {
return null;
}
}
}

View file

@ -0,0 +1,71 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.science;
import net.minecraft.item.ItemStack;
public class TechnoTier extends Technology {
private Tier technoTier;
private ItemStack itemToDisplay;
private Technology[] prerequisites;
private ItemStack[] requirements;
public void initialize(Tier iTier,
Technology... iPrerequisites) {
initialize(iTier, null, null, null, iPrerequisites);
}
public void initialize(Tier iTier,
Object requirement,
Technology... iPrerequisites) {
initialize(iTier, requirement, null, null, iPrerequisites);
}
public void initialize(Tier iTier,
Object requirement1,
Object requirement2,
Technology... iPrerequisites) {
initialize(iTier, requirement1, requirement2, null, iPrerequisites);
}
public void initialize(Tier iTier,
Object requirement1,
Object requirement2,
Object requirement3,
Technology... iPrerequisites) {
super.initialize(
"tier:" + iTier.ordinal(),
Tier.values()[iTier.ordinal() > 0 ? iTier.ordinal() - 1 : 0],
requirement1,
requirement2,
requirement3);
itemToDisplay = toStack(iTier.getStackToDisplay());
prerequisites = iPrerequisites;
technoTier = iTier;
if (iTier.ordinal() > 0) {
Tier.values()[iTier.ordinal() - 1].getTechnology().followups.add(this);
}
}
@Override
public ItemStack getStackToDisplay() {
return itemToDisplay;
}
@Override
public String getLocalizedName() {
return "";
}
}

View file

@ -0,0 +1,122 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.science;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public abstract class Technology {
private static final HashMap<String, Technology> technologies = new HashMap<String, Technology>();
private static final LinkedList[] registry = new LinkedList[Tier.values().length];
protected ArrayList<Technology> followups = new ArrayList<Technology>();
private Tier tier;
private ItemStack[] requirements;
private ArrayList<Technology> prerequisites = new ArrayList<Technology>();
private String id;
protected void initialize(String iId,
Tier iTier,
Object requirement1,
Object requirement2,
Object requirement3,
Technology... iPrerequisites) {
getTechnologies(iTier).add(this);
technologies.put(iId, this);
id = iId;
tier = iTier;
requirements = new ItemStack[]
{toStack(requirement1),
toStack(requirement2),
toStack(requirement3)};
prerequisites.add(iTier.getTechnology());
for (Technology t : iPrerequisites) {
prerequisites.add(t);
t.followups.add(this);
}
}
@SideOnly(Side.CLIENT)
public IIcon getIcon() {
return null;
}
public ItemStack getStackToDisplay() {
return null;
}
public abstract String getLocalizedName();
public final ArrayList<Technology> getPrerequisites() {
return prerequisites;
}
public final ArrayList<Technology> getFollowups() {
return followups;
}
public final ItemStack[] getRequirements() {
return requirements;
}
public final Tier getTier() {
return tier;
}
public static Collection<Technology> getTechnologies(Tier tier) {
if (registry[tier.ordinal()] == null) {
registry[tier.ordinal()] = new LinkedList();
}
return registry[tier.ordinal()];
}
public static Technology getTechnology(String id) {
return technologies.get(id);
}
public static ItemStack toStack(Object obj) {
if (obj instanceof ItemStack) {
return (ItemStack) obj;
} else if (obj instanceof Item) {
return new ItemStack((Item) obj);
} else if (obj instanceof Block) {
return new ItemStack((Block) obj);
} else {
return null;
}
}
public final String getID() {
return id;
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) {
}
}

View file

@ -0,0 +1,258 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.science;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.SimpleInventory;
import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.NBTUtils;
public final class TechnologyNBT {
private static HashMap<String, TechnologyNBT> technologyBooksClient = new HashMap<String, TechnologyNBT>();
private static HashMap<String, TechnologyNBT> technologyBooksServer = new HashMap<String, TechnologyNBT>();
private static int globalId = 0;
private static int DEFAULT_PROCESS_TIME = 10 * 20;
public SimpleInventory inventory = new SimpleInventory(3, "mainInv", 999);
public SimpleInventory leftToCompute = new SimpleInventory(3, "leftInv", 999);
private HashSet<String> foundTechnologies = new HashSet<String>();
private String researchedTechnology;
private ItemStack itemInComputation;
private int progress = 0;
private int processTime = 0;
private String id;
private TechnologyNBT(NBTTagCompound nbt) {
loadFromNBT(nbt);
if (!foundTechnologies.contains(Tier.WoodenGear.getTechnology().getID())) {
foundTechnologies.add(Tier.WoodenGear.getTechnology().getID());
}
}
public boolean isKnown(Technology t) {
return foundTechnologies.contains(t.getID());
}
public boolean canBeResearched(Technology t) {
if (foundTechnologies.contains(t.getID())) {
return false;
}
for (Technology p : t.getPrerequisites()) {
if (!isKnown(p)) {
return false;
}
}
return true;
}
public void update() {
if (researchedTechnology != null) {
if (itemInComputation != null) {
if (progress < processTime) {
progress++;
} else {
for (IInvSlot slot : InventoryIterator.getIterable(leftToCompute, ForgeDirection.UNKNOWN)) {
if (StackHelper.isMatchingItem(itemInComputation, slot.getStackInSlot())) {
slot.decreaseStackInSlot(1);
break;
}
}
progress = 0;
processTime = 0;
itemInComputation = null;
boolean workToDo = false;
for (IInvSlot slot : InventoryIterator.getIterable(leftToCompute, ForgeDirection.UNKNOWN)) {
if (slot.getStackInSlot() != null) {
workToDo = true;
}
}
if (!workToDo) {
foundTechnologies.add(researchedTechnology);
researchedTechnology = null;
}
}
} else {
for (IInvSlot invSlot : InventoryIterator.getIterable(inventory, ForgeDirection.UNKNOWN)) {
for (IInvSlot reqSlot : InventoryIterator.getIterable(leftToCompute, ForgeDirection.UNKNOWN)) {
if (invSlot.getStackInSlot() != null
&& reqSlot.getStackInSlot() != null
&& StackHelper.isMatchingItem(invSlot.getStackInSlot(), reqSlot.getStackInSlot())) {
itemInComputation = invSlot.decreaseStackInSlot(1);
progress = 0;
if (itemInComputation.getItem() instanceof IItemTechnologyProvider) {
processTime = ((IItemTechnologyProvider) itemInComputation.getItem()).timeToProcess();
} else {
processTime = DEFAULT_PROCESS_TIME;
}
break;
}
}
if (itemInComputation != null) {
break;
}
}
}
}
}
public void writeToNBT(NBTTagCompound nbt) {
NBTTagList foundNBT = new NBTTagList();
for (String s : foundTechnologies) {
foundNBT.appendTag(new NBTTagString(s));
}
nbt.setTag("foundTechnologies", foundNBT);
if (researchedTechnology != null) {
nbt.setString("researchedTechnology", researchedTechnology);
}
NBTTagCompound inventoryNBT = new NBTTagCompound();
inventory.writeToNBT(inventoryNBT);
nbt.setTag("inventory", inventoryNBT);
NBTTagCompound leftToComputeNBT = new NBTTagCompound();
leftToCompute.writeToNBT(leftToComputeNBT);
nbt.setTag("leftTocompute", leftToComputeNBT);
if (itemInComputation != null) {
NBTTagCompound itemInComputationNBT = new NBTTagCompound();
itemInComputation.writeToNBT(itemInComputationNBT);
nbt.setTag("itemInComputation", itemInComputationNBT);
}
nbt.setInteger("progress", progress);
nbt.setInteger("processTime", processTime);
nbt.setString("id", id);
}
public void loadFromNBT(NBTTagCompound nbt) {
NBTTagList foundNBT = nbt.getTagList("foundTechnologies", Constants.NBT.TAG_STRING);
for (int i = 0; i < foundNBT.tagCount(); ++i) {
foundTechnologies.add(foundNBT.getStringTagAt(i));
}
if (nbt.hasKey("researchedTechnology")) {
researchedTechnology = nbt.getString("researchedTechnology");
} else {
researchedTechnology = null;
}
inventory.readFromNBT(nbt.getCompoundTag("inventory"));
leftToCompute.readFromNBT(nbt.getCompoundTag("leftTocompute"));
if (nbt.hasKey("itemInComputation")) {
itemInComputation = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("itemInComputation"));
} else {
itemInComputation = null;
}
progress = nbt.getInteger("progress");
processTime = nbt.getInteger("processTime");
id = nbt.getString("id");
}
public float getProgress() {
if (processTime == 0) {
return 0;
} else {
return (float) progress / (float) processTime;
}
}
public static TechnologyNBT getTechnology(EntityPlayer holder, ItemStack stack) {
HashMap<String, TechnologyNBT> technologyBooks;
if (holder.worldObj.isRemote) {
technologyBooks = technologyBooksClient;
} else {
technologyBooks = technologyBooksServer;
}
NBTTagCompound nbt = NBTUtils.getItemData(stack);
if (!nbt.hasKey("id")
|| "".equals(nbt.getString("id"))) {
String id = holder.getDisplayName() + "-"
+ Long.toHexString((new Date()).getTime())
+ "-" + globalId++;
nbt.setString("id", id);
TechnologyNBT techno = new TechnologyNBT(nbt);
technologyBooks.put(id, techno);
return techno;
} else {
String id = nbt.getString("id");
if (technologyBooks.containsKey(id)) {
return technologyBooks.get(id);
} else {
TechnologyNBT techno = new TechnologyNBT(nbt);
technologyBooks.put(id, techno);
return techno;
}
}
}
public void startResearch(Technology t) {
researchedTechnology = t.getID();
for (int i = 0; i < 3; ++i) {
if (t.getRequirements()[i] != null) {
leftToCompute.setInventorySlotContents(i, t.getRequirements()[i].copy());
}
}
}
public Technology getResearchedTechnology() {
if (researchedTechnology != null) {
return Technology.getTechnology(researchedTechnology);
} else {
return null;
}
}
}

View file

@ -0,0 +1,113 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.core.science;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import buildcraft.BuildCraftCore;
import buildcraft.silicon.ItemRedstoneChipset;
public enum Tier {
WoodenGear,
StoneGear,
IronGear,
GoldenGear,
DiamondGear,
EmeraldGear,
RedstoneCrystalGear,
Chipset,
IronChipset,
GoldenChipset,
DiamondChipset,
EmeraldChipset,
RedstoneCrystalChipset,
Unrevealed;
private static ItemStack[] stacksToDisplay;
private static TechnoTier[] technologies;
public ItemStack getStackToDisplay () {
if (stacksToDisplay == null) {
stacksToDisplay = new ItemStack[Tier.values().length];
stacksToDisplay[WoodenGear.ordinal()] = new ItemStack(BuildCraftCore.woodenGearItem);
stacksToDisplay[StoneGear.ordinal()] = new ItemStack(BuildCraftCore.stoneGearItem);
stacksToDisplay[IronGear.ordinal()] = new ItemStack(BuildCraftCore.ironGearItem);
stacksToDisplay[GoldenGear.ordinal()] = new ItemStack(BuildCraftCore.goldGearItem);
stacksToDisplay[DiamondGear.ordinal()] = new ItemStack(BuildCraftCore.diamondGearItem);
stacksToDisplay[EmeraldGear.ordinal()] = new ItemStack(Blocks.bedrock);
stacksToDisplay[RedstoneCrystalGear.ordinal()] = new ItemStack(Blocks.bedrock);
stacksToDisplay[Chipset.ordinal()] = ItemRedstoneChipset.Chipset.RED.getStack();
stacksToDisplay[IronChipset.ordinal()] = ItemRedstoneChipset.Chipset.IRON.getStack();
stacksToDisplay[GoldenChipset.ordinal()] = ItemRedstoneChipset.Chipset.GOLD.getStack();
stacksToDisplay[DiamondChipset.ordinal()] = ItemRedstoneChipset.Chipset.DIAMOND.getStack();
stacksToDisplay[EmeraldChipset.ordinal()] = ItemRedstoneChipset.Chipset.EMERALD.getStack();
stacksToDisplay[RedstoneCrystalChipset.ordinal()] = new ItemStack(Blocks.bedrock);
stacksToDisplay[Unrevealed.ordinal()] = new ItemStack(Blocks.bedrock);
}
return stacksToDisplay[ordinal()];
}
public Technology getTechnology() {
return technologies[ordinal()];
}
public static void initializeTechnologies() {
technologies[WoodenGear.ordinal()].initialize(
WoodenGear);
technologies[StoneGear.ordinal()].initialize(
StoneGear,
new ItemStack(BuildCraftCore.woodenGearItem, 50));
technologies[IronGear.ordinal()].initialize(
IronGear,
new ItemStack(BuildCraftCore.woodenGearItem, 75),
new ItemStack(BuildCraftCore.stoneGearItem, 50));
technologies[GoldenGear.ordinal()].initialize(
GoldenGear,
new ItemStack(BuildCraftCore.woodenGearItem, 125),
new ItemStack(BuildCraftCore.stoneGearItem, 75),
new ItemStack(BuildCraftCore.ironGearItem, 10));
technologies[DiamondGear.ordinal()].initialize(
DiamondGear,
new ItemStack(BuildCraftCore.stoneGearItem, 125),
new ItemStack(BuildCraftCore.ironGearItem, 15),
new ItemStack(BuildCraftCore.goldGearItem, 5));
technologies[EmeraldGear.ordinal()].initialize(
EmeraldGear,
new ItemStack(BuildCraftCore.stoneGearItem, 200));
technologies[RedstoneCrystalGear.ordinal()].initialize(
RedstoneCrystalGear);
technologies[Chipset.ordinal()].initialize(
Chipset);
technologies[IronChipset.ordinal()].initialize(
IronChipset);
technologies[GoldenChipset.ordinal()].initialize(
GoldenChipset);
technologies[DiamondChipset.ordinal()].initialize(
DiamondChipset);
technologies[EmeraldChipset.ordinal()].initialize(
EmeraldChipset);
technologies[RedstoneCrystalChipset.ordinal()].initialize(
RedstoneCrystalChipset);
technologies[Unrevealed.ordinal()].initialize(
Unrevealed);
}
static {
technologies = new TechnoTier[Tier.values().length];
for (int i = 0; i < technologies.length; ++i) {
technologies[i] = new TechnoTier();
}
}
}

View file

@ -17,7 +17,7 @@ import net.minecraft.world.IWorldAccess;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import buildcraft.core.TickHandlerCoreClient;
import buildcraft.core.TickHandlerCore;
public class DimensionProperty implements IWorldAccess {
@ -52,9 +52,9 @@ public class DimensionProperty implements IWorldAccess {
}
private void load(Chunk chunk, ChunkProperty property) {
synchronized (TickHandlerCoreClient.startSynchronousComputation) {
synchronized (TickHandlerCore.startSynchronousComputation) {
try {
TickHandlerCoreClient.startSynchronousComputation.wait();
TickHandlerCore.startSynchronousComputation.wait();
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < worldHeight; ++y) {

View file

@ -71,10 +71,8 @@ public class TransportProxyClient extends TransportProxy {
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerIron, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerGold, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerDiamond, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipePowerHeat, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeStructureCobblestone, pipeItemRenderer);
// MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsStipes.shiftedIndex, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsVoid, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeFluidsVoid, pipeItemRenderer);
MinecraftForgeClient.registerItemRenderer(BuildCraftTransport.pipeItemsSandstone, pipeItemRenderer);