Items done, <1000 errors whoot!

This commit is contained in:
LexManos committed 2016-03-01 23:38:31 -08:00
1 parent ad788880e5
commit 8863aab9e5
40 files changed
+1136 -1348

No files matched your search

@@ -16,10 +16,13 @@ import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@@ -52,6 +55,8 @@ import net.minecraftforge.event.entity.living.LivingPackSizeEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn;
import net.minecraftforge.event.entity.living.ZombieEvent.SummonAidEvent;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.event.entity.player.ArrowNockEvent;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.event.entity.player.EntityInteractEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
@@ -297,23 +302,23 @@ public class ForgeEventFactory
return 0;
}
public static ItemStack onBucketUse(EntityPlayer player, World world, ItemStack stack, RayTraceResult target)
public static ActionResult<ItemStack> onBucketUse(EntityPlayer player, World world, ItemStack stack, RayTraceResult target)
{
FillBucketEvent event = new FillBucketEvent(player, stack, world, target);
if (MinecraftForge.EVENT_BUS.post(event)) return stack;
if (MinecraftForge.EVENT_BUS.post(event)) return new ActionResult<ItemStack>(EnumActionResult.FAIL, stack);
if (event.getResult() == Result.ALLOW)
{
if (player.capabilities.isCreativeMode)
return stack;
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
if (--stack.stackSize <= 0)
return event.getFilledBucket();
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, event.getFilledBucket());
if (!player.inventory.addItemStackToInventory(event.getFilledBucket()))
player.dropPlayerItemWithRandomChoice(event.getFilledBucket(), false);
return stack;
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
return null;
}
@@ -521,4 +526,20 @@ public class ForgeEventFactory
return canContinueSleep == Result.ALLOW;
}
public static ActionResult<ItemStack> onArrowNock(ItemStack item, World world, EntityPlayer player, EnumHand hand, boolean hasAmmo)
{
ArrowNockEvent event = new ArrowNockEvent(player, item, hand, world, hasAmmo);
if (MinecraftForge.EVENT_BUS.post(event))
return new ActionResult<ItemStack>(EnumActionResult.FAIL, item);
return event.getAction();
}
public static int onArrowLoose(ItemStack stack, World world, EntityPlayer player, int charge, boolean hasAmmo)
{
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, world, charge, hasAmmo);
if (MinecraftForge.EVENT_BUS.post(event))
return -1;
return event.getCharge();
}
}
@@ -3,6 +3,7 @@ package net.minecraftforge.event.entity.player;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* ArrowLooseEvent is fired when a player stops using a bow.<br>
@@ -22,13 +23,22 @@ import net.minecraft.item.ItemStack;
@Cancelable
public class ArrowLooseEvent extends PlayerEvent
{
public final ItemStack bow;
public int charge;
public ArrowLooseEvent(EntityPlayer player, ItemStack bow, int charge)
private final ItemStack bow;
private final World world;
private final boolean hasAmmo;
private int charge;
public ArrowLooseEvent(EntityPlayer player, ItemStack bow, World world, int charge, boolean hasAmmo)
{
super(player);
this.bow = bow;
this.world = world;
this.charge = charge;
this.hasAmmo = hasAmmo;
}
public ItemStack getBow() { return this.bow; }
public boolean hasAmmo() { return this.hasAmmo; }
public int getCharge() { return this.charge; }
public void setCharge(int charge) { this.charge = charge; }
}
@@ -1,31 +1,45 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
/**
* ArrowNockEvent is fired when a player begins using a bow.<br>
* This event is fired whenever a player begins using a bow in
* ItemBow#onItemRightClick(ItemStack, World, EntityPlayer).<br>
* <br>
* {@link #result} contains the resulting ItemStack due to the use of the bow. <br>
* <br>
* This event is {@link Cancelable}.<br>
* If this event is canceled, the player does not begin using the bow.<br>
* <br>
* This event does not have a result. {@link HasResult}<br>
* <br>
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
**/
@Cancelable
public class ArrowNockEvent extends PlayerEvent
{
public ItemStack result;
public ArrowNockEvent(EntityPlayer player, ItemStack result)
private final ItemStack bow;
private final EnumHand hand;
private final World world;
private final boolean hasAmmo;
private ActionResult<ItemStack> action;
public ArrowNockEvent(EntityPlayer player, ItemStack item, EnumHand hand, World world, boolean hasAmmo)
{
super(player);
this.result = result;
this.bow = item;
this.hand = hand;
this.world = world;
this.hasAmmo = hasAmmo;
}
public ItemStack getBow() { return this.bow; }
public EnumHand getHand() { return this.hand; }
public boolean hasAmmo() { return this.hasAmmo; }
public ActionResult<ItemStack> getAction()
{
return this.action;
}
public void setAction(ActionResult<ItemStack> action)
{
this.action = action;
}
}