public static @Nonnull TextureAtlasSprite getTexture(@Nonnull IBlockState state) { return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state); }
@Override protected ResourceLocation getEntityTexture(EntityChameleonTick tick) { String blockPath = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(tick.blockID.getStateFromMeta(tick.blockMeta)).getIconName(); String modName = "minecraft"; if (blockPath.contains(":")) { modName = blockPath.split(":")[0]; blockPath = blockPath.split(":")[1]; } return new ResourceLocation(modName, "textures/" + blockPath + ".png"); } }
@Override protected ResourceLocation getEntityTexture(EntityAnimatedBlock animatedblock) { String blockPath = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(animatedblock.blockID.getStateFromMeta(animatedblock.blockMeta)).getIconName(); String modName = "minecraft"; if (blockPath.contains(":")) { modName = blockPath.split(":")[0]; blockPath = blockPath.split(":")[1]; } return new ResourceLocation(modName, "textures/" + blockPath + ".png"); } }
/** * Attempts to get a block sprite from a block state. * * @param state The block state to get the sprite for. * @return The block sprite. */ public static TextureAtlasSprite getSprite (IBlockState state) { return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state); }
private TextureAtlasSprite getTexture(IBlockState blockstate) { return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(blockstate); }
@Nullable private static TextureAtlasSprite getTextureAtlasSprite(IBlockState blockState) { Minecraft minecraft = Minecraft.getMinecraft(); BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher(); BlockModelShapes blockModelShapes = blockRendererDispatcher.getBlockModelShapes(); TextureAtlasSprite textureAtlasSprite = blockModelShapes.getTexture(blockState); if (textureAtlasSprite == minecraft.getTextureMapBlocks().getMissingSprite()) { return null; } return textureAtlasSprite; }
@SideOnly(Side.CLIENT) public static boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World world, @Nonnull RayTraceResult target, @Nonnull ParticleManager effectRenderer) { if (state.getBlock() instanceof IPaintable) { BlockPos pos = target.getBlockPos(); IBlockState paintSource = ((IPaintable) state.getBlock()).getPaintSource(state, world, pos); if (paintSource != null) { addBlockHitEffects(world, state, paintSource, pos, target.sideHit, effectRenderer); lastTexture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(paintSource); return true; } } return false; }
private TextureAtlasSprite getTexture(Block blockIn) { return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(blockIn.getDefaultState()); } }
@SideOnly(Side.CLIENT) protected void setTexture(ParticleDigging fx, World world, BlockPos pos, IBlockState state) { Minecraft minecraft = Minecraft.getMinecraft(); BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher(); BlockModelShapes blockModelShapes = blockRendererDispatcher.getBlockModelShapes(); TextureAtlasSprite texture = blockModelShapes.getTexture(state); fx.setParticleTexture(texture); } }
@Override public TextureAtlasSprite getParticleTexture() { final TextureAtlasSprite sprite = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( Blocks.STONE.getDefaultState() ); if ( sprite == null ) { return ClientSide.instance.getMissingIcon(); } return sprite; }
protected IBakedModel handleDisplayStandType(ItemStack displayStandType, boolean axisX, EnumFacing facing) { if (displayStandType != null && !displayStandType.isEmpty()) { // Get reference texture IBlockState blockState = BlockHelpers.getBlockStateFromItemStack(displayStandType); String textureName = Minecraft.getMinecraft().getBlockRendererDispatcher() .getBlockModelShapes().getTexture(blockState).getIconName(); // Retexture our model String cacheName = textureName + axisX + facing.toString(); IBakedModel bakedRetexturedModel = retexturedCache.get(cacheName); if (bakedRetexturedModel == null) { IModel retexturedModel = retexturableModel.retexture(ImmutableMap.of("base", textureName)); IModelState modelState = ROTATIONS.get(facing); // Hack, see DisplayStand#bakeVariantModel, should just be retexturableModel.getDefaultState(); bakedRetexturedModel = retexturedModel.bake(modelState, DefaultVertexFormats.BLOCK, org.cyclops.cyclopscore.helper.RenderHelpers.TEXTURE_GETTER); retexturedCache.put(cacheName, bakedRetexturedModel); } return bakedRetexturedModel; } return untexturedBakedModel; }
@SideOnly(Side.CLIENT) @Override public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World world, @Nonnull RayTraceResult target, @Nonnull ParticleManager effectRenderer) { TileConduitBundle cb = getTileEntity(world, target.getBlockPos()); if (cb == null) { return false; } TextureAtlasSprite tex = null; if (YetaUtil.isSolidFacadeRendered(cb, Minecraft.getMinecraft().player)) { IBlockState paintSource = cb.getPaintSource(); if (paintSource != null) { tex = RenderUtil.getTexture(paintSource); } } else if (target.hitInfo instanceof CollidableComponent) { CollidableComponent cc = (CollidableComponent) target.hitInfo; IConduit con = cb.getConduit(cc.conduitType); if (con != null && con instanceof IClientConduit.WithDefaultRendering) { tex = ((IClientConduit.WithDefaultRendering) con).getTextureForState(cc).getCroppedSprite(); } } if (tex == null) { tex = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(ModObject.block_machine_base.getBlockNN().getDefaultState()); } lastHitIcon = tex; addBlockHitEffects(world, effectRenderer, target.hitVec.x, target.hitVec.y, target.hitVec.z, target.sideHit, tex); return true; }
texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(blockState).getIconName(); flowerPot.getTileData().setString(TAG_TEXTURE_PATH, texture);
IBlockState paintSource = ((IPaintable) state.getBlock()).getPaintSource(state, world, pos); if (paintSource != null) { texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(paintSource);
texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( state );
@SideOnly(Side.CLIENT) @Override public boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager effectRenderer) { if (lastHitIcon == null) { lastHitIcon = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes() .getTexture(ModObject.block_machine_base.getBlockNN().getDefaultState()); } IBlockState state = world.getBlockState(pos); TextureAtlasSprite tex = lastHitIcon; if (state.getBlock() != this || tex == null) { return false; } state = state.getActualState(world, pos); int i = 4; for (int j = 0; j < i; ++j) { for (int k = 0; k < i; ++k) { for (int l = 0; l < i; ++l) { double d0 = pos.getX() + (j + 0.5D) / i; double d1 = pos.getY() + (k + 0.5D) / i; double d2 = pos.getZ() + (l + 0.5D) / i; ParticleDigging fx = (ParticleDigging) new ParticleDigging.Factory().createParticle(-1, world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, 0); fx.setBlockPos(pos); fx.setParticleTexture(tex); effectRenderer.addEffect(fx); } } } return true; }
@SideOnly(Side.CLIENT) private IBakedModel paintModel(IModel sourceModel, final @Nullable IBlockState paintSource, IModelState rotation, final PaintMode paintMode) { IModelState state = sourceModel.getDefaultState(); state = combine(state, rotation); if (state instanceof UVLock) { sourceModel = sourceModel.uvlock(true); state = ((UVLock) state).getParent(); } if (state == null) { state = sourceModel.getDefaultState(); } final TextureAtlasSprite missingSprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); final TextureAtlasSprite paintSprite = paintSource == null ? missingSprite : NullHelper.first(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(paintSource), missingSprite); if (paintMode == PaintMode.ALL_TEXTURES) { return sourceModel.bake(state, Attributes.DEFAULT_BAKED_FORMAT, new AllPainter(paintSprite)); } else { return sourceModel.bake(state, Attributes.DEFAULT_BAKED_FORMAT, new TaggedPainter(paintSprite)); } }
/** * Gets the TextureAtlasSprite for the ItemStack. Has support for both Items and Blocks. * * @param stack The ItemStack to get the sprite for. * @return The sprite for the ItemStack. */ public static TextureAtlasSprite getSprite (ItemStack stack) { final Minecraft mc = Minecraft.getMinecraft(); final Block block = StackUtils.getBlockFromStack(stack); if (block == null) { final ItemModelMesher mesher = mc.getRenderItem().getItemModelMesher(); return !stack.isEmpty() ? mesher.getParticleIcon(stack.getItem(), stack.getItemDamage()) : mesher.getItemModel(null).getParticleTexture(); } return mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(block.getStateFromMeta(stack.getItemDamage())); }
texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture( state );