mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Fixed Tree Feller dropping sideways log items
This commit is contained in:
		@@ -199,7 +199,7 @@ public abstract class TreeFeller {
 | 
			
		||||
                Misc.dropItem(block.getLocation(), new ItemStack(Material.LOG, 1, block.getData()));
 | 
			
		||||
                break;
 | 
			
		||||
            case LEAVES:
 | 
			
		||||
                Misc.randomDropItem(block.getLocation(), new ItemStack(Material.SAPLING, 1, (short) (block.getData() & 3)), 10);
 | 
			
		||||
                Misc.randomDropItem(block.getLocation(), new ItemStack(Material.SAPLING, 1, Woodcutting.extractLogItemData(block.getData())), 10);
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                if (ModChecks.isCustomLogBlock(block)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ public abstract class Woodcutting {
 | 
			
		||||
     * @throws IllegalArgumentException if 'log' is invalid
 | 
			
		||||
     */
 | 
			
		||||
    protected static int getExperienceFromLog(Block log) {
 | 
			
		||||
        TreeSpecies logType = TreeSpecies.getByData((byte) (log.getData() & 0x3));
 | 
			
		||||
        TreeSpecies logType = TreeSpecies.getByData(extractLogItemData(log.getData()));
 | 
			
		||||
 | 
			
		||||
        // Apparently species can be null in certain cases (custom server mods?)
 | 
			
		||||
        // https://github.com/mcMMO-Dev/mcMMO/issues/229
 | 
			
		||||
@@ -146,7 +146,7 @@ public abstract class Woodcutting {
 | 
			
		||||
            Location location = block.getLocation();
 | 
			
		||||
            ItemStack item = new ItemStack(Material.LOG, 1, blockData);
 | 
			
		||||
 | 
			
		||||
            switch (TreeSpecies.getByData((byte) (blockData & 0x3))) {
 | 
			
		||||
            switch (TreeSpecies.getByData(extractLogItemData(blockData))) {
 | 
			
		||||
            case GENERIC:
 | 
			
		||||
                if (Config.getInstance().getOakDoubleDropsEnabled()) {
 | 
			
		||||
                    Misc.dropItem(location, item);
 | 
			
		||||
@@ -172,4 +172,14 @@ public abstract class Woodcutting {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Extract the log type from the block data (remove rotation)
 | 
			
		||||
     *
 | 
			
		||||
     * @param data Original block data
 | 
			
		||||
     * @return Extracted log type
 | 
			
		||||
     */
 | 
			
		||||
    protected static byte extractLogItemData(byte data) {
 | 
			
		||||
        return (byte) (data & 0x3);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user