本文整理汇总了Java中net.minecraftforge.common.ForgeVersion.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java ForgeVersion.getResult方法的具体用法?Java ForgeVersion.getResult怎么用?Java ForgeVersion.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.ForgeVersion
的用法示例。
在下文中一共展示了ForgeVersion.getResult方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initGui
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
@Override
public void initGui()
{
if (!hasCheckedForUpdates)
{
if (modButton != null)
{
for (ModContainer mod : Loader.instance().getModList())
{
Status status = ForgeVersion.getResult(mod).status;
if (status == Status.OUTDATED || status == Status.BETA_OUTDATED)
{
// TODO: Needs better visualization, maybe stacked icons
// drawn in a terrace-like pattern?
showNotification = Status.OUTDATED;
}
}
}
hasCheckedForUpdates = true;
}
}
示例2: firstRender
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
@SubscribeEvent
public void firstRender(RenderGameOverlayEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if (!mc.inGameHasFocus || mc.thePlayer == null) {
return;
}
if (!show) {
show = true;
for (ModContainer container : Loader.instance().getActiveModList()) {
if (!container.getModId().startsWith("mcp") && !container.getModId().equalsIgnoreCase("mcp") && !container.getModId().equalsIgnoreCase("FML") && !container.getModId().equalsIgnoreCase("Forge")) {
CheckResult res = ForgeVersion.getResult(container);
if ((res != null && res.status != Status.PENDING) && res.status == Status.BETA_OUTDATED || res.status == Status.OUTDATED) {
IChatComponent comp = new ChatComponentText("\u00a7eNew version (\u00a77" + res.target + "\u00a7e) for\u00a7a " + container.getName() + " \u00a7eis available for Minecraft " + ForgeVersion.mcVersion + "!\n\u00a7bDownload at: \u00a7a" + res.url);
ChatStyle style = comp.getChatStyle();
style.setColor(EnumChatFormatting.YELLOW);
style.setChatHoverEvent(new HoverEvent(net.minecraft.event.HoverEvent.Action.SHOW_TEXT, new ChatComponentText("\u00a7cClick to open download page.")));
style.setChatClickEvent(new ClickEvent(net.minecraft.event.ClickEvent.Action.OPEN_URL, res.url));
comp.setChatStyle(style);
mc.thePlayer.addChatComponentMessage(comp);
}
}
}
}
}
示例3: drawSlot
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
@Override
protected void drawSlot(int idx, int right, int top, int height, Tessellator tess)
{
ModContainer mc = mods.get(idx);
String name = StringUtils.stripControlCodes(mc.getName());
String version = StringUtils.stripControlCodes(mc.getDisplayVersion());
FontRenderer font = this.parent.getFontRenderer();
CheckResult vercheck = ForgeVersion.getResult(mc);
if (Loader.instance().getModState(mc) == ModState.DISABLED)
{
font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFF2222);
font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xFF2222);
font.drawString(font.trimStringToWidth("DISABLED", listWidth - 10), this.left + 3 , top + 22, 0xFF2222);
}
else
{
font.drawString(font.trimStringToWidth(name, listWidth - 10), this.left + 3 , top + 2, 0xFFFFFF);
font.drawString(font.trimStringToWidth(version, listWidth - (5 + height)), this.left + 3 , top + 12, 0xCCCCCC);
font.drawString(font.trimStringToWidth(mc.getMetadata() != null ? mc.getMetadata().getChildModCountString() : "Metadata not found", listWidth - 10), this.left + 3 , top + 22, 0xCCCCCC);
if (vercheck.status.shouldDraw())
{
//TODO: Consider adding more icons for visualization
Minecraft.getMinecraft().getTextureManager().bindTexture(VERSION_CHECK_ICONS);
GlStateManager.color(1, 1, 1, 1);
GlStateManager.pushMatrix();
Gui.drawModalRectWithCustomSizedTexture(right - (height / 2 + 4), top + (height / 2 - 4), vercheck.status.getSheetOffset() * 8, (vercheck.status.isAnimated() && ((System.currentTimeMillis() / 800 & 1)) == 1) ? 8 : 0, 8, 8, 64, 16);
GlStateManager.popMatrix();
}
}
}
示例4: playerJoin
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
@SubscribeEvent
public void playerJoin(final EntityJoinWorldEvent event) {
if (!updateMsgDone && !event.isCanceled() && event.getWorld().isRemote && (event.getEntity() instanceof EntityPlayer)) {
final EntityPlayer player = (EntityPlayer) event.getEntity();
ForgeVersion.CheckResult versioncheck = ForgeVersion.getResult(this);
if (player != null && !player.isDead && versioncheck != null && (versioncheck.status == ForgeVersion.Status.OUTDATED || versioncheck.status == ForgeVersion.Status.BETA_OUTDATED)) {
String msg = "Version "+versioncheck.target+" of "+getMCModInfo().name+" is available";
player.sendMessage(new TextComponentString(msg));
}
updateMsgDone = true;
}
}
示例5: getUpdateMessage
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
@Nullable
private String getUpdateMessage(@Nonnull final String modId) {
final ModContainer mod = ForgeUtils.findModContainer(modId);
if (mod == null)
return null;
final CheckResult result = ForgeVersion.getResult(mod);
if (dontPrintMessage(result))
return null;
final String t = result.target.toString();
final String u = result.url.toString();
return Localization.format(this.messageId, mod.getName(), t, u);
}
示例6: checkVersion
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
/**
* Checks the current version against the git-hub version.
*/
public static void checkVersion()
{
// Pull the repository information.
ModContainer prefabMod = null;
for (ModContainer modContainer : Loader.instance().getModList())
{
if (modContainer.getName().toLowerCase().equals(Prefab.MODID.toLowerCase()))
{
prefabMod = modContainer;
break;
}
}
if (prefabMod != null)
{
CheckResult result = ForgeVersion.getResult(prefabMod);
if (result != null && result.status == Status.OUTDATED)
{
// Current version is out dated, show the message when the user is logged in.
UpdateChecker.messageToShow = "[Prefab] There is a new version available! New Version: [" + result.target.toString() + "] Your Version: ["
+ Prefab.VERSION + "]";
UpdateChecker.showMessage = true;
}
}
}
示例7: PostLoad
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
@EventHandler
public static void PostLoad(FMLPostInitializationEvent PostEvent) {
log.info("Start Post Initialization");
long tM = System.currentTimeMillis();
proxy.postInit();
TomsModAPIMain.init();
log.info("Setting Max Stack Size of Minecarts to " + Config.minecartMaxStackSize + ".");
Items.MINECART.setMaxStackSize(Config.minecartMaxStackSize);
Items.CHEST_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
Items.TNT_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
Items.FURNACE_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
Items.HOPPER_MINECART.setMaxStackSize(Config.minecartMaxStackSize);
versionCheckResult = ForgeVersion.getResult(mc);
Logger vcLog = LogManager.getLogger(Configs.ModName + "] [Version Checker");
if (versionCheckResult.status == Status.OUTDATED) {
vcLog.warn("****************************************");
vcLog.warn("* Tom's Mod is OUTDATED!!");
vcLog.warn("* Current version: " + Configs.version);
vcLog.warn("* Online version: " + versionCheckResult.target.toString());
vcLog.warn("****************************************");
} else if (versionCheckResult.status == Status.AHEAD) {
vcLog.warn("??? status == AHEAD ???");
vcLog.warn("?? Current version: " + Configs.version);
} else if (versionCheckResult.status == Status.PENDING || versionCheckResult.status == Status.FAILED) {
vcLog.warn("Tom's Mod version checking failed.");
} else {
vcLog.info("Tom's Mod is up to date");
}
String[] tools = new String[]{"!_axe", "!_pickaxe", "!_shovel", "!_sword", "!_hoe"};
List<String> toNerf = new ArrayList<>();
if (Config.nerfedTools != null && Config.nerfedTools.length > 0)
Stream.of(Config.nerfedTools).map(ResourceLocation::new).filter(Item.REGISTRY::containsKey).map(ResourceLocation::toString).forEach(toNerf::add);
if (Config.disableWoodenTools) {
log.info("Nerfing wooden tools");
Stream.of(tools).map(t -> t.replace("!", "wooden")).forEach(toNerf::add);
}
if (Config.disableStoneTools) {
log.info("Nerfing stone tools");
Stream.of(tools).map(t -> t.replace("!", "stone")).forEach(toNerf::add);
}
if (Config.disableIronTools) {
log.info("Nerfing iron tools");
Stream.of(tools).map(t -> t.replace("!", "iron")).forEach(toNerf::add);
}
if (Config.disableGoldTools) {
log.info("Nerfing gold tools");
Stream.of(tools).map(t -> t.replace("!", "gold")).forEach(toNerf::add);
}
if (Config.disableDiamondTools) {
log.info("Nerfing diamond tools");
Stream.of(tools).map(t -> t.replace("!", "diamond")).forEach(toNerf::add);
}
if (Config.enableHardModeStarting) {
log.info("Overwriting Wood Harvest Levels");
hackedWood = new HackedWoodMaterial();
List<ItemStack> list = new ArrayList<>(OreDictionary.getOres("logWood"));
list.addAll(OreDictionary.getOres("plankWood"));
list.addAll(OreDictionary.getOres("slabWood"));
list.addAll(OreDictionary.getOres("stairWood"));
for (ItemStack stack : list) {
Block block = Block.getBlockFromItem(stack.getItem());
if (block != Blocks.AIR) {
block.setHarvestLevel("axe", 0);
TomsModUtils.trySetFinalField(Block.class, Material.class, block, hackedWood, log, "Failed to set Material value for " + block.getUnlocalizedName());
}
}
}
toNerf.stream().map(ResourceLocation::new).map(Item.REGISTRY::getObject).filter(i -> i != null).forEach(CoreInit::nerfTool);
Config.initFluids();
Config.printWarnings();
long time = System.currentTimeMillis() - tM;
log.info("Post Initialization took in " + time + " milliseconds");
}
示例8: updateCheckResult
import net.minecraftforge.common.ForgeVersion; //导入方法依赖的package包/类
public static void updateCheckResult()
{
CheckResult r = ForgeVersion.getResult(modContainer);
if (r != null && r.status != Status.PENDING) versionCheckResult = r;
}