Search in sources :

Example 1 with BlockWorkbench

use of net.minecraft.block.BlockWorkbench in project MC-Prefab by Brian-Wuest.

the class StructureAlternateStart method CustomBlockProcessingHandled.

@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos, EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player) {
    HouseConfiguration houseConfig = (HouseConfiguration) configuration;
    if ((!houseConfig.addBed && foundBlock instanceof BlockBed) || (!houseConfig.addChest && foundBlock instanceof BlockChest) || (!houseConfig.addTorches && foundBlock instanceof BlockTorch) || (!houseConfig.addCraftingTable && (foundBlock instanceof BlockWorkbench || foundBlock instanceof BlockFurnace))) {
        // "handled"
        return true;
    }
    if (foundBlock instanceof BlockFurnace) {
        this.furnacePosition = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
    } else if (foundBlock instanceof BlockTrapDoor && houseConfig.addMineShaft) {
        // The trap door will still be added, but the mine shaft may not be
        // built.
        this.trapDoorPosition = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
    } else if (foundBlock instanceof BlockChest && this.chestPosition == null) {
        this.chestPosition = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
    } else if (foundBlock instanceof BlockStandingSign) {
        this.signPosition = block.getStartingPosition().getRelativePosition(originalPos, this.getClearSpace().getShape().getDirection(), configuration.houseFacing);
    }
    if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain()) && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath())) {
        blockState = blockState.withProperty(BlockStainedGlass.COLOR, houseConfig.glassColor);
        block.setBlockState(blockState);
        this.priorityOneBlocks.add(block);
        return true;
    } else if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourceDomain()) && foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourcePath())) {
        block.setBlockState(foundBlock.getStateFromMeta(houseConfig.glassColor.getMetadata()));
        this.priorityOneBlocks.add(block);
        return true;
    }
    return false;
}
Also used : BlockFurnace(net.minecraft.block.BlockFurnace) BlockChest(net.minecraft.block.BlockChest) BlockWorkbench(net.minecraft.block.BlockWorkbench) BlockTrapDoor(net.minecraft.block.BlockTrapDoor) BlockStandingSign(net.minecraft.block.BlockStandingSign) BlockBed(net.minecraft.block.BlockBed) HouseConfiguration(com.wuest.prefab.Config.Structures.HouseConfiguration) BlockTorch(net.minecraft.block.BlockTorch)

Example 2 with BlockWorkbench

use of net.minecraft.block.BlockWorkbench in project Wurst-MC-1.12 by Wurst-Imperium.

the class AutoEatMod method shouldEat.

private boolean shouldEat() {
    // check hunger
    if (!WMinecraft.getPlayer().canEat(false))
        return false;
    // check screen
    if (!ignoreScreen.isChecked() && mc.currentScreen != null)
        return false;
    // check for clickable objects
    if (mc.currentScreen == null && mc.objectMouseOver != null) {
        // clickable entities
        Entity entity = mc.objectMouseOver.entityHit;
        if (entity instanceof EntityVillager || entity instanceof EntityTameable)
            return false;
        // clickable blocks
        BlockPos pos = mc.objectMouseOver.getBlockPos();
        if (pos != null) {
            Block block = WMinecraft.getWorld().getBlockState(pos).getBlock();
            if (block instanceof BlockContainer || block instanceof BlockWorkbench)
                return false;
        }
    }
    return true;
}
Also used : Entity(net.minecraft.entity.Entity) BlockContainer(net.minecraft.block.BlockContainer) BlockWorkbench(net.minecraft.block.BlockWorkbench) EntityVillager(net.minecraft.entity.passive.EntityVillager) Block(net.minecraft.block.Block) BlockPos(net.minecraft.util.math.BlockPos) EntityTameable(net.minecraft.entity.passive.EntityTameable)

Aggregations

BlockWorkbench (net.minecraft.block.BlockWorkbench)2 HouseConfiguration (com.wuest.prefab.Config.Structures.HouseConfiguration)1 Block (net.minecraft.block.Block)1 BlockBed (net.minecraft.block.BlockBed)1 BlockChest (net.minecraft.block.BlockChest)1 BlockContainer (net.minecraft.block.BlockContainer)1 BlockFurnace (net.minecraft.block.BlockFurnace)1 BlockStandingSign (net.minecraft.block.BlockStandingSign)1 BlockTorch (net.minecraft.block.BlockTorch)1 BlockTrapDoor (net.minecraft.block.BlockTrapDoor)1 Entity (net.minecraft.entity.Entity)1 EntityTameable (net.minecraft.entity.passive.EntityTameable)1 EntityVillager (net.minecraft.entity.passive.EntityVillager)1 BlockPos (net.minecraft.util.math.BlockPos)1