本文整理汇总了Java中net.minecraftforge.fml.common.Mod.EventHandler类的典型用法代码示例。如果您正苦于以下问题:Java EventHandler类的具体用法?Java EventHandler怎么用?Java EventHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EventHandler类属于net.minecraftforge.fml.common.Mod包,在下文中一共展示了EventHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event){
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
config.load();
canBeDeactivated = config.getBoolean("canBeDeactivated", Configuration.CATEGORY_GENERAL, true, "If the wopper can be deactivated using redstone");
wopperSpeed = config.getInt("speed", Configuration.CATEGORY_GENERAL, 10, 1, 1000, "The amount of ticks that have to pass before the wopper does a movement action again");
if(config.hasChanged()){
config.save();
}
blockWopper = new BlockWopper("wopper");
GameRegistry.registerTileEntity(TileEntityWopper.class, MOD_ID+":wopper");
proxy.preInit();
}
示例2: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent e)
{
LogUtil.logDebug("Starting pre-initialization...");
configFile = BBConfigFolderLoader.getConfigFile(e);
configFile.load();
BBConfig.initialize();
BBConfig.syncConfig(configFile);
MinecraftForge.EVENT_BUS.register(eventHandler);
network = NetworkRegistry.INSTANCE.newSimpleChannel("bbchannel");
network.registerMessage(PacketNetherBrickOvenFuelLevel.PacketHandler.class,
PacketNetherBrickOvenFuelLevel.class, 0, Side.CLIENT);
network.registerMessage(PacketCampfireState.PacketHandler.class,
PacketCampfireState.class, 1, Side.CLIENT);
RegisterTileEntities.register();
FuelRegistry.addDefaultFuels();
ElementRegistry.init();
proxy.preInit(e);
}
示例3: onServerStopped
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public static void onServerStopped(FMLServerStoppedEvent event)
{
if (ModConfiguration.halloweenCheckInterval > 0)
{
// stop the scheduler
scheduler.schedule(new Runnable()
{
@Override
public void run()
{
handle.cancel(true);
}
}, 0, TimeUnit.SECONDS);
}
}
示例4: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
logger = event.getModLog();
config = new Configuration(event.getSuggestedConfigurationFile());
doConfig();
int id = 1; // Don't use 0, more easy debug.
snw = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);
snw.registerMessage(Request.Handler.class, Request.class, id++, Side.SERVER);
snw.registerMessage(Data.Handler.class, Data.class, id++, Side.CLIENT);
proxy.preInit();
}
示例5: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event){
Util.logger = new Logger(event.getModLog());
// find the fields we need regardless of obs
OpenGuiWrapper.findFields();
// register event handlers
MinecraftForge.EVENT_BUS.register(new Registrar());
MinecraftForge.EVENT_BUS.register(new VersionTracker());
MinecraftForge.EVENT_BUS.register(PlayerWorldSyncServer.INSTANCE);
// setup networking
RemoteGuiNetworkManager.INSTANCE.preInit(event);
VersionTracker.register(new UniversalRemoteVersionProvider());
proxy.preInit(event);
// fix broken config issues
UniversalRemoteConfiguration.validateConfig();
}
示例6: onInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void onInit(FMLInitializationEvent e) {
proxy.init();
//TODO: When smores has ore voting stabilized, update and re-enable this
//NBTTagCompound oresTag = new NBTTagCompound();
//oresTag.setBoolean("oreCopper", true);
//oresTag.setBoolean("ingotCopper", true);
//oresTag.setBoolean("dustCopper", true);
//oresTag.setBoolean("gearCopper", true);
//oresTag.setBoolean("plateCopper", true);
//FMLInterModComms.sendMessage("smores", "recipeVote", oresTag);
//Thermionics machines are *unusually* safe for charset to carry around
FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.FIREBOX.getRegistryName());
FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.OVEN.getRegistryName());
FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.BATTERY_LEAD.getRegistryName()); //Avoid creative battery carry!
FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.HAMMER_MILL.getRegistryName());
FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.MOTOR_CONVECTION.getRegistryName());
FMLInterModComms.sendMessage("charset", "addCarry", ThermionicsBlocks.SERGER.getRegistryName());
}
示例7: init
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent e) {
proxy.init(e);
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Cat", SoundEvents.RECORD_CAT, 183000000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Blocks", SoundEvents.RECORD_BLOCKS, 327000000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Chirp", SoundEvents.RECORD_CHIRP, 183000000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Far", SoundEvents.RECORD_FAR, 152400000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Mall", SoundEvents.RECORD_MALL, 190200000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Mellohi", SoundEvents.RECORD_MELLOHI, 81600000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Stal", SoundEvents.RECORD_STAL, 138000000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Strad", SoundEvents.RECORD_STRAD, 184800000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Wait", SoundEvents.RECORD_WAIT, 214800000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - Ward", SoundEvents.RECORD_WARD, 246600000));
//ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - 11", SoundEvents.RECORD_11, 66600000));
ApplicationMusicPlayer.registerDefaultSong(new ListedSong("C418 - 13", SoundEvents.RECORD_13, 154800000));
}
示例8: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
NetworkRegistry.INSTANCE.registerGuiHandler(Elicitation.instance, new GuiHandler());
Items.setup();
}
示例9: serverLoad
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void serverLoad(FMLServerStartingEvent event)
{
this.worldDir = event.getServer().getFolderName(); // Hand me that world name
_SaveData save = SaveHandler.loadFactionsFromFile(Main.configDir, Main.worldDir);
if (save == null)
{
save = new _SaveData(); // Init
}
TerritoryHandler.setSaveData(save);
}
示例10: afterModsLoaded
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void afterModsLoaded(FMLPostInitializationEvent event)
{
if (Loader.isModLoaded(Compats.IC2)) {
ItemsCG.loadRecipes();
}
}
示例11: load
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void load(FMLPreInitializationEvent event)
{
modLog = event.getModLog();
ConfigurationCG.init(event.getSuggestedConfigurationFile());
if (proxy.isClient()) {
getIC2Tab();
}
ItemsCG.load();
}
示例12: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit (FMLPreInitializationEvent event) {
CapabilityManager.INSTANCE.register(ITeslaConsumer.class, new CapabilityTeslaConsumer<ITeslaConsumer>(), BaseTeslaContainer.class);
CapabilityManager.INSTANCE.register(ITeslaProducer.class, new CapabilityTeslaProducer<ITeslaProducer>(), BaseTeslaContainer.class);
CapabilityManager.INSTANCE.register(ITeslaHolder.class, new CapabilityTeslaHolder<ITeslaHolder>(), BaseTeslaContainer.class);
}
示例13: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent e) {
proxy.preInit(e);
ModConfig.initConfig(e.getSuggestedConfigurationFile());
try {
// github = new GitHubBuilder().fromCredentials()/*.withOAuthToken("f6710197d10c01c77b8f5a1574c10ee0b57f5e6b", "[email protected]")
// */.build();
gson = new GsonBuilder()
.serializeNulls()
.setPrettyPrinting()
.create();
// ArrayList<AppStoreAppInfo> list = Main.gson.fromJson("[\n" +
// " {\n" +
// " \"name\": \"Mineuim Web Browser\",\n" +
// " \"shortDescription\": \"A web browser in mc!\",\n" +
// " \"description\": \"\",\n" +
// " \"category\": \"INTERNET\",\n" +
// " \"urls\": []\n" +
// " }\n" +
// "]", new TypeToken<List<AppStoreAppInfo>>(){}.getType());
// System.out.println(list.get(0));
//
// ArrayList<AppStoreAppInfo> info = new ArrayList<>();
// info.add(new AppStoreAppInfo("Mineuim Web Browser", "A web browser in mc!", "", AppCategory.INTERNET, new ArrayList<>()));
// System.out.println(gson.toJson(info));
//new ApplicationUnofficialAppStore().init();
} catch (Exception e1) {
e1.printStackTrace();
}
if (!modDataDir.exists()) modDataDir.mkdirs();
}
示例14: serverStarting
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
PacketHandler.NETWORKINSTANCE.registerMessage(PacketGetWorker.Handler.class, PacketGetWorker.class,
PacketHandler.nextID(), Side.SERVER);
PacketHandler.NETWORKINSTANCE.registerMessage(PacketReturnWorker.Handler.class, PacketReturnWorker.class,
PacketHandler.nextID(), Side.CLIENT);
event.registerServerCommand(new MainCmd());
event.registerServerCommand(new GamemodeCmd());
}
示例15: preInit
import net.minecraftforge.fml.common.Mod.EventHandler; //导入依赖的package包/类
@EventHandler
public void preInit (FMLPreInitializationEvent event) {
// Packets
NETWORK.register(PacketStage.class, Side.CLIENT);
NETWORK.register(PacketStageAll.class, Side.CLIENT);
NETWORK.register(PacketRequestClientSync.class, Side.SERVER);
CapabilityManager.INSTANCE.register(IStageData.class, new Storage(), DefaultStageData.class);
MinecraftForge.EVENT_BUS.register(new PlayerDataHandler());
BookshelfRegistry.addCommand(COMMAND);
BookshelfRegistry.addGameRule(GAME_RULE_SHARE_STAGES);
}