Merge with 6.5.x energy value tweaks
This commit is contained in:
parent
457f69e5e0
commit
d3288d107a
1 changed files with 0 additions and 36 deletions
|
@ -1,36 +0,0 @@
|
|||
package buildcraft.core.lib;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraftforge.common.AchievementPage;
|
||||
|
||||
public class AchievementManager {
|
||||
public AchievementPage page;
|
||||
|
||||
public AchievementManager(String name) {
|
||||
page = new AchievementPage(name);
|
||||
AchievementPage.registerAchievementPage(page);
|
||||
|
||||
FMLCommonHandler.instance().bus().register(this);
|
||||
}
|
||||
|
||||
public Achievement registerAchievement(Achievement a) {
|
||||
page.getAchievements().add(a.registerStat());
|
||||
return a;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCrafting(PlayerEvent.ItemCraftedEvent event) {
|
||||
Item item = event.crafting.getItem();
|
||||
int damage = event.crafting.getItemDamage();
|
||||
|
||||
for (Achievement a : page.getAchievements()) {
|
||||
if (item.equals(a.theItemStack.getItem()) && damage == a.theItemStack.getItemDamage()) {
|
||||
event.player.addStat(a, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue