Java 类net.minecraft.block.BlockGlass 实例源码
项目:LittleThings-old
文件:TileEntityItemElevator.java
private IInventory searchForInventory()
{
for (int j = 1; j < 64; j++) {
TileEntity foundte = worldObj.getTileEntity(getPos().add(0, j, 0));
Block foundBlock = worldObj.getBlockState(getPos().add(0, j, 0)).getBlock();
if (foundte != null && foundte instanceof IInventory) {
this.foundInventory = getPos().add(0, j, 0);
this.oldBlock = foundBlock;
return (IInventory) foundte;
} else if (foundte == null && !((foundBlock instanceof BlockGlass) || foundBlock instanceof BlockStainedGlass)) {
this.foundInventory = null;
this.oldBlock = null;
return null;
}
}
this.foundInventory = null;
this.oldBlock = null;
return null;
}
项目:MrCrayfishSkateboardingMod
文件:TileEntityTextureable.java
public boolean setTexture(ItemStack stack)
{
if(stack != null && stack.getItem() instanceof ItemDye)
{
EnumDyeColor colour = EnumDyeColor.byDyeDamage(stack.getMetadata());
texture = new ResourceLocation("textures/blocks/hardened_clay_stained_" + colour.getName() + ".png");
return true;
}
if(stack != null && stack.getItem() instanceof ItemBlock)
{
System.out.println("called");
Block block = ((ItemBlock) stack.getItem()).block;
if(block.isNormalCube(block.getDefaultState()) || block instanceof BlockGlass)
{
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(block.getStateFromMeta(stack.getMetadata()));
texture = new ResourceLocation(model.getParticleTexture().getIconName());
return true;
}
}
return false;
}
项目:MrCrayfishSkateboardingMod
文件:TileEntityTextureable.java
public boolean setTexture(ItemStack stack)
{
if(stack != null && stack.getItem() instanceof ItemDye)
{
EnumDyeColor colour = EnumDyeColor.byDyeDamage(stack.getMetadata());
texture = new ResourceLocation("textures/blocks/hardened_clay_stained_" + colour.getName() + ".png");
return true;
}
if(stack != null && stack.getItem() instanceof ItemBlock)
{
System.out.println("called");
Block block = ((ItemBlock) stack.getItem()).block;
if(block.isNormalCube(block.getDefaultState()) || block instanceof BlockGlass)
{
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(block.getStateFromMeta(stack.getMetadata()));
texture = new ResourceLocation(model.getParticleTexture().getIconName());
return true;
}
}
return false;
}
项目:RandomAdditions
文件:SubBlockCable.java
@Override
public boolean onBlockActivated(EntityPlayer player, ItemStack stack, TileEntity tileEntity)
{
if(stack != null && stack.getItem() instanceof ItemBlock && tileEntity instanceof TileEntityCable)
{
TileEntityCable cable = (TileEntityCable) tileEntity;
if(cable.isCoverd()) return false;
Block block = Block.getBlockFromItem(stack.getItem());
if(!block.isNormalCube() && !(block instanceof BlockGlass))
{
return false;
}
cable.block = block;
cable.meta = stack.getItemDamage();
cable.updateBlock();
cable.getWorldObj().playSoundEffect((double)((float)cable.xCoord + 0.5F), (double)((float)cable.yCoord + 0.5F), (double)((float)cable.zCoord + 0.5F), block.stepSound.func_150496_b(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
if(!player.capabilities.isCreativeMode)stack.stackSize--;
return true;
}
return false;
}
项目:Backmemed
文件:ConnectedTextures.java
private static boolean isFullCubeModel(IBlockState p_isFullCubeModel_0_)
{
if (p_isFullCubeModel_0_.isFullCube())
{
return true;
}
else
{
Block block = p_isFullCubeModel_0_.getBlock();
return block instanceof BlockGlass ? true : block instanceof BlockStainedGlass;
}
}
项目:LittleThings-old
文件:TileEntityItemElevator.java
private void updatePartials()
{
for (int j = 1; j < 64; j++) {
BlockPos added = getPos().add(0, j, 0);
if (worldObj.getBlockState(added).getBlock() instanceof BlockGlass || worldObj.getBlockState(added).getBlock() instanceof BlockStainedGlass)
for (int i = 10; i >= 1; i--)
worldObj.spawnParticle(EnumParticleTypes.PORTAL,
added.getX() + 0.5, added.getY() - 1 + i / 10, added.getZ() + 0.5,
0, 0.3, 0);
else break;
}
}
项目:FFS
文件:GenericUtil.java
public static boolean isBlockGlass(IBlockState blockState) {
if(blockState == null || blockState.getMaterial() == Material.AIR) {
return false;
}
if(blockState.getBlock() instanceof BlockGlass) {
return true;
}
ItemStack is = new ItemStack(blockState.getBlock(), 1);
return blockState.getMaterial() == Material.GLASS && !is.getUnlocalizedName().contains("pane");
}
项目:TheStuffMod
文件:ItemPaintbrush.java
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float textureX, float textureY, float textureZ) {
if(!world.isRemote) {
if(world.getBlock(x, y, z) instanceof BlockColoured || world.getBlock(x, y, z) instanceof BlockColored || world.getBlock(x, y, z) instanceof BlockStainedGlass || world.getBlock(x, y, z) instanceof BlockStainedGlassPane) {
if(world.getBlockMetadata(x, y, z) != this.getDamage(itemstack)) {
world.setBlockMetadataWithNotify(x, y, z, this.getDamage(itemstack), 2);
player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
return true;
} else return false;
} else if(world.getBlock(x, y, z) instanceof BlockHardenedClay) {
world.setBlock(x, y, z, Blocks.stained_hardened_clay, this.getDamage(itemstack), 2);
player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
return true;
} else if(world.getBlock(x, y, z) instanceof BlockGlass) {
world.setBlock(x, y, z, Blocks.stained_glass, this.getDamage(itemstack), 2);
player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
return true;
} else if(world.getBlock(x, y, z) == Blocks.glass_pane) {
world.setBlock(x, y, z, Blocks.stained_glass_pane, this.getDamage(itemstack), 2);
player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
return true;
} else if(world.getBlock(x, y, z) instanceof BlockWood) {
world.setBlock(x, y, z, ModBlocks.woodColoured, this.getDamage(itemstack), 2);
player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
return true;
} else if(world.getBlock(x, y, z) == Blocks.brick_block) {
world.setBlock(x, y, z, ModBlocks.brickColoured, this.getDamage(itemstack), 2);
player.inventory.setInventorySlotContents(player.inventory.currentItem, this.getContainerItem(itemstack));
return true;
}
}
return false;
}
项目:MeeCreeps
文件:SchematicHouse.java
@Override
public Predicate<IBlockState> getStateMatcher() {
return blockState -> blockState.getBlock() instanceof BlockGlass;
}
项目:MC-Prefab
文件:BlockGlassSlab.java
/**
* Get the MapColor for this Block and the given BlockState
*/
@Override
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
return ((BlockGlass)Blocks.GLASS).getMapColor(Blocks.GLASS.getDefaultState(), worldIn, pos);
}
项目:Wars-Mod
文件:ItemEnderSword.java
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
if (!world.isRemote) {
if (cooldown <= 0) {
if (WarsMod.getDonators().contains(player.getName())) {
if (player instanceof EntityPlayerMP && ItemArmorMod.hasFullSuit(player, WarsItems.enderArmor)) {
RayTraceResult result = player.rayTrace(20, 1F);
int x = result.getBlockPos().getX();
int y = result.getBlockPos().getY();
int z = result.getBlockPos().getZ();
if(!teleportTo(x, y, z, player) && !(world.getBlockState(result.getBlockPos()).getBlock() instanceof BlockGlass)){//BlockGlass check prevents potentially escaping the dome
if(player.posX > x)
if(teleportTo(x+2, y, z, player)) {
cooldown = 80;
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
if(player.posX < x)
if(teleportTo(x-2, y, z, player)) {
cooldown = 80;
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
if(player.posZ > z)
if(teleportTo(x, y, z+2, player)) {
cooldown = 80;
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
if(player.posZ < z)
if(teleportTo(x, y, z-2, player)) {
cooldown = 80;
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
}
cooldown = 80;
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
} else {
player.addChatMessage(new TextComponentTranslation("class.donatoronly"));
return new ActionResult(EnumActionResult.FAIL, stack);
}
}
}
return new ActionResult(EnumActionResult.PASS, stack);
}
项目:ZeldaSwordSkills
文件:BlockCeramicJar.java
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos) {
return super.canPlaceBlockAt(world, pos) && (world.isSideSolid(pos.down(), EnumFacing.UP) || world.getBlockState(pos.down()).getBlock() instanceof BlockGlass);
}