Update to 1.6.4

This commit is contained in:
Andrew 2013-09-20 15:59:28 +12:00
parent 5215025ffa
commit c16c62bff8
10 changed files with 72 additions and 72 deletions

View File

@ -7,28 +7,28 @@ import java.util.Iterator;
import me.libraryaddict.disguise.DisguiseTypes.Disguise; import me.libraryaddict.disguise.DisguiseTypes.Disguise;
import me.libraryaddict.disguise.Events.DisguiseEvent; import me.libraryaddict.disguise.Events.DisguiseEvent;
import me.libraryaddict.disguise.Events.UndisguiseEvent; import me.libraryaddict.disguise.Events.UndisguiseEvent;
import net.minecraft.server.v1_6_R2.AttributeMapServer; import net.minecraft.server.v1_6_R3.AttributeMapServer;
import net.minecraft.server.v1_6_R2.EntityHuman; import net.minecraft.server.v1_6_R3.EntityHuman;
import net.minecraft.server.v1_6_R2.EntityInsentient; import net.minecraft.server.v1_6_R3.EntityInsentient;
import net.minecraft.server.v1_6_R2.EntityLiving; import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R2.EntityPlayer; import net.minecraft.server.v1_6_R3.EntityPlayer;
import net.minecraft.server.v1_6_R2.EntityTrackerEntry; import net.minecraft.server.v1_6_R3.EntityTrackerEntry;
import net.minecraft.server.v1_6_R2.ItemStack; import net.minecraft.server.v1_6_R3.ItemStack;
import net.minecraft.server.v1_6_R2.MobEffect; import net.minecraft.server.v1_6_R3.MobEffect;
import net.minecraft.server.v1_6_R2.Packet17EntityLocationAction; import net.minecraft.server.v1_6_R3.Packet17EntityLocationAction;
import net.minecraft.server.v1_6_R2.Packet20NamedEntitySpawn; import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn;
import net.minecraft.server.v1_6_R2.Packet28EntityVelocity; import net.minecraft.server.v1_6_R3.Packet28EntityVelocity;
import net.minecraft.server.v1_6_R2.Packet35EntityHeadRotation; import net.minecraft.server.v1_6_R3.Packet35EntityHeadRotation;
import net.minecraft.server.v1_6_R2.Packet39AttachEntity; import net.minecraft.server.v1_6_R3.Packet39AttachEntity;
import net.minecraft.server.v1_6_R2.Packet40EntityMetadata; import net.minecraft.server.v1_6_R3.Packet40EntityMetadata;
import net.minecraft.server.v1_6_R2.Packet41MobEffect; import net.minecraft.server.v1_6_R3.Packet41MobEffect;
import net.minecraft.server.v1_6_R2.Packet44UpdateAttributes; import net.minecraft.server.v1_6_R3.Packet44UpdateAttributes;
import net.minecraft.server.v1_6_R2.Packet5EntityEquipment; import net.minecraft.server.v1_6_R3.Packet5EntityEquipment;
import net.minecraft.server.v1_6_R2.WorldServer; import net.minecraft.server.v1_6_R3.WorldServer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -62,7 +62,7 @@ public class DisguiseAPI {
disguise = disguise.clone(); disguise = disguise.clone();
} }
try { try {
Field field = net.minecraft.server.v1_6_R2.Entity.class.getDeclaredField("entityCount"); Field field = net.minecraft.server.v1_6_R3.Entity.class.getDeclaredField("entityCount");
field.setAccessible(true); field.setAccessible(true);
int id = field.getInt(null); int id = field.getInt(null);
disguises.put(id, disguise); disguises.put(id, disguise);
@ -259,7 +259,7 @@ public class DisguiseAPI {
tracker.trackedPlayers.add(entityplayer); tracker.trackedPlayers.add(entityplayer);
try { try {
// Grab the entity ID the fake disguise will use // Grab the entity ID the fake disguise will use
Field field = net.minecraft.server.v1_6_R2.Entity.class.getDeclaredField("entityCount"); Field field = net.minecraft.server.v1_6_R3.Entity.class.getDeclaredField("entityCount");
field.setAccessible(true); field.setAccessible(true);
int id = field.getInt(null); int id = field.getInt(null);
// Set the entitycount plus one so we don't have the id being reused // Set the entitycount plus one so we don't have the id being reused
@ -277,7 +277,7 @@ public class DisguiseAPI {
} }
// Send himself some entity attributes // Send himself some entity attributes
if (tracker.tracker instanceof EntityLiving) { if (tracker.tracker instanceof EntityLiving) {
AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) tracker.tracker).aW(); AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) tracker.tracker).aX();
Collection collection = attributemapserver.c(); Collection collection = attributemapserver.c();
if (!collection.isEmpty()) { if (!collection.isEmpty()) {
@ -310,9 +310,9 @@ public class DisguiseAPI {
entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(0, tracker.tracker.passenger, tracker.tracker)); entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(0, tracker.tracker.passenger, tracker.tracker));
} }
if (tracker.tracker instanceof EntityInsentient && ((EntityInsentient) tracker.tracker).bI() != null) { if (tracker.tracker instanceof EntityInsentient && ((EntityInsentient) tracker.tracker).getLeashHolder() != null) {
entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(1, tracker.tracker, entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(1, tracker.tracker,
((EntityInsentient) tracker.tracker).bI())); ((EntityInsentient) tracker.tracker).getLeashHolder()));
} }
// Resend the armor // Resend the armor

View File

@ -10,15 +10,15 @@ import me.libraryaddict.disguise.PacketsManager;
import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher; import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher;
import me.libraryaddict.disguise.DisguiseTypes.Watchers.HorseWatcher; import me.libraryaddict.disguise.DisguiseTypes.Watchers.HorseWatcher;
import me.libraryaddict.disguise.DisguiseTypes.Watchers.ZombieWatcher; import me.libraryaddict.disguise.DisguiseTypes.Watchers.ZombieWatcher;
import net.minecraft.server.v1_6_R2.EntityAgeable; import net.minecraft.server.v1_6_R3.EntityAgeable;
import net.minecraft.server.v1_6_R2.EntityInsentient; import net.minecraft.server.v1_6_R3.EntityInsentient;
import net.minecraft.server.v1_6_R2.EntityLiving; import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R2.EntityPlayer; import net.minecraft.server.v1_6_R3.EntityPlayer;
import net.minecraft.server.v1_6_R2.EntityTrackerEntry; import net.minecraft.server.v1_6_R3.EntityTrackerEntry;
import net.minecraft.server.v1_6_R2.WorldServer; import net.minecraft.server.v1_6_R3.WorldServer;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse.Variant;
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,7 +4,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_6_R2.CraftSound; import org.bukkit.craftbukkit.v1_6_R3.CraftSound;
public enum DisguiseSound { public enum DisguiseSound {

View File

@ -6,7 +6,7 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
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;
@ -18,10 +18,10 @@ import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.reflect.StructureModifier;
import me.libraryaddict.disguise.DisguiseAPI; import me.libraryaddict.disguise.DisguiseAPI;
import net.minecraft.server.v1_6_R2.ChunkCoordinates; import net.minecraft.server.v1_6_R3.ChunkCoordinates;
import net.minecraft.server.v1_6_R2.EntityPlayer; import net.minecraft.server.v1_6_R3.EntityPlayer;
import net.minecraft.server.v1_6_R2.ItemStack; import net.minecraft.server.v1_6_R3.ItemStack;
import net.minecraft.server.v1_6_R2.WatchableObject; import net.minecraft.server.v1_6_R3.WatchableObject;
public class FlagWatcher { public class FlagWatcher {
public enum SlotType { public enum SlotType {

View File

@ -2,7 +2,7 @@ package me.libraryaddict.disguise.DisguiseTypes;
import java.util.HashMap; import java.util.HashMap;
import net.minecraft.server.v1_6_R2.EnumEntitySize; import net.minecraft.server.v1_6_R3.EnumEntitySize;
public class Values { public class Values {

View File

@ -1,6 +1,6 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.DisguiseTypes.Disguise; import me.libraryaddict.disguise.DisguiseTypes.Disguise;
@ -13,7 +13,7 @@ public class DroppedItemWatcher extends FlagWatcher {
} }
public ItemStack getItemStack() { public ItemStack getItemStack() {
return CraftItemStack.asBukkitCopy((net.minecraft.server.v1_6_R2.ItemStack) getValue(10, return CraftItemStack.asBukkitCopy((net.minecraft.server.v1_6_R3.ItemStack) getValue(10,
CraftItemStack.asNMSCopy(new ItemStack(1)))); CraftItemStack.asNMSCopy(new ItemStack(1))));
} }

View File

@ -1,6 +1,6 @@
package me.libraryaddict.disguise.DisguiseTypes.Watchers; package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import me.libraryaddict.disguise.DisguiseTypes.Disguise; import me.libraryaddict.disguise.DisguiseTypes.Disguise;
@ -15,7 +15,7 @@ public class ItemFrameWatcher extends FlagWatcher {
public ItemStack getItemStack() { public ItemStack getItemStack() {
if (getValue(3, (byte) 0) instanceof Integer) if (getValue(3, (byte) 0) instanceof Integer)
return new ItemStack(0); return new ItemStack(0);
return CraftItemStack.asBukkitCopy((net.minecraft.server.v1_6_R2.ItemStack) getValue(3, null)); return CraftItemStack.asBukkitCopy((net.minecraft.server.v1_6_R3.ItemStack) getValue(3, null));
} }
public void setItemStack(ItemStack newItem) { public void setItemStack(ItemStack newItem) {

View File

@ -3,8 +3,8 @@ package me.libraryaddict.disguise.DisguiseTypes.Watchers;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.server.v1_6_R2.MobEffect; import net.minecraft.server.v1_6_R3.MobEffect;
import net.minecraft.server.v1_6_R2.PotionBrewer; import net.minecraft.server.v1_6_R3.PotionBrewer;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;

View File

@ -12,17 +12,17 @@ import me.libraryaddict.disguise.DisguiseTypes.FlagWatcher;
import me.libraryaddict.disguise.DisguiseTypes.Values; import me.libraryaddict.disguise.DisguiseTypes.Values;
import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher; import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher;
import me.libraryaddict.disguise.DisguiseTypes.Watchers.LivingWatcher; import me.libraryaddict.disguise.DisguiseTypes.Watchers.LivingWatcher;
import net.minecraft.server.v1_6_R2.ChatMessage; import net.minecraft.server.v1_6_R3.ChatMessage;
import net.minecraft.server.v1_6_R2.ChunkCoordinates; import net.minecraft.server.v1_6_R3.ChunkCoordinates;
import net.minecraft.server.v1_6_R2.EntityHuman; import net.minecraft.server.v1_6_R3.EntityHuman;
import net.minecraft.server.v1_6_R2.EntityLiving; import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R2.GenericAttributes; import net.minecraft.server.v1_6_R3.GenericAttributes;
import net.minecraft.server.v1_6_R2.WatchableObject; import net.minecraft.server.v1_6_R3.WatchableObject;
import net.minecraft.server.v1_6_R2.World; import net.minecraft.server.v1_6_R3.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_6_R2.CraftWorld; import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -175,14 +175,14 @@ public class LibsDisguises extends JavaPlugin {
break; break;
} }
try { try {
net.minecraft.server.v1_6_R2.Entity entity = null; net.minecraft.server.v1_6_R3.Entity entity = null;
Class entityClass; Class entityClass;
if (disguiseType == DisguiseType.PLAYER) { if (disguiseType == DisguiseType.PLAYER) {
entityClass = EntityHuman.class; entityClass = EntityHuman.class;
entity = new DisguiseHuman(world); entity = new DisguiseHuman(world);
} else { } else {
entityClass = Class.forName("net.minecraft.server.v1_6_R2.Entity" + name); entityClass = Class.forName("net.minecraft.server.v1_6_R3.Entity" + name);
entity = (net.minecraft.server.v1_6_R2.Entity) entityClass.getConstructor(World.class).newInstance(world); entity = (net.minecraft.server.v1_6_R3.Entity) entityClass.getConstructor(World.class).newInstance(world);
} }
Values value = new Values(disguiseType, entityClass, entity.at); Values value = new Values(disguiseType, entityClass, entity.at);
List<WatchableObject> watchers = entity.getDataWatcher().c(); List<WatchableObject> watchers = entity.getDataWatcher().c();

View File

@ -18,22 +18,22 @@ import me.libraryaddict.disguise.DisguiseTypes.MobDisguise;
import me.libraryaddict.disguise.DisguiseTypes.PlayerDisguise; import me.libraryaddict.disguise.DisguiseTypes.PlayerDisguise;
import me.libraryaddict.disguise.DisguiseTypes.Values; import me.libraryaddict.disguise.DisguiseTypes.Values;
import me.libraryaddict.disguise.DisguiseTypes.DisguiseSound.SoundType; import me.libraryaddict.disguise.DisguiseTypes.DisguiseSound.SoundType;
import net.minecraft.server.v1_6_R2.AttributeSnapshot; import net.minecraft.server.v1_6_R3.AttributeSnapshot;
import net.minecraft.server.v1_6_R2.Block; import net.minecraft.server.v1_6_R3.Block;
import net.minecraft.server.v1_6_R2.DataWatcher; import net.minecraft.server.v1_6_R3.DataWatcher;
import net.minecraft.server.v1_6_R2.EntityLiving; import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R2.EnumArt; import net.minecraft.server.v1_6_R3.EnumArt;
import net.minecraft.server.v1_6_R2.EnumEntitySize; import net.minecraft.server.v1_6_R3.EnumEntitySize;
import net.minecraft.server.v1_6_R2.ItemStack; import net.minecraft.server.v1_6_R3.ItemStack;
import net.minecraft.server.v1_6_R2.MathHelper; import net.minecraft.server.v1_6_R3.MathHelper;
import net.minecraft.server.v1_6_R2.WatchableObject; import net.minecraft.server.v1_6_R3.WatchableObject;
import net.minecraft.server.v1_6_R2.World; import net.minecraft.server.v1_6_R3.World;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.ExperienceOrb;
@ -127,7 +127,7 @@ public class PacketsManager {
public static PacketContainer[] constructSpawnPackets(Disguise disguise, Entity disguisedEntity) { public static PacketContainer[] constructSpawnPackets(Disguise disguise, Entity disguisedEntity) {
if (disguise.getEntity() == null) if (disguise.getEntity() == null)
disguise.setEntity(disguisedEntity); disguise.setEntity(disguisedEntity);
net.minecraft.server.v1_6_R2.Entity nmsEntity = ((CraftEntity) disguisedEntity).getHandle(); net.minecraft.server.v1_6_R3.Entity nmsEntity = ((CraftEntity) disguisedEntity).getHandle();
ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>(); ArrayList<PacketContainer> packets = new ArrayList<PacketContainer>();
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
int slot = i - 1; int slot = i - 1;
@ -427,11 +427,11 @@ public class PacketsManager {
} else { } else {
boolean hasInvun = false; boolean hasInvun = false;
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
net.minecraft.server.v1_6_R2.EntityLiving e = ((CraftLivingEntity) entity) net.minecraft.server.v1_6_R3.EntityLiving e = ((CraftLivingEntity) entity)
.getHandle(); .getHandle();
hasInvun = (e.noDamageTicks == e.maxNoDamageTicks); hasInvun = (e.noDamageTicks == e.maxNoDamageTicks);
} else { } else {
net.minecraft.server.v1_6_R2.Entity e = ((CraftEntity) entity).getHandle(); net.minecraft.server.v1_6_R3.Entity e = ((CraftEntity) entity).getHandle();
hasInvun = e.isInvulnerable(); hasInvun = e.isInvulnerable();
} }
soundType = entitySound.getType(soundName, !hasInvun); soundType = entitySound.getType(soundName, !hasInvun);