net.minecraft.util.EnumFacing Java Examples

The following examples show how to use net.minecraft.util.EnumFacing. 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: StructureTofuVillagePieces.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@SuppressWarnings("deprecation")
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) {
    if (this.averageGroundLvl < 0) {
        this.averageGroundLvl = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);

        if (this.averageGroundLvl < 0) {
            return true;
        }

        this.boundingBox.offset(0, this.averageGroundLvl - this.boundingBox.maxY + 5, 0);
    }

    IBlockState iblockstate = this.getBiomeSpecificBlockState(Blocks.SPRUCE_FENCE.getDefaultState());
    this.setBlockState(worldIn, iblockstate, 1, 0, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate, 1, 1, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, iblockstate, 1, 2, 0, structureBoundingBoxIn);
    this.setBlockState(worldIn, Blocks.WOOL.getStateFromMeta(EnumDyeColor.BLACK.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.EAST, 2, 3, 0, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.NORTH, 1, 3, 1, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.WEST, 0, 3, 0, structureBoundingBoxIn);
    this.placeTorch(worldIn, EnumFacing.SOUTH, 1, 3, -1, structureBoundingBoxIn);
    return true;
}
 
Example #2
Source File: HarvesterTileEntity.java    From EmergingTechnology with MIT License 6 votes vote down vote up
public boolean canHarvest(EnumFacing facing) {
    if (getTargetBlockState(facing) == null) {
    }

    if (!sufficientEnergy()) {
        return false;
    }

    if (outputsFull()) {
        return false;
    }

    if (HarvesterHelper.isInteractableCrop(getTargetBlockState(facing).getBlock())) {
        return HarvesterHelper.isInteractableCropReadyForHarvest(getTargetBlockState(facing), getWorld(),
                getTarget(facing));
    }

    return PlantHelper.isCropAtPositionReadyForHarvest(getWorld(), getTarget(facing));
}
 
Example #3
Source File: WorldGeneratorSignals.java    From Signals with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){
    // TODO when adding worldgen, resolve the note at https://github.com/MineMaarten/Signals/pull/80 regarding the possibility of rails not being included in the network.
    if(chunkX == 0) {
        int x = chunkX * 16 + 8;
        int y = 4;
        int startZ = chunkZ * 16;
        for(int z = startZ; z < startZ + 16; z++) {
            world.setBlockState(new BlockPos(x, y, z), Blocks.STONE.getDefaultState(), 0);
            world.setBlockState(new BlockPos(x, y + 1, z), Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, EnumRailDirection.NORTH_SOUTH), 0);
            if(z % 256 == 0) {
                world.setBlockState(new BlockPos(x + 1, y + 1, z), ModBlocks.BLOCK_SIGNAL.getDefaultState().withProperty(BlockSignalBase.FACING, EnumFacing.NORTH), 0);

            }
        }
    }
}
 
Example #4
Source File: BlockPackager.java    From CommunityMod with GNU Lesser General Public License v2.1 6 votes vote down vote up
public EnumFacing getFacingFromMeta(int meta) {
	if (meta == 0) {
		return EnumFacing.EAST;
	}
	if (meta == 1) {
		return EnumFacing.WEST;
	}
	if (meta == 2) {
		return EnumFacing.NORTH;
	}
	if (meta == 3) {
		return EnumFacing.SOUTH;
	}
	if (meta == 4) {
		return EnumFacing.UP;
	}
	if (meta == 5) {
		return EnumFacing.DOWN;
	}
	return EnumFacing.EAST;
}
 
Example #5
Source File: GTTileMagicEnergyAbsorber.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void checkForEndPortal() {
	if (world.getTotalWorldTime() % 100 == 0) {
		this.isAbovePortal = world.getBlockState(this.pos.offset(EnumFacing.DOWN)).getBlock() == Blocks.END_PORTAL;
		this.updateGui();
		if (this.portalMode && this.isAbovePortal) {
			if (world.rand.nextInt(512) == 0 && GTUtility.tryResetStrongholdPortal(world, pos)) {
				this.isAbovePortal = false;
				this.updateGui();
				return;
			}
			if (GTConfig.general.oneMagicAbsorberPerEndPortal
					&& GTUtility.tryExplodeOtherAbsorbers(this.world, this.pos)) {
				// TODO something here
			}
		}
	}
}
 
