Search in sources :

Example 36 with Blueprint

use of com.ldtteam.structures.blueprints.v1.Blueprint in project minecolonies by ldtteam.

the class AbstractSchematicProvider method unsafeUpdateTEDataFromSchematic.

/**
 * Load the schematic data from the TE schematic name, if it's a reattempt, calculate the name from the building (backup).
 * Might throw exceptions if data is invalid.
 */
private void unsafeUpdateTEDataFromSchematic(final TileEntityColonyBuilding te) {
    final String structureName;
    if (te.getSchematicName().isEmpty()) {
        structureName = new StructureName(Structures.SCHEMATICS_PREFIX, style, this.getSchematicName() + Math.max(1, buildingLevel)).toString();
    } else {
        structureName = new StructureName(Structures.SCHEMATICS_PREFIX, style, te.getSchematicName()).toString();
    }
    final LoadOnlyStructureHandler structure = new LoadOnlyStructureHandler(colony.getWorld(), getPosition(), structureName, new PlacementSettings(), true);
    final Blueprint blueprint = structure.getBluePrint();
    blueprint.rotateWithMirror(BlockPosUtil.getRotationFromRotations(getRotation()), isMirrored() ? Mirror.FRONT_BACK : Mirror.NONE, colony.getWorld());
    final BlockInfo info = blueprint.getBlockInfoAsMap().getOrDefault(blueprint.getPrimaryBlockOffset(), null);
    if (info.getTileEntityData() != null) {
        te.readSchematicDataFromNBT(info.getTileEntityData());
    }
}
Also used : Blueprint(com.ldtteam.structures.blueprints.v1.Blueprint) BlockInfo(com.ldtteam.structurize.util.BlockInfo) StructureName(com.ldtteam.structurize.management.StructureName) LoadOnlyStructureHandler(com.minecolonies.api.util.LoadOnlyStructureHandler) PlacementSettings(com.ldtteam.structurize.util.PlacementSettings)

Example 37 with Blueprint

use of com.ldtteam.structures.blueprints.v1.Blueprint in project minecolonies by ldtteam.

the class AbstractEntityAIStructure method fillItemsList.

/**
 * Fill the list of the item positions to gather.
 */
@Override
public void fillItemsList() {
    worker.getCitizenStatusHandler().setLatestStatus(new TranslationTextComponent("com.minecolonies.coremod.status.gathering"));
    if (!structurePlacer.getB().hasBluePrint()) {
        return;
    }
    final Blueprint blueprint = structurePlacer.getB().getBluePrint();
    final BlockPos leftCorner = structurePlacer.getB().getWorldPos().subtract(blueprint.getPrimaryBlockOffset());
    searchForItems(new AxisAlignedBB(leftCorner, leftCorner.offset(blueprint.getSizeX(), blueprint.getSizeY(), blueprint.getSizeZ())));
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Blueprint(com.ldtteam.structures.blueprints.v1.Blueprint) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Blueprint (com.ldtteam.structures.blueprints.v1.Blueprint)37 BlockPos (net.minecraft.util.math.BlockPos)23 BlockState (net.minecraft.block.BlockState)13 StructureName (com.ldtteam.structurize.management.StructureName)8 PlacementSettings (com.ldtteam.structurize.util.PlacementSettings)8 LoadOnlyStructureHandler (com.minecolonies.api.util.LoadOnlyStructureHandler)8 PlayerEntity (net.minecraft.entity.player.PlayerEntity)6 TileEntity (net.minecraft.tileentity.TileEntity)6 Nullable (org.jetbrains.annotations.Nullable)6 BlockInfo (com.ldtteam.structurize.util.BlockInfo)5 NotNull (org.jetbrains.annotations.NotNull)5 IBlueprintDataProvider (com.ldtteam.structurize.blocks.interfaces.IBlueprintDataProvider)4 World (net.minecraft.world.World)4 Optional (java.util.Optional)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 SchematicRequestMessage (com.ldtteam.structurize.network.messages.SchematicRequestMessage)2 PlacementError (com.ldtteam.structurize.placement.handlers.placement.PlacementError)2 IStructureHandler (com.ldtteam.structurize.placement.structure.IStructureHandler)2 AbstractBlockHut (com.minecolonies.api.blocks.AbstractBlockHut)2 IColony (com.minecolonies.api.colony.IColony)2