Java Code Examples for net.minecraft.block.Block

The following are top voted examples for showing how to use net.minecraft.block.Block. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: connor41-etfuturum2   File: ChorusFlower.java   View source code 6 votes vote down vote up
public static boolean canPlantStay(World world, int x, int y, int z) {
	Block block = world.getBlock(x, y - 1, z);
	if (block != ModBlocks.chorus_plant && block != Blocks.end_stone) {
		if (block.isAir(world, x, y - 1, z)) {
			int adjecentCount = 0;
			for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
				Block adjecentBlock = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
				if (adjecentBlock == ModBlocks.chorus_plant)
					adjecentCount++;
				else if (!adjecentBlock.isAir(world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ))
					return false;
			}
			return adjecentCount == 1;
		} else
			return false;
	} else
		return true;
}
 
Example 2
Project: Technical   File: TileEntityMachine.java   View source code 6 votes vote down vote up
public static int getItemBurnTimeElectrical(ItemStack itemStack) {
	if(itemStack == null) {
		return 0;
	} else {
		Item item = itemStack.getItem();

		if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) {

			@SuppressWarnings("unused")
			Block block = Block.getBlockFromItem(item);

		}
		if(item == TechnicalItem.Battery1)
			return 2560;

		return 0;
	}
}
 
Example 3
Project: CustomWorldGen   File: EntityLivingBase.java   View source code 6 votes vote down vote up
/**
 * returns true if this entity is by a ladder, false otherwise
 */
public boolean isOnLadder()
{
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.getEntityBoundingBox().minY);
    int k = MathHelper.floor_double(this.posZ);

    if (this instanceof EntityPlayer && ((EntityPlayer)this).isSpectator())
    {
        return false;
    }
    else
    {
        BlockPos blockpos = new BlockPos(i, j, k);
        IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
        Block block = iblockstate.getBlock();
        return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, worldObj, new BlockPos(i, j, k), this);
    }
}
 
Example 4
Project: Backmemed   File: SVertexBuilder.java   View source code 6 votes vote down vote up
public static void pushEntity(IBlockState blockState, BlockPos blockPos, IBlockAccess blockAccess, VertexBuffer wrr)
{
    Block block = blockState.getBlock();
    int i;
    int j;

    if (blockState instanceof BlockStateBase)
    {
        BlockStateBase blockstatebase = (BlockStateBase)blockState;
        i = blockstatebase.getBlockId();
        j = blockstatebase.getMetadata();
    }
    else
    {
        i = Block.getIdFromBlock(block);
        j = block.getMetaFromState(blockState);
    }

    i = BlockAliases.getMappedBlockId(i, j);
    int i1 = block.getRenderType(blockState).ordinal();
    int k = ((i1 & 65535) << 16) + (i & 65535);
    int l = j & 65535;
    wrr.sVertexBuilder.pushEntity(((long)l << 32) + (long)k);
}
 
Example 5
Project: uniquecrops   File: ItemGeneric.java   View source code 6 votes vote down vote up
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	
	if (stack.getItemDamage() == EnumItems.TIMEMEAL.ordinal() && player.canPlayerEdit(pos, facing, stack)) {
		Block crops = world.getBlockState(pos).getBlock();
		if (crops != null && crops instanceof BlockCrops) {
			if (crops != UCBlocks.cropMerlinia)
				world.setBlockState(pos, ((BlockCrops)crops).withAge(0), 2);
			else if (crops == UCBlocks.cropMerlinia)
				((Merlinia)crops).merliniaGrowth(world, pos, world.rand.nextInt(1) + 1);
			else if (crops instanceof BlockNetherWart)
				((BlockNetherWart)crops).updateTick(world, pos, world.getBlockState(pos), world.rand);
			if (!player.capabilities.isCreativeMode && !player.worldObj.isRemote)
				stack.stackSize--;
			UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.VILLAGER_HAPPY, pos.getX() - 0.5D, pos.getY(), pos.getZ() - 0.5D, 6));
			return EnumActionResult.SUCCESS;
		}
	}
	return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
}
 
Example 6
Project: BaseClient   File: StatList.java   View source code 6 votes vote down vote up
/**
 * Merge {@link StatBase} object references for similar blocks
 */