Example #6
Source File: EvalModelTest.java    From OpenModsLib with MIT License 6 votes vote down vote up
@Test
public void testArithmeticsVarApply() {
	EvaluatorFactory factory = new EvaluatorFactory();
	factory.appendStatement("clip(2.4 / a + 1/(3 * b))");

	final ClipStub clipStub = new ClipStub();
	final IJointClip jointClipMock = clipStub.jointClipMock;

	final TRSRTransformation transform = TRSRTransformation.from(EnumFacing.NORTH);
	Mockito.when(jointClipMock.apply(Matchers.anyFloat())).thenReturn(transform);

	final TRSRTransformation result = factory.createEvaluator(clips("clip", clipStub))
			.evaluate(DUMMY_JOINT, ImmutableMap.of("a", 5.1f, "b", -0.4f));
	Assert.assertEquals(transform, result);

	Mockito.verify(jointClipMock).apply(2.4f / 5.1f + 1f / (3f * -0.4f));
	Mockito.verifyNoMoreInteractions(jointClipMock);
}
 
Example #7
Source File: BlockTorchUnlit.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public boolean onBlockActivated(World world, BlockPos pos,
		IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY,
		float hitZ) {

	if(player.getHeldItem(EnumHand.MAIN_HAND) != null) {
		Item item = player.getHeldItem(EnumHand.MAIN_HAND).getItem();
		if(!world.isRemote && item != null && AtmosphereHandler.getOxygenHandler(world.provider.getDimension()).getAtmosphereType(pos).allowsCombustion() && (item == Item.getItemFromBlock(Blocks.TORCH) || 
				item == Items.FLINT_AND_STEEL || 
				item == Items.FIRE_CHARGE)) {

			world.setBlockState(pos, Blocks.TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)));

			return true;
		}
	}

	return true;
}
 
Example #8
Source File: BlockTFBattery.java    From TofuCraftReload with MIT License 6 votes vote down vote up
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (!worldIn.isRemote) {
        ItemStack stack = playerIn.getHeldItem(hand);
        TileEntity tileentity = worldIn.getTileEntity(pos);
        if (tileentity instanceof TileEntityTofuBattery) {
            IFluidHandlerItem handler = FluidUtil.getFluidHandler(ItemHandlerHelper.copyStackWithSize(stack, 1));
            if (handler != null) {
                FluidUtil.interactWithFluidHandler(playerIn, hand, tileentity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing));
                return true;
            } else {
                playerIn.openGui(TofuMain.instance, TofuGuiHandler.ID_BATTERY_GUI, worldIn, pos.getX(), pos.getY(), pos.getZ());
            }
        }
    }
    return true;
}
 
Example #9
Source File: NetworkSimplifier.java    From Logistics-Pipes-2 with MIT License 6 votes vote down vote up
private WeightedNetworkNode createWeightedNode(NetworkNode node, Map<UUID, WeightedNetworkNode> results, Map<UUID, Tuple<NetworkNode, EnumFacing>> destinations) {
	if (results.containsKey(node.getId()))
		return results.get(node.getId());

	WeightedNetworkNode current = new WeightedNetworkNode(node.getId(), node.getMember());
	for (int i = 0; i < 6; i++)	{
		current.addNeighbor(node.getNeighborAt(i), i);
	}

	//current.getMember().spawnParticle(1.0f, 1.0f, 0.0f);
	results.put(current.getId(), current);
	for (int i = 0; i < 6; i++) {
		Tuple<NetworkNode, Integer> neighbor = getNextNeighborAt(node, i, 0, destinations);
		if (neighbor == null) {
			continue;
		}
		current.weightedNeighbors[i] = new Tuple<WeightedNetworkNode, Integer>(createWeightedNode(neighbor.getKey(), results, destinations), neighbor.getVal());
	}

	return current;
}
 
Example #10
Source File: BlockManipulator.java    From OpenModsLib with MIT License 6 votes vote down vote up
public boolean place(IBlockState state, EnumFacing direction, EnumHand hand) {
	if (!world.isBlockLoaded(blockPos)) return false;

	if (spawnProtection) {
		if (!world.isBlockModifiable(player, blockPos)) return false;
	}

	final BlockSnapshot snapshot = BlockSnapshot.getBlockSnapshot(world, blockPos);

	if (!world.setBlockState(blockPos, state, blockPlaceFlags)) return false;

	if (ForgeEventFactory.onPlayerBlockPlace(player, snapshot, direction, hand).isCanceled()) {
		world.restoringBlockSnapshots = true;
		snapshot.restore(true, false);
		world.restoringBlockSnapshots = false;
		return false;
	}

	return true;
}
 
