net.minecraftforge.common.MinecraftForge Java Examples
The following examples show how to use
net.minecraftforge.common.MinecraftForge.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FullbrightHack.java From ForgeWurst with GNU General Public License v3.0 | 6 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { if(isEnabled()) { if(mc.gameSettings.gammaSetting < 16) mc.gameSettings.gammaSetting = Math.min(mc.gameSettings.gammaSetting + 0.5F, 16); return; } if(mc.gameSettings.gammaSetting > 0.5F) mc.gameSettings.gammaSetting = Math.max(mc.gameSettings.gammaSetting - 0.5F, 0.5F); else MinecraftForge.EVENT_BUS.unregister(this); }
Example #2
Source File: PlayerCivilizationCapabilityImpl.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
@Override public void setReputation(CivilizationType civ, int amount) { if (civ == null) { return; } reputations.put(civ, amount); if (!player.getEntityWorld().isRemote) { ToroQuestPacketHandler.INSTANCE.sendTo(new MessageSetPlayerReputation(civ, amount), (EntityPlayerMP) player); MinecraftForge.EVENT_BUS.post(new CivilizationEvent.ReputationChange(player, civ, amount)); ReputationLevel level = ReputationLevel.fromReputation(amount); /* TODO if (ReputationLevel.FRIEND.equals(level)) { player.addStat(FRIEND_ACHIEVEMNT); } else if (ReputationLevel.ALLY.equals(level)) { player.addStat(ALLY_ACHIEVEMNT); } else if (ReputationLevel.HERO.equals(level)) { player.addStat(HERO_ACHIEVEMNT); }*/ } }
Example #3
Source File: WorldGenRegistry.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
public void initializeRegistry() { GTLog.logger.info("Initializing ore generation registry..."); registerShapeGenerator("ellipsoid", EllipsoidGenerator::new); registerShapeGenerator("sphere", SphereGenerator::new); registerShapeGenerator("plate", PlateGenerator::new); registerShapeGenerator("single", SingleBlockGenerator::new); registerBlockFiller("simple", SimpleBlockFiller::new); registerBlockFiller("ignore_bedrock", () -> new BlacklistedBlockFiller(Lists.newArrayList(Blocks.BEDROCK.getDefaultState()))); registerVeinPopulator("surface_rock", SurfaceRockPopulator::new); registerVeinPopulator("fluid_spring", FluidSpringPopulator::new); registerVeinPopulator("surface_block", SurfaceBlockPopulator::new); WorldGeneratorImpl worldGenerator = new WorldGeneratorImpl(); GameRegistry.registerWorldGenerator(worldGenerator, 1); MinecraftForge.ORE_GEN_BUS.register(worldGenerator); try { reinitializeRegisteredVeins(); } catch (IOException | RuntimeException exception) { GTLog.logger.fatal("Failed to initialize worldgen registry.", exception); } }
Example #4
Source File: ElectroMagicTools.java From Electro-Magic-Tools with GNU General Public License v3.0 | 6 votes |
@EventHandler public void load(FMLInitializationEvent event) { ElectroMagicTools.logger.info(localize("console.EMT.init.begin")); ElectroMagicTools.logger.info(localize("console.EMT.init.loadProxies")); proxy.load(); ElectroMagicTools.logger.info(localize("console.EMT.init.mobDrops")); MinecraftForge.EVENT_BUS.register(new EntityEventHandler()); ElectroMagicTools.logger.info(localize("console.EMT.init.loot")); DungeonChestGenerator.generateLoot(); ElectroMagicTools.logger.info(localize("console.EMT.init.entities")); BaseEntityRegistry.registerEMTEntities(); ElectroMagicTools.logger.info(localize("console.EMT.init.guiHandler")); NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy); ElectroMagicTools.logger.info(localize("console.EMT.init.end")); }
Example #5
Source File: BlockUtils.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
/** * Tries breaking a block safely and fires an event for it. * * @return Whether the block was successfully broken */ public static boolean breakBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nullable IBlockState oldState, @Nonnull EntityPlayerMP player) { if (!world.isBlockLoaded(pos)) return false; if (!(player instanceof FakePlayer) && !hasEditPermission(pos, player)) return false; if (oldState == null) oldState = world.getBlockState(pos); BlockEvent.BreakEvent event = new BlockEvent.BreakEvent(world, pos, oldState, player); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) return false; TileEntity tile = world.getTileEntity(pos); Block block = oldState.getBlock(); if (block.removedByPlayer(oldState, world, pos, player, true)) { block.onPlayerDestroy(world, pos, oldState); block.harvestBlock(world, player, pos, oldState, tile, player.getHeldItemMainhand()); world.notifyBlockUpdate(pos, oldState, Blocks.AIR.getDefaultState(), 3); } else return false; return true; }
Example #6
Source File: ChestEspHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@Override protected void onDisable() { MinecraftForge.EVENT_BUS.unregister(this); GL11.glDeleteLists(greenBox, 1); greenBox = 0; GL11.glDeleteLists(orangeBox, 1); orangeBox = 0; GL11.glDeleteLists(cyanBox, 1); cyanBox = 0; GL11.glDeleteLists(normalChests, 1); normalChests = 0; }
Example #7
Source File: CommonProxy.java From SimplyJetpacks with MIT License | 5 votes |
public void registerHandlers() { SimplyJetpacks.logger.info("Registering handlers"); NetworkRegistry.INSTANCE.registerGuiHandler(SimplyJetpacks.instance, new GuiHandler()); FMLCommonHandler.instance().bus().register(new SyncHandler()); FMLCommonHandler.instance().bus().register(new PlatingReturnHandler()); MinecraftForge.EVENT_BUS.register(new EntityInteractHandler()); MinecraftForge.EVENT_BUS.register(new LivingTickHandler()); }
Example #8
Source File: ForgeClientSparkPlugin.java From spark with GNU General Public License v3.0 | 5 votes |
public static void register(ForgeSparkMod mod, FMLClientSetupEvent event) { Minecraft minecraft = event.getMinecraftSupplier().get(); ForgeClientSparkPlugin plugin = new ForgeClientSparkPlugin(mod, minecraft); MinecraftForge.EVENT_BUS.register(plugin); plugin.scheduler.scheduleWithFixedDelay(plugin::checkCommandRegistered, 10, 10, TimeUnit.SECONDS); }
Example #9
Source File: CommonProxy.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public void registerEventHandlers() { MinecraftForge.EVENT_BUS.register(new AnvilUpdateEventHandler()); MinecraftForge.EVENT_BUS.register(new BlockEventHandler()); MinecraftForge.EVENT_BUS.register(new EntityEventHandler()); MinecraftForge.EVENT_BUS.register(new ItemPickupEventHandler()); MinecraftForge.EVENT_BUS.register(new LivingDropsEventHandler()); MinecraftForge.EVENT_BUS.register(new PlayerEventHandler()); MinecraftForge.EVENT_BUS.register(new WorldEventHandler()); MinecraftForge.EVENT_BUS.register(new TickHandler()); MinecraftForge.EVENT_BUS.register(this); ForgeChunkManager.setForcedChunkLoadingCallback(EnderUtilities.instance, new ChunkLoading()); }
Example #10
Source File: GTTileDragonEggEnergySiphon.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onLoaded() { super.onLoaded(); if (this.isSimulating() && !this.enet) { MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); this.enet = true; } }
Example #11
Source File: GTTileBufferBase.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onLoaded() { super.onLoaded(); if (this.isSimulating() && !this.addedToEnet) { MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); this.addedToEnet = true; } }
Example #12
Source File: ClientEventHandler.java From HoloInventory with MIT License | 5 votes |
public static void init() { if (instance != null) MinecraftForge.EVENT_BUS.unregister(instance); instance = new ClientEventHandler(); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); keyHold = new KeyBinding("Hold to show", KeyConflictContext.IN_GAME, Keyboard.KEY_H, HoloInventory.MODID); keyToggle = new KeyBinding("Toggle to show", KeyConflictContext.IN_GAME, 0, HoloInventory.MODID); ClientRegistry.registerKeyBinding(keyHold); ClientRegistry.registerKeyBinding(keyToggle); }
Example #13
Source File: SemiBlockInitializer.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
public static void init(){ MinecraftForge.EVENT_BUS.register(SemiBlockManager.getServerInstance()); FMLCommonHandler.instance().bus().register(SemiBlockManager.getServerInstance()); Class requesterClass = Loader.isModLoaded(ModIds.AE2) ? SemiBlockRequesterAE.class : SemiBlockRequester.class; registerSemiBlock(SemiBlockActiveProvider.ID, SemiBlockActiveProvider.class, false); registerSemiBlock(SemiBlockPassiveProvider.ID, SemiBlockPassiveProvider.class, false); registerSemiBlock(SemiBlockStorage.ID, SemiBlockStorage.class, false); registerSemiBlock(SemiBlockDefaultStorage.ID, SemiBlockDefaultStorage.class, false); registerSemiBlock(SemiBlockRequester.ID, requesterClass, false); registerSemiBlock("heatFrame", SemiBlockHeatFrame.class); PneumaticCraft.proxy.registerSemiBlockRenderer((ItemSemiBlockBase)Itemss.logisticsFrameRequester); SemiBlockManager.registerSemiBlockToItemMapping(requesterClass, Itemss.logisticsFrameRequester); PneumaticCraft.proxy.registerSemiBlockRenderer((ItemSemiBlockBase)Itemss.logisticsFrameDefaultStorage); SemiBlockManager.registerSemiBlockToItemMapping(SemiBlockDefaultStorage.class, Itemss.logisticsFrameDefaultStorage); PneumaticCraft.proxy.registerSemiBlockRenderer((ItemSemiBlockBase)Itemss.logisticsFrameStorage); SemiBlockManager.registerSemiBlockToItemMapping(SemiBlockStorage.class, Itemss.logisticsFrameStorage); PneumaticCraft.proxy.registerSemiBlockRenderer((ItemSemiBlockBase)Itemss.logisticsFramePassiveProvider); SemiBlockManager.registerSemiBlockToItemMapping(SemiBlockPassiveProvider.class, Itemss.logisticsFramePassiveProvider); PneumaticCraft.proxy.registerSemiBlockRenderer((ItemSemiBlockBase)Itemss.logisticsFrameActiveProvider); SemiBlockManager.registerSemiBlockToItemMapping(SemiBlockActiveProvider.class, Itemss.logisticsFrameActiveProvider); }
Example #14
Source File: GuiCustom.java From Custom-Main-Menu with MIT License | 5 votes |
@Override protected void actionPerformed(GuiButton button) throws IOException { if (button instanceof GuiCustomWrappedButton && this.guiConfig.name.equals("mainmenu")) { GuiCustomWrappedButton wrapped = (GuiCustomWrappedButton) button; if (wrapped.wrappedButton != null) { ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(new GuiFakeMain(), wrapped.wrappedButton, new ArrayList<GuiButton>()); if (MinecraftForge.EVENT_BUS.post(event)) { return; } event.getButton().playPressSound(this.mc.getSoundHandler()); if (this.equals(this.mc.currentScreen)) { MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(new GuiFakeMain(), wrapped.wrappedButton, new ArrayList<GuiButton>())); } } } else if (button.id >= 6000 && button instanceof GuiCustomButton) { GuiCustomButton custom = (GuiCustomButton) button; // It's one of mine :o if (custom.b.action != null) { custom.b.action.perform(custom.b, this); } } }
Example #15
Source File: RenderEventService.java From ForgeHax with MIT License | 5 votes |
@SubscribeEvent(priority = EventPriority.LOW) public void onRenderGameOverlayEvent(final RenderGameOverlayEvent.Text event) { if (event.getType().equals(RenderGameOverlayEvent.ElementType.TEXT)) { MinecraftForge.EVENT_BUS.post(new Render2DEvent(event.getPartialTicks())); GlStateManager.color(1.f, 1.f, 1.f, 1.f); // reset color } }
Example #16
Source File: ClientProxy.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); MinecraftForge.EVENT_BUS.register(new ModelBakeHandler()); MinecraftForge.EVENT_BUS.register(new SmallVesselHighlightHandler()); }
Example #17
Source File: EntityElevatorCapsule.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void useNetworkData(EntityPlayer player, Side side, byte id, NBTTagCompound nbt) { if(id == PACKET_WRITE_DST_INFO && world.isRemote) { if(nbt.hasKey("dimid")) { dstTilePos = new DimensionBlockPosition(nbt.getInteger("dimid"), new HashedBlockPosition(nbt.getInteger("x"), nbt.getInteger("y"), nbt.getInteger("z"))); } else dstTilePos = null; } else if(id == PACKET_WRITE_SRC_INFO && world.isRemote) { if(nbt.hasKey("dimid")) { srcTilePos = new DimensionBlockPosition(nbt.getInteger("dimid"), new HashedBlockPosition(nbt.getInteger("x"), nbt.getInteger("y"), nbt.getInteger("z"))); } else srcTilePos = null; } else if(id == PACKET_RECIEVE_NBT) { PacketHandler.sendToPlayersTrackingEntity(new PacketEntity(this, PACKET_WRITE_DST_INFO), this); } else if(id == PACKET_LAUNCH_EVENT && world.isRemote) { List<EntityPlayer> list = world.getEntitiesWithinAABB(EntityPlayer.class, getEntityBoundingBox()); for(Entity ent : list) { if(this.getRidingEntity() == null) ent.startRiding(this); } MinecraftForge.EVENT_BUS.post(new RocketEvent.RocketLaunchEvent(this)); } else if(id == PACKET_DEORBIT && world.isRemote) { MinecraftForge.EVENT_BUS.post(new RocketEvent.RocketDeOrbitingEvent(this)); } }
Example #18
Source File: ClientProxy.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void registerHandlers(){ super.registerHandlers(); MinecraftForge.EVENT_BUS.register(new ClientEventHandler()); FMLCommonHandler.instance().bus().register(new ClientEventHandler()); MinecraftForge.EVENT_BUS.register(HUDHandler.instance()); FMLCommonHandler.instance().bus().register(HUDHandler.instance()); FMLCommonHandler.instance().bus().register(ClientTickHandler.instance()); FMLCommonHandler.instance().bus().register(getHackTickHandler()); FMLCommonHandler.instance().bus().register(clientHudHandler = new CommonHUDHandler()); MinecraftForge.EVENT_BUS.register(new ClientSemiBlockManager()); MinecraftForge.EVENT_BUS.register(HUDHandler.instance().getSpecificRenderer(CoordTrackUpgradeHandler.class)); MinecraftForge.EVENT_BUS.register(AreaShowManager.getInstance()); FMLCommonHandler.instance().bus().register(AreaShowManager.getInstance()); FMLCommonHandler.instance().bus().register(KeyHandler.getInstance()); ThirdPartyManager.instance().clientSide(); /* if(Config.enableUpdateChecker) { UpdateChecker.instance().start(); FMLCommonHandler.instance().bus().register(UpdateChecker.instance()); }*/ EntityTrackHandler.registerDefaultEntries(); getAllKeybindsFromOptionsFile(); new IGWSupportNotifier(); }
Example #19
Source File: RewardForCollectingItemImplementation.java From malmo with MIT License | 5 votes |
@Override public void prepare(MissionInit missionInit) { super.prepare(missionInit); MinecraftForge.EVENT_BUS.register(this); MalmoMod.MalmoMessageHandler.registerForMessage(this, MalmoMessageType.SERVER_COLLECTITEM); }
Example #20
Source File: ToolTip.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
@Override protected void doInit(InitPhase phase, ContentHelper helper) { stack = item.getItemStack(); MinecraftForge.EVENT_BUS.register(this); }
Example #21
Source File: GuiWiki.java From IGW-mod with GNU General Public License v2.0 | 5 votes |
public void setCurrentFile(ItemStack stack){ String defaultName = WikiRegistry.getPageForItemStack(stack); if(defaultName == null) defaultName = stack.getUnlocalizedName().replace("tile.", "block/").replace("item.", "item/"); ItemWikiEvent wikiEvent = new ItemWikiEvent(stack, defaultName); MinecraftForge.EVENT_BUS.post(wikiEvent); if(stack != null) { stack = stack.copy(); // stack.stackSize = 1; stack.setCount(1); } setCurrentFile(wikiEvent.pageOpened, stack); }
Example #22
Source File: GTProxyClient.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void init(FMLInitializationEvent e) { super.init(e); registerTintedBlocks(); registerTintedItems(); MinecraftForge.EVENT_BUS.register(this); this.onRegisterRender(); }
Example #23
Source File: RewardForPossessingItemImplementation.java From malmo with MIT License | 5 votes |
@Override public void prepare(MissionInit missionInit) { super.prepare(missionInit); MinecraftForge.EVENT_BUS.register(this); possessedItems = new HashMap<String, Integer>(); maxPossessedItems = new HashMap<String, Integer>(); }
Example #24
Source File: PlayerSpecials.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
private PlayerSpecials() { RenderHolstered backChisel = new RenderHolstered(new ItemStack(ChiselItems.obsidianChisel)); RenderTranslucent translucent = new RenderTranslucent(); renderMap.putAll(UUID.fromString("a7529984-8cb2-4fb9-b799-97980f770101"), Lists.newArrayList(backChisel, translucent)); // Cricket renderMap.putAll(UUID.fromString("a1d2532b-ee11-4ca3-b4c5-76e168d4c98e"), Lists.newArrayList(backChisel, translucent)); // TheCricket26 renderMap.putAll(UUID.fromString("5399b615-3440-4c66-939d-ab1375952ac3"), Lists.newArrayList(backChisel, translucent)); // Drullkus renderMap.put(UUID.fromString("671516b1-4fb3-4c03-aa7c-9c88cfab3ae8"), new RenderHolstered(new ItemStack(ChiselItems.diamondChisel))); // tterrag renderMap.put(UUID.fromString("ad18f501-08fa-4e7e-b324-86750009106e"), new RenderHolstered(new ItemStack(ChiselItems.chisel)));//minecreatr MinecraftForge.EVENT_BUS.register(this); }
Example #25
Source File: EnderZoo.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@EventHandler public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new RegistryHandler()); itemForCreativeMenuIcon = ItemForCreativeMenuIcon.create(); Config.load(event); itemWitheringDust = ItemWitheringDust.create(); itemConfusingDust = ItemConfusingDust.create(); itemEnderFragment = ItemEnderFragment.create(); itemGuardiansBow = ItemGuardiansBow.create(); itemOwlEgg = ItemOwlEgg.create(); if (Config.confusingChargeEnabled) { blockConfusingCharge = BlockConfusingCharge.create(); } if (Config.enderChargeEnabled) { blockEnderCharge = BlockEnderCharge.create(); } if (Config.concussionChargeEnabled) { blockConcussionCharge = BlockConcussionCharge.create(); } potions = new Potions(); FMLInterModComms.sendMessage("waila", "register", "crazypants.enderzoo.waila.WailaCompat.load"); proxy.preInit(); }
Example #26
Source File: GuiAnvil.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { if (clickedMouseButton == 0) { for (int l = 0; l < this.buttonList.size(); ++l) { GuiButton guibutton = (GuiButton)this.buttonList.get(l); if (guibutton.mousePressed(this.mc, mouseX, mouseY)) { ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(this, guibutton, this.buttonList); if (MinecraftForge.EVENT_BUS.post(event)) break; if(selectedButton == event.getButton()) continue; else { this.mouseReleased(mouseX, mouseY, 0); } this.selectedButton = event.getButton(); event.getButton().playPressSound(this.mc.getSoundHandler()); this.actionPerformed(event.getButton()); if (this.equals(this.mc.currentScreen)) MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.getButton(), this.buttonList)); } } } }
Example #27
Source File: MixinThreadedAnvilChunkStorage.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
@Inject(method = "sendWatchPackets", at = @At("HEAD")) private void fireWatchEvents(ServerPlayerEntity player, ChunkPos pos, Packet<?>[] packets, boolean withinMaxWatchDistance, boolean withinViewDistance, CallbackInfo callback) { if (withinViewDistance && !withinMaxWatchDistance) { ChunkWatchEvent.Watch event = new ChunkWatchEvent.Watch(player, pos, world); MinecraftForge.EVENT_BUS.post(event); } }
Example #28
Source File: VanillaAnvilLogic.java From OpenModsLib with MIT License | 5 votes |
private boolean onAnvilChange(@Nonnull ItemStack inputItem, @Nonnull ItemStack modifierItem, String itemName, int baseCost) { AnvilUpdateEvent e = new AnvilUpdateEvent(inputItem, modifierItem, itemName, baseCost); if (MinecraftForge.EVENT_BUS.post(e)) return false; if (!e.getOutput().isEmpty()) { this.outputStack = e.getOutput(); this.maximumCost = e.getCost(); this.materialCost = e.getMaterialCost(); return false; } return true; }
Example #29
Source File: ClientProxy.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void postInitalize() { IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); if(manager instanceof SimpleReloadableResourceManager) { SimpleReloadableResourceManager rm = (SimpleReloadableResourceManager) manager; rm.registerReloadListener(ResourceReloadListener.getInstance()); } MinecraftForge.EVENT_BUS.register(EffectHandler.getInstance()); MinecraftForge.EVENT_BUS.register(new RenderEventHandler()); FMLCommonHandler.instance().bus().register(new ClientHandler()); super.postInitalize(); }
Example #30
Source File: ServerHandler.java From NotEnoughItems with MIT License | 5 votes |
public static void init() { instance = new ServerHandler(); PacketCustom.assignHandler(NEICPH.channel, new NEISPH()); FMLCommonHandler.instance().bus().register(instance); MinecraftForge.EVENT_BUS.register(instance); Item.getItemFromBlock(Blocks.mob_spawner).setHasSubtypes(true); NEIActions.init(); }