本文整理汇总了Java中net.minecraft.stats.Achievement类的典型用法代码示例。如果您正苦于以下问题:Java Achievement类的具体用法?Java Achievement怎么用?Java Achievement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Achievement类属于net.minecraft.stats包,在下文中一共展示了Achievement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addStat
import net.minecraft.stats.Achievement; //导入依赖的package包/类
/**
* Adds a value to a statistic field.
*/
public void addStat(StatBase stat, int amount)
{
if (stat != null)
{
if (stat.isAchievement() && net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.AchievementEvent(this, (net.minecraft.stats.Achievement) stat))) return;
this.statsFile.increaseStat(this, stat, amount);
for (ScoreObjective scoreobjective : this.getWorldScoreboard().getObjectivesFromCriteria(stat.getCriteria()))
{
this.getWorldScoreboard().getOrCreateScore(this.getName(), scoreobjective).increaseScore(amount);
}
if (this.statsFile.hasUnsentAchievement())
{
this.statsFile.sendStats(this);
}
}
}
示例2: GuiAchievements
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public GuiAchievements(GuiScreen parentScreenIn, StatisticsManager statFileWriterIn)
{
this.parentScreen = parentScreenIn;
this.statFileWriter = statFileWriterIn;
int i = 141;
int j = 141;
this.xScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayColumn * 24 - 70 - 12);
this.xScrollO = this.xScrollTarget;
this.xScrollP = this.xScrollTarget;
this.yScrollTarget = (double)(AchievementList.OPEN_INVENTORY.displayRow * 24 - 70);
this.yScrollO = this.yScrollTarget;
this.yScrollP = this.yScrollTarget;
minecraftAchievements.clear();
for (Achievement achievement : AchievementList.ACHIEVEMENTS)
{
if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement))
{
minecraftAchievements.add(achievement);
}
}
}
示例3: setQuestsSub
import net.minecraft.stats.Achievement; //导入依赖的package包/类
private static MenuGUI setQuestsSub(Minecraft mc, MenuGUI sub, EntityPlayer player) {
sub.elements.add(new LabelGUI(sub, 0, 0, sub.width, '-' + StatCollector.translateToLocal("guiQuestList") + '-', WindowAlign.CENTER));
final MenuGUI questList = new MenuGUI(sub, 0, 0, sub.width, 150);
questList.innerMenu = true;
final StatFileWriter stats = mc.thePlayer.getStatFileWriter();
if (stats != null) {
final List<Achievement> ach = net.minecraft.stats.AchievementList.achievementList;
ach.stream()
.filter(obj0 -> obj0 instanceof Achievement).map(obj0 -> obj0)
.filter(ach0 -> ach0.isAchievement() && !stats.hasAchievementUnlocked(ach0) && stats.canUnlockAchievement(ach0))
.forEach(ach0 -> questList.elements.add(new AchievementList(questList, 0, 0, questList.width, ach0)));
}
sub.elements.add(questList);
return sub;
}
示例4: init
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public static void init() {
for( AchievementsReader.AchievementList alist : CustomAchievements.proxy.ar.root.achievements ){
if( !alist.uid.isEmpty() ){
int meta = 0;
if( alist.meta != null ){ meta = alist.meta; }
ItemStack is = new ItemStack( Item.getByNameOrId( alist.item ), 1, meta );
if( is != null ) {
Achievement tempAch = new Achievement( "achievement." + alist.uid, alist.uid, alist.xpos, alist.ypos, is, achievements.get( alist.parent ) ).registerStat();
achievements.put( alist.uid, tempAch );
achievementsIgnoreMeta.put( tempAch.hashCode(), alist.ignoreMeta );
achievementsTrophy.put( tempAch.hashCode(), alist.trophy );
if( alist.type.equals( "Detect" ) ){ detectAchievements.add( tempAch ); }
if( alist.type.equals( "Craft" ) ){ craftAchievements.add( tempAch ); }
}
}
}
String tabName = CustomAchievements.proxy.ar.root.tabname.isEmpty() ? "Custom Achievements" : CustomAchievements.proxy.ar.root.tabname;
page = new AchievementPage( tabName, achievements.values().toArray( new Achievement[achievements.size()] ) );
AchievementPage.registerAchievementPage( page );
}
示例5: trigger
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public static void trigger( Achievement achievement, EntityPlayer player ){
if( player != null ){
boolean getTrophy = false;
if( !player.worldObj.isRemote && player instanceof EntityPlayerMP && !player.hasAchievement( achievement ) && achievementsTrophy.get( achievement.hashCode() ) ){
getTrophy = true;
}
player.addStat( achievement );
if( player.hasAchievement( achievement ) && getTrophy ){
ItemStack is = new ItemStack( ModBlocks.trophy );
NBTTagCompound compound = NBTHelper.getTagCompound( is );
compound.setTag( "item", achievement.theItemStack.serializeNBT() );
compound.setString( "player", player.getName() );
is.setTagCompound( compound );
player.worldObj.spawnEntityInWorld( new EntityItem( player.worldObj, player.posX, player.posY, player.posZ, is ) );
}
}
}
示例6: initialization
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public static void initialization()
{
enter_aether = new AetherAchievement("achievement.enter_aether", "enter_aether", 0, 1, Blocks.GLOWSTONE, (Achievement) null).registerStat();
defeat_bronze = new AetherAchievement("achievement.defeat_bronze", "defeat_bronze", -2, 3, new ItemStack(ItemsAether.dungeon_key, 1, 0), enter_aether).registerStat();
defeat_silver = new AetherAchievement("achievement.defeat_silver", "defeat_silver", 0, 4, new ItemStack(ItemsAether.dungeon_key, 1, 1), enter_aether).registerStat();
defeat_gold = new AetherAchievement("achievement.defeat_gold", "defeat_gold", 2, 3, new ItemStack(ItemsAether.dungeon_key, 1, 2), enter_aether).registerStat();
enchanter = new AetherAchievement("achievement.enchanter", "enchanter", 2, 1, BlocksAether.enchanter, enter_aether).registerStat();
incubator = new AetherAchievement("achievement.incubator", "incubator", 2, -1, BlocksAether.incubator, enter_aether).registerStat();
blue_cloud = new AetherAchievement("achievement.blue_aercloud", "blue_aercloud", -2, -1, new ItemStack(BlocksAether.aercloud, 1, 1), enter_aether).registerStat();
flying_pig = new AetherAchievement("achievement.flying_pig", "flying_pig", -2, 1, Items.SADDLE, enter_aether).registerStat();
grav_tools = new AetherAchievement("achievement.grav_tools", "grav_tools", -1, -3, ItemsAether.gravitite_pickaxe, enter_aether).registerStat();
loreception = new AetherAchievement("achievement.loreception", "loreception", 1, -3, ItemsAether.lore_book, enter_aether).registerStat();
ACpage = new AchievementPage("Aether I", enter_aether, defeat_bronze, defeat_silver, defeat_gold, enchanter, incubator, blue_cloud, flying_pig, grav_tools, loreception);
AchievementPage.registerAchievementPage(ACpage);
}
示例7: getAchievementForItem
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public static Achievement getAchievementForItem(ItemStack stack)
{
if (stack == null)
{
return null;
}
for (Achievement ach : list)
{
ItemStack s = ach.theItemStack;
if (s.getItem() == stack.getItem() && s.getItemDamage() == stack.getItemDamage())
{
return ach;
}
}
return null;
}
示例8: fromClass
import net.minecraft.stats.Achievement; //导入依赖的package包/类
/**
* Get all initialized achievement fields as a list
*
* @param clazz
* Achievement class
* @return Return all initialized achievements as a list
*/
public static Achievement[] fromClass(Class<?> clazz) {
ArrayList<Achievement> achievements = new ArrayList<Achievement>();
for (Field field : clazz.getFields()) {
try {
if (field.getType() == Achievement.class) {
Achievement ach = (Achievement) field.get(null);
if (ach == null) {
continue;
}
achievements.add(ach);
}
} catch (Exception e) {
}
}
return (Achievement[]) achievements.toArray(new Achievement[achievements.size()]);
}
示例9: handleInteract
import net.minecraft.stats.Achievement; //导入依赖的package包/类
@SuppressWarnings("static-access")
@SubscribeEvent
public static void handleInteract(PlayerInteractEvent.RightClickBlock event) throws NullPointerException
{
ItemStack item = event.getEntityPlayer().getActiveItemStack();
AchievementPage page = ARKCraftAchievements.page;
Achievement achievement = ARKCraftAchievements.achievementMichaelBay;
EntityPlayer player = event.getEntityPlayer();
if (!AchievementHelper.containsAchievement(page, achievement)) {
if (item != null && item.getItem() == ARKCraftRangedWeapons.rocket_propelled_grenade) {
if (item.getDisplayName().equals("Michael_Bay") && player.isSneaking()) {
double x = player.posX;
double y = player.posY;
double z = player.posZ;
Easter.MICHAEL_BAY.createExplosionNoDamage(player, event.getWorld(), 5.0F, x, y, z, 0, 1, 0);
AchievementHelper.registerAndDisplay(player, achievement);
}
}
}
}
示例10: init
import net.minecraft.stats.Achievement; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) {
AlloycraftBlocks.initBlocks();
AlloycraftItems.initItems();
alloycrafttab = new UtilsCreativeTab("alloycraft", Item.getItemFromBlock(AlloycraftBlocks.forgeoff));
NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
GameRegistry.addRecipe(new RecipeHandler());
alloyforge = new UtilsAchievement("achievement.alloyforgemade", "alloyforgecrafted", 2, 0, new ItemStack(AlloycraftBlocks.forgeoff), null, "Alloy Forge!", "You made an Alloy Forge!", AlloycraftMain.modid);
alloy = new UtilsAchievement("achievement.alloymade", "alloycrafted", 2, 1, new ItemStack(AlloycraftItems.alloy), alloyforge, "Alloy!", "You made your first Alloy!", AlloycraftMain.modid);
alloyaxe = new UtilsAchievement("achievement.alloyaxemade", "alloyaxecrafted", 0, 2, new ItemStack(AlloycraftItems.alloyaxe), alloy, "Alloy Axe", "Crafted an Alloy Axe", AlloycraftMain.modid);
alloypick = new UtilsAchievement("achievement.alloypickmade", "alloypickcrafted", 1, 2, new ItemStack(AlloycraftItems.alloypickaxe), alloy, "Alloy Pickaxe", "Crafted an Alloy Pickaxe", AlloycraftMain.modid);
alloyhoe = new UtilsAchievement("achievement.alloyhoemade", "alloyhoecrafted", 2, 2, new ItemStack(AlloycraftItems.alloyhoe), alloy, "Alloy Hoe", "Crafted an Alloy Hoe", AlloycraftMain.modid);
alloysword = new UtilsAchievement("achievement.alloyswordmade", "alloyswordcrafted", 3, 2, new ItemStack(AlloycraftItems.alloysword), alloy, "Alloy Sword", "Crafted an Alloy Sword", AlloycraftMain.modid);
alloyshovel = new UtilsAchievement("achievement.alloyshovelmade", "alloyshovelcrafted", 4, 2, new ItemStack(AlloycraftItems.alloyshovel), alloy, "Alloy Shovel", "Crafted an Alloy Shovel", AlloycraftMain.modid);
alloyCraftPage = new AchievementPage("Alloycraft" ,new Achievement[]{alloyforge, alloy, alloypick, alloyhoe, alloyaxe, alloyshovel, alloysword});
AchievementPage.registerAchievementPage(alloyCraftPage);
MinecraftForge.EVENT_BUS.register(new com.ashindigo.alloycraft.lib.EventHandler());
}
示例11: preInit
import net.minecraft.stats.Achievement; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent e) {
// read your config file, create Blocks, Items, register with GameRegistry
Main.proxy.preInit(e);
// Read configuration file
Configuration config = new Configuration(e.getSuggestedConfigurationFile());
config.load();
maxBridgeDistance = config.getInt("maxBridgeDistance", config.CATEGORY_GENERAL, 400, 1, 1000, "Max length of bridges made be Grappling Gun.");
bridgeDroopFactor = config.getInt("bridgeDroopFactor", config.CATEGORY_GENERAL, 100, 0, 100, "Percent of slack the bridge will have, causing it to hang.");
bridgeYOffset = config.getFloat("bridgeYOffset", config.CATEGORY_GENERAL, -0.3F, -1.00F, 1.00F, "Generated bridges will be raised or lowered by this ammount in blocks.\nDefault is just below user's feet.");
customAchievements = config.getBoolean("customAchievements", config.CATEGORY_GENERAL, true, "Custom crafting and building achievements.");
config.save();
// Register Achievements (if enabled in config)
if (customAchievements) {
craftAchievement = new Achievement("achievement.grapplingGun", "grapplingGun", 8, 2, ModItems.bridgeBuilder, AchievementList.buildBetterPickaxe);
craftAchievement.registerStat();
buildAchievement = new Achievement("achievement.buildBridge", "buildBridge", 10, 2, ModBlocks.bridgeBlock2, craftAchievement);
buildAchievement.registerStat();
}
// Register Simple Channel
snw = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
snw.registerMessage(bridgeMessageHandler.class, bridgeMessage.class, 0, Side.SERVER);
}
示例12: init
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public static void init() {
// localized name, nonLocalizedName, x,y (in achievement page), item or block to display on page, see AchivementList.java for rest
firstGoldCoin = new Achievement("achievement.firstGoldCoin", "firstGoldCoin", 0, 0,
new ItemStack(ModItems.goldCoin), (Achievement)null).initIndependentStat();
levelTenDragon = new Achievement("achievement.levelTenDragon", "levelTenDragon", 1, 2,
new ItemStack(ModItems.goldCoin), firstGoldCoin);
foundAllDragonEggs = new Achievement("achievement.foundAllDragonEggs", "foundAllDragonEggs", 1, 4,
new ItemStack(ModItems.earthDragonEgg), levelTenDragon);
firstGoldCoin.registerStat();
levelTenDragon.registerStat();
foundAllDragonEggs.registerStat();
AchievementPage.registerAchievementPage(new AchievementPage("Draco Animus",
// new Achievement[] { firstGoldCoin, levelTenDragon }
new Achievement[] { firstGoldCoin, levelTenDragon, foundAllDragonEggs }
));
}
示例13: loadAchievements
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public static void loadAchievements()
{
getBitumen = new Achievement("achievement.roadstuff_getbitumen", "roadstuff_getbitumen", 0, 0, new ItemStack(RoadStuffItems.itemBitumen, 1, 0), null);
smeltBitumen = new Achievement("achievement.roadstuff_smeltbitumen", "roadstuff_smeltbitumen", 2, 0, new ItemStack(RoadStuffItems.itemBitumen, 1, 1), getBitumen);
craftAsphalt = new Achievement("achievement.roadstuff_craftasphalt", "roadstuff_craftasphalt", 4, 0, new ItemStack(RoadStuffBlocks.blockAsphalt, 1, 0), smeltBitumen);
craftAsphaltLine = new Achievement("achievement.roadstuff_craftasphaltline", "roadstuff_craftasphaltline", 6, 0, new ItemStack(RoadStuffBlocks.blockAsphaltLine, 1, 0), craftAsphalt);
craftAsphaltCorner = new Achievement("achievement.roadstuff_craftasphaltcorner", "roadstuff_craftasphaltcorner", 8, 0, new ItemStack(RoadStuffBlocks.blockAsphaltCorner, 1, 0), craftAsphaltLine);
craftAsphaltSlab = new Achievement("achievement.roadstuff_craftasphaltslab", "roadstuff_craftasphaltslab", 5, -1, new ItemStack(RoadStuffBlocks.singleSlabAsphalt, 1, 0), craftAsphalt);
craftConcrete = new Achievement("achievement.roadstuff_craftconcrete", "roadstuff_craftconcrete", 4, 2, new ItemStack(RoadStuffBlocks.blockConcrete, 1, 0), null);
craftConcreteLine = new Achievement("achievement.roadstuff_craftconcreteline", "roadstuff_craftconcreteline", 6, 2, new ItemStack(RoadStuffBlocks.blockConcreteLine, 1, 0), craftConcrete);
craftConcreteCorner = new Achievement("achievement.roadstuff_craftconcretecorner", "roadstuff_craftconcretecorner", 8, 2, new ItemStack(RoadStuffBlocks.blockConcreteCorner, 1, 0), craftConcreteLine);
craftConcreteSlab = new Achievement("achievement.roadstuff_craftconcreteslab", "roadstuff_craftconcreteslab", 5, 3, new ItemStack(RoadStuffBlocks.singleSlabConcrete, 1, 0), craftConcrete);
craftCone = new Achievement("achievement.roadstuff_craftcone", "roadstuff_craftcone", 2, -4, new ItemStack(RoadStuffBlocks.blockCone, 1, 0), smeltBitumen);
craftSign = new Achievement("achievement.roadstuff_craftsign", "roadstuff_craftsign", 4, -4, new ItemStack(RoadStuffBlocks.blockTrafficSign, 1, 1), craftCone);
configSign = new Achievement("achievement.roadstuff_configsign", "roadstuff_configsign", 6, -4, new ItemStack(RoadStuffBlocks.blockTrafficSign, 1, 1), craftSign);
craftReflector = new Achievement("achievement.roadstuff_craftreflector", "roadstuff_craftreflector", 0, -4, new ItemStack(RoadStuffBlocks.blockReflector, 1, 0), craftCone);
craftIlluminatedReflector = new Achievement("achievement.roadstuff_craftilluminatedreflector", "roadstuff_craftilluminatedreflector", 0, -6, new ItemStack(RoadStuffBlocks.blockReflector, 1, 3), craftReflector);
page = new AchievementPage("Road Stuff", getBitumen, smeltBitumen, craftAsphalt, craftConcrete, craftCone, craftAsphaltLine, craftAsphaltCorner, craftConcreteLine, craftConcreteCorner, craftSign, configSign, craftReflector, craftIlluminatedReflector, craftAsphaltSlab, craftConcreteSlab);
}
示例14: unlockAchievement
import net.minecraft.stats.Achievement; //导入依赖的package包/类
public void unlockAchievement(EntityPlayerMP playerMP, ItemStack stack) {
if (playerMP != null && stack != null && stack.getItem() != null && stack.stackSize > 0) {
Achievement achievement = null;
ItemStack baseItem = null;
if (registeredAchievements != null && !registeredAchievements.isEmpty()) {
for (Map.Entry<ItemStack, Achievement> entry : registeredAchievements.entrySet()) {
if (entry != null && ParsingUtil.doStacksMatch(entry.getKey(), stack)) {
achievement = entry.getValue();
baseItem = entry.getKey();
break;
}
}
}
if (achievement != null && baseItem != null && !playerMP.func_147099_x().hasAchievementUnlocked(achievement) && playerMP.func_147099_x().canUnlockAchievement(achievement)) {
int count = stack.stackSize + NBTUtil.getInt(playerMP, achievement.statId);
NBTUtil.setInt(playerMP, achievement.statId, count);
if (count >= baseItem.stackSize) {
playerMP.addStat(achievement, 1);
NBTUtil.removeTag(playerMP, achievement.statId);
}
}
}
}
示例15: registerAchievementCondition
import net.minecraft.stats.Achievement; //导入依赖的package包/类
@Override
public void registerAchievementCondition(Achievement achievement, String... args) {
if (achievement != null && args != null && (args.length == 1 || args.length == 2 || args.length == 3)) {
String itemName = args[0];
int count = 1;
if (args.length >= 2) {
if (args[1].startsWith("meta="))
itemName += " " + args[1];
if (args[1].startsWith("count="))
count = ParsingUtil.getCountFromString(args[1]);
if (args.length == 3 && args[2].startsWith("count="))
count = ParsingUtil.getCountFromString(args[2]);
}
ItemStack stack = ParsingUtil.getStackFromString(itemName);
stack.stackSize = count;
if (stack == null && stack.getItem() != null)
return;
if (stack != null && args.length == 2 && args[1].startsWith("count="))
stack.stackSize = ParsingUtil.parseInt(args[1].substring(6));
if (stack != null && args.length == 3 && args[2].startsWith("count="))
stack.stackSize = ParsingUtil.parseInt(args[2].substring(6));
if (stack != null && stack.getItem() != null && stack.stackSize > 0)
registeredAchievements.put(stack, achievement);
}
}