Example #11
Source File: InvPipeRenderer.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void handleRenderBlockDamage(IBlockAccess world, BlockPos pos, IBlockState state, TextureAtlasSprite sprite, BufferBuilder buffer) {
    CCRenderState renderState = CCRenderState.instance();
    renderState.reset();
    renderState.bind(buffer);
    renderState.setPipeline(new Vector3(new Vec3d(pos)).translation(), new IconTransformation(sprite));
    BlockInventoryPipe block = (BlockInventoryPipe) state.getBlock();
    TileEntityInventoryPipe tileEntity = (TileEntityInventoryPipe) block.getPipeTileEntity(world, pos);
    if (tileEntity == null) {
        return;
    }
    InventoryPipeType pipeType = tileEntity.getPipeType();
    if (pipeType == null) {
        return;
    }
    float thickness = pipeType.getThickness();
    int connectedSidesMask = block.getActualConnections(tileEntity, world);
    Cuboid6 baseBox = BlockPipe.getSideBox(null, thickness);
    BlockRenderer.renderCuboid(renderState, baseBox, 0);
    for (EnumFacing renderSide : EnumFacing.VALUES) {
        if ((connectedSidesMask & (1 << renderSide.getIndex())) > 0) {
            Cuboid6 sideBox = BlockPipe.getSideBox(renderSide, thickness);
            BlockRenderer.renderCuboid(renderState, sideBox, 0);
        }
    }
}
 
Example #12
Source File: BlockBarrelDistillation.java    From Sakura_mod with MIT License 5 votes vote down vote up
/**
 * Convert the given metadata into a BlockState for this Block
 */
public IBlockState getStateFromMeta(int meta)
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);
	
    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }
	
    return this.getDefaultState().withProperty(FACING, enumfacing);
}
 
Example #13
Source File: BlockTaiko.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	if(RecipesUtil.containsMatch(false, OreDictionary.getOres("stickWood"), playerIn.getHeldItem(hand))){
		worldIn.playSound(playerIn, pos, CommonProxy.TAIKO, SoundCategory.BLOCKS, 1.2F, 1.2F);
		playerIn.swingArm(hand);
		}
	return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
}
 
Example #14
Source File: BaseMethods.java    From pycode-minecraft with MIT License 5 votes vote down vote up
protected void put(BlockPos pos, IBlockState block_state, EnumFacing facing) {
    // don't run on client
    if (this.world == null || this.world.isRemote) return;

    Block block = block_state.getBlock();

    FMLLog.info("Putting %s at %s", block_state, pos);

    // handle special cases
    if (block instanceof BlockDoor) {
        ItemDoor.placeDoor(this.world, pos, facing, block, true);
    } else if (block instanceof BlockBed) {
        BlockPos headpos = pos.offset(facing);
        if (this.world.getBlockState(pos.down()).isSideSolid(this.world, pos.down(), EnumFacing.UP) &&
                this.world.getBlockState(headpos.down()).isSideSolid(this.world, headpos.down(), EnumFacing.UP)) {
            block_state = block_state
                    .withProperty(BlockBed.OCCUPIED, false).withProperty(BlockBed.FACING, facing)
                    .withProperty(BlockBed.PART, BlockBed.EnumPartType.FOOT);
            if (this.world.setBlockState(pos, block_state, 11)) {
                block_state = block_state.withProperty(BlockBed.PART, BlockBed.EnumPartType.HEAD);
                this.world.setBlockState(headpos, block_state, 11);
            }
        }
    } else {
        this.world.setBlockState(pos, block_state);
    }
}
 
Example #15
Source File: BlockFluidKineticGenerator.java    From Production-Line with MIT License 5 votes vote down vote up
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
    if (!world.isRemote) {
        player.openGui(ProductionLine.getInstance(), GuiHandler.EnumGui.FluidKineticGenerator.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
    }
    return true;
}
 
Example #16
Source File: ScaffolderTileEntity.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
    if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
        return true;
    if (capability == CapabilityEnergy.ENERGY)
        return true;

    return super.hasCapability(capability, facing);
}
 
Example #17
Source File: LargeTurbineRenderer.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderSided(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline, EnumFacing side, boolean hasBase, boolean hasRotor, boolean isActive, int rotorRGB) {
    Matrix4 cornerOffset = null;
    switch (side.getAxis()) {
        case X:
            cornerOffset = translation.copy().translate(0.01 * side.getFrontOffsetX(), -1.0, -1.0);
            cornerOffset.scale(1.0, 3.0, 3.0);
            break;
        case Z:
            cornerOffset = translation.copy().translate(-1.0, -1.0, 0.01 * side.getFrontOffsetZ());
            cornerOffset.scale(3.0, 3.0, 1.0);
            break;
        case Y:
            cornerOffset = translation.copy().translate(-1.0, 0.01 * side.getFrontOffsetY(), -1.0);
            cornerOffset.scale(3.0, 1.0, 3.0);
            break;
    }
    if (hasBase) {
        Textures.renderFace(renderState, cornerOffset, pipeline, side, Cuboid6.full, baseRingSprite);
        renderState.brightness = 0xF000F0;
        renderState.colour = 0xFFFFFFFF;
        Textures.renderFace(renderState, cornerOffset, new IVertexOperation[0], side, Cuboid6.full, baseBackgroundSprite);
    }
    if (hasRotor) {
        TextureAtlasSprite sprite = isActive ? activeBladeSprite : idleBladeSprite;
        IVertexOperation[] color = ArrayUtils.add(pipeline, new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(rotorRGB)));
        Textures.renderFace(renderState, cornerOffset, color, side, Cuboid6.full, sprite);
    }
}
 
