Jump to content

Darwino43

Members
  • Posts

    1
  • Joined

  • Last visited

Darwino43's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. This is for advanced Minecraft Java mod makers. So i have this script: import net.minecraft.entity.monster.SkeletonEntity; import net.minecraft.item.Items; import net.minecraft.item.EnchantedGoldenAppleItem; import net.minecraft.item.ItemStack; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Hand; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class Example { @SubscribeEvent public void tameSkeleton(PlayerInteractEvent.EntityInteract event) { if (event.getTarget() instanceof SkeletonEntity) { SkeletonEntity skeleton = (SkeletonEntity) event.getTarget(); ItemStack itemstack = event.getPlayer().getHeldItem(event.getHand()); if (skeleton.isTamed()) { return; } else if (itemstack.getItem() instanceof EnchantedGoldenAppleItem) { if (!event.getPlayer().abilities.isCreativeMode) { itemstack.shrink(1); } if (!skeleton.world.isRemote) { skeleton.setTamedBy(event.getPlayer()); skeleton.world.setEntityState(skeleton, (byte)7); } return; } } } @SubscribeEvent public void skeletonDefendPlayer(LivingAttackEvent event) { if (event.getEntity() instanceof PlayerEntity) { PlayerEntity player = (PlayerEntity) event.getEntity(); if (player.getAttackingEntity() instanceof SkeletonEntity) { SkeletonEntity skeleton = (SkeletonEntity) player.getAttackingEntity(); if (skeleton.isTamed()) { event.setCanceled(true); skeleton.setAttackTarget(event.getSource().getTrueSource()); } } } } } and it should make skeleton posible to tame. Apps that im using to create mods doesnt show any errors so why it doesnt work?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.