Browse Source

Added new Items and Mobs from 1.8. Support for RB 1185.

main
Nichole Mattera 10 years ago
parent
commit
a9f653561e
  1. 72
      src/net/mcbat/MobLoot/Utils/CreatureID.java
  2. 61
      src/net/mcbat/MobLoot/Utils/ItemInfo.java
  3. 3
      src/plugin.yml

72
src/net/mcbat/MobLoot/Utils/CreatureID.java

@ -3,9 +3,12 @@ package net.mcbat.MobLoot.Utils;
import net.minecraft.server.EntityWolf;
import org.bukkit.craftbukkit.entity.CraftWolf;
import org.bukkit.entity.Animals;
import org.bukkit.entity.CaveSpider;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Enderman;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Ghast;
import org.bukkit.entity.Giant;
@ -13,6 +16,7 @@ import org.bukkit.entity.Monster;
import org.bukkit.entity.Pig;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Sheep;
import org.bukkit.entity.Silverfish;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Spider;
@ -21,23 +25,26 @@ import org.bukkit.entity.Wolf;
import org.bukkit.entity.Zombie;
public enum CreatureID {
CAVE_SPIDER("CaveSpider"),
CHICKEN("Chicken"),
COW("Cow"),
CREEPER("Creeper"),
ELECTRIFIED_CREEPER("ElectrifiedCreeper"),
ENDERMAN("Enderman"),
GHAST("Ghast"),
GIANT("Giant"),
MONSTER("Monster"),
PIG("Pig"),
PIG_ZOMBIE("PigZombie"),
SELF_TAMED_WOLF("SelfTamedWolf"),
SHEEP("Sheep"),
SILVERFISH("Silverfish"),
SKELETON("Skeleton"),
SLIME("Slime"),
SPIDER("Spider"),
SQUID("Squid"),
TAMED_WOLF("TamedWolf"),
WOLF("Wolf"),
WOLF_TAMED("TamedWolf"),
WOLF_TAMED_BY_SELF("SelfTamedWolf"),
ZOMBIE("Zombie");
private String _name;
@ -60,38 +67,47 @@ public enum CreatureID {
}
public static CreatureID fromEntity(Entity entity, String playerName) {
if (entity instanceof Chicken) return CreatureID.CHICKEN;
else if (entity instanceof Cow) return CreatureID.COW;
else if (entity instanceof Creeper) {
Creeper creeper = (Creeper) entity;
if (creeper.isPowered()) return CreatureID.ELECTRIFIED_CREEPER;
else return CreatureID.CREEPER;
}
else if (entity instanceof Ghast) return CreatureID.GHAST;
else if (entity instanceof Giant) return CreatureID.GIANT;
else if (entity instanceof Pig) return CreatureID.PIG;
else if (entity instanceof PigZombie) return CreatureID.PIG_ZOMBIE;
else if (entity instanceof Sheep) return CreatureID.SHEEP;
else if (entity instanceof Skeleton) return CreatureID.SKELETON;
else if (entity instanceof Slime) return CreatureID.SLIME;
else if (entity instanceof Spider) return CreatureID.SPIDER;
else if (entity instanceof Squid) return CreatureID.SQUID;
else if (entity instanceof Wolf) {
CraftWolf wolf = (CraftWolf) entity;
EntityWolf wolfEntity = wolf.getHandle();
// Order borrowed from CraftBukkit->CraftEntity.java (Thank You! =D)
if (entity instanceof Animals) {
if (entity instanceof Chicken) return CreatureID.CHICKEN;
else if (entity instanceof Cow) return CreatureID.COW;
else if (entity instanceof Pig) return CreatureID.PIG;
else if (entity instanceof Wolf) {
EntityWolf wolfEntity = ((CraftWolf) entity).getHandle();
if (wolfEntity.getOwnerName().equalsIgnoreCase(""))
return CreatureID.WOLF;
else if (wolfEntity.getOwnerName().equalsIgnoreCase(playerName))
return CreatureID.SELF_TAMED_WOLF;
return CreatureID.WOLF_TAMED_BY_SELF;
else
return CreatureID.TAMED_WOLF;
return CreatureID.WOLF_TAMED;
}
else if (entity instanceof Zombie) return CreatureID.ZOMBIE;
else if (entity instanceof Monster) return CreatureID.MONSTER;
return null;
else if (entity instanceof Sheep) return CreatureID.SHEEP;
}
else if (entity instanceof Monster) {
if (entity instanceof Zombie) {
if (entity instanceof PigZombie) return CreatureID.PIG_ZOMBIE;
else return CreatureID.ZOMBIE;
}
else if (entity instanceof Creeper) {
if (((Creeper) entity).isPowered()) return CreatureID.ELECTRIFIED_CREEPER;
else return CreatureID.CREEPER;
}
else if (entity instanceof Enderman) return CreatureID.ENDERMAN;
else if (entity instanceof Silverfish) return CreatureID.SILVERFISH;
else if (entity instanceof Giant) return CreatureID.GIANT;
else if (entity instanceof Skeleton) return CreatureID.SKELETON;
else if (entity instanceof Spider) {
if (entity instanceof CaveSpider) return CreatureID.CAVE_SPIDER;
else return CreatureID.SPIDER;
}
else return CreatureID.MONSTER;
}
else if (entity instanceof Squid) return CreatureID.SQUID;
else if (entity instanceof Slime) return CreatureID.SLIME;
else if (entity instanceof Ghast) return CreatureID.GHAST;
return null;
}
}

61
src/net/mcbat/MobLoot/Utils/ItemInfo.java

@ -79,11 +79,9 @@ public class ItemInfo {
}
private boolean isItem(int item) {
if (item >= 0 && item <= 28) return true;
else if (item == 30) return true;
else if (item == 35) return true;
else if (item >= 37 && item <= 95) return true;
else if (item >= 256 && item <= 357) return true;
if (item >= 0 && item <= 115) return true;
else if (item >= 256 && item <= 372) return true;
else if (item >= 2256 && item <= 2257) return true;
return false;
}
@ -92,18 +90,63 @@ public class ItemInfo {
if (data == 0)
return true;
if (item == 6 || item == 17 || item == 263) {
if (item == 70 || item == 72 || item == 263) {
if (data == 0 || data == 1) return true;
else return false;
}
if (item == 17 || item == 18 || item == 31 || item == 84 || item == 97) {
if (data >= 0 && data <= 2) return true;
else return false;
}
else if (item == 35 || item == 351) {
else if (item == 43 || item == 44 || item == 53 || item == 65 || item == 67 || item == 86 || item == 91 || item == 98) {
if (data >= 0 && data <= 3) return true;
else return false;
}
else if (item == 50 || item == 75 || item == 76 || item == 92) {
if (data >= 0 && data <= 5) return true;
else return false;
}
else if (item == 59 || item == 96 || item == 104 || item == 105 || item == 107) {
if (data >= 0 && data <= 7) return true;
else return false;
}
else if (item == 60) {
if (data >= 0 && data <= 8) return true;
else return false;
}
else if (item == 27 || item == 28 || item == 66) {
if (data >= 0 && data <= 9) return true;
else return false;
}
else if (item == 99 || item == 100) {
if (data >= 0 && data <= 10) return true;
else return false;
}
else if (item == 6 || item == 8 || item == 9 || item == 11 || item == 35 || item == 51 || item == 55 || item == 63 || item == 64 || item == 71 || item == 81 || item == 83 || item == 93 || item == 94 || item == 106 || item == 351) {
if (data >= 0 && data <= 15) return true;
else return false;
}
else if (item == 43 || item == 44) {
if (data >= 0 && data <= 3) return true;
else if (item == 23 || item == 54 || item == 61 || item == 62 || item == 68) {
if (data >= 2 && data <= 5) return true;
else return false;
}
else if (item == 69) {
if (data >= 6 && data <= 14) return true;
else return false;
}
else if (item == 26) {
if (data >= 0 && data <= 3) return true;
else if (data >= 8 && data <= 11) return true;
else return false;
}
else if (item == 29 || item == 33 || item == 34) {
if (data >= 0 && data <= 5) return true;
else if (data >= 8 && data <= 13) return true;
else return false;
}
else if ((item >= 256 && item <= 259) || (item >= 267 && item <= 279) || (item >= 283 && item <= 286) || (item >= 290 && item <= 294) || (item >= 298 && item <= 317) || item == 359) {
return true;
}
return false;
}

3
src/plugin.yml

@ -2,7 +2,7 @@ name: MobLoot
main: net.mcbat.MobLoot.MobLoot
author: Steven Mattera
website: http://mc-bat.net
version: 3.00
version: 3.01
commands:
mobloot:
aliases: [ml, loot]
@ -13,7 +13,6 @@ commands:
/<command> save - Save the configuration to disk.
permissions:
mobloot.commands.*:
default: op
description: Allows use of all MobLoot commands.
children:
mobloot.commands.set: true

Loading…
Cancel
Save