mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 00:07:45 +00:00
Multiple tweaks and fixes to the recent changes in the client refactor PR (#8836)
* Add an easy way to get the NamedGuiOverlay from a vanilla overlay * Fix static member ordering crash in UnitTextureAtlasSprite * Allow boss bar rendering to be cancelled * Make fluid container datagen use the new name
This commit is contained in:
1 parent
b558b132cd
commit
a98eeb9d08
6 files changed
+24
-7
No files matched your search
@@ -1,18 +1,20 @@
|
||||
--- a/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
+++ b/net/minecraft/client/gui/components/BossHealthOverlay.java
|
||||
@@ -34,6 +_,7 @@
|
||||
@@ -34,6 +_,8 @@
|
||||
|
||||
for(LerpingBossEvent lerpingbossevent : this.f_93699_.values()) {
|
||||
int k = i / 2 - 91;
|
||||
+ var event = net.minecraftforge.client.ForgeHooksClient.onCustomizeBossEventProgress(p_93705_, this.f_93698_.m_91268_(), lerpingbossevent, k, j, 10 + this.f_93698_.f_91062_.f_92710_);
|
||||
+ if (!event.isCanceled()) {
|
||||
RenderSystem.m_157429_(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.m_157456_(0, f_93697_);
|
||||
this.m_93706_(p_93705_, k, j, lerpingbossevent);
|
||||
@@ -42,7 +_,7 @@
|
||||
@@ -42,7 +_,8 @@
|
||||
int i1 = i / 2 - l / 2;
|
||||
int j1 = j - 9;
|
||||
this.f_93698_.f_91062_.m_92763_(p_93705_, component, (float)i1, (float)j1, 16777215);
|
||||
- j += 10 + 9;
|
||||
+ }
|
||||
+ j += event.getIncrement();
|
||||
if (j >= this.f_93698_.m_91268_().m_85446_() / 3) {
|
||||
break;
|
||||
|
||||
@@ -55,11 +55,13 @@ public abstract class CustomizeGuiOverlayEvent extends Event
|
||||
/**
|
||||
* Fired <b>before</b> a boss health bar is rendered to the screen.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* Cancelling this event will prevent the given bar from rendering.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@Cancelable
|
||||
public static class BossEventProgress extends CustomizeGuiOverlayEvent
|
||||
{
|
||||
private final LerpingBossEvent bossEvent;
|
||||
@@ -124,7 +126,7 @@ public abstract class CustomizeGuiOverlayEvent extends Event
|
||||
* Fired <b>before</b> textual information is rendered to the debug screen.
|
||||
* This can be used to add or remove text information.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
@@ -162,7 +164,7 @@ public abstract class CustomizeGuiOverlayEvent extends Event
|
||||
/**
|
||||
* Fired <b>before</b> the chat messages overlay is rendered to the screen.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.<p/>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
|
||||
@@ -59,6 +59,7 @@ public final class GuiOverlayManager
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
OVERLAYS_BY_NAME = OVERLAYS.stream()
|
||||
.collect(ImmutableMap.toImmutableMap(NamedGuiOverlay::id, Function.identity()));
|
||||
assignVanillaOverlayTypes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,6 +74,12 @@ public final class GuiOverlayManager
|
||||
}
|
||||
}
|
||||
|
||||
private static void assignVanillaOverlayTypes()
|
||||
{
|
||||
for (var entry : VanillaGuiOverlay.values())
|
||||
entry.type = OVERLAYS_BY_NAME.get(entry.id());
|
||||
}
|
||||
|
||||
private GuiOverlayManager()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -209,6 +209,7 @@ public enum VanillaGuiOverlay
|
||||
|
||||
private final ResourceLocation id;
|
||||
final IGuiOverlay overlay;
|
||||
NamedGuiOverlay type;
|
||||
|
||||
VanillaGuiOverlay(String id, IGuiOverlay overlay)
|
||||
{
|
||||
@@ -221,4 +222,9 @@ public enum VanillaGuiOverlay
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public NamedGuiOverlay type()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class DynamicFluidContainerModelBuilder<T extends ModelBuilder<T>> extend
|
||||
|
||||
protected DynamicFluidContainerModelBuilder(T parent, ExistingFileHelper existingFileHelper)
|
||||
{
|
||||
super(new ResourceLocation("forge:bucket"), parent, existingFileHelper);
|
||||
super(new ResourceLocation("forge:fluid_container"), parent, existingFileHelper);
|
||||
}
|
||||
|
||||
public DynamicFluidContainerModelBuilder<T> fluid(Fluid fluid)
|
||||
|
||||
@@ -18,8 +18,8 @@ import net.minecraft.resources.ResourceLocation;
|
||||
*/
|
||||
public class UnitTextureAtlasSprite extends TextureAtlasSprite
|
||||
{
|
||||
public static final UnitTextureAtlasSprite INSTANCE = new UnitTextureAtlasSprite();
|
||||
public static final ResourceLocation LOCATION = new ResourceLocation("forge", "unit");
|
||||
public static final UnitTextureAtlasSprite INSTANCE = new UnitTextureAtlasSprite();
|
||||
|
||||
private UnitTextureAtlasSprite()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user