Make resourcelocation the class available on the server.

This commit is contained in:
Christian 2013-07-08 17:30:25 -04:00
parent 033eedb50f
commit 38bd039a93
15 changed files with 72 additions and 68 deletions

View File

@ -28,6 +28,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.RenderGlobal;
@ -35,7 +36,6 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
@ -93,7 +93,7 @@ public class ForgeHooksClient
}
GL11.glScalef(scale, scale, scale);
int size = item.stackSize;
int count = (size > 40 ? 5 : (size > 20 ? 4 : (size > 5 ? 3 : (size > 1 ? 2 : 1))));
@ -172,7 +172,7 @@ public class ForgeHooksClient
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
}
return true;
}
@ -239,7 +239,7 @@ public class ForgeHooksClient
public static void onTextureStitchedPost(TextureMap map)
{
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map));
FluidRegistry.WATER.setIcons(BlockFluid.func_94424_b("water"), BlockFluid.func_94424_b("water_flow"));
FluidRegistry.LAVA.setIcons(BlockFluid.func_94424_b("lava"), BlockFluid.func_94424_b("lava_flow"));
}

View File

@ -10,8 +10,8 @@ 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.client.resources.ResourceLocation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GuiControlsScrollPanel extends GuiSlot
{

View File

@ -17,7 +17,6 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.NetClientHandler;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.crash.CallableMinecraftVersion;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -33,6 +32,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.FoodStats;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.util.StringUtils;
import net.minecraft.world.EnumSkyBlock;
@ -52,7 +52,7 @@ public class GuiIngameForge extends GuiIngame
private static final ResourceLocation VIGNETTE = new ResourceLocation("textures/misc/vignette.png");
private static final ResourceLocation WIDGITS = new ResourceLocation("textures/gui/widgets.png");
private static final ResourceLocation PUMPKIN_BLUR = new ResourceLocation("textures/misc/pumpkinblur.png");
private static final int WHITE = 0xFFFFFF;
//Flags to toggle the rendering of certain aspects of the HUD, valid conditions
@ -71,7 +71,7 @@ public class GuiIngameForge extends GuiIngame
public static boolean renderExperiance = true;
public static boolean renderJumpBar = true;
public static boolean renderObjective = true;
public static int left_height = 39;
public static int right_height = 39;
@ -95,7 +95,7 @@ public class GuiIngameForge extends GuiIngame
renderHealthMount = mc.thePlayer.ridingEntity instanceof EntityLivingBase;
renderFood = mc.thePlayer.ridingEntity == null;
renderJumpBar = mc.thePlayer.func_110317_t();
right_height = 39;
left_height = 39;
@ -129,7 +129,7 @@ public class GuiIngameForge extends GuiIngame
if (renderCrosshairs) renderCrosshairs(width, height);
if (renderBossHealth) renderBossHealth();
if (this.mc.playerController.shouldDrawHUD())
{
if (renderHealth) renderHealth(width, height);
@ -145,7 +145,7 @@ public class GuiIngameForge extends GuiIngame
{
renderJumpBar(width, height);
}
else if (renderExperiance)
else if (renderExperiance)
{
renderExperience(width, height);
}
@ -344,9 +344,9 @@ public class GuiIngameForge extends GuiIngame
int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
int rowHeight = Math.max(10 - (healthRows - 2), 3);
this.rand.setSeed((long)(updateCounter * 312871));
int left = width / 2 - 91;
int top = height - left_height;
left_height += (healthRows * rowHeight);
@ -357,14 +357,14 @@ public class GuiIngameForge extends GuiIngame
{
regen = updateCounter % 25;
}
final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int BACKGROUND = (highlight ? 25 : 16);
int MARGIN = 16;
if (mc.thePlayer.isPotionActive(Potion.poison)) MARGIN += 36;
else if (mc.thePlayer.isPotionActive(Potion.wither)) MARGIN += 72;
float absorbRemaining = absorb;
for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i)
{
int b0 = (highlight ? 1 : 0);
@ -373,7 +373,7 @@ public class GuiIngameForge extends GuiIngame
int y = top - row * rowHeight;
if (health <= 4) y += rand.nextInt(2);
if (i == regen) y -= 2;
if (i == regen) y -= 2;
drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9);
@ -401,7 +401,7 @@ public class GuiIngameForge extends GuiIngame
drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); //5
}
}
mc.mcProfiler.endSection();
post(HEALTH);
}
@ -487,20 +487,20 @@ public class GuiIngameForge extends GuiIngame
bind(field_110324_m);
if (pre(EXPERIENCE)) return;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (mc.playerController.func_78763_f())
{
mc.mcProfiler.startSection("expBar");
int cap = this.mc.thePlayer.xpBarCap();
int left = width / 2 - 91;
if (cap > 0)
{
short barWidth = 182;
int filled = (int)(mc.thePlayer.experience * (float)(barWidth + 1));
int top = height - 32 + 3;
drawTexturedModalRect(left, top, 0, 64, barWidth, 5);
if (filled > 0)
{
drawTexturedModalRect(left, top, 0, 69, filled, 5);
@ -508,8 +508,8 @@ public class GuiIngameForge extends GuiIngame
}
this.mc.mcProfiler.endSection();
if (mc.playerController.func_78763_f() && mc.thePlayer.experienceLevel > 0)
{
mc.mcProfiler.startSection("expLevel");
@ -536,7 +536,7 @@ public class GuiIngameForge extends GuiIngame
bind(field_110324_m);
if (pre(JUMPBAR)) return;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.mcProfiler.startSection("jumpBar");
float charge = mc.thePlayer.func_110319_bJ();
final int barWidth = 182;
@ -813,12 +813,12 @@ public class GuiIngameForge extends GuiIngame
if (!(tmp instanceof EntityLivingBase)) return;
bind(field_110324_m);
if (pre(HEALTHMOUNT)) return;
boolean unused = false;
int left_align = width / 2 + 91;
mc.mcProfiler.endStartSection("mountHealth");
EntityLivingBase mount = (EntityLivingBase)tmp;
int health = (int)Math.ceil((double)mount.func_110143_aJ());
@ -826,7 +826,7 @@ public class GuiIngameForge extends GuiIngame
int hearts = (int)(healthMax + 0.5F) / 2;
if (hearts > 30) hearts = 30;
final int MARGIN = 52;
final int BACKGROUND = MARGIN + (unused ? 1 : 0);
final int HALF = MARGIN + 45;
@ -835,7 +835,7 @@ public class GuiIngameForge extends GuiIngame
for (int heart = 0; hearts > 0; heart += 20)
{
int top = height - right_height;
int rowCount = Math.min(hearts, 10);
hearts -= rowCount;

2
fml

@ -1 +1 @@
Subproject commit 2336002f20e9412a7663781b23c51de0eff6a692
Subproject commit 26e5f4b4ff5c8e95f9307a893e626e355162241f

View File

@ -1,10 +0,0 @@
--- ../src_base/minecraft/net/minecraft/client/audio/SoundPool.java
+++ ../src_work/minecraft/net/minecraft/client/audio/SoundPool.java
@@ -12,6 +12,7 @@
import java.util.Random;
import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.client.resources.ResourceManager;
+import net.minecraftforge.client.ForgeHooksClient;
@SideOnly(Side.CLIENT)
public class SoundPool

View File

@ -1,13 +1,13 @@
--- ../src_base/minecraft/net/minecraft/client/particle/EffectRenderer.java
+++ ../src_work/minecraft/net/minecraft/client/particle/EffectRenderer.java
@@ -13,6 +13,7 @@
import net.minecraft.client.resources.ResourceLocation;
@@ -12,6 +12,7 @@
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
@@ -63,9 +64,13 @@
for (int j = 0; j < this.fxLayers[i].size(); ++j)
{

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/ItemRenderer.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/ItemRenderer.java
@@ -17,6 +17,8 @@
@@ -16,6 +16,8 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;

View File

@ -1,12 +1,12 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java
@@ -14,9 +14,15 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
@ -36,7 +36,7 @@
+ /**
+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide.
+ *
+ *
+ * @param entity Entity wearing the armor
+ * @param stack ItemStack for the armor
+ * @param slot Slot ID that the item is in
@ -46,9 +46,9 @@
+ public static ResourceLocation getArmorResource(Entity entity, ItemStack stack, int slot, String type)
+ {
+ ItemArmor item = (ItemArmor)stack.getItem();
+ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png",
+ String s1 = String.format("textures/models/armor/%s_layer_%d%s.png",
+ bipedArmorFilenamePrefix[item.renderIndex], (slot == 2 ? 2 : 1), type == null ? "" : String.format("_%s", type));
+
+
+ s1 = ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, (slot == 2 ? 2 : 1), type);
+ ResourceLocation resourcelocation = (ResourceLocation)field_110859_k.get(s1);
+

View File

@ -1,9 +1,16 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
@@ -21,7 +21,16 @@
@@ -15,13 +15,22 @@
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.MinecraftForgeClient;
@ -11,7 +18,6 @@
+import net.minecraftforge.common.MinecraftForge;
+
import org.lwjgl.opengl.GL11;
+import net.minecraft.item.ItemBlock;
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
@ -125,7 +131,7 @@
boolean flag = par1AbstractClientPlayer.func_110310_o().func_110557_a();
boolean flag1 = !par1AbstractClientPlayer.isInvisible();
boolean flag2 = !par1AbstractClientPlayer.getHideCape();
+ flag = event.renderCape && flag;
+ flag = event.renderCape && flag;
float f6;
if (flag && flag1 && flag2)

View File

@ -1,13 +1,13 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java
@@ -9,8 +9,14 @@
@@ -8,9 +8,14 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySnowman;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
+
+import net.minecraftforge.client.IItemRenderer;
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
@ -15,7 +15,7 @@
@SideOnly(Side.CLIENT)
public class RenderSnowMan extends RenderLiving
@@ -35,12 +41,15 @@
@@ -35,12 +40,15 @@
super.renderEquippedItems(par1EntitySnowman, par2);
ItemStack itemstack = new ItemStack(Block.pumpkin, 1);

View File

@ -1,9 +1,9 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java
@@ -17,6 +17,9 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.RenderLivingEvent;
+import net.minecraftforge.common.MinecraftForge;
+

View File

@ -1,21 +1,24 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
@@ -11,6 +11,8 @@
@@ -11,9 +11,11 @@
import java.util.List;
import javax.imageio.ImageIO;
import net.minecraft.client.resources.Resource;
+import net.minecraft.client.resources.ResourceLocation;
+import net.minecraft.client.resources.ResourceManager;
import net.minecraft.client.resources.data.AnimationFrame;
import net.minecraft.client.resources.data.AnimationMetadataSection;
import net.minecraft.util.Icon;
+import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class TextureAtlasSprite implements Icon
@@ -184,6 +186,20 @@
this.field_130224_d = par1;
}
+ /**
+ * Load the specified resource as this sprite's data.
+ * Returning false from this function will prevent this icon from being stitched onto the master texture.
+ * Returning false from this function will prevent this icon from being stitched onto the master texture.
+ * @param manager Main resource manager
+ * @param location File resource location
+ * @return False to prevent this Icon from being stitched
@ -26,7 +29,7 @@
+ func_130100_a(manager.func_110536_a(location));
+ return true;
+ }
+
+
public void func_130100_a(Resource par1Resource) throws IOException
{
this.func_130102_n();

View File

@ -1,9 +1,9 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
@@ -21,6 +21,7 @@
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.ForgeHooksClient;
@SideOnly(Side.CLIENT)

View File

@ -1,14 +1,17 @@
--- ../src_base/minecraft/net/minecraft/inventory/Slot.java
+++ ../src_work/minecraft/net/minecraft/inventory/Slot.java
@@ -2,6 +2,8 @@
@@ -2,9 +2,11 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.client.renderer.texture.TextureMap;
+import net.minecraft.client.resources.ResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
+import net.minecraft.util.ResourceLocation;
public class Slot
{
@@ -22,6 +24,13 @@
/** display position of the inventory slot on the screen y axis */
@ -39,7 +42,7 @@
+
+ /**
+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI.
+ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background.
+ * @return String: The texture file that will be used in GuiContainer.drawSlotInventory for the slot background.
+ */
+ @SideOnly(Side.CLIENT)
+ public ResourceLocation getBackgroundIconTexture()
@ -49,7 +52,7 @@
+
+ /**
+ * Sets which icon index to use as the background image of the slot when it's empty.
+ * @param icon The icon to use, null for none
+ * @param icon The icon to use, null for none
+ */
+ public void setBackgroundIcon(Icon icon)
+ {
@ -67,9 +70,9 @@
+ }
+
+ /**
+ * Retrieves the index in the inventory for this slot, this value should typically not
+ * Retrieves the index in the inventory for this slot, this value should typically not
+ * be used, but can be useful for some occasions.
+ *
+ *
+ * @return Index in associated inventory for this slot.
+ */
+ public int getSlotIndex()

View File

@ -49,7 +49,9 @@ def main():
for cur_file in fnmatch.filter(filelist, '*.java'):
file_base = os.path.normpath(os.path.join(base, path[len(work)+1:], cur_file)).replace(os.path.sep, '/')
file_work = os.path.normpath(os.path.join(work, path[len(work)+1:], cur_file)).replace(os.path.sep, '/')
if not os.path.isfile(file_base):
print("Missing base file %s"%(file_base))
continue
fromlines = open(file_base, 'U').readlines()
tolines = open(file_work, 'U').readlines()
@ -74,4 +76,4 @@ def main():
cleanDirs(patchd)
if __name__ == '__main__':
main()
main()