private static void draw(World world, double dx, double dy, double dz, Entity entity, ScarfNode prime, ArrayList<ScarfNode> nodes) { TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/wool_colored_white"); //TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); ScarfNode lastNode = prime; for(ScarfNode node : nodes) { //TODO: Swap out sprites each segment? float x1 = (float)(node.x-dx); float x2 = (float)(lastNode.x-dx); float y1 = (float)(node.y-dy); float y2 = (float)(lastNode.y-dy); float z1 = (float)(node.z-dz); float z2 = (float)(lastNode.z-dz); float light1 = world.getLight(new BlockPos((int)node.x, (int)node.y, (int)node.z)) / 15f; float light2 = world.getLight(new BlockPos((int)lastNode.x, (int)lastNode.y, (int)lastNode.z)) / 15f; ribbon(x1, y1, z1, x2, y2, z2, 0.25f, sprite, node.r, node.g, node.b, light1, light2); ribbon(x2, y2, z2, x1, y1, z1, 0.25f, sprite, node.r, node.g, node.b, light2, light1); lastNode = node; } }
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) { double uMin = textureSprite.getMinU(); double uMax = textureSprite.getMaxU(); double vMin = textureSprite.getMinV(); double vMax = textureSprite.getMaxV(); uMax = uMax - maskRight / 16.0 * (uMax - uMin); vMax = vMax - maskTop / 16.0 * (vMax - vMin); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder worldrenderer = tessellator.getBuffer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex(); worldrenderer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex(); worldrenderer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex(); worldrenderer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex(); tessellator.draw(); }
@Optional.Method(modid = "mekanism") private void drawMekGasContent() { if(tank.getTank() instanceof HybridGasTank) { GasStack gasContent = ((HybridGasTank) tank.getTank()).getGas(); if(gasContent != null && gasContent.amount > 0) { GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); float percFilled = ((float) gasContent.amount) / ((float) tank.getTank().getCapacity()); percFilled = MathHelper.clamp(percFilled, 0F, 1F); int pxFilled = MathHelper.ceil(percFilled * 61F); TextureAtlasSprite tas = gasContent.getGas().getSprite(); if(tas == null) { tas = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); } this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); drawTexturedModalRect(15, 10 + 61 - pxFilled, tas, 20, pxFilled); } } }
private static TextureAtlasSprite getSpriteByUv(int[] p_getSpriteByUv_0_) { float f = 1.0F; float f1 = 1.0F; float f2 = 0.0F; float f3 = 0.0F; int i = p_getSpriteByUv_0_.length / 4; for (int j = 0; j < 4; ++j) { int k = j * i; float f4 = Float.intBitsToFloat(p_getSpriteByUv_0_[k + 4]); float f5 = Float.intBitsToFloat(p_getSpriteByUv_0_[k + 4 + 1]); f = Math.min(f, f4); f1 = Math.min(f1, f5); f2 = Math.max(f2, f4); f3 = Math.max(f3, f5); } float f6 = (f + f2) / 2.0F; float f7 = (f1 + f3) / 2.0F; TextureAtlasSprite textureatlassprite = Minecraft.getMinecraft().getTextureMapBlocks().getIconByUV((double)f6, (double)f7); return textureatlassprite; }
public BakedWrapper(final Node<?> node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet<String> meshes, final ImmutableMap<String, TextureAtlasSprite> textures) { this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder() .maximumSize(128) .expireAfterAccess(2, TimeUnit.MINUTES) .<Integer, B3DState>build(new CacheLoader<Integer, B3DState>() { public B3DState load(Integer frame) throws Exception { IModelState parent = state; Animation newAnimation = node.getAnimation(); if(parent instanceof B3DState) { B3DState ps = (B3DState)parent; parent = ps.getParent(); } return new B3DState(newAnimation, frame, frame, 0, parent); } })); }
private List<ItemModelGenerator.Span> func_178393_a(TextureAtlasSprite p_178393_1_) { int i = p_178393_1_.getIconWidth(); int j = p_178393_1_.getIconHeight(); List<ItemModelGenerator.Span> list = Lists.<ItemModelGenerator.Span>newArrayList(); for (int k = 0; k < p_178393_1_.getFrameCount(); ++k) { int[] aint = p_178393_1_.getFrameTextureData(k)[0]; for (int l = 0; l < j; ++l) { for (int i1 = 0; i1 < i; ++i1) { boolean flag = !this.func_178391_a(aint, i1, l, i, j); this.func_178396_a(ItemModelGenerator.SpanFacing.UP, list, aint, i1, l, i, j, flag); this.func_178396_a(ItemModelGenerator.SpanFacing.DOWN, list, aint, i1, l, i, j, flag); this.func_178396_a(ItemModelGenerator.SpanFacing.LEFT, list, aint, i1, l, i, j, flag); this.func_178396_a(ItemModelGenerator.SpanFacing.RIGHT, list, aint, i1, l, i, j, flag); } } } return list; }
public static boolean renderObject(Minecraft mc, RenderItem itemRender, int x, int y, Object itm, boolean highlight, float lvl) { itemRender.zLevel = lvl; if (itm == null) { return renderItemStack(mc, itemRender, null, x, y, "", highlight); } if (itm instanceof Item) { return renderItemStack(mc, itemRender, new ItemStack((Item) itm, 1), x, y, "", highlight); } if (itm instanceof Block) { return renderItemStack(mc, itemRender, new ItemStack((Block) itm, 1), x, y, "", highlight); } if (itm instanceof ItemStack) { return renderItemStackWithCount(mc, itemRender, (ItemStack) itm, x, y, highlight); } if (itm instanceof TextureAtlasSprite) { return renderIcon(mc, itemRender, (TextureAtlasSprite) itm, x, y, highlight); } return renderItemStack(mc, itemRender, ItemStack.EMPTY, x, y, "", highlight); }
public BakedItemModel(ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, ImmutableMap<TransformType, TRSRTransformation> transforms, ItemOverrideList overrides, IBakedModel otherModel) { this.quads = quads; this.particle = particle; this.transforms = transforms; this.overrides = overrides; if(otherModel != null) { this.otherModel = otherModel; this.isCulled = true; } else { ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); for(BakedQuad quad : quads) { if(quad.getFace() == EnumFacing.SOUTH) { builder.add(quad); } } this.otherModel = new BakedItemModel(builder.build(), particle, transforms, overrides, this); isCulled = false; } }
public void setVertexState(WorldRenderer.State state) { this.rawIntBuffer.clear(); this.func_181670_b(state.getRawBuffer().length); this.rawIntBuffer.put(state.getRawBuffer()); this.vertexCount = state.getVertexCount(); this.vertexFormat = new VertexFormat(state.getVertexFormat()); if (state.stateQuadSprites != null) { if (this.quadSprites == null) { this.quadSprites = new TextureAtlasSprite[this.getBufferQuadSize()]; } TextureAtlasSprite[] atextureatlassprite = state.stateQuadSprites; System.arraycopy(atextureatlassprite, 0, this.quadSprites, 0, atextureatlassprite.length); } else { this.quadSprites = null; } }
private static TextureAtlasSprite getConnectedTextureMultiPass(IBlockAccess p_getConnectedTextureMultiPass_0_, IBlockState p_getConnectedTextureMultiPass_1_, BlockPos p_getConnectedTextureMultiPass_2_, EnumFacing p_getConnectedTextureMultiPass_3_, TextureAtlasSprite p_getConnectedTextureMultiPass_4_, RenderEnv p_getConnectedTextureMultiPass_5_) { TextureAtlasSprite textureatlassprite = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, p_getConnectedTextureMultiPass_4_, true, p_getConnectedTextureMultiPass_5_); if (!multipass) { return textureatlassprite; } else if (textureatlassprite == p_getConnectedTextureMultiPass_4_) { return textureatlassprite; } else { TextureAtlasSprite textureatlassprite1 = textureatlassprite; for (int i = 0; i < 3; ++i) { TextureAtlasSprite textureatlassprite2 = getConnectedTextureSingle(p_getConnectedTextureMultiPass_0_, p_getConnectedTextureMultiPass_1_, p_getConnectedTextureMultiPass_2_, p_getConnectedTextureMultiPass_3_, textureatlassprite1, false, p_getConnectedTextureMultiPass_5_); if (textureatlassprite2 == textureatlassprite1) { break; } textureatlassprite1 = textureatlassprite2; } return textureatlassprite1; } }
private int[] makeQuadVertexData(BlockPartFace partFace, TextureAtlasSprite sprite, EnumFacing facing, float[] p_178405_4_, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade) { int[] aint = new int[28]; for (int i = 0; i < 4; ++i) { this.fillVertexData(aint, i, facing, partFace, p_178405_4_, sprite, modelRotationIn, partRotation, uvLocked, shade); } return aint; }
protected ParticleGlowBase(World world, double x, double y, double z, double velocityX, double velocityY, double velocityZ) { super(world, x, y, z, velocityX, velocityY, velocityZ); this.particleAlpha = 0.90F; motionX = velocityX; motionY = velocityY; motionZ = velocityZ; particleRainbow = rand.nextInt(32); this.particleMaxAge = 20; TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); setParticleTexture(sprite); }
public BakedProgrammingPuzzle(ModelProgrammingPuzzle parent, ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms, Map<String, IBakedModel> cache) { this.quads = quads; this.particle = particle; this.format = format; this.parent = parent; this.transforms = transforms; this.cache = cache; this.overridesList = new PuzzleOverrideList(Collections.emptyList(), this); }
private void makeItemModels() { for (ResourceLocation resourcelocation : this.itemLocations.values()) { ModelBlock modelblock = (ModelBlock)this.models.get(resourcelocation); if (this.hasItemModel(modelblock)) { ModelBlock modelblock1 = this.makeItemModel(modelblock); if (modelblock1 != null) { modelblock1.name = resourcelocation.toString(); } this.models.put(resourcelocation, modelblock1); } else if (this.isCustomRenderer(modelblock)) { this.models.put(resourcelocation, modelblock); } } for (TextureAtlasSprite textureatlassprite : this.sprites.values()) { if (!textureatlassprite.hasAnimationMetadata()) { textureatlassprite.clearFramesTextureData(); } } }
private List<BlockPart> func_178394_a(int p_178394_1_, String p_178394_2_, TextureAtlasSprite p_178394_3_) { Map<EnumFacing, BlockPartFace> map = Maps.<EnumFacing, BlockPartFace>newHashMap(); map.put(EnumFacing.SOUTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {0.0F, 0.0F, 16.0F, 16.0F}, 0))); map.put(EnumFacing.NORTH, new BlockPartFace((EnumFacing)null, p_178394_1_, p_178394_2_, new BlockFaceUV(new float[] {16.0F, 0.0F, 0.0F, 16.0F}, 0))); List<BlockPart> list = Lists.<BlockPart>newArrayList(); list.add(new BlockPart(new Vector3f(0.0F, 0.0F, 7.5F), new Vector3f(16.0F, 16.0F, 8.5F), map, (BlockPartRotation)null, true)); list.addAll(this.func_178397_a(p_178394_3_, p_178394_2_, p_178394_1_)); return list; }
public BakedDynBucket(ModelDynBucket parent, ImmutableList<BakedQuad> quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap<ItemCameraTransforms.TransformType, TRSRTransformation> transforms, Map<String, IBakedModel> cache) { this.quads = quads; this.particle = particle; this.format = format; this.parent = parent; this.transforms = transforms; this.cache = cache; }
@Override public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { FluidStack fluidStack = FluidUtil.getFluidContained(stack); // not a fluid item apparently if (fluidStack == null) { // empty bucket return originalModel; } BakedDynBucket model = (BakedDynBucket)originalModel; Fluid fluid = fluidStack.getFluid(); String name = fluid.getName(); if (!model.cache.containsKey(name)) { IModel parent = model.parent.process(ImmutableMap.of("fluid", name)); Function<ResourceLocation, TextureAtlasSprite> textureGetter; textureGetter = new Function<ResourceLocation, TextureAtlasSprite>() { public TextureAtlasSprite apply(ResourceLocation location) { return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); } }; IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format, textureGetter); model.cache.put(name, bakedModel); return bakedModel; } return model.cache.get(name); }
private boolean isFullSprite(BakedQuad p_isFullSprite_1_) { TextureAtlasSprite textureatlassprite = p_isFullSprite_1_.getSprite(); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMaxU(); float f2 = f1 - f; float f3 = f2 / 256.0F; float f4 = textureatlassprite.getMinV(); float f5 = textureatlassprite.getMaxV(); float f6 = f5 - f4; float f7 = f6 / 256.0F; int[] aint = p_isFullSprite_1_.getVertexData(); int i = aint.length / 4; for (int j = 0; j < 4; ++j) { int k = j * i; float f8 = Float.intBitsToFloat(aint[k + 4]); float f9 = Float.intBitsToFloat(aint[k + 4 + 1]); if (!this.equalsDelta(f8, f, f3) && !this.equalsDelta(f8, f1, f3)) { return false; } if (!this.equalsDelta(f9, f4, f7) && !this.equalsDelta(f9, f5, f7)) { return false; } } return true; }
private static BakedQuad[] getQuadsCompact(ConnectedTexturesCompact.Dir p_getQuadsCompact_0_, int p_getQuadsCompact_1_, ConnectedTexturesCompact.Dir p_getQuadsCompact_2_, int p_getQuadsCompact_3_, ConnectedTexturesCompact.Dir p_getQuadsCompact_4_, int p_getQuadsCompact_5_, TextureAtlasSprite[] p_getQuadsCompact_6_, int p_getQuadsCompact_7_, BakedQuad p_getQuadsCompact_8_, RenderEnv p_getQuadsCompact_9_) { BakedQuad bakedquad = getQuadCompact(p_getQuadsCompact_6_[p_getQuadsCompact_1_], p_getQuadsCompact_0_, p_getQuadsCompact_7_, p_getQuadsCompact_8_, p_getQuadsCompact_9_); BakedQuad bakedquad1 = getQuadCompact(p_getQuadsCompact_6_[p_getQuadsCompact_3_], p_getQuadsCompact_2_, p_getQuadsCompact_7_, p_getQuadsCompact_8_, p_getQuadsCompact_9_); BakedQuad bakedquad2 = getQuadCompact(p_getQuadsCompact_6_[p_getQuadsCompact_5_], p_getQuadsCompact_4_, p_getQuadsCompact_7_, p_getQuadsCompact_8_, p_getQuadsCompact_9_); return p_getQuadsCompact_9_.getArrayQuadsCtm(bakedquad, bakedquad1, bakedquad2); }
private void func_180474_b(float p_180474_1_, ScaledResolution p_180474_2_) { if (p_180474_1_ < 1.0F) { p_180474_1_ = p_180474_1_ * p_180474_1_; p_180474_1_ = p_180474_1_ * p_180474_1_; p_180474_1_ = p_180474_1_ * 0.8F + 0.2F; } GlStateManager.disableAlpha(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(1.0F, 1.0F, 1.0F, p_180474_1_); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.portal.getDefaultState()); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMinV(); float f2 = textureatlassprite.getMaxU(); float f3 = textureatlassprite.getMaxV(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(0.0D, (double)p_180474_2_.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex(); worldrenderer.pos((double)p_180474_2_.getScaledWidth(), (double)p_180474_2_.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex(); worldrenderer.pos((double)p_180474_2_.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex(); worldrenderer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
public BakedQuadRetextured(BakedQuad quad, TextureAtlasSprite textureIn) { super(Arrays.copyOf(quad.getVertexData(), quad.getVertexData().length), quad.tintIndex, FaceBakery.getFacingFromVertexData(quad.getVertexData()), textureIn); this.texture = textureIn; this.format = quad.format; this.applyDiffuseLighting = quad.applyDiffuseLighting; this.spriteOld = quad.getSprite(); this.remapQuad(); this.fixVertexData(); }
public void setTexture(TextureAtlasSprite texture) { try { parent.setTexture(texture); } catch(AbstractMethodError e) { // catch missing method errors caused by change to IVertexConsumer } }
private static TextureAtlasSprite getIcon(String p_getIcon_0_) { TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks(); TextureAtlasSprite textureatlassprite = texturemap.getSpriteSafe(p_getIcon_0_); if (textureatlassprite != null) { return textureatlassprite; } else { textureatlassprite = texturemap.getSpriteSafe("blocks/" + p_getIcon_0_); return textureatlassprite; } }
@Override public IBakedModel bake(IModelState state, VertexFormat format, java.util.function.Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state); TRSRTransformation transform = (TRSRTransformation.identity()); ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder(); if (headTexture != null && haftTexture != null && handleTexture != null) { ImmutableList.Builder<ResourceLocation> texBuilder = ImmutableList.builder(); if (haftTexture != null) { texBuilder.add(haftTexture); } if (headTexture != null) { texBuilder.add(headTexture); } if (handleTexture != null) { texBuilder.add(handleTexture); } if (adornmentTexture != null) { texBuilder.add(adornmentTexture); } ImmutableList<ResourceLocation> textures = texBuilder.build(); IBakedModel model = (new ItemLayerModel(textures)).bake(state, format, bakedTextureGetter); builder.addAll(model.getQuads(null, null, 0)); } return new BakedMaceModel(this, builder.build(), format, Maps.immutableEnumMap(transformMap), Maps.<String, IBakedModel>newHashMap()); }
private static TextureAtlasSprite getConnectedTextureHorizontalVertical(ConnectedProperties p_getConnectedTextureHorizontalVertical_0_, IBlockAccess p_getConnectedTextureHorizontalVertical_1_, IBlockState p_getConnectedTextureHorizontalVertical_2_, BlockPos p_getConnectedTextureHorizontalVertical_3_, int p_getConnectedTextureHorizontalVertical_4_, int p_getConnectedTextureHorizontalVertical_5_, TextureAtlasSprite p_getConnectedTextureHorizontalVertical_6_, int p_getConnectedTextureHorizontalVertical_7_) { TextureAtlasSprite[] atextureatlassprite = p_getConnectedTextureHorizontalVertical_0_.tileIcons; TextureAtlasSprite textureatlassprite = getConnectedTextureHorizontal(p_getConnectedTextureHorizontalVertical_0_, p_getConnectedTextureHorizontalVertical_1_, p_getConnectedTextureHorizontalVertical_2_, p_getConnectedTextureHorizontalVertical_3_, p_getConnectedTextureHorizontalVertical_4_, p_getConnectedTextureHorizontalVertical_5_, p_getConnectedTextureHorizontalVertical_6_, p_getConnectedTextureHorizontalVertical_7_); if (textureatlassprite != null && textureatlassprite != p_getConnectedTextureHorizontalVertical_6_ && textureatlassprite != atextureatlassprite[3]) { return textureatlassprite; } else { TextureAtlasSprite textureatlassprite1 = getConnectedTextureVertical(p_getConnectedTextureHorizontalVertical_0_, p_getConnectedTextureHorizontalVertical_1_, p_getConnectedTextureHorizontalVertical_2_, p_getConnectedTextureHorizontalVertical_3_, p_getConnectedTextureHorizontalVertical_4_, p_getConnectedTextureHorizontalVertical_5_, p_getConnectedTextureHorizontalVertical_6_, p_getConnectedTextureHorizontalVertical_7_); return textureatlassprite1 == atextureatlassprite[0] ? atextureatlassprite[4] : (textureatlassprite1 == atextureatlassprite[1] ? atextureatlassprite[5] : (textureatlassprite1 == atextureatlassprite[2] ? atextureatlassprite[6] : textureatlassprite1)); } }
public Builder(IBakedModel p_i46075_1_, TextureAtlasSprite p_i46075_2_) { this(p_i46075_1_.isAmbientOcclusion(), p_i46075_1_.isGui3d(), p_i46075_1_.getItemCameraTransforms()); this.builderTexture = p_i46075_1_.getParticleTexture(); for (EnumFacing enumfacing : EnumFacing.values()) { this.addFaceBreakingFours(p_i46075_1_, p_i46075_2_, enumfacing); } this.addGeneralBreakingFours(p_i46075_1_, p_i46075_2_); }
private void addFaceBreakingFours(IBakedModel p_177649_1_, TextureAtlasSprite p_177649_2_, EnumFacing p_177649_3_) { for (BakedQuad bakedquad : p_177649_1_.getFaceQuads(p_177649_3_)) { this.addFaceQuad(p_177649_3_, new BreakingFour(bakedquad, p_177649_2_)); } }
private void addFaceQuads(IBlockState p_188644_1_, IBakedModel p_188644_2_, TextureAtlasSprite p_188644_3_, EnumFacing p_188644_4_, long p_188644_5_) { for (BakedQuad bakedquad : p_188644_2_.getQuads(p_188644_1_, p_188644_4_, p_188644_5_)) { this.addFaceQuad(p_188644_4_, new BakedQuadRetextured(bakedquad, p_188644_3_)); } }
private void renderPortal(float timeInPortal, ScaledResolution scaledRes) { if (timeInPortal < 1.0F) { timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * timeInPortal; timeInPortal = timeInPortal * 0.8F + 0.2F; } GlStateManager.disableAlpha(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.color(1.0F, 1.0F, 1.0F, timeInPortal); this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(Blocks.PORTAL.getDefaultState()); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMinV(); float f2 = textureatlassprite.getMaxU(); float f3 = textureatlassprite.getMaxV(); Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos(0.0D, (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f, (double)f3).endVertex(); vertexbuffer.pos((double)scaledRes.getScaledWidth(), (double)scaledRes.getScaledHeight(), -90.0D).tex((double)f2, (double)f3).endVertex(); vertexbuffer.pos((double)scaledRes.getScaledWidth(), 0.0D, -90.0D).tex((double)f2, (double)f1).endVertex(); vertexbuffer.pos(0.0D, 0.0D, -90.0D).tex((double)f, (double)f1).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
/** * Sets the texture used by the particle. */ public void setParticleTexture(TextureAtlasSprite texture) { int i = this.getFXLayer(); if (i == 1) { this.particleTexture = texture; } else { throw new RuntimeException("Invalid call to Particle.setTex, use coordinate methods"); } }
protected IBakedModel bakeModel(ModelBlock modelBlockIn, net.minecraftforge.common.model.ITransformation modelRotationIn, boolean uvLocked) { TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName("particle"))); SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(modelBlockIn, modelBlockIn.createOverrides())).setTexture(textureatlassprite); if (modelBlockIn.getElements().isEmpty()) { return null; } else { for (BlockPart blockpart : modelBlockIn.getElements()) { for (EnumFacing enumfacing : blockpart.mapFaces.keySet()) { BlockPartFace blockpartface = (BlockPartFace)blockpart.mapFaces.get(enumfacing); TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)this.sprites.get(new ResourceLocation(modelBlockIn.resolveTextureName(blockpartface.texture))); if (blockpartface.cullFace == null || !net.minecraftforge.common.model.TRSRTransformation.isInteger(modelRotationIn.getMatrix())) { simplebakedmodel$builder.addGeneralQuad(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); } else { simplebakedmodel$builder.addFaceQuad(modelRotationIn.rotate(blockpartface.cullFace), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, modelRotationIn, uvLocked)); } } } return simplebakedmodel$builder.makeBakedModel(); } }
private void func_180474_b(float p_180474_1_, ScaledResolution p_180474_2_) { if (p_180474_1_ < 1.0F) { p_180474_1_ = p_180474_1_ * p_180474_1_; p_180474_1_ = p_180474_1_ * p_180474_1_; p_180474_1_ = p_180474_1_ * 0.8F + 0.2F; } GlStateManager.disableAlpha(); GlStateManager.disableDepth(); GlStateManager.depthMask(false); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(1.0F, 1.0F, 1.0F, p_180474_1_); this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture); TextureAtlasSprite textureatlassprite = this.mc.getBlockRendererDispatcher().getBlockModelShapes() .getTexture(Blocks.portal.getDefaultState()); float f = textureatlassprite.getMinU(); float f1 = textureatlassprite.getMinV(); float f2 = textureatlassprite.getMaxU(); float f3 = textureatlassprite.getMaxV(); Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(0.0D, (double) p_180474_2_.getScaledHeight(), -90.0D).tex((double) f, (double) f3) .endVertex(); worldrenderer.pos((double) p_180474_2_.getScaledWidth(), (double) p_180474_2_.getScaledHeight(), -90.0D) .tex((double) f2, (double) f3).endVertex(); worldrenderer.pos((double) p_180474_2_.getScaledWidth(), 0.0D, -90.0D).tex((double) f2, (double) f1) .endVertex(); worldrenderer.pos(0.0D, 0.0D, -90.0D).tex((double) f, (double) f1).endVertex(); tessellator.draw(); GlStateManager.depthMask(true); GlStateManager.enableDepth(); GlStateManager.enableAlpha(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
/** * Draws a texture rectangle using the texture currently bound to the TextureManager */ public void drawTexturedModalRect(int xCoord, int yCoord, TextureAtlasSprite textureSprite, int widthIn, int heightIn) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos((double)(xCoord + 0), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMaxV()).endVertex(); worldrenderer.pos((double)(xCoord + widthIn), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMaxV()).endVertex(); worldrenderer.pos((double)(xCoord + widthIn), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMinV()).endVertex(); worldrenderer.pos((double)(xCoord + 0), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMinV()).endVertex(); tessellator.draw(); }
/** * Draws a texture rectangle using the texture currently bound to the TextureManager */ public void drawTexturedModalRect(int xCoord, int yCoord, TextureAtlasSprite textureSprite, int widthIn, int heightIn) { Tessellator tessellator = Tessellator.getInstance(); VertexBuffer vertexbuffer = tessellator.getBuffer(); vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX); vertexbuffer.pos((double)(xCoord + 0), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMaxV()).endVertex(); vertexbuffer.pos((double)(xCoord + widthIn), (double)(yCoord + heightIn), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMaxV()).endVertex(); vertexbuffer.pos((double)(xCoord + widthIn), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMaxU(), (double)textureSprite.getMinV()).endVertex(); vertexbuffer.pos((double)(xCoord + 0), (double)(yCoord + 0), (double)this.zLevel).tex((double)textureSprite.getMinU(), (double)textureSprite.getMinV()).endVertex(); tessellator.draw(); }
public void renderBlockDamage(IBlockState state, BlockPos pos, TextureAtlasSprite texture, IBlockAccess blockAccess) { if (state.getRenderType() == EnumBlockRenderType.MODEL) { state = state.getActualState(blockAccess, pos); IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(state); IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(state, ibakedmodel, texture, pos)).makeBakedModel(); this.blockModelRenderer.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getInstance().getBuffer(), true); } }
public BakedQuad(int[] vertexDataIn, int tintIndexIn, EnumFacing faceIn, TextureAtlasSprite spriteIn) { this.vertexData = vertexDataIn; this.tintIndex = tintIndexIn; this.face = faceIn; this.sprite = spriteIn; this.fixVertexData(); }
@Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { super.drawGuiContainerForegroundLayer(mouseX, mouseY); FluidStack content = tank.getTank().getFluid(); if(content != null && content.amount > 0) { int fluidColor = content.getFluid().getColor(content); float red = (fluidColor >> 16 & 0xFF) / 255F; float green = (fluidColor >> 8 & 0xFF) / 255F; float blue = (fluidColor & 0xFF) / 255F; float percFilled = ((float) content.amount) / ((float) tank.getTank().getCapacity()); percFilled = MathHelper.clamp(percFilled, 0F, 1F); int pxFilled = MathHelper.ceil(percFilled * 61F); GlStateManager.color(red, green, blue, 1.0F); ResourceLocation rl = content.getFluid().getStill(content); TextureAtlasSprite tas = Minecraft.getMinecraft().getTextureMapBlocks().getTextureExtry(rl.toString()); if(tas == null) { tas = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite(); } this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); drawTexturedModalRect(15, 10 + 61 - pxFilled, tas, 20, pxFilled); } else if (ModularMachinery.isMekanismLoaded){ drawMekGasContent(); } GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(TEXTURES_FLUID_HATCH); this.drawTexturedModalRect(15, 10, 176, 0, 20, 61); }