Java Code Examples for net.minecraft.init.Blocks.BARRIER

The following are Jave code examples for showing how to use BARRIER of the net.minecraft.init.Blocks class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: GardenStuff   File: BlockFence.java   View Source Code Vote up 6 votes
public boolean canConnectTo (IBlockAccess world, BlockPos pos) {
    IBlockState state = world.getBlockState(pos);
    Block block = state.getBlock();

    if (block instanceof BlockFence)
        return true;
    if (block == Blocks.BARRIER)
        return false;

    Material material = block.getMaterial(state);
    if (!material.isOpaque())
        return false;
    if (!state.isFullCube())
        return false;

    return material != Material.GOURD;
}
 
Example 2
Project: Backmemed   File: WorldClient.java   View Source Code Vote up 6 votes
public void doVoidFogParticles(int posX, int posY, int posZ)
{
    int i = 32;
    Random random = new Random();
    ItemStack itemstack = this.mc.player.getHeldItemMainhand();

    if (itemstack == null || Block.getBlockFromItem(itemstack.getItem()) != Blocks.BARRIER)
    {
        itemstack = this.mc.player.getHeldItemOffhand();
    }

    boolean flag = this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && !itemstack.func_190926_b() && itemstack.getItem() == Item.getItemFromBlock(Blocks.BARRIER);
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int j = 0; j < 667; ++j)
    {
        this.showBarrierParticles(posX, posY, posZ, 16, random, flag, blockpos$mutableblockpos);
        this.showBarrierParticles(posX, posY, posZ, 32, random, flag, blockpos$mutableblockpos);
    }
}
 
Example 3
Project: Industrial-Foregoing   File: GUIBookMain.java   View Source Code Vote up 5 votes
public static ItemStack getCategoryItemStack(BookCategory category) {
    if (category.getEntries().isEmpty()) return new ItemStack(Blocks.BARRIER);
    if (!category.getDisplay().isEmpty()) category.getDisplay();
    for (CategoryEntry entry : category.getEntries().values()) {
        if (!entry.getDisplay().isEmpty()) return entry.getDisplay();
    }
    return new ItemStack(Blocks.BARRIER);
}
 
Example 4
Project: Backmemed   File: WorldEntitySpawner.java   View Source Code Vote up 5 votes
public static boolean canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType spawnPlacementTypeIn, World worldIn, BlockPos pos)
{
    if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (spawnPlacementTypeIn == EntityLiving.SpawnPlacementType.IN_WATER)
        {
            return iblockstate.getMaterial() == Material.WATER && worldIn.getBlockState(pos.down()).getMaterial() == Material.WATER && !worldIn.getBlockState(pos.up()).isNormalCube();
        }
        else
        {
            BlockPos blockpos = pos.down();

            if (!worldIn.getBlockState(blockpos).isFullyOpaque())
            {
                return false;
            }
            else
            {
                Block block = worldIn.getBlockState(blockpos).getBlock();
                boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER;
                return flag && isValidEmptySpawnBlock(iblockstate) && isValidEmptySpawnBlock(worldIn.getBlockState(pos.up()));
            }
        }
    }
}
 
Example 5
Project: Backmemed   File: WorldClient.java   View Source Code Vote up 5 votes
public void showBarrierParticles(int p_184153_1_, int p_184153_2_, int p_184153_3_, int p_184153_4_, Random random, boolean p_184153_6_, BlockPos.MutableBlockPos pos)
{
    int i = p_184153_1_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    int j = p_184153_2_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    int k = p_184153_3_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    pos.setPos(i, j, k);
    IBlockState iblockstate = this.getBlockState(pos);
    iblockstate.getBlock().randomDisplayTick(iblockstate, this, pos, random);

    if (p_184153_6_ && iblockstate.getBlock() == Blocks.BARRIER)
    {
        this.spawnParticle(EnumParticleTypes.BARRIER, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
Example 6
Project: CustomWorldGen   File: WorldEntitySpawner.java   View Source Code Vote up 5 votes
public static boolean canCreatureTypeSpawnAtLocation(EntityLiving.SpawnPlacementType spawnPlacementTypeIn, World worldIn, BlockPos pos)
{
    if (!worldIn.getWorldBorder().contains(pos))
    {
        return false;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (spawnPlacementTypeIn == EntityLiving.SpawnPlacementType.IN_WATER)
        {
            return iblockstate.getMaterial().isLiquid() && worldIn.getBlockState(pos.down()).getMaterial().isLiquid() && !worldIn.getBlockState(pos.up()).isNormalCube();
        }
        else
        {
            BlockPos blockpos = pos.down();
            IBlockState state = worldIn.getBlockState(blockpos);

            if (!state.getBlock().canCreatureSpawn(state, worldIn, blockpos, spawnPlacementTypeIn))
            {
                return false;
            }
            else
            {
                Block block = worldIn.getBlockState(blockpos).getBlock();
                boolean flag = block != Blocks.BEDROCK && block != Blocks.BARRIER;
                return flag && isValidEmptySpawnBlock(iblockstate) && isValidEmptySpawnBlock(worldIn.getBlockState(pos.up()));
            }
        }
    }
}
 
Example 7
Project: CustomWorldGen   File: WorldClient.java   View Source Code Vote up 5 votes
public void doVoidFogParticles(int posX, int posY, int posZ)
{
    int i = 32;
    Random random = new Random();
    ItemStack itemstack = this.mc.thePlayer.getHeldItemMainhand();
    boolean flag = this.mc.playerController.getCurrentGameType() == GameType.CREATIVE && itemstack != null && Block.getBlockFromItem(itemstack.getItem()) == Blocks.BARRIER;
    BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();

    for (int j = 0; j < 667; ++j)
    {
        this.showBarrierParticles(posX, posY, posZ, 16, random, flag, blockpos$mutableblockpos);
        this.showBarrierParticles(posX, posY, posZ, 32, random, flag, blockpos$mutableblockpos);
    }
}
 
Example 8
Project: CustomWorldGen   File: WorldClient.java   View Source Code Vote up 5 votes
public void showBarrierParticles(int p_184153_1_, int p_184153_2_, int p_184153_3_, int p_184153_4_, Random random, boolean p_184153_6_, BlockPos.MutableBlockPos pos)
{
    int i = p_184153_1_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    int j = p_184153_2_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    int k = p_184153_3_ + this.rand.nextInt(p_184153_4_) - this.rand.nextInt(p_184153_4_);
    pos.setPos(i, j, k);
    IBlockState iblockstate = this.getBlockState(pos);
    iblockstate.getBlock().randomDisplayTick(iblockstate, this, pos, random);

    if (p_184153_6_ && iblockstate.getBlock() == Blocks.BARRIER)
    {
        this.spawnParticle(EnumParticleTypes.BARRIER, (double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F), 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
Example 9
Project: Bewitchment   File: BlockScornedBrickFence.java   View Source Code Vote up 4 votes
protected static boolean isExcepBlockForAttachWithPiston(Block p_194142_0_) {
	return Block.isExceptBlockForAttachWithPiston(p_194142_0_) || p_194142_0_ == Blocks.BARRIER || p_194142_0_ == Blocks.MELON_BLOCK || p_194142_0_ == Blocks.PUMPKIN || p_194142_0_ == Blocks.LIT_PUMPKIN;
}
 
Example 10
Project: Bewitchment   File: BlockFakeIceFence.java   View Source Code Vote up 4 votes
protected static boolean isExcepBlockForAttachWithPiston(Block p_194142_0_) {
	return Block.isExceptBlockForAttachWithPiston(p_194142_0_) || p_194142_0_ == Blocks.BARRIER || p_194142_0_ == Blocks.MELON_BLOCK || p_194142_0_ == Blocks.PUMPKIN || p_194142_0_ == Blocks.LIT_PUMPKIN;
}
 
Example 11
Project: Backmemed   File: EntityWither.java   View Source Code Vote up 4 votes
public static boolean canDestroyBlock(Block blockIn)
{
    return blockIn != Blocks.BEDROCK && blockIn != Blocks.END_PORTAL && blockIn != Blocks.END_PORTAL_FRAME && blockIn != Blocks.COMMAND_BLOCK && blockIn != Blocks.REPEATING_COMMAND_BLOCK && blockIn != Blocks.CHAIN_COMMAND_BLOCK && blockIn != Blocks.BARRIER && blockIn != Blocks.STRUCTURE_BLOCK && blockIn != Blocks.STRUCTURE_VOID;
}
 
Example 12
Project: Backmemed   File: EntityDragon.java   View Source Code Vote up 4 votes
/**
 * Destroys all blocks that aren't associated with 'The End' inside the given bounding box.
 */
private boolean destroyBlocksInAABB(AxisAlignedBB p_70972_1_)
{
    int i = MathHelper.floor(p_70972_1_.minX);
    int j = MathHelper.floor(p_70972_1_.minY);
    int k = MathHelper.floor(p_70972_1_.minZ);
    int l = MathHelper.floor(p_70972_1_.maxX);
    int i1 = MathHelper.floor(p_70972_1_.maxY);
    int j1 = MathHelper.floor(p_70972_1_.maxZ);
    boolean flag = false;
    boolean flag1 = false;

    for (int k1 = i; k1 <= l; ++k1)
    {
        for (int l1 = j; l1 <= i1; ++l1)
        {
            for (int i2 = k; i2 <= j1; ++i2)
            {
                BlockPos blockpos = new BlockPos(k1, l1, i2);
                IBlockState iblockstate = this.world.getBlockState(blockpos);
                Block block = iblockstate.getBlock();

                if (iblockstate.getMaterial() != Material.AIR && iblockstate.getMaterial() != Material.FIRE)
                {
                    if (!this.world.getGameRules().getBoolean("mobGriefing"))
                    {
                        flag = true;
                    }
                    else if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.END_PORTAL && block != Blocks.END_PORTAL_FRAME)
                    {
                        if (block != Blocks.COMMAND_BLOCK && block != Blocks.REPEATING_COMMAND_BLOCK && block != Blocks.CHAIN_COMMAND_BLOCK && block != Blocks.IRON_BARS && block != Blocks.END_GATEWAY)
                        {
                            flag1 = this.world.setBlockToAir(blockpos) || flag1;
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                    else
                    {
                        flag = true;
                    }
                }
            }
        }
    }

    if (flag1)
    {
        double d0 = p_70972_1_.minX + (p_70972_1_.maxX - p_70972_1_.minX) * (double)this.rand.nextFloat();
        double d1 = p_70972_1_.minY + (p_70972_1_.maxY - p_70972_1_.minY) * (double)this.rand.nextFloat();
        double d2 = p_70972_1_.minZ + (p_70972_1_.maxZ - p_70972_1_.minZ) * (double)this.rand.nextFloat();
        this.world.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }

    return flag;
}
 
Example 13
Project: Backmemed   File: BlockFence.java   View Source Code Vote up 4 votes
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return block == Blocks.BARRIER ? false : ((!(block instanceof BlockFence) || block.blockMaterial != this.blockMaterial) && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && iblockstate.isFullCube() ? block.blockMaterial != Material.GOURD : false) : true);
}
 
Example 14
Project: Backmemed   File: BlockWall.java   View Source Code Vote up 4 votes
private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return block == Blocks.BARRIER ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && iblockstate.isFullCube() ? block.blockMaterial != Material.GOURD : false) : true);
}
 
Example 15
Project: BetterBeginningsReborn   File: JsonBrickOvenShapedRecipe.java   View Source Code Vote up 4 votes
public void register()
{
    	if(!output.isValid())
    	{
    	    LogUtil.log(Level.ERROR, "No matching item found for brick oven recipe output '" + output.getItemName() + "'");
    	    BBConfigFolderLoader.failLoading();
    	    return;
    	}
	List<Object> res = new ArrayList<>();
	for (String s : recipe)
	{
	    res.add(s);
	}
	
	for (Map.Entry<Character, JsonLoadedItem> entry : ingredients.entrySet())
	{
		res.add(entry.getKey());

		JsonLoadedItem jli = entry.getValue();
		if(!jli.isValid())
	    	{
	    	    LogUtil.log(Level.ERROR, "No matching item found for brick oven recipe input '" + jli.getItemName() + "'");
	    	    BBConfigFolderLoader.failLoading();
	    	    return;
	    	}
		if (jli.isOreDictionary())
		{
			res.add(jli.getItemName());
		}
		else
		{
			ItemStack stack = jli.getFirstItemStackOrNull();
			if (stack != null)
			{
				res.add(stack);
			}
			else
			{
				ItemStack invalid = new ItemStack(Blocks.BARRIER);
				invalid.setStackDisplayName("ERROR IN LOADING JSON RECIPE. MISSING INGREDIENT.");
				res.add(invalid);
			}
		}
	}
	Object[] params = res.toArray();
	BrickOvenRecipeHandler.addShapedRecipe(output.getFirstItemStackOrNull(), params);
}
 
Example 16
Project: BetterBeginningsReborn   File: JsonAdvancedRecipe.java   View Source Code Vote up 4 votes
public void register()
{
    	if(!output.isValid())
    	{
    	    LogUtil.log(Level.ERROR, "No matching item found for advanced crafting output '" + output.getItemName() + "'");
    	    BBConfigFolderLoader.failLoading();
    	    return;
    	}
	List<Object> res = new ArrayList<>();
	for (JsonLoadedItemStack jlis : catalysts)
	{
	    	if(!jlis.isValid())
	    	{
	    	    LogUtil.log(Level.ERROR, "No matching item found for advanced crafting catalyst '" + jlis.getItemName() + "'");
	    	    BBConfigFolderLoader.failLoading();
	    	    return;
	    	}
		if (jlis.isOreDictionary())
		{
			res.add(jlis.getItemName());
			res.add(jlis.getStackSize());
		}
		else
		{
			res.add(jlis.getFirstItemStackOrNull());
		}
	}
	Object[] addedMats = res.toArray();

	res = new ArrayList<>();
	for (String s : recipe)
	{
		res.add(s);
	}
	for (Map.Entry<Character, JsonLoadedItem> entry : ingredients.entrySet())
	{
		res.add(entry.getKey());
		if(!entry.getValue().isValid())
	    	{
	    	    LogUtil.log(Level.ERROR, "No matching item found for advanced crafting input '" + entry.getValue().getItemName() + "'");
	    	    BBConfigFolderLoader.failLoading();
	    	    return;
	    	}
		if (entry.getValue().isOreDictionary())
		{
			res.add(entry.getValue().getItemName());
		}
		else
		{
			ItemStack stack = entry.getValue().getFirstItemStackOrNull();
			if (stack != null)
			{
				res.add(stack);
			}
			else
			{
				ItemStack invalid = new ItemStack(Blocks.BARRIER);
				invalid.setStackDisplayName("ERROR IN LOADING JSON RECIPE. MISSING INGREDIENT.");
				res.add(invalid);
			}
		}
	}
	Object[] params = res.toArray();

	AdvancedCraftingHandler.addAdvancedRecipe(output.getFirstItemStackOrNull(), hideFromNEI, addedMats, params);
}
 
Example 17
Project: CustomWorldGen   File: EntityWither.java   View Source Code Vote up 4 votes
public static boolean canDestroyBlock(Block blockIn)
{
    return blockIn != Blocks.BEDROCK && blockIn != Blocks.END_PORTAL && blockIn != Blocks.END_PORTAL_FRAME && blockIn != Blocks.COMMAND_BLOCK && blockIn != Blocks.REPEATING_COMMAND_BLOCK && blockIn != Blocks.CHAIN_COMMAND_BLOCK && blockIn != Blocks.BARRIER;
}
 
Example 18
Project: CustomWorldGen   File: BlockFence.java   View Source Code Vote up 4 votes
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return block == Blocks.BARRIER ? false : ((!(block instanceof BlockFence) || block.blockMaterial != this.blockMaterial) && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && iblockstate.isFullCube() ? block.blockMaterial != Material.GOURD : false) : true);
}
 
Example 19
Project: CustomWorldGen   File: BlockWall.java   View Source Code Vote up 4 votes
private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return block == Blocks.BARRIER ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && iblockstate.isFullCube() ? block.blockMaterial != Material.GOURD : false) : true);
}
 
Example 20
Project: CustomWorldGen   File: BlockModelShapes.java   View Source Code Vote up 4 votes
public TextureAtlasSprite getTexture(IBlockState state)
{
    Block block = state.getBlock();
    IBakedModel ibakedmodel = this.getModelForState(state);

    if (ibakedmodel == null || ibakedmodel == this.modelManager.getMissingModel())
    {
        if (block == Blocks.WALL_SIGN || block == Blocks.STANDING_SIGN || block == Blocks.CHEST || block == Blocks.TRAPPED_CHEST || block == Blocks.STANDING_BANNER || block == Blocks.WALL_BANNER)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/planks_oak");
        }

        if (block == Blocks.ENDER_CHEST)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/obsidian");
        }

        if (block == Blocks.FLOWING_LAVA || block == Blocks.LAVA)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/lava_still");
        }

        if (block == Blocks.FLOWING_WATER || block == Blocks.WATER)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/water_still");
        }

        if (block == Blocks.SKULL)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:blocks/soul_sand");
        }

        if (block == Blocks.BARRIER)
        {
            return this.modelManager.getTextureMap().getAtlasSprite("minecraft:items/barrier");
        }
    }

    if (ibakedmodel == null)
    {
        ibakedmodel = this.modelManager.getMissingModel();
    }

    return ibakedmodel.getParticleTexture();
}