net.minecraft.stats.Achievement Java Examples

The following examples show how to use net.minecraft.stats.Achievement. 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: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public static void init(){
    registerAcquire(0, 0, Itemss.ingotIronCompressed, null);
    registerAcquire(2, 0, Blockss.airCompressor, getAchieve(Itemss.ingotIronCompressed));
    registerAcquire(4, 0, Fluids.getBucket(Fluids.oil), getAchieve(Itemss.ingotIronCompressed));
    registerAcquire(6, 0, Blockss.refinery, getAchieve(Fluids.getBucket(Fluids.oil)));
    registerAcquire(8, 0, Itemss.plastic, getAchieve(Blockss.refinery));
    registerAcquire(10, 0, Blockss.uvLightBox, getAchieve(Itemss.plastic));
    registerAcquire(12, 0, Fluids.getBucket(Fluids.etchingAcid), getAchieve(Blockss.uvLightBox));

    register("dw9x9", 0, 2, new ItemStack(Blocks.cobblestone), null).setSpecial();

    AchievementPage.registerAchievementPage(new AchievementPage("PneumaticCraft", achieveList.values().toArray(new Achievement[achieveList.size()])));
}
 
Example #2
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private static Achievement register(String id, int x, int y, ItemStack icon, Achievement parentAchievement){
    Achievement achieve = new Achievement(id, id, x, y, icon, parentAchievement);
    achieve.initIndependentStat();
    achieve.registerStat();
    achieveList.put(id, achieve);
    return achieve;
}
 
Example #3
Source File: ConsoleInputGui.java    From ehacks-pro with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the screen and all the components in it.
 */
@SuppressWarnings("unchecked")
@Override
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
    drawRect(2, this.height - 14, this.width - 2, this.height - 2, Integer.MIN_VALUE);
    if (this.inputField.getText().length() == 0) {
        this.inputField.setText("/");
    }
    if (this.inputField.getText().charAt(0) != '/') {
        this.inputField.setText("/" + this.inputField.getText());
    }
    this.inputField.drawTextBox();
    IChatComponent ichatcomponent = EHacksGui.clickGui.consoleGui.getChatComponent(Mouse.getX(), Mouse.getY());

    if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() != null) {
        HoverEvent hoverevent = ichatcomponent.getChatStyle().getChatHoverEvent();

        if (null != hoverevent.getAction()) {
            switch (hoverevent.getAction()) {
                case SHOW_ITEM:
                    ItemStack itemstack = null;
                    try {
                        NBTBase nbtbase = JsonToNBT.func_150315_a(hoverevent.getValue().getUnformattedText());

                        if (nbtbase instanceof NBTTagCompound) {
                            itemstack = ItemStack.loadItemStackFromNBT((NBTTagCompound) nbtbase);
                        }
                    } catch (NBTException ignored) {
                    }
                    if (itemstack != null) {
                        this.renderToolTip(itemstack, p_73863_1_, p_73863_2_);
                    } else {
                        this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid Item!", p_73863_1_, p_73863_2_);
                    }
                    break;
                case SHOW_TEXT:
                    this.func_146283_a(Splitter.on("\n").splitToList(hoverevent.getValue().getFormattedText()), p_73863_1_, p_73863_2_);
                    break;
                case SHOW_ACHIEVEMENT:
                    StatBase statbase = StatList.func_151177_a(hoverevent.getValue().getUnformattedText());
                    if (statbase != null) {
                        IChatComponent ichatcomponent1 = statbase.func_150951_e();
                        ChatComponentTranslation chatcomponenttranslation = new ChatComponentTranslation("stats.tooltip.type." + (statbase.isAchievement() ? "achievement" : "statistic"));
                        chatcomponenttranslation.getChatStyle().setItalic(Boolean.TRUE);
                        String s = statbase instanceof Achievement ? ((Achievement) statbase).getDescription() : null;
                        ArrayList<String> arraylist = Lists.newArrayList(ichatcomponent1.getFormattedText(), chatcomponenttranslation.getFormattedText());

                        if (s != null) {
                            arraylist.addAll(this.fontRendererObj.listFormattedStringToWidth(s, 150));
                        }

                        this.func_146283_a(arraylist, p_73863_1_, p_73863_2_);
                    } else {
                        this.drawCreativeTabHoveringText(EnumChatFormatting.RED + "Invalid statistic/achievement!", p_73863_1_, p_73863_2_);
                    }
                    break;
                default:
                    break;
            }
        }

        GL11.glDisable(GL11.GL_LIGHTING);
    }

    super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
 
Example #4
Source File: Achievements.java    From BaseMetals with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static Achievement makeAchievement(String baseName, Achievement requirement, int x, int y, Item icon) {
	return makeAchievement( baseName,  requirement,  x,  y, new ItemStack( icon));
}
 
Example #5
Source File: Achievements.java    From BaseMetals with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static Achievement makeAchievement(String baseName, Achievement requirement, int x, int y, Block icon) {
	return makeAchievement( baseName,  requirement,  x,  y, new ItemStack( icon));
}
 
Example #6
Source File: Achievements.java    From BaseMetals with GNU Lesser General Public License v2.1 4 votes vote down vote up
private static Achievement makeAchievement(String baseName, Achievement requirement, int x, int y, ItemStack icon) {
	Achievement a = new Achievement(baseName,baseName,x,y,icon,requirement);
	a.registerStat();
	page.getAchievements().add(a);
	return a;
}
 
Example #7
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private static void registerAcquire(int x, int y, Item item, Achievement parentAchievement){
    registerAcquire(x, y, new ItemStack(item), parentAchievement);
}
 
Example #8
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private static void registerAcquire(int x, int y, Block block, Achievement parentAchievement){
    registerAcquire(x, y, new ItemStack(block), parentAchievement);
}
 
Example #9
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private static void registerAcquire(int x, int y, ItemStack stack, Achievement parentAchievement){
    register(stack.getItem().getUnlocalizedName().substring(5), x, y, stack, parentAchievement);
}
 
Example #10
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public static void giveAchievement(EntityPlayer player, String id){
    Achievement achieve = getAchieve(id);
    if(achieve != null) player.triggerAchievement(achieve);
}
 
Example #11
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private static Achievement getAchieve(Item item){
    return getAchieve(new ItemStack(item));
}
 
Example #12
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private static Achievement getAchieve(Block block){
    return getAchieve(new ItemStack(block));
}
 
Example #13
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private static Achievement getAchieve(ItemStack stack){
    return getAchieve(stack.getItem().getUnlocalizedName().substring(5));
}
 
Example #14
Source File: AchievementHandler.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private static Achievement getAchieve(String id){
    return achieveList.get(id);
}
 
Example #15
Source File: IRelic.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 2 votes vote down vote up
/**
 * Sets the achievement that this relic binds to.
 */
public void setBindAchievement(Achievement achievement);
 
Example #16
Source File: IRelic.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 2 votes vote down vote up
/**
 * Gets the achievement that this relic binds to.
 */
public Achievement getBindAchievement();