Search in sources :

Example 1 with DirectionalDataHandler

use of party.lemons.biomemakeover.util.DirectionalDataHandler in project Biome-Makeover by Lemonszz.

the class SimpleStructurePieceMixin method generate.

@Inject(method = "generate", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/structure/Structure;getInfosForBlock(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/structure/StructurePlacementData;Lnet/minecraft/block/Block;)Ljava/util/List;"))
public void generate(StructureWorldAccess world, StructureAccessor structureAccessor, ChunkGenerator chunkGenerator, Random random, BlockBox box, ChunkPos chunkPos, BlockPos blockPos, CallbackInfoReturnable<Boolean> cbi) {
    if (this instanceof DirectionalDataHandler) {
        List<Structure.StructureBlockInfo> list = this.structure.getInfosForBlock(this.pos, this.placementData, BMBlocks.DIRECTIONAL_DATA);
        for (Structure.StructureBlockInfo info : list) {
            if (info.tag != null) {
                String meta = info.tag.getString("metadata");
                Direction dir = info.state.get(FacingBlock.FACING);
                world.setBlockState(info.pos, Blocks.AIR.getDefaultState(), 3);
                ((DirectionalDataHandler) this).handleDirectionalMetadata(meta, dir, info.pos, world, random, box);
            }
        }
    }
}
Also used : DirectionalDataHandler(party.lemons.biomemakeover.util.DirectionalDataHandler) Structure(net.minecraft.structure.Structure) Direction(net.minecraft.util.math.Direction) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

Structure (net.minecraft.structure.Structure)1 Direction (net.minecraft.util.math.Direction)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 DirectionalDataHandler (party.lemons.biomemakeover.util.DirectionalDataHandler)1