use of buildcraft.core.item.ItemMapLocation in project BuildCraft by BuildCraft.
the class TileZonePlan method update.
@Override
public void update() {
super.update();
if (worldObj.isRemote) {
return;
}
if (previewRecalcTimer.markTimeIfDelay(worldObj)) {
recalculatePreview();
}
if (inv.getStackInSlot(0) != null && inv.getStackInSlot(1) == null && inv.getStackInSlot(0).getItem() instanceof ItemMapLocation) {
if (progress < CRAFT_TIME) {
progress++;
if (worldObj.getTotalWorldTime() % 5 == 0) {
sendNetworkUpdate();
}
} else {
ItemStack stack = inv.decrStackSize(0, 1);
if (selectedAreas[currentSelectedArea] != null) {
ItemMapLocation.setZone(stack, selectedAreas[currentSelectedArea]);
((INamedItem) stack.getItem()).setName(stack, mapName);
}
inv.setInventorySlotContents(1, stack);
}
} else if (progress != 0) {
progress = 0;
sendNetworkUpdate();
}
}
use of buildcraft.core.item.ItemMapLocation in project BuildCraft by BuildCraft.
the class BuildCraftCore method loadConfiguration.
@Mod.EventHandler
public void loadConfiguration(FMLPreInitializationEvent evt) {
BCLog.logger.info("Starting BuildCraft " + DefaultProps.VERSION);
BCLog.logger.info("Copyright (c) the BuildCraft team, 2011-2016");
BCLog.logger.info("http://www.mod-buildcraft.com");
new BCCreativeTab("main");
commandBuildcraft.addAlias("bc");
commandBuildcraft.addChildCommand(new SubCommandDeop());
commandBuildcraft.addChildCommand(new SubCommandOp());
BuildcraftRecipeRegistry.assemblyTable = AssemblyRecipeManager.INSTANCE;
BuildcraftRecipeRegistry.integrationTable = IntegrationRecipeManager.INSTANCE;
BuildcraftRecipeRegistry.refinery = RefineryRecipeManager.INSTANCE;
BuildcraftRecipeRegistry.programmingTable = ProgrammingRecipeManager.INSTANCE;
BuilderAPI.schematicHelper = SchematicHelper.INSTANCE;
BuilderAPI.schematicRegistry = SchematicRegistry.INSTANCE;
File cfgBase = new File(evt.getModConfigurationDirectory(), "buildcraft");
BCRegistry.INSTANCE.setRegistryConfig(new File(cfgBase, "objects.cfg"));
mainConfiguration = new Configuration(new File(cfgBase, "main.cfg"));
detailedConfigManager = new FileConfigManager(" The buildcraft detailed configuration file. This contains a lot of miscelaneous options that have no " + "affect on gameplay.\n You should refer to the BC source code for a detailed description of what these do. " + "(https://github.com/BuildCraft/BuildCraft)\n" + " This file will be overwritten every time that buildcraft starts, so there is no point in adding comments");
detailedConfigManager.setConfigFile(new File(cfgBase, "detailed.properties"));
ConficGuiFactoryBC.setConfig(mainConfiguration);
mainConfiguration.load();
ConficGuiFactoryBC.getCat("debug").setShowInGui(false);
ConficGuiFactoryBC.getCat("vars").setShowInGui(false);
ConficGuiFactoryBC.register("general.useServerDataOnClient", BuildCraftCore.useServerDataOnClient, "Allows BuildCraft to use the integrated server's data on the client on singleplayer worlds. Disable if you're getting the odd crash caused by it.", RestartRequirement.NONE);
ConficGuiFactoryBC.register("general.builderMaxIterationsPerItemFactor", BuildCraftCore.builderMaxPerItemFactor, "Lower this number if BuildCraft builders/fillers are causing TPS lag. Raise it if you think they are being too slow.", RestartRequirement.NONE);
ConficGuiFactoryBC.register("general.miningBreaksPlayerProtectedBlocks", false, "Should BuildCraft miners be allowed to break blocks using player-specific protection?", RestartRequirement.NONE);
ConficGuiFactoryBC.register("general.updateCheck", true, "Should I check the BuildCraft version on startup?", RestartRequirement.NONE);
ConficGuiFactoryBC.register("display.hidePowerValues", false, "Should all power values (RF, RF/t) be hidden?", RestartRequirement.NONE);
ConficGuiFactoryBC.register("display.hideFluidValues", false, "Should all fluid values (mB, mB/t) be hidden?", RestartRequirement.NONE);
ConficGuiFactoryBC.register("general.itemLifespan", 60, "How long, in seconds, should items stay on the ground? (Vanilla = 300, default = 60)", RestartRequirement.NONE).setMinValue(5);
ConficGuiFactoryBC.register("network.updateFactor", 10, "How often, in ticks, should network update packets be sent? Increasing this might help network performance.", RestartRequirement.GAME).setMinValue(1);
ConficGuiFactoryBC.register("network.longUpdateFactor", 40, "How often, in ticks, should full network sync packets be sent? Increasing this might help network performance.", RestartRequirement.GAME).setMinValue(1);
ConficGuiFactoryBC.register("general.canEnginesExplode", false, "Should engines explode upon overheat?", RestartRequirement.NONE);
ConficGuiFactoryBC.register("worldgen.enable", true, "Should BuildCraft generate anything in the world?", RestartRequirement.GAME);
ConficGuiFactoryBC.register("general.pumpsConsumeWater", false, "Should pumps consume water? Enabling this might cause performance issues!", RestartRequirement.NONE);
ConficGuiFactoryBC.register("power.miningUsageMultiplier", 1.0D, "What should the multiplier of all mining-related power usage be?", RestartRequirement.NONE);
ConficGuiFactoryBC.register("display.colorBlindMode", false, "Should I enable colorblind mode?", RestartRequirement.GAME);
ConficGuiFactoryBC.register("worldgen.generateWaterSprings", true, "Should BuildCraft generate water springs?", RestartRequirement.GAME);
ConficGuiFactoryBC.register("debug.network.stats", false, "Should all network packets be tracked for statistical purposes?", RestartRequirement.NONE);
reloadConfig(RestartRequirement.GAME);
wrenchItem = (new ItemWrench()).setTextureLocation("buildcraftcore:wrench").setUnlocalizedName("wrenchItem");
BCRegistry.INSTANCE.registerItem(wrenchItem, false);
mapLocationItem = (new ItemMapLocation()).setUnlocalizedName("mapLocation");
BCRegistry.INSTANCE.registerItem(mapLocationItem, false);
listItem = (ItemList) (new ItemList()).setUnlocalizedName("list");
BCRegistry.INSTANCE.registerItem(listItem, false);
debuggerItem = (new ItemDebugger()).setUnlocalizedName("debugger");
BCRegistry.INSTANCE.registerItem(debuggerItem, false);
if (BuildCraftCore.modifyWorld) {
EnumSpring.WATER.canGen = ConficGuiFactoryBC.get("worldgen.generateWaterSprings").getBoolean();
springBlock = new BlockSpring();
springBlock.setUnlocalizedName("eternalSpring");
BCRegistry.INSTANCE.registerBlock(springBlock, ItemSpring.class, false);
}
woodenGearItem = (new ItemBuildCraft()).setTextureLocation("buildcraftcore:gear/wood").setUnlocalizedName("woodenGearItem");
if (BCRegistry.INSTANCE.registerItem(woodenGearItem, false)) {
OreDictionary.registerOre("gearWood", new ItemStack(woodenGearItem));
}
stoneGearItem = (new ItemBuildCraft()).setTextureLocation("buildcraftcore:gear/stone").setUnlocalizedName("stoneGearItem");
if (BCRegistry.INSTANCE.registerItem(stoneGearItem, false)) {
OreDictionary.registerOre("gearStone", new ItemStack(stoneGearItem));
}
ironGearItem = (new ItemBuildCraft()).setTextureLocation("buildcraftcore:gear/iron").setUnlocalizedName("ironGearItem");
if (BCRegistry.INSTANCE.registerItem(ironGearItem, false)) {
OreDictionary.registerOre("gearIron", new ItemStack(ironGearItem));
}
goldGearItem = (new ItemBuildCraft()).setTextureLocation("buildcraftcore:gear/gold").setUnlocalizedName("goldGearItem");
if (BCRegistry.INSTANCE.registerItem(goldGearItem, false)) {
OreDictionary.registerOre("gearGold", new ItemStack(goldGearItem));
}
diamondGearItem = (new ItemBuildCraft()).setTextureLocation("buildcraftcore:gear/diamond").setUnlocalizedName("diamondGearItem");
if (BCRegistry.INSTANCE.registerItem(diamondGearItem, false)) {
OreDictionary.registerOre("gearDiamond", new ItemStack(diamondGearItem));
}
paintbrushItem = new ItemPaintbrush();
paintbrushItem.setUnlocalizedName("paintbrush");
BCRegistry.INSTANCE.registerItem(paintbrushItem, false);
if (DEVELOPER_MODE) {
tabletItem = new ItemTablet();
tabletItem.setUnlocalizedName("tablet");
BCRegistry.INSTANCE.registerItem(tabletItem, false);
}
decoratedBlock = new BlockDecoration();
decoratedBlock.setUnlocalizedName("decoratedBlock");
BCRegistry.INSTANCE.registerBlock(decoratedBlock, true);
engineBlock = (BlockEngine) CompatHooks.INSTANCE.getBlock(BlockEngine.class);
BCRegistry.INSTANCE.registerBlock(engineBlock, ItemEngine.class, true);
engineBlock.registerTile((Class<? extends TileEngineBase>) CompatHooks.INSTANCE.getTile(TileEngineWood.class), 0, "tile.engineWood");
BCRegistry.INSTANCE.registerTileEntity(TileEngineWood.class, "buildcraft.core.engine.wood", "net.minecraft.src.buildcraft.energy.TileEngineWood");
markerBlock = (BlockMarker) CompatHooks.INSTANCE.getBlock(BlockMarker.class);
BCRegistry.INSTANCE.registerBlock(markerBlock.setUnlocalizedName("markerBlock"), false);
pathMarkerBlock = (BlockPathMarker) CompatHooks.INSTANCE.getBlock(BlockPathMarker.class);
BCRegistry.INSTANCE.registerBlock(pathMarkerBlock.setUnlocalizedName("pathMarkerBlock"), false);
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new BlockHighlightHandler());
MinecraftForge.EVENT_BUS.register(new ListTooltipHandler());
MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE);
OreDictionary.registerOre("craftingTableWood", Blocks.crafting_table);
}
use of buildcraft.core.item.ItemMapLocation in project BuildCraft by BuildCraft.
the class TileZonePlanner method update.
@Override
public void update() {
deltaManager.tick();
if (getWorld().isRemote) {
return;
}
{
// noinspection ConstantConditions
if (!invInputPaintbrush.getStackInSlot(0).isEmpty() && invInputPaintbrush.getStackInSlot(0).getItem() instanceof ItemPaintbrush_BC8 && !invInputMapLocation.getStackInSlot(0).isEmpty() && invInputMapLocation.getStackInSlot(0).getItem() instanceof ItemMapLocation && invInputMapLocation.getStackInSlot(0).getTagCompound() != null && invInputMapLocation.getStackInSlot(0).getTagCompound().hasKey("chunkMapping") && invInputResult.getStackInSlot(0).isEmpty()) {
if (progressInput == 0) {
deltaProgressInput.addDelta(0, 200, 1);
deltaProgressInput.addDelta(200, 205, -1);
}
if (progressInput < 200) {
progressInput++;
return;
}
ZonePlan zonePlan = new ZonePlan();
zonePlan.readFromNBT(invInputMapLocation.getStackInSlot(0).getTagCompound());
layers[BCCoreItems.paintbrush.getBrushFromStack(invInputPaintbrush.getStackInSlot(0)).colour.getMetadata()] = zonePlan.getWithOffset(-pos.getX(), -pos.getZ());
invInputMapLocation.setStackInSlot(0, StackUtil.EMPTY);
invInputResult.setStackInSlot(0, new ItemStack(BCCoreItems.mapLocation));
this.markDirty();
this.sendNetworkUpdate(NET_RENDER_DATA);
progressInput = 0;
} else if (progressInput != -1) {
progressInput = -1;
deltaProgressInput.setValue(0);
}
}
{
if (!invOutputPaintbrush.getStackInSlot(0).isEmpty() && invOutputPaintbrush.getStackInSlot(0).getItem() instanceof ItemPaintbrush_BC8 && !invOutputMapLocation.getStackInSlot(0).isEmpty() && invOutputMapLocation.getStackInSlot(0).getItem() instanceof ItemMapLocation && invOutputResult.getStackInSlot(0).isEmpty()) {
if (progressOutput == 0) {
deltaProgressOutput.addDelta(0, 200, 1);
deltaProgressOutput.addDelta(200, 205, -1);
}
if (progressOutput < 200) {
progressOutput++;
return;
}
ItemMapLocation.setZone(invOutputMapLocation.getStackInSlot(0), layers[BCCoreItems.paintbrush.getBrushFromStack(invOutputPaintbrush.getStackInSlot(0)).colour.getMetadata()].getWithOffset(pos.getX(), pos.getZ()));
invOutputResult.setStackInSlot(0, invOutputMapLocation.getStackInSlot(0));
invOutputMapLocation.setStackInSlot(0, StackUtil.EMPTY);
progressOutput = 0;
} else if (progressOutput != -1) {
progressOutput = -1;
deltaProgressOutput.setValue(0);
}
}
}
Aggregations