示例#1
0
 @Override
 protected void actionPerformed(GuiButton guibutton) {
   if (world.isRemote) {
     if (guibutton.id == 0) {
       ModLoader.getMinecraftInstance()
           .thePlayer
           .sendChatMessage("/time add " + (TFC_Time.dayLength / 24));
     } else if (guibutton.id == 1) {
       ModLoader.getMinecraftInstance()
           .thePlayer
           .sendChatMessage("/time add " + (TFC_Time.dayLength));
     } else if (guibutton.id == 2) {
       ModLoader.getMinecraftInstance()
           .thePlayer
           .sendChatMessage("/time add " + (TFC_Time.dayLength * 7));
     } else if (guibutton.id == 3) {
       ModLoader.getMinecraftInstance()
           .thePlayer
           .sendChatMessage("/time add " + (TFC_Time.dayLength * TFC_Time.daysInMonth));
     } else if (guibutton.id == 4) {
       ModLoader.getMinecraftInstance()
           .thePlayer
           .sendChatMessage("/time add " + (TFC_Time.dayLength * TFC_Time.daysInYear));
     }
   }
 }
示例#2
0
 private static void handleTileEntityPacket(Packet230ModLoader packet230modloader) {
   if (packet230modloader.dataInt == null || packet230modloader.dataInt.length < 5) {
     log("Bad TileEntityPacket received.");
   } else {
     int i = packet230modloader.dataInt[0];
     int j = packet230modloader.dataInt[1];
     int k = packet230modloader.dataInt[2];
     int l = packet230modloader.dataInt[3];
     int i1 = packet230modloader.dataInt[4];
     int ai[] = new int[packet230modloader.dataInt.length - 5];
     System.arraycopy(packet230modloader.dataInt, 5, ai, 0, packet230modloader.dataInt.length - 5);
     float af[] = packet230modloader.dataFloat;
     String as[] = packet230modloader.dataString;
     for (int j1 = 0; j1 < ModLoader.getLoadedMods().size(); j1++) {
       BaseMod basemod = (BaseMod) ModLoader.getLoadedMods().get(j1);
       if (!(basemod instanceof BaseModMp)) {
         continue;
       }
       BaseModMp basemodmp = (BaseModMp) basemod;
       if (basemodmp.getId() != i) {
         continue;
       }
       basemodmp.handleTileEntityPacket(j, k, l, i1, ai, af, as);
       break;
     }
   }
 }
示例#3
0
 public mod_Aether() {
   cloudPara = false;
   rand = new Random();
   zLevel = -90F;
   // key_loreGain = new KeyBinding("key.loreGain", 48);
   dim = new DimensionAether();
   BiomeGenAether biomegenaether = new BiomeGenAether();
   try {
     ModLoader.setPrivateValue(
         net.minecraft.src.BiomeGenBase.class, biomegenaether, "w", Boolean.valueOf(false));
   } catch (Exception exception) {
     System.out.println("Forgot to update reflection. Trying MCP name for disabling rain.");
     try {
       ModLoader.setPrivateValue(
           net.minecraft.src.BiomeGenBase.class,
           biomegenaether,
           "enableRain",
           Boolean.valueOf(false));
     } catch (Exception exception1) {
     }
   }
   new AetherBlocks();
   new AetherItems();
   new AetherMobs();
   new AetherPoison();
   new AetherAchievements();
   new AetherRecipes();
   // ModLoader.RegisterKey(this, key_loreGain, false);
   ModLoader.SetInGameHook(this, true, false);
   //    SAPI.interceptAdd(this);
   PlayerAPI.RegisterPlayerBase(net.minecraft.src.PlayerBaseAether.class);
 }
示例#4
0
 private static void sendPacket(Packet230ModLoader packet230modloader) {
   if (packet230Received
       && ModLoader.getMinecraftInstance().field_71441_e != null
       && ModLoader.getMinecraftInstance().field_71441_e.field_72995_K) {
     ModLoader.getMinecraftInstance().func_71391_r().func_72552_c(packet230modloader);
   }
 }
 public int getId() {
   int id = ModLoader.getUniqueEntityId();
   boolean isUsed = false;
   do {
     isUsed = false;
     for (ComputerBox c : storageBoxes) {
       for (NBTTagCompound nbt : c.getStoredPokemon()) {
         if (nbt != null) {
           if (nbt.getInteger("pixelmonID") == id) {
             id = ModLoader.getUniqueEntityId();
             isUsed = true;
           }
         }
       }
     }
     for (ComputerBox c : storageBoxes) {
       for (int i = 0; i < ComputerBox.boxLimit; i++) {
         if (c.getStoredPokemon()[i] != null) {
           if (c.getStoredPokemon()[i].getInteger("pixelmonID") == id) {
             id = ModLoader.getUniqueEntityId();
             isUsed = true;
           }
         }
       }
     }
   } while (isUsed);
   return id;
 }
示例#6
0
 @Override
 public void onPlayerLogin(EntityPlayer player) {
   if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
     if (SimpleModsConfiguration.server.isDedicatedServer()) {
       if (!Permissions.playerData.getCompoundTag(player.username).hasKey("Rank")) {
         NBTTagCompound data = new NBTTagCompound();
         data.setString("Rank", Permissions.defaultRank);
         Permissions.playerData.setCompoundTag(player.username, data);
         player.addChatMessage(
             SimpleModsTranslation.welcomeMessageCoreDefaultRank.replaceAll(
                 "%d", Permissions.defaultRank));
         player.addChatMessage(SimpleModsTranslation.welcomeMessageCore);
         if (Permissions.rankData.getCompoundTag(Permissions.getRank(player)).hasKey("Spawn")) {
           data =
               Permissions.rankData
                   .getCompoundTag(Permissions.getRank(player))
                   .getCompoundTag("Spawn");
           Double X = data.getDouble("X");
           Double Y = data.getDouble("Y");
           Double Z = data.getDouble("Z");
           Float yaw = data.getFloat("yaw");
           Float pitch = data.getFloat("pitch");
           Integer dim = data.getInteger("Dim");
           if (player.dimension != dim)
             ModLoader.getMinecraftServerInstance()
                 .getConfigurationManager()
                 .transferPlayerToDimension(((EntityPlayerMP) player), dim);
           ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(X, Y, Z, yaw, pitch);
           player.sendChatToPlayer("Welcome to " + data.getString("name"));
         }
       }
     } else {
       if (!Permissions.playerData.getCompoundTag(player.username).hasKey("Rank")) {
         NBTTagCompound data = new NBTTagCompound();
         data.setString("Rank", Permissions.opRank);
         Permissions.playerData.setCompoundTag(player.username, data);
         if (Permissions.rankData.getCompoundTag(Permissions.getRank(player)).hasKey("Spawn")) {
           data =
               Permissions.rankData
                   .getCompoundTag(Permissions.getRank(player))
                   .getCompoundTag("Spawn");
           Double X = data.getDouble("X");
           Double Y = data.getDouble("Y");
           Double Z = data.getDouble("Z");
           Float yaw = data.getFloat("yaw");
           Float pitch = data.getFloat("pitch");
           Integer dim = data.getInteger("Dim");
           if (player.dimension != dim)
             ModLoader.getMinecraftServerInstance()
                 .getConfigurationManager()
                 .transferPlayerToDimension(((EntityPlayerMP) player), dim);
           ((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(X, Y, Z, yaw, pitch);
           player.sendChatToPlayer("Welcome to " + data.getString("name"));
         }
       }
     }
   }
 }
 @Override
 public void load() {
   if (allowUpdateCheck) {
     versionChecker =
         new ModVersionChecker(
             getName(), getVersion(), versionURL, mcfTopic, ModLoader.getLogger());
     versionChecker.checkVersionWithLoggingBySubStringAsFloat(1, 4);
     ModLoader.setInGameHook(this, true, true);
   }
 }
示例#8
0
 public static void syncCurrentItemNBT(World world, EntityPlayer player) {
   if (!world.isRemote) {
     ModLoader.serverSendPacket(
         ((EntityPlayerMP) player).playerNetServerHandler,
         PacketHandler.createSyncItemNBTPacket(player, player.inventory.currentItem));
   } else {
     ModLoader.clientSendPacket(
         PacketHandler.createSyncItemNBTPacket(player, player.inventory.currentItem));
   }
 }
示例#9
0
  private static void handleModCheck(Packet230ModLoader packet230modloader) {
    Packet230ModLoader packet230modloader1 = new Packet230ModLoader();
    packet230modloader1.modId = "ModLoaderMP".hashCode();
    packet230modloader1.packetType = 0;
    packet230modloader1.dataString = new String[ModLoader.getLoadedMods().size()];
    for (int i = 0; i < ModLoader.getLoadedMods().size(); i++) {
      packet230modloader1.dataString[i] = ((BaseMod) ModLoader.getLoadedMods().get(i)).toString();
    }

    sendPacket(packet230modloader1);
  }
示例#10
0
 public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) {
   int metadata = world.getBlockMetadata(i, j, k);
   if (metadata == 2)
     ModLoader.openGUI(
         entityplayer, new GuiVehicleCrafting(entityplayer.inventory, world, i, j, k));
   else
     ModLoader.openGUI(
         entityplayer,
         new GuiPlaneCrafting(entityplayer.inventory, world, i, j, k, metadata == 1));
   return true;
 }
  @Override
  public void keyUp(EnumSet<TickType> types, KeyBinding key, boolean tickEnd) {
    Map<String, Bender> bendersMap = mod_Avatar.proxy.getBendersMap();
    String username = ModLoader.getMinecraftInstance().thePlayer.username;

    if (!tickEnd
        && ModLoader.getMinecraftInstance().thePlayer != null
        && bendersMap.containsKey(username)) {
      // Pass the key off to to the bender.
      bendersMap.get(username).keyUp(key);
    }
  }
示例#12
0
  /** registers all entities and tile entities */
  public static void registerAllEntities() {
    // EntityRegistry.registerModEntity(EntityNitroGlycerin.class, "nitroGlycerin", 1,
    // MTCore.instance, 80, 3, false);
    // EntityRegistry.registerModEntity(EntityStickyTorch.class, "stickyTorch", 2, MTCore.instance,
    // 80, 3, false);
    ModLoader.registerEntityID(EntityNitroGlycerin.class, "nitroGlycerin", 300);
    ModLoader.registerEntityID(EntityStickyTorch.class, "stickyTorch", 301);

    GameRegistry.registerTileEntity(TileEntityBioCarbonizer.class, "bioCarbonizer");
    GameRegistry.registerTileEntity(TileEntityBlast.class, "blast");
    GameRegistry.registerTileEntity(TileEntityIncinerator.class, "incinerator");
  }
示例#13
0
 public static void handleGUI(Packet100OpenWindow packet100openwindow) {
   if (!hasInit) {
     initializePrivate();
   }
   BaseModMp basemodmp =
       (BaseModMp) guiModMap.get(Integer.valueOf(packet100openwindow.field_73429_b));
   GuiScreen guiscreen = basemodmp.handleGUI(packet100openwindow.field_73429_b);
   if (guiscreen != null) {
     ModLoader.openGUI(ModLoader.getMinecraftInstance().field_71439_g, guiscreen);
     ModLoader.getMinecraftInstance().field_71439_g.field_71070_bA.field_75152_c =
         packet100openwindow.field_73431_a;
   }
 }
示例#14
0
 public static void sendPacket(BaseModMp basemodmp, Packet230ModLoader packet230modloader) {
   if (!hasInit) {
     initializePrivate();
   }
   if (basemodmp == null) {
     IllegalArgumentException illegalargumentexception =
         new IllegalArgumentException("baseModMp cannot be null.");
     ModLoader.getLogger().throwing("ModLoaderMp", "SendPacket", illegalargumentexception);
     ModLoader.throwException("baseModMp cannot be null.", illegalargumentexception);
   } else {
     packet230modloader.modId = basemodmp.getId();
     sendPacket(packet230modloader);
   }
 }
示例#15
0
 public void load() {
   ModLoader.addRecipe(
       new ItemStack(block, 1),
       new Object[] {
         "X1X",
         "X4X",
         "X4X",
         Character.valueOf('1'),
         new ItemStack(mod_obsidiams.block, 1),
         Character.valueOf('4'),
         new ItemStack(Item.blazeRod, 1),
       });
   ModLoader.addName(block, "Pelle en Obsidiams");
 }
示例#16
0
  public static BaseModMp getModInstance(Class class1) {
    for (int i = 0; i < ModLoader.getLoadedMods().size(); i++) {
      BaseMod basemod = (BaseMod) ModLoader.getLoadedMods().get(i);
      if (!(basemod instanceof BaseModMp)) {
        continue;
      }
      BaseModMp basemodmp = (BaseModMp) basemod;
      if (class1.isInstance(basemodmp)) {
        return (BaseModMp) ModLoader.getLoadedMods().get(i);
      }
    }

    return null;
  }
  public static void init() {

    /* Initialise each mod item individually */
    miniumShard =
        new ItemMiniumShard(ItemIds.MINIUM_SHARD).setIconCoord(0, 0).setItemName("miniumShard");
    miniumStone =
        new ItemMiniumStone(ItemIds.MINIUM_STONE).setIconCoord(1, 0).setItemName("miniumStone");
    philStone =
        new ItemPhilosopherStone(ItemIds.PHIL_STONE)
            .setIconCoord(2, 0)
            .setItemName("philosophersStone");

    ModLoader.addShapelessRecipe(new ItemStack(miniumStone), Block.dirt);
    ModLoader.addShapelessRecipe(new ItemStack(philStone), Block.dirt, Block.dirt);
  }
  public boolean interact(EntityPlayer entityplayer) {
    ItemStack itemstack = entityplayer.inventory.getCurrentItem();

    if (itemstack == null) {
      ItemStack shell = new ItemStack(mod_Fossil.Ancientegg, 1, EnumToInt(this.DinoInside));

      if (entityplayer.inventory.addItemStackToInventory(shell)) {
        ModLoader.onItemPickup(entityplayer, shell);
        worldObj.playSoundAtEntity(
            entityplayer,
            "random.pop",
            0.2F,
            ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        this.setDead();
      } else {
        return false;
      }

      return false;
    }

    if (FMLCommonHandler.instance().getSide().isClient()) {
      if (itemstack.getItem().itemID == mod_Fossil.DinoPedia.itemID) {
        this.showpedia(entityplayer);
        return true;
      }
    }

    return false;
  }
示例#19
0
 @ServerStarting
 public void serverStarting(FMLServerStartingEvent event) {
   MinecraftServer server = ModLoader.getMinecraftServerInstance();
   ICommandManager commandManager = server.getCommandManager();
   ServerCommandManager serverCommandManager = (ServerCommandManager) commandManager;
   serverCommandManager.registerCommand(new CommanduPerm());
 }
 private static EDVector3 getRelativeViewVector(EDVector3 pos) {
   EntityPlayer renderentity = ModLoader.getMinecraftInstance().thePlayer;
   return new EDVector3(
       (float) renderentity.posX - pos.x,
       (float) renderentity.posY - pos.y,
       (float) renderentity.posZ - pos.z);
 }
 public void muzzleFlash() {
   int X = (int) (posX + 0.5) - 1;
   int Y = (int) (posY + 0.0);
   int Z = (int) (posZ + 0.5) - 1;
   lastFlash = ModLoader.getMinecraftInstance().ticksRan + 5;
   if ((X != flashX || Y != flashY || Z != flashZ)) {
     if (worldObj.getBlockId(flashX, flashY, flashZ) == 136) {
       worldObj.scheduledUpdatesAreImmediate = true;
       worldObj.setBlock(flashX, flashY, flashZ, 0);
       worldObj.scheduledUpdatesAreImmediate = false;
     }
     if (worldObj.getBlockId(X, Y, Z) == 0) {
       worldObj.scheduledUpdatesAreImmediate = true;
       worldObj.setBlock(X, Y, Z, 136);
       worldObj.scheduledUpdatesAreImmediate = false;
       flashX = X;
       flashY = Y;
       flashZ = Z;
     }
   } else {
     if (worldObj.getBlockId(X, Y, Z) == 0) {
       worldObj.scheduledUpdatesAreImmediate = true;
       worldObj.setBlock(X, Y, Z, 136);
       worldObj.scheduledUpdatesAreImmediate = false;
       flashX = X;
       flashY = Y;
       flashZ = Z;
     }
   }
 }
  @Override
  public void modsLoaded() {
    super.modsLoaded();
    BuildCraftEnergy.initialize();

    ModLoader.registerTileEntity(TileEngine.class, "net.minecraft.src.buildcraft.energy.Engine");
  }
示例#23
0
  public InfiToolCore(
      int itemID,
      int damageBase,
      InfiMaterialEnum head,
      InfiMaterialEnum handle,
      String internalName) {
    super(itemID, damageBase, EnumToolMaterial.WOOD, null);

    this.toolHarvestLevel = head.getHarvestLevel();
    this.maxStackSize = 1;
    this.efficiencyOnProperMaterial = head.getSpeed();
    this.toolDamage = damageBase + head.getDamage();
    int durability = (int) (head.getDurability() * handle.getDurabilityBonus());
    setMaxDamage(durability);
    this.headType = head.getMaterialType();
    this.handleType = handle.getMaterialType();
    this.enchantibility = (head.getEnchantability() + handle.getEnchantability()) / 2;
    this.headUnbreaking = head.getUnbreakingLevel();
    this.handleUnbreaking = handle.getUnbreakingLevel();
    this.headShoddy = head.getShoddy();
    this.handleShoddy = handle.getShoddy();
    this.setIconIndex(handleType - 1);
    this.setItemName(internalName);
    if (headType != handleType) {
      ModLoader.addName(
          this, namePrefix[handleType - 1] + nameSuffix[headType - 1] + " " + getInvName());
    }
  }
  /** Called when the player picks up an item from an inventory slot */
  public void onPickupFromSlot(ItemStack par1ItemStack) {
    ModLoader.takenFromCrafting(this.thePlayer, par1ItemStack, this.craftMatrix);
    //        ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix); TODO

    this.func_48434_c(par1ItemStack);

    for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2) {
      ItemStack var3 = this.craftMatrix.getStackInSlot(var2);

      if (var3 != null) {
        this.craftMatrix.decrStackSize(var2, 1);

        if (var3.getItem().hasContainerItem()) {
          ItemStack var4 = new ItemStack(var3.getItem().getContainerItem());

          if (!var3.getItem().doesContainerItemLeaveCraftingGrid(var3)
              || !this.thePlayer.inventory.addItemStackToInventory(var4)) {
            if (this.craftMatrix.getStackInSlot(var2) == null) {
              this.craftMatrix.setInventorySlotContents(var2, var4);
            } else {
              this.thePlayer.dropPlayerItem(var4);
            }
          }
        }
      }
    }
  }
  public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload) {
    if ("MC|BEdit".equals(par1Packet250CustomPayload.channel)) {
      try {
        DataInputStream datainputstream =
            new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data));
        ItemStack itemstack = Packet.readItemStack(datainputstream);

        if (!ItemWritableBook.validBookTagPages(itemstack.getTagCompound())) {
          throw new IOException("Invalid book tag!");
        }

        ItemStack itemstack2 = playerEntity.inventory.getCurrentItem();

        if (itemstack != null
            && itemstack.itemID == Item.writableBook.shiftedIndex
            && itemstack.itemID == itemstack2.itemID) {
          itemstack2.setTagCompound(itemstack.getTagCompound());
        }
      } catch (Exception exception) {
        exception.printStackTrace();
      }
    } else if ("MC|BSign".equals(par1Packet250CustomPayload.channel)) {
      try {
        DataInputStream datainputstream1 =
            new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data));
        ItemStack itemstack1 = Packet.readItemStack(datainputstream1);

        if (!ItemEditableBook.validBookTagContents(itemstack1.getTagCompound())) {
          throw new IOException("Invalid book tag!");
        }

        ItemStack itemstack3 = playerEntity.inventory.getCurrentItem();

        if (itemstack1 != null
            && itemstack1.itemID == Item.writtenBook.shiftedIndex
            && itemstack3.itemID == Item.writableBook.shiftedIndex) {
          itemstack3.setTagCompound(itemstack1.getTagCompound());
          itemstack3.itemID = Item.writtenBook.shiftedIndex;
        }
      } catch (Exception exception1) {
        exception1.printStackTrace();
      }
    } else if ("MC|TrSel".equals(par1Packet250CustomPayload.channel)) {
      try {
        DataInputStream datainputstream2 =
            new DataInputStream(new ByteArrayInputStream(par1Packet250CustomPayload.data));
        int i = datainputstream2.readInt();
        Container container = playerEntity.craftingInventory;

        if (container instanceof ContainerMerchant) {
          ((ContainerMerchant) container).setCurrentRecipeIndex(i);
        }
      } catch (Exception exception2) {
        exception2.printStackTrace();
      }
    } else {
      ModLoader.serverCustomPayload(this, par1Packet250CustomPayload);
    }
  }
