LinkedBeaconTeleporterItem generates own ItemStack

master
Ruakij 4 years ago
parent a296a190c6
commit 3d757a6ccf

@ -13,11 +13,11 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
// INFO: Safe to store as its always cloned by bukkit
ItemStack item;
public LinkedBeaconTeleporterItem(ItemStack item){
public LinkedBeaconTeleporterItem(){
// Create a new LinkedBeaconTeleporter
super();
this.item = item;
this.item = Main.lbtManager.getItemStackFromLbtItem(this);
}
public LinkedBeaconTeleporterItem(String teleporterId, ItemStack item) {
super(teleporterId);
@ -25,9 +25,9 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
this.item = item;
}
public LinkedBeaconTeleporterItem(String teleporterId){
this(teleporterId,
new ItemStack(Material.BEACON)
);
super(teleporterId);
this.item = Main.lbtManager.getItemStackFromLbtItem(this);
}
public ItemStack item(){
@ -36,9 +36,6 @@ public class LinkedBeaconTeleporterItem extends LinkedBeaconTeleporter {
// Conversion methods
public ItemStack toItemStack(){
return Main.lbtManager.getItemStackFromLbtItem(this);
}
public static LinkedBeaconTeleporterItem getFromItemStack(ItemStack itemStack){
return Main.lbtManager.getLbtItemFromItemStack(itemStack);
}

@ -23,13 +23,10 @@ public class OnPrepareItemCraftEvent {
if(lbtItem == null){
// If none is found, create new LinkedBeaconTeleporterItem and set as crafting-result
ItemStack item = new ItemStack(Material.BEACON);
lbtItem = new LinkedBeaconTeleporterItem(item);
lbtItem = new LinkedBeaconTeleporterItem();
}
// Generate ItemStack
ItemStack item = lbtItem.toItemStack();
ItemStack item = lbtItem.item();
// Exactly 2
item.setAmount(2);

Loading…
Cancel
Save