Example #18
Source File: BlockRotationModeTest.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Test
public void testTopEqualsUpForAllHorizontals() {
	for (EnumFacing facing : EnumFacing.HORIZONTALS) {
		final Orientation orientation = mode.getOrientationFacing(facing);
		Assert.assertNotNull(facing.toString(), orientation);
		Assert.assertEquals(facing.toString(), EnumFacing.UP, mode.getTop(orientation));
	}
}
 
Example #19
Source File: EasyPlaceUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static EnumFacing applyPlacementFacing(IBlockState stateSchematic, EnumFacing side, IBlockState stateClient)
{
    PropertyDirection prop = BlockUtils.getFirstDirectionProperty(stateSchematic);

    if (prop != null)
    {
        side = stateSchematic.getValue(prop).getOpposite();
    }

    return side;
}
 
Example #20
Source File: ItemBuildersWand.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void moveEndPosition(ItemStack stack, EntityPlayer player, boolean reverse)
{
    EnumFacing direction = EntityUtils.getClosestLookingDirection(player);
    Mode mode = Mode.getMode(stack);
    BlockPosEU posStart = mode == Mode.CUBE || mode == Mode.WALLS ?
            this.getPosition(stack, mode, POS_START) : this.getPerTemplateAreaCorner(stack, mode, POS_START);
    BlockPosEU posEnd = this.getPosition(stack, mode, POS_END);

    if (posEnd == null)
    {
        posEnd = posStart;
    }

    if (posStart != null && posEnd != null)
    {
        int v = reverse ? 1 : -1;
        posEnd = posEnd.add(direction.getXOffset() * v, direction.getYOffset() * v, direction.getZOffset() * v);

        if (mode == Mode.WALLS || mode == Mode.CUBE)
        {
            this.setPosition(posEnd, false, stack, player);
        }
        else
        {
            this.setPerTemplateAreaCorner(posEnd, mode, false, stack, player);
            this.setAreaFacing(stack, mode, PositionUtils.getFacingFromPositions(posStart, posEnd));
            this.setMirror(stack, mode, Mirror.NONE);
        }
    }
}
 
Example #21
Source File: TileEntityModuleInventory.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing)
{
    if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY &&
        (facing == null || ArrayUtils.contains(supplier.sides, facing)))
    {
        return (T) invHandler;
    }

    return null;
}
 
Example #22
Source File: LPRoutedFluid.java    From Logistics-Pipes-2 with MIT License 5 votes vote down vote up
public LPRoutedFluid(double x, double y, double z, FluidStack content, EnumFacing initVector, TileGenericPipe holder, Deque<EnumFacing> routingInfo, TileGenericPipe destination) {
	setHeading(initVector);
	setHolding(holder);
	route = routingInfo;
	ticks = 0;
	this.stack = content.copy();
	this.position=new Triple<Double, Double, Double>(x, y, z);
	ID=UUID.randomUUID();
	this.destination = destination;
}
 
Example #23
Source File: TidalGeneratorTileEntity.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
    if (capability == CapabilityEnergy.ENERGY)
        return CapabilityEnergy.ENERGY.cast(this.generatorEnergyHandler);
    if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
        return CapabilityAnimation.ANIMATION_CAPABILITY.cast(getAnimator());
    return super.getCapability(capability, facing);
}
 
Example #24
Source File: GTModelMortar.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected BlockPartFace createWallFaceNS(EnumFacing side) {
	if (side == EnumFacing.UP || side == EnumFacing.DOWN) {
		return new BlockPartFace((EnumFacing) null, -1, "", new BlockFaceUV(new float[] { 0.0F, 0.0F, 12.0F,
				2.0F }, 0));
	}
	if (side == EnumFacing.NORTH || side == EnumFacing.SOUTH) {
		return new BlockPartFace((EnumFacing) null, -1, "", new BlockFaceUV(new float[] { 0.0F, 0.0F, 10.0F,
				5.0F }, 0));
	}
	return new BlockPartFace((EnumFacing) null, -1, "", new BlockFaceUV(new float[] { 0.0F, 0.0F, 2.0F, 5.0F }, 0));
}
 
