Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions src/main/java/fox/spiteful/forbidden/FMEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderHell;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.living.*;
Expand Down Expand Up @@ -160,8 +161,8 @@ else if (randy.nextInt(35) < 3)
}
}

if (event.entityLiving.worldObj.provider.dimensionId != -1)
return;
//if ( event.entityLiving.worldObj.provider.dimensionId != -1 )
if ( !(event.entityLiving.worldObj.provider instanceof WorldProviderHell) ) { return; }

if (!event.recentlyHit || event.source.getEntity() == null || !(event.source.getEntity() instanceof EntityPlayer) || event.source.getEntity() instanceof FakePlayer) {
if (randy.nextInt(30) < 4) {
Expand Down Expand Up @@ -348,7 +349,10 @@ public void onHarvest(HarvestDropsEvent event) {
event.drops.add((ItemStack) (current.next()));
}
}
if(player.worldObj.provider.dimensionId == -1 && event.block == Blocks.quartz_ore){
//if(player.worldObj.provider.dimensionId == -1 && event.block == Blocks.quartz_ore){
if( ( player.worldObj.provider instanceof WorldProviderHell ) &&
( event.block == Blocks.quartz_ore ) )
{
int fortune = EnchantmentHelper.getFortuneModifier(player);
if(fortune > 0 && randy.nextInt(60) <= fortune){
event.drops.add(new ItemStack(ForbiddenItems.deadlyShards, 1, 6));
Expand All @@ -372,8 +376,11 @@ public void onEat(PlayerUseItemEvent.Finish event){
if(event.entityPlayer.worldObj.isRemote)
return;
if(event.item.getItem() instanceof ItemFood){
if(event.entityPlayer.worldObj.provider.dimensionId == -1 && event.item.getItem() != ForbiddenItems.gluttonyShard
&& randy.nextInt(10) < 2){
//if(event.entityPlayer.worldObj.provider.dimensionId == -1 && event.item.getItem() != ForbiddenItems.gluttonyShard&& randy.nextInt(10) < 2){
if( ( event.entityPlayer.worldObj.provider instanceof WorldProviderHell ) &&
( event.item.getItem() != ForbiddenItems.gluttonyShard ) &&
( randy.nextInt(10) < 2 ) )
{
EntityItem ent = event.entityPlayer.entityDropItem(new ItemStack(ForbiddenItems.gluttonyShard, 1), 1.0F);
ent.motionY += randy.nextFloat() * 0.05F;
ent.motionX += (randy.nextFloat() - randy.nextFloat()) * 0.1F;
Expand Down Expand Up @@ -409,8 +416,13 @@ public ItemStack getSinShard() {

@SubscribeEvent
public void onSpawn(LivingSpawnEvent event) {
if (event.entityLiving.worldObj.provider.dimensionId == -1 && event.entityLiving instanceof EntityPigZombie && randy.nextInt(175) == 1)
//if (event.entityLiving.worldObj.provider.dimensionId == -1 && event.entityLiving instanceof EntityPigZombie && randy.nextInt(175) == 1)
if( (event.entityLiving.worldObj.provider instanceof WorldProviderHell ) &&
( event.entityLiving instanceof EntityPigZombie) &&
( randy.nextInt(175) == 1 ) )
{
event.entityLiving.setCurrentItemOrArmor(0, new ItemStack(ForbiddenItems.deadlyShards, 1, 1));
}
}

@SubscribeEvent
Expand Down Expand Up @@ -456,7 +468,10 @@ public void onFeelPain(LivingHurtEvent event){
doses += 3;
chance += 3;
}
if(player.worldObj.provider.dimensionId == -1 && randy.nextInt(30) < chance){
//if(player.worldObj.provider.dimensionId == -1 && randy.nextInt(30) < chance){
if( ( player.worldObj.provider instanceof WorldProviderHell ) &&
( randy.nextInt(30) < chance ) )
{
EntityItem ent = player.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F);
ent.motionY += player.worldObj.rand.nextFloat() * 0.05F;
ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
Expand Down