use of net.minecraft.client.renderer.texture.SimpleTexture in project blockbuster by mchorse.
the class URLDownloadThread method addToManager.
public static void addToManager(ResourceLocation url, InputStream is) throws IOException {
BufferedImage image = ImageIO.read(is);
SimpleTexture texture = new SimpleTexture(url);
TextureUtil.uploadTextureImageAllocate(texture.getGlTextureId(), image, false, false);
TextureManager manager = Minecraft.getMinecraft().renderEngine;
Map<ResourceLocation, ITextureObject> map = ReflectionUtils.getTextures(manager);
map.put(url, texture);
}
use of net.minecraft.client.renderer.texture.SimpleTexture in project GregTech by GregTechCEu.
the class GTLaserBeamParticle method renderParticle.
@Override
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
GlStateManager.translate(posX - interpPosX, posY - interpPosY, posZ - interpPosZ);
Vector3 cameraDirection = null;
if (!doubleVertical) {
cameraDirection = new Vector3(posX, posY, posZ).subtract(new Vector3(entityIn.getPositionEyes(partialTicks)));
}
TextureManager renderEngine = MINECRAFT.getRenderManager().renderEngine;
ITextureObject bodyTexture = null;
if (body != null) {
bodyTexture = renderEngine.getTexture(body);
if (bodyTexture == null) {
bodyTexture = new SimpleTexture(body);
renderEngine.loadTexture(body, bodyTexture);
}
}
ITextureObject headTexture = null;
if (head != null) {
headTexture = renderEngine.getTexture(head);
if (headTexture == null) {
headTexture = new SimpleTexture(head);
renderEngine.loadTexture(head, headTexture);
}
}
float offset = -emit * (MINECRAFT.player.ticksExisted + partialTicks);
LaserBeamRenderer.renderRawBeam(bodyTexture == null ? -1 : bodyTexture.getGlTextureId(), headTexture == null ? -1 : headTexture.getGlTextureId(), direction, cameraDirection, beamHeight, headWidth, alpha, offset);
GlStateManager.translate(interpPosX - posX, interpPosY - posY, interpPosZ - posZ);
}
use of net.minecraft.client.renderer.texture.SimpleTexture in project MCMOD-Industria by M-Marvin.
the class AnimatedTexture method load.
public void load(IResourceManager manager) throws IOException {
SimpleTexture.TextureData simpletexture$texturedata = this.getTextureImage(manager);
simpletexture$texturedata.throwIfError();
TextureMetadataSection texturemetadatasection = simpletexture$texturedata.getTextureMetadata();
boolean flag;
boolean flag1;
if (texturemetadatasection != null) {
flag = texturemetadatasection.isBlur();
flag1 = texturemetadatasection.isClamp();
} else {
flag = false;
flag1 = false;
}
NativeImage nativeimage = simpletexture$texturedata.getImage();
if (!RenderSystem.isOnRenderThreadOrInit()) {
RenderSystem.recordRenderCall(() -> {
this.loadImage(nativeimage, flag, flag1);
});
} else {
this.loadImage(nativeimage, flag, flag1);
}
this.size = simpletexture$texturedata.getImage().getWidth();
this.textureHeight = simpletexture$texturedata.getImage().getHeight();
ResourceLocation metadataFile = new ResourceLocation(this.location.getNamespace(), this.location.getPath() + ".mcmeta");
try {
IResource metadataResource = manager.getResource(metadataFile);
InputStreamReader inputStreamReader = new InputStreamReader(metadataResource.getInputStream());
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
StringBuffer stringBuffer = new StringBuffer();
String string;
while ((string = bufferedReader.readLine()) != null) {
stringBuffer.append(string);
}
CompoundNBT metadataNBT = JsonToNBT.parseTag(stringBuffer.toString());
CompoundNBT animation = metadataNBT.getCompound("animation");
this.frameTime = animation.getInt("frametime");
if (animation.contains("frames")) {
ListNBT arr = animation.getList("frames", 3);
frames = new int[arr.size()];
for (int i = 0; i < arr.size(); i++) {
this.frames[i] = arr.getInt(i);
}
} else {
int height = simpletexture$texturedata.getImage().getHeight();
int frameCount = height / size;
frames = new int[frameCount];
for (int i = 0; i < frameCount; i++) {
this.frames[i] = i;
}
}
} catch (CommandSyntaxException | FileNotFoundException e) {
this.frames = new int[] { 0 };
this.frameTime = 1;
}
}
Aggregations