private static void mergeStatBases(StatBase[] statBaseIn, Block p_151180_1_, Block p_151180_2_)
{
    int i = Block.getIdFromBlock(p_151180_1_);
    int j = Block.getIdFromBlock(p_151180_2_);

    if (statBaseIn[i] != null && statBaseIn[j] == null)
    {
        statBaseIn[j] = statBaseIn[i];
    }
    else
    {
        allStats.remove(statBaseIn[i]);
        objectMineStats.remove(statBaseIn[i]);
        generalStats.remove(statBaseIn[i]);
        statBaseIn[i] = statBaseIn[j];
    }
}
 
Example 7
Project: DecompiledMinecraft   File: EntityEnderman.java   View source code 6 votes vote down vote up
/**
 * (abstract) Protected helper method to read subclass entity data from NBT.
 */
public void readEntityFromNBT(NBTTagCompound tagCompund)
{
    super.readEntityFromNBT(tagCompund);
    IBlockState iblockstate;

    if (tagCompund.hasKey("carried", 8))
    {
        iblockstate = Block.getBlockFromName(tagCompund.getString("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535);
    }
    else
    {
        iblockstate = Block.getBlockById(tagCompund.getShort("carried")).getStateFromMeta(tagCompund.getShort("carriedData") & 65535);
    }

    this.setHeldBlockState(iblockstate);
}
 
Example 8
Project: Technical   File: BlockBaryteOre.java   View source code 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
	Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
	if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) {
		return true;
	}

	if (block == this) {
		return false;
	}
	return true;
}
 
Example 9
Project: customstuff4   File: StateMetaMapper.java   View source code 5 votes vote down vote up
@SuppressWarnings("unchecked")
static <T extends Block> StateMetaMapper<T> create(Collection<IProperty<?>> properties)
{
    if (properties.size() == 0)
        return new EmptyStateMetaMapper<>();
    else if (properties.size() == 1)
        return new SimpleStateMetaMapper(properties.iterator().next());
    else
        return new BitStateMetaMapper<>(properties);
}
 
Example 10
Project: CustomWorldGen   File: ExtendedBlockStorage.java   View source code 5 votes vote down vote up
public void set(int x, int y, int z, IBlockState state)
{
    if (state instanceof net.minecraftforge.common.property.IExtendedBlockState)
        state = ((net.minecraftforge.common.property.IExtendedBlockState) state).getClean();
    IBlockState iblockstate = this.get(x, y, z);
    Block block = iblockstate.getBlock();
    Block block1 = state.getBlock();

    if (block != Blocks.AIR)
    {
        --this.blockRefCount;

        if (block.getTickRandomly())
        {
            --this.tickRefCount;
        }
    }

    if (block1 != Blocks.AIR)
    {
        ++this.blockRefCount;

        if (block1.getTickRandomly())
        {
            ++this.tickRefCount;
        }
    }

    this.data.set(x, y, z, state);
}
 
Example 11
Project: DecompiledMinecraft   File: ItemSword.java   View source code 5 votes vote down vote up
/**
 * Called when a Block is destroyed using this Item. Return true to trigger the "Use Item" statistic.
 */
public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLivingBase playerIn)
{
    if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D)
    {
        stack.damageItem(2, playerIn);
    }

    return true;
}
 
Example 12
Project: Backmemed   File: World.java   View source code 5 votes vote down vote up
public void notifyNeighborsRespectDebug(BlockPos pos, Block blockType, boolean p_175722_3_)
{
    if (this.worldInfo.getTerrainType() != WorldType.DEBUG_WORLD)
    {
        this.notifyNeighborsOfStateChange(pos, blockType, p_175722_3_);
    }
}
 
Example 13
Project: Backmemed   File: ItemTool.java   View source code 5 votes vote down vote up
protected ItemTool(float attackDamageIn, float attackSpeedIn, Item.ToolMaterial materialIn, Set<Block> effectiveBlocksIn)
{
    this.efficiencyOnProperMaterial = 4.0F;
    this.toolMaterial = materialIn;
    this.effectiveBlocks = effectiveBlocksIn;
    this.maxStackSize = 1;
    this.setMaxDamage(materialIn.getMaxUses());
    this.efficiencyOnProperMaterial = materialIn.getEfficiencyOnProperMaterial();
    this.damageVsEntity = attackDamageIn + materialIn.getDamageVsEntity();
    this.attackSpeed = attackSpeedIn;
    this.setCreativeTab(CreativeTabs.TOOLS);
}
 
Example 14
Project: CustomWorldGen   File: NBTUtil.java   View source code 5 votes vote down vote up
/**
 * Writes the given blockstate to the given tag.
 *  
 * @param tag The tag to write to
 * @param state The blockstate to be written
 */
