Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2014-08-13 20:07:01 -05:00
commit b9534bd245
167 changed files with 2452 additions and 3483 deletions

View File

@ -13,7 +13,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -4,8 +4,8 @@ import java.util.HashSet;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.CraftChunk; import org.bukkit.craftbukkit.v1_7_R4.CraftChunk;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
public class BlockRegenerateData public class BlockRegenerateData
{ {
@ -46,7 +46,7 @@ public class BlockRegenerateData
//if (_loc.getBlock().getType() == Material.CHEST) //if (_loc.getBlock().getType() == Material.CHEST)
// return; // return;
net.minecraft.server.v1_7_R3.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle(); net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle();
c.a(_loc.getBlockX() & 0xF, _loc.getBlockY(), _loc.getBlockZ() & 0xF, _id, _data); c.a(_loc.getBlockX() & 0xF, _loc.getBlockY(), _loc.getBlockZ() & 0xF, _id, _data);
((CraftWorld)_loc.getChunk().getWorld()).getHandle().notify(_loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ()); ((CraftWorld)_loc.getChunk().getWorld()).getHandle().notify(_loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ());

View File

@ -5,7 +5,7 @@ import java.util.HashSet;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.CraftChunk; import org.bukkit.craftbukkit.v1_7_R4.CraftChunk;
public class BlockRegenerateSet public class BlockRegenerateSet
{ {
@ -61,7 +61,7 @@ public class BlockRegenerateSet
{ {
for (Chunk chunk : _chunks) for (Chunk chunk : _chunks)
{ {
net.minecraft.server.v1_7_R3.Chunk c = ((CraftChunk)chunk).getHandle(); net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk)chunk).getHandle();
c.initLighting(); c.initLighting();
} }
} }

View File

@ -7,7 +7,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;

View File

@ -11,24 +11,24 @@ import mineplex.core.fakeEntity.FakeEntityManager;
import mineplex.core.fakeEntity.FakePlayer; import mineplex.core.fakeEntity.FakePlayer;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import net.minecraft.server.v1_7_R3.EntityInsentient; import net.minecraft.server.v1_7_R4.EntityInsentient;
import net.minecraft.server.v1_7_R3.EntityLiving; import net.minecraft.server.v1_7_R4.EntityLiving;
import net.minecraft.server.v1_7_R3.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet28EntityVelocity; import net.minecraft.server.v1_7_R4.Packet28EntityVelocity;
import net.minecraft.server.v1_7_R3.Packet31RelEntityMove; import net.minecraft.server.v1_7_R4.Packet31RelEntityMove;
import net.minecraft.server.v1_7_R3.Packet34EntityTeleport; import net.minecraft.server.v1_7_R4.Packet34EntityTeleport;
import net.minecraft.server.v1_7_R3.PathfinderGoalSelector; import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftAgeable; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftAgeable;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;

View File

@ -7,8 +7,8 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.fakeEntity.FakeEntity; import mineplex.core.fakeEntity.FakeEntity;
import net.minecraft.server.v1_7_R3.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R3.Packet28EntityVelocity; import net.minecraft.server.v1_7_R4.Packet28EntityVelocity;
public class UpdateThread extends Thread public class UpdateThread extends Thread
{ {

View File

@ -2,7 +2,7 @@ package me.chiss.Core.Utility;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class InventoryUtil public class InventoryUtil

View File

@ -39,7 +39,7 @@ public class LobbyBalancer implements Listener, Runnable
loadLobbyServers(); loadLobbyServers();
_plugin.getProxy().getPluginManager().registerListener(_plugin, this); _plugin.getProxy().getPluginManager().registerListener(_plugin, this);
_plugin.getProxy().getScheduler().schedule(_plugin, this, 500L, 500L, TimeUnit.MILLISECONDS); _plugin.getProxy().getScheduler().schedule(_plugin, this, 200L, 200L, TimeUnit.MILLISECONDS);
} }
@EventHandler @EventHandler
@ -70,8 +70,7 @@ public class LobbyBalancer implements Listener, Runnable
_bestServerIndex = 0; _bestServerIndex = 0;
_maxPlayersToSendToBestServer = 1; _maxPlayersToSendToBestServer = 1;
// Since we had to enter our dangerzone, update local data so if we have to enter it again we don't pick the same server over and over // Since we had to enter our dangerzone, decrease buffer so we try to hit another server
_sortedLobbies.get(_bestServerIndex).incrementPlayerCount(5);
bungeeBufferNumber -= 2; bungeeBufferNumber -= 2;
if (bungeeBufferNumber <= 0) if (bungeeBufferNumber <= 0)

View File

@ -2,7 +2,7 @@ package mineplex.core.common.util;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class InventoryUtil public class InventoryUtil

View File

@ -7,31 +7,31 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import net.minecraft.server.v1_7_R3.Block; import net.minecraft.server.v1_7_R4.Block;
import net.minecraft.server.v1_7_R3.BlockContainer; import net.minecraft.server.v1_7_R4.BlockContainer;
import net.minecraft.server.v1_7_R3.Blocks; import net.minecraft.server.v1_7_R4.Blocks;
import net.minecraft.server.v1_7_R3.ChunkCoordIntPair; import net.minecraft.server.v1_7_R4.ChunkCoordIntPair;
import net.minecraft.server.v1_7_R3.ChunkSection; import net.minecraft.server.v1_7_R4.ChunkSection;
import net.minecraft.server.v1_7_R3.EnumSkyBlock; import net.minecraft.server.v1_7_R4.EnumSkyBlock;
import net.minecraft.server.v1_7_R3.ExceptionWorldConflict; import net.minecraft.server.v1_7_R4.ExceptionWorldConflict;
import net.minecraft.server.v1_7_R3.IContainer; import net.minecraft.server.v1_7_R4.IContainer;
import net.minecraft.server.v1_7_R3.IProgressUpdate; import net.minecraft.server.v1_7_R4.IProgressUpdate;
import net.minecraft.server.v1_7_R3.MinecraftServer; import net.minecraft.server.v1_7_R4.MinecraftServer;
import net.minecraft.server.v1_7_R3.PacketPlayOutMapChunkBulk; import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk;
import net.minecraft.server.v1_7_R3.PacketPlayOutMultiBlockChange; import net.minecraft.server.v1_7_R4.PacketPlayOutMultiBlockChange;
import net.minecraft.server.v1_7_R3.RegionFile; import net.minecraft.server.v1_7_R4.RegionFile;
import net.minecraft.server.v1_7_R3.RegionFileCache; import net.minecraft.server.v1_7_R4.RegionFileCache;
import net.minecraft.server.v1_7_R3.TileEntity; import net.minecraft.server.v1_7_R4.TileEntity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_7_R3.CraftChunk; import org.bukkit.craftbukkit.v1_7_R4.CraftChunk;
import org.bukkit.craftbukkit.v1_7_R3.CraftServer; import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.event.world.WorldUnloadEvent;
@ -42,7 +42,7 @@ public class MapUtil
{ {
public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer) public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer)
{ {
net.minecraft.server.v1_7_R3.Chunk c = ((CraftChunk) chunk).getHandle(); net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle();
for (int x = 0; x < 16; x++) for (int x = 0; x < 16; x++)
{ {
@ -89,9 +89,9 @@ public class MapUtil
public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data) public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data)
{ {
Chunk chunk = world.getChunkAt(x >> 4, z >> 4); Chunk chunk = world.getChunkAt(x >> 4, z >> 4);
net.minecraft.server.v1_7_R3.Chunk c = ((CraftChunk) chunk).getHandle(); net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle();
c.a(x & 0xF, y, z & 0xF, Block.e(id), data); c.a(x & 0xF, y, z & 0xF, Block.getById(id), data);
((CraftWorld) world).getHandle().notify(x, y, z); ((CraftWorld) world).getHandle().notify(x, y, z);
} }
@ -144,19 +144,19 @@ public class MapUtil
public static void ChunkBlockChange(World world, int x, int y, int z, int id, byte data) public static void ChunkBlockChange(World world, int x, int y, int z, int id, byte data)
{ {
if (changeChunkBlock(x & 15, y, z & 15, ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4), if (changeChunkBlock(x & 15, y, z & 15, ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4),
Block.e(id), data)) Block.getById(id), data))
{ {
((CraftWorld) world).getHandle().notify(x, y, z); ((CraftWorld) world).getHandle().notify(x, y, z);
} }
} }
private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_7_R3.Chunk chunk, Block block, private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_7_R4.Chunk chunk, Block block,
byte data) byte data)
{ {
return chunk.a(x, y, z, block, data); return chunk.a(x, y, z, block, data);
} }
public static void SendChunkForPlayer(net.minecraft.server.v1_7_R3.Chunk chunk, Player player) public static void SendChunkForPlayer(net.minecraft.server.v1_7_R4.Chunk chunk, Player player)
{ {
SendChunkForPlayer(chunk.locX, chunk.locZ, player); SendChunkForPlayer(chunk.locX, chunk.locZ, player);
} }
@ -205,7 +205,7 @@ public class MapUtil
Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld) world).getHandle().getWorld())); Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld) world).getHandle().getWorld()));
Iterator<net.minecraft.server.v1_7_R3.Chunk> chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks Iterator<net.minecraft.server.v1_7_R4.Chunk> chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks
.values().iterator(); .values().iterator();
for (Entity entity : world.getEntities()) for (Entity entity : world.getEntities())
@ -215,7 +215,7 @@ public class MapUtil
while (chunkIterator.hasNext()) while (chunkIterator.hasNext())
{ {
net.minecraft.server.v1_7_R3.Chunk chunk = chunkIterator.next(); net.minecraft.server.v1_7_R4.Chunk chunk = chunkIterator.next();
chunk.removeEntities(); chunk.removeEntities();
} }

View File

@ -37,6 +37,6 @@ public class UtilAction
//Velocity //Velocity
ent.setFallDistance(0); ent.setFallDistance(0);
ent.setVelocity(vec); ent.setVelocity(vec);
} }
} }

View File

@ -3,18 +3,18 @@ package mineplex.core.common.util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import net.minecraft.server.v1_7_R3.DataWatcher; import net.minecraft.server.v1_7_R4.DataWatcher;
import net.minecraft.server.v1_7_R3.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayInClientCommand; import net.minecraft.server.v1_7_R4.PacketPlayInClientCommand;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;

View File

@ -4,32 +4,32 @@ import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import net.minecraft.server.v1_7_R3.EntityBat; import net.minecraft.server.v1_7_R4.EntityBat;
import net.minecraft.server.v1_7_R3.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R3.EntityEnderDragon; import net.minecraft.server.v1_7_R4.EntityEnderDragon;
import net.minecraft.server.v1_7_R3.EntityHuman; import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R3.EntityInsentient; import net.minecraft.server.v1_7_R4.EntityInsentient;
import net.minecraft.server.v1_7_R3.Navigation; import net.minecraft.server.v1_7_R4.Navigation;
import net.minecraft.server.v1_7_R3.PathfinderGoalLookAtPlayer; import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_7_R3.PathfinderGoalMoveTowardsRestriction; import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_7_R3.PathfinderGoalRandomLookaround; import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
import net.minecraft.server.v1_7_R3.PathfinderGoalSelector; import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
public class UtilEnt public class UtilEnt
{ {

View File

@ -2,8 +2,8 @@ package mineplex.core.common.util;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;

View File

@ -2,10 +2,10 @@ package mineplex.core.common.util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles; import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class UtilParticle public class UtilParticle

View File

@ -9,7 +9,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,23 +2,23 @@ package mineplex.core.common.util;
import java.io.File; import java.io.File;
import net.minecraft.server.v1_7_R3.ConvertProgressUpdater; import net.minecraft.server.v1_7_R4.ConvertProgressUpdater;
import net.minecraft.server.v1_7_R3.Convertable; import net.minecraft.server.v1_7_R4.Convertable;
import net.minecraft.server.v1_7_R3.EntityTracker; import net.minecraft.server.v1_7_R4.EntityTracker;
import net.minecraft.server.v1_7_R3.EnumDifficulty; import net.minecraft.server.v1_7_R4.EnumDifficulty;
import net.minecraft.server.v1_7_R3.EnumGamemode; import net.minecraft.server.v1_7_R4.EnumGamemode;
import net.minecraft.server.v1_7_R3.IWorldAccess; import net.minecraft.server.v1_7_R4.IWorldAccess;
import net.minecraft.server.v1_7_R3.ServerNBTManager; import net.minecraft.server.v1_7_R4.ServerNBTManager;
import net.minecraft.server.v1_7_R3.WorldLoaderServer; import net.minecraft.server.v1_7_R4.WorldLoaderServer;
import net.minecraft.server.v1_7_R3.WorldManager; import net.minecraft.server.v1_7_R4.WorldManager;
import net.minecraft.server.v1_7_R3.WorldServer; import net.minecraft.server.v1_7_R4.WorldServer;
import net.minecraft.server.v1_7_R3.WorldSettings; import net.minecraft.server.v1_7_R4.WorldSettings;
import net.minecraft.server.v1_7_R3.WorldType; import net.minecraft.server.v1_7_R4.WorldType;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.craftbukkit.v1_7_R3.CraftServer; import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldInitEvent;
import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
@ -81,7 +81,7 @@ public class WorldUtil
System.out.println("Loaded world with dimension : " + dimension); System.out.println("Loaded world with dimension : " + dimension);
WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, creator.environment(), generator); WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, creator.environment(), generator);
boolean containsWorld = false; boolean containsWorld = false;
for (World otherWorld : server.getWorlds()) for (World otherWorld : server.getWorlds())

View File

@ -7,7 +7,7 @@ import java.sql.SQLException;
import mineplex.core.logger.Logger; import mineplex.core.logger.Logger;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class AntiHackRepository public class AntiHackRepository

View File

@ -8,7 +8,7 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;

View File

@ -90,7 +90,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle); final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
AddButton(36, AddButton(36,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), F.item(gadget.GetName()), new String[] {}, 1, false, false), new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@Override @Override
@ -108,7 +108,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item); final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item);
AddButton(38, AddButton(38,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), F.item(gadget.GetName()), new String[] {}, 1, false, false), new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@Override @Override
@ -123,7 +123,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
if (Plugin.getPetManager().hasActivePet(Player.getName())) if (Plugin.getPetManager().hasActivePet(Player.getName()))
{ {
AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), F.item(Plugin.getPetManager().getActivePet(Player.getName()).getCustomName()), new String[] {}, 1, false, false), AddButton(40, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@Override @Override
@ -141,7 +141,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Mount<?> mount = Plugin.getMountManager().getActive(Player); final Mount<?> mount = Plugin.getMountManager().getActive(Player);
AddButton(42, AddButton(42,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), F.item(mount.GetName()), new String[] {}, 1, false, false), new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), C.mItem + mount.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@Override @Override
@ -159,7 +159,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph); final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
AddButton(44, AddButton(44,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), F.item(gadget.GetName()), new String[] {}, 1, false, false), new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton() new SingleButton()
{ {
@Override @Override

View File

@ -4,13 +4,13 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_7_R3.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R3.Items; import net.minecraft.server.v1_7_R4.Items;
import net.minecraft.server.v1_7_R3.PacketPlayOutOpenWindow; import net.minecraft.server.v1_7_R4.PacketPlayOutOpenWindow;
import net.minecraft.server.v1_7_R3.PacketPlayOutSetSlot; import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -135,7 +135,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory()); entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory());
entityPlayer.activeContainer.windowId = containerCounter; entityPlayer.activeContainer.windowId = containerCounter;
entityPlayer.activeContainer.addSlotListener(entityPlayer); entityPlayer.activeContainer.addSlotListener(entityPlayer);
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R3.ItemStack(Items.NAME_TAG))); entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R4.ItemStack(Items.NAME_TAG)));
Shop.SetCurrentPageForPlayer(Player, petTagPage); Shop.SetCurrentPageForPlayer(Player, petTagPage);
} }

View File

@ -17,8 +17,8 @@ import mineplex.core.pet.repository.token.PetChangeToken;
import mineplex.core.pet.repository.token.PetToken; import mineplex.core.pet.repository.token.PetToken;
import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase; import mineplex.core.shop.page.ShopPageBase;
import net.minecraft.server.v1_7_R3.ItemStack; import net.minecraft.server.v1_7_R4.ItemStack;
import net.minecraft.server.v1_7_R3.Items; import net.minecraft.server.v1_7_R4.Items;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -67,7 +67,7 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
UtilPlayer.message(Player, F.main(Plugin.GetName(), ChatColor.RED + "Pet name cannot be longer than 16 characters.")); UtilPlayer.message(Player, F.main(Plugin.GetName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
PlayDenySound(Player); PlayDenySound(Player);
return; Shop.OpenPageForPlayer(Player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", Player));
} }
PetExtra tag = new PetExtra("Rename " + _pet.GetName() + " to " + _tagName, Material.NAME_TAG, 100); PetExtra tag = new PetExtra("Rename " + _pet.GetName() + " to " + _tagName, Material.NAME_TAG, 100);

View File

@ -21,9 +21,11 @@ import org.bukkit.Material;
import org.bukkit.entity.*; import org.bukkit.entity.*;
import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -31,7 +33,7 @@ import org.bukkit.util.Vector;
public class Creature extends MiniPlugin public class Creature extends MiniPlugin
{ {
private boolean _spawnForce = false; private boolean _spawnForce = false;
private boolean _disableCustom = true; private boolean _disableCustom = false;
public Creature(JavaPlugin plugin) public Creature(JavaPlugin plugin)
{ {
@ -53,6 +55,15 @@ public class Creature extends MiniPlugin
return entity; return entity;
} }
@EventHandler(priority = EventPriority.HIGHEST)
public void eggThrow(PlayerEggThrowEvent event)
{
if (_spawnForce)
return;
event.setHatching(false);
}
@EventHandler @EventHandler
public void Spawn(CreatureSpawnEvent event) public void Spawn(CreatureSpawnEvent event)
{ {

View File

@ -4,7 +4,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;

View File

@ -5,26 +5,26 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_7_R3.ChunkAddEntityEvent; import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent;
import net.minecraft.server.v1_7_R3.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutAnimation; import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
import net.minecraft.server.v1_7_R3.PacketPlayOutNamedEntitySpawn; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityVelocity; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R3.PacketPlayOutRelEntityMove; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_7_R3.PacketPlayOutRelEntityMoveLook; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_7_R3.PacketPlayOutUpdateAttributes; import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityEquipment; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_7_R3.PacketPlayOutNamedSoundEffect; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;

View File

@ -1,13 +1,13 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import net.minecraft.server.v1_7_R3.DataWatcher; import net.minecraft.server.v1_7_R4.DataWatcher;
import net.minecraft.server.v1_7_R3.Entity; import net.minecraft.server.v1_7_R4.Entity;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
public abstract class DisguiseBase public abstract class DisguiseBase
{ {

View File

@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises;
import java.util.Random; import java.util.Random;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
public class DisguiseBlock extends DisguiseBase public class DisguiseBlock extends DisguiseBase
{ {

View File

@ -1,9 +1,9 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_7_R3.EnumEntitySize; import net.minecraft.server.v1_7_R4.EnumEntitySize;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
import org.bukkit.entity.*; import org.bukkit.entity.*;
public abstract class DisguiseCreature extends DisguiseInsentient public abstract class DisguiseCreature extends DisguiseInsentient

View File

@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises;
import java.util.Arrays; import java.util.Arrays;
import net.minecraft.server.v1_7_R3.MobEffect; import net.minecraft.server.v1_7_R4.MobEffect;
import net.minecraft.server.v1_7_R3.MobEffectList; import net.minecraft.server.v1_7_R4.MobEffectList;
import net.minecraft.server.v1_7_R3.PotionBrewer; import net.minecraft.server.v1_7_R4.PotionBrewer;
import org.bukkit.entity.*; import org.bukkit.entity.*;
public class DisguiseEnderman extends DisguiseMonster public class DisguiseEnderman extends DisguiseMonster

View File

@ -3,8 +3,8 @@ package mineplex.core.disguise.disguises;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityEquipment; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
public abstract class DisguiseInsentient extends DisguiseLiving public abstract class DisguiseInsentient extends DisguiseLiving
{ {
@ -56,11 +56,11 @@ public abstract class DisguiseInsentient extends DisguiseLiving
public List<Packet> getArmorPackets() public List<Packet> getArmorPackets()
{ {
List<PacketPlayOutEntityEquipment> p5 = new ArrayList<PacketPlayOutEntityEquipment>(); List<PacketPlayOutEntityEquipment> p5 = new ArrayList<PacketPlayOutEntityEquipment>();
net.minecraft.server.v1_7_R3.ItemStack[] armorContents = Entity.getEquipment(); net.minecraft.server.v1_7_R4.ItemStack[] armorContents = Entity.getEquipment();
for (short i=0; i < armorContents.length; i++) for (short i=0; i < armorContents.length; i++)
{ {
net.minecraft.server.v1_7_R3.ItemStack armorSlot = armorContents[i]; net.minecraft.server.v1_7_R4.ItemStack armorSlot = armorContents[i];
if (armorSlot != null) if (armorSlot != null)
{ {

View File

@ -1,9 +1,9 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_7_R3.EnumEntitySize; import net.minecraft.server.v1_7_R4.EnumEntitySize;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
public class DisguiseMagmaCube extends DisguiseInsentient public class DisguiseMagmaCube extends DisguiseInsentient
{ {

View File

@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutNamedEntitySpawn; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
import net.minecraft.util.com.mojang.authlib.GameProfile; import net.minecraft.util.com.mojang.authlib.GameProfile;
public class DisguisePlayer extends DisguiseHuman public class DisguisePlayer extends DisguiseHuman

View File

@ -1,9 +1,9 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_7_R3.EnumEntitySize; import net.minecraft.server.v1_7_R4.EnumEntitySize;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
public class DisguiseSlime extends DisguiseInsentient public class DisguiseSlime extends DisguiseInsentient
{ {

View File

@ -1,6 +1,6 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_7_R3.BlockCloth; import net.minecraft.server.v1_7_R4.BlockCloth;
import org.bukkit.entity.*; import org.bukkit.entity.*;
public class DisguiseWolf extends DisguiseTameableAnimal public class DisguiseWolf extends DisguiseTameableAnimal

View File

@ -1,8 +1,8 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_7_R3.Entity; import net.minecraft.server.v1_7_R4.Entity;
import net.minecraft.server.v1_7_R3.NBTTagCompound; import net.minecraft.server.v1_7_R4.NBTTagCompound;
import net.minecraft.server.v1_7_R3.World; import net.minecraft.server.v1_7_R4.World;
public class DummyEntity extends Entity public class DummyEntity extends Entity
{ {

View File

@ -2,22 +2,22 @@ package mineplex.core.fakeEntity;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R3.BlockCloth; import net.minecraft.server.v1_7_R4.BlockCloth;
import net.minecraft.server.v1_7_R3.DataWatcher; import net.minecraft.server.v1_7_R4.DataWatcher;
import net.minecraft.server.v1_7_R3.Entity; import net.minecraft.server.v1_7_R4.Entity;
import net.minecraft.server.v1_7_R3.EntityLiving; import net.minecraft.server.v1_7_R4.EntityLiving;
import net.minecraft.server.v1_7_R3.EntitySlime; import net.minecraft.server.v1_7_R4.EntitySlime;
import net.minecraft.server.v1_7_R3.EnumEntitySize; import net.minecraft.server.v1_7_R4.EnumEntitySize;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R3.PacketPlayOutAttachEntity; import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
public class FakeEntity public class FakeEntity

View File

@ -3,9 +3,9 @@ package mineplex.core.fakeEntity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,9 +1,9 @@
package mineplex.core.fakeEntity; package mineplex.core.fakeEntity;
import net.minecraft.server.v1_7_R3.EnumEntitySize; import net.minecraft.server.v1_7_R4.EnumEntitySize;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;

View File

@ -1,13 +1,13 @@
package mineplex.core.fakeEntity; package mineplex.core.fakeEntity;
import net.minecraft.server.v1_7_R3.DataWatcher; import net.minecraft.server.v1_7_R4.DataWatcher;
import net.minecraft.server.v1_7_R3.ItemStack; import net.minecraft.server.v1_7_R4.ItemStack;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntity; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
public class FakeItemDrop extends FakeEntity public class FakeItemDrop extends FakeEntity
@ -75,7 +75,7 @@ public class FakeItemDrop extends FakeEntity
dataWatcher.a(1, Short.valueOf((short)300)); dataWatcher.a(1, Short.valueOf((short)300));
dataWatcher.a(8, Integer.valueOf(0)); dataWatcher.a(8, Integer.valueOf(0));
dataWatcher.a(9, Byte.valueOf((byte) 0)); dataWatcher.a(9, Byte.valueOf((byte) 0));
dataWatcher.a(10, new net.minecraft.server.v1_7_R3.ItemStack(_itemStack.getItem(), _itemStack.count)); dataWatcher.a(10, new net.minecraft.server.v1_7_R4.ItemStack(_itemStack.getItem(), _itemStack.count));
} }
public void SetItemStack(org.bukkit.inventory.ItemStack itemStack) public void SetItemStack(org.bukkit.inventory.ItemStack itemStack)

View File

@ -3,16 +3,16 @@ package mineplex.core.fakeEntity;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_7_R3.DataWatcher; import net.minecraft.server.v1_7_R4.DataWatcher;
import net.minecraft.server.v1_7_R3.EntitySlime; import net.minecraft.server.v1_7_R4.EntitySlime;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutNamedEntitySpawn; import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
import net.minecraft.util.com.mojang.authlib.GameProfile; import net.minecraft.util.com.mojang.authlib.GameProfile;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
public class FakePlayer extends FakeEntity public class FakePlayer extends FakeEntity

View File

@ -1,7 +1,7 @@
package mineplex.core.friend; package mineplex.core.friend;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

View File

@ -1,7 +1,7 @@
package mineplex.core.friend.ui; package mineplex.core.friend.ui;
import net.minecraft.server.v1_7_R3.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R3.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
public class LineTracker public class LineTracker
{ {

View File

@ -2,10 +2,10 @@ package mineplex.core.friend.ui;
import java.util.HashSet; import java.util.HashSet;
import net.minecraft.server.v1_7_R3.EntityPlayer; import net.minecraft.server.v1_7_R4.EntityPlayer;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;

View File

@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilTime;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Monster; import org.bukkit.entity.Monster;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -2,13 +2,13 @@ package mineplex.core.memory;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.server.v1_7_R3.CraftingManager; import net.minecraft.server.v1_7_R4.CraftingManager;
import net.minecraft.server.v1_7_R3.IInventory; import net.minecraft.server.v1_7_R4.IInventory;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;

View File

@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilEnt;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEnderDragon; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon;
import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -8,12 +8,12 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_7_R3.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R3.Navigation; import net.minecraft.server.v1_7_R4.Navigation;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -6,7 +6,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;

View File

@ -1,9 +1,9 @@
package mineplex.core.npc; package mineplex.core.npc;
import net.minecraft.server.v1_7_R3.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.Location; import org.bukkit.Location;
public class NpcEntry public class NpcEntry

View File

@ -11,15 +11,15 @@ import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_7_R3.EntityAgeable; import net.minecraft.server.v1_7_R4.EntityAgeable;
import net.minecraft.server.v1_7_R3.EntityInsentient; import net.minecraft.server.v1_7_R4.EntityInsentient;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftAgeable; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftAgeable;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;

View File

@ -2,7 +2,7 @@ package mineplex.core.packethandler;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
public interface IPacketRunnable public interface IPacketRunnable
{ {

View File

@ -5,9 +5,9 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;

View File

@ -1,14 +1,14 @@
package mineplex.core.packethandler; package mineplex.core.packethandler;
import net.minecraft.server.v1_7_R3.IPacketVerifier; import net.minecraft.server.v1_7_R4.IPacketVerifier;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityVelocity; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
import net.minecraft.server.v1_7_R3.PacketPlayOutRelEntityMove; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_7_R3.PacketPlayOutRelEntityMoveLook; import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
import net.minecraft.server.v1_7_R3.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PacketVerifier implements IPacketVerifier public class PacketVerifier implements IPacketVerifier

View File

@ -18,13 +18,13 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import net.minecraft.server.v1_7_R3.EntityCreature; import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R3.EntityHuman; import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R3.EntityInsentient; import net.minecraft.server.v1_7_R4.EntityInsentient;
import net.minecraft.server.v1_7_R3.Navigation; import net.minecraft.server.v1_7_R4.Navigation;
import net.minecraft.server.v1_7_R3.PathfinderGoalLookAtPlayer; import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_7_R3.PathfinderGoalRandomLookaround; import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
import net.minecraft.server.v1_7_R3.PathfinderGoalSelector; import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
@ -39,8 +39,8 @@ import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.libs.com.google.gson.Gson; import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;

View File

@ -7,19 +7,19 @@ import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseSquid; import mineplex.core.disguise.disguises.DisguiseSquid;
import net.minecraft.server.v1_7_R3.AxisAlignedBB; import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R3.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R3.MovingObjectPosition; import net.minecraft.server.v1_7_R4.MovingObjectPosition;
import net.minecraft.server.v1_7_R3.Vec3D; import net.minecraft.server.v1_7_R4.Vec3D;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -106,7 +106,7 @@ public class ProjectileUser
double distanceToEntity = 0.0D; double distanceToEntity = 0.0D;
LivingEntity victim = null; LivingEntity victim = null;
net.minecraft.server.v1_7_R3.Entity nmsEntity = ((CraftEntity)_thrown).getHandle(); net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity)_thrown).getHandle();
Vec3D vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ); Vec3D vec3d = Vec3D.a(nmsEntity.locX, nmsEntity.locY, nmsEntity.locZ);
Vec3D vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ); Vec3D vec3d1 = Vec3D.a(nmsEntity.locX + nmsEntity.motX, nmsEntity.locY + nmsEntity.motY, nmsEntity.locZ + nmsEntity.motZ);
@ -121,9 +121,9 @@ public class ProjectileUser
for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().getEntities(((CraftEntity)_thrown).getHandle(), ((CraftEntity)_thrown).getHandle().boundingBox.a(((CraftEntity)_thrown).getHandle().motX, ((CraftEntity)_thrown).getHandle().motY, ((CraftEntity)_thrown).getHandle().motZ).grow(1.0D, 1.0D, 1.0D))) for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().getEntities(((CraftEntity)_thrown).getHandle(), ((CraftEntity)_thrown).getHandle().boundingBox.a(((CraftEntity)_thrown).getHandle().motX, ((CraftEntity)_thrown).getHandle().motY, ((CraftEntity)_thrown).getHandle().motZ).grow(1.0D, 1.0D, 1.0D)))
{ {
if (entity instanceof net.minecraft.server.v1_7_R3.Entity) if (entity instanceof net.minecraft.server.v1_7_R4.Entity)
{ {
Entity bukkitEntity = ((net.minecraft.server.v1_7_R3.Entity) entity).getBukkitEntity(); Entity bukkitEntity = ((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity();
if (bukkitEntity instanceof LivingEntity) if (bukkitEntity instanceof LivingEntity)
{ {

View File

@ -22,7 +22,7 @@ import mineplex.core.shop.item.ShopItem;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventoryCustom; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;

View File

@ -5,7 +5,7 @@ import java.util.List;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import net.minecraft.server.v1_7_R3.IInventory; import net.minecraft.server.v1_7_R4.IInventory;
public interface ISalesPackage public interface ISalesPackage
{ {

View File

@ -5,10 +5,10 @@ import java.util.List;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.common.util.InventoryUtil; import mineplex.core.common.util.InventoryUtil;
import net.minecraft.server.v1_7_R3.IInventory; import net.minecraft.server.v1_7_R4.IInventory;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;

View File

@ -1,12 +1,12 @@
package mineplex.core.shop.item; package mineplex.core.shop.item;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import net.minecraft.server.v1_7_R3.NBTTagList; import net.minecraft.server.v1_7_R4.NBTTagList;
import net.minecraft.server.v1_7_R3.NBTTagString; import net.minecraft.server.v1_7_R4.NBTTagString;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class ShopItem extends CraftItemStack public class ShopItem extends CraftItemStack
@ -122,8 +122,8 @@ public class ShopItem extends CraftItemStack
return false; return false;
} }
net.minecraft.server.v1_7_R3.ItemStack original = ((CraftItemStack)this).getHandle(); net.minecraft.server.v1_7_R4.ItemStack original = ((CraftItemStack)this).getHandle();
net.minecraft.server.v1_7_R3.ItemStack comparison = ((CraftItemStack)obj).getHandle(); net.minecraft.server.v1_7_R4.ItemStack comparison = ((CraftItemStack)obj).getHandle();
return original.tag == null || original.tag.equals(comparison.tag); return original.tag == null || original.tag.equals(comparison.tag);
} }

View File

@ -1,16 +1,16 @@
package mineplex.core.shop.page; package mineplex.core.shop.page;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventoryDoubleChest; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryDoubleChest;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventoryPlayer; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryPlayer;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventoryView; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryView;
import net.minecraft.server.v1_7_R3.Container; import net.minecraft.server.v1_7_R4.Container;
import net.minecraft.server.v1_7_R3.EntityHuman; import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R3.IInventory; import net.minecraft.server.v1_7_R4.IInventory;
import net.minecraft.server.v1_7_R3.InventoryLargeChest; import net.minecraft.server.v1_7_R4.InventoryLargeChest;
import net.minecraft.server.v1_7_R3.PlayerInventory; import net.minecraft.server.v1_7_R4.PlayerInventory;
import net.minecraft.server.v1_7_R3.Slot; import net.minecraft.server.v1_7_R4.Slot;
public class AnvilContainer extends Container public class AnvilContainer extends Container
{ {

View File

@ -1,8 +1,8 @@
package mineplex.core.shop.page; package mineplex.core.shop.page;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventoryCustom; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;

View File

@ -1,6 +1,6 @@
package mineplex.core.sound; package mineplex.core.sound;
import net.minecraft.server.v1_7_R3.Packet; import net.minecraft.server.v1_7_R4.Packet;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;

View File

@ -7,7 +7,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;

View File

@ -4,7 +4,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;

View File

@ -349,7 +349,7 @@ public class ClientClass
for (SkillType type : SkillType.values()) for (SkillType type : SkillType.values())
if (caller.isOp() || type != SkillType.Class) if (caller.isOp() || type != SkillType.Class)
if (_skillMap.containsKey(type)) if (_skillMap.containsKey(type))
UtilPlayer.message(caller, F.desc(type.toString(), _skillMap.get(type).GetName())); UtilPlayer.message(caller, F.desc(type.toString(), _skillMap.get(type).GetName() + " Lvl" + _skillMap.get(type).getLevel(caller)));
} }
public void ResetSkills(Player player) public void ResetSkills(Player player)

View File

@ -13,7 +13,7 @@ import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;

View File

@ -53,7 +53,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
try try
{ {
_itemMaxDurability = net.minecraft.server.v1_7_R3.Item.class.getDeclaredField("durability"); _itemMaxDurability = net.minecraft.server.v1_7_R4.Item.class.getDeclaredField("durability");
_itemMaxDurability.setAccessible(true); _itemMaxDurability.setAccessible(true);
} }
catch (SecurityException e) catch (SecurityException e)
@ -189,7 +189,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory
try try
{ {
_itemMaxDurability.setInt(net.minecraft.server.v1_7_R3.Item.d(newItem.GetType().getId()), 56); _itemMaxDurability.setInt(net.minecraft.server.v1_7_R4.Item.getById(newItem.GetType().getId()), 56);
} }
catch (IllegalArgumentException e) catch (IllegalArgumentException e)
{ {

View File

@ -3,7 +3,7 @@ package mineplex.minecraft.game.classcombat.item;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;

View File

@ -7,7 +7,7 @@ import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -7,7 +7,7 @@ import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -4,7 +4,7 @@ import org.bukkit.Effect;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;

View File

@ -1,7 +1,7 @@
package mineplex.minecraft.game.classcombat.shop; package mineplex.minecraft.game.classcombat.shop;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;

View File

@ -3,9 +3,9 @@ package mineplex.minecraft.game.core.combat;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.server.v1_7_R3.ItemStack; import net.minecraft.server.v1_7_R4.ItemStack;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Fireball; import org.bukkit.entity.Fireball;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;

View File

@ -19,7 +19,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
public class ConditionEffect implements Listener public class ConditionEffect implements Listener
{ {

View File

@ -17,16 +17,16 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.npc.NpcManager; import mineplex.core.npc.NpcManager;
import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener;
import net.minecraft.server.v1_7_R3.DamageSource; import net.minecraft.server.v1_7_R4.DamageSource;
import net.minecraft.server.v1_7_R3.EntityHuman; import net.minecraft.server.v1_7_R4.EntityHuman;
import net.minecraft.server.v1_7_R3.EntityLiving; import net.minecraft.server.v1_7_R4.EntityLiving;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Fish; import org.bukkit.entity.Fish;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -64,7 +64,7 @@ public class DamageManager extends MiniPlugin
{ {
_lastDamageByPlayerTime = EntityLiving.class.getDeclaredField("lastDamageByPlayerTime"); _lastDamageByPlayerTime = EntityLiving.class.getDeclaredField("lastDamageByPlayerTime");
_lastDamageByPlayerTime.setAccessible(true); _lastDamageByPlayerTime.setAccessible(true);
_k = EntityLiving.class.getDeclaredMethod("h", float.class); _k = EntityLiving.class.getDeclaredMethod("damageArmor", float.class);
_k.setAccessible(true); _k.setAccessible(true);
} }
catch (final Exception e) catch (final Exception e)
@ -276,7 +276,7 @@ public class DamageManager extends MiniPlugin
//Sticky Arrow //Sticky Arrow
if (event.GetCause() == DamageCause.PROJECTILE) if (event.GetCause() == DamageCause.PROJECTILE)
((CraftLivingEntity)event.GetDamageeEntity()).getHandle().p(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().aY() + 1); ((CraftLivingEntity)event.GetDamageeEntity()).getHandle().p(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().aZ() + 1);
//Knockback //Knockback
double knockback = event.GetDamage(); double knockback = event.GetDamage();
@ -478,7 +478,7 @@ public class DamageManager extends MiniPlugin
{ {
if (!ignoreArmor) if (!ignoreArmor)
{ {
int j = 25 - entityLiving.aU(); int j = 25 - entityLiving.aV();
float k = damage * (float)j; float k = damage * (float)j;
_k.invoke(entityLiving, damage); _k.invoke(entityLiving, damage);

View File

@ -27,7 +27,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
public class Fire extends MiniPlugin public class Fire extends MiniPlugin
{ {

View File

@ -1,467 +0,0 @@
package net.minecraft.server.v1_7_R3;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
public class EnchantmentManager
{
private static final Random random = new Random();
public static int getEnchantmentLevel(int paramInt, ItemStack paramItemStack)
{
if (paramItemStack == null)
{
return 0;
}
NBTTagList localNBTTagList = paramItemStack.getEnchantments();
if (localNBTTagList == null)
{
return 0;
}
for (int i = 0; i < localNBTTagList.size(); i++)
{
int j = localNBTTagList.get(i).getShort("id");
int k = localNBTTagList.get(i).getShort("lvl");
if (j == paramInt)
{
return k;
}
}
return 0;
}
public static Map a(ItemStack paramItemStack)
{
LinkedHashMap localLinkedHashMap = new LinkedHashMap();
NBTTagList localNBTTagList = paramItemStack.getItem() == Items.ENCHANTED_BOOK ? Items.ENCHANTED_BOOK
.g(paramItemStack) : paramItemStack.getEnchantments();
if (localNBTTagList != null)
{
for (int i = 0; i < localNBTTagList.size(); i++)
{
int j = localNBTTagList.get(i).getShort("id");
int k = localNBTTagList.get(i).getShort("lvl");
localLinkedHashMap.put(Integer.valueOf(j), Integer.valueOf(k));
}
}
return localLinkedHashMap;
}
public static void a(Map paramMap, ItemStack paramItemStack)
{
NBTTagList localNBTTagList = new NBTTagList();
for (Iterator localIterator = paramMap.keySet().iterator(); localIterator.hasNext();)
{
int i = ((Integer) localIterator.next()).intValue();
NBTTagCompound localNBTTagCompound = new NBTTagCompound();
localNBTTagCompound.setShort("id", (short) i);
localNBTTagCompound.setShort("lvl", (short) ((Integer) paramMap.get(Integer.valueOf(i))).intValue());
localNBTTagList.add(localNBTTagCompound);
if (paramItemStack.getItem() == Items.ENCHANTED_BOOK)
{
Items.ENCHANTED_BOOK.a(paramItemStack,
new EnchantmentInstance(i, ((Integer) paramMap.get(Integer.valueOf(i))).intValue()));
}
}
if (localNBTTagList.size() > 0)
{
if (paramItemStack.getItem() != Items.ENCHANTED_BOOK)
{
paramItemStack.a("ench", localNBTTagList);
}
}
else if (paramItemStack.hasTag())
{
paramItemStack.getTag().remove("ench");
}
}
public static int getEnchantmentLevel(int paramInt, ItemStack[] paramArrayOfItemStack)
{
if (paramArrayOfItemStack == null)
{
return 0;
}
int i = 0;
for (ItemStack localItemStack : paramArrayOfItemStack)
{
int m = getEnchantmentLevel(paramInt, localItemStack);
if (m > i)
{
i = m;
}
}
return i;
}
private static void a(EnchantmentModifier paramEnchantmentModifier, ItemStack paramItemStack)
{
if (paramItemStack == null)
{
return;
}
NBTTagList localNBTTagList = paramItemStack.getEnchantments();
if (localNBTTagList == null)
{
return;
}
for (int i = 0; i < localNBTTagList.size(); i++)
{
int j = localNBTTagList.get(i).getShort("id");
int k = localNBTTagList.get(i).getShort("lvl");
if (Enchantment.byId[j] != null)
{
paramEnchantmentModifier.a(Enchantment.byId[j], k);
}
}
}
private static void a(EnchantmentModifier paramEnchantmentModifier, ItemStack[] paramArrayOfItemStack)
{
for (ItemStack localItemStack : paramArrayOfItemStack)
{
a(paramEnchantmentModifier, localItemStack);
}
}
private static EnchantmentModifierProtection b = null;
public static int a(ItemStack[] paramArrayOfItemStack, DamageSource paramDamageSource)
{
if (b == null)
{
try
{
Constructor<EnchantmentModifierProtection> constructor = EnchantmentModifierProtection.class.getDeclaredConstructor();
constructor.setAccessible(true);
b = constructor.newInstance();
}
catch (Exception e)
{
e.printStackTrace();
}
}
b.a = 0;
b.b = paramDamageSource;
a(b, paramArrayOfItemStack);
if (b.a > 25)
{
b.a = 25;
}
b.b = null;
return (b.a + 1 >> 1) + random.nextInt((b.a >> 1) + 1);
}
private static EnchantmentModifierDamage c = null;
public static float a(EntityLiving paramEntityLiving1, EntityLiving paramEntityLiving2)
{
return a(paramEntityLiving1.bd(), paramEntityLiving2.getMonsterType());
}
public static float a(ItemStack paramItemStack, EnumMonsterType paramEnumMonsterType)
{
if (c == null)
{
try
{
Constructor<EnchantmentModifierDamage> constructor = EnchantmentModifierDamage.class.getDeclaredConstructor();
constructor.setAccessible(true);
c = constructor.newInstance();
}
catch (Exception e)
{
e.printStackTrace();
}
}
c.a = 0.0F;
c.b = paramEnumMonsterType;
a(c, paramItemStack);
c.b = null;
return c.a;
}
private static EnchantmentModifierThorns d = null;
public static void a(EntityLiving paramEntityLiving, Entity paramEntity)
{
if (d == null)
{
try
{
Constructor<EnchantmentModifierThorns> constructor = EnchantmentModifierThorns.class.getDeclaredConstructor();
constructor.setAccessible(true);
d = constructor.newInstance();
}
catch (Exception e)
{
e.printStackTrace();
}
}
d.b = paramEntity;
d.a = paramEntityLiving;
a(d, paramEntityLiving.getEquipment());
if ((paramEntity instanceof EntityHuman))
{
a(d, paramEntityLiving.bd());
}
d.a = null;
d.b = null;
}
private static EnchantmentModifierArthropods e = null;
public static void b(EntityLiving paramEntityLiving, Entity paramEntity)
{
if (e == null)
{
try
{
Constructor<EnchantmentModifierArthropods> constructor = EnchantmentModifierArthropods.class.getDeclaredConstructor();
constructor.setAccessible(true);
e = constructor.newInstance();
}
catch (Exception e)
{
e.printStackTrace();
}
}
e.a = paramEntityLiving;
e.b = paramEntity;
a(e, paramEntityLiving.getEquipment());
if ((paramEntityLiving instanceof EntityHuman))
{
a(e, paramEntityLiving.bd());
}
e.a = null;
e.b = null;
}
public static int getKnockbackEnchantmentLevel(EntityLiving paramEntityLiving1, EntityLiving paramEntityLiving2)
{
return getEnchantmentLevel(Enchantment.KNOCKBACK.id, paramEntityLiving1.bd());
}
public static int getFireAspectEnchantmentLevel(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, paramEntityLiving.bd());
}
public static int getOxygenEnchantmentLevel(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.OXYGEN.id, paramEntityLiving.getEquipment());
}
public static int getDigSpeedEnchantmentLevel(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.DIG_SPEED.id, paramEntityLiving.bd());
}
public static boolean hasSilkTouchEnchantment(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, paramEntityLiving.bd()) > 0;
}
public static int getBonusBlockLootEnchantmentLevel(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, paramEntityLiving.bd());
}
public static int getLuckEnchantmentLevel(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.LUCK.id, paramEntityLiving.bd());
}
public static int getLureEnchantmentLevel(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.LURE.id, paramEntityLiving.bd());
}
public static int getBonusMonsterLootEnchantmentLevel(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, paramEntityLiving.bd());
}
public static boolean hasWaterWorkerEnchantment(EntityLiving paramEntityLiving)
{
return getEnchantmentLevel(Enchantment.WATER_WORKER.id, paramEntityLiving.getEquipment()) > 0;
}
public static ItemStack a(Enchantment paramEnchantment, EntityLiving paramEntityLiving)
{
for (ItemStack localItemStack : paramEntityLiving.getEquipment())
{
if ((localItemStack != null) && (getEnchantmentLevel(paramEnchantment.id, localItemStack) > 0))
{
return localItemStack;
}
}
return null;
}
public static int a(Random paramRandom, int paramInt1, int paramInt2, ItemStack paramItemStack)
{
Item localItem = paramItemStack.getItem();
int i = localItem.c();
if (i <= 0)
{
return 0;
}
if (paramInt2 > 15)
{
paramInt2 = 15;
}
int j = paramRandom.nextInt(8) + 1 + (paramInt2 >> 1) + paramRandom.nextInt(paramInt2 + 1);
if (paramInt1 == 0)
{
return Math.max(j / 3, 1);
}
if (paramInt1 == 1)
{
return j * 2 / 3 + 1;
}
return Math.max(j, paramInt2 * 2);
}
public static ItemStack a(Random paramRandom, ItemStack paramItemStack, int paramInt)
{
List localList = b(paramRandom, paramItemStack, paramInt);
int i = paramItemStack.getItem() == Items.BOOK ? 1 : 0;
if (i != 0)
{
paramItemStack.setItem(Items.ENCHANTED_BOOK);
}
if (localList != null)
{
for (EnchantmentInstance localEnchantmentInstance : (List<EnchantmentInstance>)localList)
{
if (i != 0)
{
Items.ENCHANTED_BOOK.a(paramItemStack, localEnchantmentInstance);
}
else
{
paramItemStack.addEnchantment(localEnchantmentInstance.enchantment, localEnchantmentInstance.level);
}
}
}
return paramItemStack;
}
public static List b(Random paramRandom, ItemStack paramItemStack, int paramInt)
{
Item localItem = paramItemStack.getItem();
int i = localItem.c();
if (i <= 0)
{
return null;
}
i /= 2;
i = 1 + paramRandom.nextInt((i >> 1) + 1) + paramRandom.nextInt((i >> 1) + 1);
int j = i + paramInt;
float f = (paramRandom.nextFloat() + paramRandom.nextFloat() - 1.0F) * 0.15F;
int k = (int) (j * (1.0F + f) + 0.5F);
if (k < 1)
{
k = 1;
}
ArrayList localArrayList = null;
Map localMap = b(k, paramItemStack);
if ((localMap != null) && (!localMap.isEmpty()))
{
EnchantmentInstance localEnchantmentInstance1 = (EnchantmentInstance) WeightedRandom.a(paramRandom,
localMap.values());
if (localEnchantmentInstance1 != null)
{
localArrayList = new ArrayList();
localArrayList.add(localEnchantmentInstance1);
int m = k;
while (paramRandom.nextInt(50) <= m)
{
Iterator localIterator1 = localMap.keySet().iterator();
Object localObject;
while (localIterator1.hasNext())
{
localObject = (Integer) localIterator1.next();
int n = 1;
for (EnchantmentInstance localEnchantmentInstance2 : (List<EnchantmentInstance>)localArrayList)
{
if (!localEnchantmentInstance2.enchantment.a(Enchantment.byId[((Integer)localObject).intValue()]))
{
n = 0;
break;
}
}
if (n == 0)
{
localIterator1.remove();
}
}
if (!localMap.isEmpty())
{
localObject = (EnchantmentInstance) WeightedRandom.a(paramRandom, localMap.values());
localArrayList.add(localObject);
}
m >>= 1;
}
}
}
return localArrayList;
}
public static Map b(int paramInt, ItemStack paramItemStack)
{
Item localItem = paramItemStack.getItem();
HashMap localHashMap = null;
int i = paramItemStack.getItem() == Items.BOOK ? 1 : 0;
for (Enchantment localEnchantment : Enchantment.byId)
{
if (localEnchantment != null)
{
if ((localEnchantment.slot.canEnchant(localItem)) || (i != 0))
{
for (int m = localEnchantment.getStartLevel(); m <= localEnchantment.getMaxLevel(); m++)
{
if ((paramInt >= localEnchantment.a(m)) && (paramInt <= localEnchantment.b(m)))
{
if (localHashMap == null)
{
localHashMap = new HashMap();
}
localHashMap.put(Integer.valueOf(localEnchantment.id), new EnchantmentInstance(
localEnchantment, m));
}
}
}
}
}
return localHashMap;
}
}

View File

@ -1,162 +0,0 @@
package net.minecraft.server.v1_7_R3;
public class EntityBlaze extends EntityMonster {
private float bp = 0.5F;
private int bq;
private int br;
public EntityBlaze(World world) {
super(world);
this.fireProof = true;
this.b = 10;
}
protected void aC() {
super.aC();
this.getAttributeInstance(GenericAttributes.e).setValue(6.0D);
}
protected void c() {
super.c();
this.datawatcher.a(16, new Byte((byte) 0));
}
protected String t() {
return "mob.blaze.breathe";
}
protected String aS() {
return "mob.blaze.hit";
}
protected String aT() {
return "mob.blaze.death";
}
public float d(float f) {
return 1.0F;
}
public void e() {
if (!this.world.isStatic) {
if (this.K()) {
this.damageEntity(DamageSource.DROWN, 1.0F);
}
--this.bq;
if (this.bq <= 0) {
this.bq = 100;
this.bp = 0.5F + (float) this.random.nextGaussian() * 3.0F;
}
if (this.bT() != null && this.bT().locY + (double) this.bT().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
}
}
if (this.random.nextInt(24) == 0) {
this.world.makeSound(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F);
}
if (!Vegetated && !this.onGround && this.motY < 0.0D) {
this.motY *= 0.6D;
}
for (int i = 0; i < 2; ++i) {
this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D);
}
super.e();
}
protected void a(Entity entity, float f) {
if (Vegetated)
return;
if (this.attackTicks <= 0 && f < 2.0F && entity.boundingBox.e > this.boundingBox.b && entity.boundingBox.b < this.boundingBox.e) {
this.attackTicks = 20;
this.n(entity);
} else if (f < 30.0F) {
double d0 = entity.locX - this.locX;
double d1 = entity.boundingBox.b + (double) (entity.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
double d2 = entity.locZ - this.locZ;
if (this.attackTicks == 0) {
++this.br;
if (this.br == 1) {
this.attackTicks = 60;
this.a(true);
} else if (this.br <= 4) {
this.attackTicks = 6;
} else {
this.attackTicks = 100;
this.br = 0;
this.a(false);
}
if (this.br > 1) {
float f1 = MathHelper.c(f) * 0.5F;
this.world.a((EntityHuman) null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
for (int i = 0; i < 1; ++i) {
EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.world, this, d0 + this.random.nextGaussian() * (double) f1, d1, d2 + this.random.nextGaussian() * (double) f1);
entitysmallfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
this.world.addEntity(entitysmallfireball);
}
}
}
this.yaw = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.bn = true;
}
}
protected void b(float f) {}
protected Item getLoot() {
return Items.BLAZE_ROD;
}
public boolean isBurning() {
return this.bZ();
}
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
if (flag) {
int j = this.random.nextInt(2 + i);
if (j > 0) {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.v1_7_R3.util.CraftMagicNumbers.getMaterial(Items.BLAZE_ROD), j));
}
}
org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
}
public boolean bZ() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
public void a(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
b0 = (byte) (b0 | 1);
} else {
b0 &= -2;
}
this.datawatcher.watch(16, Byte.valueOf(b0));
}
protected boolean j_() {
return true;
}
}

View File

@ -1,116 +0,0 @@
package net.minecraft.server.v1_7_R3;
public class FoodMetaData {
// CraftBukkit start - All made public
public int foodLevel = 20;
public float saturationLevel = 7.0F;
public float exhaustionLevel;
public int foodTickTimer;
private EntityHuman entityhuman;
// CraftBukkit end
private int e = 20;
public FoodMetaData() { throw new AssertionError("Whoopsie, we missed the bukkit."); } // CraftBukkit start - throw an error
// CraftBukkit start - added EntityHuman constructor
public FoodMetaData(EntityHuman entityhuman) {
org.apache.commons.lang.Validate.notNull(entityhuman);
this.entityhuman = entityhuman;
}
// CraftBukkit end
public void eat(int i, float f) {
this.foodLevel = Math.min(i + this.foodLevel, 20);
this.saturationLevel = Math.min(this.saturationLevel + (float) i * f * 2.0F, (float) this.foodLevel);
}
public void a(ItemFood itemfood, ItemStack itemstack) {
// CraftBukkit start
int oldFoodLevel = foodLevel;
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, itemfood.getNutrition(itemstack) + oldFoodLevel);
if (!event.isCancelled()) {
this.eat(event.getFoodLevel() - oldFoodLevel, itemfood.getSaturationModifier(itemstack));
}
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
// CraftBukkit end
}
public void a(EntityHuman entityhuman) {
EnumDifficulty enumdifficulty = entityhuman.world.difficulty;
this.e = this.foodLevel;
if (this.exhaustionLevel > 4.0F) {
this.exhaustionLevel -= 4.0F;
if (this.saturationLevel > 0.0F) {
this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F);
} else if (enumdifficulty != EnumDifficulty.PEACEFUL) {
// CraftBukkit start
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, Math.max(this.foodLevel - 1, 0));
if (!event.isCancelled()) {
this.foodLevel = event.getFoodLevel();
}
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), this.foodLevel, this.saturationLevel));
// CraftBukkit end
}
}
if (entityhuman.world.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && entityhuman.bQ()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason
entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
this.a(3.0F);
this.foodTickTimer = 0;
}
} else if (this.foodLevel <= 0) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
if (entityhuman.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || entityhuman.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) {
entityhuman.damageEntity(DamageSource.STARVE, 1.0F);
}
this.foodTickTimer = 0;
}
} else {
this.foodTickTimer = 0;
}
}
public void a(NBTTagCompound nbttagcompound) {
if (nbttagcompound.hasKeyOfType("foodLevel", 99)) {
this.foodLevel = nbttagcompound.getInt("foodLevel");
this.foodTickTimer = nbttagcompound.getInt("foodTickTimer");
this.saturationLevel = nbttagcompound.getFloat("foodSaturationLevel");
this.exhaustionLevel = nbttagcompound.getFloat("foodExhaustionLevel");
}
}
public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setInt("foodLevel", this.foodLevel);
nbttagcompound.setInt("foodTickTimer", this.foodTickTimer);
nbttagcompound.setFloat("foodSaturationLevel", this.saturationLevel);
nbttagcompound.setFloat("foodExhaustionLevel", this.exhaustionLevel);
}
public int a() {
return this.foodLevel;
}
public boolean c() {
return this.foodLevel < 20;
}
public void a(float f) {
this.exhaustionLevel = Math.min(this.exhaustionLevel + f, 40.0F);
}
public float e() {
return this.saturationLevel;
}
}

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -35,12 +35,40 @@ public class Chunk {
public boolean m; public boolean m;
public boolean n; public boolean n;
public boolean o; public boolean o;
public long p; public long lastSaved;
public boolean q; public boolean q;
public int r; public int r;
public long s; public long s;
private int x; private int x;
protected gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot protected net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap<Class> entityCount = new net.minecraft.util.gnu.trove.map.hash.TObjectIntHashMap<Class>(); // Spigot
// CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking
private int neighbors = 0x1 << 12;
public boolean areNeighborsLoaded(final int radius) {
switch(radius) {
case 2:
return this.neighbors == Integer.MAX_VALUE >> 6;
case 1:
final int mask =
// x z offset x z offset x z offset
( 0x1 << (1 * 5 + 1 + 12) ) | ( 0x1 << (0 * 5 + 1 + 12) ) | ( 0x1 << (-1 * 5 + 1 + 12) ) |
( 0x1 << (1 * 5 + 0 + 12) ) | ( 0x1 << (0 * 5 + 0 + 12) ) | ( 0x1 << (-1 * 5 + 0 + 12) ) |
( 0x1 << (1 * 5 + -1 + 12) ) | ( 0x1 << (0 * 5 + -1 + 12) ) | ( 0x1 << (-1 * 5 + -1 + 12) );
return (this.neighbors & mask) == mask;
default:
throw new UnsupportedOperationException(String.valueOf(radius));
}
}
public void setNeighborLoaded(final int x, final int z) {
this.neighbors |= 0x1 << (x * 5 + 12 + z);
}
public void setNeighborUnloaded(final int x, final int z) {
this.neighbors &= ~(0x1 << (x * 5 + 12 + z));
}
// CraftBukkit end
public Chunk(World world, int i, int j) { public Chunk(World world, int i, int j) {
this.sections = new ChunkSection[16]; this.sections = new ChunkSection[16];
@ -56,7 +84,7 @@ public class Chunk {
this.heightMap = new int[256]; this.heightMap = new int[256];
for (int k = 0; k < this.entitySlices.length; ++k) { for (int k = 0; k < this.entitySlices.length; ++k) {
this.entitySlices[k] = new org.bukkit.craftbukkit.v1_7_R3.util.UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList this.entitySlices[k] = new org.bukkit.craftbukkit.v1_7_R4.util.UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
} }
Arrays.fill(this.b, -999); Arrays.fill(this.b, -999);
@ -64,7 +92,7 @@ public class Chunk {
// CraftBukkit start // CraftBukkit start
if (!(this instanceof EmptyChunk)) { if (!(this instanceof EmptyChunk)) {
this.bukkitChunk = new org.bukkit.craftbukkit.v1_7_R3.CraftChunk(this); this.bukkitChunk = new org.bukkit.craftbukkit.v1_7_R4.CraftChunk(this);
} }
} }
@ -140,7 +168,7 @@ public class Chunk {
return 0; return 0;
} }
public ChunkSection[] i() { public ChunkSection[] getSections() {
return this.sections; return this.sections;
} }
@ -399,13 +427,13 @@ public class Chunk {
} }
// Spigot start - prevent invalid data values // Spigot start - prevent invalid data values
private static int checkData( Block block, int l ) public static int checkData( Block block, int data )
{ {
if (block == Block.b( "minecraft:double_plant" ) ) if (block == Blocks.DOUBLE_PLANT )
{ {
return l == 7 ? 0 : l; return data < 6 || data >= 8 ? data : 0;
} }
return l; return data;
} }
// Spigot end // Spigot end
@ -725,10 +753,15 @@ public class Chunk {
tileentity.t(); tileentity.t();
this.tileEntities.put(chunkposition, tileentity); this.tileEntities.put(chunkposition, tileentity);
// Spigot start - The tile entity has a world, now hoppers can be born ticking.
if (this.world.spigotConfig.altHopperTicking) {
this.world.triggerHoppersList.add(tileentity);
}
// Spigot end
// CraftBukkit start // CraftBukkit start
} else { } else {
System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z
+ " (" + org.bukkit.craftbukkit.v1_7_R3.util.CraftMagicNumbers.getMaterial(getType(i, j, k)) + ") where there was no entity tile!"); + " (" + org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers.getMaterial(getType(i, j, k)) + ") where there was no entity tile!");
System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16));
new Exception().printStackTrace(); new Exception().printStackTrace();
// CraftBukkit end // CraftBukkit end
@ -757,7 +790,7 @@ public class Chunk {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
entity.W(); entity.X();
} }
this.world.a(this.entitySlices[i]); this.world.a(this.entitySlices[i]);
@ -773,9 +806,12 @@ public class Chunk {
// Spigot Start // Spigot Start
if ( tileentity instanceof IInventory ) if ( tileentity instanceof IInventory )
{ {
for ( org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity h : new ArrayList<org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity>( (List) ( (IInventory) tileentity ).getViewers() ) ) for ( org.bukkit.entity.HumanEntity h : new ArrayList<org.bukkit.entity.HumanEntity>( (List) ( (IInventory) tileentity ).getViewers() ) )
{ {
h.getHandle().closeInventory(); if ( h instanceof org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity )
{
( (org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity) h).getHandle().closeInventory();
}
} }
} }
// Spigot End // Spigot End
@ -791,9 +827,12 @@ public class Chunk {
// Spigot Start // Spigot Start
if ( entity instanceof IInventory ) if ( entity instanceof IInventory )
{ {
for ( org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity h : new ArrayList<org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity>( (List) ( (IInventory) entity ).getViewers() ) ) for ( org.bukkit.entity.HumanEntity h : new ArrayList<org.bukkit.entity.HumanEntity>( (List) ( (IInventory) entity ).getViewers() ) )
{ {
h.getHandle().closeInventory(); if ( h instanceof org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity )
{
( (org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity) h).getHandle().closeInventory();
}
} }
} }
// Spigot End // Spigot End
@ -829,7 +868,7 @@ public class Chunk {
if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) { if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1); list.add(entity1);
Entity[] aentity = entity1.as(); Entity[] aentity = entity1.at();
if (aentity != null) { if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) { for (int i1 = 0; i1 < aentity.length; ++i1) {
@ -866,10 +905,10 @@ public class Chunk {
public boolean a(boolean flag) { public boolean a(boolean flag) {
if (flag) { if (flag) {
if (this.o && this.world.getTime() != this.p || this.n) { if (this.o && this.world.getTime() != this.lastSaved || this.n) {
return true; return true;
} }
} else if (this.o && this.world.getTime() >= this.p + 600L) { } else if (this.o && this.world.getTime() >= this.lastSaved + 600L) {
return true; return true;
} }
@ -884,7 +923,8 @@ public class Chunk {
return false; return false;
} }
public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { public void loadNearby(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
world.timings.syncChunkLoadPostTimer.startTiming(); // Spigot
if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) { if (!this.done && ichunkprovider.isChunkLoaded(i + 1, j + 1) && ichunkprovider.isChunkLoaded(i, j + 1) && ichunkprovider.isChunkLoaded(i + 1, j)) {
ichunkprovider.getChunkAt(ichunkprovider1, i, j); ichunkprovider.getChunkAt(ichunkprovider1, i, j);
} }
@ -900,6 +940,7 @@ public class Chunk {
if (ichunkprovider.isChunkLoaded(i - 1, j - 1) && !ichunkprovider.getOrCreateChunk(i - 1, j - 1).done && ichunkprovider.isChunkLoaded(i, j - 1) && ichunkprovider.isChunkLoaded(i - 1, j)) { if (ichunkprovider.isChunkLoaded(i - 1, j - 1) && !ichunkprovider.getOrCreateChunk(i - 1, j - 1).done && ichunkprovider.isChunkLoaded(i, j - 1) && ichunkprovider.isChunkLoaded(i - 1, j)) {
ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1); ichunkprovider.getChunkAt(ichunkprovider1, i - 1, j - 1);
} }
world.timings.syncChunkLoadPostTimer.stopTiming(); // Spigot
} }
public int d(int i, int j) { public int d(int i, int j) {
@ -939,7 +980,7 @@ public class Chunk {
} }
} }
public boolean k() { public boolean isReady() {
// Spigot Start // Spigot Start
/* /*
* As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client. * As of 1.7, Mojang added a check to make sure that only chunks which have been lit are sent to the client.
@ -979,7 +1020,7 @@ public class Chunk {
this.sections = achunksection; this.sections = achunksection;
} }
public BiomeBase a(int i, int j, WorldChunkManager worldchunkmanager) { public BiomeBase getBiome(int i, int j, WorldChunkManager worldchunkmanager) {
int k = this.v[j << 4 | i] & 255; int k = this.v[j << 4 | i] & 255;
if (k == 255) { if (k == 255) {
@ -1136,4 +1177,4 @@ public class Chunk {
return true; return true;
} }
} }

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -16,10 +16,10 @@ import org.apache.logging.log4j.Logger;
import java.util.Random; import java.util.Random;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.v1_7_R3.chunkio.ChunkIOExecutor; import org.bukkit.craftbukkit.v1_7_R4.chunkio.ChunkIOExecutor;
import org.bukkit.craftbukkit.v1_7_R3.util.LongHash; import org.bukkit.craftbukkit.v1_7_R4.util.LongHash;
import org.bukkit.craftbukkit.v1_7_R3.util.LongHashSet; import org.bukkit.craftbukkit.v1_7_R4.util.LongHashSet;
import org.bukkit.craftbukkit.v1_7_R3.util.LongObjectHashMap; import org.bukkit.craftbukkit.v1_7_R4.util.LongObjectHashMap;
import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.ChunkUnloadEvent;
// CraftBukkit end // CraftBukkit end
@ -94,6 +94,10 @@ public class ChunkProviderServer implements IChunkProvider {
} }
// CraftBukkit start - Add async variant, provide compatibility // CraftBukkit start - Add async variant, provide compatibility
public Chunk getChunkIfLoaded(int x, int z) {
return this.chunks.get(LongHash.toLong(x, z));
}
public Chunk getChunkAt(int i, int j) { public Chunk getChunkAt(int i, int j) {
return getChunkAt(i, j, null); return getChunkAt(i, j, null);
} }
@ -183,7 +187,7 @@ public class ChunkProviderServer implements IChunkProvider {
} }
if (chunk == null) { if (chunk == null) {
org.bukkit.craftbukkit.v1_7_R3.SpigotTimings.syncChunkLoadTimer.startTiming(); // Spigot world.timings.syncChunkLoadTimer.startTiming(); // Spigot
chunk = this.loadChunk(i, j); chunk = this.loadChunk(i, j);
if (chunk == null) { if (chunk == null) {
if (this.chunkProvider == null) { if (this.chunkProvider == null) {
@ -216,9 +220,24 @@ public class ChunkProviderServer implements IChunkProvider {
*/ */
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk)); server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk));
} }
// Update neighbor counts
for (int x = -2; x < 3; x++) {
for (int z = -2; z < 3; z++) {
if (x == 0 && z == 0) {
continue;
}
Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborLoaded(-x, -z);
chunk.setNeighborLoaded(x, z);
}
}
}
// CraftBukkit end // CraftBukkit end
chunk.a(this, this, i, j); chunk.loadNearby(this, this, i, j);
org.bukkit.craftbukkit.v1_7_R3.SpigotTimings.syncChunkLoadTimer.stopTiming(); // Spigot world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
} }
return chunk; return chunk;
@ -249,9 +268,11 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = this.f.a(this.world, i, j); Chunk chunk = this.f.a(this.world, i, j);
if (chunk != null) { if (chunk != null) {
chunk.p = this.world.getTime(); chunk.lastSaved = this.world.getTime();
if (this.chunkProvider != null) { if (this.chunkProvider != null) {
world.timings.syncChunkLoadStructuresTimer.startTiming(); // Spigot
this.chunkProvider.recreateStructures(i, j); this.chunkProvider.recreateStructures(i, j);
world.timings.syncChunkLoadStructuresTimer.stopTiming(); // Spigot
} }
} }
@ -276,7 +297,7 @@ public class ChunkProviderServer implements IChunkProvider {
public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public
if (this.f != null) { if (this.f != null) {
try { try {
chunk.p = this.world.getTime(); chunk.lastSaved = this.world.getTime();
this.f.a(this.world, chunk); this.f.a(this.world, chunk);
// CraftBukkit start - IOException to Exception // CraftBukkit start - IOException to Exception
} catch (Exception ioexception) { } catch (Exception ioexception) {
@ -378,6 +399,21 @@ public class ChunkProviderServer implements IChunkProvider {
// this.unloadQueue.remove(olong); // this.unloadQueue.remove(olong);
// this.chunks.remove(olong.longValue()); // this.chunks.remove(olong.longValue());
// Update neighbor counts
for (int x = -2; x < 3; x++) {
for (int z = -2; z < 3; z++) {
if (x == 0 && z == 0) {
continue;
}
Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
}
}
}
} }
} }
// CraftBukkit end // CraftBukkit end
@ -408,9 +444,9 @@ public class ChunkProviderServer implements IChunkProvider {
} }
public int getLoadedChunks() { public int getLoadedChunks() {
// CraftBukkit - this.chunks.count() -> .values().size() // CraftBukkit - this.chunks.count() -> this.chunks.size()
return this.chunks.values().size(); return this.chunks.size();
} }
public void recreateStructures(int i, int j) {} public void recreateStructures(int i, int j) {}
} }

View File

@ -1,8 +1,8 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
// CraftBukkit start // CraftBukkit start
import java.util.List; import java.util.List;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
// CraftBukkit end // CraftBukkit end

View File

@ -0,0 +1,512 @@
package net.minecraft.server.v1_7_R4;
import java.io.File;
import java.io.PrintStream;
import java.net.InetAddress;
import java.net.Proxy;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.logging.Handler;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.bukkit.craftbukkit.libs.joptsimple.OptionSet;
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
import org.bukkit.craftbukkit.v1_7_R4.LoggerOutputStream;
import org.bukkit.craftbukkit.v1_7_R4.SpigotTimings;
import org.bukkit.craftbukkit.v1_7_R4.command.CraftRemoteConsoleCommandSender;
import org.bukkit.craftbukkit.v1_7_R4.util.ForwardLogHandler;
import org.bukkit.craftbukkit.v1_7_R4.util.TerminalConsoleWriterThread;
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.plugin.PluginLoadOrder;
import org.bukkit.plugin.PluginManager;
import org.spigotmc.CustomTimingsHandler;
import org.spigotmc.SpigotConfig;
public class DedicatedServer
extends MinecraftServer
implements IMinecraftServer
{
private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger();
private final List j = Collections.synchronizedList(new ArrayList());
private RemoteStatusListener k;
private RemoteControlListener l;
public PropertyManager propertyManager;
private boolean generateStructures;
private EnumGamemode p;
private boolean q;
public DedicatedServer(OptionSet options)
{
super(options, Proxy.NO_PROXY);
new ThreadSleepForever(this, "Server Infinisleeper");
}
protected boolean init()
throws UnknownHostException
{
ThreadCommandReader threadcommandreader = new ThreadCommandReader(this, "Server console handler");
threadcommandreader.setDaemon(true);
threadcommandreader.start();
java.util.logging.Logger global = java.util.logging.Logger.getLogger("");
global.setUseParentHandlers(false);
for (Handler handler : global.getHandlers()) {
global.removeHandler(handler);
}
global.addHandler(new ForwardLogHandler());
org.apache.logging.log4j.core.Logger logger = (org.apache.logging.log4j.core.Logger)LogManager.getRootLogger();
for (Appender appender : logger.getAppenders().values()) {
if ((appender instanceof ConsoleAppender)) {
logger.removeAppender(appender);
}
}
new Thread(new TerminalConsoleWriterThread(System.out, this.reader)).start();
System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true));
logger.info("Starting minecraft server version 1.7.10");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
logger.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
logger.info("Loading properties");
this.propertyManager = new PropertyManager(this.options);
if (N())
{
c("127.0.0.1");
}
else
{
setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
c(this.propertyManager.getString("server-ip", ""));
}
setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
setSpawnNPCs(this.propertyManager.getBoolean("spawn-npcs", true));
setPvP(this.propertyManager.getBoolean("pvp", true));
setAllowFlight(this.propertyManager.getBoolean("allow-flight", false));
setTexturePack(this.propertyManager.getString("resource-pack", ""));
setMotd(this.propertyManager.getString("motd", "A Minecraft Server"));
setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false));
setIdleTimeout(this.propertyManager.getInt("player-idle-timeout", 0));
if (this.propertyManager.getInt("difficulty", 1) < 0) {
this.propertyManager.setProperty("difficulty", Integer.valueOf(0));
} else if (this.propertyManager.getInt("difficulty", 1) > 3) {
this.propertyManager.setProperty("difficulty", Integer.valueOf(3));
}
this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
int gamemode = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.getId());
this.p = WorldSettings.a(gamemode);
logger.info("Default game type: " + this.p);
InetAddress inetaddress = null;
if (getServerIp().length() > 0) {
inetaddress = InetAddress.getByName(getServerIp());
}
if (L() < 0) {
setPort(this.propertyManager.getInt("server-port", 25565));
}
a(new DedicatedPlayerList(this));
SpigotConfig.init();
SpigotConfig.registerCommands();
logger.info("Generating keypair");
a(MinecraftEncryption.b());
logger.info("Starting Minecraft server on " + (getServerIp().length() == 0 ? "*" : getServerIp()) + ":" + L());
if (!SpigotConfig.lateBind) {
try
{
ai().a(inetaddress, L());
}
catch (Throwable ioexception)
{
logger.warn("**** FAILED TO BIND TO PORT!");
logger.warn("The exception was: {}", new Object[] { ioexception.toString() });
logger.warn("Perhaps a server is already running on that port?");
return false;
}
}
this.server.loadPlugins();
this.server.enablePlugins(PluginLoadOrder.STARTUP);
if (!getOnlineMode())
{
logger.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
logger.warn("The server will make no attempt to authenticate usernames. Beware.");
logger.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
logger.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
if (aE()) {
getUserCache().c();
}
if (!NameReferencingFileConverter.a(this.propertyManager)) {
return false;
}
this.convertable = new WorldLoaderServer(this.server.getWorldContainer());
long j = System.nanoTime();
if (O() == null) {
k(this.propertyManager.getString("level-name", "world"));
}
String s = this.propertyManager.getString("level-seed", "");
String s1 = this.propertyManager.getString("level-type", "DEFAULT");
String s2 = this.propertyManager.getString("generator-settings", "");
long k = new Random().nextLong();
if (s.length() > 0) {
try
{
long l = Long.parseLong(s);
if (l != 0L) {
k = l;
}
}
catch (NumberFormatException numberformatexception)
{
k = s.hashCode();
}
}
WorldType worldtype = WorldType.getType(s1);
if (worldtype == null) {
worldtype = WorldType.NORMAL;
}
at();
getEnableCommandBlock();
l();
getSnooperEnabled();
c(this.propertyManager.getInt("max-build-height", 256));
c((getMaxBuildHeight() + 8) / 16 * 16);
c(MathHelper.a(getMaxBuildHeight(), 64, 256));
this.propertyManager.setProperty("max-build-height", Integer.valueOf(getMaxBuildHeight()));
logger.info("Preparing level \"" + O() + "\"");
a(O(), O(), k, worldtype, s2);
long i1 = System.nanoTime() - j;
String s3 = String.format("%.3fs", new Object[] { Double.valueOf(i1 / 1000000000.0D) });
logger.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
if (this.propertyManager.getBoolean("enable-query", false))
{
logger.info("Starting GS4 status listener");
this.k = new RemoteStatusListener(this);
this.k.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false))
{
logger.info("Starting remote control listener");
this.l = new RemoteControlListener(this);
this.l.a();
this.remoteConsole = new CraftRemoteConsoleCommandSender();
}
if (this.server.getBukkitSpawnRadius() > -1)
{
logger.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
this.propertyManager.properties.remove("spawn-protection");
this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
this.server.removeBukkitSpawnRadius();
this.propertyManager.savePropertiesFile();
}
if (SpigotConfig.lateBind) {
try
{
ai().a(inetaddress, L());
}
catch (Throwable ioexception)
{
logger.warn("**** FAILED TO BIND TO PORT!");
logger.warn("The exception was: {}", new Object[] { ioexception.toString() });
logger.warn("Perhaps a server is already running on that port?");
return false;
}
}
return true;
}
public PropertyManager getPropertyManager()
{
return this.propertyManager;
}
public boolean getGenerateStructures()
{
return this.generateStructures;
}
public EnumGamemode getGamemode()
{
return this.p;
}
public EnumDifficulty getDifficulty()
{
return EnumDifficulty.getById(this.propertyManager.getInt("difficulty", 1));
}
public boolean isHardcore()
{
return this.propertyManager.getBoolean("hardcore", false);
}
protected void a(CrashReport crashreport) {}
public CrashReport b(CrashReport crashreport)
{
crashreport = super.b(crashreport);
crashreport.g().a("Is Modded", new CrashReportModded(this));
crashreport.g().a("Type", new CrashReportType(this));
return crashreport;
}
protected void t()
{
System.exit(0);
}
public void v()
{
super.v();
aB();
}
public boolean getAllowNether()
{
return this.propertyManager.getBoolean("allow-nether", true);
}
public boolean getSpawnMonsters()
{
return this.propertyManager.getBoolean("spawn-monsters", true);
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator)
{
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(aC().getHasWhitelist()));
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(aC().getWhitelisted().length));
super.a(mojangstatisticsgenerator);
}
public boolean getSnooperEnabled()
{
return this.propertyManager.getBoolean("snooper-enabled", true);
}
public void issueCommand(String s, ICommandListener icommandlistener)
{
this.j.add(new ServerCommand(s, icommandlistener));
}
public void aB()
{
SpigotTimings.serverCommandTimer.startTiming();
while (!this.j.isEmpty())
{
ServerCommand servercommand = (ServerCommand)this.j.remove(0);
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
this.server.getPluginManager().callEvent(event);
servercommand = new ServerCommand(event.getCommand(), servercommand.source);
this.server.dispatchServerCommand(this.console, servercommand);
}
SpigotTimings.serverCommandTimer.stopTiming();
}
public boolean X()
{
return true;
}
public DedicatedPlayerList aC()
{
return (DedicatedPlayerList)super.getPlayerList();
}
public int a(String s, int i)
{
return this.propertyManager.getInt(s, i);
}
public String a(String s, String s1)
{
return this.propertyManager.getString(s, s1);
}
public boolean a(String s, boolean flag)
{
return this.propertyManager.getBoolean(s, flag);
}
public void a(String s, Object object)
{
this.propertyManager.setProperty(s, object);
}
public void a()
{
this.propertyManager.savePropertiesFile();
}
public String b()
{
File file1 = this.propertyManager.c();
return file1 != null ? file1.getAbsolutePath() : "No settings file";
}
public void aD()
{
ServerGUI.a(this);
this.q = true;
}
public boolean ak()
{
return this.q;
}
public String a(EnumGamemode enumgamemode, boolean flag)
{
return "";
}
public boolean getEnableCommandBlock()
{
return this.propertyManager.getBoolean("enable-command-block", false);
}
public int getSpawnProtection()
{
return this.propertyManager.getInt("spawn-protection", super.getSpawnProtection());
}
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman)
{
if (world.worldProvider.dimension != 0) {
return false;
}
if (aC().getOPs().isEmpty()) {
return false;
}
if (aC().isOp(entityhuman.getProfile())) {
return false;
}
if (getSpawnProtection() <= 0) {
return false;
}
ChunkCoordinates chunkcoordinates = world.getSpawn();
int l = MathHelper.a(i - chunkcoordinates.x);
int i1 = MathHelper.a(k - chunkcoordinates.z);
int j1 = Math.max(l, i1);
return j1 <= getSpawnProtection();
}
public int l()
{
return this.propertyManager.getInt("op-permission-level", 4);
}
public void setIdleTimeout(int i)
{
super.setIdleTimeout(i);
this.propertyManager.setProperty("player-idle-timeout", Integer.valueOf(i));
a();
}
public boolean m()
{
return this.propertyManager.getBoolean("broadcast-rcon-to-ops", true);
}
public boolean at()
{
return this.propertyManager.getBoolean("announce-player-achievements", true);
}
protected boolean aE()
{
this.server.getLogger().info("**** Beginning UUID conversion, this may take A LONG time ****");
boolean flag = false;
for (int i = 0; (!flag) && (i <= 2); i++)
{
if (i > 0)
{
logger.warn("Encountered a problem while converting the user banlist, retrying in a few seconds");
aG();
}
flag = NameReferencingFileConverter.a(this);
}
boolean flag1 = false;
for (int i = 0; (!flag1) && (i <= 2); i++)
{
if (i > 0)
{
logger.warn("Encountered a problem while converting the ip banlist, retrying in a few seconds");
aG();
}
flag1 = NameReferencingFileConverter.b(this);
}
boolean flag2 = false;
for (int i = 0; (!flag2) && (i <= 2); i++)
{
if (i > 0)
{
logger.warn("Encountered a problem while converting the op list, retrying in a few seconds");
aG();
}
flag2 = NameReferencingFileConverter.c(this);
}
boolean flag3 = false;
for (int i = 0; (!flag3) && (i <= 2); i++)
{
if (i > 0)
{
logger.warn("Encountered a problem while converting the whitelist, retrying in a few seconds");
aG();
}
flag3 = NameReferencingFileConverter.d(this);
}
boolean flag4 = false;
for (int i = 0; (!flag4) && (i <= 2); i++)
{
if (i > 0)
{
logger.warn("Encountered a problem while converting the player save files, retrying in a few seconds");
aG();
}
flag4 = NameReferencingFileConverter.a(this, this.propertyManager);
}
return (flag) || (flag1) || (flag2) || (flag3) || (flag4);
}
private void aG()
{
try
{
Thread.sleep(5000L);
}
catch (InterruptedException interruptedexception) {}
}
public PlayerList getPlayerList()
{
return aC();
}
static org.apache.logging.log4j.Logger aF()
{
return logger;
}
}

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -22,12 +22,11 @@ import org.bukkit.event.painting.PaintingBreakByEntityEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityPortalEvent; import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
// CraftBukkit end // CraftBukkit end
@ -47,7 +46,7 @@ public abstract class Entity {
public boolean k; public boolean k;
public Entity passenger; public Entity passenger;
public Entity vehicle; public Entity vehicle;
public boolean n; public boolean attachedToPlayer;
public World world; public World world;
public double lastX; public double lastX;
public double lastY; public double lastY;
@ -116,18 +115,17 @@ public abstract class Entity {
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
// Spigot start // Spigot start
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.v1_7_R3.SpigotTimings.getEntityTimings(this); // Spigot public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.v1_7_R4.SpigotTimings.getEntityTimings(this); // Spigot
public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
public final boolean defaultActivationState; public final boolean defaultActivationState;
public long activatedTick = 0; public long activatedTick = 0;
public boolean fromMobSpawner; public boolean fromMobSpawner;
public boolean Silent;
public boolean Invisible;
public void inactiveTick() { } public void inactiveTick() { }
// Spigot end // Spigot end
public boolean Silent;
public boolean Invisible;
public int getId() { public int getId() {
return this.id; return this.id;
} }
@ -258,10 +256,10 @@ public abstract class Entity {
} }
public void h() { public void h() {
this.B(); this.C();
} }
public void B() { public void C() {
this.world.methodProfiler.a("entityBaseTick"); this.world.methodProfiler.a("entityBaseTick");
if (this.vehicle != null && this.vehicle.dead) { if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
@ -279,12 +277,12 @@ public abstract class Entity {
this.world.methodProfiler.a("portal"); this.world.methodProfiler.a("portal");
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer(); MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
i = this.C(); i = this.D();
if (this.an) { if (this.an) {
if (true || minecraftserver.getAllowNether()) { // CraftBukkit if (true || minecraftserver.getAllowNether()) { // CraftBukkit
if (this.vehicle == null && this.ao++ >= i) { if (this.vehicle == null && this.ao++ >= i) {
this.ao = i; this.ao = i;
this.portalCooldown = this.ah(); this.portalCooldown = this.ai();
byte b0; byte b0;
if (this.world.worldProvider.dimension == -1) { if (this.world.worldProvider.dimension == -1) {
@ -315,7 +313,7 @@ public abstract class Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
if (this.isSprinting() && !this.L()) { if (this.isSprinting() && !this.M()) {
int j = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locX);
i = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); i = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
@ -323,11 +321,11 @@ public abstract class Entity {
Block block = this.world.getType(j, i, k); Block block = this.world.getType(j, i, k);
if (block.getMaterial() != Material.AIR) { if (block.getMaterial() != Material.AIR) {
this.world.addParticle("blockcrack_" + Block.b(block) + "_" + this.world.getData(j, i, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D); this.world.addParticle("blockcrack_" + Block.getId(block) + "_" + this.world.getData(j, i, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D);
} }
} }
this.M(); this.N();
if (this.world.isStatic) { if (this.world.isStatic) {
this.fireTicks = 0; this.fireTicks = 0;
} else if (this.fireTicks > 0) { } else if (this.fireTicks > 0) {
@ -345,13 +343,13 @@ public abstract class Entity {
} }
} }
if (this.O()) { if (this.P()) {
this.D(); this.E();
this.fallDistance *= 0.5F; this.fallDistance *= 0.5F;
} }
if (this.locY < -64.0D) { if (this.locY < -64.0D) {
this.F(); this.G();
} }
if (!this.world.isStatic) { if (!this.world.isStatic) {
@ -362,32 +360,23 @@ public abstract class Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
public int C() { public int D() {
return 0; return 0;
} }
protected void D() { protected void E() {
if (!this.fireProof) { if (!this.fireProof) {
this.damageEntity(DamageSource.LAVA, 4);
// CraftBukkit start - Fallen in lava TODO: this event spams! // CraftBukkit start - Fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) { if (this instanceof EntityLiving) {
Server server = this.world.getServer();
// TODO: shouldn't be sending null for the block.
org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.LAVA, 4D);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
damagee.setLastDamageCause(event);
this.damageEntity(DamageSource.LAVA, (float) event.getDamage());
}
if (this.fireTicks <= 0) { if (this.fireTicks <= 0) {
// not on fire yet // not on fire yet
// TODO: shouldn't be sending null for the block.
org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15); EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
server.getPluginManager().callEvent(combustEvent); this.world.getServer().getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) { if (!combustEvent.isCancelled()) {
this.setOnFire(combustEvent.getDuration()); this.setOnFire(combustEvent.getDuration());
@ -400,7 +389,6 @@ public abstract class Entity {
} }
// CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
this.damageEntity(DamageSource.LAVA, 4);
this.setOnFire(15); this.setOnFire(15);
} }
} }
@ -418,7 +406,7 @@ public abstract class Entity {
this.fireTicks = 0; this.fireTicks = 0;
} }
protected void F() { protected void G() {
this.die(); this.die();
} }
@ -433,7 +421,7 @@ public abstract class Entity {
// CraftBukkit start - Don't do anything if we aren't moving // CraftBukkit start - Don't do anything if we aren't moving
// We need to do this regardless of whether or not we are moving thanks to portals // We need to do this regardless of whether or not we are moving thanks to portals
try { try {
this.H(); this.I();
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision"); CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision");
@ -445,8 +433,8 @@ public abstract class Entity {
if (d0 == 0 && d1 == 0 && d2 == 0 && this.vehicle == null && this.passenger == null) { if (d0 == 0 && d1 == 0 && d2 == 0 && this.vehicle == null && this.passenger == null) {
return; return;
} }
// CraftBukkit end // CraftBukkit end
org.bukkit.craftbukkit.v1_7_R3.SpigotTimings.entityMoveTimer.startTiming(); // Spigot org.bukkit.craftbukkit.v1_7_R4.SpigotTimings.entityMoveTimer.startTiming(); // Spigot
if (this.X) { if (this.X) {
this.boundingBox.d(d0, d1, d2); this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
@ -697,19 +685,18 @@ public abstract class Entity {
this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D); this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D);
if (this.Q > (float) this.d && block.getMaterial() != Material.AIR) { if (this.Q > (float) this.d && block.getMaterial() != Material.AIR) {
this.d = (int) this.Q + 1; this.d = (int) this.Q + 1;
if (this.L()) { if (this.M()) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.35F; float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.35F;
if (f > 1.0F) { if (f > 1.0F) {
f = 1.0F; f = 1.0F;
} }
this.makeSound(this.G(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); this.makeSound(this.H(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
} }
if (!Silent) if (!Silent)
this.a(l, k, i1, block); this.a(l, k, i1, block);
block.b(this.world, l, k, i1, this); block.b(this.world, l, k, i1, this);
} }
} }
@ -717,7 +704,7 @@ public abstract class Entity {
// CraftBukkit start - Move to the top of the method // CraftBukkit start - Move to the top of the method
/* /*
try { try {
this.H(); this.I();
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision"); CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision");
@ -727,7 +714,7 @@ public abstract class Entity {
} }
*/ */
// CraftBukkit end // CraftBukkit end
boolean flag2 = this.K(); boolean flag2 = this.L();
if (this.world.e(this.boundingBox.shrink(0.001D, 0.001D, 0.001D))) { if (this.world.e(this.boundingBox.shrink(0.001D, 0.001D, 0.001D))) {
this.burn(1); this.burn(1);
@ -757,14 +744,14 @@ public abstract class Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
org.bukkit.craftbukkit.v1_7_R3.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot org.bukkit.craftbukkit.v1_7_R4.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot
} }
protected String G() { protected String H() {
return "game.neutral.swim"; return "game.neutral.swim";
} }
protected void H() { protected void I() {
int i = MathHelper.floor(this.boundingBox.a + 0.001D); int i = MathHelper.floor(this.boundingBox.a + 0.001D);
int j = MathHelper.floor(this.boundingBox.b + 0.001D); int j = MathHelper.floor(this.boundingBox.b + 0.001D);
int k = MathHelper.floor(this.boundingBox.c + 0.001D); int k = MathHelper.floor(this.boundingBox.c + 0.001D);
@ -805,8 +792,8 @@ public abstract class Entity {
} }
public void makeSound(String s, float f, float f1) { public void makeSound(String s, float f, float f1) {
if (!Silent) if (!Silent)
this.world.makeSound(this, s, f, f1); this.world.makeSound(this, s, f, f1);
} }
protected boolean g_() { protected boolean g_() {
@ -824,7 +811,7 @@ public abstract class Entity {
} }
} }
public AxisAlignedBB I() { public AxisAlignedBB J() {
return null; return null;
} }
@ -844,15 +831,15 @@ public abstract class Entity {
} }
} }
public boolean K() { public boolean L() {
return this.inWater || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY + (double) this.length), MathHelper.floor(this.locZ)); return this.inWater || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY + (double) this.length), MathHelper.floor(this.locZ));
} }
public boolean L() { public boolean M() {
return this.inWater; return this.inWater;
} }
public boolean M() { public boolean N() {
if (this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D, 0.001D, 0.001D), Material.WATER, this)) { if (this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D, 0.001D, 0.001D), Material.WATER, this)) {
if (!this.inWater && !this.justCreated) { if (!this.inWater && !this.justCreated) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F; float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
@ -861,7 +848,7 @@ public abstract class Entity {
f = 1.0F; f = 1.0F;
} }
this.makeSound(this.N(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); this.makeSound(this.O(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
float f1 = (float) MathHelper.floor(this.boundingBox.b); float f1 = (float) MathHelper.floor(this.boundingBox.b);
int i; int i;
@ -891,7 +878,7 @@ public abstract class Entity {
return this.inWater; return this.inWater;
} }
protected String N() { protected String O() {
return "game.neutral.swim.splash"; return "game.neutral.swim.splash";
} }
@ -916,7 +903,7 @@ public abstract class Entity {
return 0.0F; return 0.0F;
} }
public boolean O() { public boolean P() {
return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
} }
@ -1066,7 +1053,7 @@ public abstract class Entity {
this.al = true; this.al = true;
} }
protected void P() { protected void Q() {
this.velocityChanged = true; this.velocityChanged = true;
} }
@ -1074,23 +1061,23 @@ public abstract class Entity {
if (this.isInvulnerable()) { if (this.isInvulnerable()) {
return false; return false;
} else { } else {
this.P(); this.Q();
return false; return false;
} }
} }
public boolean Q() {
return false;
}
public boolean R() { public boolean R() {
return false; return false;
} }
public boolean S() {
return false;
}
public void b(Entity entity, int i) {} public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) { public boolean c(NBTTagCompound nbttagcompound) {
String s = this.V(); String s = this.W();
if (!this.dead && s != null) { if (!this.dead && s != null) {
nbttagcompound.setString("id", s); nbttagcompound.setString("id", s);
@ -1102,7 +1089,7 @@ public abstract class Entity {
} }
public boolean d(NBTTagCompound nbttagcompound) { public boolean d(NBTTagCompound nbttagcompound) {
String s = this.V(); String s = this.W();
if (!this.dead && s != null && this.passenger == null) { if (!this.dead && s != null && this.passenger == null) {
nbttagcompound.setString("id", s); nbttagcompound.setString("id", s);
@ -1204,7 +1191,7 @@ public abstract class Entity {
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
this.b(this.yaw, this.pitch); this.b(this.yaw, this.pitch);
this.a(nbttagcompound); this.a(nbttagcompound);
if (this.U()) { if (this.V()) {
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
} }
@ -1255,7 +1242,7 @@ public abstract class Entity {
if (bworld == null) { if (bworld == null) {
EntityPlayer entityPlayer = (EntityPlayer) this; EntityPlayer entityPlayer = (EntityPlayer) this;
bworld = ((org.bukkit.craftbukkit.v1_7_R3.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld(); bworld = ((org.bukkit.craftbukkit.v1_7_R4.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld();
} }
this.spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle()); this.spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
@ -1270,11 +1257,11 @@ public abstract class Entity {
} }
} }
protected boolean U() { protected boolean V() {
return true; return true;
} }
protected final String V() { protected final String W() {
return EntityTypes.b(this); return EntityTypes.b(this);
} }
@ -1282,7 +1269,7 @@ public abstract class Entity {
protected abstract void b(NBTTagCompound nbttagcompound); protected abstract void b(NBTTagCompound nbttagcompound);
public void W() {} public void X() {}
protected NBTTagList a(double... adouble) { protected NBTTagList a(double... adouble) {
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
@ -1322,6 +1309,13 @@ public abstract class Entity {
public EntityItem a(ItemStack itemstack, float f) { public EntityItem a(ItemStack itemstack, float f) {
if (itemstack.count != 0 && itemstack.getItem() != null) { if (itemstack.count != 0 && itemstack.getItem() != null) {
// CraftBukkit start - Capture drops for death event
if (this instanceof EntityLiving && ((EntityLiving) this).drops != null) {
((EntityLiving) this).drops.add(org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack.asBukkitCopy(itemstack));
return null;
}
// CraftBukkit end
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack); EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
entityitem.pickupDelay = 10; entityitem.pickupDelay = 10;
@ -1361,7 +1355,7 @@ public abstract class Entity {
return null; return null;
} }
public void aa() { public void ab() {
if (this.vehicle.dead) { if (this.vehicle.dead) {
this.vehicle = null; this.vehicle = null;
} else { } else {
@ -1370,7 +1364,7 @@ public abstract class Entity {
this.motZ = 0.0D; this.motZ = 0.0D;
this.h(); this.h();
if (this.vehicle != null) { if (this.vehicle != null) {
this.vehicle.ab(); this.vehicle.ac();
this.h += (double) (this.vehicle.yaw - this.vehicle.lastYaw); this.h += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
for (this.g += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.h >= 180.0D; this.h -= 360.0D) { for (this.g += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.h >= 180.0D; this.h -= 360.0D) {
@ -1415,17 +1409,17 @@ public abstract class Entity {
} }
} }
public void ab() { public void ac() {
if (this.passenger != null) { if (this.passenger != null) {
this.passenger.setPosition(this.locX, this.locY + this.ad() + this.passenger.ac(), this.locZ); this.passenger.setPosition(this.locX, this.locY + this.ae() + this.passenger.ad(), this.locZ); // Spigot
} }
} }
public double ac() { public double ad() {
return (double) this.height; return (double) this.height;
} }
public double ad() { public double ae() {
return (double) this.length * 0.75D; return (double) this.length * 0.75D;
} }
@ -1475,7 +1469,7 @@ public abstract class Entity {
this.vehicle = null; this.vehicle = null;
} else { } else {
// CraftBukkit start // CraftBukkit start
if ((this.bukkitEntity instanceof LivingEntity) && entity.getBukkitEntity() instanceof Vehicle && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4)) { if ((this.bukkitEntity instanceof LivingEntity) && (entity instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4)) {
// It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are. // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are.
VehicleExitEvent exitEvent = null; VehicleExitEvent exitEvent = null;
if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) { if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) {
@ -1531,17 +1525,17 @@ public abstract class Entity {
} }
} }
public float ae() { public float af() {
return 0.1F; return 0.1F;
} }
public Vec3D af() { public Vec3D ag() {
return null; return null;
} }
public void ag() { public void ah() {
if (this.portalCooldown > 0) { if (this.portalCooldown > 0) {
this.portalCooldown = this.ah(); this.portalCooldown = this.ai();
} else { } else {
double d0 = this.lastX - this.locX; double d0 = this.lastX - this.locX;
double d1 = this.lastZ - this.locZ; double d1 = this.lastZ - this.locZ;
@ -1554,7 +1548,7 @@ public abstract class Entity {
} }
} }
public int ah() { public int ai() {
return 300; return 300;
} }
@ -1570,7 +1564,7 @@ public abstract class Entity {
return !this.fireProof && (this.fireTicks > 0 || flag && this.g(0)); return !this.fireProof && (this.fireTicks > 0 || flag && this.g(0));
} }
public boolean al() { public boolean am() {
return this.vehicle != null; return this.vehicle != null;
} }
@ -1597,7 +1591,7 @@ public abstract class Entity {
public void setInvisible(boolean flag) { public void setInvisible(boolean flag) {
if (Invisible && !flag) if (Invisible && !flag)
return; return;
this.a(5, flag); this.a(5, flag);
} }
@ -1653,12 +1647,14 @@ public abstract class Entity {
} }
} }
EntityDamageEvent event = org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callEntityDamageEvent(entitylightning, this, EntityDamageEvent.DamageCause.LIGHTNING, 5D); if (this.fireProof) {
if (event.isCancelled()) { return;
}
CraftEventFactory.entityDamage = entitylightning;
if (!this.damageEntity(DamageSource.FIRE, 5.0F)) {
CraftEventFactory.entityDamage = null;
return; return;
} }
this.burn((float) event.getDamage());
// CraftBukkit end // CraftBukkit end
++this.fireTicks; ++this.fireTicks;
@ -1751,7 +1747,7 @@ public abstract class Entity {
} }
} }
public void ar() { public void as() {
this.I = true; this.I = true;
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
} }
@ -1766,7 +1762,7 @@ public abstract class Entity {
return LocaleI18n.get("entity." + s + ".name"); return LocaleI18n.get("entity." + s + ".name");
} }
public Entity[] as() { public Entity[] at() {
return null; return null;
} }
@ -1778,7 +1774,7 @@ public abstract class Entity {
return 0.0F; return 0.0F;
} }
public boolean au() { public boolean av() {
return true; return true;
} }
@ -1827,7 +1823,7 @@ public abstract class Entity {
Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null; Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null;
boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END
TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.v1_7_R3.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.v1_7_R4.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins
EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent); EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent);
event.useTravelAgent(useTravelAgent); event.useTravelAgent(useTravelAgent);
event.getEntity().getServer().getPluginManager().callEvent(event); event.getEntity().getServer().getPluginManager().callEvent(event);
@ -1900,15 +1896,15 @@ public abstract class Entity {
return true; return true;
} }
public int aw() { public int ax() {
return 3; return 3;
} }
public int ax() { public int ay() {
return this.aq; return this.aq;
} }
public boolean ay() { public boolean az() {
return false; return false;
} }
@ -1925,7 +1921,7 @@ public abstract class Entity {
return this.uniqueID; return this.uniqueID;
} }
public boolean aB() { public boolean aC() {
return true; return true;
} }
@ -1934,4 +1930,4 @@ public abstract class Entity {
} }
public void i(int i) {} public void i(int i) {}
} }

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.Calendar; import java.util.Calendar;
import java.util.Random; import java.util.Random;
@ -6,7 +6,7 @@ import java.util.Random;
public class EntityBat extends EntityAmbient public class EntityBat extends EntityAmbient
{ {
private ChunkCoordinates h; private ChunkCoordinates h;
public boolean Vegetated = false; public boolean Vegetated = false;
public EntityBat(World paramWorld) public EntityBat(World paramWorld)
@ -14,7 +14,7 @@ public class EntityBat extends EntityAmbient
super(paramWorld); super(paramWorld);
a(0.5F, 0.9F); a(0.5F, 0.9F);
setStartled(true); setAsleep(true);
} }
protected void c() protected void c()
@ -24,36 +24,36 @@ public class EntityBat extends EntityAmbient
this.datawatcher.a(16, new Byte((byte) 0)); this.datawatcher.a(16, new Byte((byte) 0));
} }
protected float be() protected float bf()
{ {
return 0.1F; return 0.1F;
} }
protected float bf() protected float bg()
{ {
return super.bf() * 0.95F; return super.bg() * 0.95F;
} }
protected String t() protected String t()
{ {
if ((isStartled()) && (this.random.nextInt(4) != 0)) if ((isAsleep()) && (this.random.nextInt(4) != 0))
{ {
return null; return null;
} }
return "mob.bat.idle"; return "mob.bat.idle";
} }
protected String aS() protected String aT()
{ {
return "mob.bat.hurt"; return "mob.bat.hurt";
} }
protected String aT() protected String aU()
{ {
return "mob.bat.death"; return "mob.bat.death";
} }
public boolean R() public boolean S()
{ {
return false; return false;
} }
@ -62,23 +62,23 @@ public class EntityBat extends EntityAmbient
{ {
} }
protected void bn() protected void bo()
{ {
} }
protected void aC() protected void aD()
{ {
super.aC(); super.aD();
getAttributeInstance(GenericAttributes.a).setValue(6.0D); getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D);
} }
public boolean isStartled() public boolean isAsleep()
{ {
return (this.datawatcher.getByte(16) & 0x1) != 0; return (this.datawatcher.getByte(16) & 0x1) != 0;
} }
public void setStartled(boolean paramBoolean) public void setAsleep(boolean paramBoolean)
{ {
int i = this.datawatcher.getByte(16); int i = this.datawatcher.getByte(16);
if (paramBoolean) if (paramBoolean)
@ -91,7 +91,7 @@ public class EntityBat extends EntityAmbient
} }
} }
protected boolean bj() protected boolean bk()
{ {
return true; return true;
} }
@ -99,11 +99,11 @@ public class EntityBat extends EntityAmbient
public void h() public void h()
{ {
super.h(); super.h();
if (Vegetated) if (Vegetated)
return; return;
if (isStartled()) if (isAsleep())
{ {
this.motX = (this.motY = this.motZ = 0.0D); this.motX = (this.motY = this.motZ = 0.0D);
this.locY = (MathHelper.floor(this.locY) + 1.0D - this.length); this.locY = (MathHelper.floor(this.locY) + 1.0D - this.length);
@ -114,18 +114,18 @@ public class EntityBat extends EntityAmbient
} }
} }
protected void bm() protected void bn()
{ {
super.bm(); super.bn();
if (Vegetated) if (Vegetated)
return; return;
if (isStartled()) if (isAsleep())
{ {
if (!this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1, MathHelper.floor(this.locZ)).r()) if (!this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1, MathHelper.floor(this.locZ)).r())
{ {
setStartled(false); setAsleep(false);
this.world.a(null, 1015, (int) this.locX, (int) this.locY, (int) this.locZ, 0); this.world.a(null, 1015, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
} }
else else
@ -136,7 +136,7 @@ public class EntityBat extends EntityAmbient
} }
if (this.world.findNearbyPlayer(this, 4.0D) != null) if (this.world.findNearbyPlayer(this, 4.0D) != null)
{ {
setStartled(false); setAsleep(false);
this.world.a(null, 1015, (int) this.locX, (int) this.locY, (int) this.locZ, 0); this.world.a(null, 1015, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
} }
} }
@ -170,7 +170,7 @@ public class EntityBat extends EntityAmbient
&& (this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1, && (this.world.getType(MathHelper.floor(this.locX), (int) this.locY + 1,
MathHelper.floor(this.locZ)).r())) MathHelper.floor(this.locZ)).r()))
{ {
setStartled(true); setAsleep(true);
} }
} }
} }
@ -188,7 +188,7 @@ public class EntityBat extends EntityAmbient
{ {
} }
public boolean ay() public boolean az()
{ {
return true; return true;
} }
@ -199,9 +199,9 @@ public class EntityBat extends EntityAmbient
{ {
return false; return false;
} }
if ((!this.world.isStatic) && (isStartled() && !Vegetated)) if ((!this.world.isStatic) && (isAsleep()) && !Vegetated)
{ {
setStartled(false); setAsleep(false);
} }
return super.damageEntity(paramDamageSource, paramFloat); return super.damageEntity(paramDamageSource, paramFloat);
} }

View File

@ -0,0 +1,192 @@
package net.minecraft.server.v1_7_R4;
import java.util.Random;
public class EntityBlaze extends EntityMonster
{
private float bp = 0.5F;
private int bq;
private int br;
public EntityBlaze(World paramWorld)
{
super(paramWorld);
this.fireProof = true;
this.b = 10;
}
protected void aD()
{
super.aD();
getAttributeInstance(GenericAttributes.e).setValue(6.0D);
}
protected void c()
{
super.c();
this.datawatcher.a(16, new Byte((byte) 0));
}
protected String t()
{
return "mob.blaze.breathe";
}
protected String aT()
{
return "mob.blaze.hit";
}
protected String aU()
{
return "mob.blaze.death";
}
public float d(float paramFloat)
{
return 1.0F;
}
public void e()
{
if (!this.world.isStatic)
{
if (L())
{
damageEntity(DamageSource.DROWN, 1.0F);
}
this.bq -= 1;
if (this.bq <= 0)
{
this.bq = 100;
this.bp = (0.5F + (float) this.random.nextGaussian() * 3.0F);
}
if ((bT() != null) && (bT().locY + bT().getHeadHeight() > this.locY + getHeadHeight() + this.bp))
{
this.motY += (0.300000011920929D - this.motY) * 0.300000011920929D;
}
}
if (this.random.nextInt(24) == 0)
{
this.world.makeSound(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire",
1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F);
}
if (!Vegetated && (!this.onGround) && (this.motY < 0.0D))
{
this.motY *= 0.6D;
}
for (int i = 0; i < 2; i++)
{
this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * this.width, this.locY
+ this.random.nextDouble() * this.length, this.locZ + (this.random.nextDouble() - 0.5D)
* this.width, 0.0D, 0.0D, 0.0D);
}
super.e();
}
protected void a(Entity paramEntity, float paramFloat)
{
if (Vegetated)
return;
if ((this.attackTicks <= 0) && (paramFloat < 2.0F) && (paramEntity.boundingBox.e > this.boundingBox.b)
&& (paramEntity.boundingBox.b < this.boundingBox.e))
{
this.attackTicks = 20;
n(paramEntity);
}
else if (paramFloat < 30.0F)
{
double d1 = paramEntity.locX - this.locX;
double d2 = paramEntity.boundingBox.b + paramEntity.length / 2.0F - (this.locY + this.length / 2.0F);
double d3 = paramEntity.locZ - this.locZ;
if (this.attackTicks == 0)
{
this.br += 1;
if (this.br == 1)
{
this.attackTicks = 60;
a(true);
}
else if (this.br <= 4)
{
this.attackTicks = 6;
}
else
{
this.attackTicks = 100;
this.br = 0;
a(false);
}
if (this.br > 1)
{
float f = MathHelper.c(paramFloat) * 0.5F;
this.world.a(null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
for (int i = 0; i < 1; i++)
{
EntitySmallFireball localEntitySmallFireball = new EntitySmallFireball(this.world, this, d1
+ this.random.nextGaussian() * f, d2, d3 + this.random.nextGaussian() * f);
localEntitySmallFireball.locY = (this.locY + this.length / 2.0F + 0.5D);
this.world.addEntity(localEntitySmallFireball);
}
}
}
this.yaw = ((float) (Math.atan2(d3, d1) * 180.0D / 3.141592741012573D) - 90.0F);
this.bn = true;
}
}
protected void b(float paramFloat)
{
}
protected Item getLoot()
{
return Items.BLAZE_ROD;
}
public boolean isBurning()
{
return bZ();
}
protected void dropDeathLoot(boolean paramBoolean, int paramInt)
{
if (paramBoolean)
{
int i = this.random.nextInt(2 + paramInt);
for (int j = 0; j < i; j++)
{
a(Items.BLAZE_ROD, 1);
}
}
}
public boolean bZ()
{
return (this.datawatcher.getByte(16) & 0x1) != 0;
}
public void a(boolean paramBoolean)
{
byte b = this.datawatcher.getByte(16);
if (paramBoolean)
{
b = (byte) (b | 0x1);
}
else
{
b = (byte) (b & 0xFFFFFFFE);
}
this.datawatcher.watch(16, Byte.valueOf(b));
}
protected boolean j_()
{
return true;
}
}

View File

@ -1,13 +1,13 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
// CraftBukkit start // CraftBukkit start
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.craftbukkit.v1_7_R3.util.BlockStateListPopulator; import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.craftbukkit.v1_7_R4.util.BlockStateListPopulator;
import org.bukkit.event.entity.EntityCreatePortalEvent; import org.bukkit.event.entity.EntityCreatePortalEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
@ -38,8 +38,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
public EntityEnderCrystal bC; public EntityEnderCrystal bC;
private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
public boolean Vegetated = false; public boolean Vegetated = false;
public EntityEnderDragon(World world) { public EntityEnderDragon(World world) {
super(world); super(world);
this.children = new EntityComplexPart[] { this.bq = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.br = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bs = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bt = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bu = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bv = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bw = new EntityComplexPart(this, "wing", 4.0F, 4.0F)}; this.children = new EntityComplexPart[] { this.bq = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.br = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bs = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bt = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bu = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bv = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bw = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
@ -51,9 +51,9 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.ak = true; this.ak = true;
} }
protected void aC() { protected void aD() {
super.aC(); super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(200.0D); this.getAttributeInstance(GenericAttributes.maxHealth).setValue(200.0D);
} }
protected void c() { protected void c() {
@ -165,7 +165,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.bm += this.random.nextGaussian() * 2.0D; this.bm += this.random.nextGaussian() * 2.0D;
} }
if (!Vegetated && (this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.F)) { if (!Vegetated && this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.F) {
this.bQ(); this.bQ();
} }
@ -304,15 +304,9 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
if (this.bC != null) { if (this.bC != null) {
if (this.bC.dead) { if (this.bC.dead) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
// CraftBukkit start CraftEventFactory.entityDamage = this.bC; // CraftBukkit
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, 10.0F); this.a(this.bq, DamageSource.explosion((Explosion) null), 10.0F);
Bukkit.getPluginManager().callEvent(event); CraftEventFactory.entityDamage = null; // CraftBukkit
if (!event.isCancelled()) {
getBukkitEntity().setLastDamageCause(event);
this.a(this.bq, DamageSource.explosion((Explosion) null), (float) event.getDamage());
}
// CraftBukkit end
} }
this.bC = null; this.bC = null;
@ -376,7 +370,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
} }
} }
} }
public void setTargetBlock(int x, int y, int z) public void setTargetBlock(int x, int y, int z)
{ {
this.h = x; this.h = x;
@ -384,7 +378,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
this.bm = z; this.bm = z;
this.bD = null; this.bD = null;
} }
public void setTargetEntity(Entity entity) public void setTargetEntity(Entity entity)
{ {
this.bD = entity; this.bD = entity;
@ -402,7 +396,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
if (event.getTarget() == null) { if (event.getTarget() == null) {
this.bD = null; this.bD = null;
} else { } else {
this.bD = ((org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity) event.getTarget()).getHandle(); this.bD = ((org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity) event.getTarget()).getHandle();
} }
} }
// CraftBukkit end // CraftBukkit end
@ -442,7 +436,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
// CraftBukkit start - Create a list to hold all the destroyed blocks // CraftBukkit start - Create a list to hold all the destroyed blocks
List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>(); List<org.bukkit.block.Block> destroyedBlocks = new java.util.ArrayList<org.bukkit.block.Block>();
org.bukkit.craftbukkit.v1_7_R3.CraftWorld craftWorld = this.world.getWorld(); org.bukkit.craftbukkit.v1_7_R4.CraftWorld craftWorld = this.world.getWorld();
// CraftBukkit end // CraftBukkit end
for (int k1 = i; k1 <= l; ++k1) { for (int k1 = i; k1 <= l; ++k1) {
@ -490,7 +484,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
int blockY = block.getY(); int blockY = block.getY();
int blockZ = block.getZ(); int blockZ = block.getZ();
Block nmsBlock = org.bukkit.craftbukkit.v1_7_R3.util.CraftMagicNumbers.getBlock(blockId); Block nmsBlock = org.bukkit.craftbukkit.v1_7_R4.util.CraftMagicNumbers.getBlock(blockId);
if (nmsBlock.a(explosionSource)) { if (nmsBlock.a(explosionSource)) {
nmsBlock.dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), event.getYield(), 0); nmsBlock.dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), event.getYield(), 0);
} }
@ -539,7 +533,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
return super.damageEntity(damagesource, f); return super.damageEntity(damagesource, f);
} }
protected void aE() { protected void aF() {
if (this.dead) return; // CraftBukkit - can't kill what's already dead if (this.dead) return; // CraftBukkit - can't kill what's already dead
++this.bB; ++this.bB;
if (this.bB >= 180 && this.bB <= 200) { if (this.bB >= 180 && this.bB <= 200) {
@ -565,14 +559,24 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
} }
if (this.bB == 1) { if (this.bB == 1) {
// Spigot start // CraftBukkit start - Use relative location for far away sounds
if(this.world.spigotConfig.dragonDeathSoundRadius > 0){ //this.world.b(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
this.world.getServer().getHandle().sendPacketNearby((int) this.locX, (int) this.locY, (int) this.locZ, this.world.spigotConfig.dragonDeathSoundRadius, this.dimension, new PacketPlayOutWorldEvent(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0, true)); int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
for (EntityPlayer player : (List<EntityPlayer>) this.world.players) {
double deltaX = this.locX - player.locX;
double deltaZ = this.locZ - player.locZ;
double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
if ( world.spigotConfig.dragonDeathSoundRadius > 0 && distanceSquared > world.spigotConfig.dragonDeathSoundRadius * world.spigotConfig.dragonDeathSoundRadius ) continue; // Spigot
if (distanceSquared > viewDistance * viewDistance) {
double deltaLength = Math.sqrt(distanceSquared);
double relativeX = player.locX + (deltaX / deltaLength) * viewDistance;
double relativeZ = player.locZ + (deltaZ / deltaLength) * viewDistance;
player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1018, (int) relativeX, (int) this.locY, (int) relativeZ, 0, true));
} else {
player.playerConnection.sendPacket(new PacketPlayOutWorldEvent(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0, true));
}
} }
else { // CraftBukkit end
this.world.b(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
// Spigot end
} }
} }
@ -660,11 +664,11 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
protected void w() {} protected void w() {}
public Entity[] as() { public Entity[] at() {
return this.children; return this.children;
} }
public boolean Q() { public boolean R() {
return false; return false;
} }
@ -676,11 +680,11 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
return "mob.enderdragon.growl"; return "mob.enderdragon.growl";
} }
protected String aS() { protected String aT() {
return "mob.enderdragon.hit"; return "mob.enderdragon.hit";
} }
protected float be() { protected float bf() {
return 5.0F; return 5.0F;
} }
@ -691,4 +695,4 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
return 12000; return 12000;
} }
// CraftBukkit end // CraftBukkit end
} }

View File

@ -1,10 +1,10 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.UUID; import java.util.UUID;
// CraftBukkit start // CraftBukkit start
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory; import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.event.entity.EntityTeleportEvent; import org.bukkit.event.entity.EntityTeleportEvent;
// CraftBukkit end // CraftBukkit end
@ -24,9 +24,9 @@ public class EntityEnderman extends EntityMonster {
this.W = 1.0F; this.W = 1.0F;
} }
protected void aC() { protected void aD() {
super.aC(); super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(40.0D); this.getAttributeInstance(GenericAttributes.maxHealth).setValue(40.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.30000001192092896D); this.getAttributeInstance(GenericAttributes.d).setValue(0.30000001192092896D);
this.getAttributeInstance(GenericAttributes.e).setValue(7.0D); this.getAttributeInstance(GenericAttributes.e).setValue(7.0D);
} }
@ -40,20 +40,20 @@ public class EntityEnderman extends EntityMonster {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.setShort("carried", (short) Block.b(this.getCarried())); nbttagcompound.setShort("carried", (short) Block.getId(this.getCarried()));
nbttagcompound.setShort("carriedData", (short) this.getCarriedData()); nbttagcompound.setShort("carriedData", (short) this.getCarriedData());
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setCarried(Block.e(nbttagcompound.getShort("carried"))); this.setCarried(Block.getById(nbttagcompound.getShort("carried")));
this.setCarriedData(nbttagcompound.getShort("carriedData")); this.setCarriedData(nbttagcompound.getShort("carriedData"));
} }
protected Entity findTarget() { protected Entity findTarget() {
if (Vegetated) if (Vegetated)
return null; return null;
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D); EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
if (entityhuman != null) { if (entityhuman != null) {
@ -89,12 +89,12 @@ public class EntityEnderman extends EntityMonster {
vec3d1 = vec3d1.a(); vec3d1 = vec3d1.a();
double d1 = vec3d.b(vec3d1); double d1 = vec3d.b(vec3d1);
return d1 > 1.0D - 0.025D / d0 && entityhuman.p(this); return d1 > 1.0D - 0.025D / d0 && entityhuman.hasLineOfSight(this);
} }
} }
public void e() { public void e() {
if (this.K()) { if (this.L()) {
this.damageEntity(DamageSource.DROWN, 1.0F); this.damageEntity(DamageSource.DROWN, 1.0F);
} }
@ -121,7 +121,7 @@ public class EntityEnderman extends EntityMonster {
j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D); j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D);
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D); k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
block = this.world.getType(i, j, k); block = this.world.getType(i, j, k);
if (br[Block.b(block)]) { if (br[Block.getId(block)]) {
// CraftBukkit start - Pickup event // CraftBukkit start - Pickup event
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) { if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
this.setCarried(block); this.setCarried(block);
@ -164,7 +164,7 @@ public class EntityEnderman extends EntityMonster {
} }
} }
if (this.K() || this.isBurning()) { if (this.L() || this.isBurning()) {
this.target = null; this.target = null;
this.a(false); this.a(false);
this.bv = false; this.bv = false;
@ -293,11 +293,11 @@ public class EntityEnderman extends EntityMonster {
return this.cd() ? "mob.endermen.scream" : "mob.endermen.idle"; return this.cd() ? "mob.endermen.scream" : "mob.endermen.idle";
} }
protected String aS() { protected String aT() {
return "mob.endermen.hit"; return "mob.endermen.hit";
} }
protected String aT() { protected String aU() {
return "mob.endermen.death"; return "mob.endermen.death";
} }
@ -309,25 +309,20 @@ public class EntityEnderman extends EntityMonster {
Item item = this.getLoot(); Item item = this.getLoot();
if (item != null) { if (item != null) {
// CraftBukkit start - Whole method int j = this.random.nextInt(2 + i);
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(2 + i);
if (count > 0) { for (int k = 0; k < j; ++k) {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.v1_7_R3.util.CraftMagicNumbers.getMaterial(item), count)); this.a(item, 1);
} }
CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
} }
} }
public void setCarried(Block block) { public void setCarried(Block block) {
this.datawatcher.watch(16, Byte.valueOf((byte) (Block.b(block) & 255))); this.datawatcher.watch(16, Byte.valueOf((byte) (Block.getId(block) & 255)));
} }
public Block getCarried() { public Block getCarried() {
return Block.e(this.datawatcher.getByte(16)); return Block.getById(this.datawatcher.getByte(16));
} }
public void setCarriedData(int i) { public void setCarriedData(int i) {
@ -372,19 +367,19 @@ public class EntityEnderman extends EntityMonster {
} }
static { static {
br[Block.b((Block) Blocks.GRASS)] = true; br[Block.getId(Blocks.GRASS)] = true;
br[Block.b(Blocks.DIRT)] = true; br[Block.getId(Blocks.DIRT)] = true;
br[Block.b((Block) Blocks.SAND)] = true; br[Block.getId(Blocks.SAND)] = true;
br[Block.b(Blocks.GRAVEL)] = true; br[Block.getId(Blocks.GRAVEL)] = true;
br[Block.b((Block) Blocks.YELLOW_FLOWER)] = true; br[Block.getId(Blocks.YELLOW_FLOWER)] = true;
br[Block.b((Block) Blocks.RED_ROSE)] = true; br[Block.getId(Blocks.RED_ROSE)] = true;
br[Block.b((Block) Blocks.BROWN_MUSHROOM)] = true; br[Block.getId(Blocks.BROWN_MUSHROOM)] = true;
br[Block.b((Block) Blocks.RED_MUSHROOM)] = true; br[Block.getId(Blocks.RED_MUSHROOM)] = true;
br[Block.b(Blocks.TNT)] = true; br[Block.getId(Blocks.TNT)] = true;
br[Block.b(Blocks.CACTUS)] = true; br[Block.getId(Blocks.CACTUS)] = true;
br[Block.b(Blocks.CLAY)] = true; br[Block.getId(Blocks.CLAY)] = true;
br[Block.b(Blocks.PUMPKIN)] = true; br[Block.getId(Blocks.PUMPKIN)] = true;
br[Block.b(Blocks.MELON)] = true; br[Block.getId(Blocks.MELON)] = true;
br[Block.b((Block) Blocks.MYCEL)] = true; br[Block.getId(Blocks.MYCEL)] = true;
} }
} }

View File

@ -1,19 +1,16 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory; // CraftBukkit
// CraftBukkit start
import org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
// CraftBukkit end
public class EntityFallingBlock extends Entity { public class EntityFallingBlock extends Entity {
public Block id; // CraftBukkit - private -> public public Block id; // CraftBukkit - private -> public
public int data; public int data;
public int b; public int ticksLived;
public boolean dropItem; public boolean dropItem;
private boolean f; private boolean f;
private boolean hurtEntities; private boolean hurtEntities;
@ -59,18 +56,18 @@ public class EntityFallingBlock extends Entity {
protected void c() {} protected void c() {}
public boolean Q() { public boolean R() {
return !this.dead && !spectating; return !this.dead && !spectating;
} }
@Override @Override
public boolean damageEntity(DamageSource damagesource, float f) public boolean damageEntity(DamageSource damagesource, float f)
{ {
CraftEventFactory.handleEntityDamageEvent(this, damagesource, f); CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f);
return true; return true;
} }
public void h() { public void h() {
if (this.id.getMaterial() == Material.AIR) { if (this.id.getMaterial() == Material.AIR) {
this.die(); this.die();
@ -78,7 +75,7 @@ public class EntityFallingBlock extends Entity {
this.lastX = this.locX; this.lastX = this.locX;
this.lastY = this.locY; this.lastY = this.locY;
this.lastZ = this.locZ; this.lastZ = this.locZ;
++this.b; ++this.ticksLived;
this.motY -= 0.03999999910593033D; this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ); this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.9800000190734863D; this.motX *= 0.9800000190734863D;
@ -89,9 +86,9 @@ public class EntityFallingBlock extends Entity {
int j = MathHelper.floor(this.locY); int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ); int k = MathHelper.floor(this.locZ);
if (this.b == 1) { if (this.ticksLived == 1) {
// CraftBukkit - compare data and call event // CraftBukkit - compare data and call event
if (this.b != 1 || this.world.getType(i, j, k) != this.id || this.world.getData(i, j, k) != this.data || CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, Blocks.AIR, 0).isCancelled()) { if (this.ticksLived != 1 || this.world.getType(i, j, k) != this.id || this.world.getData(i, j, k) != this.data || CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, Blocks.AIR, 0).isCancelled()) {
this.die(); this.die();
return; return;
} }
@ -145,7 +142,7 @@ public class EntityFallingBlock extends Entity {
this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F); this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
} }
} }
} else if (this.b > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.b > 600) { } else if (this.ticksLived > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.ticksLived > 600) {
if (this.dropItem) { if (this.dropItem) {
this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F); this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F);
} }
@ -168,17 +165,10 @@ public class EntityFallingBlock extends Entity {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
// CraftBukkit start CraftEventFactory.entityDamage = this; // CraftBukkit
float damage = (float) Math.min(MathHelper.d((float) i * this.fallHurtAmount), this.fallHurtMax); entity.damageEntity(damagesource, (float) Math.min(MathHelper.d((float) i * this.fallHurtAmount), this.fallHurtMax));
CraftEventFactory.entityDamage = null; // CraftBukkit
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(this, entity, EntityDamageEvent.DamageCause.FALLING_BLOCK, damage);
if (event.isCancelled()) {
continue;
}
entity.damageEntity(damagesource, (float) event.getDamage());
// CraftBukkit end
} }
if (flag && (double) this.random.nextFloat() < 0.05000000074505806D + (double) i * 0.05D) { if (flag && (double) this.random.nextFloat() < 0.05000000074505806D + (double) i * 0.05D) {
@ -197,10 +187,10 @@ public class EntityFallingBlock extends Entity {
} }
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setByte("Tile", (byte) Block.b(this.id)); nbttagcompound.setByte("Tile", (byte) Block.getId(this.id));
nbttagcompound.setInt("TileID", Block.b(this.id)); nbttagcompound.setInt("TileID", Block.getId(this.id));
nbttagcompound.setByte("Data", (byte) this.data); nbttagcompound.setByte("Data", (byte) this.data);
nbttagcompound.setByte("Time", (byte) this.b); nbttagcompound.setByte("Time", (byte) this.ticksLived);
nbttagcompound.setBoolean("DropItem", this.dropItem); nbttagcompound.setBoolean("DropItem", this.dropItem);
nbttagcompound.setBoolean("HurtEntities", this.hurtEntities); nbttagcompound.setBoolean("HurtEntities", this.hurtEntities);
nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount); nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount);
@ -212,13 +202,13 @@ public class EntityFallingBlock extends Entity {
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {
if (nbttagcompound.hasKeyOfType("TileID", 99)) { if (nbttagcompound.hasKeyOfType("TileID", 99)) {
this.id = Block.e(nbttagcompound.getInt("TileID")); this.id = Block.getById(nbttagcompound.getInt("TileID"));
} else { } else {
this.id = Block.e(nbttagcompound.getByte("Tile") & 255); this.id = Block.getById(nbttagcompound.getByte("Tile") & 255);
} }
this.data = nbttagcompound.getByte("Data") & 255; this.data = nbttagcompound.getByte("Data") & 255;
this.b = nbttagcompound.getByte("Time") & 255; this.ticksLived = nbttagcompound.getByte("Time") & 255;
if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) { if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) {
this.hurtEntities = nbttagcompound.getBoolean("HurtEntities"); this.hurtEntities = nbttagcompound.getBoolean("HurtEntities");
this.fallHurtAmount = nbttagcompound.getFloat("FallHurtAmount"); this.fallHurtAmount = nbttagcompound.getFloat("FallHurtAmount");
@ -246,11 +236,11 @@ public class EntityFallingBlock extends Entity {
public void a(CrashReportSystemDetails crashreportsystemdetails) { public void a(CrashReportSystemDetails crashreportsystemdetails) {
super.a(crashreportsystemdetails); super.a(crashreportsystemdetails);
crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(Block.b(this.id))); crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(Block.getId(this.id)));
crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data)); crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data));
} }
public Block f() { public Block f() {
return this.id; return this.id;
} }
} }

