Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void chooseRandom(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- Random rand = new Random(10);
- int random = rand.nextInt();
- switch (random) {
- case 0: // Explosion
- explosion(stack, worldIn, target, attacker);
- break;
- case 1: // Lightning
- lightning(stack, worldIn, target, attacker);
- break;
- case 2: // Positive Potion Effect for Player
- playerEffect(stack, worldIn, target, attacker);
- break;
- case 3: // Negative Potion Effect for Enemies
- negativeEntityEffect(stack, worldIn, target, attacker);
- break;
- case 4: // Get Rid of Hunger
- noHunger(stack, worldIn, target, attacker);
- break;
- case 5: // Get Rid of All Bad Effects
- removeEffects(stack, worldIn, target, attacker);
- break;
- case 6: // Spawn Cobwebs in Enemy
- cobWeb(stack, worldIn, target, attacker);
- break;
- case 7: // Spawn Lava on Enemy
- lava(stack, worldIn, target, attacker);
- break;
- case 8: // Spawn Flaming Arrows
- flamingArrows(stack, worldIn, target, attacker);
- break;
- case 9: // Do Nothing
- doNothing();
- break;
- case 10 : // Spawn Hole
- spawnHole(stack, worldIn, target, attacker);
- break;
- }
- }
- public static void explosion(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- int x = target.chunkCoordX;
- int y = target.chunkCoordY;
- int z = target.chunkCoordZ;
- worldIn.createExplosion(attacker, x, y, z, 10F, true);
- }
- public static void lightning(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- int x = target.chunkCoordX;
- int y = target.chunkCoordY;
- int z = target.chunkCoordZ;
- worldIn.addWeatherEffect(new EntityLightningBolt(worldIn, x, y, z, false));
- }
- public static void playerEffect(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- PotionEffect[] positiveEffects = {
- new PotionEffect(MobEffects.SPEED, 30, 5), new PotionEffect(MobEffects.HASTE, 30, 5),
- new PotionEffect(MobEffects.STRENGTH, 30, 5), new PotionEffect(MobEffects.INSTANT_HEALTH, 30, 5),
- new PotionEffect(MobEffects.JUMP_BOOST, 30, 5), new PotionEffect(MobEffects.REGENERATION, 30, 5),
- new PotionEffect(MobEffects.RESISTANCE, 30, 5), new PotionEffect(MobEffects.FIRE_RESISTANCE, 30, 5),
- new PotionEffect(MobEffects.WATER_BREATHING, 30, 5), new PotionEffect(MobEffects.INVISIBILITY, 30, 5),
- new PotionEffect(MobEffects.NIGHT_VISION, 30, 5), new PotionEffect(MobEffects.HEALTH_BOOST, 30, 20),
- new PotionEffect(MobEffects.ABSORPTION, 30, 5), new PotionEffect(MobEffects.SATURATION, 30, 5),
- new PotionEffect(MobEffects.LUCK, 30, 5)
- };
- Random rand = new Random();
- int random = rand.nextInt(positiveEffects.length);
- if (target instanceof EntityPlayer) {
- target.addPotionEffect(positiveEffects[random]);
- }
- }
- public static void negativeEntityEffect(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- PotionEffect[] negativeEffects = {
- new PotionEffect(MobEffects.SLOWNESS, 30, 5), new PotionEffect(MobEffects.MINING_FATIGUE, 30, 5),
- new PotionEffect(MobEffects.NAUSEA, 30, 5), new PotionEffect(MobEffects.BLINDNESS, 30, 5),
- new PotionEffect(MobEffects.HUNGER, 30, 5), new PotionEffect(MobEffects.WEAKNESS, 30, 5),
- new PotionEffect(MobEffects.LEVITATION, 30, 5), new PotionEffect(MobEffects.GLOWING, 30, 5),
- };
- Random rand = new Random();
- int random = rand.nextInt(negativeEffects.length);
- attacker.addPotionEffect(negativeEffects[random]);
- }
- public static void noHunger(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- if (attacker instanceof EntityPlayer) {
- EntityPlayer player = (EntityPlayer) attacker;
- player.getFoodStats().setFoodLevel(10);
- }
- }
- public static void removeEffects(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- for (PotionEffect effect : attacker.getActivePotionEffects()) {
- attacker.removePotionEffect(effect.getPotion());
- }
- }
- public static void cobWeb(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- int x = target.chunkCoordX;
- int y = target.chunkCoordY;
- int z = target.chunkCoordZ;
- BlockPos normal = new BlockPos(x, y, z);
- BlockPos right = new BlockPos(x + 1, y, z);
- BlockPos left = new BlockPos(x - 1, y, z);
- BlockPos up = new BlockPos(x, y + 1, z);
- BlockPos down = new BlockPos(x, y - 1, z);
- worldIn.setBlockState(normal, Blocks.WEB.getDefaultState());
- worldIn.setBlockState(right, Blocks.WEB.getDefaultState());
- worldIn.setBlockState(left, Blocks.WEB.getDefaultState());
- worldIn.setBlockState(up, Blocks.WEB.getDefaultState());
- worldIn.setBlockState(down, Blocks.WEB.getDefaultState());
- }
- public static void lava(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- int x = target.chunkCoordX;
- int y = target.chunkCoordY;
- int z = target.chunkCoordZ;
- BlockPos normal = new BlockPos(x, y, z);
- BlockPos right = new BlockPos(x + 1, y, z);
- BlockPos left = new BlockPos(x - 1, y, z);
- BlockPos up = new BlockPos(x, y + 1, z);
- BlockPos down = new BlockPos(x, y - 1, z);
- worldIn.setBlockState(normal, Blocks.LAVA.getDefaultState());
- worldIn.setBlockState(right, Blocks.LAVA.getDefaultState());
- worldIn.setBlockState(left, Blocks.LAVA.getDefaultState());
- worldIn.setBlockState(up, Blocks.LAVA.getDefaultState());
- worldIn.setBlockState(down, Blocks.LAVA.getDefaultState());
- }
- public static void flamingArrows(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- int x = target.chunkCoordX;
- int y = target.chunkCoordY;
- int z = target.chunkCoordZ;
- int playerX = attacker.chunkCoordX;
- int playerY = attacker.chunkCoordY;
- int playerZ = attacker.chunkCoordZ;
- EntityTippedArrow arrow = new EntityTippedArrow(worldIn, playerX, playerY, playerZ + 1);
- EntityTippedArrow arrow1 = new EntityTippedArrow(worldIn, playerX, playerY, playerZ + 1);
- EntityTippedArrow arrow2 = new EntityTippedArrow(worldIn, playerX, playerY, playerZ + 1);
- arrow.shoot(x, y, z, 5.0F, 0);
- arrow1.shoot(x, y, z, 5.0F, 0);
- arrow2.shoot(x, y, z, 5.0F, 0);
- }
- public static void doNothing() {}
- public static void spawnHole(ItemStack stack, World worldIn, final EntityLivingBase target,
- final EntityLivingBase attacker) {
- int x = target.chunkCoordX;
- int y = target.chunkCoordY;
- int z = target.chunkCoordZ;
- BlockPos normal = new BlockPos(x, y, z);
- BlockPos down = new BlockPos(x, y - 1, z);
- BlockPos up = new BlockPos(x, y + 1, z);
- BlockPos left = new BlockPos(x - 1, y, z);
- BlockPos right = new BlockPos(x + 1, y, z);
- worldIn.setBlockToAir(normal);
- worldIn.setBlockToAir(down);
- worldIn.setBlockToAir(up);
- worldIn.setBlockToAir(left);
- worldIn.setBlockToAir(right);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement