Some work on 1.7, waiting for Abrar to fix a few things.

This commit is contained in:
Lex Manos committed 2013-12-09 21:59:12 -08:00
1 parent d4e7a5c68e
commit 521b8a16c4
18 files changed
+245 -487

No files matched your search

@@ -9,10 +9,11 @@ import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.CommandEvent;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.util.EnumChatFormatting;
import static net.minecraft.util.EnumChatFormatting.*;
/**
@@ -73,20 +74,20 @@ public class ClientCommandHandler extends CommandHandler
}
else
{
sender.sendChatToPlayer(format("commands.generic.permission").setColor(RED));
sender.func_145747_a(format(RED, "commands.generic.permission"));
}
}
catch (WrongUsageException wue)
{
sender.sendChatToPlayer(format("commands.generic.usage", format(wue.getMessage(), wue.getErrorOjbects())).setColor(RED));
sender.func_145747_a(format(RED, "commands.generic.usage", format(RED, wue.getMessage(), wue.getErrorOjbects())));
}
catch (CommandException ce)
{
sender.sendChatToPlayer(format(ce.getMessage(), ce.getErrorOjbects()).setColor(RED));
sender.func_145747_a(format(RED, ce.getMessage(), ce.getErrorOjbects()));
}
catch (Throwable t)
{
sender.sendChatToPlayer(format("commands.generic.exception").setColor(RED));
sender.func_145747_a(format(RED, "commands.generic.exception"));
t.printStackTrace();
}
@@ -94,14 +95,11 @@ public class ClientCommandHandler extends CommandHandler
}
//Couple of helpers because the mcp names are stupid and long...
private ChatMessageComponent format(String str, Object... args)
private ChatComponentTranslation format(EnumChatFormatting color, String str, Object... args)
{
return ChatMessageComponent.createFromTranslationWithSubstitutions(str, args);
}
private ChatMessageComponent format(String str)
{
return ChatMessageComponent.createFromTranslationKey(str);
ChatComponentTranslation ret = new ChatComponentTranslation(str, args);
ret.func_150256_b().func_150238_a(color);
return ret;
}
public void autoComplete(String leftOfCursor, String full)
@@ -1,8 +1,8 @@
package net.minecraftforge.client;
import net.minecraft.world.EnumGameType;
import net.minecraft.util.EnumOS;
import net.minecraft.client.settings.EnumOptions;
import net.minecraft.util.Util.EnumOS;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.client.settings.GameSettings.Options;
import net.minecraft.item.EnumRarity;
import net.minecraftforge.common.EnumHelper;
@@ -11,20 +11,20 @@ public class EnumHelperClient extends EnumHelper
private static Class[][] clentTypes =
{
{EnumGameType.class, int.class, String.class},
{EnumOptions.class, String.class, boolean.class, boolean.class},
{GameType.class, int.class, String.class},
{Options.class, String.class, boolean.class, boolean.class},
{EnumOS.class},
{EnumRarity.class, int.class, String.class}
};
public static EnumGameType addGameType(String name, int id, String displayName)
public static GameType addGameType(String name, int id, String displayName)
{
return addEnum(EnumGameType.class, name, id, displayName);
return addEnum(GameType.class, name, id, displayName);
}
public static EnumOptions addOptions(String name, String langName, boolean isSlider, boolean isToggle)
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle)
{
return addEnum(EnumOptions.class, name, langName, isSlider, isToggle);
return addEnum(Options.class, name, langName, isSlider, isToggle);
}
public static EnumOS addOS2(String name)
@@ -9,6 +9,7 @@ import javax.imageio.ImageIO;
import net.minecraftforge.client.event.MouseEvent;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraftforge.client.event.FOVUpdateEvent;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
@@ -17,14 +18,15 @@ import org.lwjgl.opengl.PixelFormat;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.BlockLiquid;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
@@ -59,12 +61,6 @@ public class ForgeHooksClient
return FMLClientHandler.instance().getClient().renderEngine;
}
@Deprecated
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, int layer, String type)
{
return getArmorTexture(entity, armor, _default, slot, type);
}
public static String getArmorTexture(Entity entity, ItemStack armor, String _default, int slot, String type)
{
String result = armor.getItem().getArmorTexture(armor, entity, slot, type);
@@ -251,8 +247,8 @@ public class ForgeHooksClient
{
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));
FluidRegistry.WATER.setIcons(BlockFluid.getFluidIcon("water_still"), BlockFluid.getFluidIcon("water_flow"));
FluidRegistry.LAVA.setIcons(BlockFluid.getFluidIcon("lava_still"), BlockFluid.getFluidIcon("lava_flow"));
FluidRegistry.WATER.setIcons(BlockLiquid.func_149803_e("water_still"), BlockLiquid.func_149803_e("water_flow"));
FluidRegistry.LAVA.setIcons(BlockLiquid.func_149803_e("lava_still"), BlockLiquid.func_149803_e("lava_flow"));
}
/**
@@ -347,7 +343,7 @@ public class ForgeHooksClient
private static boolean skyInit;
private static int skyRGBMultiplier;
public static int getSkyBlendColour(World world, int playerX, int playerZ)
public static int getSkyBlendColour(World world, int playerX, int playerY, int playerZ)
{
if (playerX == skyX && playerZ == skyZ && skyInit)
{
@@ -367,7 +363,7 @@ public class ForgeHooksClient
for (int z = -distance; z <= distance; ++z)
{
BiomeGenBase biome = world.getBiomeGenForCoords(playerX + x, playerZ + z);
int colour = biome.getSkyColorByTemp(biome.getFloatTemperature());
int colour = biome.getSkyColorByTemp(biome.func_150564_a(playerX + x, playerY, playerZ + z));
r += (colour & 0xFF0000) >> 16;
g += (colour & 0x00FF00) >> 8;
b += colour & 0x0000FF;
@@ -1,128 +0,0 @@
package net.minecraftforge.client;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.gui.GuiControls;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GuiControlsScrollPanel extends GuiSlot
{
protected static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png");
private GuiControls controls;
private GameSettings options;
private Minecraft mc;
private String[] message;
private int _mouseX;
private int _mouseY;
private int selected = -1;
public GuiControlsScrollPanel(GuiControls controls, GameSettings options, Minecraft mc)
{
super(mc, controls.width, controls.height, 16, (controls.height - 32) + 4, 25);
this.controls = controls;
this.options = options;
this.mc = mc;
}
@Override
protected int getSize()
{
return options.keyBindings.length;
}
@Override
protected void elementClicked(int i, boolean flag)
{
if (!flag)
{
if (selected == -1)
{
selected = i;
}
else
{
options.setKeyBinding(selected, -100);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
}
@Override
protected boolean isSelected(int i)
{
return false;
}
@Override
protected void drawBackground() {}
@Override
public void drawScreen(int mX, int mY, float f)
{
_mouseX = mX;
_mouseY = mY;
if (selected != -1 && !Mouse.isButtonDown(0) && Mouse.getDWheel() == 0)
{
if (Mouse.next() && Mouse.getEventButtonState())
{
options.setKeyBinding(selected, -100 + Mouse.getEventButton());
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
}
}
super.drawScreen(mX, mY, f);
}
@Override
protected void drawSlot(int index, int xPosition, int yPosition, int l, Tessellator tessellator)
{
int width = 70;
int height = 20;
xPosition -= 20;
boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + height;
int k = (flag ? 2 : 1);
mc.renderEngine.bindTexture(WIDGITS);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
controls.drawTexturedModalRect(xPosition, yPosition, 0, 46 + k * 20, width / 2, height);
controls.drawTexturedModalRect(xPosition + width / 2, yPosition, 200 - width / 2, 46 + k * 20, width / 2, height);
controls.drawString(mc.fontRenderer, options.getKeyBindingDescription(index), xPosition + width + 4, yPosition + 6, 0xFFFFFFFF);
boolean conflict = false;
for (int x = 0; x < options.keyBindings.length; x++)
{
if (x != index && options.keyBindings[x].keyCode == options.keyBindings[index].keyCode)
{
conflict = true;
break;
}
}
String str = (conflict ? EnumChatFormatting.RED : "") + options.getOptionDisplayString(index);
str = (index == selected ? EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + "??? " + EnumChatFormatting.WHITE + "<" : str);
controls.drawCenteredString(mc.fontRenderer, str, xPosition + (width / 2), yPosition + (height - 8) / 2, 0xFFFFFFFF);
}
public boolean keyTyped(char c, int i)
{
if (selected != -1)
{
options.setKeyBinding(selected, i);
selected = -1;
KeyBinding.resetKeyBindingArrayAndHash();
return false;
}
return true;
}
}
@@ -14,15 +14,18 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.GuiPlayerInfo;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.crash.CallableMinecraftVersion;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeInstance;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.scoreboard.Score;
@@ -78,7 +81,7 @@ public class GuiIngameForge extends GuiIngame
private ScaledResolution res = null;
private FontRenderer fontrenderer = null;
private RenderGameOverlayEvent eventParent;
private static final String MC_VERSION = (new CallableMinecraftVersion(null)).minecraftVersion();
private static final String MC_VERSION = "1.7.2";
public GuiIngameForge(Minecraft mc)
{
@@ -111,7 +114,7 @@ public class GuiIngameForge extends GuiIngame
}
else
{
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
}
if (renderHelmet) renderHelmet(res, partialTicks, hasScreen, mouseX, mouseY);
@@ -162,7 +165,7 @@ public class GuiIngameForge extends GuiIngame
}
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GL11.glDisable(GL11.GL_ALPHA_TEST);
renderChat(width, height);
@@ -217,8 +220,9 @@ public class GuiIngameForge extends GuiIngame
if (pre(CROSSHAIRS)) return;
bind(Gui.icons);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
OpenGlHelper.func_148821_a(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR, 1, 0);
drawTexturedModalRect(width / 2 - 7, height / 2 - 7, 0, 0, 16, 16);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GL11.glDisable(GL11.GL_BLEND);
post(CROSSHAIRS);
}
@@ -228,7 +232,9 @@ public class GuiIngameForge extends GuiIngame
{
if (pre(BOSSHEALTH)) return;
mc.mcProfiler.startSection("bossHealth");
GL11.glEnable(GL11.GL_BLEND);
super.renderBossHealth();
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(BOSSHEALTH);
}
@@ -241,7 +247,7 @@ public class GuiIngameForge extends GuiIngame
if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null)
{
if (itemstack.itemID == Block.pumpkin.blockID)
if (itemstack.getItem() == Item.func_150898_a(Blocks.pumpkin))
{
renderPumpkinBlur(res.getScaledWidth(), res.getScaledHeight());
}
@@ -259,6 +265,7 @@ public class GuiIngameForge extends GuiIngame
if (pre(ARMOR)) return;
mc.mcProfiler.startSection("armor");
GL11.glEnable(GL11.GL_BLEND);
int left = width / 2 - 91;
int top = height - left_height;
@@ -281,6 +288,7 @@ public class GuiIngameForge extends GuiIngame
}
left_height += 10;
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(ARMOR);
}
@@ -303,10 +311,11 @@ public class GuiIngameForge extends GuiIngame
{
if (pre(AIR)) return;
mc.mcProfiler.startSection("air");
GL11.glEnable(GL11.GL_BLEND);
int left = width / 2 + 91;
int top = height - right_height;
if (mc.thePlayer.isInsideOfMaterial(Material.water))
if (mc.thePlayer.isInsideOfMaterial(Material.field_151586_h))
{
int air = mc.thePlayer.getAir();
int full = MathHelper.ceiling_double_int((double)(air - 2) * 10.0D / 300.0D);
@@ -319,6 +328,7 @@ public class GuiIngameForge extends GuiIngame
right_height += 10;
}
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(AIR);
}
@@ -328,6 +338,7 @@ public class GuiIngameForge extends GuiIngame
bind(icons);
if (pre(HEALTH)) return;
mc.mcProfiler.startSection("health");
GL11.glEnable(GL11.GL_BLEND);
boolean highlight = mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
@@ -336,7 +347,7 @@ public class GuiIngameForge extends GuiIngame
highlight = false;
}
AttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
IAttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth());
int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
float healthMax = (float)attrMaxHealth.getAttributeValue();
@@ -402,6 +413,7 @@ public class GuiIngameForge extends GuiIngame
}
}
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(HEALTH);
}
@@ -411,6 +423,7 @@ public class GuiIngameForge extends GuiIngame
if (pre(FOOD)) return;
mc.mcProfiler.startSection("food");
GL11.glEnable(GL11.GL_BLEND);
int left = width / 2 + 91;
int top = height - right_height;
right_height += 10;
@@ -455,6 +468,7 @@ public class GuiIngameForge extends GuiIngame
else if (idx == level)
drawTexturedModalRect(x, y, icon + 45, 27, 9, 9);
}
GL11.glDisable(GL11.GL_BLEND);
mc.mcProfiler.endSection();
post(FOOD);
}
@@ -577,7 +591,7 @@ public class GuiIngameForge extends GuiIngame
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack);
if (font != null)
{
@@ -609,11 +623,11 @@ public class GuiIngameForge extends GuiIngame
long time = mc.theWorld.getTotalWorldTime();
if (time >= 120500L)
{
right.add(StatCollector.translateToLocal("demo.demoExpired"));
right.add(I18n.getStringParams("demo.demoExpired"));
}
else
{
right.add(String.format(StatCollector.translateToLocal("demo.remainingTime"), StringUtils.ticksToElapsedTime((int)(120500L - time))));
right.add(I18n.getStringParams("demo.remainingTime", StringUtils.ticksToElapsedTime((int)(120500L - time))));
}
}
@@ -664,10 +678,15 @@ public class GuiIngameForge extends GuiIngame
}
left.add(String.format("ws: %.3f, fs: %.3f, g: %b, fl: %d", mc.thePlayer.capabilities.getWalkSpeed(), mc.thePlayer.capabilities.getFlySpeed(), mc.thePlayer.onGround, mc.theWorld.getHeightValue(x, z)));
right.add(null);
for (String s : FMLCommonHandler.instance().getBrandings().subList(1, FMLCommonHandler.instance().getBrandings().size()))
if (mc.entityRenderer != null && mc.entityRenderer.func_147702_a())
{
right.add(s);
left.add(String.format("shader: %s", mc.entityRenderer.func_147706_e().func_148022_b()));
}
right.add(null);
for (String brand : FMLCommonHandler.instance().getBrandings(false))
{
right.add(brand);
}
GL11.glPopMatrix();
mc.mcProfiler.endSection();
@@ -710,7 +729,7 @@ public class GuiIngameForge extends GuiIngame
GL11.glPushMatrix();
GL11.glTranslatef((float)(width / 2), (float)(height - 48), 0.0F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.func_148821_a(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0);
int color = (recordIsPlaying ? Color.HSBtoRGB(hue / 50.0F, 0.7F, 0.6F) & WHITE : WHITE);
fontrenderer.drawString(recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, color | (opacity << 24));
GL11.glDisable(GL11.GL_BLEND);
@@ -730,7 +749,7 @@ public class GuiIngameForge extends GuiIngame
GL11.glPushMatrix();
GL11.glTranslatef((float)event.posX, (float)event.posY, 0.0F);
persistantChatGUI.drawChat(updateCounter);
persistantChatGUI.func_146230_a(updateCounter);
GL11.glPopMatrix();
post(CHAT);
@@ -741,14 +760,14 @@ public class GuiIngameForge extends GuiIngame
protected void renderPlayerList(int width, int height)
{
ScoreObjective scoreobjective = this.mc.theWorld.getScoreboard().func_96539_a(0);
NetClientHandler handler = mc.thePlayer.sendQueue;
NetHandlerPlayClient handler = mc.thePlayer.sendQueue;
if (mc.gameSettings.keyBindPlayerList.pressed && (!mc.isIntegratedServerRunning() || handler.playerInfoList.size() > 1 || scoreobjective != null))
if (mc.gameSettings.keyBindPlayerList.func_151470_d() && (!mc.isIntegratedServerRunning() || handler.field_147303_b.size() > 1 || scoreobjective != null))
{
if (pre(PLAYER_LIST)) return;
this.mc.mcProfiler.startSection("playerList");
List players = handler.playerInfoList;
int maxPlayers = handler.currentServerMaxPlayers;
List players = handler.field_147303_b;
int maxPlayers = handler.field_147304_c;
int rows = maxPlayers;
int columns = 1;
@@ -829,6 +848,7 @@ public class GuiIngameForge extends GuiIngame
int left_align = width / 2 + 91;
mc.mcProfiler.endStartSection("mountHealth");
GL11.glEnable(GL11.GL_BLEND);
EntityLivingBase mount = (EntityLivingBase)tmp;
int health = (int)Math.ceil((double)mount.getHealth());
float healthMax = mount.getMaxHealth();
@@ -861,6 +881,7 @@ public class GuiIngameForge extends GuiIngame
right_height += 10;
}
GL11.glDisable(GL11.GL_BLEND);
post(HEALTHMOUNT);
}
@@ -31,12 +31,9 @@ public abstract class RenderPlayerEvent extends PlayerEvent
public abstract static class Specials extends RenderPlayerEvent
{
@Deprecated
public final float partialTicks;
public Specials(EntityPlayer player, RenderPlayer renderer, float partialTicks)
{
super(player, renderer, partialTicks);
this.partialTicks = partialTicks;
}
@Cancelable
@@ -62,14 +59,11 @@ public abstract class RenderPlayerEvent extends PlayerEvent
*/
public int result = -1;
public final int slot;
@Deprecated
public final float partialTick;
public final ItemStack stack;
public SetArmorModel(EntityPlayer player, RenderPlayer renderer, int slot, float partialTick, ItemStack stack)
{
super(player, renderer, partialTick);
this.slot = slot;
this.partialTick = partialTick;
this.stack = stack;
}
}