Java Code Examples for net.minecraft.world.gen.structure.template.PlacementSettings#setIgnoreEntities()

The following examples show how to use net.minecraft.world.gen.structure.template.PlacementSettings#setIgnoreEntities() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemBuildersWand.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
private PlacementSettings getPasteModePlacement(ItemStack stack, EntityPlayer player)
{
    EnumFacing facing = this.getTemplateFacing(stack);
    EnumFacing areaFacing = this.getAreaFacing(stack, Mode.PASTE);

    if (areaFacing == null)
    {
        areaFacing = facing;
    }

    Rotation rotation = PositionUtils.getRotation(facing, areaFacing);
    PlacementSettings placement = new PlacementSettings();
    boolean ignoreEntities = player.capabilities.isCreativeMode == false ||
            WandOption.AFFECT_ENTITIES.isEnabled(stack, Mode.PASTE) == false;
    placement.setMirror(this.getMirror(stack));
    placement.setRotation(rotation);
    placement.setIgnoreEntities(ignoreEntities);

    return placement;
}
 
Example 2
Source File: SchematicPlacement.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public PlacementSettings getPlacementSettings()
{
    PlacementSettings placement = new PlacementSettings();

    placement.setMirror(this.mirror);
    placement.setRotation(this.rotation);
    placement.setIgnoreEntities(this.ignoreEntities);
    placement.setReplacedBlock(Blocks.STRUCTURE_VOID);

    return placement;
}
 
Example 3
Source File: ItemBuildersWand.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void moveAreaImmediate(ItemStack stack, World world, EntityPlayer player, BlockPos posSrc1, BlockPos posSrc2, BlockPos posDst1,
        Mirror mirror, Rotation rotation)
{
    PlacementSettings placement = new PlacementSettings();
    placement.setMirror(mirror);
    placement.setRotation(rotation);
    placement.setIgnoreEntities(false);
    placement.setReplacedBlock(Blocks.BARRIER); // meh

    ReplaceMode replace = WandOption.REPLACE_EXISTING.isEnabled(stack, Mode.MOVE_DST) ? ReplaceMode.EVERYTHING : ReplaceMode.NOTHING;
    TemplateEnderUtilities template = new TemplateEnderUtilities(placement, replace);
    template.takeBlocksFromWorld(world, posSrc1, posSrc2.subtract(posSrc1), true, false);
    this.deleteArea(stack, world, player, posSrc1, posSrc2, true);
    template.addBlocksToWorld(world, posDst1);
}
 
Example 4
Source File: ItemBuildersWand.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
private EnumActionResult stackArea(ItemStack stack, World world, EntityPlayer player, BlockPosEU pos1EU, BlockPosEU pos2EU)
{
    if (player.capabilities.isCreativeMode == false && Configs.buildersWandEnableStackMode == false)
    {
        player.sendStatusMessage(new TextComponentTranslation("enderutilities.chat.message.featuredisabledinsurvivalmode"), true);
        return EnumActionResult.FAIL;
    }

    if (pos1EU == null || pos2EU == null)
    {
        return EnumActionResult.FAIL;
    }

    int dim = world.provider.getDimension();
    BlockPos pos1 = pos1EU.toBlockPos();
    BlockPos pos2 = pos2EU.toBlockPos();
    BlockPos endPosRelative = pos2.subtract(pos1);
    Area3D area = Area3D.getAreaFromNBT(this.getAreaTag(stack));

    if (pos1EU.getDimension() != dim || pos2EU.getDimension() != dim ||
        this.isStackedAreaWithinLimits(pos1, pos2, endPosRelative, area, player) == false)
    {
        player.sendStatusMessage(new TextComponentTranslation("enderutilities.chat.message.areatoolargeortoofar"), true);
        return EnumActionResult.FAIL;
    }

    boolean takeEntities = player.capabilities.isCreativeMode && WandOption.AFFECT_ENTITIES.isEnabled(stack);
    PlacementSettings placement = new PlacementSettings();
    placement.setIgnoreEntities(takeEntities == false);
    ReplaceMode replaceMode = WandOption.REPLACE_EXISTING.isEnabled(stack, Mode.STACK) ? ReplaceMode.WITH_NON_AIR : ReplaceMode.NOTHING;
    TemplateEnderUtilities template = new TemplateEnderUtilities(placement, replaceMode);
    template.takeBlocksFromWorld(world, pos1, pos2.subtract(pos1), takeEntities, false);

    if (player.capabilities.isCreativeMode)
    {
        this.stackAreaImmediate(world, pos1, endPosRelative, area, template);
    }
    else
    {
        UUID wandUUID = NBTUtils.getUUIDFromItemStack(stack, WRAPPER_TAG_NAME, true);
        TaskStackArea task = new TaskStackArea(world, wandUUID, pos1, endPosRelative, template, area, Configs.buildersWandBlocksPerTick);
        PlayerTaskScheduler.getInstance().addTask(player, task, 1);
    }

    return EnumActionResult.SUCCESS;
}