public static NBTTagCompound writeBlockState(NBTTagCompound tag, IBlockState state)
{
    tag.setString("Name", ((ResourceLocation)Block.REGISTRY.getNameForObject(state.getBlock())).toString());

    if (!state.getProperties().isEmpty())
    {
        NBTTagCompound nbttagcompound = new NBTTagCompound();

        for (Entry < IProperty<?>, Comparable<? >> entry : state.getProperties().entrySet())
        {
            IProperty<?> iproperty = (IProperty)entry.getKey();
            nbttagcompound.setString(iproperty.getName(), getName(iproperty, (Comparable)entry.getValue()));
        }

        tag.setTag("Properties", nbttagcompound);
    }

    return tag;
}
 
Example 15
Project: CustomWorldGen   File: TileEntity.java   View source code 5 votes vote down vote up
/**
 * Gets the block type at the location of this entity (client-only).
 */
public Block getBlockType()
{
    if (this.blockType == null && this.worldObj != null)
    {
        this.blockType = this.worldObj.getBlockState(this.pos).getBlock();
    }

    return this.blockType;
}
 
Example 16
Project: IceMod   File: IceLands.java   View source code 5 votes vote down vote up
public IceLands(int par1)
{
    super(par1);
    
    this.setBiomeName("Icelands");
    
    this.topBlock = (byte)IceMod.IcyOre.blockID;
    this.fillerBlock = (byte)Block.ice.blockID;
    
    this.theBiomeDecorator.bigMushroomsPerChunk = 10;
    this.theBiomeDecorator.treesPerChunk = 5;
    this.theBiomeDecorator.clayPerChunk  = 3;
    this.theBiomeDecorator.reedsPerChunk = 1;

    this.spawnableMonsterList.add(new SpawnListEntry(EntitySnowman.class, 25, 4, 8));
    this.spawnableCreatureList.add(new SpawnListEntry(EntityCow.class, 25, 4, 8));
    this.spawnableMonsterList.add(new SpawnListEntry(EntityDragon.class, 1, 1, 1));
    this.spawnableMonsterList.add(new SpawnListEntry(EntityIronGolem.class, 1, 1, 1));
    
    this.setMinMaxHeight(0.1F, 0.5F);
    //mnmx
    this.setTemperatureRainfall(0.7F, 0.2F);
   
}
 
Example 17
Project: UniversalRemote   File: UniversalRemoteConfiguration.java   View source code 5 votes vote down vote up
public static boolean isBlockBlacklisted(Block block)
{
	ResourceLocation loc = Block.REGISTRY.getNameForObject(block);
	String[] blackList = UniversalRemoteConfiguration.blacklist.blacklist.split(",");

	for (String entry : blackList)
	{
		String[] parts = entry.split(":");

		if (loc.toString().equals(entry))
		{
			return true;
		}

		// bad entry?
		if (parts.length != 2) continue;

		if (parts[1].equals("*") && loc.getResourceDomain().equals(parts[0]))
		{
			return true;
		}
	}

	return false;
}
 
Example 18
Project: CustomWorldGen   File: BlockColors.java   View source code 5 votes vote down vote up
public void registerBlockColorHandler(IBlockColor blockColor, Block... blocksIn)
{
    for (Block block : blocksIn)
    {
        if (block == null) throw new IllegalArgumentException("Block registered to block color handler cannot be null!");
        if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
        this.blockColorMap.put(block.delegate, blockColor);
    }
}
 
Example 19
Project: BaseClient   File: EntityAIOcelotSit.java   View source code 5 votes vote down vote up
/**
 * Return true to set given position as destination
 */
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
{
    if (!worldIn.isAirBlock(pos.up()))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);
        Block block = iblockstate.getBlock();

        if (block == Blocks.chest)
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityChest && ((TileEntityChest)tileentity).numPlayersUsing < 1)
            {
                return true;
            }
        }
        else
        {
            if (block == Blocks.lit_furnace)
            {
                return true;
            }

            if (block == Blocks.bed && iblockstate.getValue(BlockBed.PART) != BlockBed.EnumPartType.HEAD)
            {
                return true;
            }
        }

        return false;
    }
}
 
Example 20
Project: DecompiledMinecraft   File: EntityArmorStand.java   View source code 5 votes vote down vote up
private void dropContents()
{
    for (int i = 0; i < this.contents.length; ++i)
    {
        if (this.contents[i] != null && this.contents[i].stackSize > 0)
        {
            if (this.contents[i] != null)
            {
                Block.spawnAsEntity(this.worldObj, (new BlockPos(this)).up(), this.contents[i]);
            }

            this.contents[i] = null;
        }
    }
}
 
