mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 20:00:46 +00:00
Fix clone(), formatting tweaks
This commit is contained in:
parent
e6d177c09a
commit
7eac272386
1 changed files with 17 additions and 21 deletions
|
@ -1,23 +1,22 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file is part of ASkyBlock.
|
* This file is part of ASkyBlock.
|
||||||
*
|
* <p>
|
||||||
* ASkyBlock is free software: you can redistribute it and/or modify
|
* ASkyBlock is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
* <p>
|
||||||
* ASkyBlock is distributed in the hope that it will be useful,
|
* ASkyBlock is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
* <p>
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with ASkyBlock. If not, see <http://www.gnu.org/licenses/>.
|
* along with ASkyBlock. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package net.ess3.nms.v1_9_R1;
|
package net.ess3.nms.v1_9_R1;
|
||||||
|
|
||||||
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
@ -34,6 +33,7 @@ public class SpawnEgg1_9 {
|
||||||
public SpawnEgg1_9(EntityType type) {
|
public SpawnEgg1_9(EntityType type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the type of entity this egg will spawn.
|
* Get the type of entity this egg will spawn.
|
||||||
*
|
*
|
||||||
|
@ -54,14 +54,11 @@ public class SpawnEgg1_9 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SPAWN EGG{" + getSpawnedType() + "}";
|
return "SPAWN EGG{" + getSpawnedType() + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpawnEgg1_9 clone() {
|
|
||||||
return (SpawnEgg1_9) this.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an ItemStack of one spawn egg
|
* Get an ItemStack of one spawn egg
|
||||||
* @return ItemStack
|
* @return ItemStack
|
||||||
|
@ -70,7 +67,6 @@ public class SpawnEgg1_9 {
|
||||||
return toItemStack(1);
|
return toItemStack(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an itemstack of spawn eggs
|
* Get an itemstack of spawn eggs
|
||||||
* @param amount
|
* @param amount
|
||||||
|
@ -81,7 +77,7 @@ public class SpawnEgg1_9 {
|
||||||
ItemStack item = new ItemStack(Material.MONSTER_EGG, amount);
|
ItemStack item = new ItemStack(Material.MONSTER_EGG, amount);
|
||||||
net.minecraft.server.v1_9_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
|
net.minecraft.server.v1_9_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
|
||||||
NBTTagCompound tagCompound = stack.getTag();
|
NBTTagCompound tagCompound = stack.getTag();
|
||||||
if(tagCompound == null){
|
if (tagCompound == null) {
|
||||||
tagCompound = new NBTTagCompound();
|
tagCompound = new NBTTagCompound();
|
||||||
}
|
}
|
||||||
NBTTagCompound id = new NBTTagCompound();
|
NBTTagCompound id = new NBTTagCompound();
|
||||||
|
@ -99,7 +95,7 @@ public class SpawnEgg1_9 {
|
||||||
public static SpawnEgg1_9 fromItemStack(ItemStack item) {
|
public static SpawnEgg1_9 fromItemStack(ItemStack item) {
|
||||||
if (item == null)
|
if (item == null)
|
||||||
throw new IllegalArgumentException("item cannot be null");
|
throw new IllegalArgumentException("item cannot be null");
|
||||||
if (item.getType() != Material.MONSTER_EGG )
|
if (item.getType() != Material.MONSTER_EGG)
|
||||||
throw new IllegalArgumentException("item is not a monster egg");
|
throw new IllegalArgumentException("item is not a monster egg");
|
||||||
net.minecraft.server.v1_9_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
|
net.minecraft.server.v1_9_R1.ItemStack stack = CraftItemStack.asNMSCopy(item);
|
||||||
NBTTagCompound tagCompound = stack.getTag();
|
NBTTagCompound tagCompound = stack.getTag();
|
||||||
|
|
Loading…
Reference in a new issue