View File

@ -1,8 +1,7 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
// CraftBukkit end // CraftBukkit end
@ -42,12 +41,12 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.datawatcher.a(16, Byte.valueOf((byte) 0)); this.datawatcher.a(16, Byte.valueOf((byte) 0));
} }
protected void aC() { protected void aD() {
super.aC(); super.aD();
this.getAttributeInstance(GenericAttributes.a).setValue(10.0D); this.getAttributeInstance(GenericAttributes.maxHealth).setValue(10.0D);
} }
protected void bp() { protected void bq() {
if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL) { if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL) {
this.die(); this.die();
} }
@ -67,9 +66,10 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d6 = this.bn - this.locZ; double d6 = this.bn - this.locZ;
this.aN = this.yaw = -((float) Math.atan2(d5, d6)) * 180.0F / 3.1415927F; this.aN = this.yaw = -((float) Math.atan2(d5, d6)) * 180.0F / 3.1415927F;
return; return;
} }
this.w(); this.w();
this.bo = this.bp; this.bo = this.bp;
double d0 = this.i - this.locX; double d0 = this.i - this.locX;
@ -142,7 +142,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d7 = this.target.locZ - this.locZ; double d7 = this.target.locZ - this.locZ;
this.aM = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; this.aM = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
if (this.p(this.target)) { if (this.hasLineOfSight(this.target)) {
if (this.bp == 10) { if (this.bp == 10) {
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0); this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
} }
@ -203,11 +203,11 @@ public class EntityGhast extends EntityFlying implements IMonster {
return "mob.ghast.moan"; return "mob.ghast.moan";
} }
protected String aS() { protected String aT() {
return "mob.ghast.scream"; return "mob.ghast.scream";
} }
protected String aT() { protected String aU() {
return "mob.ghast.death"; return "mob.ghast.death";
} }
@ -216,27 +216,22 @@ public class EntityGhast extends EntityFlying implements IMonster {
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(2) + this.random.nextInt(1 + i); int j = this.random.nextInt(2) + this.random.nextInt(1 + i);
int k; int k;
if (j > 0) { for (k = 0; k < j; ++k) {
loot.add(CraftItemStack.asNewCraftStack(Items.GHAST_TEAR, j)); this.a(Items.GHAST_TEAR, 1);
} }
j = this.random.nextInt(3) + this.random.nextInt(1 + i); j = this.random.nextInt(3) + this.random.nextInt(1 + i);
if (j > 0) { for (k = 0; k < j; ++k) {
loot.add(CraftItemStack.asNewCraftStack(Items.SULPHUR, j)); this.a(Items.SULPHUR, 1);
} }
org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end
} }
protected float be() { protected float bf() {
return 10.0F; return 10.0F;
} }
@ -259,4 +254,4 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.explosionPower = nbttagcompound.getInt("ExplosionPower"); this.explosionPower = nbttagcompound.getInt("ExplosionPower");
} }
} }
} }

View File

@ -1,14 +1,9 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
// CraftBukkit start
import org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory;
import org.bukkit.event.entity.EntityDamageEvent;
// CraftBukkit end
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
public class EntityHorse extends EntityAnimal implements IInventoryListener { public class EntityHorse extends EntityAnimal implements IInventoryListener {
@ -122,7 +117,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
if (Vegetated) if (Vegetated)
return; return;
if (flag) { if (flag) {
this.datawatcher.watch(16, Integer.valueOf(j | i)); this.datawatcher.watch(16, Integer.valueOf(j | i));
} else { } else {
@ -262,11 +257,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return this.passenger != null && this.passenger.equals(entity) ? false : super.damageEntity(damagesource, f); return this.passenger != null && this.passenger.equals(entity) ? false : super.damageEntity(damagesource, f);
} }
public int aU() { public int aV() {
return by[this.cl()]; return by[this.cl()];
} }
public boolean R() { public boolean S() {
return this.passenger == null; return this.passenger == null;
} }
@ -298,26 +293,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
int i = MathHelper.f(f * 0.5F - 3.0F); int i = MathHelper.f(f * 0.5F - 3.0F);
if (i > 0) { if (i > 0) {
// CraftBukkit start - fire EntityDamageEvent this.damageEntity(DamageSource.FALL, (float) i);
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, this, EntityDamageEvent.DamageCause.FALL, i);
if (!event.isCancelled()) {
float damage = (float) event.getDamage();
if (damage > 0) {
this.getBukkitEntity().setLastDamageCause(event);
this.damageEntity(DamageSource.FALL, damage);
}
}
if (this.passenger != null) { if (this.passenger != null) {
EntityDamageEvent passengerEvent = CraftEventFactory.callEntityDamageEvent(null, this.passenger, EntityDamageEvent.DamageCause.FALL, i); this.passenger.damageEntity(DamageSource.FALL, (float) i);
if (!passengerEvent.isCancelled() && this.passenger != null) { // Check again in case of plugin
float damage = (float) passengerEvent.getDamage();
if (damage > 0) {
this.passenger.getBukkitEntity().setLastDamageCause(passengerEvent);
this.passenger.damageEntity(DamageSource.FALL, damage);
}
}
// CraftBukkit end
} }
Block block = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw), MathHelper.floor(this.locZ)); Block block = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw), MathHelper.floor(this.locZ));
@ -415,7 +393,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return this.getAttributeInstance(attributeJumpStrength).getValue(); return this.getAttributeInstance(attributeJumpStrength).getValue();
} }
protected String aT() { protected String aU() {
this.cS(); this.cS();
int i = this.getType(); int i = this.getType();
@ -426,10 +404,10 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
boolean flag = this.random.nextInt(4) == 0; boolean flag = this.random.nextInt(4) == 0;
int i = this.getType(); int i = this.getType();
return i == 4 ? Items.BONE : (i == 3 ? (flag ? Item.d(0) : Items.ROTTEN_FLESH) : Items.LEATHER); return i == 4 ? Items.BONE : (i == 3 ? (flag ? Item.getById(0) : Items.ROTTEN_FLESH) : Items.LEATHER);
} }
protected String aS() { protected String aT() {
this.cS(); this.cS();
if (this.random.nextInt(3) == 0) { if (this.random.nextInt(3) == 0) {
this.cU(); this.cU();
@ -446,7 +424,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
protected String t() { protected String t() {
this.cS(); this.cS();
if (this.random.nextInt(10) == 0 && !this.bg()) { if (this.random.nextInt(10) == 0 && !this.bh()) {
this.cU(); this.cU();
} }
@ -491,10 +469,10 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
} }
} }
protected void aC() { protected void aD() {
super.aC(); super.aD();
this.bb().b(attributeJumpStrength); this.getAttributeMap().b(attributeJumpStrength);
this.getAttributeInstance(GenericAttributes.a).setValue(53.0D); this.getAttributeInstance(GenericAttributes.maxHealth).setValue(53.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.22499999403953552D); this.getAttributeInstance(GenericAttributes.d).setValue(0.22499999403953552D);
} }
@ -506,7 +484,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100 return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100
} }
protected float be() { protected float bf() {
return 0.8F; return 0.8F;
} }
@ -688,7 +666,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return i == 2 || i == 1; return i == 2 || i == 1;
} }
protected boolean bg() { protected boolean bh() {
return this.passenger != null && this.cu() ? true : this.cm() || this.cn(); return this.passenger != null && this.cu() ? true : this.cm() || this.cn();
} }
@ -712,10 +690,23 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
super.die(damagesource); super.die(damagesource);
/* CraftBukkit start - Handle chest dropping in dropDeathLoot below
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.cK(); this.dropChest();
}
// CraftBukkit end */
}
// CraftBukkit start - Add method
protected void dropDeathLoot(boolean flag, int i) {
super.dropDeathLoot(flag, i);
// Moved from die method above
if (!this.world.isStatic) {
this.dropChest();
} }
} }
// CraftBukkit end
public void e() { public void e() {
if (this.random.nextInt(200) == 0) { if (this.random.nextInt(200) == 0) {
@ -858,11 +849,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
String s = this.cv(); String s = this.cv();
if (s != null) { if (s != null) {
this.makeSound(s, this.be(), this.bf()); this.makeSound(s, this.bf(), this.bg());
} }
} }
public void cK() { public void dropChest() {
this.a(this, this.inventoryChest); this.a(this, this.inventoryChest);
this.cs(); this.cs();
} }
@ -880,7 +871,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
} }
public boolean h(EntityHuman entityhuman) { public boolean h(EntityHuman entityhuman) {
this.setOwnerUUID(entityhuman.getUniqueID().toString()); this.setOwnerUUID(entityhuman.getUniqueID().toString());
this.setTame(true); this.setTame(true);
return true; return true;
} }
@ -924,7 +915,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
} }
this.W = 1.0F; this.W = 1.0F;
this.aQ = this.bk() * 0.1F; this.aQ = this.bl() * 0.1F;
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.i((float) this.getAttributeInstance(GenericAttributes.d).getValue()); this.i((float) this.getAttributeInstance(GenericAttributes.d).getValue());
super.e(f, f1); super.e(f, f1);
@ -1018,7 +1009,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication"); this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication");
} }
// CraftBukkit end // CraftBukkit end
AttributeInstance attributeinstance = this.bb().a("Speed"); AttributeInstance attributeinstance = this.getAttributeMap().a("Speed");
if (attributeinstance != null) { if (attributeinstance != null) {
this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D); this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D);
@ -1118,9 +1109,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
} }
entityhorse1.setType(k); entityhorse1.setType(k);
double d0 = this.getAttributeInstance(GenericAttributes.a).b() + entityageable.getAttributeInstance(GenericAttributes.a).b() + (double) this.cV(); double d0 = this.getAttributeInstance(GenericAttributes.maxHealth).b() + entityageable.getAttributeInstance(GenericAttributes.maxHealth).b() + (double) this.cV();
entityhorse1.getAttributeInstance(GenericAttributes.a).setValue(d0 / 3.0D); entityhorse1.getAttributeInstance(GenericAttributes.maxHealth).setValue(d0 / 3.0D);
double d1 = this.getAttributeInstance(attributeJumpStrength).b() + entityageable.getAttributeInstance(attributeJumpStrength).b() + this.cW(); double d1 = this.getAttributeInstance(attributeJumpStrength).b() + entityageable.getAttributeInstance(attributeJumpStrength).b() + this.cW();
entityhorse1.getAttributeInstance(attributeJumpStrength).setValue(d1 / 3.0D); entityhorse1.getAttributeInstance(attributeJumpStrength).setValue(d1 / 3.0D);
@ -1130,8 +1121,8 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return entityhorse1; return entityhorse1;
} }
public GroupDataEntity a(GroupDataEntity groupdataentity) { public GroupDataEntity prepare(GroupDataEntity groupdataentity) {
Object object = super.a(groupdataentity); Object object = super.prepare(groupdataentity);
boolean flag = false; boolean flag = false;
int i = 0; int i = 0;
int j; int j;
@ -1160,14 +1151,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
} }
if (j != 4 && j != 3) { if (j != 4 && j != 3) {
this.getAttributeInstance(GenericAttributes.a).setValue((double) this.cV()); this.getAttributeInstance(GenericAttributes.maxHealth).setValue((double) this.cV());
if (j == 0) { if (j == 0) {
this.getAttributeInstance(GenericAttributes.d).setValue(this.cX()); this.getAttributeInstance(GenericAttributes.d).setValue(this.cX());
} else { } else {
this.getAttributeInstance(GenericAttributes.d).setValue(0.17499999701976776D); this.getAttributeInstance(GenericAttributes.d).setValue(0.17499999701976776D);
} }
} else { } else {
this.getAttributeInstance(GenericAttributes.a).setValue(15.0D); this.getAttributeInstance(GenericAttributes.maxHealth).setValue(15.0D);
this.getAttributeInstance(GenericAttributes.d).setValue(0.20000000298023224D); this.getAttributeInstance(GenericAttributes.d).setValue(0.20000000298023224D);
} }
@ -1181,7 +1172,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
return (GroupDataEntity) object; return (GroupDataEntity) object;
} }
protected boolean bj() { protected boolean bk() {
return true; return true;
} }
@ -1199,7 +1190,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
power = 0.4F + 0.4F * (float) i / 90.0F; power = 0.4F + 0.4F * (float) i / 90.0F;
} }
org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory.callHorseJumpEvent(this, power); org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory.callHorseJumpEvent(this, power);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.bI = true; this.bI = true;
this.cU(); this.cU();
@ -1209,15 +1200,15 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
} }
} }
public void ab() { public void ac() {
super.ab(); super.ac();
if (this.bM > 0.0F) { if (this.bM > 0.0F) {
float f = MathHelper.sin(this.aM * 3.1415927F / 180.0F); float f = MathHelper.sin(this.aM * 3.1415927F / 180.0F);
float f1 = MathHelper.cos(this.aM * 3.1415927F / 180.0F); float f1 = MathHelper.cos(this.aM * 3.1415927F / 180.0F);
float f2 = 0.7F * this.bM; float f2 = 0.7F * this.bM;
float f3 = 0.15F * this.bM; float f3 = 0.15F * this.bM;
this.passenger.setPosition(this.locX + (double) (f2 * f), this.locY + this.ad() + this.passenger.ac() + (double) f3, this.locZ - (double) (f2 * f1)); this.passenger.setPosition(this.locX + (double) (f2 * f), this.locY + this.ad() + this.passenger.ad() + (double) f3, this.locZ - (double) (f2 * f1));
if (this.passenger instanceof EntityLiving) { if (this.passenger instanceof EntityLiving) {
((EntityLiving) this.passenger).aM = this.aM; ((EntityLiving) this.passenger).aM = this.aM;
} }
@ -1243,4 +1234,4 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
public boolean h_() { public boolean h_() {
return false; return false;
} }
} }

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
@ -9,9 +9,9 @@ import net.minecraft.util.com.google.common.base.Charsets;
import net.minecraft.util.com.mojang.authlib.GameProfile; import net.minecraft.util.com.mojang.authlib.GameProfile;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftHumanEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftItem; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftItem;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.entity.EntityCombustByEntityEvent;
import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.player.PlayerBedEnterEvent;
@ -82,9 +82,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.maxFireTicks = 20; this.maxFireTicks = 20;
} }
protected void aC() { protected void aD() {
super.aC(); super.aD();
this.bb().b(GenericAttributes.e).setValue(1.0D); this.getAttributeMap().b(GenericAttributes.e).setValue(1.0D);
} }
protected void c() { protected void c() {
@ -94,19 +94,19 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.datawatcher.a(18, Integer.valueOf(0)); this.datawatcher.a(18, Integer.valueOf(0));
} }
public boolean bx() { public boolean by() {
return this.f != null; return this.f != null;
} }
public void bz() { public void bA() {
if (this.f != null) { if (this.f != null) {
this.f.b(this.world, this, this.g); this.f.b(this.world, this, this.g);
} }
this.bA(); this.bB();
} }
public void bA() { public void bB() {
this.f = null; this.f = null;
this.g = 0; this.g = 0;
if (!this.world.isStatic) { if (!this.world.isStatic) {
@ -115,7 +115,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
public boolean isBlocking() { public boolean isBlocking() {
return this.bx() && this.f.getItem().d(this.f) == EnumAnimation.BLOCK; return this.by() && this.f.getItem().d(this.f) == EnumAnimation.BLOCK;
} }
public void h() { public void h() {
@ -131,7 +131,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.p(); this.p();
} }
} else { } else {
this.bA(); this.bB();
} }
} }
@ -214,19 +214,19 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
public int C() { public int D() {
return this.abilities.isInvulnerable ? 0 : 80; return this.abilities.isInvulnerable ? 0 : 80;
} }
protected String G() { protected String H() {
return "game.player.swim"; return "game.player.swim";
} }
protected String N() { protected String O() {
return "game.player.swim.splash"; return "game.player.swim.splash";
} }
public int ah() { public int ai() {
return 10; return 10;
} }
@ -250,7 +250,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
vec3d1.a(-this.pitch * 3.1415927F / 180.0F); vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F); vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
String s = "iconcrack_" + Item.b(itemstack.getItem()); String s = "iconcrack_" + Item.getId(itemstack.getItem());
if (itemstack.usesData()) { if (itemstack.usesData()) {
s = s + "_" + itemstack.getData(); s = s + "_" + itemstack.getData();
@ -276,7 +276,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (event.isCancelled()) { if (event.isCancelled()) {
// Update client // Update client
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
// Spigot Start // Spigot Start
((EntityPlayer) this).getBukkitEntity().updateInventory(); ((EntityPlayer) this).getBukkitEntity().updateInventory();
((EntityPlayer) this).getBukkitEntity().updateScaledHealth(); ((EntityPlayer) this).getBukkitEntity().updateScaledHealth();
@ -291,7 +291,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
// Update client // Update client
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.getSlot((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f));
} }
return; return;
} }
@ -306,11 +306,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
this.bA(); this.bB();
} }
} }
protected boolean bg() { protected boolean bh() {
return this.getHealth() <= 0.0F || this.isSleeping(); return this.getHealth() <= 0.0F || this.isSleeping();
} }
@ -352,7 +352,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
public void aa() { public void ab() {
if (!this.world.isStatic && this.isSneaking()) { if (!this.world.isStatic && this.isSneaking()) {
this.mount((Entity) null); this.mount((Entity) null);
this.setSneaking(false); this.setSneaking(false);
@ -363,7 +363,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
float f = this.yaw; float f = this.yaw;
float f1 = this.pitch; float f1 = this.pitch;
super.aa(); super.ab();
this.br = this.bs; this.br = this.bs;
this.bs = 0.0F; this.bs = 0.0F;
this.l(this.locX - d0, this.locY - d1, this.locZ - d2); this.l(this.locX - d0, this.locY - d1, this.locZ - d2);
@ -375,9 +375,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
protected void bp() { protected void bq() {
super.bp(); super.bq();
this.ba(); this.bb();
} }
public void e() { public void e() {
@ -407,7 +407,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.i((float) attributeinstance.getValue()); this.i((float) attributeinstance.getValue());
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
// CraftBukkit - Math -> TrigMath // CraftBukkit - Math -> TrigMath
float f1 = (float) org.bukkit.craftbukkit.v1_7_R3.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; float f1 = (float) org.bukkit.craftbukkit.v1_7_R4.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
if (f > 0.1F) { if (f > 0.1F) {
f = 0.1F; f = 0.1F;
@ -434,7 +434,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
List list = this.world.getEntities(this, axisalignedbb); List list = this.world.getEntities(this, axisalignedbb);
if (list != null && this.R()) { // Spigot: Add this.R() condition if (list != null && this.S()) { // Spigot: Add this.S() condition (second !this.isDead near bottom of EntityLiving)
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i); Entity entity = (Entity) list.get(i);
@ -488,11 +488,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(StatisticList.v, 1); this.a(StatisticList.v, 1);
} }
protected String aS() { protected String aT() {
return "game.player.hurt"; return "game.player.hurt";
} }
protected String aT() { protected String aU() {
return "game.player.die"; return "game.player.die";
} }
@ -519,6 +519,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
public EntityItem a(boolean flag) { public EntityItem a(boolean flag) {
// Called only when dropped by Q or CTRL-Q
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true); return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true);
} }
@ -570,7 +571,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
player.getInventory().addItem(drop.getItemStack()); org.bukkit.inventory.ItemStack cur = player.getInventory().getItemInHand();
if (flag1 && (cur == null || cur.getAmount() == 0)) {
// The complete stack was dropped
player.getInventory().setItemInHand(drop.getItemStack());
} else if (flag1 && cur.isSimilar(drop.getItemStack()) && drop.getItemStack().getAmount() == 1) {
// Only one item is dropped
cur.setAmount(cur.getAmount() + 1);
player.getInventory().setItemInHand(cur);
} else {
// Fallback
player.getInventory().addItem(drop.getItemStack());
}
return null; return null;
} }
// CraftBukkit end // CraftBukkit end
@ -780,15 +792,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
// CraftBukkit end // CraftBukkit end
} }
protected void h(float f) { protected void damageArmor(float f) {
this.inventory.a(f); this.inventory.a(f);
} }
public int aU() { public int aV() {
return this.inventory.l(); return this.inventory.l();
} }
public float bD() { public float bE() {
int i = 0; int i = 0;
ItemStack[] aitemstack = this.inventory.armor; ItemStack[] aitemstack = this.inventory.armor;
int j = aitemstack.length; int j = aitemstack.length;
@ -804,26 +816,32 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return (float) i / (float) this.inventory.armor.length; return (float) i / (float) this.inventory.armor.length;
} }
protected void d(DamageSource damagesource, float f) { // CraftBukkit start
protected boolean d(DamageSource damagesource, float f) { // void -> boolean
if (true) {
return super.d(damagesource, f);
}
// CraftBukkit end
if (!this.isInvulnerable()) { if (!this.isInvulnerable()) {
if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) { if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) {
f = (1.0F + f) * 0.5F; f = (1.0F + f) * 0.5F;
} }
f = this.b(damagesource, f); f = this.applyArmorModifier(damagesource, f);
f = this.c(damagesource, f); f = this.applyMagicModifier(damagesource, f);
float f1 = f; float f1 = f;
f = Math.max(f - this.br(), 0.0F); f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
this.m(this.br() - (f1 - f)); this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
if (f != 0.0F) { if (f != 0.0F) {
this.a(damagesource.f()); this.applyExhaustion(damagesource.getExhaustionCost());
float f2 = this.getHealth(); float f2 = this.getHealth();
this.setHealth(this.getHealth() - f); this.setHealth(this.getHealth() - f);
this.aV().a(damagesource, f2, f); this.aW().a(damagesource, f2, f);
} }
} }
return false; // CraftBukkit
} }
public void openFurnace(TileEntityFurnace tileentityfurnace) {} public void openFurnace(TileEntityFurnace tileentityfurnace) {}
@ -843,7 +861,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void b(ItemStack itemstack) {} public void b(ItemStack itemstack) {}
public boolean q(Entity entity) { public boolean q(Entity entity) {
ItemStack itemstack = this.bE(); ItemStack itemstack = this.bF();
ItemStack itemstack1 = itemstack != null ? itemstack.cloneItemStack() : null; ItemStack itemstack1 = itemstack != null ? itemstack.cloneItemStack() : null;
if (!entity.c(this)) { if (!entity.c(this)) {
@ -855,7 +873,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (itemstack.a(this, (EntityLiving) entity)) { if (itemstack.a(this, (EntityLiving) entity)) {
// CraftBukkit - bypass infinite items; <= 0 -> == 0 // CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) { if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
this.bF(); this.bG();
} }
return true; return true;
@ -864,9 +882,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return false; return false;
} else { } else {
if (itemstack != null && itemstack == this.bE()) { if (itemstack != null && itemstack == this.bF()) {
if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) { if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) {
this.bF(); this.bG();
} else if (itemstack.count < itemstack1.count && this.abilities.canInstantlyBuild) { } else if (itemstack.count < itemstack1.count && this.abilities.canInstantlyBuild) {
itemstack.count = itemstack1.count; itemstack.count = itemstack1.count;
} }
@ -876,20 +894,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
public ItemStack bE() { public ItemStack bF() {
return this.inventory.getItemInHand(); return this.inventory.getItemInHand();
} }
public void bF() { public void bG() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null); this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
} }
public double ac() { public double ad() {
return (double) (this.height - 0.5F); return (double) (this.height - 0.5F);
} }
public void attack(Entity entity) { public void attack(Entity entity) {
if (entity.au()) { if (entity.av()) {
if (!entity.j(this)) { if (!entity.j(this)) {
float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue(); float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue();
int i = 0; int i = 0;
@ -905,8 +923,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
if (f > 0.0F || f1 > 0.0F) { if (f > 0.0F || f1 > 0.0F) {
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.h_() && !this.M() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.h_() && !this.L() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
if (flag && f > 0.0F) { if (flag && f > 0.0F) {
f *= 1.5F; f *= 1.5F;
@ -956,7 +973,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
EnchantmentManager.b(this, entity); EnchantmentManager.b(this, entity);
ItemStack itemstack = this.bE(); ItemStack itemstack = this.bF();
Object object = entity; Object object = entity;
if (entity instanceof EntityComplexPart) { if (entity instanceof EntityComplexPart) {
@ -971,7 +988,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
itemstack.a((EntityLiving) object, this); itemstack.a((EntityLiving) object, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0 // CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) { if (itemstack.count == 0) {
this.bF(); this.bG();
} }
} }
@ -989,7 +1006,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
this.a(0.3F); this.applyExhaustion(0.3F);
} else if (flag1) { } else if (flag1) {
entity.extinguish(); entity.extinguish();
} }
@ -1045,7 +1062,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
if (this.al()) { if (this.am()) {
this.mount((Entity) null); this.mount((Entity) null);
} }
@ -1245,13 +1262,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(Statistic statistic, int i) {} public void a(Statistic statistic, int i) {}
public void bi() { public void bj() {
super.bi(); super.bj();
this.a(StatisticList.r, 1); this.a(StatisticList.r, 1);
if (this.isSprinting()) { if (this.isSprinting()) {
this.a(0.8F); this.applyExhaustion(0.8F);
} else { } else {
this.a(0.2F); this.applyExhaustion(0.2F);
} }
} }
@ -1275,7 +1292,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2); this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2);
} }
public float bk() { public float bl() {
return (float) this.getAttributeInstance(GenericAttributes.d).getValue(); return (float) this.getAttributeInstance(GenericAttributes.d).getValue();
} }
@ -1287,13 +1304,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) { if (i > 0) {
this.a(StatisticList.m, i); this.a(StatisticList.m, i);
this.a(0.015F * (float) i * 0.01F); this.applyExhaustion(0.015F * (float) i * 0.01F);
} }
} else if (this.L()) { } else if (this.M()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) { if (i > 0) {
this.a(StatisticList.i, i); this.a(StatisticList.i, i);
this.a(0.015F * (float) i * 0.01F); this.applyExhaustion(0.015F * (float) i * 0.01F);
} }
} else if (this.h_()) { } else if (this.h_()) {
if (d1 > 0.0D) { if (d1 > 0.0D) {
@ -1304,9 +1321,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (i > 0) { if (i > 0) {
this.a(StatisticList.h, i); this.a(StatisticList.h, i);
if (this.isSprinting()) { if (this.isSprinting()) {
this.a(0.099999994F * (float) i * 0.01F); this.applyExhaustion(0.099999994F * (float) i * 0.01F);
} else { } else {
this.a(0.01F * (float) i * 0.01F); this.applyExhaustion(0.01F * (float) i * 0.01F);
} }
} }
} else { } else {
@ -1368,9 +1385,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
} }
public void ar() { public void as() {
if (!this.abilities.isFlying) { if (!this.abilities.isFlying) {
super.ar(); super.as();
} }
} }
@ -1414,7 +1431,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.expLevel >= 30 ? 62 + (this.expLevel - 30) * 7 : (this.expLevel >= 15 ? 17 + (this.expLevel - 15) * 3 : 17); return this.expLevel >= 30 ? 62 + (this.expLevel - 30) * 7 : (this.expLevel >= 15 ? 17 + (this.expLevel - 15) * 3 : 17);
} }
public void a(float f) { public void applyExhaustion(float f) {
if (!this.abilities.isInvulnerable) { if (!this.abilities.isInvulnerable) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.foodData.a(f); this.foodData.a(f);
@ -1430,7 +1447,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return (flag || this.foodData.c()) && !this.abilities.isInvulnerable; return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
} }
public boolean bQ() { public boolean bR() {
return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth(); return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth();
} }
@ -1455,8 +1472,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return true; return true;
} }
if (this.bE() != null) { if (this.bF() != null) {
ItemStack itemstack = this.bE(); ItemStack itemstack = this.bF();
if (itemstack.b(block) || itemstack.a(block) > 1.0F) { if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
return true; return true;
@ -1531,7 +1548,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1]; return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
} }
public ItemStack bd() { public ItemStack be() {
return this.inventory.getItemInHand(); return this.inventory.getItemInHand();
} }
@ -1543,7 +1560,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.inventory.armor; return this.inventory.armor;
} }
public boolean aB() { public boolean aC() {
return !this.abilities.isFlying; return !this.abilities.isFlying;
} }
@ -1563,7 +1580,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return chatcomponenttext; return chatcomponenttext;
} }
public void m(float f) { public void setAbsorptionHearts(float f) {
if (f < 0.0F) { if (f < 0.0F) {
f = 0.0F; f = 0.0F;
} }
@ -1571,7 +1588,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.getDataWatcher().watch(17, Float.valueOf(f)); this.getDataWatcher().watch(17, Float.valueOf(f));
} }
public float br() { public float getAbsorptionHearts() {
return this.getDataWatcher().getFloat(17); return this.getDataWatcher().getFloat(17);
} }
@ -1584,4 +1601,4 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return uuid; return uuid;
} }
} }

View File