Example 21
Project: DecompiledMinecraft   File: TileEntityPiston.java   View source code 5 votes vote down vote up
public void writeToNBT(NBTTagCompound compound)
{
    super.writeToNBT(compound);
    compound.setInteger("blockId", Block.getIdFromBlock(this.pistonState.getBlock()));
    compound.setInteger("blockData", this.pistonState.getBlock().getMetaFromState(this.pistonState));
    compound.setInteger("facing", this.pistonFacing.getIndex());
    compound.setFloat("progress", this.lastProgress);
    compound.setBoolean("extending", this.extending);
}
 
Example 22
Project: ExPetrum   File: BlockCoralPlant.java   View source code 5 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
{
	super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
	this.onNeighborChange(worldIn, pos, fromPos);
}
 
Example 23
Project: BaseClient   File: ExtendedBlockStorage.java   View source code 5 votes vote down vote up
public void set(int x, int y, int z, IBlockState state)
{
    IBlockState iblockstate = this.get(x, y, z);
    Block block = iblockstate.getBlock();
    Block block1 = state.getBlock();

    if (block != Blocks.air)
    {
        --this.blockRefCount;

        if (block.getTickRandomly())
        {
            --this.tickRefCount;
        }
    }

    if (block1 != Blocks.air)
    {
        ++this.blockRefCount;

        if (block1.getTickRandomly())
        {
            ++this.tickRefCount;
        }
    }

    this.data[y << 8 | z << 4 | x] = (char)Block.BLOCK_STATE_IDS.get(state);
}
 
Example 24
Project: modName   File: ModRegistry.java   View source code 5 votes vote down vote up
@SubscribeEvent
public void onItemRegistry(RegistryEvent.Register<Item> e) 
{
	e.getRegistry().registerAll(Ref.ITEMS.toArray(new Item[0]));
	for (Block block : Ref.BLOCKS)
		e.getRegistry().register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
}
 
Example 25
Project: BaseClient   File: StructureVillagePieces.java   View source code 5 votes vote down vote up
protected void writeStructureToNBT(NBTTagCompound tagCompound)
{
    super.writeStructureToNBT(tagCompound);
    tagCompound.setInteger("CA", Block.blockRegistry.getIDForObject(this.cropTypeA));
    tagCompound.setInteger("CB", Block.blockRegistry.getIDForObject(this.cropTypeB));
    tagCompound.setInteger("CC", Block.blockRegistry.getIDForObject(this.cropTypeC));
    tagCompound.setInteger("CD", Block.blockRegistry.getIDForObject(this.cropTypeD));
}
 
Example 26
Project: AdvancedCombat   File: RegistryHelper.java   View source code 5 votes vote down vote up
/** Register the block correctly */
public static void registerBlock(IBlockAdvanced regBlock) {
	Block block = (Block)regBlock;
	ItemBlock item;
	
	// register the block by itself first
       BLOCKS_TO_REGISTER.add(block.setUnlocalizedName(block.getRegistryName().toString()));
       
	// try to get the ItemBlock
       if(regBlock.getItemClass() != null) {
        try {
			Class<?>[] ctorArgClasses = new Class[regBlock.getItemClassArgs().length + 1];
	        ctorArgClasses[0] = Block.class; // start with the block
	        for (int idx = 1; idx < ctorArgClasses.length; idx++) {
	            ctorArgClasses[idx] = regBlock.getItemClassArgs()[idx - 1].getClass();
	        }
	        Constructor<? extends ItemBlock> itemCtor = regBlock.getItemClass().getConstructor(ctorArgClasses);
	        item = itemCtor.newInstance(ObjectArrays.concat(regBlock, regBlock.getItemClassArgs()));
        } catch (Exception e) {
        	Log.logger.error("Unable to register block " + block.getRegistryName());
        	return;
        }
        
        // register the ItemBlock if there are no errors
        ITEMS_TO_REGISTER.add(item.setRegistryName(block.getRegistryName()));
       }
}
 
