2012-08-06 10:35:57 +00:00
|
|
|
package net.minecraftforge.client;
|
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import static net.minecraftforge.common.ForgeVersion.Status.BETA;
|
|
|
|
import static net.minecraftforge.common.ForgeVersion.Status.BETA_OUTDATED;
|
2014-12-28 04:10:54 +00:00
|
|
|
import static org.lwjgl.opengl.GL11.*;
|
|
|
|
import static org.lwjgl.opengl.GL20.*;
|
|
|
|
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
import java.nio.FloatBuffer;
|
2015-09-02 04:26:42 +00:00
|
|
|
import java.util.Map;
|
2014-12-28 04:10:54 +00:00
|
|
|
|
|
|
|
import javax.vecmath.Matrix4f;
|
2015-02-14 01:44:09 +00:00
|
|
|
import javax.vecmath.Vector3d;
|
|
|
|
import javax.vecmath.Vector4f;
|
2014-12-28 04:10:54 +00:00
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.client.Minecraft;
|
2014-04-03 10:12:22 +00:00
|
|
|
import net.minecraft.client.audio.ISound;
|
|
|
|
import net.minecraft.client.audio.SoundEventAccessorComposite;
|
|
|
|
import net.minecraft.client.audio.SoundManager;
|
2013-12-25 08:35:59 +00:00
|
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
|
|
import net.minecraft.client.gui.GuiMainMenu;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.client.gui.GuiScreen;
|
|
|
|
import net.minecraft.client.model.ModelBase;
|
|
|
|
import net.minecraft.client.renderer.EntityRenderer;
|
2014-12-28 04:10:54 +00:00
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
|
|
|
import net.minecraft.client.renderer.OpenGlHelper;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.client.renderer.RenderGlobal;
|
2015-02-17 01:56:32 +00:00
|
|
|
import net.minecraft.client.renderer.WorldRenderer;
|
|
|
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
2014-12-28 04:10:54 +00:00
|
|
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
|
|
|
import net.minecraft.client.renderer.block.model.ItemTransformVec3f;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderItem;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.client.renderer.texture.TextureManager;
|
|
|
|
import net.minecraft.client.renderer.texture.TextureMap;
|
2015-09-02 04:26:42 +00:00
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
2014-12-28 04:10:54 +00:00
|
|
|
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
|
|
|
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.client.resources.I18n;
|
2014-12-28 04:10:54 +00:00
|
|
|
import net.minecraft.client.resources.model.IBakedModel;
|
2014-11-27 03:56:35 +00:00
|
|
|
import net.minecraft.client.resources.model.ModelBakery;
|
|
|
|
import net.minecraft.client.resources.model.ModelManager;
|
2015-02-14 01:44:09 +00:00
|
|
|
import net.minecraft.client.resources.model.ModelRotation;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.client.settings.GameSettings;
|
2013-04-05 00:28:50 +00:00
|
|
|
import net.minecraft.entity.Entity;
|
2013-06-30 12:50:11 +00:00
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
2012-12-13 05:58:35 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-09-02 04:26:42 +00:00
|
|
|
import net.minecraft.item.Item;
|
2012-12-13 05:58:35 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
2015-09-02 04:26:42 +00:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.util.BlockPos;
|
2013-12-25 08:35:59 +00:00
|
|
|
import net.minecraft.util.EnumChatFormatting;
|
2015-06-28 22:19:10 +00:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2014-12-26 05:39:12 +00:00
|
|
|
import net.minecraft.util.EnumWorldBlockLayer;
|
2014-11-27 03:56:35 +00:00
|
|
|
import net.minecraft.util.IRegistry;
|
2012-12-13 05:58:35 +00:00
|
|
|
import net.minecraft.util.MovingObjectPosition;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2013-09-14 03:11:59 +00:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraft.world.biome.BiomeGenBase;
|
2012-08-23 01:02:14 +00:00
|
|
|
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
|
|
|
import net.minecraftforge.client.event.FOVUpdateEvent;
|
|
|
|
import net.minecraftforge.client.event.GuiScreenEvent;
|
2014-11-27 03:56:35 +00:00
|
|
|
import net.minecraftforge.client.event.ModelBakeEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.client.event.MouseEvent;
|
2014-02-21 17:13:40 +00:00
|
|
|
import net.minecraftforge.client.event.RenderHandEvent;
|
2012-08-23 01:02:14 +00:00
|
|
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
2013-03-18 03:07:30 +00:00
|
|
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
2014-12-28 04:10:54 +00:00
|
|
|
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
2015-02-04 06:45:23 +00:00
|
|
|
import net.minecraftforge.client.model.ModelLoader;
|
2013-12-13 07:32:36 +00:00
|
|
|
import net.minecraftforge.common.ForgeModContainer;
|
2013-12-25 08:35:59 +00:00
|
|
|
import net.minecraftforge.common.ForgeVersion;
|
|
|
|
import net.minecraftforge.common.ForgeVersion.Status;
|
2012-08-07 08:24:06 +00:00
|
|
|
import net.minecraftforge.common.MinecraftForge;
|
2015-01-16 22:30:00 +00:00
|
|
|
import net.minecraftforge.fluids.FluidRegistry;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
2014-12-28 04:10:54 +00:00
|
|
|
import net.minecraftforge.fml.common.FMLLog;
|
2014-11-27 03:56:35 +00:00
|
|
|
|
2014-12-28 04:10:54 +00:00
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
|
import org.lwjgl.BufferUtils;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
//import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
|
|
|
|
//import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
|
2012-08-06 10:35:57 +00:00
|
|
|
|
2015-06-28 22:19:10 +00:00
|
|
|
|
2015-09-02 04:26:42 +00:00
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
2012-08-06 10:35:57 +00:00
|
|
|
public class ForgeHooksClient
|
|
|
|
{
|
2014-01-18 05:55:48 +00:00
|
|
|
//private static final ResourceLocation ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
2014-06-30 01:42:48 +00:00
|
|
|
|
2013-06-30 12:50:11 +00:00
|
|
|
static TextureManager engine()
|
2012-09-09 14:02:21 +00:00
|
|
|
{
|
|
|
|
return FMLClientHandler.instance().getClient().renderEngine;
|
|
|
|
}
|
2012-08-06 10:35:57 +00:00
|
|
|
|
2013-07-24 20:12:38 +00:00
|
|
|
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, String type)
|
|
|
|
{
|
|
|
|
String result = armor.getItem().getArmorTexture(armor, entity, slot, type);
|
2013-04-05 00:28:50 +00:00
|
|
|
return result != null ? result : _default;
|
2012-08-07 00:52:23 +00:00
|
|
|
}
|
2012-08-07 08:24:06 +00:00
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
/*
|
|
|
|
* Removed, Modders let me know if this is needed anymore.
|
2013-12-21 08:10:35 +00:00
|
|
|
public static boolean renderEntityItem(EntityItem entity, ItemStack item, float bobing, float rotation, Random random, TextureManager engine, RenderBlocks renderBlocks, int count)
|
2012-08-07 08:24:06 +00:00
|
|
|
{
|
|
|
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, ENTITY);
|
|
|
|
if (customRenderer == null)
|
|
|
|
{
|
2012-12-18 14:56:28 +00:00
|
|
|
return false;
|
2012-08-07 08:24:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_ROTATION))
|
|
|
|
{
|
|
|
|
GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
|
|
|
|
}
|
|
|
|
if (!customRenderer.shouldUseRenderHelper(ENTITY, item, ENTITY_BOBBING))
|
|
|
|
{
|
|
|
|
GL11.glTranslatef(0.0F, -bobing, 0.0F);
|
|
|
|
}
|
|
|
|
boolean is3D = customRenderer.shouldUseRenderHelper(ENTITY, item, BLOCK_3D);
|
2012-08-23 01:02:14 +00:00
|
|
|
|
2013-09-03 19:52:58 +00:00
|
|
|
engine.bindTexture(item.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
2014-02-05 08:05:37 +00:00
|
|
|
Block block = item.getItem() instanceof ItemBlock ? Block.getBlockFromItem(item.getItem()) : null;
|
|
|
|
if (is3D || (block != null && RenderBlocks.renderItemIn3d(block.getRenderType())))
|
2012-08-07 08:24:06 +00:00
|
|
|
{
|
2014-02-05 08:05:37 +00:00
|
|
|
int renderType = (block != null ? block.getRenderType() : 1);
|
2012-08-07 08:24:06 +00:00
|
|
|
float scale = (renderType == 1 || renderType == 19 || renderType == 12 || renderType == 2 ? 0.5F : 0.25F);
|
2014-02-05 08:05:37 +00:00
|
|
|
boolean blend = block != null && block.getRenderBlockPass() > 0;
|
2012-08-07 08:24:06 +00:00
|
|
|
|
2013-03-20 01:09:34 +00:00
|
|
|
if (RenderItem.renderInFrame)
|
2013-02-15 12:10:49 +00:00
|
|
|
{
|
|
|
|
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
|
|
|
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
|
|
|
|
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
|
|
|
}
|
|
|
|
|
2013-12-21 08:10:35 +00:00
|
|
|
if (blend)
|
|
|
|
{
|
|
|
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
|
|
|
GL11.glEnable(GL11.GL_BLEND);
|
2014-02-05 08:05:37 +00:00
|
|
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
2013-12-21 08:10:35 +00:00
|
|
|
}
|
2013-07-08 21:30:25 +00:00
|
|
|
|
2013-12-21 08:10:35 +00:00
|
|
|
GL11.glScalef(scale, scale, scale);
|
2012-09-09 14:02:21 +00:00
|
|
|
|
2012-09-17 07:25:26 +00:00
|
|
|
for(int j = 0; j < count; j++)
|
2012-08-07 08:24:06 +00:00
|
|
|
{
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
if (j > 0)
|
|
|
|
{
|
|
|
|
GL11.glTranslatef(
|
2013-05-19 20:22:12 +00:00
|
|
|
((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
|
|
|
|
((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale,
|
|
|
|
((random.nextFloat() * 2.0F - 1.0F) * 0.2F) / scale);
|
2012-08-07 08:24:06 +00:00
|
|
|
}
|
|
|
|
customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
2013-12-21 08:10:35 +00:00
|
|
|
|
|
|
|
if (blend)
|
|
|
|
{
|
|
|
|
GL11.glDisable(GL11.GL_BLEND);
|
|
|
|
}
|
2012-08-07 08:24:06 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
|
|
|
customRenderer.renderItem(ENTITY, item, renderBlocks, entity);
|
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2012-08-07 08:24:06 +00:00
|
|
|
return true;
|
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
*/
|
2012-09-09 14:02:21 +00:00
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
/*
|
2013-06-30 12:50:11 +00:00
|
|
|
public static boolean renderInventoryItem(RenderBlocks renderBlocks, TextureManager engine, ItemStack item, boolean inColor, float zLevel, float x, float y)
|
2012-08-07 08:24:06 +00:00
|
|
|
{
|
|
|
|
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(item, INVENTORY);
|
|
|
|
if (customRenderer == null)
|
|
|
|
{
|
2013-03-19 20:49:31 +00:00
|
|
|
return false;
|
2012-08-07 08:24:06 +00:00
|
|
|
}
|
|
|
|
|
2013-09-03 19:52:58 +00:00
|
|
|
engine.bindTexture(item.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
2012-08-07 08:24:06 +00:00
|
|
|
if (customRenderer.shouldUseRenderHelper(INVENTORY, item, INVENTORY_BLOCK))
|
|
|
|
{
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glTranslatef(x - 2, y + 3, -3.0F + zLevel);
|
|
|
|
GL11.glScalef(10F, 10F, 10F);
|
|
|
|
GL11.glTranslatef(1.0F, 0.5F, 1.0F);
|
|
|
|
GL11.glScalef(1.0F, 1.0F, -1F);
|
|
|
|
GL11.glRotatef(210F, 1.0F, 0.0F, 0.0F);
|
|
|
|
GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
|
2012-08-23 01:02:14 +00:00
|
|
|
|
2012-08-07 08:24:06 +00:00
|
|
|
if(inColor)
|
|
|
|
{
|
2013-12-21 08:10:35 +00:00
|
|
|
int color = item.getItem().getColorFromItemStack(item, 0);
|
2012-08-07 08:24:06 +00:00
|
|
|
float r = (float)(color >> 16 & 0xff) / 255F;
|
|
|
|
float g = (float)(color >> 8 & 0xff) / 255F;
|
|
|
|
float b = (float)(color & 0xff) / 255F;
|
|
|
|
GL11.glColor4f(r, g, b, 1.0F);
|
|
|
|
}
|
2012-08-23 01:02:14 +00:00
|
|
|
|
2012-08-07 08:24:06 +00:00
|
|
|
GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
|
2014-02-05 08:05:37 +00:00
|
|
|
renderBlocks.useInventoryTint = inColor;
|
2012-08-07 08:24:06 +00:00
|
|
|
customRenderer.renderItem(INVENTORY, item, renderBlocks);
|
2014-02-05 08:05:37 +00:00
|
|
|
renderBlocks.useInventoryTint = true;
|
2012-08-07 08:24:06 +00:00
|
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GL11.glDisable(GL11.GL_LIGHTING);
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glTranslatef(x, y, -3.0F + zLevel);
|
|
|
|
|
|
|
|
if (inColor)
|
|
|
|
{
|
2013-12-21 08:10:35 +00:00
|
|
|
int color = item.getItem().getColorFromItemStack(item, 0);
|
2012-08-07 08:24:06 +00:00
|
|
|
float r = (float)(color >> 16 & 255) / 255.0F;
|
|
|
|
float g = (float)(color >> 8 & 255) / 255.0F;
|
|
|
|
float b = (float)(color & 255) / 255.0F;
|
|
|
|
GL11.glColor4f(r, g, b, 1.0F);
|
|
|
|
}
|
|
|
|
|
|
|
|
customRenderer.renderItem(INVENTORY, item, renderBlocks);
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
GL11.glEnable(GL11.GL_LIGHTING);
|
|
|
|
}
|
2013-07-08 21:30:25 +00:00
|
|
|
|
2012-08-07 08:24:06 +00:00
|
|
|
return true;
|
|
|
|
}
|
2013-05-04 20:59:47 +00:00
|
|
|
|
2013-07-04 04:14:59 +00:00
|
|
|
public static void renderEffectOverlay(TextureManager manager, RenderItem render)
|
2012-08-07 08:24:06 +00:00
|
|
|
{
|
2013-05-04 20:59:47 +00:00
|
|
|
}
|
|
|
|
|
2013-06-30 12:50:11 +00:00
|
|
|
public static void renderEquippedItem(ItemRenderType type, IItemRenderer customRenderer, RenderBlocks renderBlocks, EntityLivingBase entity, ItemStack item)
|
2013-05-04 20:59:47 +00:00
|
|
|
{
|
|
|
|
if (customRenderer.shouldUseRenderHelper(type, item, EQUIPPED_BLOCK))
|
2012-08-07 08:24:06 +00:00
|
|
|
{
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
2013-05-04 20:59:47 +00:00
|
|
|
customRenderer.renderItem(type, item, renderBlocks, entity);
|
2012-08-07 08:24:06 +00:00
|
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
|
|
|
GL11.glTranslatef(0.0F, -0.3F, 0.0F);
|
|
|
|
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
|
|
|
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
|
|
|
|
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
|
|
|
|
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
|
2013-05-04 20:59:47 +00:00
|
|
|
customRenderer.renderItem(type, item, renderBlocks, entity);
|
2012-08-07 08:24:06 +00:00
|
|
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
}*/
|
2012-08-23 01:02:14 +00:00
|
|
|
|
|
|
|
//Optifine Helper Functions u.u, these are here specifically for Optifine
|
|
|
|
//Note: When using Optfine, these methods are invoked using reflection, which
|
|
|
|
//incurs a major performance penalty.
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public static void orientBedCamera(IBlockAccess world, BlockPos pos, IBlockState state, Entity entity)
|
2012-08-23 01:02:14 +00:00
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
Block block = state.getBlock();
|
2012-08-23 01:02:14 +00:00
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
if (block != null && block.isBed(world, pos, entity))
|
2012-08-23 01:02:14 +00:00
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
GL11.glRotatef((float)(block.getBedDirection(world, pos).getHorizontalIndex() * 90), 0.0F, 1.0F, 0.0F);
|
2012-08-23 01:02:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean onDrawBlockHighlight(RenderGlobal context, EntityPlayer player, MovingObjectPosition target, int subID, ItemStack currentItem, float partialTicks)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new DrawBlockHighlightEvent(context, player, target, subID, currentItem, partialTicks));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void dispatchRenderLast(RenderGlobal context, float partialTicks)
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new RenderWorldLastEvent(context, partialTicks));
|
|
|
|
}
|
|
|
|
|
2014-02-21 17:13:40 +00:00
|
|
|
public static boolean renderFirstPersonHand(RenderGlobal context, float partialTicks, int renderPass)
|
|
|
|
{
|
|
|
|
return MinecraftForge.EVENT_BUS.post(new RenderHandEvent(context, partialTicks, renderPass));
|
|
|
|
}
|
|
|
|
|
2013-03-18 03:07:30 +00:00
|
|
|
public static void onTextureStitchedPre(TextureMap map)
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map));
|
2015-02-17 18:20:14 +00:00
|
|
|
ModelLoader.White.instance.register(map);
|
2015-06-18 11:14:46 +00:00
|
|
|
FluidRegistry.onTextureStitchedPre(map);
|
2013-03-18 03:07:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void onTextureStitchedPost(TextureMap map)
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));
|
2012-08-23 01:02:14 +00:00
|
|
|
}
|
2013-03-07 03:18:26 +00:00
|
|
|
|
|
|
|
static int renderPass = -1;
|
|
|
|
public static void setRenderPass(int pass)
|
|
|
|
{
|
|
|
|
renderPass = pass;
|
|
|
|
}
|
2013-04-05 02:10:07 +00:00
|
|
|
|
2015-02-08 23:46:01 +00:00
|
|
|
static final ThreadLocal<EnumWorldBlockLayer> renderLayer = new ThreadLocal<EnumWorldBlockLayer>()
|
|
|
|
{
|
|
|
|
protected EnumWorldBlockLayer initialValue()
|
|
|
|
{
|
|
|
|
return EnumWorldBlockLayer.SOLID;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-12-26 05:39:12 +00:00
|
|
|
public static void setRenderLayer(EnumWorldBlockLayer layer)
|
|
|
|
{
|
2015-02-08 23:46:01 +00:00
|
|
|
renderLayer.set(layer);
|
2014-12-26 05:39:12 +00:00
|
|
|
}
|
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public static ModelBase getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int slotID, ModelBase _default)
|
2013-05-09 00:13:19 +00:00
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
ModelBase modelbase = itemStack.getItem().getArmorModel(entityLiving, itemStack, slotID);
|
|
|
|
return modelbase == null ? _default : modelbase;
|
2013-05-09 00:13:19 +00:00
|
|
|
}
|
2013-05-23 05:01:19 +00:00
|
|
|
|
2013-07-04 02:31:54 +00:00
|
|
|
//This properly moves the domain, if provided, to the front of the string before concatenating
|
|
|
|
public static String fixDomain(String base, String complex)
|
|
|
|
{
|
|
|
|
int idx = complex.indexOf(':');
|
|
|
|
if (idx == -1)
|
|
|
|
{
|
|
|
|
return base + complex;
|
|
|
|
}
|
|
|
|
|
|
|
|
String name = complex.substring(idx + 1, complex.length());
|
|
|
|
if (idx > 1)
|
|
|
|
{
|
|
|
|
String domain = complex.substring(0, idx);
|
|
|
|
return domain + ':' + base + name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return base + name;
|
|
|
|
}
|
|
|
|
}
|
2013-06-06 13:39:19 +00:00
|
|
|
|
2013-09-06 00:14:24 +00:00
|
|
|
public static boolean postMouseEvent()
|
|
|
|
{
|
2013-09-04 21:00:04 +00:00
|
|
|
return MinecraftForge.EVENT_BUS.post(new MouseEvent());
|
|
|
|
}
|
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public static float getOffsetFOV(EntityPlayer entity, float fov)
|
2013-09-06 00:14:24 +00:00
|
|
|
{
|
|
|
|
FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
|
|
|
|
MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
|
|
|
|
return fovUpdateEvent.newfov;
|
|
|
|
}
|
|
|
|
|
2013-09-14 03:11:59 +00:00
|
|
|
private static int skyX, skyZ;
|
|
|
|
|
|
|
|
private static boolean skyInit;
|
|
|
|
private static int skyRGBMultiplier;
|
2014-06-30 01:42:48 +00:00
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public static int getSkyBlendColour(World world, BlockPos center)
|
2013-09-14 03:11:59 +00:00
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
if (center.getX() == skyX && center.getZ() == skyZ && skyInit)
|
2013-09-14 03:11:59 +00:00
|
|
|
{
|
|
|
|
return skyRGBMultiplier;
|
|
|
|
}
|
|
|
|
skyInit = true;
|
2013-12-21 08:10:35 +00:00
|
|
|
|
|
|
|
GameSettings settings = Minecraft.getMinecraft().gameSettings;
|
|
|
|
int[] ranges = ForgeModContainer.blendRanges;
|
|
|
|
int distance = 0;
|
2014-02-05 08:05:37 +00:00
|
|
|
if (settings.fancyGraphics && settings.renderDistanceChunks >= 0 && settings.renderDistanceChunks < ranges.length)
|
2013-12-21 08:10:35 +00:00
|
|
|
{
|
2014-02-05 08:05:37 +00:00
|
|
|
distance = ranges[settings.renderDistanceChunks];
|
2013-12-21 08:10:35 +00:00
|
|
|
}
|
2014-06-30 01:42:48 +00:00
|
|
|
|
2013-09-14 03:11:59 +00:00
|
|
|
int r = 0;
|
|
|
|
int g = 0;
|
|
|
|
int b = 0;
|
|
|
|
|
2013-09-14 03:57:29 +00:00
|
|
|
int divider = 0;
|
2013-09-14 03:11:59 +00:00
|
|
|
for (int x = -distance; x <= distance; ++x)
|
|
|
|
{
|
|
|
|
for (int z = -distance; z <= distance; ++z)
|
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
BlockPos pos = center.add(x, 0, z);
|
|
|
|
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
|
2014-12-02 03:11:17 +00:00
|
|
|
int colour = biome.getSkyColorByTemp(biome.getFloatTemperature(pos));
|
2013-09-14 03:11:59 +00:00
|
|
|
r += (colour & 0xFF0000) >> 16;
|
|
|
|
g += (colour & 0x00FF00) >> 8;
|
|
|
|
b += colour & 0x0000FF;
|
2013-09-14 03:57:29 +00:00
|
|
|
divider++;
|
2013-09-14 03:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-14 03:57:29 +00:00
|
|
|
int multiplier = (r / divider & 255) << 16 | (g / divider & 255) << 8 | b / divider & 255;
|
2013-09-14 03:11:59 +00:00
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
skyX = center.getX();
|
|
|
|
skyZ = center.getY();
|
2013-09-14 03:11:59 +00:00
|
|
|
skyRGBMultiplier = multiplier;
|
|
|
|
return skyRGBMultiplier;
|
|
|
|
}
|
2013-05-23 05:01:19 +00:00
|
|
|
/**
|
|
|
|
* Initialization of Forge Renderers.
|
|
|
|
*/
|
2013-09-06 00:14:24 +00:00
|
|
|
static
|
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
//FluidRegistry.renderIdFluid = RenderingRegistry.getNextAvailableRenderId();
|
|
|
|
//RenderingRegistry.registerBlockHandler(RenderBlockFluid.instance);
|
2013-05-23 05:01:19 +00:00
|
|
|
}
|
2013-12-25 08:35:59 +00:00
|
|
|
|
|
|
|
public static void renderMainMenu(GuiMainMenu gui, FontRenderer font, int width, int height)
|
|
|
|
{
|
|
|
|
Status status = ForgeVersion.getStatus();
|
|
|
|
if (status == BETA || status == BETA_OUTDATED)
|
|
|
|
{
|
|
|
|
// render a warning at the top of the screen,
|
2014-06-02 22:28:11 +00:00
|
|
|
String line = I18n.format("forge.update.beta.1", EnumChatFormatting.RED, EnumChatFormatting.RESET);
|
2013-12-25 08:35:59 +00:00
|
|
|
gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (0 * (font.FONT_HEIGHT + 1)), -1);
|
2014-06-02 22:28:11 +00:00
|
|
|
line = I18n.format("forge.update.beta.2");
|
2013-12-25 08:35:59 +00:00
|
|
|
gui.drawString(font, line, (width - font.getStringWidth(line)) / 2, 4 + (1 * (font.FONT_HEIGHT + 1)), -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
String line = null;
|
|
|
|
switch(status)
|
|
|
|
{
|
|
|
|
//case FAILED: line = " Version check failed"; break;
|
|
|
|
//case UP_TO_DATE: line = "Forge up to date"}; break;
|
|
|
|
//case AHEAD: line = "Using non-recommended Forge build, issues may arise."}; break;
|
|
|
|
case OUTDATED:
|
2014-06-02 22:28:11 +00:00
|
|
|
case BETA_OUTDATED: line = I18n.format("forge.update.newversion", ForgeVersion.getTarget()); break;
|
2013-12-25 08:35:59 +00:00
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (line != null)
|
|
|
|
{
|
|
|
|
// if we have a line, render it in the bottom right, above Mojang's copyright line
|
|
|
|
gui.drawString(font, line, width - font.getStringWidth(line) - 2, height - (2 * (font.FONT_HEIGHT + 1)), -1);
|
|
|
|
}
|
|
|
|
}
|
2014-04-03 10:12:22 +00:00
|
|
|
|
|
|
|
public static ISound playSound(SoundManager manager, ISound sound)
|
|
|
|
{
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
SoundEventAccessorComposite accessor = manager.sndHandler.getSound(sound.getSoundLocation());
|
|
|
|
PlaySoundEvent e = new PlaySoundEvent(manager, sound, (accessor == null ? null : accessor.getSoundCategory()));
|
2014-04-03 10:12:22 +00:00
|
|
|
MinecraftForge.EVENT_BUS.post(e);
|
|
|
|
return e.result;
|
|
|
|
}
|
2014-05-20 17:51:46 +00:00
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
//static RenderBlocks worldRendererRB;
|
2014-05-20 17:51:46 +00:00
|
|
|
static int worldRenderPass;
|
|
|
|
|
|
|
|
public static int getWorldRenderPass()
|
|
|
|
{
|
|
|
|
return worldRenderPass;
|
|
|
|
}
|
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public static void drawScreen(GuiScreen screen, int mouseX, int mouseY, float partialTicks)
|
|
|
|
{
|
|
|
|
if (!MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Pre(screen, mouseX, mouseY, partialTicks)))
|
|
|
|
screen.drawScreen(mouseX, mouseY, partialTicks);
|
|
|
|
MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.DrawScreenEvent.Post(screen, mouseX, mouseY, partialTicks));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static float getFogDensity(EntityRenderer renderer, Entity entity, Block block, float partial, float density)
|
|
|
|
{
|
|
|
|
EntityViewRenderEvent.FogDensity event = new EntityViewRenderEvent.FogDensity(renderer, entity, block, partial, density);
|
|
|
|
if (MinecraftForge.EVENT_BUS.post(event)) return event.density;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onFogRender(EntityRenderer renderer, Entity entity, Block block, float partial, int mode, float distance)
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new EntityViewRenderEvent.RenderFogEvent(renderer, entity, block, partial, mode, distance));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2014-05-20 17:51:46 +00:00
|
|
|
public static void setWorldRendererRB(RenderBlocks renderBlocks)
|
|
|
|
{
|
|
|
|
worldRendererRB = renderBlocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onPreRenderWorld(WorldRenderer worldRenderer, int pass)
|
|
|
|
{
|
|
|
|
if(worldRendererRB != null)
|
|
|
|
{
|
|
|
|
worldRenderPass = pass;
|
|
|
|
MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Pre(worldRenderer, (ChunkCache)worldRendererRB.blockAccess, worldRendererRB, pass));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void onPostRenderWorld(WorldRenderer worldRenderer, int pass)
|
|
|
|
{
|
|
|
|
if(worldRendererRB != null)
|
|
|
|
{
|
|
|
|
MinecraftForge.EVENT_BUS.post(new RenderWorldEvent.Post(worldRenderer, (ChunkCache)worldRendererRB.blockAccess, worldRendererRB, pass));
|
|
|
|
worldRenderPass = -1;
|
|
|
|
}
|
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
*/
|
2014-11-27 03:56:35 +00:00
|
|
|
|
|
|
|
public static void onModelBake(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery)
|
|
|
|
{
|
2015-02-04 06:45:23 +00:00
|
|
|
ModelLoader loader = (ModelLoader)modelBakery;
|
|
|
|
MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, loader));
|
|
|
|
loader.onPostBakeEvent(modelRegistry);
|
2014-11-27 03:56:35 +00:00
|
|
|
}
|
2014-12-28 04:10:54 +00:00
|
|
|
|
|
|
|
public static Matrix4f getMatrix(ItemTransformVec3f transform)
|
|
|
|
{
|
|
|
|
javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f();
|
|
|
|
m.setIdentity();
|
|
|
|
m.setTranslation(transform.translation);
|
|
|
|
t.setIdentity();
|
|
|
|
t.rotY(transform.rotation.y);
|
|
|
|
m.mul(t);
|
|
|
|
t.setIdentity();
|
|
|
|
t.rotX(transform.rotation.x);
|
|
|
|
m.mul(t);
|
|
|
|
t.setIdentity();
|
|
|
|
t.rotZ(transform.rotation.z);
|
|
|
|
m.mul(t);
|
|
|
|
t.setIdentity();
|
|
|
|
t.m00 = transform.scale.x;
|
|
|
|
t.m11 = transform.scale.y;
|
|
|
|
t.m22 = transform.scale.z;
|
|
|
|
m.mul(t);
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static IBakedModel handleCameraTransforms(IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType)
|
|
|
|
{
|
|
|
|
if(model instanceof IPerspectiveAwareModel)
|
|
|
|
{
|
|
|
|
Pair<IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType);
|
|
|
|
|
|
|
|
if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight());
|
|
|
|
return pair.getLeft();
|
|
|
|
}
|
|
|
|
switch(cameraTransformType)
|
|
|
|
{
|
|
|
|
case FIRST_PERSON:
|
|
|
|
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().firstPerson);
|
|
|
|
break;
|
|
|
|
case GUI:
|
|
|
|
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().gui);
|
|
|
|
break;
|
|
|
|
case HEAD:
|
|
|
|
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().head);
|
|
|
|
break;
|
|
|
|
case THIRD_PERSON:
|
|
|
|
RenderItem.applyVanillaTransform(model.getItemCameraTransforms().thirdPerson);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return model;
|
|
|
|
}
|
|
|
|
|
|
|
|
private static final FloatBuffer matrixBuf = BufferUtils.createFloatBuffer(16);
|
|
|
|
|
|
|
|
public static void multiplyCurrentGlMatrix(Matrix4f matrix)
|
|
|
|
{
|
|
|
|
matrixBuf.clear();
|
|
|
|
float[] t = new float[4];
|
|
|
|
for(int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
matrix.getColumn(i, t);
|
|
|
|
matrixBuf.put(t);
|
|
|
|
}
|
|
|
|
matrixBuf.flip();
|
|
|
|
GL11.glMultMatrix(matrixBuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
// moved and expanded from WorldVertexBufferUploader.draw
|
|
|
|
|
|
|
|
public static void preDraw(EnumUsage attrType, VertexFormatElement attr, int stride, ByteBuffer buffer)
|
|
|
|
{
|
|
|
|
buffer.position(attr.getOffset());
|
|
|
|
switch(attrType)
|
|
|
|
{
|
|
|
|
case POSITION:
|
|
|
|
glVertexPointer(attr.getElementCount(), attr.getType().getGlConstant(), stride, buffer);
|
|
|
|
glEnableClientState(GL_VERTEX_ARRAY);
|
|
|
|
break;
|
|
|
|
case NORMAL:
|
|
|
|
if(attr.getElementCount() != 3)
|
|
|
|
{
|
|
|
|
throw new IllegalArgumentException("Normal attribute should have the size 3: " + attr);
|
|
|
|
}
|
|
|
|
glNormalPointer(attr.getType().getGlConstant(), stride, buffer);
|
|
|
|
glEnableClientState(GL_NORMAL_ARRAY);
|
|
|
|
break;
|
|
|
|
case COLOR:
|
|
|
|
glColorPointer(attr.getElementCount(), attr.getType().getGlConstant(), stride, buffer);
|
|
|
|
glEnableClientState(GL_COLOR_ARRAY);
|
|
|
|
break;
|
|
|
|
case UV:
|
|
|
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + attr.getIndex());
|
|
|
|
glTexCoordPointer(attr.getElementCount(), attr.getType().getGlConstant(), stride, buffer);
|
|
|
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
|
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
|
|
|
break;
|
|
|
|
case PADDING:
|
|
|
|
break;
|
|
|
|
case GENERIC:
|
|
|
|
glEnableVertexAttribArray(attr.getIndex());
|
|
|
|
glVertexAttribPointer(attr.getIndex(), attr.getElementCount(), attr.getType().getGlConstant(), false, stride, buffer);
|
|
|
|
default:
|
|
|
|
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void postDraw(EnumUsage attrType, VertexFormatElement attr, int stride, ByteBuffer buffer)
|
|
|
|
{
|
|
|
|
switch(attrType)
|
|
|
|
{
|
|
|
|
case POSITION:
|
|
|
|
glDisableClientState(GL_VERTEX_ARRAY);
|
|
|
|
break;
|
|
|
|
case NORMAL:
|
|
|
|
glDisableClientState(GL_NORMAL_ARRAY);
|
|
|
|
break;
|
|
|
|
case COLOR:
|
|
|
|
glDisableClientState(GL_COLOR_ARRAY);
|
|
|
|
// is this really needed?
|
|
|
|
GlStateManager.resetColor();
|
|
|
|
break;
|
|
|
|
case UV:
|
|
|
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit + attr.getIndex());
|
|
|
|
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
|
|
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
|
|
|
break;
|
|
|
|
case PADDING:
|
|
|
|
break;
|
|
|
|
case GENERIC:
|
|
|
|
glDisableVertexAttribArray(attr.getIndex());
|
|
|
|
default:
|
|
|
|
FMLLog.severe("Unimplemented vanilla attribute upload: %s", attrType.getDisplayName());
|
|
|
|
}
|
|
|
|
}
|
2015-02-14 01:44:09 +00:00
|
|
|
|
|
|
|
public static void transform(Vector3d vec, Matrix4f m)
|
|
|
|
{
|
|
|
|
Vector4f tmp = new Vector4f((float)vec.x, (float)vec.y, (float)vec.z, 1f);
|
|
|
|
m.transform(tmp);
|
|
|
|
if(Math.abs(tmp.w - 1f) > 1e-5) tmp.scale(1f / tmp.w);
|
|
|
|
vec.set(tmp.x, tmp.y, tmp.z);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static Matrix4f getMatrix(ModelRotation modelRotation)
|
|
|
|
{
|
|
|
|
Matrix4f ret = new Matrix4f(modelRotation.getMatrix4d()), tmp = new Matrix4f();
|
|
|
|
tmp.setIdentity();
|
|
|
|
tmp.m03 = tmp.m13 = tmp.m23 = .5f;
|
|
|
|
ret.mul(tmp, ret);
|
|
|
|
tmp.invert();
|
|
|
|
//tmp.m03 = tmp.m13 = tmp.m23 = -.5f;
|
|
|
|
ret.mul(tmp);
|
|
|
|
return ret;
|
|
|
|
}
|
2015-02-17 01:56:32 +00:00
|
|
|
|
|
|
|
public static void putQuadColor(WorldRenderer renderer, BakedQuad quad, int color)
|
|
|
|
{
|
|
|
|
float cr = color & 0xFF;
|
|
|
|
float cg = (color >>> 8) & 0xFF;
|
|
|
|
float cb = (color >>> 16) & 0xFF;
|
|
|
|
float ca = (color >>> 24) & 0xFF;
|
|
|
|
for(int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
int vc = quad.getVertexData()[3 + 7 * i];
|
|
|
|
float vcr = vc & 0xFF;
|
|
|
|
float vcg = (vc >>> 8) & 0xFF;
|
|
|
|
float vcb = (vc >>> 16) & 0xFF;
|
|
|
|
float vca = (vc >>> 24) & 0xFF;
|
|
|
|
int ncr = Math.min(0xFF, (int)(cr * vcr / 0xFF));
|
|
|
|
int ncg = Math.min(0xFF, (int)(cg * vcg / 0xFF));
|
|
|
|
int ncb = Math.min(0xFF, (int)(cb * vcb / 0xFF));
|
|
|
|
int nca = Math.min(0xFF, (int)(ca * vca / 0xFF));
|
2015-06-28 22:19:10 +00:00
|
|
|
renderer.putColorRGBA(renderer.getColorIndex(4 - i), ncr, ncg, ncb, nca);
|
2015-02-17 01:56:32 +00:00
|
|
|
}
|
|
|
|
}
|
2015-09-02 04:26:42 +00:00
|
|
|
|
|
|
|
private static Map<Pair<Item, Integer>, Class<? extends TileEntity>> tileItemMap = Maps.newHashMap();
|
|
|
|
|
|
|
|
public static void renderTileItem(Item item, int metadata)
|
|
|
|
{
|
|
|
|
Class<? extends TileEntity> tileClass = tileItemMap.get(Pair.of(item,
|
|
|
|
metadata));
|
|
|
|
if (tileClass != null)
|
|
|
|
{
|
2015-09-02 19:01:30 +00:00
|
|
|
TileEntitySpecialRenderer r = TileEntityRendererDispatcher.instance.getSpecialRendererByClass(tileClass);
|
2015-09-02 04:26:42 +00:00
|
|
|
if (r != null)
|
|
|
|
{
|
|
|
|
r.renderTileEntityAt(null, 0, 0, 0, 0, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @deprecated Will be removed as soon as possible, hopefully 1.9.
|
|
|
|
*/
|
|
|
|
@Deprecated
|
|
|
|
public static void registerTESRItemStack(Item item, int metadata, Class<? extends TileEntity> TileClass)
|
|
|
|
{
|
|
|
|
tileItemMap.put(Pair.of(item, metadata), TileClass);
|
|
|
|
}
|
2015-06-28 22:19:10 +00:00
|
|
|
|
|
|
|
public static void fillNormal(int[] faceData, EnumFacing facing)
|
|
|
|
{
|
|
|
|
int x = ((byte)(facing.getFrontOffsetX() * 127)) & 0xFF;
|
|
|
|
int y = ((byte)(facing.getFrontOffsetY() * 127)) & 0xFF;
|
|
|
|
int z = ((byte)(facing.getFrontOffsetZ() * 127)) & 0xFF;
|
|
|
|
for(int i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
faceData[i * 7 + 6] = x | (y << 0x08) | (z << 0x10);
|
|
|
|
}
|
|
|
|
}
|
2012-08-06 10:35:57 +00:00
|
|
|
}
|