@ -1,11 +1,11 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory; import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.event.entity.EntityUnleashEvent; import org.bukkit.event.entity.EntityUnleashEvent;
import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
// CraftBukkit end // CraftBukkit end
@ -33,7 +33,7 @@ public abstract class EntityInsentient extends EntityLiving {
private boolean bv; private boolean bv;
private Entity bw; private Entity bw;
private NBTTagCompound bx; private NBTTagCompound bx;
public boolean Vegetated; public boolean Vegetated;
public boolean BreakLeash = true; public boolean BreakLeash = true;
public boolean PullWhileLeashed = true; public boolean PullWhileLeashed = true;
@ -54,9 +54,9 @@ public abstract class EntityInsentient extends EntityLiving {
} }
} }
protected void aC() { protected void aD() {
super.aC(); super.aD();
this.bb().b(GenericAttributes.b).setValue(16.0D); this.getAttributeMap().b(GenericAttributes.b).setValue(16.0D);
} }
public ControllerLook getControllerLook() { public ControllerLook getControllerLook() {
@ -107,12 +107,12 @@ public abstract class EntityInsentient extends EntityLiving {
String s = this.t(); String s = this.t();
if (s != null) { if (s != null) {
this.makeSound(s, this.be(), this.bf()); this.makeSound(s, this.bf(), this.bg());
} }
} }
public void B() { public void C() {
super.B(); super.C();
this.world.methodProfiler.a("mobBaseTick"); this.world.methodProfiler.a("mobBaseTick");
if (this.isAlive() && !Silent && this.random.nextInt(1000) < this.a_++) { if (this.isAlive() && !Silent && this.random.nextInt(1000) < this.a_++) {
this.a_ = -this.q(); this.a_ = -this.q();
@ -158,7 +158,7 @@ public abstract class EntityInsentient extends EntityLiving {
} }
protected float f(float f, float f1) { protected float f(float f, float f1) {
if (this.bj()) { if (this.bk()) {
this.bn.a(); this.bn.a();
return f1; return f1;
} else { } else {
@ -171,12 +171,10 @@ public abstract class EntityInsentient extends EntityLiving {
} }
protected Item getLoot() { protected Item getLoot() {
return Item.d(0); return Item.getById(0);
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - Whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
Item item = this.getLoot(); Item item = this.getLoot();
if (item != null) { if (item != null) {
@ -186,25 +184,10 @@ public abstract class EntityInsentient extends EntityLiving {
j += this.random.nextInt(i + 1); j += this.random.nextInt(i + 1);
} }
if (j > 0) { for (int k = 0; k < j; ++k) {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.v1_7_R3.util.CraftMagicNumbers.getMaterial(item), j)); this.a(item, 1);
} }
} }
// Determine rare item drops and add them to the loot
if (this.lastDamageByPlayerTime > 0) {
int k = this.random.nextInt(200) - i;
if (k < 5) {
ItemStack itemstack = this.getRareDrop(k <= 0 ? 1 : 0);
if (itemstack != null) {
loot.add(org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack.asCraftMirror(itemstack));
}
}
}
CraftEventFactory.callEntityDeathEvent(this, loot); // raise event even for those times when the entity does not drop loot
// CraftBukkit end
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
@ -383,7 +366,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
protected boolean bj() { protected boolean bk() {
return false; return false;
} }
@ -416,7 +399,7 @@ public abstract class EntityInsentient extends EntityLiving {
} }
} }
protected void bm() { protected void bn() {
++this.aU; ++this.aU;
this.world.methodProfiler.a("checkDespawn"); this.world.methodProfiler.a("checkDespawn");
this.w(); this.w();
@ -440,7 +423,7 @@ public abstract class EntityInsentient extends EntityLiving {
this.navigation.f(); this.navigation.f();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("mob tick"); this.world.methodProfiler.a("mob tick");
this.bo(); this.bp();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("controls"); this.world.methodProfiler.a("controls");
this.world.methodProfiler.a("move"); this.world.methodProfiler.a("move");
@ -453,8 +436,8 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
protected void bp() { protected void bq() {
super.bp(); super.bq();
this.bd = 0.0F; this.bd = 0.0F;
this.be = 0.0F; this.be = 0.0F;
this.w(); this.w();
@ -472,7 +455,7 @@ public abstract class EntityInsentient extends EntityLiving {
} }
if (this.bu != null) { if (this.bu != null) {
this.a(this.bu, 10.0F, (float) this.bv()); this.a(this.bu, 10.0F, (float) this.x());
if (this.g-- <= 0 || this.bu.dead || this.bu.f((Entity) this) > (double) (f * f)) { if (this.g-- <= 0 || this.bu.dead || this.bu.f((Entity) this) > (double) (f * f)) {
this.bu = null; this.bu = null;
} }
@ -485,15 +468,15 @@ public abstract class EntityInsentient extends EntityLiving {
this.pitch = this.f; this.pitch = this.f;
} }
boolean flag = this.L(); boolean flag = this.M();
boolean flag1 = this.O(); boolean flag1 = this.P();
if (flag || flag1) { if (flag || flag1) {
this.bc = this.random.nextFloat() < 0.8F; this.bc = this.random.nextFloat() < 0.8F;
} }
} }
public int bv() { public int x() {
return 40; return 40;
} }
@ -540,7 +523,7 @@ public abstract class EntityInsentient extends EntityLiving {
return 4; return 4;
} }
public int aw() { public int ax() {
if (this.getGoalTarget() == null) { if (this.getGoalTarget() == null) {
return 3; return 3;
} else { } else {
@ -555,7 +538,7 @@ public abstract class EntityInsentient extends EntityLiving {
} }
} }
public ItemStack bd() { public ItemStack be() {
return this.equipment[0]; return this.equipment[0];
} }
@ -722,8 +705,8 @@ public abstract class EntityInsentient extends EntityLiving {
protected void bD() { protected void bD() {
float f = this.world.b(this.locX, this.locY, this.locZ); float f = this.world.b(this.locX, this.locY, this.locZ);
if (this.bd() != null && this.random.nextFloat() < 0.25F * f) { if (this.be() != null && this.random.nextFloat() < 0.25F * f) {
EnchantmentManager.a(this.random, this.bd(), (int) (5.0F + f * (float) this.random.nextInt(18))); EnchantmentManager.a(this.random, this.be(), (int) (5.0F + f * (float) this.random.nextInt(18)));
} }
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
@ -735,7 +718,7 @@ public abstract class EntityInsentient extends EntityLiving {
} }
} }
public GroupDataEntity a(GroupDataEntity groupdataentity) { public GroupDataEntity prepare(GroupDataEntity groupdataentity) {
this.getAttributeInstance(GenericAttributes.b).a(new AttributeModifier("Random spawn bonus", this.random.nextGaussian() * 0.05D, 1)); this.getAttributeInstance(GenericAttributes.b).a(new AttributeModifier("Random spawn bonus", this.random.nextGaussian() * 0.05D, 1));
return groupdataentity; return groupdataentity;
} }
@ -814,7 +797,7 @@ public abstract class EntityInsentient extends EntityLiving {
return true; return true;
} }
if (entityhuman.getName().equalsIgnoreCase(((EntityTameableAnimal) this).getName())) { if (((EntityTameableAnimal) this).e(entityhuman)) {
// CraftBukkit start - fire PlayerLeashEntityEvent // CraftBukkit start - fire PlayerLeashEntityEvent
if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) { if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
@ -916,4 +899,4 @@ public abstract class EntityInsentient extends EntityLiving {
this.bx = null; this.bx = null;
} }
} }

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
@ -8,11 +8,16 @@ import java.util.Random;
import java.util.UUID; import java.util.UUID;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory; import java.util.ArrayList;
import com.google.common.base.Function;
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.EntityRegainHealthEvent;
// CraftBukkit end // CraftBukkit end
import org.bukkit.craftbukkit.v1_7_R4.SpigotTimings; // Spigot
public abstract class EntityLiving extends Entity { public abstract class EntityLiving extends Entity {
private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@ -77,6 +82,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit start // CraftBukkit start
public int expToDrop; public int expToDrop;
public int maxAirTicks = 300; public int maxAirTicks = 300;
ArrayList<org.bukkit.inventory.ItemStack> drops = null;
// CraftBukkit end // CraftBukkit end
// Spigot start // Spigot start
public void inactiveTick() public void inactiveTick()
@ -84,14 +90,14 @@ public abstract class EntityLiving extends Entity {
super.inactiveTick(); super.inactiveTick();
++this.aU; // Above all the floats ++this.aU; // Above all the floats
} }
// Spigot en // Spigot end
public boolean ghost; public boolean ghost;
public EntityLiving(World world) { public EntityLiving(World world) {
super(world); super(world);
this.aC(); this.aD();
// CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
this.datawatcher.watch(6, (float) this.getAttributeInstance(GenericAttributes.a).getValue()); this.datawatcher.watch(6, (float) this.getAttributeInstance(GenericAttributes.maxHealth).getValue());
this.k = true; this.k = true;
this.aL = (float) (Math.random() + 1.0D) * 0.01F; this.aL = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
@ -108,18 +114,18 @@ public abstract class EntityLiving extends Entity {
this.datawatcher.a(6, Float.valueOf(1.0F)); this.datawatcher.a(6, Float.valueOf(1.0F));
} }
protected void aC() { protected void aD() {
this.bb().b(GenericAttributes.a); this.getAttributeMap().b(GenericAttributes.maxHealth);
this.bb().b(GenericAttributes.c); this.getAttributeMap().b(GenericAttributes.c);
this.bb().b(GenericAttributes.d); this.getAttributeMap().b(GenericAttributes.d);
if (!this.bj()) { if (!this.bk()) {
this.getAttributeInstance(GenericAttributes.d).setValue(0.10000000149011612D); this.getAttributeInstance(GenericAttributes.d).setValue(0.10000000149011612D);
} }
} }
protected void a(double d0, boolean flag) { protected void a(double d0, boolean flag) {
if (!this.L()) { if (!this.M()) {
this.M(); this.N();
} }
if (flag && this.fallDistance > 0.0F) { if (flag && this.fallDistance > 0.0F) {
@ -151,13 +157,13 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag); super.a(d0, flag);
} }
public boolean aD() { public boolean aE() {
return false; return false;
} }
public void B() { public void C() {
this.aC = this.aD; this.aC = this.aD;
super.B(); super.C();
this.world.methodProfiler.a("livingEntityBaseTick"); this.world.methodProfiler.a("livingEntityBaseTick");
if (this.isAlive() && this.inBlock()) { if (this.isAlive() && this.inBlock()) {
this.damageEntity(DamageSource.STUCK, 1.0F); this.damageEntity(DamageSource.STUCK, 1.0F);
@ -170,7 +176,7 @@ public abstract class EntityLiving extends Entity {
boolean flag = this instanceof EntityHuman && ((EntityHuman) this).abilities.isInvulnerable; boolean flag = this instanceof EntityHuman && ((EntityHuman) this).abilities.isInvulnerable;
if (this.isAlive() && this.a(Material.WATER)) { if (this.isAlive() && this.a(Material.WATER)) {
if (!this.aD() && !this.hasEffect(MobEffectList.WATER_BREATHING.id) && !flag) { if (!this.aE() && !this.hasEffect(MobEffectList.WATER_BREATHING.id) && !flag) {
this.setAirTicks(this.j(this.getAirTicks())); this.setAirTicks(this.j(this.getAirTicks()));
if (this.getAirTicks() == -20) { if (this.getAirTicks() == -20) {
this.setAirTicks(0); this.setAirTicks(0);
@ -187,7 +193,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
if (!this.world.isStatic && this.al() && this.vehicle instanceof EntityLiving) { if (!this.world.isStatic && this.am() && this.vehicle instanceof EntityLiving) {
this.mount((Entity) null); this.mount((Entity) null);
} }
} else { } else {
@ -198,7 +204,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end // CraftBukkit end
} }
if (this.isAlive() && this.K()) { if (this.isAlive() && this.L()) {
this.extinguish(); this.extinguish();
} }
@ -216,7 +222,7 @@ public abstract class EntityLiving extends Entity {
} }
if (this.getHealth() <= 0.0F) { if (this.getHealth() <= 0.0F) {
this.aE(); this.aF();
} }
if (this.lastDamageByPlayerTime > 0) { if (this.lastDamageByPlayerTime > 0) {
@ -237,7 +243,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
this.aN(); this.aO();
this.aY = this.aX; this.aY = this.aX;
this.aN = this.aM; this.aN = this.aM;
this.aP = this.aO; this.aP = this.aO;
@ -250,7 +256,7 @@ public abstract class EntityLiving extends Entity {
public int getExpReward() { public int getExpReward() {
int exp = this.getExpValue(this.killer); int exp = this.getExpValue(this.killer);
if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.aF() && this.world.getGameRules().getBoolean("doMobLoot")) { if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.aG() && this.world.getGameRules().getBoolean("doMobLoot")) {
return exp; return exp;
} else { } else {
return 0; return 0;
@ -262,7 +268,7 @@ public abstract class EntityLiving extends Entity {
return false; return false;
} }
protected void aE() { protected void aF() {
++this.deathTicks; ++this.deathTicks;
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
int i; int i;
@ -290,7 +296,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
protected boolean aF() { protected boolean aG() {
return !this.isBaby(); return !this.isBaby();
} }
@ -308,7 +314,7 @@ public abstract class EntityLiving extends Entity {
return false; return false;
} }
public Random aH() { public Random aI() {
return this.random; return this.random;
} }
@ -316,7 +322,7 @@ public abstract class EntityLiving extends Entity {
return this.lastDamager; return this.lastDamager;
} }
public int aJ() { public int aK() {
return this.bm; return this.bm;
} }
@ -325,11 +331,11 @@ public abstract class EntityLiving extends Entity {
this.bm = this.ticksLived; this.bm = this.ticksLived;
} }
public EntityLiving aK() { public EntityLiving aL() {
return this.bn; return this.bn;
} }
public int aL() { public int aM() {
return this.bo; return this.bo;
} }
@ -343,7 +349,7 @@ public abstract class EntityLiving extends Entity {
this.bo = this.ticksLived; this.bo = this.ticksLived;
} }
public int aM() { public int aN() {
return this.aU; return this.aU;
} }
@ -353,7 +359,7 @@ public abstract class EntityLiving extends Entity {
nbttagcompound.setShort("HurtTime", (short) this.hurtTicks); nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
nbttagcompound.setShort("DeathTime", (short) this.deathTicks); nbttagcompound.setShort("DeathTime", (short) this.deathTicks);
nbttagcompound.setShort("AttackTime", (short) this.attackTicks); nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
nbttagcompound.setFloat("AbsorptionAmount", this.br()); nbttagcompound.setFloat("AbsorptionAmount", this.getAbsorptionHearts());
ItemStack[] aitemstack = this.getEquipment(); ItemStack[] aitemstack = this.getEquipment();
int i = aitemstack.length; int i = aitemstack.length;
@ -367,7 +373,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
nbttagcompound.set("Attributes", GenericAttributes.a(this.bb())); nbttagcompound.set("Attributes", GenericAttributes.a(this.getAttributeMap()));
aitemstack = this.getEquipment(); aitemstack = this.getEquipment();
i = aitemstack.length; i = aitemstack.length;
@ -393,9 +399,9 @@ public abstract class EntityLiving extends Entity {
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.m(nbttagcompound.getFloat("AbsorptionAmount")); this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount"));
if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isStatic) { if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isStatic) {
GenericAttributes.a(this.bb(), nbttagcompound.getList("Attributes", 10)); GenericAttributes.a(this.getAttributeMap(), nbttagcompound.getList("Attributes", 10));
} }
if (nbttagcompound.hasKeyOfType("ActiveEffects", 9)) { if (nbttagcompound.hasKeyOfType("ActiveEffects", 9)) {
@ -415,9 +421,9 @@ public abstract class EntityLiving extends Entity {
if (nbttagcompound.hasKey("Bukkit.MaxHealth")) { if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth"); NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth");
if (nbtbase.getTypeId() == 5) { if (nbtbase.getTypeId() == 5) {
this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagFloat) nbtbase).c()); this.getAttributeInstance(GenericAttributes.maxHealth).setValue((double) ((NBTTagFloat) nbtbase).c());
} else if (nbtbase.getTypeId() == 3) { } else if (nbtbase.getTypeId() == 3) {
this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagInt) nbtbase).d()); this.getAttributeInstance(GenericAttributes.maxHealth).setValue((double) ((NBTTagInt) nbtbase).d());
} }
} }
// CraftBukkit end // CraftBukkit end
@ -441,7 +447,7 @@ public abstract class EntityLiving extends Entity {
this.attackTicks = nbttagcompound.getShort("AttackTime"); this.attackTicks = nbttagcompound.getShort("AttackTime");
} }
protected void aN() { protected void aO() {
Iterator iterator = this.effects.keySet().iterator(); Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -559,7 +565,7 @@ public abstract class EntityLiving extends Entity {
return true; return true;
} }
public boolean aQ() { public boolean aR() {
return this.getMonsterType() == EnumMonsterType.UNDEAD; return this.getMonsterType() == EnumMonsterType.UNDEAD;
} }
@ -574,22 +580,22 @@ public abstract class EntityLiving extends Entity {
protected void a(MobEffect mobeffect) { protected void a(MobEffect mobeffect) {
this.updateEffects = true; this.updateEffects = true;
if (!this.world.isStatic) { if (!this.world.isStatic) {
MobEffectList.byId[mobeffect.getEffectId()].b(this, this.bb(), mobeffect.getAmplifier()); MobEffectList.byId[mobeffect.getEffectId()].b(this, this.getAttributeMap(), mobeffect.getAmplifier());
} }
} }
protected void a(MobEffect mobeffect, boolean flag) { protected void a(MobEffect mobeffect, boolean flag) {
this.updateEffects = true; this.updateEffects = true;
if (flag && !this.world.isStatic) { if (flag && !this.world.isStatic) {
MobEffectList.byId[mobeffect.getEffectId()].a(this, this.bb(), mobeffect.getAmplifier()); MobEffectList.byId[mobeffect.getEffectId()].a(this, this.getAttributeMap(), mobeffect.getAmplifier());
MobEffectList.byId[mobeffect.getEffectId()].b(this, this.bb(), mobeffect.getAmplifier()); MobEffectList.byId[mobeffect.getEffectId()].b(this, this.getAttributeMap(), mobeffect.getAmplifier());
} }
} }
protected void b(MobEffect mobeffect) { protected void b(MobEffect mobeffect) {
this.updateEffects = true; this.updateEffects = true;
if (!this.world.isStatic) { if (!this.world.isStatic) {
MobEffectList.byId[mobeffect.getEffectId()].a(this, this.bb(), mobeffect.getAmplifier()); MobEffectList.byId[mobeffect.getEffectId()].a(this, this.getAttributeMap(), mobeffect.getAmplifier());
} }
} }
@ -623,7 +629,7 @@ public abstract class EntityLiving extends Entity {
public void setHealth(float f) { public void setHealth(float f) {
// CraftBukkit start - Handle scaled health // CraftBukkit start - Handle scaled health
if (this instanceof EntityPlayer) { if (this instanceof EntityPlayer) {
org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity(); org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity();
// Squeeze // Squeeze
if (f < 0.0F) { if (f < 0.0F) {
player.setRealHealth(0.0D); player.setRealHealth(0.0D);
@ -652,7 +658,8 @@ public abstract class EntityLiving extends Entity {
} else if (damagesource.o() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) { } else if (damagesource.o() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
return false; return false;
} else { } else {
if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) { // CraftBukkit - Moved into d(DamageSource, float)
if (false && (damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) {
this.getEquipment(4).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this); this.getEquipment(4).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this);
f *= 0.75F; f *= 0.75F;
} }
@ -660,29 +667,28 @@ public abstract class EntityLiving extends Entity {
this.aF = 1.5F; this.aF = 1.5F;
boolean flag = true; boolean flag = true;
// CraftBukkit start
EntityDamageEvent event = CraftEventFactory.handleEntityDamageEvent(this, damagesource, f);
if (event != null) {
if (event.isCancelled()) {
return false;
}
f = (float) event.getDamage();
}
// CraftBukkit end
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
if (f <= this.lastDamage) { if (f <= this.lastDamage) {
return false; return false;
} }
this.d(damagesource, f - this.lastDamage); // CraftBukkit start
if (!this.d(damagesource, f - this.lastDamage)) {
return false;
}
// CraftBukkit end
this.lastDamage = f; this.lastDamage = f;
flag = false; flag = false;
} else { } else {
// CraftBukkit start
float previousHealth = this.getHealth();
if (!this.d(damagesource, f)) {
return false;
}
this.lastDamage = f; this.lastDamage = f;
this.aw = this.getHealth(); this.aw = previousHealth;
this.noDamageTicks = this.maxNoDamageTicks; this.noDamageTicks = this.maxNoDamageTicks;
this.d(damagesource, f); // CraftBukkit end
this.hurtTicks = this.ay = 10; this.hurtTicks = this.ay = 10;
} }
@ -710,7 +716,7 @@ public abstract class EntityLiving extends Entity {
if (flag) { if (flag) {
this.world.broadcastEntityEffect(this, (byte) 2); this.world.broadcastEntityEffect(this, (byte) 2);
if (damagesource != DamageSource.DROWN) { if (damagesource != DamageSource.DROWN) {
this.P(); this.Q();
} }
if (entity != null) { if (entity != null) {
@ -732,16 +738,16 @@ public abstract class EntityLiving extends Entity {
String s; String s;
if (this.getHealth() <= 0.0F) { if (this.getHealth() <= 0.0F) {
s = this.aT(); s = this.aU();
if (flag && s != null) { if (flag && s != null) {
this.makeSound(s, this.be(), this.bf()); this.makeSound(s, this.bf(), this.bg());
} }
this.die(damagesource); this.die(damagesource);
} else { } else {
s = this.aS(); s = this.aT();
if (flag && s != null) { if (flag && s != null) {
this.makeSound(s, this.be(), this.bf()); this.makeSound(s, this.bf(), this.bg());
} }
} }
@ -763,13 +769,13 @@ public abstract class EntityLiving extends Entity {
vec3d1.a(-this.pitch * 3.1415927F / 180.0F); vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F); vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
this.world.addParticle("iconcrack_" + Item.b(itemstack.getItem()), vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c); this.world.addParticle("iconcrack_" + Item.getId(itemstack.getItem()), vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c);
} }
} }
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity(); Entity entity = damagesource.getEntity();
EntityLiving entityliving = this.aW(); EntityLiving entityliving = this.aX();
if (this.ba >= 0 && entityliving != null) { if (this.ba >= 0 && entityliving != null) {
entityliving.b(this, this.ba); entityliving.b(this, this.ba);
@ -780,7 +786,7 @@ public abstract class EntityLiving extends Entity {
} }
this.aT = true; this.aT = true;
this.aV().g(); this.aW().g();
if (!this.world.isStatic) { if (!this.world.isStatic) {
int i = 0; int i = 0;
@ -788,18 +794,25 @@ public abstract class EntityLiving extends Entity {
i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity); i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
} }
if (this.aF() && this.world.getGameRules().getBoolean("doMobLoot")) { if (this.aG() && this.world.getGameRules().getBoolean("doMobLoot")) {
this.drops = new ArrayList<org.bukkit.inventory.ItemStack>(); // CraftBukkit - Setup drop capture
this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i); this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
this.dropEquipment(this.lastDamageByPlayerTime > 0, i); this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
if (false && this.lastDamageByPlayerTime > 0) { // CraftBukkit - move rare item drop call to dropDeathLoot if (this.lastDamageByPlayerTime > 0) {
int j = this.random.nextInt(200) - i; int j = this.random.nextInt(200) - i;
if (j < 5) { if (j < 5) {
this.getRareDrop(j <= 0 ? 1 : 0); this.getRareDrop(j <= 0 ? 1 : 0);
} }
} }
} else { // CraftBukkit
CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit // CraftBukkit start - Call death event
CraftEventFactory.callEntityDeathEvent(this, this.drops);
this.drops = null;
} else {
CraftEventFactory.callEntityDeathEvent(this);
// CraftBukkit end
} }
} }
@ -826,19 +839,15 @@ public abstract class EntityLiving extends Entity {
} }
} }
protected String aS() { protected String aT() {
return "game.neutral.hurt"; return "game.neutral.hurt";
} }
protected String aT() { protected String aU() {
return "game.neutral.die"; return "game.neutral.die";
} }
// CraftBukkit start - Change return type to ItemStack protected void getRareDrop(int i) {}
protected ItemStack getRareDrop(int i) {
return null;
}
// CraftBukkit end
protected void dropDeathLoot(boolean flag, int i) {} protected void dropDeathLoot(boolean flag, int i) {}
@ -859,25 +868,16 @@ public abstract class EntityLiving extends Entity {
super.b(f); super.b(f);
MobEffect mobeffect = this.getEffect(MobEffectList.JUMP); MobEffect mobeffect = this.getEffect(MobEffectList.JUMP);
float f1 = mobeffect != null ? (float) (mobeffect.getAmplifier() + 1) : 0.0F; float f1 = mobeffect != null ? (float) (mobeffect.getAmplifier() + 1) : 0.0F;
// CraftBukkit start int i = MathHelper.f(f - 3.0F - f1);
float i = MathHelper.f(f - 3.0F - f1);
if (i > 0) { if (i > 0) {
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, this, EntityDamageEvent.DamageCause.FALL, i); // CraftBukkit start
if (event.isCancelled()) { if (!this.damageEntity(DamageSource.FALL, (float) i)) {
return; return;
} }
// CraftBukkit end
i = (float) event.getDamage(); this.makeSound(this.o(i), 1.0F, 1.0F);
if (i > 0) { // this.damageEntity(DamageSource.FALL, (float) i); // CraftBukkit - moved up
this.getBukkitEntity().setLastDamageCause(event);
}
}
// CraftBukkit end
if (i > 0) {
this.makeSound(this.o(org.bukkit.util.NumberConversions.ceil(i)), 1.0F, 1.0F); // CraftBukkit - ceil
this.damageEntity(DamageSource.FALL, (float) i);
int j = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
int l = MathHelper.floor(this.locZ); int l = MathHelper.floor(this.locZ);
@ -895,7 +895,7 @@ public abstract class EntityLiving extends Entity {
return i > 4 ? "game.neutral.hurt.fall.big" : "game.neutral.hurt.fall.small"; return i > 4 ? "game.neutral.hurt.fall.big" : "game.neutral.hurt.fall.small";
} }
public int aU() { public int aV() {
int i = 0; int i = 0;
ItemStack[] aitemstack = this.getEquipment(); ItemStack[] aitemstack = this.getEquipment();
int j = aitemstack.length; int j = aitemstack.length;
@ -913,22 +913,22 @@ public abstract class EntityLiving extends Entity {
return i; return i;
} }
protected void h(float f) {} protected void damageArmor(float f) {}
protected float b(DamageSource damagesource, float f) { protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) { if (!damagesource.ignoresArmor()) {
int i = 25 - this.aU(); int i = 25 - this.aV();
float f1 = f * (float) i; float f1 = f * (float) i;
this.h(f); // this.damageArmor(f); // CraftBukkit - Moved into d(DamageSource, float)
f = f1 / 25.0F; f = f1 / 25.0F;
} }
return f; return f;
} }
protected float c(DamageSource damagesource, float f) { protected float applyMagicModifier(DamageSource damagesource, float f) {
if (damagesource.h()) { if (damagesource.isStarvation()) {
return f; return f;
} else { } else {
if (this instanceof EntityZombie) { if (this instanceof EntityZombie) {
@ -939,7 +939,8 @@ public abstract class EntityLiving extends Entity {
int j; int j;
float f1; float f1;
if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { // CraftBukkit - Moved to d(DamageSource, float)
if (false && this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
j = 25 - i; j = 25 - i;
f1 = f * (float) j; f1 = f * (float) j;
@ -965,37 +966,132 @@ public abstract class EntityLiving extends Entity {
} }
} }
protected void d(DamageSource damagesource, float f) { // CraftBukkit start
protected boolean d(final DamageSource damagesource, float f) { // void -> boolean, add final
if (!this.isInvulnerable()) { if (!this.isInvulnerable()) {
f = this.b(damagesource, f); final boolean human = this instanceof EntityHuman;
f = this.c(damagesource, f); float originalDamage = f;
float f1 = f; Function<Double, Double> hardHat = new Function<Double, Double>() {
@Override
public Double apply(Double f) {
if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && EntityLiving.this.getEquipment(4) != null) {
return -(f - (f * 0.75F));
}
return -0.0;
}
};
float hardHatModifier = hardHat.apply((double) f).floatValue();
f += hardHatModifier;
f = Math.max(f - this.br(), 0.0F); Function<Double, Double> blocking = new Function<Double, Double>() {
this.m(this.br() - (f1 - f)); @Override
public Double apply(Double f) {
if (human) {
if (!damagesource.ignoresArmor() && ((EntityHuman) EntityLiving.this).isBlocking() && f > 0.0F) {
return -(f - ((1.0F + f) * 0.5F));
}
}
return -0.0;
}
};
float blockingModifier = blocking.apply((double) f).floatValue();
f += blockingModifier;
Function<Double, Double> armor = new Function<Double, Double>() {
@Override
public Double apply(Double f) {
return -(f - EntityLiving.this.applyArmorModifier(damagesource, f.floatValue()));
}
};
float armorModifier = armor.apply((double) f).floatValue();
f += armorModifier;
Function<Double, Double> resistance = new Function<Double, Double>() {
@Override
public Double apply(Double f) {
if (!damagesource.isStarvation() && EntityLiving.this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
int i = (EntityLiving.this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f.floatValue() * (float) j;
return -(f - (f1 / 25.0F));
}
return -0.0;
}
};
float resistanceModifier = resistance.apply((double) f).floatValue();
f += resistanceModifier;
Function<Double, Double> magic = new Function<Double, Double>() {
@Override
public Double apply(Double f) {
return -(f - EntityLiving.this.applyMagicModifier(damagesource, f.floatValue()));
}
};
float magicModifier = magic.apply((double) f).floatValue();
f += magicModifier;
Function<Double, Double> absorption = new Function<Double, Double>() {
@Override
public Double apply(Double f) {
return -(Math.max(f - Math.max(f - EntityLiving.this.getAbsorptionHearts(), 0.0F), 0.0F));
}
};
float absorptionModifier = absorption.apply((double) f).floatValue();
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
if (event.isCancelled()) {
return false;
}
f = (float) event.getFinalDamage();
// Apply damage to helmet
if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) {
this.getEquipment(4).damage((int) (event.getDamage() * 4.0F + this.random.nextFloat() * event.getDamage() * 2.0F), this);
}
// Apply damage to armor
if (!damagesource.ignoresArmor()) {
float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
this.damageArmor(armorDamage);
}
absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
this.setAbsorptionHearts(Math.max(this.getAbsorptionHearts() - absorptionModifier, 0.0F));
if (f != 0.0F) { if (f != 0.0F) {
if (human) {
((EntityHuman) this).applyExhaustion(damagesource.getExhaustionCost());
}
// CraftBukkit end
float f2 = this.getHealth(); float f2 = this.getHealth();
this.setHealth(f2 - f); this.setHealth(f2 - f);
this.aV().a(damagesource, f2, f); this.aW().a(damagesource, f2, f);
this.m(this.br() - f); // CraftBukkit start
if (human) {
return true;
}
// CraftBukkit end
this.setAbsorptionHearts(this.getAbsorptionHearts() - f);
} }
return true; // CraftBukkit
} }
return false; // CraftBukkit
} }
public CombatTracker aV() { public CombatTracker aW() {
return this.combatTracker; return this.combatTracker;
} }
public EntityLiving aW() { public EntityLiving aX() {
return (EntityLiving) (this.combatTracker.c() != null ? this.combatTracker.c() : (this.killer != null ? this.killer : (this.lastDamager != null ? this.lastDamager : null))); return (EntityLiving) (this.combatTracker.c() != null ? this.combatTracker.c() : (this.killer != null ? this.killer : (this.lastDamager != null ? this.lastDamager : null)));
} }
public final float getMaxHealth() { public final float getMaxHealth() {
return (float) this.getAttributeInstance(GenericAttributes.a).getValue(); return (float) this.getAttributeInstance(GenericAttributes.maxHealth).getValue();
} }
public final int aY() { public final int aZ() {
return this.datawatcher.getByte(9); return this.datawatcher.getByte(9);
} }
@ -1007,7 +1103,7 @@ public abstract class EntityLiving extends Entity {
return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6); return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6);
} }
public void aZ() { public void ba() {
if (!this.at || this.au >= this.j() / 2 || this.au < 0) { if (!this.at || this.au >= this.j() / 2 || this.au < 0) {
this.au = -1; this.au = -1;
this.at = true; this.at = true;
@ -1017,11 +1113,11 @@ public abstract class EntityLiving extends Entity {
} }
} }
protected void F() { protected void G() {
this.damageEntity(DamageSource.OUT_OF_WORLD, 4.0F); this.damageEntity(DamageSource.OUT_OF_WORLD, 4.0F);
} }
protected void ba() { protected void bb() {
int i = this.j(); int i = this.j();
if (this.at) { if (this.at) {
@ -1038,10 +1134,10 @@ public abstract class EntityLiving extends Entity {
} }
public AttributeInstance getAttributeInstance(IAttribute iattribute) { public AttributeInstance getAttributeInstance(IAttribute iattribute) {
return this.bb().a(iattribute); return this.getAttributeMap().a(iattribute);
} }
public AttributeMapBase bb() { public AttributeMapBase getAttributeMap() {
if (this.d == null) { if (this.d == null) {
this.d = new AttributeMapServer(); this.d = new AttributeMapServer();
} }
@ -1053,7 +1149,7 @@ public abstract class EntityLiving extends Entity {
return EnumMonsterType.UNDEFINED; return EnumMonsterType.UNDEFINED;
} }
public abstract ItemStack bd(); public abstract ItemStack be();
public abstract ItemStack getEquipment(int i); public abstract ItemStack getEquipment(int i);
@ -1074,15 +1170,15 @@ public abstract class EntityLiving extends Entity {
public abstract ItemStack[] getEquipment(); public abstract ItemStack[] getEquipment();
protected float be() { protected float bf() {
return 1.0F; return 1.0F;
} }
protected float bf() { protected float bg() {
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
} }
protected boolean bg() { protected boolean bh() {
return this.getHealth() <= 0.0F; return this.getHealth() <= 0.0F;
} }
@ -1122,7 +1218,7 @@ public abstract class EntityLiving extends Entity {
this.enderTeleportTo(d0, d1, d2); this.enderTeleportTo(d0, d1, d2);
} }
protected void bi() { protected void bj() {
this.motY = 0.41999998688697815D; this.motY = 0.41999998688697815D;
if (this.hasEffect(MobEffectList.JUMP)) { if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F); this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
@ -1141,9 +1237,9 @@ public abstract class EntityLiving extends Entity {
public void e(float f, float f1) { public void e(float f, float f1) {
double d0; double d0;
if (this.L() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) { if (this.M() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY; d0 = this.locY;
this.a(f, f1, this.bj() ? 0.04F : 0.02F); this.a(f, f1, this.bk() ? 0.04F : 0.02F);
this.move(this.motX, this.motY, this.motZ); this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D; this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D; this.motY *= 0.800000011920929D;
@ -1152,7 +1248,7 @@ public abstract class EntityLiving extends Entity {
if (this.positionChanged && this.c(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { if (this.positionChanged && this.c(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D; this.motY = 0.30000001192092896D;
} }
} else if (this.O() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) { } else if (this.P() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY; d0 = this.locY;
this.a(f, f1, 0.02F); this.a(f, f1, 0.02F);
this.move(this.motX, this.motY, this.motZ); this.move(this.motX, this.motY, this.motZ);
@ -1174,7 +1270,7 @@ public abstract class EntityLiving extends Entity {
float f4; float f4;
if (this.onGround) { if (this.onGround) {
f4 = this.bk() * f3; f4 = this.bl() * f3;
} else { } else {
f4 = this.aQ; f4 = this.aQ;
} }
@ -1249,12 +1345,12 @@ public abstract class EntityLiving extends Entity {
this.aG += this.aF; this.aG += this.aF;
} }
protected boolean bj() { protected boolean bk() {
return false; return false;
} }
public float bk() { public float bl() {
return this.bj() ? this.bp : 0.1F; return this.bk() ? this.bp : 0.1F;
} }
public void i(float f) { public void i(float f) {
@ -1271,9 +1367,10 @@ public abstract class EntityLiving extends Entity {
} }
public void h() { public void h() {
SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot
super.h(); super.h();
if (!this.world.isStatic) { if (!this.world.isStatic) {
int i = this.aY(); int i = this.aZ();
if (i > 0) { if (i > 0) {
if (this.av <= 0) { if (this.av <= 0) {
@ -1305,11 +1402,13 @@ public abstract class EntityLiving extends Entity {
} }
if (this.ticksLived % 20 == 0) { if (this.ticksLived % 20 == 0) {
this.aV().g(); this.aW().g();
} }
} }
SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
this.e(); this.e();
SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
double d0 = this.locX - this.lastX; double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ; double d1 = this.locZ - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1); float f = (float) (d0 * d0 + d1 * d1);
@ -1323,7 +1422,7 @@ public abstract class EntityLiving extends Entity {
f3 = 1.0F; f3 = 1.0F;
f2 = (float) Math.sqrt((double) f) * 3.0F; f2 = (float) Math.sqrt((double) f) * 3.0F;
// CraftBukkit - Math -> TrigMath // CraftBukkit - Math -> TrigMath
f1 = (float) org.bukkit.craftbukkit.v1_7_R3.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; f1 = (float) org.bukkit.craftbukkit.v1_7_R4.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
} }
if (this.aD > 0.0F) { if (this.aD > 0.0F) {
@ -1374,6 +1473,7 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.aX += f2; this.aX += f2;
SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot
} }
protected float f(float f, float f1) { protected float f(float f, float f1) {
@ -1419,7 +1519,7 @@ public abstract class EntityLiving extends Entity {
--this.bg; --this.bg;
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch); this.b(this.yaw, this.pitch);
} else if (!this.bq()) { } else if (!this.br()) {
this.motX *= 0.98D; this.motX *= 0.98D;
this.motY *= 0.98D; this.motY *= 0.98D;
this.motZ *= 0.98D; this.motZ *= 0.98D;
@ -1438,30 +1538,32 @@ public abstract class EntityLiving extends Entity {
} }
this.world.methodProfiler.a("ai"); this.world.methodProfiler.a("ai");
if (this.bg()) { SpigotTimings.timerEntityAI.startTiming(); // Spigot
if (this.bh()) {
this.bc = false; this.bc = false;
this.bd = 0.0F; this.bd = 0.0F;
this.be = 0.0F; this.be = 0.0F;
this.bf = 0.0F; this.bf = 0.0F;
} else if (this.bq()) { } else if (this.br()) {
if (this.bj()) { if (this.bk()) {
this.world.methodProfiler.a("newAi"); this.world.methodProfiler.a("newAi");
this.bm(); this.bn();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} else { } else {
this.world.methodProfiler.a("oldAi"); this.world.methodProfiler.a("oldAi");
this.bp(); this.bq();
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.aO = this.yaw; this.aO = this.yaw;
} }
} }
SpigotTimings.timerEntityAI.stopTiming(); // Spigot
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("jump"); this.world.methodProfiler.a("jump");
if (this.bc) { if (this.bc) {
if (!this.L() && !this.O()) { if (!this.M() && !this.P()) {
if (this.onGround && this.bq == 0) { if (this.onGround && this.bq == 0) {
this.bi(); this.bj();
this.bq = 10; this.bq = 10;
} }
} else { } else {
@ -1476,19 +1578,23 @@ public abstract class EntityLiving extends Entity {
this.bd *= 0.98F; this.bd *= 0.98F;
this.be *= 0.98F; this.be *= 0.98F;
this.bf *= 0.9F; this.bf *= 0.9F;
SpigotTimings.timerEntityAIMove.startTiming(); // Spigot
this.e(this.bd, this.be); this.e(this.bd, this.be);
SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot
this.world.methodProfiler.b(); this.world.methodProfiler.b();
this.world.methodProfiler.a("push"); this.world.methodProfiler.a("push");
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.bn(); SpigotTimings.timerEntityAICollision.startTiming(); // Spigot
this.bo();
SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot
} }
this.world.methodProfiler.b(); this.world.methodProfiler.b();
} }
protected void bm() {} protected void bn() {}
protected void bn() { protected void bo() {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition if (this.R() && list != null && !list.isEmpty()) { // Spigot: Add this.R() condition
@ -1504,7 +1610,7 @@ public abstract class EntityLiving extends Entity {
} }
// CraftBukkit end // CraftBukkit end
if (entity.R()) { if (entity.S()) {
entity.numCollisions++; // Spigot entity.numCollisions++; // Spigot
numCollisions++; // Spigot numCollisions++; // Spigot
this.o(entity); this.o(entity);
@ -1518,16 +1624,16 @@ public abstract class EntityLiving extends Entity {
entity.collide(this); entity.collide(this);
} }
public void aa() { public void ab() {
super.aa(); super.ab();
this.aV = this.aW; this.aV = this.aW;
this.aW = 0.0F; this.aW = 0.0F;
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
} }
protected void bo() {} protected void bp() {}
protected void bp() { protected void bq() {
++this.aU; ++this.aU;
} }
@ -1553,11 +1659,11 @@ public abstract class EntityLiving extends Entity {
} }
} }
public boolean p(Entity entity) { public boolean hasLineOfSight(Entity entity) {
return this.world.a(Vec3D.a(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), Vec3D.a(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null; return this.world.a(Vec3D.a(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), Vec3D.a(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
} }
public Vec3D af() { public Vec3D ag() {
return this.j(1.0F); return this.j(1.0F);
} }
@ -1585,15 +1691,15 @@ public abstract class EntityLiving extends Entity {
} }
} }
public boolean bq() { public boolean br() {
return !this.world.isStatic; return !this.world.isStatic;
} }
public boolean Q() { public boolean R() {
return !this.dead; return !this.dead;
} }
public boolean R() { public boolean S() {
return !ghost && !this.dead; return !ghost && !this.dead;
} }
@ -1601,7 +1707,7 @@ public abstract class EntityLiving extends Entity {
return this.length * 0.85F; return this.length * 0.85F;
} }
protected void P() { protected void Q() {
this.velocityChanged = this.random.nextDouble() >= this.getAttributeInstance(GenericAttributes.c).getValue(); this.velocityChanged = this.random.nextDouble() >= this.getAttributeInstance(GenericAttributes.c).getValue();
} }
@ -1609,11 +1715,11 @@ public abstract class EntityLiving extends Entity {
return this.aO; return this.aO;
} }
public float br() { public float getAbsorptionHearts() {
return this.br; return this.br;
} }
public void m(float f) { public void setAbsorptionHearts(float f) {
if (f < 0.0F) { if (f < 0.0F) {
f = 0.0F; f = 0.0F;
} }
@ -1633,7 +1739,7 @@ public abstract class EntityLiving extends Entity {
return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false; return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false;
} }
public void bt() {}
public void bu() {} public void bu() {}
}
public void bv() {}
}

View File

@ -1,4 +1,4 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -19,10 +19,10 @@ import org.apache.logging.log4j.Logger;
// CraftBukkit start // CraftBukkit start
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.WeatherType; import org.bukkit.WeatherType;
import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory; import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
// CraftBukkit end // CraftBukkit end
@ -30,7 +30,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class EntityPlayer extends EntityHuman implements ICrafting { public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger bL = LogManager.getLogger(); private static final Logger bL = LogManager.getLogger();
public String locale = "en_US"; public String locale = "en_US"; // Spigot
public PlayerConnection playerConnection; public PlayerConnection playerConnection;
public final MinecraftServer server; public final MinecraftServer server;
public final PlayerInteractManager playerInteractManager; public final PlayerInteractManager playerInteractManager;
@ -47,7 +47,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public int invulnerableTicks = 60; // CraftBukkit - private -> public public int invulnerableTicks = 60; // CraftBukkit - private -> public
private EnumChatVisibility bV; private EnumChatVisibility bV;
private boolean bW = true; private boolean bW = true;
private long bX = 0L; private long bX = System.currentTimeMillis();
private int containerCounter; private int containerCounter;
public boolean g; public boolean g;
public int ping; public int ping;
@ -67,23 +67,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// Spigot start // Spigot start
public boolean collidesWithEntities = true; public boolean collidesWithEntities = true;
/*
@Override
public boolean Q()
{
return this.collidesWithEntities && super.Q();
}
*/
@Override @Override
public boolean R() public boolean R()
{ {
return this.collidesWithEntities && super.R(); return !spectating && this.collidesWithEntities && super.R(); // (first !this.isDead near bottom of EntityLiving)
}
@Override
public boolean S()
{
return this.collidesWithEntities && super.S(); // (second !this.isDead near bottom of EntityLiving)
} }
// Spigot end // Spigot end
public boolean spectating; // Mineplex public boolean spectating; // Mineplex
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, gameprofile); super(worldserver, gameprofile);
playerinteractmanager.player = this; playerinteractmanager.player = this;
@ -125,7 +123,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (MinecraftServer.getServer().getForceGamemode()) { if (MinecraftServer.getServer().getForceGamemode()) {
this.playerInteractManager.setGameMode(MinecraftServer.getServer().getGamemode()); this.playerInteractManager.setGameMode(MinecraftServer.getServer().getGamemode());
} else { } else {
this.playerInteractManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType"))); this.playerInteractManager.setGameMode(EnumGamemode.getById(nbttagcompound.getInt("playerGameType")));
} }
} }
this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit
@ -133,7 +131,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.setInt("playerGameType", this.playerInteractManager.getGameMode().a()); nbttagcompound.setInt("playerGameType", this.playerInteractManager.getGameMode().getId());
this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
} }
@ -225,7 +223,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (chunkcoordintpair != null) { if (chunkcoordintpair != null) {
if (this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) { if (this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) {
chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z);
if (chunk.k()) { if (chunk.isReady()) {
arraylist.add(chunk); arraylist.add(chunk);
arraylist1.addAll(chunk.tileEntities.values()); // CraftBukkit - Get tile entities directly from the chunk instead of the world arraylist1.addAll(chunk.tileEntities.values()); // CraftBukkit - Get tile entities directly from the chunk instead of the world
iterator1.remove(); iterator1.remove();
@ -254,10 +252,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
} }
if (this.bX > 0L && this.server.getIdleTimeout() > 0 && MinecraftServer.ar() - this.bX > (long) (this.server.getIdleTimeout() * 1000 * 60)) {
this.playerConnection.disconnect("You have been idle for too long!");
}
} }
public void i() { public void i() {
@ -277,15 +271,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
// CraftBukkit - Optionally scale health // CraftBukkit - Optionally scale health
if (this.getHealth() != this.bQ || this.bR != this.foodData.a() || this.foodData.e() == 0.0F != this.bS) { if (this.getHealth() != this.bQ || this.bR != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.bS) {
this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.a(), this.foodData.e())); this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel()));
this.bQ = this.getHealth(); this.bQ = this.getHealth();
this.bR = this.foodData.a(); this.bR = this.foodData.getFoodLevel();
this.bS = this.foodData.e() == 0.0F; this.bS = this.foodData.getSaturationLevel() == 0.0F;
} }
if (this.getHealth() + this.br() != this.bP) { if (this.getHealth() + this.getAbsorptionHearts() != this.bP) {
this.bP = this.getHealth() + this.br(); this.bP = this.getHealth() + this.getAbsorptionHearts();
// CraftBukkit - Update ALL the scores! // CraftBukkit - Update ALL the scores!
this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getName(), com.google.common.collect.ImmutableList.of(this)); this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getName(), com.google.common.collect.ImmutableList.of(this));
} }
@ -301,7 +295,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.playerConnection.sendPacket(new PacketPlayOutExperience(this.exp, this.expTotal, this.expLevel)); this.playerConnection.sendPacket(new PacketPlayOutExperience(this.exp, this.expTotal, this.expLevel));
} }
if (this.ticksLived % 20 * 5 == 0 && !this.getStatisticManager().a(AchievementList.L)) { if (this.ticksLived % 20 * 5 == 0 && !this.getStatisticManager().hasAchievement(AchievementList.L)) {
this.j(); this.j();
} }
@ -387,7 +381,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
IChatBaseComponent chatmessage = this.aV().b(); IChatBaseComponent chatmessage = this.aW().b();
String deathmessage = chatmessage.c(); String deathmessage = chatmessage.c();
org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage); org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage);
@ -398,7 +392,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (deathMessage.equals(deathmessage)) { if (deathMessage.equals(deathmessage)) {
this.server.getPlayerList().sendMessage(chatmessage); this.server.getPlayerList().sendMessage(chatmessage);
} else { } else {
this.server.getPlayerList().sendMessage(org.bukkit.craftbukkit.v1_7_R3.util.CraftChatMessage.fromString(deathMessage)); this.server.getPlayerList().sendMessage(org.bukkit.craftbukkit.v1_7_R4.util.CraftChatMessage.fromString(deathMessage));
} }
} }
@ -426,7 +420,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
scoreboardscore.incrementScore(); scoreboardscore.incrementScore();
} }
EntityLiving entityliving = this.aW(); EntityLiving entityliving = this.aX();
if (entityliving != null) { if (entityliving != null) {
int i = EntityTypes.a(entityliving); int i = EntityTypes.a(entityliving);
@ -440,7 +434,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
this.a(StatisticList.v, 1); this.a(StatisticList.v, 1);
this.aV().g(); this.aW().g();
} }
public boolean damageEntity(DamageSource damagesource, float f) { public boolean damageEntity(DamageSource damagesource, float f) {
@ -505,10 +499,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start // CraftBukkit start
TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL;
if (dimension == -1 && i == 0)
i = 4;
this.server.getPlayerList().changeDimension(this, i, cause); this.server.getPlayerList().changeDimension(this, i, cause);
// CraftBukkit end // CraftBukkit end
this.lastSentExp = -1; this.lastSentExp = -1;
@ -526,12 +516,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
} }
@Override
public boolean Q()
{
return !spectating;
}
public void receive(Entity entity, int i) { public void receive(Entity entity, int i) {
super.receive(entity, i); super.receive(entity, i);
@ -606,7 +590,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void startCrafting(int i, int j, int k) { public void startCrafting(int i, int j, int k) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k));
if(container == null) return; if (container == null) {
return;
}
// CraftBukkit end // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -619,7 +605,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void startEnchanting(int i, int j, int k, String s) { public void startEnchanting(int i, int j, int k, String s) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
if(container == null) return; if (container == null) {
return;
}
// CraftBukkit end // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -632,7 +620,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openAnvil(int i, int j, int k) { public void openAnvil(int i, int j, int k) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this));
if(container == null) return; if (container == null) {
return;
}
// CraftBukkit end // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -650,7 +640,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
if (container == null) { if (container == null) {
iinventory.l_(); // Should be closeContainer iinventory.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -666,7 +656,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper));
if (container == null) { if (container == null) {
tileentityhopper.l_(); // Should be closeContainer tileentityhopper.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -682,7 +672,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper));
if (container == null) { if (container == null) {
entityminecarthopper.l_(); // Should be closeContainer entityminecarthopper.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -698,7 +688,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace));
if (container == null) { if (container == null) {
tileentityfurnace.l_(); // Should be closeContainer tileentityfurnace.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -714,7 +704,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser));
if (container == null) { if (container == null) {
tileentitydispenser.l_(); // Should be closeContainer tileentitydispenser.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -730,7 +720,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand));
if (container == null) { if (container == null) {
tileentitybrewingstand.l_(); // Should be closeContainer tileentitybrewingstand.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -746,7 +736,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon));
if (container == null) { if (container == null) {
tileentitybeacon.l_(); // Should be closeContainer tileentitybeacon.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -761,7 +751,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void openTrade(IMerchant imerchant, String s) { public void openTrade(IMerchant imerchant, String s) {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
if(container == null) return; if (container == null) {
return;
}
// CraftBukkit end // CraftBukkit end
this.nextContainerCounter(); this.nextContainerCounter();
@ -792,7 +784,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start - Inventory open hook // CraftBukkit start - Inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse));
if (container == null) { if (container == null) {
iinventory.l_(); // Should be closeContainer iinventory.closeContainer();
return; return;
} }
// CraftBukkit end // CraftBukkit end
@ -831,7 +823,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void setContainerData(Container container, int i, int j) { public void setContainerData(Container container, int i, int j) {
this.playerConnection.sendPacket(new PacketPlayOutCraftProgressBar(container.windowId, i, j)); this.playerConnection.sendPacket(new PacketPlayOutWindowData(container.windowId, i, j));
} }
public void closeInventory() { public void closeInventory() {
@ -961,7 +953,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(EnumGamemode enumgamemode) { public void a(EnumGamemode enumgamemode) {
this.playerInteractManager.setGameMode(enumgamemode); this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.a())); this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId()));
} }
// CraftBukkit start - Support multi-line messages // CraftBukkit start - Support multi-line messages
@ -1044,6 +1036,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.removeQueue.add(Integer.valueOf(entity.getId())); this.removeQueue.add(Integer.valueOf(entity.getId()));
} }
} }
public long x() {
return this.bX;
}
// CraftBukkit start - Add per-player time and weather. // CraftBukkit start - Add per-player time and weather.
public long timeOffset = 0; public long timeOffset = 0;
public boolean relativeTime = true; public boolean relativeTime = true;
@ -1130,4 +1127,4 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return (CraftPlayer) super.getBukkitEntity(); return (CraftPlayer) super.getBukkitEntity();
} }
// CraftBukkit end // CraftBukkit end
} }

View File

@ -1,8 +1,8 @@
package net.minecraft.server.v1_7_R3; package net.minecraft.server.v1_7_R4;
// CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R3.event.CraftEventFactory; import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.SlimeSplitEvent; import org.bukkit.event.entity.SlimeSplitEvent;
// CraftBukkit end // CraftBukkit end
@ -34,7 +34,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.datawatcher.watch(16, new Byte((byte) i)); this.datawatcher.watch(16, new Byte((byte) i));
this.a(0.6F * (float) i, 0.6F * (float) i); this.a(0.6F * (float) i, 0.6F * (float) i);
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
this.getAttributeInstance(GenericAttributes.a).setValue((double) (i * i)); this.getAttributeInstance(GenericAttributes.maxHealth).setValue((double) (i * i));
this.setHealth(this.getMaxHealth()); this.setHealth(this.getMaxHealth());
this.b = i; this.b = i;
} }
@ -92,7 +92,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
} }
if (this.bW()) { if (this.bW()) {
this.makeSound(this.bV(), this.be(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); this.makeSound(this.bV(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
} }
this.h = -0.5F; this.h = -0.5F;
@ -107,7 +107,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
} }
} }
protected void bp() { protected void bq() {
this.w(); this.w();
if (Vegetated) if (Vegetated)
@ -142,7 +142,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
this.bc = true; this.bc = true;
if (this.bY()) { if (this.bY()) {
this.makeSound(this.bV(), this.be(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F); this.makeSound(this.bV(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
} }
this.bd = 1.0F - this.random.nextFloat() * 2.0F; this.bd = 1.0F - this.random.nextFloat() * 2.0F;
@ -203,7 +203,7 @@ public class EntitySlime extends EntityInsentient implements IMonster {
if (this.bT()) { if (this.bT()) {
int i = this.getSize(); int i = this.getSize();
if (this.p(entityhuman) && this.f(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bU())) { if (this.hasLineOfSight(entityhuman) && this.f(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bU())) {
this.makeSound("mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); this.makeSound("mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
} }
} }
@ -217,16 +217,16 @@ public class EntitySlime extends EntityInsentient implements IMonster {
return this.getSize(); return this.getSize();
} }
protected String aS() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
protected String aT() { protected String aT() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small"); return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
} }
protected String aU() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
protected Item getLoot() { protected Item getLoot() {
return this.getSize() == 1 ? Items.SLIME_BALL : Item.d(0); return this.getSize() == 1 ? Items.SLIME_BALL : Item.getById(0);
} }
public boolean canSpawn() { public boolean canSpawn() {
@ -251,11 +251,11 @@ public class EntitySlime extends EntityInsentient implements IMonster {
} }
} }
protected float be() { protected float bf() {
return 0.4F * (float) this.getSize(); return 0.4F * (float) this.getSize();
} }
public int bv() { public int x() {
return 0; return 0;
} }
@ -266,4 +266,4 @@ public class EntitySlime extends EntityInsentient implements IMonster {
protected boolean bW() { protected boolean bW() {
return this.getSize() > 2; return this.getSize() > 2;
} }
} }

Some files were not shown because too many files have changed in this diff Show More