use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.
the class EntityConverterService method convertEquipable.
public void convertEquipable(LivingEntity entity, TagCompound properties) {
List<TagCompound> equipmentList = new ArrayList<>();
if (random.nextFloat() <= entity.getEquipment().getChestplateDropChance()) {
ItemStack itemStack = entity.getEquipment().getChestplate();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Chestplate.getSlotId()));
equipmentList.add(item);
}
}
if (random.nextFloat() <= entity.getEquipment().getHelmetDropChance()) {
ItemStack itemStack = entity.getEquipment().getHelmet();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Helmet.getSlotId()));
equipmentList.add(item);
}
}
if (random.nextFloat() <= entity.getEquipment().getLeggingsDropChance()) {
ItemStack itemStack = entity.getEquipment().getLeggings();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Leggins.getSlotId()));
equipmentList.add(item);
}
}
if (random.nextFloat() <= entity.getEquipment().getBootsDropChance()) {
ItemStack itemStack = entity.getEquipment().getBoots();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Boots.getSlotId()));
equipmentList.add(item);
}
}
properties.getCompoundData().put("Equipment", new TagList(equipmentList));
}
use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.
the class EntityConverterService method convertSheep.
public void convertSheep(Sheep sheep, TagCompound properties) {
properties.getCompoundData().put("Color", new TagInt(sheep.getColor().getDyeData()));
properties.getCompoundData().put("Sheared", new TagByte(sheep.isSheared()));
}
use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.
the class EntityConverterService method convertEquipable.
public void convertEquipable(LivingEntity entity, TagCompound properties) {
List<TagCompound> equipmentList = new ArrayList<>();
if (random.nextFloat() <= entity.getEquipment().getChestplateDropChance()) {
ItemStack itemStack = entity.getEquipment().getChestplate();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Chestplate.getSlotId()));
equipmentList.add(item);
}
}
if (random.nextFloat() <= entity.getEquipment().getHelmetDropChance()) {
ItemStack itemStack = entity.getEquipment().getHelmet();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Helmet.getSlotId()));
equipmentList.add(item);
}
}
if (random.nextFloat() <= entity.getEquipment().getLeggingsDropChance()) {
ItemStack itemStack = entity.getEquipment().getLeggings();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Leggins.getSlotId()));
equipmentList.add(item);
}
}
if (random.nextFloat() <= entity.getEquipment().getBootsDropChance()) {
ItemStack itemStack = entity.getEquipment().getBoots();
if (itemStack != null && itemStack.getType() != Material.AIR) {
TagCompound item = MyPetApi.getPlatformHelper().itemStackToCompund(itemStack);
item.getCompoundData().put("Slot", new TagInt(EquipmentSlot.Boots.getSlotId()));
equipmentList.add(item);
}
}
properties.getCompoundData().put("Equipment", new TagList(equipmentList));
}
use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.
the class EntityConverterService method convertOcelot.
public void convertOcelot(Ocelot ocelot, TagCompound properties) {
properties.getCompoundData().put("CatType", new TagInt(ocelot.getCatType().getId()));
properties.getCompoundData().put("Sitting", new TagByte(ocelot.isSitting()));
}
use of de.keyle.knbt.TagInt in project MyPet by xXKeyleXx.
the class EntityConverterService method convertVillager.
public void convertVillager(Villager villager, TagCompound properties) {
int profession = villager.getProfession().ordinal();
if (MyPetApi.getCompatUtil().compareWithMinecraftVersion("1.10") >= 0) {
profession--;
}
properties.getCompoundData().put("Profession", new TagInt(profession));
TagCompound villagerTag = MyPetApi.getPlatformHelper().entityToTag(villager);
String[] allowedTags = { "Riches", "Career", "CareerLevel", "Willing", "Inventory", "Offers" };
Set<String> keys = new HashSet<>(villagerTag.getCompoundData().keySet());
for (String key : keys) {
if (Arrays.binarySearch(allowedTags, key) > -1) {
continue;
}
villagerTag.remove(key);
}
properties.getCompoundData().put("OriginalData", villagerTag);
}
Aggregations