Merge pull request #506 from fewizz/BOP-1.7.10-2.1.x

Added comp. with vanilla achievements. Other lang support.
This commit is contained in:
Adubbz 2015-07-07 15:58:20 +10:00
commit 800587ac35
3 changed files with 40 additions and 6 deletions

View File

@ -98,10 +98,4 @@ public class WorldTypeMessageGUI extends GuiScreen
super.drawScreen(x, y, renderPartialTicks);
}
@Override
public void drawCenteredString(FontRenderer fontRenderer, String string, int x, int y, int colour)
{
fontRenderer.drawStringWithShadow(string, x - fontRenderer.getStringWidth(string.replaceAll("\\P{InBasic_Latin}", "")) / 2, y, colour);
}
}

View File

@ -12,6 +12,7 @@ import biomesoplenty.common.eventhandler.entity.SlimeSpawnEventHandler;
import biomesoplenty.common.eventhandler.entity.TemptEventHandler;
import biomesoplenty.common.eventhandler.misc.BonemealEventHandler;
import biomesoplenty.common.eventhandler.misc.BucketEventHandler;
import biomesoplenty.common.eventhandler.misc.CompatibilityWithVanillaAchievements;
import biomesoplenty.common.eventhandler.misc.OreDictionaryEventHandler;
import biomesoplenty.common.eventhandler.potions.PotionParalysisEventHandler;
import biomesoplenty.common.eventhandler.potions.PotionPossessionEventHandler;
@ -71,6 +72,7 @@ public class BOPEventHandlers
MinecraftForge.EVENT_BUS.register(new BonemealEventHandler());
MinecraftForge.EVENT_BUS.register(new BucketEventHandler());
MinecraftForge.EVENT_BUS.register(new OreDictionaryEventHandler());
FMLCommonHandler.instance().bus().register(new CompatibilityWithVanillaAchievements());
}
private static void registerClientEventHandlers()

View File

@ -0,0 +1,38 @@
package biomesoplenty.common.eventhandler.misc;
import biomesoplenty.api.content.BOPCBlocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.AchievementList;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
public class CompatibilityWithVanillaAchievements {
@SubscribeEvent
public void woodMined(PlayerEvent.ItemPickupEvent event){
for(int i = 0; i < 4; i++){
for(int z = 0; z < 4; z++){
switch(i){
case 0 : if(event.pickedUp.getEntityItem().isItemEqual(new ItemStack(BOPCBlocks.logs1, 0, z))){
event.player.addStat(AchievementList.mineWood, 1);
return;
}
case 1 : if(event.pickedUp.getEntityItem().isItemEqual(new ItemStack(BOPCBlocks.logs2, 0, z))){
event.player.addStat(AchievementList.mineWood, 1);
return;
}
case 2 : if(event.pickedUp.getEntityItem().isItemEqual(new ItemStack(BOPCBlocks.logs3, 0, z))){
event.player.addStat(AchievementList.mineWood, 1);
return;
}
case 3 : if(event.pickedUp.getEntityItem().isItemEqual(new ItemStack(BOPCBlocks.logs4, 0, z))){
event.player.addStat(AchievementList.mineWood, 1);
return;
}
}
}
}
}
}