mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-30 22:44:24 +01:00
Change: Removed all CraftBukkit and NMS Code
This commit is contained in:
parent
473648e905
commit
7fe5dd337a
@ -8,17 +8,11 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.server.v1_4_6.Item;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.craftbukkit.v1_4_6.entity.CraftPigZombie;
|
||||
import org.bukkit.craftbukkit.v1_4_6.entity.CraftSkeleton;
|
||||
import org.bukkit.craftbukkit.v1_4_6.entity.CraftZombie;
|
||||
import org.bukkit.craftbukkit.v1_4_6.inventory.CraftItemStack;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -39,11 +33,11 @@ public class DMobType {
|
||||
|
||||
private int maxHealth;
|
||||
|
||||
private Item ItemHand;
|
||||
private Item ItemHelmet;
|
||||
private Item ItemChestplate;
|
||||
private Item ItemLeggings;
|
||||
private Item ItemBoots;
|
||||
private ItemStack ItemHand;
|
||||
private ItemStack ItemHelmet;
|
||||
private ItemStack ItemChestplate;
|
||||
private ItemStack ItemLeggings;
|
||||
private ItemStack ItemBoots;
|
||||
|
||||
private Map<ItemStack, Integer> drops = new HashMap<ItemStack, Integer>();
|
||||
public Map<ItemStack, Integer> getDrops() { return this.drops; }
|
||||
@ -66,42 +60,11 @@ public class DMobType {
|
||||
LivingEntity entity=(LivingEntity)gWorld.world.spawnEntity(loc, type);
|
||||
|
||||
/* Set the Items */
|
||||
|
||||
//Check if it's a Zombie
|
||||
if(type==EntityType.ZOMBIE){
|
||||
CraftZombie entityC = (CraftZombie)entity;
|
||||
net.minecraft.server.v1_4_6.EntityZombie entityMC = entityC.getHandle();
|
||||
|
||||
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.v1_4_6.ItemStack(ItemHand));
|
||||
if(ItemBoots!=null) entityMC.setEquipment(1, new net.minecraft.server.v1_4_6.ItemStack(ItemBoots));
|
||||
if(ItemLeggings!=null) entityMC.setEquipment(2, new net.minecraft.server.v1_4_6.ItemStack(ItemLeggings));
|
||||
if(ItemChestplate!=null) entityMC.setEquipment(3, new net.minecraft.server.v1_4_6.ItemStack(ItemChestplate));
|
||||
if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.v1_4_6.ItemStack(ItemHelmet));
|
||||
}
|
||||
|
||||
//Check if it's a Skeleton
|
||||
if(type==EntityType.SKELETON){
|
||||
CraftSkeleton entityC = (CraftSkeleton)entity;
|
||||
net.minecraft.server.v1_4_6.EntitySkeleton entityMC = entityC.getHandle();
|
||||
|
||||
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.v1_4_6.ItemStack(ItemHand));
|
||||
if(ItemBoots!=null) entityMC.setEquipment(1, new net.minecraft.server.v1_4_6.ItemStack(ItemBoots));
|
||||
if(ItemLeggings!=null) entityMC.setEquipment(2, new net.minecraft.server.v1_4_6.ItemStack(ItemLeggings));
|
||||
if(ItemChestplate!=null) entityMC.setEquipment(3, new net.minecraft.server.v1_4_6.ItemStack(ItemChestplate));
|
||||
if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.v1_4_6.ItemStack(ItemHelmet));
|
||||
}
|
||||
|
||||
//Check if it's a Zombie Pigman
|
||||
if(type==EntityType.PIG_ZOMBIE){
|
||||
CraftPigZombie entityC = (CraftPigZombie)entity;
|
||||
net.minecraft.server.v1_4_6.EntityPigZombie entityMC = entityC.getHandle();
|
||||
|
||||
if(ItemHand!=null) entityMC.setEquipment(0, new net.minecraft.server.v1_4_6.ItemStack(ItemHand));
|
||||
if(ItemBoots!=null) entityMC.setEquipment(1, new net.minecraft.server.v1_4_6.ItemStack(ItemBoots));
|
||||
if(ItemLeggings!=null) entityMC.setEquipment(2, new net.minecraft.server.v1_4_6.ItemStack(ItemLeggings));
|
||||
if(ItemChestplate!=null) entityMC.setEquipment(3, new net.minecraft.server.v1_4_6.ItemStack(ItemChestplate));
|
||||
if(ItemHelmet!=null) entityMC.setEquipment(4, new net.minecraft.server.v1_4_6.ItemStack(ItemHelmet));
|
||||
}
|
||||
entity.getEquipment().setItemInHand(ItemHand);
|
||||
entity.getEquipment().setHelmet(ItemHelmet);
|
||||
entity.getEquipment().setChestplate(ItemChestplate);
|
||||
entity.getEquipment().setLeggings(ItemLeggings);
|
||||
entity.getEquipment().setBoots(ItemBoots);
|
||||
|
||||
/* Check mob specified stuff */
|
||||
if(type==EntityType.SKELETON){
|
||||
@ -152,23 +115,23 @@ public class DMobType {
|
||||
|
||||
//Load Items
|
||||
if(configFile.contains(mobName+".ItemHelmet")){
|
||||
mobType.ItemHelmet=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHelmet"))).getItem();
|
||||
mobType.ItemHelmet = new ItemStack(configFile.getInt(mobName+".ItemHelmet"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHelmet"))).getItem();
|
||||
}
|
||||
|
||||
if(configFile.contains(mobName+".ItemChestplate")){
|
||||
mobType.ItemChestplate=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemChestplate"))).getItem();
|
||||
mobType.ItemChestplate = new ItemStack(configFile.getInt(mobName+".ItemChestplate"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemChestplate"))).getItem();
|
||||
}
|
||||
|
||||
if(configFile.contains(mobName+".ItemBoots")){
|
||||
mobType.ItemBoots=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemBoots"))).getItem();
|
||||
mobType.ItemBoots = new ItemStack(configFile.getInt(mobName+".ItemBoots"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemBoots"))).getItem();
|
||||
}
|
||||
|
||||
if(configFile.contains(mobName+".ItemLeggings")){
|
||||
mobType.ItemLeggings=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemLeggings"))).getItem();
|
||||
mobType.ItemLeggings = new ItemStack(configFile.getInt(mobName+".ItemLeggings"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemLeggings"))).getItem();
|
||||
}
|
||||
|
||||
if(configFile.contains(mobName+".ItemHand")){
|
||||
mobType.ItemHand=CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHand"))).getItem();
|
||||
mobType.ItemHand = new ItemStack(configFile.getInt(mobName+".ItemHand"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHand"))).getItem();
|
||||
}
|
||||
|
||||
//Load different Mob options
|
||||
|
@ -13,15 +13,20 @@ public class DMob {
|
||||
//Variables
|
||||
public LivingEntity entity;
|
||||
public DMobType type;
|
||||
public int live;
|
||||
|
||||
public DMob(LivingEntity entity, int live, GameWorld gworld, DMobType type){
|
||||
gworld.dmobs.add(this);
|
||||
|
||||
this.entity = entity;
|
||||
this.live = live;
|
||||
this.type = type;
|
||||
|
||||
/* Remove DropChance of equipment */
|
||||
this.entity.getEquipment().setHelmetDropChance(0);
|
||||
this.entity.getEquipment().setChestplateDropChance(0);
|
||||
this.entity.getEquipment().setLeggingsDropChance(0);
|
||||
this.entity.getEquipment().setBootsDropChance(0);
|
||||
this.entity.getEquipment().setItemInHandDropChance(0);
|
||||
|
||||
/* Max Health */
|
||||
if(live>0){
|
||||
this.entity.setMaxHealth(live);
|
||||
|
Loading…
Reference in New Issue
Block a user