當前位置: 首頁>>代碼示例>>Java>>正文


Java DynamicTexture類代碼示例

本文整理匯總了Java中net.minecraft.client.renderer.texture.DynamicTexture的典型用法代碼示例。如果您正苦於以下問題:Java DynamicTexture類的具體用法?Java DynamicTexture怎麽用?Java DynamicTexture使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DynamicTexture類屬於net.minecraft.client.renderer.texture包,在下文中一共展示了DynamicTexture類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: downloadMap

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public void downloadMap(@Nullable String fileName, @Nullable Integer scaledRes) {
    if (MC.player == null || !(MC.player.getHeldItemMainhand().getItem() instanceof ItemMap)) return;

    ItemMap map = (ItemMap) MC.player.getHeldItemMainhand().getItem();
    MapData heldMapData = map.getMapData(MC.player.getHeldItemMainhand(), MC.world);

    if (fileName == null) fileName = heldMapData.mapName;

    ResourceLocation location = findResourceLocation(heldMapData.mapName);
    if (location == null) {
        Helper.printMessage("Failed to find ResourceLocation");
        return;
    }

    DynamicTexture texture = (DynamicTexture)MC.getTextureManager().getTexture(location);
    BufferedImage image = dynamicToImage(texture);
    if (scaledRes != null) image = createResizedCopy(image, scaledRes, scaledRes, true);

    saveImage(fileName, image);
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:21,代碼來源:MapDownloader.java

示例2: onLoad

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
@Override
public void onLoad() {
    MC.addScheduledTask(() -> {
        try {
            BufferedImage image = getImageFromUrl(waifuUrl);
            if (image == null) { LOGGER.warn("Failed to download waifu image"); return; }

            DynamicTexture dynamicTexture = new DynamicTexture(image);
            dynamicTexture.loadTexture(MC.getResourceManager());
            waifu = MC.getTextureManager().getDynamicTextureLocation("WAIFU", dynamicTexture);
        } catch (Exception e) {
            e.printStackTrace();
        }

    });
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:17,代碼來源:WaifuESP.java

示例3: EntityRenderer

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn)
{
    this.shaderIndex = shaderCount;
    this.useShader = false;
    this.frameCount = 0;
    this.mc = mcIn;
    this.resourceManager = resourceManagerIn;
    this.itemRenderer = mcIn.getItemRenderer();
    this.theMapItemRenderer = new MapItemRenderer(mcIn.getTextureManager());
    this.lightmapTexture = new DynamicTexture(16, 16);
    this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture);
    this.lightmapColors = this.lightmapTexture.getTextureData();
    this.theShaderGroup = null;

    for (int i = 0; i < 32; ++i)
    {
        for (int j = 0; j < 32; ++j)
        {
            float f = (float)(j - 16);
            float f1 = (float)(i - 16);
            float f2 = MathHelper.sqrt_float(f * f + f1 * f1);
            this.rainXCoords[i << 5 | j] = -f1 / f2;
            this.rainYCoords[i << 5 | j] = f / f2;
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:EntityRenderer.java

示例4: initDynamicTexture

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public static void initDynamicTexture(int texID, int width, int height, DynamicTexture tex)
{
    MultiTexID multitexid = tex.getMultiTexID();
    int[] aint = tex.getTextureData();
    int i = width * height;
    Arrays.fill(aint, i, i * 2, -8421377);
    Arrays.fill((int[])aint, i * 2, i * 3, (int)0);
    TextureUtil.allocateTexture(multitexid.base, width, height);
    TextureUtil.setTextureBlurMipmap(false, false);
    TextureUtil.setTextureClamped(false);
    TextureUtil.allocateTexture(multitexid.norm, width, height);
    TextureUtil.setTextureBlurMipmap(false, false);
    TextureUtil.setTextureClamped(false);
    TextureUtil.allocateTexture(multitexid.spec, width, height);
    TextureUtil.setTextureBlurMipmap(false, false);
    TextureUtil.setTextureClamped(false);
    GlStateManager.bindTexture(multitexid.base);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:ShadersTex.java

示例5: EntityRenderer

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) {
	this.shaderIndex = shaderCount;
	this.useShader = false;
	this.frameCount = 0;
	this.mc = mcIn;
	this.resourceManager = resourceManagerIn;
	this.itemRenderer = mcIn.getItemRenderer();
	this.theMapItemRenderer = new MapItemRenderer(mcIn.getTextureManager());
	this.lightmapTexture = new DynamicTexture(16, 16);
	this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture);
	this.lightmapColors = this.lightmapTexture.getTextureData();
	this.theShaderGroup = null;

	for (int i = 0; i < 32; ++i) {
		for (int j = 0; j < 32; ++j) {
			float f = (float) (j - 16);
			float f1 = (float) (i - 16);
			float f2 = MathHelper.sqrt_float(f * f + f1 * f1);
			this.rainXCoords[i << 5 | j] = -f1 / f2;
			this.rainYCoords[i << 5 | j] = f / f2;
		}
	}
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:24,代碼來源:EntityRenderer.java

示例6: handleImage

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
public static void handleImage(LImage img) {
	if (isImageHandled(img)) {
		return;
	}
	try {
		LithiumMod.log("Loading image for control with UUID[" + img.getUUID() + "].");
		handledControls.add(img.getUUID());
		bufferedImages.put(img.getUUID(), new DynamicTexture(ImageIO.read(new URL(img.getImageURL()))));
		LithiumMod.log("Finished loading image for control with UUID[" + img.getUUID() + "].");

	} catch (IOException e) {
		LithiumMod.log("An error occured while trying to load image for control with UUID[" + img.getUUID() + "].");
		e.printStackTrace();
	}
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Forge,代碼行數:17,代碼來源:ImageManager.java

示例7: renderLithiumControl

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@Override
public void renderLithiumControl(LImage control, GuiScreen gui) {
    Point loc = NewLithiumGUI.centerControl(control);

    //Ask ImageManager to give us a dynamic texture
    DynamicTexture imageTexture = ImageManager.getDynamicTexture(control);
    if (imageTexture != null) {
        //Get Minecraft's texture manager
        TextureManager textureManager = ModCoderPackUtils.getTextureManager();

        //Bind the texture. (In other words, tell Minecraft to use this texture)
        textureManager.bindTexture(textureManager.getDynamicTextureLocation(control.getUUID().toString(), imageTexture));
        //Correct colors
        GlStateManager.color(1, 1, 1, 1);
        //Draw the image to the screen
        Gui.drawModalRectWithCustomSizedTexture(loc.getX(), loc.getY(), 0.0F, 0.0F, control.getSize().getWidth(), control.getSize().getHeight(), control.getSize().getWidth(), control.getSize().getHeight());
    }
}
 
開發者ID:NickAcPT,項目名稱:Lithium-Forge,代碼行數:20,代碼來源:ImageRenderer.java

示例8: EntityRenderer

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn)
{
    this.shaderIndex = SHADER_COUNT;
    this.mc = mcIn;
    this.resourceManager = resourceManagerIn;
    this.itemRenderer = mcIn.getItemRenderer();
    this.theMapItemRenderer = new MapItemRenderer(mcIn.getTextureManager());
    this.lightmapTexture = new DynamicTexture(16, 16);
    this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture);
    this.lightmapColors = this.lightmapTexture.getTextureData();
    this.theShaderGroup = null;

    for (int i = 0; i < 32; ++i)
    {
        for (int j = 0; j < 32; ++j)
        {
            float f = (float)(j - 16);
            float f1 = (float)(i - 16);
            float f2 = MathHelper.sqrt(f * f + f1 * f1);
            this.rainXCoords[i << 5 | j] = -f1 / f2;
            this.rainYCoords[i << 5 | j] = f / f2;
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:25,代碼來源:EntityRenderer.java

示例9: EntityRenderer

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn)
{
    this.shaderIndex = SHADER_COUNT;
    this.mc = mcIn;
    this.resourceManager = resourceManagerIn;
    this.itemRenderer = mcIn.getItemRenderer();
    this.theMapItemRenderer = new MapItemRenderer(mcIn.getTextureManager());
    this.lightmapTexture = new DynamicTexture(16, 16);
    this.locationLightMap = mcIn.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture);
    this.lightmapColors = this.lightmapTexture.getTextureData();
    this.theShaderGroup = null;

    for (int i = 0; i < 32; ++i)
    {
        for (int j = 0; j < 32; ++j)
        {
            float f = (float)(j - 16);
            float f1 = (float)(i - 16);
            float f2 = MathHelper.sqrt_float(f * f + f1 * f1);
            this.rainXCoords[i << 5 | j] = -f1 / f2;
            this.rainYCoords[i << 5 | j] = f / f2;
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:25,代碼來源:EntityRenderer.java

示例10: render

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public void render(int x, int y, int mouseX, int mouseY) {
	rc = txt.getDynamicTextureLocation(c.toString(), new DynamicTexture(img));
	if (!frame.isVisible()) frame.setVisible(true);

	if (rc != null) {
		mc.getRenderManager().renderEngine.bindTexture(rc);
		drawRectWithFullTexture(x, y, width, height);
		txt.deleteTexture(rc);
	}
	if (mouseX >= x && mouseY >= y && mouseX < x + this.width && mouseY < y + this.height) {
		if (mouseX != lastMouseX && mouseY != lastMouseY) {
			if (c instanceof BrowserView) {
				Point p = new Point(Math.round(SwingUtils.map(mouseX - x, 0, width, 0, c.getWidth())), Math.round(SwingUtils.map(mouseY - y, 0, height, 0, c.getHeight())));

				Point globalP = p.getLocation();
				SwingUtilities.convertPointToScreen(globalP, c);

				BrowserView view = (BrowserView) c;

				SwingUtils.forwardMouseMoveEvent(view.getBrowser(), p.x, p.y, globalP.x, globalP.y);
			}
		}
	}
	lastMouseX = mouseX;
	lastMouseY = mouseY;
}
 
開發者ID:lukas2005,項目名稱:Device-Mod-Apps,代碼行數:27,代碼來源:SwingWrapper.java

示例11: resetClientBody

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
   public static void resetClientBody()
   {
	ClientProxyCore.overworldTextureRequestSent = false;
	ClientProxyCore.overworldTexturesValid = false;
	clientRequests.clear();
       File baseFolder = new File(FMLClientHandler.instance().getClient().mcDataDir, "assets/temp");
       if (baseFolder.exists() && baseFolder.isDirectory())
       {
       	for (File f : baseFolder.listFiles())
       	     if (f.isFile()) f.delete();        	
       }
	GalacticraftCore.packetPipeline.sendToServer(new PacketSimple(PacketSimple.EnumSimplePacket.S_REQUEST_OVERWORLD_IMAGE, new Object[] {}));
	DrawGameScreen.reusableMap = new DynamicTexture(MapUtil.SIZE_STD2, MapUtil.SIZE_STD2);
	MapUtil.biomeColours.clear();
	setupColours();
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:18,代碼來源:MapUtil.java

示例12: EntityRenderer

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public EntityRenderer(Minecraft p_i45076_1_, IResourceManager p_i45076_2_)
{
	this.shaderIndex = shaderCount;
	this.cameraZoom = 1.0D;
	this.prevFrameTime = Minecraft.getSystemTime();
	this.random = new Random();
	this.fogColorBuffer = GLAllocation.createDirectFloatBuffer(16);
	this.mc = p_i45076_1_;
	this.resourceManager = p_i45076_2_;
	this.theMapItemRenderer = new MapItemRenderer(p_i45076_1_.getTextureManager());
	this.itemRenderer = new ItemRenderer(p_i45076_1_);
	this.lightmapTexture = new DynamicTexture(16, 16);
	this.locationLightMap = p_i45076_1_.getTextureManager().getDynamicTextureLocation("lightMap", this.lightmapTexture);
	this.lightmapColors = this.lightmapTexture.getTextureData();
	this.theShaderGroup = null;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:17,代碼來源:EntityRenderer.java

示例13: generateQrCode

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public void generateQrCode() {
    if (mResourceLocation != null) {
        return;
    }

    BufferedImage bufferedImage = null;
    File imageFile = QRCode.from(mIpAddress).to(ImageType.PNG).withSize(256, 256).file();

    try {
        bufferedImage = ImageIO.read(imageFile);
    } catch (IOException e) {
        e.printStackTrace();
    }

    mResourceLocation = Minecraft.getMinecraft().renderEngine.getDynamicTextureLocation(imageFile.getName(), new DynamicTexture(bufferedImage));
}
 
開發者ID:RemotecraftProject,項目名稱:RemotecraftMod,代碼行數:17,代碼來源:QrCodeManager.java

示例14: convertTextureToGrayScale

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
public static void convertTextureToGrayScale() throws IOException
{
    IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager();
    try
    {
        BufferedImage vanillaCreeperTextureData = TextureUtil.readBufferedImage(resourceManager.getResource(vanillaCreeperTexture).getInputStream());

        // Do the conversion to grayscale
        BufferedImage creeperTextureData = new BufferedImage(vanillaCreeperTextureData.getWidth(), vanillaCreeperTextureData.getHeight(), BufferedImage.TYPE_USHORT_GRAY);
        Graphics g = creeperTextureData.getGraphics();
        g.drawImage(vanillaCreeperTextureData, 0, 0, null);
        g.dispose();

        DynamicTexture dynamicGrayscaleCreeperTexture = new DynamicTexture(creeperTextureData);

        grayscaleCreeperTexture = new ResourceLocation(ChameleonCreepersMod.MODID, "textures/entity/creeper/chameleoncreeper.png");
        Minecraft.getMinecraft().getTextureManager().loadTexture(grayscaleCreeperTexture, dynamicGrayscaleCreeperTexture);
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}
 
開發者ID:VelocityRa,項目名稱:ChameleonCreepersMod,代碼行數:24,代碼來源:RenderChameleonCreeper.java

示例15: getLogoTexture

import net.minecraft.client.renderer.texture.DynamicTexture; //導入依賴的package包/類
@Override
@Strippable(side = Side.CLIENT)
public ResourceLocation getLogoTexture() {
    if (this.logo == null) {
        try {
            URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
            InputStream stream = new URL(url.toString() + "/logo.png").openStream();
            BufferedImage image = ImageIO.read(stream);
            DynamicTexture texture = new DynamicTexture(image);
            this.logo = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("mods/" + getModID(), texture);
            stream.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
    return logo;
}
 
開發者ID:OpenModLoader,項目名稱:OpenModLoader,代碼行數:18,代碼來源:OMLModInfo.java


注:本文中的net.minecraft.client.renderer.texture.DynamicTexture類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。