Example #25
Source File: StructureTofuMineshaftPieces.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public static StructureBoundingBox findCrossing(List<StructureComponent> listIn, Random rand, int x, int y, int z, EnumFacing facing) {
    StructureBoundingBox structureboundingbox = new StructureBoundingBox(x, y, z, x, y + 2, z);

    if (rand.nextInt(4) == 0) {
        structureboundingbox.maxY += 4;
    }

    switch (facing) {
        case NORTH:
        default:
            structureboundingbox.minX = x - 1;
            structureboundingbox.maxX = x + 3;
            structureboundingbox.minZ = z - 4;
            break;
        case SOUTH:
            structureboundingbox.minX = x - 1;
            structureboundingbox.maxX = x + 3;
            structureboundingbox.maxZ = z + 3 + 1;
            break;
        case WEST:
            structureboundingbox.minX = x - 4;
            structureboundingbox.minZ = z - 1;
            structureboundingbox.maxZ = z + 3;
            break;
        case EAST:
            structureboundingbox.maxX = x + 3 + 1;
            structureboundingbox.minZ = z - 1;
            structureboundingbox.maxZ = z + 3;
    }

    return StructureComponent.findIntersecting(listIn, structureboundingbox) != null ? null : structureboundingbox;
}
 
Example #26
Source File: WindTileEntity.java    From EmergingTechnology with MIT License 5 votes vote down vote up
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
    if (capability == CapabilityEnergy.ENERGY)
        return true;
    if (capability == CapabilityAnimation.ANIMATION_CAPABILITY)
        return true;

    return super.hasCapability(capability, facing);
}
 
Example #27
Source File: ItemLocationBound.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setTarget(ItemStack stack, EntityPlayer player, boolean storeRotation)
{
    BlockPos pos = player.getPosition();
    double hitX = player.posX - pos.getX();
    double hitY = player.posY - pos.getY();
    double hitZ = player.posZ - pos.getZ();
    //System.out.printf("x: %d y: %d z: %d hit: %.3f %.3f %.3f\n", x, y, z, hitX, hitY, hitZ);
    boolean adjustPosHit = stack.getItem() == EnderUtilitiesItems.LINK_CRYSTAL &&
            ((ItemLinkCrystal) stack.getItem()).getModuleTier(stack) == ItemLinkCrystal.TYPE_LOCATION;

    this.setTarget(stack, player, pos, EnumFacing.UP, hitX, hitY, hitZ, adjustPosHit, storeRotation);
}
 
Example #28
Source File: DijkstraRouter.java    From Logistics-Pipes-2 with MIT License 5 votes vote down vote up
private void pushToRouteUntillParent(NetworkNode current, ArrayDeque<Tuple<UUID, EnumFacing>> route) throws InterruptedException {
	NetworkNode parent = current.parent.getKey();
	EnumFacing direction = current.parent.getVal();
	int parentDirection = direction.getOpposite().getIndex();

	NetworkNode help = current;
	while(help.getId() != parent.getId()) {
		help = help.getNeighborAt(parentDirection);
		route.push(new Tuple<UUID, EnumFacing>(help.getId(), direction));
		//help.getMember().spawnParticle(1.0f, 0.549f, 0.0f);
		Thread.sleep(120);
	}
}
 
Example #29
Source File: EasyPlaceUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static boolean canClickOnAdjacentBlockToPlaceSingleSlabAt(BlockPos targetBlockPos, IBlockState targetState, EnumFacing side, World worldClient)
{
    BlockPos posSide = targetBlockPos.offset(side);
    IBlockState stateSide = worldClient.getBlockState(posSide);

    return PlacementUtils.isReplaceable(worldClient, posSide, false) == false &&
           (side.getAxis() != EnumFacing.Axis.Y ||
            clientBlockIsSameMaterialSingleSlab(targetState, stateSide) == false
            || stateSide.getValue(BlockSlab.HALF) != targetState.getValue(BlockSlab.HALF));
}
 
Example #30
Source File: BlockWorldState.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
public IBlockState getOffsetState(EnumFacing face) {
    if (pos instanceof MutableBlockPos) {
        ((MutableBlockPos) pos).move(face);
        IBlockState blockState = world.getBlockState(pos);
        ((MutableBlockPos) pos).move(face.getOpposite());
        return blockState;
    }
    return world.getBlockState(this.pos.offset(face));
}