Bug Fixes

# Conflicts:
#	src/main/java/com/songoda/ultimatetimber/treefall/NoAnimationTreeDestroyer.java
#	src/main/java/com/songoda/ultimatetimber/treefall/TreeFallEvent.java
#	src/main/java/com/songoda/ultimatetimber/treefall/TreeLoot.java
This commit is contained in:
Brian 2018-12-18 14:52:10 +02:00
parent 92d4899cd9
commit bab00aed4d

View File

@ -2,6 +2,7 @@ package com.songoda.ultimatetimber.treefall;
import com.songoda.ultimatetimber.utils.LeafToSaplingConverter;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
@ -60,9 +61,47 @@ public class TreeLoot {
}
if (itemStack.getType().equals(Material.LOG)){
if (fallingBlock.getBlockData() == 0 || fallingBlock.getBlockData() == 4 || fallingBlock.getBlockData() == 8)
itemStack = new ItemStack(Material.LOG, 1, (byte) 0);
if (fallingBlock.getBlockData() == 1 || fallingBlock.getBlockData() == 5 || fallingBlock.getBlockData() == 9)
itemStack = new ItemStack(Material.LOG, 1, (byte) 1);
if (fallingBlock.getBlockData() == 2 || fallingBlock.getBlockData() == 6 || fallingBlock.getBlockData() == 10)
itemStack = new ItemStack(Material.LOG, 1, (byte) 2);
if (fallingBlock.getBlockData() == 4 || fallingBlock.getBlockData() == 7 || fallingBlock.getBlockData() == 11)
itemStack = new ItemStack(Material.LOG, 1, (byte) 3);
}
if (itemStack.getType().equals(Material.LOG_2)){
if (fallingBlock.getBlockData() == 0 || fallingBlock.getBlockData() == 4 || fallingBlock.getBlockData() == 8)
itemStack = new ItemStack(Material.LOG_2, 1, (byte) 0);
if (fallingBlock.getBlockData() == 1 || fallingBlock.getBlockData() == 5 || fallingBlock.getBlockData() == 9)
itemStack = new ItemStack(Material.LOG_2, 1, (byte) 1);
}
if (hasBonusLoot)
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(material, 1));
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), new ItemStack(material, 1));
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), itemStack);
fallingBlock.getWorld().dropItem(fallingBlock.getLocation(), itemStack);
}
public static ItemStack convertBlock(Block block, boolean hasSilkTouch) {
ItemStack itemStack = new ItemStack(block.getType(), 1);
if (itemStack.getType().equals(Material.VINE)) return itemStack;
if (itemStack.getType().equals(Material.LEAVES) || itemStack.getType().equals(Material.LEAVES_2))
itemStack = LeafToSaplingConverter.convertLeaves(block, hasSilkTouch);
if (itemStack.getType().equals(Material.HUGE_MUSHROOM_2)) {
if(!hasSilkTouch) itemStack = new ItemStack(Material.RED_MUSHROOM, 1);
}
if (itemStack.getType().equals(Material.HUGE_MUSHROOM_1)) {
if(!hasSilkTouch) itemStack = new ItemStack(Material.BROWN_MUSHROOM, 1);
}
}