mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-04 15:26:05 +00:00
Merge pull request #253 from speedxx/patch-1
replace private constructors & 1.16 attribute names
This commit is contained in:
commit
e1b514ca85
@ -5,11 +5,14 @@ import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_16_R1.NBTTagInt;
|
||||
import net.minecraft.server.v1_16_R1.NBTTagList;
|
||||
import net.minecraft.server.v1_16_R1.NBTTagString;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -141,13 +144,13 @@ public class Command_modifyitem extends FreedomCommand
|
||||
item.setItemMeta(potionMeta);
|
||||
break;
|
||||
}
|
||||
// TODO: Fix code here bc 1.15 made some things private for some reason
|
||||
/*case "attribute":
|
||||
|
||||
case "attribute":
|
||||
if (args.length < 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
net.minecraft.server.v1_15_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
||||
net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
||||
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
|
||||
NBTTagList modifiers = getAttributeList(nmsStack);
|
||||
NBTTagCompound cmpnd = new NBTTagCompound();
|
||||
@ -157,8 +160,8 @@ public class Command_modifyitem extends FreedomCommand
|
||||
msg("Invalid attribute. Please run /attributelist for a list of valid attributes.");
|
||||
return true;
|
||||
}
|
||||
cmpnd.set("AttributeName", new NBTTagString(attribute.getAttribute()));
|
||||
cmpnd.set("Name", new NBTTagString(attribute.getAttribute()));
|
||||
cmpnd.set("AttributeName", NBTTagString.a(attribute.getAttribute()));
|
||||
cmpnd.set("Name", NBTTagString.a(attribute.getAttribute()));
|
||||
int amount;
|
||||
try
|
||||
{
|
||||
@ -169,16 +172,16 @@ public class Command_modifyitem extends FreedomCommand
|
||||
msg("The amount specified is not a valid integer.");
|
||||
return true;
|
||||
}
|
||||
cmpnd.set("Amount", new NBTTagInt(amount));
|
||||
cmpnd.set("Operation", new NBTTagInt(0));
|
||||
cmpnd.set("UUIDLeast", new NBTTagInt(894654));
|
||||
cmpnd.set("UUIDMost", new NBTTagInt(2872));
|
||||
cmpnd.set("Slot", new NBTTagString("mainhand"));
|
||||
cmpnd.set("Amount", NBTTagInt.a(amount));
|
||||
cmpnd.set("Operation", NBTTagInt.a(0));
|
||||
cmpnd.set("UUIDLeast", NBTTagInt.a(894654));
|
||||
cmpnd.set("UUIDMost", NBTTagInt.a(2872));
|
||||
cmpnd.set("Slot", NBTTagString.a("mainhand"));
|
||||
modifiers.add(cmpnd);
|
||||
compound.set("AttributeModifiers", modifiers);
|
||||
nmsStack.setTag(compound);
|
||||
item = CraftItemStack.asBukkitCopy(nmsStack);
|
||||
break;*/
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -200,21 +203,20 @@ public class Command_modifyitem extends FreedomCommand
|
||||
return stack.getTag().getList("AttributeModifiers", 10);
|
||||
}
|
||||
|
||||
|
||||
private enum Attribute
|
||||
{
|
||||
GENERIC_MAX_HEALTH("GENERIC_MAX_HEALTH", "generic.maxHealth"),
|
||||
GENERIC_FOLLOW_RANGE("GENERIC_FOLLOW_RANGE", "generic.followRange"),
|
||||
GENERIC_KNOCKBACK_RESISTANCE("GENERIC_KNOCKBACK_RESISTANCE", "generic.knockbackResistance"),
|
||||
GENERIC_MOVEMENT_SPEED("GENERIC_MOVEMENT_SPEED", "generic.movementSpeed"),
|
||||
GENERIC_FLYING_SPEED("GENERIC_FLYING_SPEED", "generic.flyingSpeed"),
|
||||
GENERIC_ATTACK_DAMAGE("GENERIC_ATTACK_DAMAGE", "generic.attackDamage"),
|
||||
GENERIC_ATTACK_SPEED("GENERIC_ATTACK_SPEED", "generic.attackSpeed"),
|
||||
GENERIC_MAX_HEALTH("GENERIC_MAX_HEALTH", "generic.max_health"),
|
||||
GENERIC_FOLLOW_RANGE("GENERIC_FOLLOW_RANGE", "generic.follow_range"),
|
||||
GENERIC_KNOCKBACK_RESISTANCE("GENERIC_KNOCKBACK_RESISTANCE", "generic.knockback_resistance"),
|
||||
GENERIC_MOVEMENT_SPEED("GENERIC_MOVEMENT_SPEED", "generic.movement_speed"),
|
||||
GENERIC_FLYING_SPEED("GENERIC_FLYING_SPEED", "generic.flying_speed"),
|
||||
GENERIC_ATTACK_DAMAGE("GENERIC_ATTACK_DAMAGE", "generic.attack_damage"),
|
||||
GENERIC_ATTACK_SPEED("GENERIC_ATTACK_SPEED", "generic.attack_speed"),
|
||||
GENERIC_ARMOR("GENERIC_ARMOR", "generic.armor"),
|
||||
GENERIC_ARMOR_TOUGHNESS("GENERIC_ARMOR_TOUGHNESS", "generic.armorToughmess"),
|
||||
GENERIC_ARMOR_TOUGHNESS("GENERIC_ARMOR_TOUGHNESS", "generic.armor_toughmess"),
|
||||
GENERIC_LUCK("GENERIC_LUCK", "generic.luck"),
|
||||
HORSE_JUMP_STRENGTH("GENERIC_MAX_HEALTH", "horse.JumpStrength"),
|
||||
ZOMBIE_SPAWN_REINFORCEMENTS("ZOMBIE_SPAWN_REINFORCEMENTS", "zombie.SpawnReinforcements");
|
||||
HORSE_JUMP_STRENGTH("GENERIC_MAX_HEALTH", "horse.jump_strength"),
|
||||
ZOMBIE_SPAWN_REINFORCEMENTS("ZOMBIE_SPAWN_REINFORCEMENTS", "zombie.spawn_reinforcements");
|
||||
|
||||
private final String name;
|
||||
private final String attribute;
|
||||
|
@ -69,6 +69,8 @@ public class Groups
|
||||
EntityType.HOGLIN,
|
||||
EntityType.HORSE,
|
||||
EntityType.HUSK,
|
||||
EntityType.ILLUSIONER,
|
||||
EntityType.IRON_GOLEM,
|
||||
EntityType.LLAMA,
|
||||
EntityType.MAGMA_CUBE,
|
||||
EntityType.MUSHROOM_COW,
|
||||
@ -78,6 +80,7 @@ public class Groups
|
||||
EntityType.PARROT,
|
||||
EntityType.PHANTOM,
|
||||
EntityType.PIG,
|
||||
EntityType.PIGLIN,
|
||||
EntityType.PILLAGER,
|
||||
EntityType.POLAR_BEAR,
|
||||
EntityType.PUFFERFISH,
|
||||
@ -90,6 +93,7 @@ public class Groups
|
||||
EntityType.SKELETON,
|
||||
EntityType.SKELETON_HORSE,
|
||||
EntityType.SLIME,
|
||||
EntityType.SNOWMAN,
|
||||
EntityType.SPIDER,
|
||||
EntityType.SQUID,
|
||||
EntityType.STRAY,
|
||||
|
Loading…
Reference in New Issue
Block a user