示例#26
0
  public static void tick() {
    if (ModLoader.getMinecraftServerInstance() == null) {
      possibleClose();
      return;
    }

    if (watchers.length != ModLoader.getMinecraftServerInstance().worldServers.length) {
      createNewWatchers();
      return;
    }

    watchers[index++].tick();

    if (index >= watchers.length) {
      index = 0;
    }
  }
 public static boolean launchGUI(EntityPlayer entityplayer, TileEntity tileentity) {
   ModLoader.openGUI(
       entityplayer,
       mod_IC2_ChargingBench.guiIdChargingBench,
       (IInventory) tileentity,
       ((TileEntityChargingBench) tileentity).getGuiContainer(entityplayer.inventory));
   return true;
 }
示例#28
0
 public static void sendKey(BaseModMp basemodmp, int i) {
   if (!hasInit) {
     initializePrivate();
   }
   if (basemodmp == null) {
     IllegalArgumentException illegalargumentexception =
         new IllegalArgumentException("baseModMp cannot be null.");
     ModLoader.getLogger().throwing("ModLoaderMp", "SendKey", illegalargumentexception);
     ModLoader.throwException("baseModMp cannot be null.", illegalargumentexception);
   } else {
     Packet230ModLoader packet230modloader = new Packet230ModLoader();
     packet230modloader.modId = "ModLoaderMP".hashCode();
     packet230modloader.packetType = 1;
     packet230modloader.dataInt = (new int[] {basemodmp.getId(), i});
     sendPacket(packet230modloader);
   }
 }
 public void decayFlash() {
   if (lastFlash < ModLoader.getMinecraftInstance().ticksRan && (lastFlash != -1)) {
     if (worldObj.getBlockId(flashX, flashY, flashZ) == 136) {
       worldObj.setBlock(flashX, flashY, flashZ, 0);
       lastFlash = -1;
     }
   }
 }
示例#30
0
  public void load() {

    ModLoader.registerBlock(AntarticaSnow);
    ModLoader.registerBlock(AntarticaIce);

    ModLoader.registerBlock(ForbiddenPortal);

    ModLoader.registerBlock(MysticalStone);
    ModLoader.addName(MysticalStone, "MysticalStone");

    ModLoader.addRecipe(
        new ItemStack(MysticalStone, 64), new Object[] {"ddd", Character.valueOf('d'), Block.dirt});
    ModLoader.addRecipe(
        new ItemStack(ForbiddenPortal, 64),
        new Object[] {
          "XXX",
          "ddd",
          "ZZZ",
          Character.valueOf('d'),
          Block.dirt,
          Character.valueOf('X'),
          Block.sand,
          Character.valueOf('Z'),
          Block.planks
        });
  }