mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-22 05:02:18 +00:00
Cleanup: removed IEEP, removed redundant casts, fixed imports, fixed typos.
This commit is contained in:
1 parent
7e4d7077a5
commit
a9d23f5e78
133 files changed
+489
-623
No files matched your search
@@ -37,7 +37,7 @@ public class AttachCapabilitiesEvent extends Event
|
||||
/**
|
||||
* Adds a capability to be attached to this object.
|
||||
* Keys MUST be unique, it is suggested that you set the domain to your mod ID.
|
||||
* If the capability is an instance of INBTSerializeable, this key will be used when serializing this capability.
|
||||
* If the capability is an instance of INBTSerializable, this key will be used when serializing this capability.
|
||||
*
|
||||
* @param key The name of owner of this capability provider.
|
||||
* @param cap The capability provider
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
@@ -16,7 +15,6 @@ 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;
|
||||
@@ -81,8 +79,8 @@ import net.minecraftforge.event.entity.player.UseHoeEvent;
|
||||
import net.minecraftforge.event.terraingen.ChunkGeneratorEvent;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.MultiPlaceEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.NeighborNotifyEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.PlaceEvent;
|
||||
import net.minecraftforge.event.world.ExplosionEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
@@ -396,9 +394,9 @@ public class ForgeEventFactory
|
||||
return event.result;
|
||||
}
|
||||
|
||||
public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediatly, boolean updateWorldFlag, boolean setSpawn)
|
||||
public static void onPlayerWakeup(EntityPlayer player, boolean wakeImmediately, boolean updateWorldFlag, boolean setSpawn)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediatly, updateWorldFlag, setSpawn));
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerWakeUpEvent(player, wakeImmediately, updateWorldFlag, setSpawn));
|
||||
}
|
||||
|
||||
public static void onPlayerFall(EntityPlayer player, float distance, float multiplier)
|
||||
@@ -447,7 +445,7 @@ public class ForgeEventFactory
|
||||
return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.amount);
|
||||
}
|
||||
|
||||
public static boolean onPotionAttemptBreaw(ItemStack[] stacks)
|
||||
public static boolean onPotionAttemptBrew(ItemStack[] stacks)
|
||||
{
|
||||
ItemStack[] tmp = new ItemStack[stacks.length];
|
||||
for (int x = 0; x < tmp.length; x++)
|
||||
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.entity.item.EntityItem;
|
||||
* Event that is fired when an EntityItem's age has reached its maximum
|
||||
* lifespan. Canceling this event will prevent the EntityItem from being
|
||||
* flagged as dead, thus staying it's removal from the world. If canceled
|
||||
* it will add more time to the entitie's life equal to extraLife.
|
||||
* it will add more time to the entities life equal to extraLife.
|
||||
*/
|
||||
@Cancelable
|
||||
public class ItemExpireEvent extends ItemEvent
|
||||
|
||||
@@ -25,12 +25,15 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
@Cancelable
|
||||
public class LivingAttackEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public final float ammount;
|
||||
public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float ammount)
|
||||
private final DamageSource source;
|
||||
private final float amount;
|
||||
public LivingAttackEvent(EntityLivingBase entity, DamageSource source, float amount)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.ammount = ammount;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public DamageSource getSource() { return source; }
|
||||
public float getAmount() { return amount; }
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package net.minecraftforge.event.entity.living;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
public abstract class LivingEntityUseItemEvent extends LivingEvent
|
||||
{
|
||||
|
||||
@@ -25,13 +25,18 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
@Cancelable
|
||||
public class LivingHurtEvent extends LivingEvent
|
||||
{
|
||||
public final DamageSource source;
|
||||
public float ammount;
|
||||
public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float ammount)
|
||||
private final DamageSource source;
|
||||
private float amount;
|
||||
public LivingHurtEvent(EntityLivingBase entity, DamageSource source, float amount)
|
||||
{
|
||||
super(entity);
|
||||
this.source = source;
|
||||
this.ammount = ammount;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public DamageSource getSource() { return source; }
|
||||
|
||||
public float getAmount() { return amount; }
|
||||
|
||||
public void setAmount(float amount) { this.amount = amount; }
|
||||
}
|
||||
@@ -38,6 +38,7 @@ public class ArrowLooseEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
public ItemStack getBow() { return this.bow; }
|
||||
public World getWorld() { return this.world; }
|
||||
public boolean hasAmmo() { return this.hasAmmo; }
|
||||
public int getCharge() { return this.charge; }
|
||||
public void setCharge(int charge) { this.charge = charge; }
|
||||
|
||||
@@ -31,6 +31,7 @@ public class ArrowNockEvent extends PlayerEvent
|
||||
}
|
||||
|
||||
public ItemStack getBow() { return this.bow; }
|
||||
public World getWorld() { return this.world; }
|
||||
public EnumHand getHand() { return this.hand; }
|
||||
public boolean hasAmmo() { return this.hasAmmo; }
|
||||
public ActionResult<ItemStack> getAction()
|
||||
|
||||
@@ -18,7 +18,7 @@ public class BonemealEvent extends PlayerEvent
|
||||
* 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()
|
||||
* setResult(ALLOW) is the same as the old setHandled()
|
||||
*/
|
||||
|
||||
public final World world;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class FillBucketEvent extends PlayerEvent
|
||||
* If you set the result to 'ALLOW', it means that you have processed
|
||||
* the event and wants the basic functionality of adding the new
|
||||
* ItemStack to your inventory and reducing the stack size to process.
|
||||
* setResult(ALLOW) is the same as the old setHandeled();
|
||||
* setResult(ALLOW) is the same as the old setHandled();
|
||||
*/
|
||||
|
||||
private final ItemStack current;
|
||||
|
||||
@@ -27,7 +27,7 @@ import net.minecraft.util.EnumHand;
|
||||
public class PlayerDestroyItemEvent extends PlayerEvent
|
||||
{
|
||||
private final ItemStack original;
|
||||
private final EnumHand hand; // May be null if this player destroies the item by any use besides holding it.
|
||||
private final EnumHand hand; // May be null if this player destroys the item by any use besides holding it.
|
||||
public PlayerDestroyItemEvent(EntityPlayer player, ItemStack original, EnumHand hand)
|
||||
{
|
||||
super(player);
|
||||
|
||||
@@ -9,13 +9,18 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
*/
|
||||
public class PlayerFlyableFallEvent extends PlayerEvent
|
||||
{
|
||||
public float distance;
|
||||
public float multipler;
|
||||
private float distance;
|
||||
private float multiplier;
|
||||
|
||||
public PlayerFlyableFallEvent(EntityPlayer player, float distance, float multiplier)
|
||||
{
|
||||
super(player);
|
||||
this.distance = distance;
|
||||
this.multipler = multiplier;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public float getDistance() { return distance;}
|
||||
public void setDistance(float distance) { this.distance = distance; }
|
||||
public float getMultiplier() { return multiplier; }
|
||||
public void setMultiplier(float multiplier) { this.multiplier = multiplier; }
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
* <br>
|
||||
* 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 #action} contains the Action the player performed during this interaction. <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>
|
||||
|
||||
@@ -9,29 +9,35 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
*/
|
||||
public class PlayerWakeUpEvent extends PlayerEvent
|
||||
{
|
||||
private final boolean wakeImmediately;
|
||||
|
||||
private final boolean updateWorld;
|
||||
|
||||
private final boolean setSpawn;
|
||||
|
||||
public PlayerWakeUpEvent(EntityPlayer player, boolean wakeImmediately, boolean updateWorld, boolean setSpawn)
|
||||
{
|
||||
super(player);
|
||||
this.wakeImmediately = wakeImmediately;
|
||||
this.updateWorld = updateWorld;
|
||||
this.setSpawn = setSpawn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for the 'wake up animation'.
|
||||
* This is false if the player is considered 'sleepy' and the overlay should slowly fade away.
|
||||
*/
|
||||
public final boolean wakeImmediatly;
|
||||
public boolean wakeImmediately() { return wakeImmediately; }
|
||||
|
||||
/**
|
||||
* Indicates if the server should be notified of sleeping changes.
|
||||
* This will only be false if the server is considered 'up to date' already, because, for example, it initiated the call.
|
||||
*/
|
||||
public final boolean updateWorld;
|
||||
public boolean updateWorld() { return updateWorld; }
|
||||
|
||||
/**
|
||||
* Indicates if the player's sleep was considered successful.
|
||||
* In vanilla, this is used to determine if the spawn chunk is to be set to the bed's position.
|
||||
*/
|
||||
public final boolean setSpawn;
|
||||
|
||||
public PlayerWakeUpEvent(EntityPlayer player, boolean wakeImmediatly, boolean updateWorld, boolean setSpawn)
|
||||
{
|
||||
super(player);
|
||||
this.wakeImmediatly = wakeImmediatly;
|
||||
this.updateWorld = updateWorld;
|
||||
this.setSpawn = setSpawn;
|
||||
}
|
||||
public boolean shouldSetSpawn() { return setSpawn; }
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class UseHoeEvent extends PlayerEvent
|
||||
* 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();
|
||||
* setResult(ALLOW) is the same as the old setHandled();
|
||||
*/
|
||||
|
||||
public final ItemStack current;
|
||||
|
||||
@@ -2,11 +2,11 @@ package net.minecraftforge.event.terraingen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
/**
|
||||
* PopulateChunkEvent is fired when an event involving chunk terrain feature population occurs.<br>
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package net.minecraftforge.event.terraingen;
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.*;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.MapGenBase;
|
||||
import net.minecraft.world.gen.NoiseGenerator;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.*;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.*;
|
||||
import net.minecraftforge.event.terraingen.OreGenEvent.*;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.*;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate;
|
||||
import net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
|
||||
public abstract class TerrainGen
|
||||
{
|
||||
|
||||
@@ -168,7 +168,7 @@ public class BlockEvent extends Event
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of blocksnapshots for all blocks which were replaced by the
|
||||
* Gets a list of BlockSnapshots for all blocks which were replaced by the
|
||||
* placement of the new blocks. Most of these blocks will just be of type AIR.
|
||||
*
|
||||
* @return immutable list of replaced BlockSnapshots
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
package net.minecraftforge.event.world;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.world.BlockEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
/**
|
||||
* Base class for Noteblock Events
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class NoteBlockEvent extends BlockEvent
|
||||
{
|
||||
private int noteId;
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
* If a method utilizes this {@link Event} as its parameter, the method will
|
||||
* receive every child event of this class.<br>
|
||||
* <br>
|
||||
* {@link #world} contains the World this event is occuring in.<br>
|
||||
* {@link #world} contains the World this event is occurring in.<br>
|
||||
* <br>
|
||||
* All children of this event are fired on the {@link MinecraftForge#EVENT_BUS}.<br>
|
||||
**/
|
||||
|
||||
Reference in new issue
Block a user