Merge pull request #840 from GirafiStudios/BOP-1.10.2-5.0.x

Fixed silk touching on BoP blocks
This commit is contained in:
Adubbz 2016-08-24 18:20:59 +10:00 committed by GitHub
commit d98ec78ccd
2 changed files with 22 additions and 0 deletions

View file

@ -0,0 +1,21 @@
package biomesoplenty.common.handler;
import biomesoplenty.common.block.IBOPBlock;
import net.minecraft.block.state.IBlockState;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class SilkTouchEventHandler {
@SubscribeEvent
public void onSilkTouched(BlockEvent.HarvestDropsEvent event)
{
IBlockState state = event.getState();
if (state.getBlock() instanceof IBOPBlock && event.isSilkTouching())
{
event.getDrops().clear();
event.getDrops().add(state.getBlock().getPickBlock(state, null, event.getWorld(), event.getPos(), event.getHarvester()));
}
}
}

View file

@ -39,6 +39,7 @@ public class ModHandlers
MinecraftForge.EVENT_BUS.register(new AchievementEventHandler()); MinecraftForge.EVENT_BUS.register(new AchievementEventHandler());
MinecraftForge.EVENT_BUS.register(new GrassPathEventHandler()); MinecraftForge.EVENT_BUS.register(new GrassPathEventHandler());
MinecraftForge.EVENT_BUS.register(new SheepEventHandler()); MinecraftForge.EVENT_BUS.register(new SheepEventHandler());
MinecraftForge.EVENT_BUS.register(new SilkTouchEventHandler());
MinecraftForge.EVENT_BUS.register(new LootTableEventHandler()); MinecraftForge.EVENT_BUS.register(new LootTableEventHandler());
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) if (FMLCommonHandler.instance().getSide() == Side.CLIENT)