Custom wood now gives "Getting Wood!"
This commit is contained in:
parent
46920572db
commit
a203d00cad
2 changed files with 27 additions and 0 deletions
24
src/java/mmm/materials/MWoodAchievementHandler.java
Normal file
24
src/java/mmm/materials/MWoodAchievementHandler.java
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package mmm.materials;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.stats.AchievementList;
|
||||||
|
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class MWoodAchievementHandler
|
||||||
|
{
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onEntityItemPickup( final EntityItemPickupEvent event )
|
||||||
|
{
|
||||||
|
final Item item = event.getItem( ).getEntityItem( ).getItem( );
|
||||||
|
if ( item instanceof ItemBlock && ( (ItemBlock) item ).getBlock( ) instanceof MLog ) {
|
||||||
|
event.getEntityPlayer( ).addStat( AchievementList.MINE_WOOD );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +30,8 @@ public class Materials
|
||||||
ITEM = new MItems( );
|
ITEM = new MItems( );
|
||||||
ORE = new MOres( );
|
ORE = new MOres( );
|
||||||
TRAP = new MTraps( );
|
TRAP = new MTraps( );
|
||||||
|
|
||||||
|
MinecraftForge.EVENT_BUS.register( new MWoodAchievementHandler( ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue