All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.level.format.updater.OldWoodBarkUpdater Maven / Gradle / Ivy

Go to download

A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.

There is a newer version: 1.6.0.1-PN
Show newest version
package cn.nukkit.level.format.updater;

import cn.nukkit.block.BlockID;
import cn.nukkit.blockstate.BlockState;
import cn.nukkit.level.format.ChunkSection;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
class OldWoodBarkUpdater implements Updater {
    private final ChunkSection section;
    private final int fromLog;
    private final int increment;

    @Override
    public boolean update(int offsetX, int offsetY, int offsetZ, int x, int y, int z, BlockState state) {
        if (state.getBlockId() != fromLog) {
            return false;
        }

        @SuppressWarnings("deprecation") 
        int legacyDamage = state.getLegacyDamage();
        if ((legacyDamage & 0b1100) != 0b1100) {
            return false;
        }
        
        section.setBlockState(x, y, z, BlockState.of(BlockID.WOOD, (legacyDamage & 0b11) + increment));
        return true;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy