Fix up more of the rendering stuff for 1.5

This commit is contained in:
pahimar 2013-03-05 16:17:54 -05:00
parent f580e4646f
commit c9cb29ede5
11 changed files with 33 additions and 63 deletions

View file

@ -3,9 +3,6 @@ package com.pahimar.ee3.block;
import net.minecraft.block.Block;
import com.pahimar.ee3.lib.BlockIds;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.common.registry.GameRegistry;
/**
* ModBlocks

View file

@ -1,7 +1,6 @@
package com.pahimar.ee3.client.renderer;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
@ -58,7 +57,6 @@ public class ItemAlchemicalChestRenderer implements IItemRenderer {
private void renderAlchemicalChest(float x, float y, float z) {
Tessellator tesselator = Tessellator.instance;
FMLClientHandler.instance().getClient().renderEngine.func_98187_b(Sprites.MODEL_ALCHEMICAL_CHEST);
GL11.glPushMatrix(); //start
GL11.glTranslatef(x, y, z); //size

View file

@ -45,14 +45,14 @@ public class ConfigurationHandler {
/* General configs */
ConfigurationSettings.DISPLAY_VERSION_RESULT = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.DISPLAY_VERSION_RESULT_CONFIGNAME, ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT).getBoolean(ConfigurationSettings.DISPLAY_VERSION_RESULT_DEFAULT);
ConfigurationSettings.LAST_DISCOVERED_VERSION = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT).value;
ConfigurationSettings.LAST_DISCOVERED_VERSION = configuration.get(CATEGORY_GENERAL, ConfigurationSettings.LAST_DISCOVERED_VERSION_CONFIGNAME, ConfigurationSettings.LAST_DISCOVERED_VERSION_DEFAULT).getString();
/* Graphic configs */
ConfigurationSettings.ENABLE_PARTICLE_FX = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_PARTICLE_FX_CONFIGNAME, ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_PARTICLE_FX_DEFAULT);
ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_CONFIGNAME, ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT).getBoolean(ConfigurationSettings.ENABLE_OVERLAY_WORLD_TRANSMUTATION_DEFAULT);
ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION = configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_DEFAULT).getInt(ConfigurationSettings.TARGET_BLOCK_OVERLAY_POSITION_DEFAULT);
try {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = Float.parseFloat(configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT).value);
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = Float.parseFloat(configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT).getString());
if (ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE <= 0F) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT;
@ -62,7 +62,7 @@ public class ConfigurationHandler {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE = ConfigurationSettings.TARGET_BLOCK_OVERLAY_SCALE_DEFAULT;
}
try {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = Float.parseFloat(configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT).value);
ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = Float.parseFloat(configuration.get(CATEGORY_GRAPHICS, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_CONFIGNAME, ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT).getString());
if ((ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY < 0F) || (ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY > 1F)) {
ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY_DEFAULT;
@ -73,7 +73,7 @@ public class ConfigurationHandler {
}
/* Audio configs */
ConfigurationSettings.ENABLE_SOUNDS = configuration.get(CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT).value;
ConfigurationSettings.ENABLE_SOUNDS = configuration.get(CATEGORY_AUDIO, ConfigurationSettings.ENABLE_SOUNDS_CONFIGNAME, ConfigurationSettings.ENABLE_SOUNDS_DEFAULT).getString();
/* Block configs */
BlockIds.CALCINATOR = configuration.getBlock(Strings.CALCINATOR_NAME, BlockIds.CALCINATOR_DEFAULT).getInt(BlockIds.CALCINATOR_DEFAULT);

View file

@ -1,7 +1,6 @@
package com.pahimar.ee3.core.handlers;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.common.ForgeDirection;
@ -21,8 +20,6 @@ public class DrawBlockHighlightHandler {
private static int pulse = 0;
private static boolean doInc = true;
private static ItemStack currentBlockStack = null;
@ForgeSubscribe
public void onDrawBlockHighlightEvent(DrawBlockHighlightEvent event) {
@ -47,7 +44,7 @@ public class DrawBlockHighlightHandler {
double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
int texture = event.context.renderEngine.getTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.WORLD_TRANSMUTATION_TEXTURE);
int texture = event.context.renderEngine.getTexture(Sprites.EFFECT_WORLD_TRANSMUTATION);
float xScale = 1;
float yScale = 1;

View file

@ -16,7 +16,6 @@ import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* KeyBindingHandler
@ -76,9 +75,4 @@ public class KeyBindingHandler extends KeyBindingRegistry.KeyHandler {
return EnumSet.of(TickType.CLIENT);
}
private static String getLocalizedKey(String key) {
return LanguageRegistry.instance().getStringLocalization(key);
}
}

View file

@ -8,7 +8,6 @@ import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -66,9 +65,6 @@ public class TransmutationTargetOverlayHandler implements ITickHandler {
float blockScale = overlayScale / 2;
float overlayOpacity = ConfigurationSettings.TARGET_BLOCK_OVERLAY_OPACITY;
MovingObjectPosition rayTrace = minecraft.objectMouseOver;
ItemStack currentBlock = null;
GL11.glPushMatrix();
ScaledResolution sr = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
GL11.glClear(256);

View file

@ -11,6 +11,8 @@ import net.minecraft.util.Icon;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.lib.Sprites;
public class RenderUtils {
private static int rotationAngle = 0;
@ -43,44 +45,30 @@ public class RenderUtils {
renderBlocks.useInventoryTint = true;
GL11.glPopMatrix();
}
public static void renderItemIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack itemStack, int x, int y, float opacity, float scale) {
public static void renderItemIntoGUI(FontRenderer fontRenderer, RenderEngine renderEngine, ItemStack stack, int x, int y, float opacity, float scale) {
int itemID = stack.itemID;
int meta = stack.getItemDamage();
Icon iconIndex = stack.getIconIndex();
Icon icon = itemStack.getIconIndex();
GL11.glDisable(GL11.GL_LIGHTING);
// FIXME
//renderEngine.bindTexture(renderEngine.getTexture(stack.getItem().getTextureFile()));
int overlayColour = Item.itemsList[itemID].getColorFromItemStack(stack, 0);
float var17 = (float) (overlayColour >> 16 & 255) / 255.0F;
float var16 = (float) (overlayColour >> 8 & 255) / 255.0F;
float var12 = (float) (overlayColour & 255) / 255.0F;
GL11.glColor4f(var17, var16, var12, opacity);
//drawTexturedQuad(x, y, iconIndex % 16 * 16, iconIndex / 16 * 16, 16, 16, -90, scale);
renderEngine.func_98187_b(Sprites.ITEM_SPRITE_SHEET);
int overlayColour = itemStack.getItem().getColorFromItemStack(itemStack, 0);
float red = (float)(overlayColour >> 16 & 255) / 255.0F;
float green = (float)(overlayColour >> 8 & 255) / 255.0F;
float blue = (float)(overlayColour & 255) / 255.0F;
GL11.glColor4f(red, green, blue, opacity);
drawTexturedQuad(x, y, icon, 16 * scale, 16 * scale, -90);
GL11.glEnable(GL11.GL_LIGHTING);
}
public static void drawTexturedQuad(int x, int y, int u, int v, int width, int height, double zLevel, float scale) {
u = (int) (u * scale);
v = (int) (v * scale);
width = (int) (width * scale);
height = (int) (height * scale);
float var7 = 0.00390625F / scale;
float var8 = 0.00390625F / scale;
Tessellator var9 = Tessellator.instance;
var9.startDrawingQuads();
var9.addVertexWithUV(x + 0, y + height, zLevel, (u + 0) * var7, (v + height) * var8);
var9.addVertexWithUV(x + width, y + height, zLevel, (u + width) * var7, (v + height) * var8);
var9.addVertexWithUV(x + width, y + 0, zLevel, (u + width) * var7, (v + 0) * var8);
var9.addVertexWithUV(x + 0, y + 0, zLevel, (u + 0) * var7, (v + 0) * var8);
var9.draw();
public static void drawTexturedQuad(int x, int y, Icon icon, float width, float height, double zLevel) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(x + 0), (double)(y + height), zLevel, (double)icon.func_94209_e(), (double)icon.func_94210_h());
tessellator.addVertexWithUV((double)(x + width), (double)(y + height), zLevel, (double)icon.func_94212_f(), (double)icon.func_94210_h());
tessellator.addVertexWithUV((double)(x + width), (double)(y + 0), zLevel, (double)icon.func_94212_f(), (double)icon.func_94206_g());
tessellator.addVertexWithUV((double)(x + 0), (double)(y + 0), zLevel, (double)icon.func_94209_e(), (double)icon.func_94206_g());
tessellator.draw();
}
}

View file

@ -47,7 +47,6 @@ import com.pahimar.ee3.item.IChargeable;
import com.pahimar.ee3.lib.ActionTypes;
import com.pahimar.ee3.lib.BlockIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Sprites;
import com.pahimar.ee3.network.PacketTypeHandler;
import com.pahimar.ee3.network.packet.PacketRequestEvent;
import com.pahimar.ee3.tileentity.TileAlchemicalChest;

View file

@ -7,11 +7,12 @@ public class Sprites {
public static final String MODEL_SHEET_LOCATION = "/mods/ee3/textures/models/";
public static final String ARMOR_SHEET_LOCATION = "/mods/ee3/textures/armor/";
public static final String GUI_SHEET_LOCATION = "/mods/ee3/textures/gui/";
public static final String EFFECTS_LOCATION = "/mods/ee3/textures/effects/";
// Item/Block sprite sheets
public static final String ITEM_SPRITE_SHEET = "ee3_items.png";
public static final String ITEM_SPRITE_SHEET = "/gui/items.png";
public static final String BLOCK_SPRITE_SHEET = "ee3_blocks.png";
// Armor sprite sheets
// GUI textures
@ -27,7 +28,7 @@ public class Sprites {
public static final String MODEL_ALUDEL = MODEL_SHEET_LOCATION + "aludel.png";
public static final String MODEL_ALCHEMICAL_CHEST = MODEL_SHEET_LOCATION + "alchemicalChest.png";
// Misc textures
public static final String WORLD_TRANSMUTATION_TEXTURE = "noise.png";
// Effect textures
public static final String EFFECT_WORLD_TRANSMUTATION = EFFECTS_LOCATION + "noise.png";
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.