use of buildcraft.core.lib.network.base.PacketHandler in project BuildCraft by BuildCraft.
the class BuildCraftEnergy method init.
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-ENERGY", new ChannelHandler(), new PacketHandler());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new EnergyGuiHandler());
StatementManager.registerTriggerProvider(new EnergyStatementProvider());
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
reloadConfig(RestartRequirement.GAME);
BuildcraftRecipeRegistry.refinery.addRecipe("buildcraft:fuel", new FluidStack(oil.fluid, 1), new FluidStack(fuel.fluid, 1), 120, 1);
double fuelOilMultiplier = BuildCraftCore.mainConfigManager.get("general", "fuel.oil.combustion").getDouble();
double fuelFuelMultiplier = BuildCraftCore.mainConfigManager.get("general", "fuel.fuel.combustion").getDouble();
int fuelOilEnergyOutput = BuildCraftCore.mainConfigManager.get("general", "fuel.oil.combustion.energyOutput").getInt();
int fuelFuelEnergyOutput = BuildCraftCore.mainConfigManager.get("general", "fuel.fuel.combustion.energyOutput").getInt();
if (!Loader.isModLoaded("BuildCraft|Factory")) {
BuildcraftFuelRegistry.fuel.addFuel(oil.fluid, fuelOilEnergyOutput, (int) (5000 * fuelOilMultiplier));
BuildcraftFuelRegistry.fuel.addFuel(fuel.fluid, fuelFuelEnergyOutput, (int) (25000 * fuelFuelMultiplier));
}
BuildcraftFuelRegistry.coolant.addCoolant(FluidRegistry.WATER, 0.0023f);
BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.ice), StackKey.fluid(FluidRegistry.WATER), 1.5f);
BuildcraftFuelRegistry.coolant.addSolidCoolant(StackKey.stack(Blocks.packed_ice), StackKey.fluid(FluidRegistry.WATER), 2.0f);
EnergyProxy.proxy.registerBlockRenderers();
EnergyProxy.proxy.registerTileEntities();
engineAchievement2 = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|energy:achievement.stirlingEngine", "engineAchievement2", 3, -2, new ItemStack(BuildCraftCore.engineBlock, 1, 1), BuildCraftCore.engineRedstoneAchievement));
engineAchievement3 = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|energy:achievement.combustionEngine", "engineAchievement3", 5, -2, new ItemStack(BuildCraftCore.engineBlock, 1, 2), engineAchievement2));
}
use of buildcraft.core.lib.network.base.PacketHandler in project BuildCraft by BuildCraft.
the class BuildCraftTransport method init.
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
transportChannelHandler = new ChannelHandler();
MinecraftForge.EVENT_BUS.register(this);
transportChannelHandler.registerPacketType(PacketFluidUpdate.class);
transportChannelHandler.registerPacketType(PacketPipeSyncRequest.class);
transportChannelHandler.registerPacketType(PacketPipeTransportItemStack.class);
transportChannelHandler.registerPacketType(PacketPipeTransportItemStackRequest.class);
transportChannelHandler.registerPacketType(PacketPipeTransportTraveler.class);
transportChannelHandler.registerPacketType(PacketPowerUpdate.class);
channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-TRANSPORT", transportChannelHandler, new PacketHandler());
TransportProxy.proxy.registerTileEntities();
BuilderAPI.schematicRegistry.registerSchematicBlock(genericPipeBlock, SchematicPipe.class);
BuilderAPI.schematicRegistry.registerSchematicBlock(filteredBufferBlock, SchematicTile.class);
new BptPipeRotatable(pipeItemsWood);
new BptPipeRotatable(pipeFluidsWood);
new BptPipeRotatable(pipeItemsIron);
new BptPipeRotatable(pipeFluidsIron);
new BptPipeRotatable(pipeItemsEmerald);
new BptPipeRotatable(pipeFluidsEmerald);
new BptPipeRotatable(pipeItemsDaizuli);
new BptPipeRotatable(pipeItemsEmzuli);
for (Item itemPipe : BlockGenericPipe.pipes.keySet()) {
Class<? extends Pipe<?>> klazz = BlockGenericPipe.pipes.get(itemPipe);
if (IDiamondPipe.class.isAssignableFrom(klazz)) {
new BptPipeFiltered(itemPipe);
}
}
PipeEventBus.registerGlobalHandler(new LensFilterHandler());
BCCreativeTab.get("pipes").setIcon(new ItemStack(BuildCraftTransport.pipeItemsDiamond, 1));
if (NEPTUNE_TESTING)
BCCreativeTab.get("neptune").setIcon(new ItemStack(Items.cake));
if (showAllFacadesCreative) {
BCCreativeTab.get("facades").setIcon(facadeItem.getFacadeForBlock(Blocks.brick_block.getDefaultState()));
}
if (Loader.isModLoaded("BuildCraft|Silicon")) {
BCCreativeTab.get("gates").setIcon(ItemGate.makeGateItem(GateMaterial.DIAMOND, GateLogic.AND));
}
StatementManager.registerParameterClass(TriggerParameterSignal.class);
StatementManager.registerParameterClass(ActionParameterSignal.class);
// Item use stripes handlers
PipeManager.registerStripesHandler(new StripesHandlerRightClick(), -32768);
PipeManager.registerStripesHandler(new StripesHandlerDispenser(), -49152);
PipeManager.registerStripesHandler(new StripesHandlerPlant(), 0);
PipeManager.registerStripesHandler(new StripesHandlerBucket(), 0);
PipeManager.registerStripesHandler(new StripesHandlerArrow(), 0);
PipeManager.registerStripesHandler(new StripesHandlerShears(), 0);
PipeManager.registerStripesHandler(new StripesHandlerPipes(), 0);
PipeManager.registerStripesHandler(new StripesHandlerPipeWires(), 0);
PipeManager.registerStripesHandler(new StripesHandlerEntityInteract(), 0);
PipeManager.registerStripesHandler(new StripesHandlerPlaceBlock(), -65536);
PipeManager.registerStripesHandler(new StripesHandlerUse(), -131072);
PipeManager.registerStripesHandler(new StripesHandlerHoe(), 0);
StripesHandlerDispenser.items.add(ItemMinecart.class);
StripesHandlerRightClick.items.add(Items.egg);
StripesHandlerRightClick.items.add(Items.snowball);
StripesHandlerRightClick.items.add(Items.experience_bottle);
StripesHandlerUse.items.add(Items.fireworks);
// Block breaking stripes handlers
PipeManager.registerStripesHandler(new StripesHandlerMinecartDestroy(), 0);
PipeManager.registerPipePluggable(FacadePluggable.class, "facade");
PipeManager.registerPipePluggable(GatePluggable.class, "gate");
PipeManager.registerPipePluggable(LensPluggable.class, "lens");
PipeManager.registerPipePluggable(PlugPluggable.class, "plug");
PipeManager.registerPipePluggable(PowerAdapterPluggable.class, "powerAdapter");
GateExpansions.registerExpansion(GateExpansionPulsar.INSTANCE);
GateExpansions.registerExpansion(GateExpansionTimer.INSTANCE);
GateExpansions.registerExpansion(GateExpansionRedstoneFader.INSTANCE);
GateExpansions.registerExpansion(GateExpansionLightSensor.INSTANCE, new ItemStack(Blocks.daylight_detector));
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
TransportProxy.proxy.registerRenderers();
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new TransportGuiHandler());
/* Make pipes extend to connect to blocks like chests. This means that a connection going UP (the bottom of the
* block in question) will be the only face that does not extend into the block slightly. */
ICustomPipeConnection smallerBlockConnection = (world, pos, face, state) -> face == EnumFacing.UP ? 0 : 2 / 16f;
PipeConnectionAPI.registerConnection(Blocks.chest, smallerBlockConnection);
PipeConnectionAPI.registerConnection(Blocks.trapped_chest, smallerBlockConnection);
PipeConnectionAPI.registerConnection(Blocks.hopper, smallerBlockConnection);
if (NEPTUNE_TESTING)
TransportPipes_BC8.init();
}
use of buildcraft.core.lib.network.base.PacketHandler in project BuildCraft by BuildCraft.
the class BuildCraftCore method init.
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
BuildCraftAPI.fakePlayerProvider = CoreProxy.proxy;
EntityRegistry.registerModEntity(EntityResizableCuboid.class, "bcResizCuboid", EntityIds.RESIZABLE_CUBOID, instance, 0, 100, false);
ChannelHandler coreChannelHandler = new ChannelHandler();
coreChannelHandler.registerPacketType(PacketTabletMessage.class);
channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-CORE", coreChannelHandler, handler = new PacketHandler());
achievementManager = new AchievementPageManager("BuildCraft");
MinecraftForge.EVENT_BUS.register(achievementManager);
woodenGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.woodenGear", "woodenGearAchievement", 0, 0, woodenGearItem, null));
stoneGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.stoneGear", "stoneGearAchievement", 2, 0, stoneGearItem, woodenGearAchievement));
ironGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.ironGear", "ironGearAchievement", 4, 0, ironGearItem, stoneGearAchievement));
goldGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.goldGear", "goldGearAchievement", 6, 0, goldGearItem, ironGearAchievement));
diamondGearAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.diamondGear", "diamondGearAchievement", 8, 0, diamondGearItem, goldGearAchievement));
wrenchAchievement = achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.wrench", "wrenchAchievement", 3, 2, wrenchItem, stoneGearAchievement));
engineRedstoneAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|core:achievement.redstoneEngine", "engineAchievement1", 1, -2, new ItemStack(engineBlock, 1, 0), BuildCraftCore.woodenGearAchievement));
StatementManager.registerParameterClass(StatementParameterItemStack.class);
StatementManager.registerParameterClass(StatementParameterItemStackExact.class);
StatementManager.registerParameterClass(StatementParameterDirection.class);
StatementManager.registerParameterClass(StatementParamGateSideOnly.class);
StatementManager.registerParameterClass(StatementParameterRedstoneLevel.class);
StatementManager.registerTriggerProvider(new CoreTriggerProvider());
StatementManager.registerActionProvider(new CoreActionProvider());
if (BuildCraftCore.modifyWorld) {
MinecraftForge.EVENT_BUS.register(new SpringPopulate());
}
if (mainConfiguration.hasChanged()) {
mainConfiguration.save();
}
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
BCCreativeTab.get("main").setIcon(new ItemStack(BuildCraftCore.wrenchItem, 1));
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcLaser");
EntityList.stringToClassMapping.remove("BuildCraft|Core.bcEnergyLaser");
BuilderAPI.schematicRegistry.registerSchematicBlock(engineBlock, SchematicEngine.class);
CoreProxy.proxy.init();
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new CoreGuiHandler());
MinecraftForge.EVENT_BUS.register(TabletManagerClient.INSTANCE);
MinecraftForge.EVENT_BUS.register(TabletManagerServer.INSTANCE);
MinecraftForge.EVENT_BUS.register(TickHandlerCore.INSTANCE);
TabletAPI.registerProgram(new TabletProgramMenuFactory());
// Create filler registry
try {
FillerManager.registry = new FillerRegistry();
// INIT FILLER PATTERNS
IFillerPattern[] patterns = { PatternFill.INSTANCE, PatternNone.INSTANCE, new PatternFlatten(), new PatternHorizon(), new PatternClear(), new PatternBox(), new PatternPyramid(), new PatternStairs(), new PatternCylinder(), new PatternFrame() };
for (IFillerPattern pattern : patterns) {
FillerManager.registry.addPattern(pattern);
}
ActionFiller.resetMap();
} catch (Error error) {
BCLog.logErrorAPI(error, IFillerPattern.class);
throw error;
}
StatementManager.registerParameterClass(PatternParameterYDir.class);
StatementManager.registerParameterClass(PatternParameterXZDir.class);
StatementManager.registerParameterClass(PatternParameterCenter.class);
StatementManager.registerParameterClass(PatternParameterHollow.class);
ListRegistry.registerHandler(new ListMatchHandlerClass());
ListRegistry.registerHandler(new ListMatchHandlerFluid());
ListRegistry.registerHandler(new ListMatchHandlerTools());
ListRegistry.registerHandler(new ListMatchHandlerArmor());
// ListRegistry.registerHandler(new ListMatchHandler());
ListRegistry.itemClassAsType.add(ItemFood.class);
DebuggingTools.fmlInit();
}
use of buildcraft.core.lib.network.base.PacketHandler in project BuildCraft by BuildCraft.
the class BuildCraftFactory method fmlPreInit.
@Mod.EventHandler
public void fmlPreInit(FMLPreInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-FACTORY", new ChannelHandler(), new PacketHandler());
BuildcraftRecipeRegistry.complexRefinery = ComplexRefineryRecipeManager.INSTANCE;
String plc = "Allows admins to whitelist or blacklist pumping of specific fluids in specific dimensions.\n" + "Eg. \"-/-1/Lava\" will disable lava in the nether. \"-/*/Lava\" will disable lava in any dimension. \"+/0/*\" will enable any fluid in the overworld.\n" + "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.";
BuildCraftCore.mainConfigManager.register("general.miningDepth", 256, "Should the mining well only be usable once after placing?", RestartRequirement.NONE);
BuildCraftCore.mainConfigManager.get("general.miningDepth").setMinValue(2).setMaxValue(256);
BuildCraftCore.mainConfigManager.register("general.pumpDimensionControl", DefaultProps.PUMP_DIMENSION_LIST, plc, RestartRequirement.NONE);
BuildCraftCore.mainConfigManager.register("general.pumpsNeedRealPower", false, "Do pumps need real (non-redstone) power?", RestartRequirement.WORLD);
reloadConfig(RestartRequirement.GAME);
miningWellBlock = (BlockMiningWell) CompatHooks.INSTANCE.getBlock(BlockMiningWell.class);
if (BCRegistry.INSTANCE.registerBlock(miningWellBlock.setUnlocalizedName("miningWellBlock"), false)) {
plainPipeBlock = new BlockPlainPipe();
BCRegistry.INSTANCE.registerBlock(plainPipeBlock.setUnlocalizedName("plainPipeBlock"), true);
}
autoWorkbenchBlock = (BlockAutoWorkbench) CompatHooks.INSTANCE.getBlock(BlockAutoWorkbench.class);
BCRegistry.INSTANCE.registerBlock(autoWorkbenchBlock.setUnlocalizedName("autoWorkbenchBlock"), false);
tankBlock = (BlockTank) CompatHooks.INSTANCE.getBlock(BlockTank.class);
BCRegistry.INSTANCE.registerBlock(tankBlock.setUnlocalizedName("tankBlock"), false);
pumpBlock = (BlockPump) CompatHooks.INSTANCE.getBlock(BlockPump.class);
BCRegistry.INSTANCE.registerBlock(pumpBlock.setUnlocalizedName("pumpBlock"), false);
floodGateBlock = (BlockFloodGate) CompatHooks.INSTANCE.getBlock(BlockFloodGate.class);
BCRegistry.INSTANCE.registerBlock(floodGateBlock.setUnlocalizedName("floodGateBlock"), false);
refineryBlock = (BlockRefinery) CompatHooks.INSTANCE.getBlock(BlockRefinery.class);
BCRegistry.INSTANCE.registerBlock(refineryBlock.setUnlocalizedName("refineryBlock"), false);
chuteBlock = (BlockChute) CompatHooks.INSTANCE.getBlock(BlockChute.class);
BCRegistry.INSTANCE.registerBlock(chuteBlock.setUnlocalizedName("blockChute"), false);
if (Loader.isModLoaded("BuildCraft|Energy")) {
energyHeaterBlock = (BlockEnergyHeater) CompatHooks.INSTANCE.getBlock(BlockEnergyHeater.class);
BCRegistry.INSTANCE.registerBlock(energyHeaterBlock.setUnlocalizedName("blockEnergyHeater"), false);
heatExchangeBlock = (BlockHeatExchange) CompatHooks.INSTANCE.getBlock(BlockHeatExchange.class);
BCRegistry.INSTANCE.registerBlock(heatExchangeBlock.setUnlocalizedName("blockHeatExchange"), false);
distillerBlock = (BlockDistiller) CompatHooks.INSTANCE.getBlock(BlockDistiller.class);
BCRegistry.INSTANCE.registerBlock(distillerBlock.setUnlocalizedName("blockDistiller"), false);
plasticSheetItem = new ItemBuildCraft();
plasticSheetItem.setUnlocalizedName("plasticSheet");
plasticSheetItem.setLocalizationRuleArray("item.plasticSheet.singular", "item.plasticSheet.plural");
plasticSheetItem.setLocalizationRule((stack) -> stack == null ? 0 : stack.stackSize > 1 ? 1 : 0);
BCRegistry.INSTANCE.registerItem(plasticSheetItem, false);
ComplexRefiningManager.preInit();
}
FactoryProxy.proxy.preInit();
MinecraftForge.EVENT_BUS.register(this);
}
use of buildcraft.core.lib.network.base.PacketHandler in project BuildCraft by BuildCraft.
the class BuildCraftSilicon method init.
@Mod.EventHandler
public void init(FMLInitializationEvent evt) {
channels = NetworkRegistry.INSTANCE.newChannel(DefaultProps.NET_CHANNEL_NAME + "-SILICON", new ChannelHandler(), new PacketHandler());
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new SiliconGuiHandler());
BCRegistry.INSTANCE.registerTileEntity(TileLaser.class, "buildcraft.silicon.TileLaser", "net.minecraft.src.buildcraft.factory.TileLaser");
BCRegistry.INSTANCE.registerTileEntity(TileAssemblyTable.class, "buildcraft.silicon.TileAssemblyTable", "net.minecraft.src.buildcraft.factory.TileAssemblyTable");
BCRegistry.INSTANCE.registerTileEntity(TileAdvancedCraftingTable.class, "buildcraft.silicon.TileAdvancedCraftingTable", "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench");
BCRegistry.INSTANCE.registerTileEntity(TileIntegrationTable.class, "buildcraft.silicon.TileIntegrationTable", "net.minecraft.src.buildcraft.factory.TileIntegrationTable");
BCRegistry.INSTANCE.registerTileEntity(TileChargingTable.class, "buildcraft.silicon.TileChargingTable", "net.minecraft.src.buildcraft.factory.TileChargingTable");
BCRegistry.INSTANCE.registerTileEntity(TileProgrammingTable.class, "buildcraft.silicon.TileProgrammingTable", "net.minecraft.src.buildcraft.factory.TileProgrammingTable");
timeForSomeLogicAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|silicon:achievement.timeForSomeLogic", "timeForSomeLogicAchievement", 9, -2, assemblyTableBlock, BuildCraftCore.diamondGearAchievement));
tinglyLaserAchievement = BuildCraftCore.achievementManager.registerAchievement(new Achievement("buildcraft|silicon:achievement.tinglyLaser", "tinglyLaserAchievement", 11, -2, laserBlock, timeForSomeLogicAchievement));
if (BuildCraftCore.loadDefaultRecipes) {
loadRecipes();
}
SiliconProxy.proxy.registerRenderers();
}
Aggregations