Example 27
Project: MeeCreeps   File: HarvestActionFactory.java   View source code 5 votes vote down vote up
@Override
public boolean isPossibleSecondary(World world, BlockPos pos, EnumFacing side) {
    if (!InventoryTools.isInventory(world, pos)) {
        return false;
    }

    // @todo config for harvest area
    AxisAlignedBB box = new AxisAlignedBB(pos.add(-10, -5, -10), pos.add(10, 5, 10));

    for (double x = box.minX ; x <= box.maxX ; x++) {
        for (double y = box.minY ; y <= box.maxY ; y++) {
            for (double z = box.minZ ; z <= box.maxZ ; z++) {
                BlockPos p = new BlockPos(x, y, z);
                IBlockState state = world.getBlockState(p);
                if (state.getBlock() == Blocks.FARMLAND) {
                    IBlockState cropState = world.getBlockState(p.up());
                    Block cropBlock = cropState.getBlock();
                    boolean hasCrops = cropBlock instanceof IPlantable && state.getBlock().canSustainPlant(world.getBlockState(p), world, p, EnumFacing.UP, (IPlantable) cropBlock);
                    if (hasCrops) {
                        return true;
                    }
                }
            }
        }
    }

    return false;
}
 
Example 28
Project: harshencastle   File: BasePontusResourceBiome.java   View source code 5 votes vote down vote up
public Block getMergerBlock(boolean isLevelDown)
{
	if(isLevelDown)
		return getMergerBlockDownLevel();
	else
		return getMergerBlockUpLevel();
}
 
Example 29
Project: ExSartagine   File: BlockSmelter.java   View source code 5 votes vote down vote up
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos) {
	Block blockDown = world.getBlockState(pos.down()).getBlock();
	if(blockDown == Blocks.LIT_FURNACE ||blockDown == Blocks.FURNACE || blockDown == ExSartagineBlock.range_extension){
				return true;
	}
	return false;
}
 
Example 30
Project: Adventurers-Toolbox   File: ItemATMace.java   View source code 5 votes vote down vote up
@Override
public float getDestroySpeed(ItemStack stack, IBlockState state) {
	Block block = state.getBlock();

	if (block == Blocks.WEB) {
		return 15.0F;
	} else {
		Material material = state.getMaterial();
		return material != Material.PLANTS && material != Material.VINE && material != Material.CORAL
				&& material != Material.LEAVES && material != Material.GOURD ? 1.0F : 1.5F;
	}
}
 
Example 31
Project: customstuff4   File: ItemSlab.java   View source code 5 votes vote down vote up
public ItemSlab(Block block, ContentBlockSlab content)
{
    super(block, content);
    singleSlab = block;
    singleSlabCS = (CSBlock) block;

    this.content = content;
}
 
Example 32
Project: minecraft-territorialdealings   File: ValueTable.java   View source code 5 votes vote down vote up
static int getValueFromBlock(Block block)
{
	if (block == null) { return 0; }

	if (block == Blocks.EMERALD_BLOCK) { return emeraldValue * 9; }
	else if (block == Blocks.DIAMOND_BLOCK) { return diamondValue * 9; }
	else if (block == Blocks.GOLD_BLOCK) { return goldValue * 9; }

	return 0;
}
 
Example 33
Project: Backmemed   File: Shaders.java   View source code 5 votes vote down vote up
public static void setBlockEntityId(TileEntity tileEntity)
{
    if (isRenderingWorld && !isShadowPass && uniformBlockEntityId.isDefined())
    {
        Block block = tileEntity.getBlockType();
        int i = Block.getIdFromBlock(block);
        uniformBlockEntityId.setValue(i);
    }
}
 
Example 34
Project: pnc-repressurized   File: DroneAIDig.java   View source code 5 votes vote down vote up
@Nonnull
private static ItemStack getSilkTouchBlock(Block block, IBlockState state) {
    Item item = Item.getItemFromBlock(block);
    if (item == Items.AIR) {
        return ItemStack.EMPTY;
    } else {
        return new ItemStack(item, 1, block.getMetaFromState(state));
    }
}
 
Example 35
Project: Bewitchment   File: FlawlessRecipe.java   View source code 5 votes vote down vote up
public FlawlessRecipe(ItemStack result, Object... inputs) {
	this.result = result;

	final List<Object> stackedList = Arrays.stream(inputs).map(obj -> {
		if (obj instanceof Item) return new ItemStack((Item) obj);
		else if (obj instanceof Block) return new ItemStack((Block) obj);
		else return obj;
	}).collect(Collectors.toList());

	neededItems = ImmutableList.copyOf(stackedList);
}
 
