GUI Patches

This commit is contained in:
LexManos 2018-11-21 21:23:24 -08:00
parent b6ddb0a7cf
commit 47a11b9a7e
32 changed files with 1518 additions and 42 deletions

View file

@ -0,0 +1,91 @@
--- a/net/minecraft/client/GameSettings.java
+++ b/net/minecraft/client/GameSettings.java
@@ -168,6 +168,7 @@
public boolean field_211842_aO;
public GameSettings(Minecraft p_i46326_1_, File p_i46326_2_) {
+ setForgeKeybindProperties();
this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[]{this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X, this.field_193629_ap, this.field_193630_aq, this.field_194146_ao}, this.field_151456_ac);
this.field_74318_M = EnumDifficulty.NORMAL;
this.field_74332_R = "";
@@ -186,6 +187,7 @@
}
public GameSettings() {
+ setForgeKeybindProperties();
this.field_74324_K = (KeyBinding[])ArrayUtils.addAll(new KeyBinding[]{this.field_74312_F, this.field_74313_G, this.field_74351_w, this.field_74370_x, this.field_74368_y, this.field_74366_z, this.field_74314_A, this.field_74311_E, this.field_151444_V, this.field_74316_C, this.field_151445_Q, this.field_74310_D, this.field_74321_H, this.field_74322_I, this.field_74323_J, this.field_151447_Z, this.field_151457_aa, this.field_151458_ab, this.field_152395_am, this.field_178883_an, this.field_186718_X, this.field_193629_ap, this.field_193630_aq, this.field_194146_ao}, this.field_151456_ac);
this.field_74318_M = EnumDifficulty.NORMAL;
this.field_74332_R = "";
@@ -247,7 +249,7 @@
this.field_74317_L.func_147117_R().func_147633_a(this.field_151442_I);
this.field_74317_L.func_110434_K().func_110577_a(TextureMap.field_110575_b);
this.field_74317_L.func_147117_R().func_174937_a(false, this.field_151442_I > 0);
- this.field_74317_L.func_175603_A();
+ this.needsBlockModelRefresh = true; // FORGE: fix for MC-64581 very laggy mipmap slider
}
}
@@ -857,7 +859,11 @@
for(KeyBinding keybinding : this.field_74324_K) {
if (s1.equals("key_" + keybinding.func_151464_g())) {
- keybinding.func_197979_b(InputMappings.func_197955_a(s2));
+ if (s2.indexOf(':') != -1) {
+ String[] pts = s2.split(":");
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.valueFromString(pts[1]), InputMappings.func_197955_a(pts[0]));
+ } else
+ keybinding.setKeyModifierAndCode(net.minecraftforge.client.settings.KeyModifier.NONE, InputMappings.func_197955_a(s2));
}
}
@@ -905,6 +911,7 @@
}
public void func_74303_b() {
+ if (net.minecraftforge.fml.client.ClientModLoader.isLoading()) return; //Don't save settings before mods add keybindigns and the like to prevent them from being deleted.
PrintWriter printwriter = null;
try {
@@ -982,7 +989,7 @@
printwriter.println("glDebugVerbosity:" + this.field_209231_W);
for(KeyBinding keybinding : this.field_74324_K) {
- printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m());
+ printwriter.println("key_" + keybinding.func_151464_g() + ":" + keybinding.func_197982_m() + (keybinding.getKeyModifier() != net.minecraftforge.client.settings.KeyModifier.NONE ? ":" + keybinding.getKeyModifier() : ""));
}
for(SoundCategory soundcategory : SoundCategory.values()) {
@@ -1084,6 +1091,33 @@
p_198017_1_.func_198985_a(set);
}
+ private void setForgeKeybindProperties() {
+ net.minecraftforge.client.settings.KeyConflictContext inGame = net.minecraftforge.client.settings.KeyConflictContext.IN_GAME;
+ field_74351_w.setKeyConflictContext(inGame);
+ field_74370_x.setKeyConflictContext(inGame);
+ field_74368_y.setKeyConflictContext(inGame);
+ field_74366_z.setKeyConflictContext(inGame);
+ field_74314_A.setKeyConflictContext(inGame);
+ field_74311_E.setKeyConflictContext(inGame);
+ field_151444_V.setKeyConflictContext(inGame);
+ field_74312_F.setKeyConflictContext(inGame);
+ field_74310_D.setKeyConflictContext(inGame);
+ field_74321_H.setKeyConflictContext(inGame);
+ field_74323_J.setKeyConflictContext(inGame);
+ field_151457_aa.setKeyConflictContext(inGame);
+ field_151458_ab.setKeyConflictContext(inGame);
+ field_186718_X.setKeyConflictContext(inGame);
+ }
+
+ // FORGE: fix for MC-64581 very laggy mipmap slider
+ private boolean needsBlockModelRefresh = false;
+ public void onGuiClosed() {
+ if (needsBlockModelRefresh) {
+ this.field_74317_L.func_152344_a(() -> net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_74317_L, net.minecraftforge.client.resource.VanillaResourceType.MODELS));
+ this.needsBlockModelRefresh = false;
+ }
+ }
+
@OnlyIn(Dist.CLIENT)
public static enum Options {
INVERT_MOUSE("options.invertMouse", false, true),

View file

@ -0,0 +1,48 @@
--- a/net/minecraft/client/audio/SoundHandler.java
+++ b/net/minecraft/client/audio/SoundHandler.java
@@ -63,6 +63,7 @@
public void func_195410_a(IResourceManager p_195410_1_) {
this.field_147697_e.func_148763_c();
+ java.util.List<net.minecraft.util.Tuple<ResourceLocation, SoundList>> resources = new java.util.LinkedList<>();
for(String s : p_195410_1_.func_199001_a()) {
try {
for(IResource iresource : p_195410_1_.func_199004_b(new ResourceLocation(s, "sounds.json"))) {
@@ -70,7 +71,7 @@
Map<String, SoundList> map = this.func_175085_a(iresource.func_199027_b());
for(Entry<String, SoundList> entry : map.entrySet()) {
- this.func_147693_a(new ResourceLocation(s, entry.getKey()), entry.getValue());
+ resources.add(new net.minecraft.util.Tuple<>(new ResourceLocation(s, entry.getKey()), entry.getValue()));
}
} catch (RuntimeException runtimeexception) {
field_147698_b.warn("Invalid sounds.json in resourcepack: '{}'", iresource.func_199026_d(), runtimeexception);
@@ -81,6 +82,17 @@
}
}
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resourcesBar = net.minecraftforge.fml.common.ProgressManager.push("Loading sounds", resources.size());
+ resources.forEach(entry -> {
+ resourcesBar.step(entry.func_76341_a().toString());
+ try {
+ this.func_147693_a(entry.func_76341_a(), entry.func_76340_b());
+ } catch (RuntimeException e) {
+ field_147698_b.warn("Invalid sounds.json", e);
+ }
+ });
+ net.minecraftforge.fml.common.ProgressManager.pop(resourcesBar);
+
for(ResourceLocation resourcelocation : this.field_147697_e.func_148742_b()) {
SoundEventAccessor soundeventaccessor = (SoundEventAccessor)this.field_147697_e.func_82594_a(resourcelocation);
if (soundeventaccessor.func_188712_c() instanceof TextComponentTranslation) {
@@ -210,6 +222,10 @@
this.field_147694_f.func_148615_a(p_147691_1_, p_147691_2_);
}
+ public void setListener(net.minecraft.entity.Entity entity, float partialTicks) {
+ this.field_147694_f.setListener(entity, partialTicks);
+ }
+
public void func_147689_b() {
this.field_147694_f.func_148610_e();
}

View file

@ -0,0 +1,61 @@
--- a/net/minecraft/client/audio/SoundManager.java
+++ b/net/minecraft/client/audio/SoundManager.java
@@ -75,6 +75,7 @@
try {
SoundSystemConfig.addLibrary(LibraryLWJGL3.class);
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this));
} catch (SoundSystemException soundsystemexception) {
field_148621_b.error(field_148623_a, "Error linking with the LibraryJavaSound plug-in", (Throwable)soundsystemexception);
}
@@ -94,6 +95,7 @@
this.func_148613_b();
this.func_148608_i();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this));
}
private synchronized void func_148608_i() {
@@ -299,6 +301,8 @@
public void func_148611_c(ISound p_148611_1_) {
if (this.field_148617_f) {
+ p_148611_1_ = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_148611_1_);
+ if (p_148611_1_ == null) return;
SoundEventAccessor soundeventaccessor = p_148611_1_.func_184366_a(this.field_148622_c);
ResourceLocation resourcelocation = p_148611_1_.func_147650_b();
if (soundeventaccessor == null) {
@@ -340,8 +344,10 @@
ResourceLocation resourcelocation1 = sound.func_188721_b();
if (sound.func_188723_h()) {
this.field_148620_e.newStreamingSource(p_148611_1_.func_204200_l(), s, func_148612_a(resourcelocation1), resourcelocation1.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_148611_1_, s));
} else {
this.field_148620_e.newSource(p_148611_1_.func_204200_l(), s, func_148612_a(resourcelocation1), resourcelocation1.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_148611_1_, s));
}
field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", sound.func_188719_a(), resourcelocation, s);
@@ -429,12 +435,16 @@
}
public void func_148615_a(EntityPlayer p_148615_1_, float p_148615_2_) {
- if (this.field_148617_f && p_148615_1_ != null) {
- float f = p_148615_1_.field_70127_C + (p_148615_1_.field_70125_A - p_148615_1_.field_70127_C) * p_148615_2_;
- float f1 = p_148615_1_.field_70126_B + (p_148615_1_.field_70177_z - p_148615_1_.field_70126_B) * p_148615_2_;
- double d0 = p_148615_1_.field_70169_q + (p_148615_1_.field_70165_t - p_148615_1_.field_70169_q) * (double)p_148615_2_;
- double d1 = p_148615_1_.field_70167_r + (p_148615_1_.field_70163_u - p_148615_1_.field_70167_r) * (double)p_148615_2_ + (double)p_148615_1_.func_70047_e();
- double d2 = p_148615_1_.field_70166_s + (p_148615_1_.field_70161_v - p_148615_1_.field_70166_s) * (double)p_148615_2_;
+ setListener((net.minecraft.entity.Entity)p_148615_1_, p_148615_2_);
+ }
+
+ public void setListener(net.minecraft.entity.Entity player, float partialTicks) {
+ if (this.field_148617_f && player != null) {
+ float f = player.field_70127_C + (player.field_70125_A - player.field_70127_C) * partialTicks;
+ float f1 = player.field_70126_B + (player.field_70177_z - player.field_70126_B) * partialTicks;
+ double d0 = player.field_70169_q + (player.field_70165_t - player.field_70169_q) * (double)partialTicks;
+ double d1 = player.field_70167_r + (player.field_70163_u - player.field_70167_r) * (double)partialTicks + (double)player.func_70047_e();
+ double d2 = player.field_70166_s + (player.field_70161_v - player.field_70166_s) * (double)partialTicks;
float f2 = MathHelper.func_76134_b((f1 + 90.0F) * ((float)Math.PI / 180F));
float f3 = MathHelper.func_76126_a((f1 + 90.0F) * ((float)Math.PI / 180F));
float f4 = MathHelper.func_76134_b(-f * ((float)Math.PI / 180F));

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/entity/AbstractClientPlayer.java
+++ b/net/minecraft/client/entity/AbstractClientPlayer.java
@@ -126,6 +126,6 @@
f *= 1.0F - f1 * 0.15F;
}
- return f;
+ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f);
}
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/entity/EntityOtherPlayerMP.java
+++ b/net/minecraft/client/entity/EntityOtherPlayerMP.java
@@ -29,6 +29,7 @@
}
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
+ net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_);
return true;
}

View file

@ -0,0 +1,62 @@
--- a/net/minecraft/client/entity/EntityPlayerSP.java
+++ b/net/minecraft/client/entity/EntityPlayerSP.java
@@ -137,6 +137,7 @@
}
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_) {
+ net.minecraftforge.common.ForgeHooks.onPlayerAttack(this, p_70097_1_, p_70097_2_);
return false;
}
@@ -465,6 +466,11 @@
}
public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_) {
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_184185_1_ = event.getSound();
+ p_184185_2_ = event.getVolume();
+ p_184185_3_ = event.getPitch();
this.field_70170_p.func_184134_a(this.field_70165_t, this.field_70163_u, this.field_70161_v, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false);
}
@@ -670,6 +676,7 @@
float f = 0.8F;
boolean flag2 = this.field_71158_b.field_192832_b >= 0.8F;
this.field_71158_b.func_78898_a();
+ net.minecraftforge.client.ForgeHooksClient.onInputUpdate(this, this.field_71158_b);
this.field_71159_c.func_193032_ao().func_193293_a(this.field_71158_b);
if (this.func_184587_cr() && !this.func_184218_aH()) {
this.field_71158_b.field_78902_a *= 0.2F;
@@ -685,10 +692,14 @@
}
AxisAlignedBB axisalignedbb = this.func_174813_aQ();
+ net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent event = new net.minecraftforge.client.event.PlayerSPPushOutOfBlocksEvent(this, axisalignedbb);
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) {
+ axisalignedbb = event.getEntityBoundingBox();
this.func_145771_j(this.field_70165_t - (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.field_70130_N * 0.35D);
this.func_145771_j(this.field_70165_t - (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.field_70130_N * 0.35D);
this.func_145771_j(this.field_70165_t + (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v - (double)this.field_70130_N * 0.35D);
this.func_145771_j(this.field_70165_t + (double)this.field_70130_N * 0.35D, axisalignedbb.field_72338_b + 0.5D, this.field_70161_v + (double)this.field_70130_N * 0.35D);
+ }
boolean flag4 = (float)this.func_71024_bL().func_75116_a() > 6.0F || this.field_71075_bZ.field_75101_c;
if ((this.field_70122_E || this.func_204231_K()) && !flag1 && !flag2 && this.field_71158_b.field_192832_b >= 0.8F && !this.func_70051_ag() && flag4 && !this.func_184587_cr() && !this.func_70644_a(MobEffects.field_76440_q)) {
if (this.field_71156_d <= 0 && !this.field_71159_c.field_71474_y.field_151444_V.func_151470_d()) {
@@ -973,4 +984,16 @@
return this.field_204230_bP;
}
}
+
+ public void updateSyncFields(EntityPlayerSP old) {
+ this.field_175172_bI = old.field_175172_bI;
+ this.field_175166_bJ = old.field_175166_bJ;
+ this.field_175167_bK = old.field_175167_bK;
+ this.field_175164_bL = old.field_175164_bL;
+ this.field_175165_bM = old.field_175165_bM;
+ this.field_184841_cd = old.field_184841_cd;
+ this.field_175170_bN = old.field_175170_bN;
+ this.field_175171_bO = old.field_175171_bO;
+ this.field_175168_bP = old.field_175168_bP;
+ }
}

View file

@ -0,0 +1,26 @@
--- a/net/minecraft/client/gui/GuiCreateWorld.java
+++ b/net/minecraft/client/gui/GuiCreateWorld.java
@@ -159,14 +159,7 @@
this.field_146321_E.field_146125_m = false;
this.field_146322_F = this.func_189646_b(new GuiButton(8, this.field_146294_l / 2 + 5, 120, 150, 20, I18n.func_135052_a("selectWorld.customizeType")) {
public void func_194829_a(double p_194829_1_, double p_194829_3_) {
- if (WorldType.field_77139_a[GuiCreateWorld.this.field_146331_K] == WorldType.field_77138_c) {
- GuiCreateWorld.this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(GuiCreateWorld.this, GuiCreateWorld.this.field_146334_a));
- }
-
- if (WorldType.field_77139_a[GuiCreateWorld.this.field_146331_K] == WorldType.field_205394_h) {
- GuiCreateWorld.this.field_146297_k.func_147108_a(new GuiCreateBuffetWorld(GuiCreateWorld.this, GuiCreateWorld.this.field_146334_a));
- }
-
+ WorldType.field_77139_a[GuiCreateWorld.this.field_146331_K].onCustomizeButton(GuiCreateWorld.this.field_146297_k, GuiCreateWorld.this);
}
});
this.field_146322_F.field_146125_m = false;
@@ -258,6 +251,7 @@
i = (long)s.hashCode();
}
}
+ WorldType.field_77139_a[this.field_146331_K].onGUICreateWorldPress();
WorldSettings worldsettings = new WorldSettings(i, GameType.func_77142_a(this.field_146342_r), this.field_146341_s, this.field_146337_w, WorldType.field_77139_a[this.field_146331_K]);
worldsettings.func_205390_a((JsonElement)Dynamic.convert(NBTDynamicOps.field_210820_a, JsonOps.INSTANCE, this.field_146334_a));

View file

@ -0,0 +1,24 @@
--- a/net/minecraft/client/gui/GuiEnchantment.java
+++ b/net/minecraft/client/gui/GuiEnchantment.java
@@ -153,7 +153,7 @@
String s1 = EnchantmentNameParts.func_178176_a().func_148334_a(this.field_146289_q, i2);
FontRenderer fontrenderer = this.field_146297_k.func_211500_ak().func_211504_a(Minecraft.field_71464_q);
int j2 = 6839882;
- if ((l < i1 + 1 || this.field_146297_k.field_71439_g.field_71068_ca < l1) && !this.field_146297_k.field_71439_g.field_71075_bZ.field_75098_d) {
+ if (((l < i1 + 1 || this.field_146297_k.field_71439_g.field_71068_ca < l1) && !this.field_146297_k.field_71439_g.field_71075_bZ.field_75098_d) || this.field_147075_G.field_185001_h[l] == -1) { // Forge: render buttons as disabled when enchantable but enchantability not met on lower levels
this.func_73729_b(j1, j + 14 + 19 * i1, 0, 185, 108, 19);
this.func_73729_b(j1 + 1, j + 15 + 19 * i1, 16 * i1, 239, 16, 16);
fontrenderer.func_78279_b(s1, k1, j + 16 + 19 * i1, i2, (j2 & 16711422) >> 1);
@@ -193,9 +193,10 @@
Enchantment enchantment = Enchantment.func_185262_c(this.field_147075_G.field_185001_h[j]);
int l = this.field_147075_G.field_185002_i[j];
int i1 = j + 1;
- if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_73863_1_, (double)p_73863_2_) && k > 0 && l >= 0 && enchantment != null) {
+ if (this.func_195359_a(60, 14 + 19 * j, 108, 17, (double)p_73863_1_, (double)p_73863_2_) && k > 0) {
List<String> list = Lists.<String>newArrayList();
- list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.func_135052_a("container.enchant.clue", enchantment.func_200305_d(l).func_150254_d()));
+ list.add("" + TextFormatting.WHITE + TextFormatting.ITALIC + I18n.func_135052_a("container.enchant.clue", enchantment == null ? "" : enchantment.func_200305_d(l).func_150254_d()));
+ if (enchantment == null) java.util.Collections.addAll(list, "", TextFormatting.RED + I18n.func_135052_a("forge.container.enchant.limitedEnchantability")); else
if (!flag) {
list.add("");
if (this.field_146297_k.field_71439_g.field_71068_ca < k) {

View file

@ -1,6 +1,38 @@
--- a/net/minecraft/client/gui/GuiIngame.java --- a/net/minecraft/client/gui/GuiIngame.java
+++ b/net/minecraft/client/gui/GuiIngame.java +++ b/net/minecraft/client/gui/GuiIngame.java
@@ -548,7 +548,13 @@ @@ -323,7 +323,7 @@
}
BlockPos blockpos = raytraceresult.func_178782_a();
- if (!this.field_73839_d.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149716_u() || !(this.field_73839_d.field_71441_e.func_175625_s(blockpos) instanceof IInventory)) {
+ if (!this.field_73839_d.field_71441_e.func_180495_p(blockpos).hasTileEntity() || !(this.field_73839_d.field_71441_e.func_175625_s(blockpos) instanceof IInventory)) {
return;
}
}
@@ -374,7 +374,10 @@
for(PotionEffect potioneffect : Ordering.natural().reverse().sortedCopy(collection)) {
Potion potion = potioneffect.func_188419_a();
- if (potion.func_76400_d() && potioneffect.func_205348_f()) {
+ if (!potion.shouldRenderHUD(potioneffect)) continue;
+ // Rebind in case previous renderHUDEffect changed texture
+ this.field_73839_d.func_110434_K().func_110577_a(GuiContainer.field_147001_a);
+ if (potioneffect.func_205348_f()) {
int k = this.field_194811_H;
int l = 1;
if (this.field_73839_d.func_71355_q()) {
@@ -406,7 +409,10 @@
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, f);
int l1 = i1 % 12;
int k1 = i1 / 12;
+ // FORGE - Move status icon check down from above so renderHUDEffect will still be called without a status icon
+ if (potion.func_76400_d())
this.func_73729_b(k + 3, l + 3, l1 * 18, 198 + k1 * 18, 18, 18);
+ potion.renderHUDEffect(k, l, potioneffect, field_73839_d, f);
}
}
@@ -548,7 +554,13 @@
GlStateManager.func_179094_E(); GlStateManager.func_179094_E();
GlStateManager.func_179147_l(); GlStateManager.func_179147_l();
GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/GuiLanguage.java
+++ b/net/minecraft/client/gui/GuiLanguage.java
@@ -82,7 +82,7 @@
Language language = this.field_148177_m.get(this.field_148176_l.get(p_195078_1_));
GuiLanguage.this.field_146454_h.func_135045_a(language);
GuiLanguage.this.field_146451_g.field_74363_ab = language.func_135034_a();
- this.field_148161_k.func_110436_a();
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(GuiLanguage.this.field_146297_k, net.minecraftforge.client.resource.VanillaResourceType.LANGUAGES);
GuiLanguage.this.field_146289_q.func_78275_b(GuiLanguage.this.field_146454_h.func_135044_b());
GuiLanguage.this.field_146452_r.field_146126_j = I18n.func_135052_a("gui.done");
GuiLanguage.this.field_211832_i.field_146126_j = GuiLanguage.this.field_146451_g.func_74297_c(GameSettings.Options.FORCE_UNICODE_FONT);

View file

@ -1,6 +1,23 @@
--- a/net/minecraft/client/gui/GuiMainMenu.java --- a/net/minecraft/client/gui/GuiMainMenu.java
+++ b/net/minecraft/client/gui/GuiMainMenu.java +++ b/net/minecraft/client/gui/GuiMainMenu.java
@@ -192,12 +192,18 @@ @@ -59,6 +59,7 @@
private int field_193978_M;
private int field_193979_N;
private final RenderSkybox field_209101_K;
+ private net.minecraftforge.client.gui.NotificationModUpdateScreen modUpdateNotification;
public GuiMainMenu() {
this.field_146972_A = field_96138_a;
@@ -178,7 +179,7 @@
if (this.func_183501_a()) {
this.field_183503_M.func_146280_a(this.field_146297_k, this.field_146294_l, this.field_146295_m);
}
-
+ modUpdateNotification = net.minecraftforge.client.gui.NotificationModUpdateScreen.init(this, field_146292_n.stream().filter(b -> b.field_146127_k == 6).findFirst().orElse(null)); // The Mobs button is id 6
}
private void func_73969_a(int p_73969_1_, int p_73969_2_) {
@@ -192,11 +193,17 @@
GuiMainMenu.this.field_146297_k.func_147108_a(new GuiMultiplayer(GuiMainMenu.this)); GuiMainMenu.this.field_146297_k.func_147108_a(new GuiMultiplayer(GuiMainMenu.this));
} }
}); });
@ -14,13 +31,12 @@
+ @Override + @Override
+ public void func_194829_a(double p_194829_1_, double p_194829_3_) { + public void func_194829_a(double p_194829_1_, double p_194829_3_) {
+ GuiMainMenu.this.field_146297_k.func_147108_a(new net.minecraftforge.fml.client.gui.GuiModList(GuiMainMenu.this)); + GuiMainMenu.this.field_146297_k.func_147108_a(new net.minecraftforge.fml.client.gui.GuiModList(GuiMainMenu.this));
}
+ });
+ } + }
+ });
}
private void func_73972_b(int p_73972_1_, int p_73972_2_) { private void func_73972_b(int p_73972_1_, int p_73972_2_) {
this.func_189646_b(new GuiButton(11, this.field_146294_l / 2 - 100, p_73972_1_, I18n.func_135052_a("menu.playdemo")) { @@ -206,7 +213,7 @@
@@ -206,7 +212,7 @@
} }
}); });
this.field_73973_d = this.func_189646_b(new GuiButton(12, this.field_146294_l / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.func_135052_a("menu.resetdemo")) { this.field_73973_d = this.func_189646_b(new GuiButton(12, this.field_146294_l / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.func_135052_a("menu.resetdemo")) {
@ -29,7 +45,7 @@
ISaveFormat isaveformat1 = GuiMainMenu.this.field_146297_k.func_71359_d(); ISaveFormat isaveformat1 = GuiMainMenu.this.field_146297_k.func_71359_d();
WorldInfo worldinfo1 = isaveformat1.func_75803_c("Demo_World"); WorldInfo worldinfo1 = isaveformat1.func_75803_c("Demo_World");
if (worldinfo1 != null) { if (worldinfo1 != null) {
@@ -283,7 +289,10 @@ @@ -283,7 +290,10 @@
s = s + ("release".equalsIgnoreCase(this.field_146297_k.func_184123_d()) ? "" : "/" + this.field_146297_k.func_184123_d()); s = s + ("release".equalsIgnoreCase(this.field_146297_k.func_184123_d()) ? "" : "/" + this.field_146297_k.func_184123_d());
} }
@ -41,3 +57,11 @@
this.func_73731_b(this.field_146289_q, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.field_146295_m - 10, -1); this.func_73731_b(this.field_146289_q, "Copyright Mojang AB. Do not distribute!", this.field_193979_N, this.field_146295_m - 10, -1);
if (p_73863_1_ > this.field_193979_N && p_73863_1_ < this.field_193979_N + this.field_193978_M && p_73863_2_ > this.field_146295_m - 10 && p_73863_2_ < this.field_146295_m) { if (p_73863_1_ > this.field_193979_N && p_73863_1_ < this.field_193979_N + this.field_193978_M && p_73863_2_ > this.field_146295_m - 10 && p_73863_2_ < this.field_146295_m) {
func_73734_a(this.field_193979_N, this.field_146295_m - 1, this.field_193979_N + this.field_193978_M, this.field_146295_m, -1); func_73734_a(this.field_193979_N, this.field_146295_m - 1, this.field_193979_N + this.field_193978_M, this.field_146295_m, -1);
@@ -299,6 +309,7 @@
if (this.func_183501_a()) {
this.field_183503_M.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
}
+ modUpdateNotification.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
}

View file

@ -0,0 +1,105 @@
--- a/net/minecraft/client/gui/GuiScreen.java
+++ b/net/minecraft/client/gui/GuiScreen.java
@@ -51,6 +51,7 @@
public boolean field_146291_p;
protected FontRenderer field_146289_q;
private URI field_175286_t;
+ protected boolean keyHandled, mouseHandled; // Forge: allow canceling key and mouse Post events from handleMouseInput and handleKeyboardInput
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_) {
for(int i = 0; i < this.field_146292_n.size(); ++i) {
@@ -87,7 +88,10 @@
}
protected void func_146285_a(ItemStack p_146285_1_, int p_146285_2_, int p_146285_3_) {
- this.func_146283_a(this.func_191927_a(p_146285_1_), p_146285_2_, p_146285_3_);
+ FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_);
+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_146285_1_);
+ this.drawHoveringText(this.func_191927_a(p_146285_1_), p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font));
+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
}
public List<String> func_191927_a(ItemStack p_191927_1_) {
@@ -106,25 +110,30 @@
}
public void func_146283_a(List<String> p_146283_1_, int p_146283_2_, int p_146283_3_) {
- if (!p_146283_1_.isEmpty()) {
+ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q);
+ }
+
+ public void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font) {
+ net.minecraftforge.fml.client.config.GuiUtils.drawHoveringText(textLines, x, y, field_146294_l, field_146295_m, -1, font);
+ if (false && !textLines.isEmpty()) {
GlStateManager.func_179101_C();
RenderHelper.func_74518_a();
GlStateManager.func_179140_f();
GlStateManager.func_179097_i();
int i = 0;
- for(String s : p_146283_1_) {
+ for(String s : textLines) {
int j = this.field_146289_q.func_78256_a(s);
if (j > i) {
i = j;
}
}
- int l1 = p_146283_2_ + 12;
- int i2 = p_146283_3_ - 12;
+ int l1 = x + 12;
+ int i2 = y - 12;
int k = 8;
- if (p_146283_1_.size() > 1) {
- k += 2 + (p_146283_1_.size() - 1) * 10;
+ if (textLines.size() > 1) {
+ k += 2 + (textLines.size() - 1) * 10;
}
if (l1 + i > this.field_146294_l) {
@@ -150,8 +159,8 @@
this.func_73733_a(l1 - 3, i2 - 3, l1 + i + 3, i2 - 3 + 1, 1347420415, 1347420415);
this.func_73733_a(l1 - 3, i2 + k + 2, l1 + i + 3, i2 + k + 3, 1344798847, 1344798847);
- for(int k1 = 0; k1 < p_146283_1_.size(); ++k1) {
- String s1 = p_146283_1_.get(k1);
+ for(int k1 = 0; k1 < textLines.size(); ++k1) {
+ String s1 = textLines.get(k1);
this.field_146289_q.func_175063_a(s1, (float)l1, (float)i2, -1);
if (k1 == 0) {
i2 += 2;
@@ -279,9 +288,12 @@
}
public void func_175281_b(String p_175281_1_, boolean p_175281_2_) {
+ p_175281_1_ = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(p_175281_1_);
+ if (p_175281_1_.isEmpty()) return;
if (p_175281_2_) {
this.field_146297_k.field_71456_v.func_146158_b().func_146239_a(p_175281_1_);
}
+ //if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.player, msg) != 0) return; //Forge: TODO Client command re-write
this.field_146297_k.field_71439_g.func_71165_d(p_175281_1_);
}
@@ -292,9 +304,13 @@
this.field_146289_q = p_146280_1_.field_71466_p;
this.field_146294_l = p_146280_2_;
this.field_146295_m = p_146280_3_;
+ java.util.function.Consumer<GuiButton> remove = (b) -> { field_146292_n.remove(b); field_195124_j.remove(b); };
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.field_146292_n, this::func_189646_b, remove))) {
this.field_146292_n.clear();
this.field_195124_j.clear();
this.func_73866_w_();
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.field_146292_n, this::func_189646_b, remove));
}
public List<? extends IGuiEventListener> func_195074_b() {
@@ -313,6 +329,7 @@
public void func_146276_q_() {
this.func_146270_b(0);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this));
}
public void func_146270_b(int p_146270_1_) {

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/GuiSleepMP.java
+++ b/net/minecraft/client/gui/GuiSleepMP.java
@@ -27,7 +27,7 @@
} else if (p_keyPressed_1_ == 257 || p_keyPressed_1_ == 335) {
String s = this.field_146415_a.func_146179_b().trim();
if (!s.isEmpty()) {
- this.field_146297_k.field_71439_g.func_71165_d(s);
+ this.func_175275_f(s); // Forge: fix vanilla not adding messages to the sent list while sleeping
}
this.field_146415_a.func_146180_a("");

View file

@ -0,0 +1,38 @@
--- a/net/minecraft/client/gui/GuiSlot.java
+++ b/net/minecraft/client/gui/GuiSlot.java
@@ -144,15 +144,8 @@
GlStateManager.func_179106_n();
Tessellator tessellator = Tessellator.func_178181_a();
BufferBuilder bufferbuilder = tessellator.func_178180_c();
- this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k);
- GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
- float f = 32.0F;
- bufferbuilder.func_181668_a(7, DefaultVertexFormats.field_181709_i);
- bufferbuilder.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148152_e / 32.0F), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d();
- bufferbuilder.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_187315_a((double)((float)this.field_148151_d / 32.0F), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d();
- bufferbuilder.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148151_d / 32.0F), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d();
- bufferbuilder.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_187315_a((double)((float)this.field_148152_e / 32.0F), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / 32.0F)).func_181669_b(32, 32, 32, 255).func_181675_d();
- tessellator.func_78381_a();
+ // Forge: background rendering moved into separate method.
+ this.drawContainerBackground(tessellator);
int k = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2;
int l = this.field_148153_b + 4 - (int)this.field_148169_q;
if (this.field_148165_u) {
@@ -369,4 +362,17 @@
public int func_148146_j() {
return this.field_148149_f;
}
+
+ protected void drawContainerBackground(Tessellator tessellator) {
+ BufferBuilder buffer = tessellator.func_178180_c();
+ this.field_148161_k.func_110434_K().func_110577_a(Gui.field_110325_k);
+ GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
+ float scale = 32.0F;
+ buffer.func_181668_a(7, DefaultVertexFormats.field_181709_i);
+ buffer.func_181662_b((double)this.field_148152_e, (double)this.field_148154_c, 0.0D).func_187315_a(this.field_148152_e / scale, (this.field_148154_c + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d();
+ buffer.func_181662_b((double)this.field_148151_d, (double)this.field_148154_c, 0.0D).func_187315_a(this.field_148151_d / scale, (this.field_148154_c + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d();
+ buffer.func_181662_b((double)this.field_148151_d, (double)this.field_148153_b, 0.0D).func_187315_a(this.field_148151_d / scale, (this.field_148153_b + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d();
+ buffer.func_181662_b((double)this.field_148152_e, (double)this.field_148153_b, 0.0D).func_187315_a(this.field_148152_e / scale, (this.field_148153_b + (int)this.field_148169_q) / scale).func_181669_b(32, 32, 32, 255).func_181675_d();
+ tessellator.func_78381_a();
+ }
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/GuiUtilRenderComponents.java
+++ b/net/minecraft/client/gui/GuiUtilRenderComponents.java
@@ -54,6 +54,7 @@
s2 = "";
s3 = s4;
}
+ s3 = TextFormatting.func_211164_a(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping.
ITextComponent itextcomponent4 = (new TextComponentString(s3)).func_150255_a(itextcomponent1.func_150256_b().func_150232_l());
list1.add(j + 1, itextcomponent4);

View file

@ -0,0 +1,13 @@
--- a/net/minecraft/client/gui/GuiVideoSettings.java
+++ b/net/minecraft/client/gui/GuiVideoSettings.java
@@ -94,4 +94,10 @@
this.func_73732_a(this.field_146289_q, this.field_146500_a, this.field_146294_l / 2, 5, 16777215);
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
}
+
+ @Override // FORGE: fix for MC-64581 very laggy mipmap slider
+ public void func_146281_b() {
+ super.func_146281_b();
+ this.field_146297_k.field_71474_y.onGuiClosed();
+ }
}

View file

@ -0,0 +1,10 @@
--- a/net/minecraft/client/gui/MapItemRenderer.java
+++ b/net/minecraft/client/gui/MapItemRenderer.java
@@ -118,6 +118,7 @@
for(MapDecoration mapdecoration : this.field_148242_b.field_76203_h.values()) {
if (!p_148237_1_ || mapdecoration.func_191180_f()) {
+ if (mapdecoration.render(k)) { k++; continue; }
MapItemRenderer.this.field_148251_b.func_110577_a(MapItemRenderer.field_148253_a);
GlStateManager.func_179094_E();
GlStateManager.func_179109_b(0.0F + (float)mapdecoration.func_176112_b() / 2.0F + 64.0F, 0.0F + (float)mapdecoration.func_176113_c() / 2.0F + 64.0F, -0.02F);

View file

@ -0,0 +1,37 @@
--- a/net/minecraft/client/gui/advancements/GuiAdvancementTab.java
+++ b/net/minecraft/client/gui/advancements/GuiAdvancementTab.java
@@ -36,6 +36,7 @@
private int field_191814_q = Integer.MIN_VALUE;
private float field_191815_r;
private boolean field_192992_s;
+ private int page;
public GuiAdvancementTab(Minecraft p_i47589_1_, GuiScreenAdvancements p_i47589_2_, AdvancementTabType p_i47589_3_, int p_i47589_4_, Advancement p_i47589_5_, DisplayInfo p_i47589_6_) {
this.field_191802_a = p_i47589_1_;
@@ -50,6 +51,15 @@
this.func_193937_a(this.field_191809_l, p_i47589_5_);
}
+ public GuiAdvancementTab(Minecraft mc, GuiScreenAdvancements screen, AdvancementTabType type, int index, int page, Advancement adv, DisplayInfo info) {
+ this(mc, screen, type, index, adv, info);
+ this.page = page;
+ }
+
+ public int getPage() {
+ return page;
+ }
+
public Advancement func_193935_c() {
return this.field_191805_h;
}
@@ -136,8 +146,8 @@
return null;
} else {
for(AdvancementTabType advancementtabtype : AdvancementTabType.values()) {
- if (p_193936_2_ < advancementtabtype.func_192650_a()) {
- return new GuiAdvancementTab(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_, p_193936_3_, p_193936_3_.func_192068_c());
+ if ((p_193936_2_ % AdvancementTabType.field_192659_e) < advancementtabtype.func_192650_a()) {
+ return new GuiAdvancementTab(p_193936_0_, p_193936_1_, advancementtabtype, p_193936_2_ % AdvancementTabType.field_192659_e, p_193936_2_ / AdvancementTabType.field_192659_e, p_193936_3_, p_193936_3_.func_192068_c());
}
p_193936_2_ -= advancementtabtype.func_192650_a();

View file

@ -0,0 +1,82 @@
--- a/net/minecraft/client/gui/advancements/GuiScreenAdvancements.java
+++ b/net/minecraft/client/gui/advancements/GuiScreenAdvancements.java
@@ -24,6 +24,7 @@
private final Map<Advancement, GuiAdvancementTab> field_191947_i = Maps.<Advancement, GuiAdvancementTab>newLinkedHashMap();
private GuiAdvancementTab field_191940_s;
private boolean field_191944_v;
+ private static int tabPage, maxPages;
public GuiScreenAdvancements(ClientAdvancementManager p_i47383_1_) {
this.field_191946_h = p_i47383_1_;
@@ -38,7 +39,23 @@
} else {
this.field_191946_h.func_194230_a(this.field_191940_s == null ? null : this.field_191940_s.func_193935_c(), true);
}
-
+ if (this.field_191947_i.size() > AdvancementTabType.field_192659_e) {
+ int guiLeft = (this.field_146294_l - 252) / 2;
+ int guiTop = (this.field_146295_m - 140) / 2;
+ func_189646_b(new net.minecraft.client.gui.GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<") {
+ @Override
+ public void func_194829_a(double mouseX, double mouseY) {
+ tabPage = Math.max(tabPage - 1, 0);
+ }
+ });
+ func_189646_b(new net.minecraft.client.gui.GuiButton(102, guiLeft + 252 - 20, guiTop - 50, 20, 20, ">") {
+ @Override
+ public void func_194829_a(double mouseX, double mouseY) {
+ tabPage = Math.min(tabPage + 1, maxPages);
+ }
+ });
+ maxPages = this.field_191947_i.size() / AdvancementTabType.field_192659_e;
+ }
}
public void func_146281_b() {
@@ -56,7 +73,7 @@
int j = (this.field_146295_m - 140) / 2;
for(GuiAdvancementTab guiadvancementtab : this.field_191947_i.values()) {
- if (guiadvancementtab.func_195627_a(i, j, p_mouseClicked_1_, p_mouseClicked_3_)) {
+ if (guiadvancementtab.getPage() == tabPage && guiadvancementtab.func_195627_a(i, j, p_mouseClicked_1_, p_mouseClicked_3_)) {
this.field_191946_h.func_194230_a(guiadvancementtab.func_193935_c(), true);
break;
}
@@ -83,6 +100,12 @@
this.func_191936_c(p_73863_1_, p_73863_2_, i, j);
this.func_191934_b(i, j);
this.func_191937_d(p_73863_1_, p_73863_2_, i, j);
+ if (maxPages != 0) {
+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
+ int width = this.field_146289_q.func_78256_a(page);
+ GlStateManager.func_179140_f();
+ this.field_146289_q.func_175063_a(page, i + (252 / 2) - (width / 2), j - 44, -1);
+ }
}
public boolean mouseDragged(double p_mouseDragged_1_, double p_mouseDragged_3_, int p_mouseDragged_5_, double p_mouseDragged_6_, double p_mouseDragged_8_) {
@@ -129,6 +152,7 @@
this.field_146297_k.func_110434_K().func_110577_a(field_191945_g);
for(GuiAdvancementTab guiadvancementtab : this.field_191947_i.values()) {
+ if (guiadvancementtab.getPage() == tabPage)
guiadvancementtab.func_191798_a(p_191934_1_, p_191934_2_, guiadvancementtab == this.field_191940_s);
}
@@ -137,6 +161,7 @@
RenderHelper.func_74520_c();
for(GuiAdvancementTab guiadvancementtab1 : this.field_191947_i.values()) {
+ if (guiadvancementtab1.getPage() == tabPage)
guiadvancementtab1.func_191796_a(p_191934_1_, p_191934_2_, this.field_146296_j);
}
@@ -159,7 +184,7 @@
if (this.field_191947_i.size() > 1) {
for(GuiAdvancementTab guiadvancementtab : this.field_191947_i.values()) {
- if (guiadvancementtab.func_195627_a(p_191937_3_, p_191937_4_, (double)p_191937_1_, (double)p_191937_2_)) {
+ if (guiadvancementtab.getPage() == tabPage && guiadvancementtab.func_195627_a(p_191937_3_, p_191937_4_, (double)p_191937_1_, (double)p_191937_2_)) {
this.func_146279_a(guiadvancementtab.func_191795_d(), p_191937_1_, p_191937_2_);
}
}

View file

@ -0,0 +1,145 @@
--- a/net/minecraft/client/gui/inventory/GuiContainer.java
+++ b/net/minecraft/client/gui/inventory/GuiContainer.java
@@ -107,6 +107,7 @@
RenderHelper.func_74518_a();
this.func_146979_b(p_73863_1_, p_73863_2_);
RenderHelper.func_74520_c();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiContainerEvent.DrawForeground(this, p_73863_1_, p_73863_2_));
InventoryPlayer inventoryplayer = this.field_146297_k.field_71439_g.field_71071_by;
ItemStack itemstack = this.field_147012_x.func_190926_b() ? inventoryplayer.func_70445_o() : this.field_147012_x;
if (!itemstack.func_190926_b()) {
@@ -158,8 +159,10 @@
GlStateManager.func_179109_b(0.0F, 0.0F, 32.0F);
this.field_73735_i = 200.0F;
this.field_146296_j.field_77023_b = 200.0F;
+ net.minecraft.client.gui.FontRenderer font = p_146982_1_.func_77973_b().getFontRenderer(p_146982_1_);
+ if (font == null) font = field_146289_q;
this.field_146296_j.func_180450_b(p_146982_1_, p_146982_2_, p_146982_3_);
- this.field_146296_j.func_180453_a(this.field_146289_q, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_);
+ this.field_146296_j.func_180453_a(font, p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x.func_190926_b() ? 0 : 8), p_146982_4_);
this.field_73735_i = 0.0F;
this.field_146296_j.field_77023_b = 0.0F;
}
@@ -203,11 +206,10 @@
this.field_73735_i = 100.0F;
this.field_146296_j.field_77023_b = 100.0F;
if (itemstack.func_190926_b() && p_146977_1_.func_111238_b()) {
- String s1 = p_146977_1_.func_178171_c();
- if (s1 != null) {
- TextureAtlasSprite textureatlassprite = this.field_146297_k.func_147117_R().func_110572_b(s1);
+ TextureAtlasSprite textureatlassprite = p_146977_1_.getBackgroundSprite();
+ if (textureatlassprite != null) {
GlStateManager.func_179140_f();
- this.field_146297_k.func_110434_K().func_110577_a(TextureMap.field_110575_b);
+ this.field_146297_k.func_110434_K().func_110577_a(p_146977_1_.getBackgroundLocation());
this.func_175175_a(i, j, textureatlassprite, 16, 16);
GlStateManager.func_179145_e();
flag1 = true;
@@ -268,7 +270,8 @@
if (super.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) {
return true;
} else {
- boolean flag = this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_);
+ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_mouseClicked_5_);
+ boolean flag = this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey);
Slot slot = this.func_195360_a(p_mouseClicked_1_, p_mouseClicked_3_);
long i = Util.func_211177_b();
this.field_146993_M = this.field_146998_K == slot && i - this.field_146997_J < 250L && this.field_146992_L == p_mouseClicked_5_;
@@ -277,6 +280,7 @@
int j = this.field_147003_i;
int k = this.field_147009_r;
boolean flag1 = this.func_195361_a(p_mouseClicked_1_, p_mouseClicked_3_, j, k, p_mouseClicked_5_);
+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int l = -1;
if (slot != null) {
l = slot.field_75222_d;
@@ -302,7 +306,7 @@
}
} else if (!this.field_147007_t) {
if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) {
- if (this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_)) {
+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) {
this.func_184098_a(slot, l, p_mouseClicked_5_, ClickType.CLONE);
} else {
boolean flag2 = l != -999 && (InputMappings.func_197956_a(340) || InputMappings.func_197956_a(344));
@@ -326,7 +330,7 @@
this.field_146987_F = 0;
} else if (p_mouseClicked_5_ == 1) {
this.field_146987_F = 1;
- } else if (this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseClicked_5_)) {
+ } else if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) {
this.field_146987_F = 2;
}
}
@@ -379,10 +383,13 @@
}
public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
+ super.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_); //Forge, Call parent to release buttons
Slot slot = this.func_195360_a(p_mouseReleased_1_, p_mouseReleased_3_);
int i = this.field_147003_i;
int j = this.field_147009_r;
boolean flag = this.func_195361_a(p_mouseReleased_1_, p_mouseReleased_3_, i, j, p_mouseReleased_5_);
+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
+ InputMappings.Input mouseKey = InputMappings.Type.MOUSE.func_197944_a(p_mouseReleased_5_);
int k = -1;
if (slot != null) {
k = slot.field_75222_d;
@@ -396,7 +403,7 @@
if (func_146272_n()) {
if (!this.field_146994_N.func_190926_b()) {
for(Slot slot2 : this.field_147002_h.field_75151_b) {
- if (slot2 != null && slot2.func_82869_a(this.field_146297_k.field_71439_g) && slot2.func_75216_d() && slot2.field_75224_c == slot.field_75224_c && Container.func_94527_a(slot2, this.field_146994_N, true)) {
+ if (slot2 != null && slot2.func_82869_a(this.field_146297_k.field_71439_g) && slot2.func_75216_d() && slot2.isSameInventory(slot) && Container.func_94527_a(slot2, this.field_146994_N, true)) {
this.func_184098_a(slot2, slot2.field_75222_d, p_mouseReleased_5_, ClickType.QUICK_MOVE);
}
}
@@ -460,7 +467,7 @@
this.func_184098_a((Slot)null, -999, Container.func_94534_d(2, this.field_146987_F), ClickType.QUICK_CRAFT);
} else if (!this.field_146297_k.field_71439_g.field_71071_by.func_70445_o().func_190926_b()) {
- if (this.field_146297_k.field_71474_y.field_74322_I.func_197984_a(p_mouseReleased_5_)) {
+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(mouseKey)) {
this.func_184098_a(slot, k, p_mouseReleased_5_, ClickType.CLONE);
} else {
boolean flag1 = k != -999 && (InputMappings.func_197956_a(340) || InputMappings.func_197956_a(344));
@@ -509,15 +516,15 @@
if (super.keyPressed(p_keyPressed_1_, p_keyPressed_2_, p_keyPressed_3_)) {
return true;
} else {
- if (p_keyPressed_1_ == 256 || this.field_146297_k.field_71474_y.field_151445_Q.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) {
+ if (p_keyPressed_1_ == 256 || this.field_146297_k.field_71474_y.field_151445_Q.isActiveAndMatches(InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_))) {
this.field_146297_k.field_71439_g.func_71053_j();
}
this.func_195363_d(p_keyPressed_1_, p_keyPressed_2_);
if (this.field_147006_u != null && this.field_147006_u.func_75216_d()) {
- if (this.field_146297_k.field_71474_y.field_74322_I.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) {
+ if (this.field_146297_k.field_71474_y.field_74322_I.isActiveAndMatches(InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_))) {
this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, 0, ClickType.CLONE);
- } else if (this.field_146297_k.field_71474_y.field_74316_C.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) {
+ } else if (this.field_146297_k.field_71474_y.field_74316_C.isActiveAndMatches(InputMappings.func_197954_a(p_keyPressed_1_, p_keyPressed_2_))) {
this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, func_146271_m() ? 1 : 0, ClickType.THROW);
}
}
@@ -529,7 +536,7 @@
protected boolean func_195363_d(int p_195363_1_, int p_195363_2_) {
if (this.field_146297_k.field_71439_g.field_71071_by.func_70445_o().func_190926_b() && this.field_147006_u != null) {
for(int i = 0; i < 9; ++i) {
- if (this.field_146297_k.field_71474_y.field_151456_ac[i].func_197976_a(p_195363_1_, p_195363_2_)) {
+ if (this.field_146297_k.field_71474_y.field_151456_ac[i].isActiveAndMatches(InputMappings.func_197954_a(p_195363_1_, p_195363_2_))) {
this.func_184098_a(this.field_147006_u, this.field_147006_u.field_75222_d, i, ClickType.SWAP);
return true;
}
@@ -556,4 +563,11 @@
}
}
+
+ @javax.annotation.Nullable
+ public Slot getSlotUnderMouse() { return this.field_147006_u; }
+ public int getGuiLeft() { return field_147003_i; }
+ public int getGuiTop() { return field_147009_r; }
+ public int getXSize() { return field_146999_f; }
+ public int getYSize() { return field_147000_g; }
}

View file

@ -0,0 +1,275 @@
--- a/net/minecraft/client/gui/inventory/GuiContainerCreative.java
+++ b/net/minecraft/client/gui/inventory/GuiContainerCreative.java
@@ -53,6 +53,8 @@
private CreativeCrafting field_147059_E;
private boolean field_195377_F;
private boolean field_199506_G;
+ private static int tabPage = 0;
+ private int maxPages = 0;
public GuiContainerCreative(EntityPlayer p_i1088_1_) {
super(new GuiContainerCreative.ContainerCreative(p_i1088_1_));
@@ -230,6 +232,22 @@
this.func_147050_b(ItemGroup.field_78032_a[i]);
this.field_147059_E = new CreativeCrafting(this.field_146297_k);
this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E);
+ int tabCount = ItemGroup.field_78032_a.length;
+ if (tabCount > 12) {
+ func_189646_b(new net.minecraft.client.gui.GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<") {
+ @Override
+ public void func_194829_a(double mouseX, double mouseY) {
+ tabPage = Math.max(tabPage - 1, 0);
+ }
+ });
+ func_189646_b(new net.minecraft.client.gui.GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">") {
+ @Override
+ public void func_194829_a(double mouseX, double mouseY) {
+ tabPage = Math.min(tabPage + 1, maxPages);
+ }
+ });
+ maxPages = (int) Math.ceil((tabCount - 12) / 10D);
+ }
} else {
this.field_146297_k.func_147108_a(new GuiInventory(this.field_146297_k.field_71439_g));
}
@@ -255,7 +273,7 @@
public boolean charTyped(char p_charTyped_1_, int p_charTyped_2_) {
if (this.field_195377_F) {
return false;
- } else if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) {
+ } else if (!ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) {
return false;
} else {
String s = this.field_147062_A.func_146179_b();
@@ -273,7 +291,7 @@
public boolean keyPressed(int p_keyPressed_1_, int p_keyPressed_2_, int p_keyPressed_3_) {
this.field_195377_F = false;
- if (field_147058_w != ItemGroup.field_78027_g.func_78021_a()) {
+ if (ItemGroup.field_78032_a[field_147058_w].hasSearchBar()) {
if (this.field_146297_k.field_71474_y.field_74310_D.func_197976_a(p_keyPressed_1_, p_keyPressed_2_)) {
this.field_195377_F = true;
this.func_147050_b(ItemGroup.field_78027_g);
@@ -309,6 +327,32 @@
private void func_147053_i() {
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
guicontainercreative$containercreative.field_148330_a.clear();
+
+ ItemGroup tab = ItemGroup.field_78032_a[field_147058_w];
+ if (tab.hasSearchBar() && tab != ItemGroup.field_78027_g) {
+ tab.func_78018_a(guicontainercreative$containercreative.field_148330_a);
+ if (!this.field_147062_A.func_146179_b().isEmpty()) {
+ //TODO: Make this a SearchTree not a manual search
+ String search = this.field_147062_A.func_146179_b().toLowerCase(Locale.ROOT);
+ java.util.Iterator<ItemStack> itr = guicontainercreative$containercreative.field_148330_a.iterator();
+ while (itr.hasNext()) {
+ ItemStack stack = itr.next();
+ boolean matches = false;
+ for (ITextComponent line : stack.func_82840_a(this.field_146297_k.field_71439_g, this.field_146297_k.field_71474_y.field_82882_x ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL)) {
+ if (TextFormatting.func_110646_a(line.getString()).toLowerCase(Locale.ROOT).contains(search)) {
+ matches = true;
+ break;
+ }
+ }
+ if (!matches)
+ itr.remove();
+ }
+ }
+ this.field_147067_x = 0.0F;
+ guicontainercreative$containercreative.func_148329_a(0.0F);
+ return;
+ }
+
if (this.field_147062_A.func_146179_b().isEmpty()) {
for(Item item : Item.field_150901_e) {
item.func_150895_a(ItemGroup.field_78027_g, guicontainercreative$containercreative.field_148330_a);
@@ -323,7 +367,7 @@
protected void func_146979_b(int p_146979_1_, int p_146979_2_) {
ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w];
- if (itemgroup.func_78019_g()) {
+ if (itemgroup != null && itemgroup.func_78019_g()) {
GlStateManager.func_179084_k();
this.field_146289_q.func_211126_b(I18n.func_135052_a(itemgroup.func_78024_c()), 8.0F, 6.0F, 4210752);
}
@@ -357,7 +401,7 @@
this.field_147066_y = false;
for(ItemGroup itemgroup : ItemGroup.field_78032_a) {
- if (this.func_195375_a(itemgroup, d0, d1)) {
+ if (itemgroup != null && this.func_195375_a(itemgroup, d0, d1)) {
this.func_147050_b(itemgroup);
return true;
}
@@ -368,10 +412,12 @@
}
private boolean func_147055_p() {
+ if (ItemGroup.field_78032_a[field_147058_w] == null) return false;
return field_147058_w != ItemGroup.field_78036_m.func_78021_a() && ItemGroup.field_78032_a[field_147058_w].func_78017_i() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e();
}
private void func_147050_b(ItemGroup p_147050_1_) {
+ if (p_147050_1_ == null) return;
int i = field_147058_w;
field_147058_w = p_147050_1_.func_78021_a();
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
@@ -447,13 +493,15 @@
}
if (this.field_147062_A != null) {
- if (p_147050_1_ == ItemGroup.field_78027_g) {
+ if (p_147050_1_.hasSearchBar()) {
this.field_147062_A.func_146189_e(true);
this.field_147062_A.func_146205_d(false);
this.field_147062_A.func_146195_b(true);
if (i != p_147050_1_.func_78021_a()) {
this.field_147062_A.func_146180_a("");
}
+ this.field_147062_A.field_146218_h = p_147050_1_.getSearchbarWidth();
+ this.field_147062_A.field_146209_f = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.field_146218_h;
this.func_147053_i();
} else {
@@ -512,16 +560,36 @@
this.func_146276_q_();
super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
- for(ItemGroup itemgroup : ItemGroup.field_78032_a) {
+ int start = tabPage * 10;
+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10) + 2);
+ if (tabPage != 0) start += 2;
+ boolean rendered = false;
+
+ for(ItemGroup itemgroup : java.util.Arrays.copyOfRange(ItemGroup.field_78032_a, start, end)) {
+ if (itemgroup != null) continue;
if (this.func_147052_b(itemgroup, p_73863_1_, p_73863_2_)) {
+ rendered = true;
break;
}
}
+ if (!rendered && !func_147052_b(ItemGroup.field_78027_g, p_73863_1_, p_73863_2_))
+ func_147052_b(ItemGroup.field_78036_m, p_73863_1_, p_73863_2_);
+
if (this.field_147064_C != null && field_147058_w == ItemGroup.field_78036_m.func_78021_a() && this.func_195359_a(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, (double)p_73863_1_, (double)p_73863_2_)) {
this.func_146279_a(I18n.func_135052_a("inventory.binSlot"), p_73863_1_, p_73863_2_);
}
+ if (maxPages != 0) {
+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
+ GlStateManager.func_179140_f();
+ this.field_73735_i = 300.0F;
+ field_146296_j.field_77023_b = 300.0F;
+ field_146289_q.func_211126_b(page, field_147003_i + (field_146999_f / 2) - (field_146289_q.func_78256_a(page) / 2), field_147009_r - 44, -1);
+ this.field_73735_i = 0.0F;
+ field_146296_j.field_77023_b = 0.0F;
+ }
+
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.func_179140_f();
this.func_191948_b(p_73863_1_, p_73863_2_);
@@ -563,7 +631,10 @@
}
}
- this.func_146283_a(list1, p_146285_2_, p_146285_3_);
+ net.minecraft.client.gui.FontRenderer font = p_146285_1_.func_77973_b().getFontRenderer(p_146285_1_);
+ net.minecraftforge.fml.client.config.GuiUtils.preItemToolTip(p_146285_1_);
+ this.drawHoveringText(list1, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font));
+ net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
} else {
super.func_146285_a(p_146285_1_, p_146285_2_, p_146285_3_);
}
@@ -575,14 +646,30 @@
RenderHelper.func_74520_c();
ItemGroup itemgroup = ItemGroup.field_78032_a[field_147058_w];
- for(ItemGroup itemgroup1 : ItemGroup.field_78032_a) {
+ int start = tabPage * 10;
+ int end = Math.min(ItemGroup.field_78032_a.length, ((tabPage + 1) * 10 + 2));
+ if (tabPage != 0) start += 2;
+
+ for(ItemGroup itemgroup1 : java.util.Arrays.copyOfRange(ItemGroup.field_78032_a, start, end)) {
this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
+ if (itemgroup1 == null) continue;
if (itemgroup1.func_78021_a() != field_147058_w) {
this.func_147051_a(itemgroup1);
}
}
- this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + itemgroup.func_78015_f()));
+ if (tabPage != 0) {
+ if (itemgroup != ItemGroup.field_78027_g) {
+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
+ func_147051_a(ItemGroup.field_78027_g);
+ }
+ if (itemgroup != ItemGroup.field_78036_m) {
+ this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
+ func_147051_a(ItemGroup.field_78036_m);
+ }
+ }
+
+ this.field_146297_k.func_110434_K().func_110577_a(itemgroup.getBackgroundImage());
this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g);
this.field_147062_A.func_195608_a(p_146976_2_, p_146976_3_, p_146976_1_);
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
@@ -594,6 +681,9 @@
this.func_73729_b(i, j + (int)((float)(k - j - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15);
}
+ if ((itemgroup == null || itemgroup.getTabPage() != tabPage) && (itemgroup != ItemGroup.field_78027_g && itemgroup != ItemGroup.field_78036_m))
+ return;
+
this.func_147051_a(itemgroup);
if (itemgroup == ItemGroup.field_78036_m) {
GuiInventory.func_147046_a(this.field_147003_i + 88, this.field_147009_r + 45, 20, (float)(this.field_147003_i + 88 - p_146976_2_), (float)(this.field_147009_r + 45 - 30 - p_146976_3_), this.field_146297_k.field_71439_g);
@@ -602,6 +692,7 @@
}
protected boolean func_195375_a(ItemGroup p_195375_1_, double p_195375_2_, double p_195375_4_) {
+ if (p_195375_1_.getTabPage() != tabPage && p_195375_1_ != ItemGroup.field_78027_g && p_195375_1_ != ItemGroup.field_78036_m) return false;
int i = p_195375_1_.func_78020_k();
int j = 28 * i;
int k = 0;
@@ -671,6 +762,8 @@
}
GlStateManager.func_179140_f();
+ GlStateManager.func_179124_c(1F, 1F, 1F); //Forge: Reset color in case Items change it.
+ GlStateManager.func_179147_l(); //Forge: Make sure blend is enabled else tabs show a white border.
this.func_73729_b(l, i1, j, k, 28, 32);
this.field_73735_i = 100.0F;
this.field_146296_j.field_77023_b = 100.0F;
@@ -845,6 +938,31 @@
public boolean func_82869_a(EntityPlayer p_82869_1_) {
return this.field_148332_b.func_82869_a(p_82869_1_);
}
+
+ public ResourceLocation getBackgroundLocation() {
+ return this.field_148332_b.getBackgroundLocation();
+ }
+
+ public void setBackgroundLocation(ResourceLocation texture) {
+ this.field_148332_b.setBackgroundLocation(texture);
+ }
+
+ public void setBackgroundName(@Nullable String name) {
+ this.field_148332_b.setBackgroundName(name);
+ }
+
+ @Nullable
+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() {
+ return this.field_148332_b.getBackgroundSprite();
+ }
+
+ public int getSlotIndex() {
+ return this.field_148332_b.getSlotIndex();
+ }
+
+ public boolean isSameInventory(Slot other) {
+ return this.field_148332_b.isSameInventory(other);
+ }
}
@OnlyIn(Dist.CLIENT)

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/recipebook/GuiRecipeBook.java
+++ b/net/minecraft/client/gui/recipebook/GuiRecipeBook.java
@@ -410,7 +410,7 @@
languagemanager.func_135045_a(language);
this.field_191888_F.field_71474_y.field_74363_ab = language.func_135034_a();
- this.field_191888_F.func_110436_a();
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_191888_F, net.minecraftforge.client.resource.VanillaResourceType.LANGUAGES);
this.field_191888_F.field_71466_p.func_78275_b(languagemanager.func_135044_b());
this.field_191888_F.field_71474_y.func_74303_b();
}

View file

@ -0,0 +1,11 @@
--- a/net/minecraft/client/gui/toasts/RecipeToast.java
+++ b/net/minecraft/client/gui/toasts/RecipeToast.java
@@ -38,7 +38,7 @@
p_193653_1_.func_192989_b().field_71466_p.func_211126_b(I18n.func_135052_a("recipe.toast.title"), 30.0F, 7.0F, -11534256);
p_193653_1_.func_192989_b().field_71466_p.func_211126_b(I18n.func_135052_a("recipe.toast.description"), 30.0F, 18.0F, -16777216);
RenderHelper.func_74520_c();
- IRecipe irecipe = this.field_202906_c.get((int)(p_193653_2_ / (5000L / (long)this.field_202906_c.size()) % (long)this.field_202906_c.size()));
+ IRecipe irecipe = this.field_202906_c.get((int)((p_193653_2_ * (long)this.field_202906_c.size() / 5000L) % (long)this.field_202906_c.size())); //Forge: fix math so that it doesn't divide by 0 when there are more than 5000 recipes
ItemStack itemstack;
if (irecipe instanceof FurnaceRecipe) {
itemstack = new ItemStack(Blocks.field_150460_al);

View file

@ -0,0 +1,84 @@
--- a/net/minecraft/inventory/Slot.java
+++ b/net/minecraft/inventory/Slot.java
@@ -12,6 +12,9 @@
public int field_75222_d;
public int field_75223_e;
public int field_75221_f;
+ protected String backgroundName = null;
+ protected net.minecraft.util.ResourceLocation backgroundLocation = null;
+ protected Object backgroundMap;
public Slot(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
this.field_75224_c = p_i1824_1_;
@@ -74,7 +77,7 @@
@Nullable
@OnlyIn(Dist.CLIENT)
public String func_178171_c() {
- return null;
+ return backgroundName;
}
public ItemStack func_75209_a(int p_75209_1_) {
@@ -93,4 +96,62 @@
public boolean func_111238_b() {
return true;
}
+
+ /**
+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI.
+ * @return The resource location for the background image
+ */
+ @OnlyIn(Dist.CLIENT)
+ public net.minecraft.util.ResourceLocation getBackgroundLocation() {
+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.field_110575_b : backgroundLocation);
+ }
+
+ /**
+ * Sets the texture file to use for the background image of the slot when it's empty.
+ * @param texture the resourcelocation for the texture
+ */
+ @OnlyIn(Dist.CLIENT)
+ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture) {
+ this.backgroundLocation = texture;
+ }
+
+ /**
+ * Sets which icon index to use as the background image of the slot when it's empty.
+ * @param name The icon to use, null for none
+ */
+ public void setBackgroundName(@Nullable String name) {
+ this.backgroundName = name;
+ }
+
+ @Nullable
+ @OnlyIn(Dist.CLIENT)
+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite() {
+ String name = func_178171_c();
+ return name == null ? null : getBackgroundMap().func_110572_b(name);
+ }
+
+ @OnlyIn(Dist.CLIENT)
+ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap() {
+ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.func_71410_x().func_147117_R();
+ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap;
+ }
+
+ /**
+ * 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() {
+ return field_75225_a;
+ }
+
+ /**
+ * Checks if the other slot is in the same inventory, by comparing the inventory reference.
+ * @param other
+ * @return true if the other slot is in the same inventory
+ */
+ public boolean isSameInventory(Slot other) {
+ return this.field_75224_c == other.field_75224_c;
+ }
}

View file

@ -0,0 +1,74 @@
--- a/net/minecraft/item/ItemGroup.java
+++ b/net/minecraft/item/ItemGroup.java
@@ -11,7 +11,7 @@
import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class ItemGroup {
- public static final ItemGroup[] field_78032_a = new ItemGroup[12];
+ public static ItemGroup[] field_78032_a = new ItemGroup[12];
public static final ItemGroup field_78030_b = (new ItemGroup(0, "buildingBlocks") {
@OnlyIn(Dist.CLIENT)
public ItemStack func_78016_d() {
@@ -104,7 +104,16 @@
private EnumEnchantmentType[] field_111230_s = new EnumEnchantmentType[0];
private ItemStack field_151245_t;
+ public ItemGroup(String label) {
+ this(field_78032_a.length, label);
+ }
+
public ItemGroup(int p_i1853_1_, String p_i1853_2_) {
+ if (p_i1853_1_ >= field_78032_a.length) {
+ ItemGroup[] tmp = new ItemGroup[p_i1853_1_ + 1];
+ System.arraycopy(field_78032_a, 0, tmp, 0, field_78032_a.length);
+ field_78032_a = tmp;
+ }
this.field_78033_n = p_i1853_1_;
this.field_78034_o = p_i1853_2_;
this.field_151245_t = ItemStack.field_190927_a;
@@ -179,11 +188,13 @@
@OnlyIn(Dist.CLIENT)
public int func_78020_k() {
+ if (field_78033_n > 11) return ((field_78033_n - 12) % 10) % 5;
return this.field_78033_n % 6;
}
@OnlyIn(Dist.CLIENT)
public boolean func_78023_l() {
+ if (field_78033_n > 11) return ((field_78033_n - 12) % 10) < 5;
return this.field_78033_n < 6;
}
@@ -220,4 +231,31 @@
}
}
+
+ public int getTabPage() {
+ return field_78033_n < 12 ? 0 : ((field_78033_n - 12) / 10) + 1;
+ }
+
+ public boolean hasSearchBar() {
+ return field_78033_n == field_78027_g.field_78033_n;
+ }
+
+ /**
+ * Gets the width of the search bar of the creative tab, use this if your
+ * creative tab name overflows together with a custom texture.
+ *
+ * @return The width of the search bar, 89 by default
+ */
+ public int getSearchbarWidth() {
+ return 89;
+ }
+
+ @OnlyIn(Dist.CLIENT)
+ public net.minecraft.util.ResourceLocation getBackgroundImage() {
+ return new net.minecraft.util.ResourceLocation("textures/gui/container/creative_inventory/tab_" + this.func_78015_f());
+ }
+
+ public int getLabelColor() {
+ return 4210752;
+ }
}

View file

@ -0,0 +1,17 @@
--- a/net/minecraft/item/crafting/IRecipePlacer.java
+++ b/net/minecraft/item/crafting/IRecipePlacer.java
@@ -7,10 +7,10 @@
default void func_201501_a(int p_201501_1_, int p_201501_2_, int p_201501_3_, IRecipe p_201501_4_, Iterator<T> p_201501_5_, int p_201501_6_) {
int i = p_201501_1_;
int j = p_201501_2_;
- if (p_201501_4_ instanceof ShapedRecipe) {
- ShapedRecipe shapedrecipe = (ShapedRecipe)p_201501_4_;
- i = shapedrecipe.func_192403_f();
- j = shapedrecipe.func_192404_g();
+ if (p_201501_4_ instanceof net.minecraftforge.common.crafting.IShapedRecipe) {
+ net.minecraftforge.common.crafting.IShapedRecipe shapedrecipe = (net.minecraftforge.common.crafting.IShapedRecipe)p_201501_4_;
+ i = shapedrecipe.getRecipeWidth();
+ j = shapedrecipe.getRecipeHeight();
}
int k1 = 0;

View file

@ -1,11 +1,92 @@
--- a/net/minecraft/potion/Potion.java --- a/net/minecraft/potion/Potion.java
+++ b/net/minecraft/potion/Potion.java +++ b/net/minecraft/potion/Potion.java
@@ -23,7 +23,7 @@ @@ -23,8 +23,8 @@
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
-public class Potion { -public class Potion {
- public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = new RegistryNamespaced<ResourceLocation, Potion>();
+public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry<Potion> { +public class Potion extends net.minecraftforge.registries.ForgeRegistryEntry<Potion> {
public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = new RegistryNamespaced<ResourceLocation, Potion>(); + public static final RegistryNamespaced<ResourceLocation, Potion> field_188414_b = net.minecraftforge.registries.GameData.getWrapper(Potion.class);
private final Map<IAttribute, AttributeModifier> field_111188_I = Maps.<IAttribute, AttributeModifier>newHashMap(); private final Map<IAttribute, AttributeModifier> field_111188_I = Maps.<IAttribute, AttributeModifier>newHashMap();
private final boolean field_76418_K; private final boolean field_76418_K;
private final int field_76414_N;
@@ -162,7 +162,6 @@
return this.field_76417_J;
}
- @OnlyIn(Dist.CLIENT)
public boolean func_76398_f() {
return this.field_76418_K;
}
@@ -259,4 +258,70 @@
private static void func_210759_a(int p_210759_0_, String p_210759_1_, Potion p_210759_2_) {
field_188414_b.func_177775_a(p_210759_0_, new ResourceLocation(p_210759_1_), p_210759_2_);
}
+
+ /**
+ * If the Potion effect should be displayed in the players inventory
+ * @param effect the active PotionEffect
+ * @return true to display it (default), false to hide it.
+ */
+ public boolean shouldRender(PotionEffect effect) { return true; }
+
+ /**
+ * If the standard PotionEffect text (name and duration) should be drawn when this potion is active.
+ * @param effect the active PotionEffect
+ * @return true to draw the standard text
+ */
+ public boolean shouldRenderInvText(PotionEffect effect) { return true; }
+
+ /**
+ * If the Potion effect should be displayed in the player's ingame HUD
+ * @param effect the active PotionEffect
+ * @return true to display it (default), false to hide it.
+ */
+ public boolean shouldRenderHUD(PotionEffect effect) { return true; }
+
+ /**
+ * Called to draw the this Potion onto the player's inventory when it's active.
+ * This can be used to e.g. render Potion icons from your own texture.
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param effect the active PotionEffect
+ * @param mc the Minecraft instance, for convenience
+ */
+ @OnlyIn(Dist.CLIENT)
+ public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { }
+
+ /**
+ * Called to draw the this Potion onto the player's ingame HUD when it's active.
+ * This can be used to e.g. render Potion icons from your own texture.
+ * @param x the x coordinate
+ * @param y the y coordinate
+ * @param effect the active PotionEffect
+ * @param mc the Minecraft instance, for convenience
+ * @param alpha the alpha value, blinks when the potion is about to run out
+ */
+ @OnlyIn(Dist.CLIENT)
+ public void renderHUDEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc, float alpha) { }
+
+ /**
+ * Get a fresh list of items that can cure this Potion.
+ * All new PotionEffects created from this Potion will call this to initialize the default curative items
+ * @see PotionEffect#getCurativeItems
+ * @return A list of items that can cure this Potion
+ */
+ public java.util.List<net.minecraft.item.ItemStack> getCurativeItems() {
+ java.util.ArrayList<net.minecraft.item.ItemStack> ret = new java.util.ArrayList<net.minecraft.item.ItemStack>();
+ ret.add(new net.minecraft.item.ItemStack(net.minecraft.init.Items.field_151117_aB));
+ return ret;
+ }
+
+ /**
+ * Used for determining {@code PotionEffect} sort order in GUIs.
+ * Defaults to the {@code PotionEffect}'s liquid color.
+ * @param potionEffect the {@code PotionEffect} instance containing the potion
+ * @return a value used to sort {@code PotionEffect}s in GUIs
+ */
+ public int getGuiSortColor(PotionEffect potionEffect) {
+ return this.func_76401_j();
+ }
}

View file

@ -0,0 +1,33 @@
--- a/net/minecraft/world/WorldType.java
+++ b/net/minecraft/world/WorldType.java
@@ -31,6 +31,7 @@
}
private WorldType(int p_i49778_1_, String p_i49778_2_, String p_i49778_3_, int p_i49778_4_) {
+ if (p_i49778_2_.length() > 16 && field_180272_g != null) throw new IllegalArgumentException("World type names must not be longer then 16: " + p_i49778_2_);
this.field_77133_f = p_i49778_2_;
this.field_211890_l = p_i49778_3_;
this.field_77134_g = p_i49778_4_;
@@ -117,4 +118,22 @@
this.field_151361_l = true;
return this;
}
+
+ /**
+ * Called when 'Create New World' button is pressed before starting game
+ */
+ public void onGUICreateWorldPress() { }
+
+ /**
+ * Called when the 'Customize' button is pressed on world creation GUI
+ * @param mc The Minecraft instance
+ * @param gui the createworld GUI
+ */
+ @OnlyIn(Dist.CLIENT)
+ public void onCustomizeButton(net.minecraft.client.Minecraft mc, net.minecraft.client.gui.GuiCreateWorld gui) {
+ if (this == WorldType.field_77138_c)
+ mc.func_147108_a(new net.minecraft.client.gui.GuiCreateFlatWorld(gui, gui.field_146334_a));
+ else if (this == WorldType.field_180271_f)
+ mc.func_147108_a(new net.minecraft.client.gui.GuiCreateBuffetWorld(gui, gui.field_146334_a));
+ }
}

View file

@ -0,0 +1,19 @@
--- a/net/minecraft/world/storage/MapDecoration.java
+++ b/net/minecraft/world/storage/MapDecoration.java
@@ -83,6 +83,16 @@
return i;
}
+ /**
+ * Renders this decoration, useful for custom sprite sheets.
+ * @param index The index of this icon in the MapData's list. Used by vanilla to offset the Z-coordinate to prevent Z-fighting
+ * @return false to run vanilla logic for this decoration, true to skip it
+ */
+ @OnlyIn(Dist.CLIENT)
+ public boolean render(int index) {
+ return false;
+ }
+
public static enum Type {
PLAYER(false),
FRAME(true),

View file

@ -123,6 +123,7 @@ import net.minecraftforge.client.model.ModelDynBucket;
import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.animation.Animation; import net.minecraftforge.client.model.animation.Animation;
import net.minecraftforge.client.resource.IResourceType; import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.ReloadRequirements;
import net.minecraftforge.client.resource.SelectiveReloadStateHandler; import net.minecraftforge.client.resource.SelectiveReloadStateHandler;
import net.minecraftforge.client.resource.VanillaResourceType; import net.minecraftforge.client.resource.VanillaResourceType;
import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.ForgeMod;
@ -777,4 +778,11 @@ public class ForgeHooksClient
return true; return true;
} }
public static void refreshResources(Minecraft mc, VanillaResourceType... types) {
SelectiveReloadStateHandler.INSTANCE.beginReload(ReloadRequirements.include(types));
mc.refreshResources();
SelectiveReloadStateHandler.INSTANCE.endReload();
}
} }

View file

@ -20,7 +20,11 @@
package net.minecraftforge.client.event; package net.minecraftforge.client.event;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable;
import java.util.function.Consumer;
import java.util.function.Function;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.InventoryEffectRenderer; import net.minecraft.client.renderer.InventoryEffectRenderer;
@ -58,25 +62,35 @@ public class GuiScreenEvent extends Event
public static class InitGuiEvent extends GuiScreenEvent public static class InitGuiEvent extends GuiScreenEvent
{ {
private Consumer<GuiButton> addButton;
private Consumer<GuiButton> removeButton;
private List<GuiButton> buttonList; private List<GuiButton> buttonList;
public InitGuiEvent(GuiScreen gui, List<GuiButton> buttonList) public InitGuiEvent(GuiScreen gui, List<GuiButton> buttonList, Consumer<GuiButton> addButton, Consumer<GuiButton> removeButton)
{ {
super(gui); super(gui);
this.setButtonList(buttonList); this.buttonList = Collections.unmodifiableList(buttonList);
this.addButton = addButton;
this.removeButton = removeButton;
} }
/** /**
* The {@link #buttonList} field from the GuiScreen object referenced by {@link #gui}. * Unmodifiable reference to the list of buttons on the {@link #gui}.
*/ */
public List<GuiButton> getButtonList() public List<GuiButton> getButtonList()
{ {
return buttonList; return buttonList;
} }
public void setButtonList(List<GuiButton> buttonList) public void addButton(GuiButton button)
{ {
this.buttonList = buttonList; addButton.accept(button);
}
public void removeButton(GuiButton button)
{
removeButton.accept(button);
} }
/** /**
@ -85,14 +99,15 @@ public class GuiScreenEvent extends Event
* *
* If canceled the following lines are skipped in {@link GuiScreen#setWorldAndResolution(Minecraft, int, int)}:<br/> * If canceled the following lines are skipped in {@link GuiScreen#setWorldAndResolution(Minecraft, int, int)}:<br/>
* {@code this.buttonList.clear();}<br/> * {@code this.buttonList.clear();}<br/>
* {@code this.children.clear();}<br/>
* {@code this.initGui();}<br/> * {@code this.initGui();}<br/>
*/ */
@Cancelable @Cancelable
public static class Pre extends InitGuiEvent public static class Pre extends InitGuiEvent
{ {
public Pre(GuiScreen gui, List<GuiButton> buttonList) public Pre(GuiScreen gui, List<GuiButton> buttonList, Consumer<GuiButton> addButton, Consumer<GuiButton> removeButton)
{ {
super(gui, buttonList); super(gui, buttonList, addButton, removeButton);
} }
} }
@ -102,9 +117,9 @@ public class GuiScreenEvent extends Event
*/ */
public static class Post extends InitGuiEvent public static class Post extends InitGuiEvent
{ {
public Post(GuiScreen gui, List<GuiButton> buttonList) public Post(GuiScreen gui, List<GuiButton> buttonList, Consumer<GuiButton> addButton, Consumer<GuiButton> removeButton)
{ {
super(gui, buttonList); super(gui, buttonList, addButton, removeButton);
} }
} }
} }
@ -176,43 +191,40 @@ public class GuiScreenEvent extends Event
* This event fires at the end of {@link GuiScreen#drawDefaultBackground()} and before the rest of the Gui draws. * This event fires at the end of {@link GuiScreen#drawDefaultBackground()} and before the rest of the Gui draws.
* This allows drawing next to Guis, above the background but below any tooltips. * This allows drawing next to Guis, above the background but below any tooltips.
*/ */
/*
public static class BackgroundDrawnEvent extends GuiScreenEvent public static class BackgroundDrawnEvent extends GuiScreenEvent
{ {
private final int mouseX; //private final int mouseX;
private final int mouseY; //private final int mouseY;
public BackgroundDrawnEvent(GuiScreen gui) public BackgroundDrawnEvent(GuiScreen gui)
{ {
super(gui); super(gui);
/*
final ScaledResolution scaledresolution = new ScaledResolution(gui.mc); final ScaledResolution scaledresolution = new ScaledResolution(gui.mc);
final int scaledWidth = scaledresolution.getScaledWidth(); final int scaledWidth = scaledresolution.getScaledWidth();
final int scaledHeight = scaledresolution.getScaledHeight(); final int scaledHeight = scaledresolution.getScaledHeight();
this.mouseX = Mouse.getX() * scaledWidth / gui.mc.displayWidth; this.mouseX = Mouse.getX() * scaledWidth / gui.mc.displayWidth;
this.mouseY = scaledHeight - Mouse.getY() * scaledHeight / gui.mc.displayHeight - 1; this.mouseY = scaledHeight - Mouse.getY() * scaledHeight / gui.mc.displayHeight - 1;
*/
} }
*/ /**
/**
* The x coordinate of the mouse pointer on the screen. * The x coordinate of the mouse pointer on the screen.
*//* * /
public int getMouseX() public int getMouseX()
{ {
return mouseX; return mouseX;
} }
*/ /**
/**
* The y coordinate of the mouse pointer on the screen. * The y coordinate of the mouse pointer on the screen.
*//* * /
public int getMouseY() public int getMouseY()
{ {
return mouseY; return mouseY;
} }
*/
} }
*/
/** /**
* This event fires in {@link InventoryEffectRenderer#updateActivePotionEffects()} * This event fires in {@link InventoryEffectRenderer#updateActivePotionEffects()}

View file

@ -102,6 +102,7 @@
"forge.controlsgui.shift": "SHIFT + %s", "forge.controlsgui.shift": "SHIFT + %s",
"forge.controlsgui.control": "CTRL + %s", "forge.controlsgui.control": "CTRL + %s",
"forge.controlsgui.control.mac": "CMD + %s", "forge.controlsgui.control.mac": "CMD + %s",
"forge.controlsgui.alt": "ALT + %s" "forge.controlsgui.alt": "ALT + %s",
"forge.container.enchant.limitedEnchantability": "Limited Enchantability"
} }