mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-27 15:33:18 +00:00
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes: Almost all int x, int y, int z parameters have been changed to BlockPos class ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing. All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it. Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated. As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format. Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata. Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
This commit is contained in:
1 parent
0e91787efb
commit
53659fca06
410 files changed
+8717
-14103
No files matched your search
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.item;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.item;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
/**
|
||||
* LivingDropsEvent is fired when an Entity's death causes dropped items to appear.<br>
|
||||
* This event is fired whenever an Entity dies and drops items in
|
||||
* This event is fired whenever an Entity dies and drops items in
|
||||
* EntityLivingBase#onDeath(DamageSource).<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingDrops(EntityLivingBase, DamageSource, ArrayList<EntityItem>, int, boolean, int)}.<br>
|
||||
@@ -18,7 +18,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
* {@link #drops} contains the ArrayList of EntityItems that will be dropped.<br>
|
||||
* {@link #lootingLevel} contains the amount of loot that will be dropped.<br>
|
||||
* {@link #recentlyHit} determines whether the Entity doing the drop has recently been damaged.<br>
|
||||
* {@link #specialDropValue} contains the special drop value for this even.<br>
|
||||
* <br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If this event is canceled, the Entity does not drop anything.<br>
|
||||
@@ -31,18 +30,16 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
public class LivingDropsEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public final ArrayList<EntityItem> drops;
|
||||
public final List<EntityItem> drops;
|
||||
public final int lootingLevel;
|
||||
public final boolean recentlyHit;
|
||||
public final int specialDropValue;
|
||||
|
||||
public LivingDropsEvent(EntityLivingBase entity, DamageSource source, ArrayList<EntityItem> drops, int lootingLevel, boolean recentlyHit, int specialDropValue)
|
||||
|
||||
public LivingDropsEvent(EntityLivingBase entity, DamageSource source, List<EntityItem> drops, int lootingLevel, boolean recentlyHit)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.drops = drops;
|
||||
this.lootingLevel = lootingLevel;
|
||||
this.recentlyHit = recentlyHit;
|
||||
this.specialDropValue = specialDropValue;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
/**
|
||||
* LivingFallEvent is fired when an Entity is set to be falling.<br>
|
||||
* This event is fired whenever an Entity is set to fall in
|
||||
* This event is fired whenever an Entity is set to fall in
|
||||
* EntityLivingBase#fall(float).<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeHooks#onLivingFall(EntityLivingBase, float)}.<br>
|
||||
@@ -23,9 +23,11 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
public class LivingFallEvent extends LivingEvent
|
||||
{
|
||||
public float distance;
|
||||
public LivingFallEvent(EntityLivingBase entity, float distance)
|
||||
public float damageMultiplier;
|
||||
public LivingFallEvent(EntityLivingBase entity, float distance, float damageMultiplier)
|
||||
{
|
||||
super(entity);
|
||||
this.distance = distance;
|
||||
this.damageMultiplier = damageMultiplier;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
@HasResult
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package net.minecraftforge.event.entity.minecart;
|
||||
|
||||
import net.minecraft.entity.item.EntityMinecart;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
/**
|
||||
* MinecartUpdateEvent is fired when a minecart is updated.<br>
|
||||
* This event is fired whenever a minecart is updated in
|
||||
* EntityMinecart#onUpdate().<br>
|
||||
* <br>
|
||||
* {@link #x} contains the x-coordinate of the minecart Entity.<br>
|
||||
* {@link #y} contains the y-coordinate of the minecart Entity.<br>
|
||||
* {@link #z} contains the z-coordinate of the minecart Entity.<br>
|
||||
* {@link #pos} contains the coordinate of the track the entity is on {if applicable}.<br>
|
||||
* <br>
|
||||
* This event is not {@link Cancelable}.<br>
|
||||
* <br>
|
||||
@@ -19,15 +18,11 @@ import net.minecraft.entity.item.EntityMinecart;
|
||||
**/
|
||||
public class MinecartUpdateEvent extends MinecartEvent
|
||||
{
|
||||
public final float x;
|
||||
public final float y;
|
||||
public final float z;
|
||||
public final BlockPos pos;
|
||||
|
||||
public MinecartUpdateEvent(EntityMinecart minecart, float x, float y, float z)
|
||||
public MinecartUpdateEvent(EntityMinecart minecart, BlockPos pos)
|
||||
{
|
||||
super(minecart);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pos = pos;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* When the player receives an achievement. If canceled the player will not receive anything.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@Cancelable
|
||||
@@ -13,26 +15,22 @@ public class BonemealEvent extends PlayerEvent
|
||||
/**
|
||||
* This event is called when a player attempts to use Bonemeal on a block.
|
||||
* It can be canceled to completely prevent any further processing.
|
||||
*
|
||||
* You can also set the result to ALLOW to mark the event as processed
|
||||
*
|
||||
* You can also set the result to ALLOW to mark the event as processed
|
||||
* and use up a bonemeal from the stack but do no further processing.
|
||||
*
|
||||
*
|
||||
* setResult(ALLOW) is the same as the old setHandeled()
|
||||
*/
|
||||
|
||||
public final World world;
|
||||
public final Block block;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
public BonemealEvent(EntityPlayer player, World world, Block block, int x, int y, int z)
|
||||
public final BlockPos pos;
|
||||
public final IBlockState block;
|
||||
|
||||
public BonemealEvent(EntityPlayer player, World world, BlockPos pos, IBlockState block)
|
||||
{
|
||||
super(player);
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
this.block = block;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
@@ -23,17 +23,17 @@ public class PlayerDropsEvent extends LivingDropsEvent
|
||||
/**
|
||||
* Creates a new event containing all the items that will drop into the
|
||||
* world when a player dies.
|
||||
* @param entity The dying player.
|
||||
* @param entity The dying player.
|
||||
* @param source The source of the damage which is killing the player.
|
||||
* @param drops List of all drops entering the world.
|
||||
*/
|
||||
public PlayerDropsEvent(EntityPlayer entity, DamageSource source, ArrayList<EntityItem> drops, boolean recentlyHit)
|
||||
public PlayerDropsEvent(EntityPlayer entity, DamageSource source, List<EntityItem> drops, boolean recentlyHit)
|
||||
{
|
||||
super(entity, source, drops,
|
||||
(source.getEntity() instanceof EntityPlayer) ?
|
||||
super(entity, source, drops,
|
||||
(source.getEntity() instanceof EntityPlayer) ?
|
||||
EnchantmentHelper.getLootingModifier(((EntityPlayer)source.getEntity())) : 0,
|
||||
recentlyHit, 0);
|
||||
|
||||
recentlyHit);
|
||||
|
||||
this.entityPlayer = entity;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,17 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
|
||||
/**
|
||||
* PlayerEvent is fired whenever an event involving Living entities occurs. <br>
|
||||
* If a method utilizes this {@link Event} as its parameter, the method will
|
||||
* If a method utilizes this {@link Event} as its parameter, the method will
|
||||
* receive every child event of this class.<br>
|
||||
* <br>
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
@@ -23,7 +24,7 @@ public class PlayerEvent extends LivingEvent
|
||||
super(player);
|
||||
entityPlayer = player;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HarvestCheck is fired when a player attempts to harvest a block.<br>
|
||||
* This event is fired whenever a player attempts to harvest a block in
|
||||
@@ -58,15 +59,12 @@ public class PlayerEvent extends LivingEvent
|
||||
* This event is fired whenever a player attempts to harvest a block in
|
||||
* EntityPlayer#canHarvestBlock(Block).<br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, Block, int, float, int, int, int)}.<br>
|
||||
* This event is fired via the {@link ForgeEventFactory#getBreakSpeed(EntityPlayer, IBlockState, float, BlockPos)}.<br>
|
||||
* <br>
|
||||
* {@link #block} contains the block being broken. <br>
|
||||
* {@link #metadata} contains the metadata of the block being broken. <br>
|
||||
* {@link #state} contains the block being broken. <br>
|
||||
* {@link #originalSpeed} contains the original speed at which the player broke the block. <br>
|
||||
* {@link #newSpeed} contains the newSpeed at which the player will break the block. <br>
|
||||
* {@link #x} contains the x-coordinate at which this event is occurring. <br>
|
||||
* {@link #y} contains the y-coordinate at which this event is occurring. <br>
|
||||
* {@link #z} contains the z-coordinate at which this event is occurring. <br>
|
||||
* {@link #pos} contains the coordinates at which this event is occurring. Y value -1 means location is unknown.<br>
|
||||
* <br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
* If it is canceled, the player is unable to break the block.<br>
|
||||
@@ -78,30 +76,18 @@ public class PlayerEvent extends LivingEvent
|
||||
@Cancelable
|
||||
public static class BreakSpeed extends PlayerEvent
|
||||
{
|
||||
public final Block block;
|
||||
public final int metadata;
|
||||
public final IBlockState state;
|
||||
public final float originalSpeed;
|
||||
public float newSpeed = 0.0f;
|
||||
public final int x;
|
||||
public final int y; // -1 notes unknown location
|
||||
public final int z;
|
||||
public final BlockPos pos; // Y position of -1 notes unknown location
|
||||
|
||||
@Deprecated
|
||||
public BreakSpeed(EntityPlayer player, Block block, int metadata, float original)
|
||||
{
|
||||
this(player, block, metadata, original, 0, -1, 0);
|
||||
}
|
||||
|
||||
public BreakSpeed(EntityPlayer player, Block block, int metadata, float original, int x, int y, int z)
|
||||
public BreakSpeed(EntityPlayer player, IBlockState state, float original, BlockPos pos)
|
||||
{
|
||||
super(player);
|
||||
this.block = block;
|
||||
this.metadata = metadata;
|
||||
this.state = state;
|
||||
this.originalSpeed = original;
|
||||
this.newSpeed = original;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pos = pos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,37 +142,37 @@ public class PlayerEvent extends LivingEvent
|
||||
this.wasDeath = wasDeath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fired when an Entity is started to be "tracked" by this player (the player receives updates about this entity, e.g. motion).
|
||||
*
|
||||
*/
|
||||
public static class StartTracking extends PlayerEvent {
|
||||
|
||||
|
||||
/**
|
||||
* The Entity now being tracked.
|
||||
*/
|
||||
public final Entity target;
|
||||
|
||||
|
||||
public StartTracking(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fired when an Entity is stopped to be "tracked" by this player (the player no longer receives updates about this entity, e.g. motion).
|
||||
*
|
||||
*/
|
||||
public static class StopTracking extends PlayerEvent {
|
||||
|
||||
|
||||
/**
|
||||
* The Entity no longer being tracked.
|
||||
*/
|
||||
public final Entity target;
|
||||
|
||||
|
||||
public StopTracking(EntityPlayer player, Entity target)
|
||||
{
|
||||
super(player);
|
||||
|
||||
@@ -9,13 +9,13 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
*/
|
||||
public class PlayerFlyableFallEvent extends PlayerEvent
|
||||
{
|
||||
|
||||
public float distance;
|
||||
public float multipler;
|
||||
|
||||
public PlayerFlyableFallEvent(EntityPlayer player, float f)
|
||||
public PlayerFlyableFallEvent(EntityPlayer player, float distance, float multiplier)
|
||||
{
|
||||
super(player);
|
||||
this.distance = f;
|
||||
this.distance = distance;
|
||||
this.multipler = multiplier;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import static cpw.mods.fml.common.eventhandler.Event.Result.DEFAULT;
|
||||
import static cpw.mods.fml.common.eventhandler.Event.Result.DENY;
|
||||
import static net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT;
|
||||
import static net.minecraftforge.fml.common.eventhandler.Event.Result.DENY;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
/**
|
||||
* PlayerInteractEvent is fired when a player interacts in some way.
|
||||
@@ -15,13 +17,11 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
* ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float),
|
||||
* ItemInWorldManager#onBlockClicked(int, int, int, int). <br>
|
||||
* <br>
|
||||
* This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, int, int, int, int)}.
|
||||
* This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, BlockPos, EnumFacing)}.
|
||||
* <br>
|
||||
* {@link #action} contains the Action the player performed durin this interaction. <br>
|
||||
* {@link #x} contains the x-coordinate of where this event occurred. <br>
|
||||
* {@link #y} contains the y-coordinate of where this event occurred. <br>
|
||||
* {@link #z} contains the z-coordinate of where this event occurred. <br>
|
||||
* {@link #face} contains the face of the block that was interacted with. <br>
|
||||
* {@link #pos} contains the coordinate of where this event occurred.<br>
|
||||
* {@link #face} contains the face of the block that was interacted with. May be null if unknown. <br>
|
||||
* {@link #world} contains the world in which this event is occurring. <br>
|
||||
* <br>
|
||||
* This event is {@link Cancelable}.<br>
|
||||
@@ -40,35 +40,25 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
RIGHT_CLICK_BLOCK,
|
||||
LEFT_CLICK_BLOCK
|
||||
}
|
||||
|
||||
|
||||
public final Action action;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final int face;
|
||||
public final World world;
|
||||
|
||||
public final BlockPos pos;
|
||||
public final EnumFacing face; // Can be null if unknown
|
||||
|
||||
public Result useBlock = DEFAULT;
|
||||
public Result useItem = DEFAULT;
|
||||
|
||||
@Deprecated
|
||||
public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face)
|
||||
{
|
||||
this(player, action, x, y, z, face, player.worldObj);
|
||||
}
|
||||
|
||||
public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face, World world)
|
||||
public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world)
|
||||
{
|
||||
super(player);
|
||||
this.action = action;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pos = pos;
|
||||
this.face = face;
|
||||
if (face == -1) useBlock = DENY;
|
||||
if (face == null) useBlock = DENY;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCanceled(boolean cancel)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@@ -13,12 +13,12 @@ public class PlayerOpenContainerEvent extends PlayerEvent
|
||||
/**
|
||||
* This event is fired when a player attempts to view a container during
|
||||
* player tick.
|
||||
*
|
||||
*
|
||||
* setResult ALLOW to allow the container to stay open
|
||||
* setResult DENY to force close the container (denying access)
|
||||
*
|
||||
* DEFAULT is vanilla behaviour
|
||||
*
|
||||
*
|
||||
* DEFAULT is vanilla behavior
|
||||
*
|
||||
*/
|
||||
|
||||
public PlayerOpenContainerEvent(EntityPlayer player, Container openContainer)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@ package net.minecraftforge.event.entity.player;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
|
||||
import net.minecraft.util.BlockPos;
|
||||
|
||||
/**
|
||||
* PlayerSleepInBedEvent is fired when a player sleeps in a bed.
|
||||
* <br>
|
||||
* This event is fired whenever a player sleeps in a bed in
|
||||
* EntityPlayer#sleepInBedAt(int, int, int).<br>
|
||||
* EntityPlayer#sleepInBedAt(BlockPos).<br>
|
||||
* <br>
|
||||
* {@link #result} contains whether the player is able to sleep. <br>
|
||||
* <br>
|
||||
@@ -20,16 +21,12 @@ import net.minecraft.entity.player.EntityPlayer.EnumStatus;
|
||||
public class PlayerSleepInBedEvent extends PlayerEvent
|
||||
{
|
||||
public EnumStatus result = null;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final BlockPos pos;
|
||||
|
||||
public PlayerSleepInBedEvent(EntityPlayer player, int x, int y, int z)
|
||||
public PlayerSleepInBedEvent(EntityPlayer player, BlockPos pos)
|
||||
{
|
||||
super(player);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
@Cancelable
|
||||
@Event.HasResult
|
||||
public class UseHoeEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* This event is fired when a player attempts to use a Hoe on a block, it
|
||||
* This event is fired when a player attempts to use a Hoe on a block, it
|
||||
* can be canceled to completely prevent any further processing.
|
||||
*
|
||||
* You can also set the result to ALLOW to mark the event as processed
|
||||
*
|
||||
* You can also set the result to ALLOW to mark the event as processed
|
||||
* and damage the hoe.
|
||||
*
|
||||
*
|
||||
* setResult(ALLOW) is the same as the old setHandeled();
|
||||
*/
|
||||
|
||||
public final ItemStack current;
|
||||
public final World world;
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
public UseHoeEvent(EntityPlayer player, ItemStack current, World world, int x, int y, int z)
|
||||
public final BlockPos pos;
|
||||
|
||||
public UseHoeEvent(EntityPlayer player, ItemStack current, World world, BlockPos pos)
|
||||
{
|
||||
super(player);
|
||||
this.current = current;
|
||||
this.world = world;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.pos = pos;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user