Example 36
Project: DecompiledMinecraft   File: BlockState.java   View source code 5 votes vote down vote up
public <T extends Comparable<T>, V extends T> IBlockState withProperty(IProperty<T> property, V value)
{
    if (!this.properties.containsKey(property))
    {
        throw new IllegalArgumentException("Cannot set property " + property + " as it does not exist in " + this.block.getBlockState());
    }
    else if (!property.getAllowedValues().contains(value))
    {
        throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on block " + Block.blockRegistry.getNameForObject(this.block) + ", it is not an allowed value");
    }
    else
    {
        return (IBlockState)(this.properties.get(property) == value ? this : (IBlockState)this.propertyValueTable.get(property, value));
    }
}
 
Example 37
Project: interactionwheel   File: DefaultWheelActionProvider.java   View source code 5 votes vote down vote up
@Override
    public void updateWheelActions(@Nonnull Set<String> actions, @Nonnull EntityPlayer player, World world, @Nullable BlockPos pos) {
        ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
        if (ItemStackTools.isValid(heldItem)) {
            actions.add(StandardWheelActions.ID_SEARCH);
        }
        if (pos != null) {
            actions.add(StandardWheelActions.ID_ROTATE);
            Block block = world.getBlockState(pos).getBlock();
            TileEntity te = world.getTileEntity(pos);
            if (te instanceof IInventory || (te != null && te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null))) {
                actions.add(StandardWheelActions.ID_DUMP);
                actions.add(StandardWheelActions.ID_EXTRACT);
                actions.add(StandardWheelActions.ID_DUMPORES);
                actions.add(StandardWheelActions.ID_DUMPBLOCKS);
                actions.add(StandardWheelActions.ID_DUMPSIMILARINV);
                if (ItemStackTools.isValid(heldItem)) {
                    actions.add(StandardWheelActions.ID_DUMP1);
                    actions.add(StandardWheelActions.ID_DUMPSIMILAR);
                }
            }
            actions.add(StandardWheelActions.ID_PICKTOOL);

            if (block instanceof IWheelBlockSupport) {
                ((IWheelBlockSupport) block).updateWheelActions(actions);
            }
        }
//        actions.add("std.dummy0");
//        actions.add("std.dummy1");
//        actions.add("std.dummy2");
//        actions.add("std.dummy3");
//        actions.add("std.dummy4");
//        actions.add("std.dummy5");
//        actions.add("std.dummy7");
//        actions.add("std.dummy8");
//        actions.add("std.dummy9");
//        actions.add("std.dummy10");
    }
 
Example 38
Project: Backmemed   File: CommandBase.java   View source code 5 votes vote down vote up
/**
 * Gets the Block specified by the given text string.  First checks the block registry, then tries by parsing the
 * string as an integer ID (deprecated).  Warns the sender if we matched by parsing the ID.  Throws if the block
 * wasn't found.  Returns the block if it was found.
 */
public static Block getBlockByText(ICommandSender sender, String id) throws NumberInvalidException
{
    ResourceLocation resourcelocation = new ResourceLocation(id);

    if (!Block.REGISTRY.containsKey(resourcelocation))
    {
        throw new NumberInvalidException("commands.give.block.notFound", new Object[] {resourcelocation});
    }
    else
    {
        return (Block)Block.REGISTRY.getObject(resourcelocation);
    }
}
 
Example 39
Project: DecompiledMinecraft   File: ItemSlab.java   View source code 5 votes vote down vote up
public ItemSlab(Block block, BlockSlab singleSlab, BlockSlab doubleSlab)
{
    super(block);
    this.singleSlab = singleSlab;
    this.doubleSlab = doubleSlab;
    this.setMaxDamage(0);
    this.setHasSubtypes(true);
}
 
Example 40
Project: DecompiledMinecraft   File: EntityFishHook.java   View source code 5 votes vote down vote up
/**
 * (abstract) Protected helper method to write subclass entity data to NBT.
 */
public void writeEntityToNBT(NBTTagCompound tagCompound)
{
    tagCompound.setShort("xTile", (short)this.xTile);
    tagCompound.setShort("yTile", (short)this.yTile);
    tagCompound.setShort("zTile", (short)this.zTile);
    ResourceLocation resourcelocation = (ResourceLocation)Block.blockRegistry.getNameForObject(this.inTile);
    tagCompound.setString("inTile", resourcelocation == null ? "" : resourcelocation.toString());
    tagCompound.setByte("shake", (byte)this.shake);
    tagCompound.setByte("inGround", (byte)(this.inGround ? 1 : 0));
}