Fix legendaries

This commit is contained in:
Shaun Bennett 2015-11-25 23:24:07 -05:00
parent 8a64a2f4ce
commit 7a663b4f7b
6 changed files with 33 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package mineplex.game.clans.items;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -63,6 +64,8 @@ import mineplex.game.clans.items.legendaries.WindBlade;
import mineplex.game.clans.items.smelting.SmeltingListener;
import mineplex.game.clans.items.ui.GearShop;
import mineplex.serverdata.serialization.RuntimeTypeAdapterFactory;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
@ -107,6 +110,9 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
private WeightSet<Class<? extends ItemAttribute>> _weaponAttributes;
private WeightSet<Class<? extends ItemAttribute>> _armorAttributes;
private WeightSet<Class<? extends ItemAttribute>> _bowAttributes;
// Attribute Masks
private EnumSet<Material> _maskAttributes;
private GearShop _shop;
@ -183,6 +189,9 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
packetHandler.addPacketHandler(this, PacketPlayOutSetSlot.class, PacketPlayOutWindowItems.class);
plugin.getServer().getScheduler().runTaskTimer(plugin, this, 1l, 1l);
_maskAttributes = EnumSet.of(Material.GOLD_RECORD, Material.GREEN_RECORD, Material.RECORD_3, Material.RECORD_4, Material.RECORD_5, Material.RECORD_6,
Material.RECORD_7, Material.RECORD_8, Material.RECORD_9, Material.RECORD_10, Material.RECORD_11, Material.RECORD_12);
}
@Override
@ -485,9 +494,26 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
itemsPacket.b[i] = maskItem(itemsPacket.b[i]); // Mask all
// out-going
// item packets
ItemStack item = CraftItemStack.asCraftMirror(itemsPacket.b[i]);
if (item != null && _maskAttributes.contains(item.getType()))
itemsPacket.b[i] = removeAttributes(itemsPacket.b[i]);
}
}
}
private net.minecraft.server.v1_8_R3.ItemStack removeAttributes(net.minecraft.server.v1_8_R3.ItemStack item)
{
if (item == null) return null;
if (item.getTag() == null)
{
item.setTag(new NBTTagCompound());
}
item.getTag().setInt("HideFlags", 62);
return item;
}
private net.minecraft.server.v1_8_R3.ItemStack maskItem(net.minecraft.server.v1_8_R3.ItemStack item)
{

View File

@ -27,7 +27,7 @@ public class AlligatorsTooth extends LegendaryItem
public AlligatorsTooth()
{
super("Alligators Tooth", "Grants bonus damage in water and special ability to swim fast!", Material.RECORD_3);
super("Alligators Tooth", "Grants bonus damage in water and special ability to swim fast!", Material.RECORD_4);
_swimSpeed = boostGen.generateValue();
}

View File

@ -19,7 +19,7 @@ public class GiantsBroadsword extends LegendaryItem
public GiantsBroadsword()
{
super("Giants Broadsword", "Deal huge damage and block to gain defensive abilities!", Material.RECORD_4);
super("Giants Broadsword", "Deal huge damage and block to gain defensive abilities!", Material.GOLD_RECORD);
}
@Override

View File

@ -22,7 +22,7 @@ public class HyperAxe extends LegendaryItem
public HyperAxe()
{
super("Hyper Axe", "Increased attack speed!", Material.RECORD_5);
super("Hyper Axe", "Increased attack speed!", Material.RECORD_3);
_speedAmount = amountGen.generateIntValue();
_speedDuration = durationGen.generateIntValue();
_lastAttack = 0;

View File

@ -16,7 +16,7 @@ public class MagneticMaul extends LegendaryItem
public MagneticMaul()
{
super("Magnetic Maul", "Pull enemies closer with special abilities!", Material.RECORD_6);
super("Magnetic Maul", "Pull enemies closer with special abilities!", Material.RECORD_5);
}
@Override
@ -27,7 +27,8 @@ public class MagneticMaul extends LegendaryItem
pullEntities(wielder);
}
}
@Override
public void onAttack(CustomDamageEvent event, Player wielder)
{

View File

@ -30,7 +30,7 @@ public class WindBlade extends LegendaryItem
public WindBlade()
{
super("Wind Blade", "Activate flying ability to take flight for 80 ticks before landing!", Material.RECORD_8); // TODO:
super("Wind Blade", "Activate flying ability to take flight for 80 ticks before landing!", Material.GREEN_RECORD); // TODO:
// Configurable?
}