Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MobEquipEvent {
- @SubscribeEvent
- public void changeToModdedEquipment(LivingSpawnEvent.SpecialSpawn event){
- if ((event.getEntity() instanceof ZombieEntity) && GeneralModConfig.MOBS_USE_HARD_STEEL_GEAR.get()) {
- ZombieEntity zombie = (ZombieEntity) event.getEntity();
- World world = event.getWorld().getWorld();
- DifficultyInstance difficultyInstance = event.getWorld().getDifficultyForLocation(zombie.getPosition());
- // EMPTY ALL ARMOR SLOTS
- // zombie.getArmorInventoryList().forEach((equipment) -> equipment = ItemStack.EMPTY);
- // EMPTY HELD ITEM SLOTS
- //zombie.getHeldEquipment().forEach((equipment) -> equipment = ItemStack.EMPTY);
- for (EquipmentSlotType slot : EquipmentSlotType.values()){
- if(!zombie.getItemStackFromSlot(slot).isEmpty()){
- zombie.setItemStackToSlot(slot, ItemStack.EMPTY);
- }
- }
- ZombieEquipUtilities.setArmorBasedOnDifficulty(difficultyInstance, world, zombie);
- ZombieEquipUtilities.setHeldItemsBasedOnDifficulty(world, zombie);
- ZombieEquipUtilities.setEnchantmentBasedOnDifficulty(difficultyInstance, zombie);
- //HardSteel.logger.info("Zombie's armor is: " + zombie.getEquipmentAndArmor().toString());
- }
- if ((event.getEntity() instanceof HuskEntity) && GeneralModConfig.MOBS_USE_HARD_STEEL_GEAR.get()) {
- HuskEntity husk = (HuskEntity) event.getEntity();
- World world = event.getWorld().getWorld();
- DifficultyInstance difficultyInstance = event.getWorld().getDifficultyForLocation(husk.getPosition());
- // EMPTY ALL ARMOR SLOTS
- // zombie.getArmorInventoryList().forEach((equipment) -> equipment = ItemStack.EMPTY);
- // EMPTY HELD ITEM SLOTS
- //zombie.getHeldEquipment().forEach((equipment) -> equipment = ItemStack.EMPTY);
- for (EquipmentSlotType slot : EquipmentSlotType.values()){
- if(!husk.getItemStackFromSlot(slot).isEmpty()){
- husk.setItemStackToSlot(slot, ItemStack.EMPTY);
- }
- }
- HuskEquipUtilities.setArmorBasedOnDifficulty(difficultyInstance, world, husk);
- HuskEquipUtilities.setHeldItemsBasedOnDifficulty(world, husk);
- HuskEquipUtilities.setEnchantmentBasedOnDifficulty(difficultyInstance, husk);
- //HardSteel.logger.info("Zombie's armor is: " + zombie.getEquipmentAndArmor().toString());
- }
- if ((event.getEntity() instanceof ZombieVillagerEntity) && GeneralModConfig.MOBS_USE_HARD_STEEL_GEAR.get()) {
- ZombieVillagerEntity zombieVillager = (ZombieVillagerEntity) event.getEntity();
- World world = event.getWorld().getWorld();
- DifficultyInstance difficultyInstance = event.getWorld().getDifficultyForLocation(zombieVillager.getPosition());
- // EMPTY ALL ARMOR SLOTS
- // zombie.getArmorInventoryList().forEach((equipment) -> equipment = ItemStack.EMPTY);
- // EMPTY HELD ITEM SLOTS
- //zombie.getHeldEquipment().forEach((equipment) -> equipment = ItemStack.EMPTY);
- for (EquipmentSlotType slot : EquipmentSlotType.values()){
- if(!zombieVillager.getItemStackFromSlot(slot).isEmpty()){
- zombieVillager.setItemStackToSlot(slot, ItemStack.EMPTY);
- }
- }
- ZombieVillagerEquipUtilities.setArmorBasedOnDifficulty(difficultyInstance, world, zombieVillager);
- ZombieVillagerEquipUtilities.setHeldItemsBasedOnDifficulty(world, zombieVillager);
- ZombieVillagerEquipUtilities.setEnchantmentBasedOnDifficulty(difficultyInstance, zombieVillager);
- //HardSteel.logger.info("Zombie's armor is: " + zombie.getEquipmentAndArmor().toString());
- }
- if((event.getEntity() instanceof SkeletonEntity) && GeneralModConfig.MOBS_USE_HARD_STEEL_GEAR.get()){
- SkeletonEntity skeleton = (SkeletonEntity) event.getEntity();
- World world = event.getWorld().getWorld();
- DifficultyInstance difficultyInstance = event.getWorld().getDifficultyForLocation(skeleton.getPosition());
- // EMPTY ALL ARMOR SLOTS
- //skeleton.getArmorInventoryList().forEach((equipment) -> equipment = ItemStack.EMPTY);
- for (EquipmentSlotType slot : EquipmentSlotType.values()){
- if(!skeleton.getItemStackFromSlot(slot).isEmpty() && slot != EquipmentSlotType.MAINHAND){
- skeleton.setItemStackToSlot(slot, ItemStack.EMPTY);
- }
- }
- SkeletonEquipUtilities.setArmorBasedOnDifficulty(difficultyInstance, world, skeleton);
- SkeletonEquipUtilities.setEnchantmentBasedOnDifficulty(difficultyInstance, skeleton);
- }
- if((event.getEntity() instanceof StrayEntity) && GeneralModConfig.MOBS_USE_HARD_STEEL_GEAR.get()){
- StrayEntity stray = (StrayEntity) event.getEntity();
- World world = event.getWorld().getWorld();
- DifficultyInstance difficultyInstance = event.getWorld().getDifficultyForLocation(stray.getPosition());
- // EMPTY ALL ARMOR SLOTS
- //skeleton.getArmorInventoryList().forEach((equipment) -> equipment = ItemStack.EMPTY);
- for (EquipmentSlotType slot : EquipmentSlotType.values()){
- if(!stray.getItemStackFromSlot(slot).isEmpty() && slot != EquipmentSlotType.MAINHAND){
- stray.setItemStackToSlot(slot, ItemStack.EMPTY);
- }
- }
- StrayEquipUtilities.setArmorBasedOnDifficulty(difficultyInstance, world, stray);
- StrayEquipUtilities.setEnchantmentBasedOnDifficulty(difficultyInstance, stray);
- }
- if((event.getEntity() instanceof WitherSkeletonEntity) && GeneralModConfig.MOBS_USE_HARD_STEEL_GEAR.get()){
- HardSteel.logger.info("Spawned a Wither Skeleton!");
- WitherSkeletonEntity witherSkeleton = (WitherSkeletonEntity) event.getEntity();
- //World world = event.getWorld().getWorld();
- //DifficultyInstance difficultyInstance = event.getWorld().getDifficultyForLocation(witherSkeleton.getPosition());
- //for (EquipmentSlotType slot : EquipmentSlotType.values()){
- // if(!witherSkeleton.getItemStackFromSlot(slot).isEmpty()){
- // witherSkeleton.setItemStackToSlot(slot, ItemStack.EMPTY);
- // }
- //}
- // GIVE WITHER SKELETON IRON GEAR WITH POSSIBLE ENCHANTMENTS
- //WitherSkeletonEquipUtilities.setArmorBasedOnDifficulty(difficultyInstance, world, witherSkeleton);
- WitherSkeletonEquipUtilities.setHeldItemsBasedOnDifficulty(witherSkeleton);
- HardSteel.logger.info("Wither Skeleton at " + witherSkeleton.getPosition().toString() + "has " + witherSkeleton.getHeldItemMainhand().toString());
- //WitherSkeletonEquipUtilities.setEnchantmentBasedOnDifficulty(difficultyInstance, witherSkeleton);
- }
- if((event.getEntity() instanceof ZombiePigmanEntity) && GeneralModConfig.MOBS_USE_HARD_STEEL_GEAR.get()){
- ZombiePigmanEntity zombiePigman = (ZombiePigmanEntity) event.getEntity();
- //World world = event.getWorld().getWorld();
- DifficultyInstance difficultyInstance = event.getWorld().getDifficultyForLocation(zombiePigman.getPosition());
- //for (EquipmentSlotType slot : EquipmentSlotType.values()){
- // if(!zombiePigman.getItemStackFromSlot(slot).isEmpty()){
- // zombiePigman.setItemStackToSlot(slot, ItemStack.EMPTY);
- // }
- //}
- // GIVE ZOMBIE PIGMAN COPPER GEAR WITH POSSIBLE ENCHANTMENTS
- //ZombiePigmanEquipUtilities.setArmorBasedOnDifficulty(difficultyInstance, world, zombiePigman);
- ZombiePigmanEquipUtilities.setHeldItemsBasedOnDifficulty(zombiePigman);
- ZombiePigmanEquipUtilities.setEnchantmentBasedOnDifficulty(difficultyInstance, zombiePigman);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment