Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #priority 500
- import crafttweaker.event.EntityJoinWorldEvent;
- import crafttweaker.event.IEntityEvent;
- import crafttweaker.entity.IEntityLiving;
- import crafttweaker.entity.IEntity;
- import crafttweaker.entity.IEntityLivingBase;
- import crafttweaker.entity.IEntityDefinition;
- import crafttweaker.util.IRandom;
- import crafttweaker.world.IWorld;
- import crafttweaker.item.IItemStack;
- import crafttweaker.data.IData;
- events.onEntityJoinWorld(function (event as EntityJoinWorldEvent) {
- if event.entity instanceof IEntityLiving {
- val entityLiving as IEntityLiving = event.entity;
- if (event.entity.definition.id).matches("minecraft:wither_skeleton") {
- val world = event.world;
- val head = crafttweaker.entity.IEntityEquipmentSlot.head();
- val chest = crafttweaker.entity.IEntityEquipmentSlot.chest();
- val legs = crafttweaker.entity.IEntityEquipmentSlot.legs();
- val feet = crafttweaker.entity.IEntityEquipmentSlot.feet();
- // Set 50% chance for each individual armor slot
- if (world.getRandom().nextDouble() <= 0.5) {
- entityLiving.setItemToSlot(head, <minecraft:diamond_helmet>);
- }
- if (world.getRandom().nextDouble() <= 0.5) {
- entityLiving.setItemToSlot(chest, <minecraft:diamond_chestplate>);
- }
- if (world.getRandom().nextDouble() <= 0.5) {
- entityLiving.setItemToSlot(legs, <minecraft:diamond_leggings>);
- }
- if (world.getRandom().nextDouble() <= 0.5) {
- entityLiving.setItemToSlot(feet, <minecraft:diamond_boots>);
- }
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment