use of net.minecraft.client.renderer.texture.AbstractTexture in project RebornCore by TechReborn.
the class RebornItemStackRenderer method renderByItem.
@Override
public void renderByItem(ItemStack itemStackIn) {
if (itemStackIn.getItem() == Items.SHIELD) {
boolean isCustom = !ItemNBTHelper.getBoolean(itemStackIn, "vanilla", false);
if (isCustom) {
ResourceLocation location = null;
String str = ItemNBTHelper.getString(itemStackIn, "type", "vanilla");
if (ShieldJsonLoader.shieldJsonFile == null || ShieldJsonLoader.shieldJsonFile.userList == null) {
renderer.renderByItem(itemStackIn);
return;
}
for (ShieldUser user : ShieldJsonLoader.shieldJsonFile.userList) {
if (user.username.equalsIgnoreCase(str)) {
location = new ResourceLocation("LOOKUP:" + str);
}
}
if (location == null) {
renderer.renderByItem(itemStackIn);
return;
}
ShieldTexture shieldTexture = ShieldTextureStore.getTexture(str);
if (shieldTexture != null) {
if (shieldTexture.getState() == DownloadState.DOWNLOADED) {
if (customTextureMap.containsKey(location.getResourcePath())) {
Minecraft.getMinecraft().getTextureManager().bindTexture(location);
} else {
AbstractTexture texture = shieldTexture.getTexture();
customTextureMap.put(location.getResourcePath(), texture);
final ResourceLocation resourceLocation = location;
THREAD_POOL.submit((Runnable) () -> Minecraft.getMinecraft().addScheduledTask((Runnable) () -> Minecraft.getMinecraft().getTextureManager().loadTexture(resourceLocation, texture)));
Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE);
}
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE);
}
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE);
}
} else {
renderer.renderByItem(itemStackIn);
return;
}
GlStateManager.pushMatrix();
GlStateManager.scale(1.0F, -1.0F, -1.0F);
modelShield.render();
GlStateManager.popMatrix();
return;
}
renderer.renderByItem(itemStackIn);
}
Aggregations