コード例 #1
0
 @Override
 public CategoryConfigManagerBuilder getConfig() {
   return new CategoryConfigManagerBuilder("Other")
       .addValue(
           "enableAnimalAITweak",
           "true",
           Type.BOOLEAN,
           "Enable changing the animals AI to make them run from their attackers.",
           property -> {
             if (property.getBoolean()) {
               if (aiManager == null) {
                 aiManager = new AITweaksManager();
                 MinecraftForge.EVENT_BUS.register(aiManager);
               }
             } else {
               if (aiManager != null) {
                 MinecraftForge.EVENT_BUS.unregister(aiManager);
                 aiManager = null;
               }
             }
           })
       .addValue(
           "enableNonSolidLeaves",
           "true",
           Type.BOOLEAN,
           "Enable tweak to make leaves blocks non-solid (like vines).",
           property -> {
             Hea3venTweaks.setConfig(
                 "NonSolidLeaves.enabled", Boolean.toString(property.getBoolean()));
           },
           true,
           true);
 }
コード例 #2
0
ファイル: EventsHandler.java プロジェクト: Thutmose/Pokecube
 @SubscribeEvent
 public void onPlayerTick(TickEvent.PlayerTickEvent event) {
   if (event.player == player) {
     for (EntityPlayer player1 : player.worldObj.playerEntities) {
       boolean pokemob;
       PokeInfo info = proxy.getMap().get(player.getUniqueID());
       if (info == null) {
         proxy.getPokemob(player);
         info = proxy.getMap().get(player.getUniqueID());
         pokemob = info != null;
         pokemob = pokemob && player.getEntityData().getBoolean("isPokemob");
       } else {
         pokemob = player.getEntityData().getBoolean("isPokemob");
       }
       PacketBuffer buffer = new PacketBuffer(Unpooled.buffer(6));
       MessageClient message = new MessageClient(buffer);
       buffer.writeByte(MessageClient.SETPOKE);
       buffer.writeInt(player1.getEntityId());
       buffer.writeBoolean(pokemob);
       if (pokemob) {
         buffer.writeFloat(info.originalHeight);
         buffer.writeFloat(info.originalWidth);
         buffer.writeNBTTagCompoundToBuffer(player1.getEntityData().getCompoundTag("Pokemob"));
       }
       PokecubeMod.packetPipeline.sendTo(message, (EntityPlayerMP) player);
       MinecraftForge.EVENT_BUS.unregister(this);
     }
   }
 }
コード例 #3
0
  private void stopMapManager() {
    if (manager != null) {
      manager.stop();
      MinecraftForge.EVENT_BUS.unregister(manager);
      FMLCommonHandler.instance().bus().unregister(manager);
    }

    if (managerThread != null) {
      managerThread.interrupt();
    }

    managerThread = null;
    manager = null;
  }
コード例 #4
0
 private void finish() {
   // goodbye cruel world
   MinecraftForge.EVENT_BUS.unregister(this);
 }