public void keyDown( EnumSet< TickType > types, KeyBinding kb, boolean tickEnd, boolean isRepeat ) { if ( tickEnd ) { return; } if ( kb.keyDescription.equals( ToggleSpawners.toggleKey.keyDescription ) ) { ToggleSpawners.spawnersActive = !ToggleSpawners.spawnersActive; } else if ( kb.keyDescription.equals( ToggleSpawners.renderKey.keyDescription ) ) { ToggleSpawners.shouldRender = !ToggleSpawners.shouldRender; } }
@Override public void keyDown(EnumSet<TickType> type, KeyBinding kb, boolean end, boolean repeats) { if (!end) { return; } int idx = helper.indexOf(kb); if (type.contains(TickType.CLIENT)) { armed[idx] = true; } if (armed[idx] && type.contains(TickType.RENDER) && (!active[idx] || mlRepeats[idx])) { fireKeyEvent(kb); active[idx] = true; armed[idx] = false; } }
private void keyTick(EnumSet<TickType> type, boolean tickEnd) { for (int i = 0; i < keyBindings.length; i++) { KeyBinding keyBinding = keyBindings[i]; int keyCode = keyBinding.field_74512_d; boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode)); if (state != keyDown[i] || (state && repeatings[i])) { if (state) { keyDown(type, keyBinding, tickEnd, state!=keyDown[i]); } else { keyUp(type, keyBinding, tickEnd); } if (tickEnd) { keyDown[i] = state; } } } }
@Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { if (!type.contains(TickType.PLAYER)) return; EntityLivingBase user = (EntityLivingBase) tickData[0]; if (cfg.burnPlayer && user != null && user.ticksExisted % 20 == 0) { if(user instanceof EntityPlayer) { burnInv((EntityPlayer)user); } else if(isHotItem(user.getHeldItem())) { user.attackEntityFrom(DamageSource.inFire, 1); user.playSound("random.fizz", 1.0F, 1.0F); } } }
@Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if(type.equals(EnumSet.of(TickType.RENDER))){ ShoulderRenderBin.skipPlayerRender = false; //attempt to ray trace RayTracer.traceFromEyes(1.0F); if(ShoulderRenderBin.rayTraceHit != null){ if(ShoulderSurfing.mc.thePlayer != null){ //calculate the difference ShoulderRenderBin.rayTraceHit.xCoord -= ShoulderSurfing.mc.thePlayer.posX; ShoulderRenderBin.rayTraceHit.yCoord -= ShoulderSurfing.mc.thePlayer.posY; ShoulderRenderBin.rayTraceHit.zCoord -= ShoulderSurfing.mc.thePlayer.posZ; } } } }
@Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { /* minecraft ought to be running and with no gui up */ if(ShoulderSurfing.mc != null && ShoulderSurfing.mc.currentScreen == null){ if (ShoulderSurfing.mc.gameSettings.thirdPersonView == 1){ if(kb == ShoulderKeybindings.KEYBIND_ROTATE_CAMERA_LEFT){ ShoulderCamera.adjustCameraLeft(); } else if(kb == ShoulderKeybindings.KEYBIND_ROTATE_CAMERA_RIGHT){ ShoulderCamera.adjustCameraRight(); } else if(kb == ShoulderKeybindings.KEYBIND_ZOOM_CAMERA_IN){ ShoulderCamera.adjustCameraIn(); } else if(kb == ShoulderKeybindings.KEYBIND_ZOOM_CAMERA_OUT){ ShoulderCamera.adjustCameraOut(); } ShoulderSurfing.writeConfig(); } } }
@Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if(type.equals(EnumSet.of(TickType.RENDER))){ //attempt to ray trace RayTraceHelper.traceFromEyes(1.0F); if(ShoulderHelper.rayTraceHit != null){ if(ShoulderSurfing.mc.thePlayer != null){ ShoulderHelper.rayTraceHit.xCoord -= ShoulderSurfing.mc.thePlayer.posX; ShoulderHelper.rayTraceHit.yCoord -= ShoulderSurfing.mc.thePlayer.posY; ShoulderHelper.rayTraceHit.zCoord -= ShoulderSurfing.mc.thePlayer.posZ; } } } }
private void sendTick(EnumSet<TickType> types, boolean end, Object... tickData) { for (TickType type : types) { if (!ticks.contains(type)) { continue; } boolean keepTicking=true; if (sendGuiTicks) { keepTicking = mod.doTickInGUI(type, end, tickData); } else { keepTicking = mod.doTickInGame(type, end, tickData); } if (!keepTicking) { ticks.remove(type); ticks.removeAll(type.partnerTicks()); } } }
@Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if(type.equals(EnumSet.of(TickType.RENDER))){ ShoulderRenderBin.skipPlayerRender = false; //attempt to ray trace RayTracer.traceFromEyes(1.0F); if(ShoulderRenderBin.rayTraceHit != null){ if(ShoulderLoader.mc.thePlayer != null){ //calculate the difference ShoulderRenderBin.rayTraceHit.xCoord -= ShoulderLoader.mc.thePlayer.posX; ShoulderRenderBin.rayTraceHit.yCoord -= ShoulderLoader.mc.thePlayer.posY; ShoulderRenderBin.rayTraceHit.zCoord -= ShoulderLoader.mc.thePlayer.posZ; } } } }
@Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { /* minecraft ought to be running and with no gui up */ if(ShoulderLoader.mc != null && ShoulderLoader.mc.currentScreen == null){ if (ShoulderLoader.mc.gameSettings.thirdPersonView == 1){ if(kb == ShoulderKeybindings.KEYBIND_ROTATE_CAMERA_LEFT){ ShoulderCamera.adjustCameraLeft(); } else if(kb == ShoulderKeybindings.KEYBIND_ROTATE_CAMERA_RIGHT){ ShoulderCamera.adjustCameraRight(); } else if(kb == ShoulderKeybindings.KEYBIND_ZOOM_CAMERA_IN){ ShoulderCamera.adjustCameraIn(); } else if(kb == ShoulderKeybindings.KEYBIND_ZOOM_CAMERA_OUT){ ShoulderCamera.adjustCameraOut(); } ShoulderSurfing.writeConfig(); } } }
@Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { if (ShoulderSurfing.mc.gameSettings.thirdPersonView == 1 ){ if(kb == ShoulderKeybindings.KEYBIND_ROTATE_CAMERA_LEFT){ ShoulderHelper.adjustCameraLeft(); } else if(kb == ShoulderKeybindings.KEYBIND_ROTATE_CAMERA_RIGHT){ ShoulderHelper.adjustCameraRight(); } else if(kb == ShoulderKeybindings.KEYBIND_ZOOM_CAMERA_IN){ ShoulderHelper.adjustCameraIn(); } else if(kb == ShoulderKeybindings.KEYBIND_ZOOM_CAMERA_OUT){ ShoulderHelper.adjustCameraOut(); } ShoulderSurfing.writeConfig(); } }
@Override public void tickStart(EnumSet<TickType> type, Object... tickData) { long tick = System.nanoTime(); //If one second has passed if (tick - lastTick > 1000000000) { lastTick = lastTick + 1000000000; secondsRemaining--; if (secondsRemaining == 0) { event.countdownOver(); tickType = EnumSet.noneOf(TickType.class); } if (notifications.containsKey(secondsRemaining)) { Chat.sendToAllPlayers(notifications.get(secondsRemaining)); } } }
private void keyTick(EnumSet<TickType> type, boolean tickEnd) { for (int i = 0; i < keyBindings.length; i++) { KeyBinding keyBinding = keyBindings[i]; int keyCode = keyBinding.keyCode; boolean state = (keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode)); if (state != keyDown[i] || (state && repeatings[i])) { if (state) { keyDown(type, keyBinding, tickEnd, state!=keyDown[i]); } else { keyUp(type, keyBinding, tickEnd); } if (tickEnd) { keyDown[i] = state; } } } }
@Override public void tickEnd( EnumSet< TickType > type, Object... tickData ) { Minecraft mc = FMLClientHandler.instance().getClient(); if ( mc.currentScreen == null && ToggleSpawners.shouldRenderText() ) { GL11.glColor3f( 1.f, 1.f, 1.f ); String str = "Spawners " + ( ToggleSpawners.areSpawnersActive() ? "Active" : "Inactive" ); mc.fontRenderer.drawStringWithShadow( str, 5, 5, 0xFFFFFFFF ); } }
@Override public void tickEnd( EnumSet< TickType > type, Object... tickData ) { EntityPlayer player = ( EntityPlayer ) tickData[ 0 ]; if ( player.worldObj.isRemote ) { return; } Long time = lastTickTimes.get( player ); if ( time == null ) { lastTickTimes.put( player, new Long( System.currentTimeMillis() ) ); time = lastTickTimes.get( player ); } Long curr = System.currentTimeMillis(); if ( Math.abs( time - curr ) >= 1000 ) { lastTickTimes.put( player, curr ); int resist = 1; InventoryPlayer inv = player.inventory; for ( ItemStack stack : inv.armorInventory ) { resist += checkItem( stack ) * 5; } if ( resist == 1 || rand.nextInt( resist ) == 0 ) { doToxicRain( player ); } } }
@Deprecated public final boolean doTickInGUI(TickType tick, boolean tickEnd, Object... data) { Minecraft mc = FMLClientHandler.instance().getClient(); boolean hasWorld = mc.field_71441_e != null; if (tickEnd && ( tick==TickType.RENDER || ( tick==TickType.CLIENT && hasWorld))) { return onTickInGUI((Float) data[0], mc, mc.field_71462_r); } return true; }
@Override public EnumSet<TickType> ticks() { /** * Allows keybind events to be listened by the client */ return EnumSet.of(TickType.CLIENT); }
@Subscribe public void constructMod(FMLConstructionEvent event) { try { ModClassLoader modClassLoader = event.getModClassLoader(); modClassLoader.addFile(modSource); EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class); this.gameTickHandler = new BaseModTicker(ticks, false); this.guiTickHandler = new BaseModTicker(ticks.clone(), true); Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName); configureMod(modClazz, event.getASMHarvestedData()); isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData()); ModLoaderNetworkHandler dummyHandler = null; if (!isNetworkMod) { FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId()); dummyHandler = new ModLoaderNetworkHandler(this); FMLNetworkHandler.instance().registerNetworkMod(dummyHandler); } Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor(); ctor.setAccessible(true); mod = modClazz.newInstance(); if (dummyHandler != null) { dummyHandler.setBaseMod(mod); } ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), new ILanguageAdapter.JavaAdapter()); } catch (Exception e) { controller.errorOccurred(this, e); Throwables.propagateIfPossible(e); } }
public static void updateGUITicks(BaseModProxy mod, boolean enable, boolean useClock) { ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().getReversedModObjectList().get(mod); if (mlmc==null) { mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer(); } if (mlmc == null) { FMLLog.severe("Attempted to register ModLoader ticking for invalid BaseMod %s",mod); return; } EnumSet<TickType> ticks = mlmc.getGUITickHandler().ticks(); // If we're enabled and we don't want clock ticks we get render ticks if (enable && !useClock) { ticks.add(TickType.RENDER); } else { ticks.remove(TickType.RENDER); } // If we're enabled but we want clock ticks, or we're server side we get world ticks if (enable && useClock) { ticks.add(TickType.CLIENT); ticks.add(TickType.WORLDLOAD); } else { ticks.remove(TickType.CLIENT); ticks.remove(TickType.WORLDLOAD); } }
@Deprecated public final boolean doTickInGUI(TickType tick, boolean tickEnd, Object... data) { Minecraft mc = FMLClientHandler.instance().getClient(); boolean hasWorld = mc.theWorld != null; if (tickEnd && ( tick==TickType.RENDER || ( tick==TickType.CLIENT && hasWorld))) { return onTickInGUI((Float) data[0], mc, mc.currentScreen); } return true; }
public static void updateStandardTicks(BaseModProxy mod, boolean enable, boolean useClock) { ModLoaderModContainer mlmc = (ModLoaderModContainer) Loader.instance().getReversedModObjectList().get(mod); if (mlmc==null) { mlmc = (ModLoaderModContainer) Loader.instance().activeModContainer(); } if (mlmc == null) { FMLLog.severe("Attempted to register ModLoader ticking for invalid BaseMod %s",mod); return; } BaseModTicker ticker = mlmc.getGameTickHandler(); EnumSet<TickType> ticks = ticker.ticks(); // If we're enabled we get render ticks if (enable && !useClock) { ticks.add(TickType.RENDER); } else { ticks.remove(TickType.RENDER); } // If we're enabled but we want clock ticks, or we're server side we get game ticks if (enable && (useClock || FMLCommonHandler.instance().getSide().isServer())) { ticks.add(TickType.CLIENT); ticks.add(TickType.WORLDLOAD); } else { ticks.remove(TickType.CLIENT); ticks.remove(TickType.WORLDLOAD); } }
@Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { if (type.equals(EnumSet.of(TickType.SERVER))) { numTicks++; if (numTicks >= 20) { numTicks = 0; List<EntityPlayer> pl = MinecraftServer.getServerConfigurationManager(MinecraftServer.getServer()).playerEntityList; } } }
@Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if (mc.thePlayer == null) { return; } ridingDragon = mc.thePlayer.ridingEntity instanceof EntityJakanPrime; // display a key binding notice after the vanilla notice if (ridingDragon && !ridingDragonPrev) { tpca.setThirdPersonDistance(6); noticeTicks = 70; } else if (!ridingDragon && ridingDragonPrev) { tpca.resetThirdPersonDistance(); noticeTicks = 0; } else { if (noticeTicks > 0) { noticeTicks--; } if (noticeTicks == 1) { String keyUpName = GameSettings.getKeyDisplayString(DragonKeyHandler.KEY_FLY_UP.keyCode); String keyDownName = GameSettings.getKeyDisplayString(DragonKeyHandler.KEY_FLY_DOWN.keyCode); mc.ingameGUI.func_110326_a(I18n.getStringParams("dragon.mountNotice", new Object[] {keyUpName, keyDownName}), false); } } ridingDragonPrev = ridingDragon; }
@Deprecated public final boolean doTickInGame(TickType tick, boolean tickEnd, Object... data) { Minecraft mc = FMLClientHandler.instance().getClient(); boolean hasWorld = mc.theWorld != null; // World and render ticks if (tickEnd && ( tick==TickType.RENDER || tick==TickType.CLIENT ) && hasWorld) { return onTickInGame((Float) data[0], mc); } return true; }
@Override public void keyUp(EnumSet<TickType> type, KeyBinding kb, boolean end) { if (!end) { return; } int idx = helper.indexOf(kb); active[idx] = false; }
@Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { tick++; if (tick > 400) tick = 0; }
@Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { if(type.equals(EnumSet.of(TickType.SERVER))) { onTickInGame(); } }
@Override public void tickStart( EnumSet< TickType > type, Object... tickData ) { }
@Override public EnumSet< TickType > ticks() { return EnumSet.of( TickType.RENDER ); }
public void keyUp( EnumSet< TickType > types, KeyBinding kb, boolean tickEnd ) { }
public EnumSet< TickType > ticks() { return EnumSet.of( TickType.CLIENT ); }