Removed RenderWorldEvent, encapsulated all public event fields.

This commit is contained in:
RainWarrior committed 2016-03-24 22:22:21 +03:00
1 parent 08c00662a0
commit 756c58d5cb
110 files changed
+1642 -680

No files matched your search

@@ -370,25 +370,45 @@ public class ForgeChunkManager
}
public static class ForceChunkEvent extends Event {
public final Ticket ticket;
public final ChunkCoordIntPair location;
private final Ticket ticket;
private final ChunkCoordIntPair location;
public ForceChunkEvent(Ticket ticket, ChunkCoordIntPair location)
{
this.ticket = ticket;
this.location = location;
}
public Ticket getTicket()
{
return ticket;
}
public ChunkCoordIntPair getLocation()
{
return location;
}
}
public static class UnforceChunkEvent extends Event {
public final Ticket ticket;
public final ChunkCoordIntPair location;
private final Ticket ticket;
private final ChunkCoordIntPair location;
public UnforceChunkEvent(Ticket ticket, ChunkCoordIntPair location)
{
this.ticket = ticket;
this.location = location;
}
public Ticket getTicket()
{
return ticket;
}
public ChunkCoordIntPair getLocation()
{
return location;
}
}
@@ -56,7 +56,6 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.WeightedRandom;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
@@ -483,7 +482,7 @@ public class ForgeHooks
public static float[] onLivingFall(EntityLivingBase entity, float distance, float damageMultiplier)
{
LivingFallEvent event = new LivingFallEvent(entity, distance, damageMultiplier);
return (MinecraftForge.EVENT_BUS.post(event) ? null : new float[]{event.distance, event.damageMultiplier});
return (MinecraftForge.EVENT_BUS.post(event) ? null : new float[]{event.getDistance(), event.getDamageMultiplier()});
}
public static boolean isLivingOnLadder(IBlockState state, World world, BlockPos pos, EntityLivingBase entity)
@@ -544,9 +543,9 @@ public class ForgeHooks
if (!player.worldObj.isRemote)
{
player.getEntityWorld().spawnEntityInWorld(event.entityItem);
player.getEntityWorld().spawnEntityInWorld(event.getEntityItem());
}
return event.entityItem;
return event.getEntityItem();
}
public static float getEnchantPower(World world, BlockPos pos)
@@ -648,7 +647,7 @@ public class ForgeHooks
{
PlayerOpenContainerEvent event = new PlayerOpenContainerEvent(player, openContainer);
MinecraftForge.EVENT_BUS.post(event);
return event.getResult() == Event.Result.DEFAULT ? event.canInteractWith : event.getResult() == Event.Result.ALLOW ? true : false;
return event.getResult() == Event.Result.DEFAULT ? event.isCanInteractWith() : event.getResult() == Event.Result.ALLOW ? true : false;
}
public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos)
@@ -800,11 +799,11 @@ public class ForgeHooks
{
AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost);
if (MinecraftForge.EVENT_BUS.post(e)) return false;
if (e.output == null) return true;
if (e.getOutput() == null) return true;
outputSlot.setInventorySlotContents(0, e.output);
container.maximumCost = e.cost;
container.materialCost = e.materialCost;
outputSlot.setInventorySlotContents(0, e.getOutput());
container.maximumCost = e.getCost();
container.materialCost = e.getMaterialCost();
return false;
}
@@ -812,7 +811,7 @@ public class ForgeHooks
{
AnvilRepairEvent e = new AnvilRepairEvent(player, left, right, output);
MinecraftForge.EVENT_BUS.post(e);
return e.breakChance;
return e.getBreakChance();
}
public static boolean onNoteChange(TileEntityNote te, byte old)
@@ -17,12 +17,12 @@ public class ForgeInternalHandler
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onEntityJoinWorld(EntityJoinWorldEvent event)
{
if (!event.world.isRemote)
if (!event.getWorld().isRemote)
{
ForgeChunkManager.loadEntity(event.entity);
ForgeChunkManager.loadEntity(event.getEntity());
}
Entity entity = event.entity;
Entity entity = event.getEntity();
if (entity.getClass().equals(EntityItem.class))
{
ItemStack stack = ((EntityItem)entity).getEntityItem();
@@ -47,12 +47,12 @@ public class ForgeInternalHandler
if (item.hasCustomEntity(stack))
{
Entity newEntity = item.createEntity(event.world, entity, stack);
Entity newEntity = item.createEntity(event.getWorld(), entity, stack);
if (newEntity != null)
{
entity.setDead();
event.setCanceled(true);
event.world.spawnEntityInWorld(newEntity);
event.getWorld().spawnEntityInWorld(newEntity);
}
}
}
@@ -61,20 +61,20 @@ public class ForgeInternalHandler
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDimensionLoad(WorldEvent.Load event)
{
ForgeChunkManager.loadWorld(event.world);
ForgeChunkManager.loadWorld(event.getWorld());
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDimensionSave(WorldEvent.Save event)
{
ForgeChunkManager.saveWorld(event.world);
ForgeChunkManager.saveWorld(event.getWorld());
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDimensionUnload(WorldEvent.Unload event)
{
ForgeChunkManager.unloadWorld(event.world);
if (event.world instanceof WorldServer)
FakePlayerFactory.unloadWorld((WorldServer)event.world);
ForgeChunkManager.unloadWorld(event.getWorld());
if (event.getWorld() instanceof WorldServer)
FakePlayerFactory.unloadWorld((WorldServer) event.getWorld());
}
}