mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-08 12:34:46 +00:00
Add widget size to recipe event (#1053)
This commit is contained in:
1 parent
5868187410
commit
18abb880f8
2 files changed
+14
-5
No files matched your search
@@ -16,11 +16,15 @@ public abstract class GuiRecipeButton extends GuiNEIButton {
|
||||
|
||||
public List<GuiRecipeButton> buttonList;
|
||||
public RecipeHandlerRef handlerRef;
|
||||
public int width;
|
||||
public int height;
|
||||
|
||||
public UpdateRecipeButtonsEvent(GuiRecipe<?> gui, RecipeHandlerRef handlerRef,
|
||||
public UpdateRecipeButtonsEvent(GuiRecipe<?> gui, RecipeHandlerRef handlerRef, int width, int height,
|
||||
List<GuiRecipeButton> buttonList) {
|
||||
super(gui);
|
||||
this.handlerRef = handlerRef;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.buttonList = new ArrayList<>(buttonList);
|
||||
}
|
||||
|
||||
@@ -29,16 +33,17 @@ public abstract class GuiRecipeButton extends GuiNEIButton {
|
||||
|
||||
public HandlerInfo handlerInfo;
|
||||
|
||||
public Pre(GuiRecipe<?> gui, RecipeHandlerRef handlerRef, HandlerInfo handlerInfo) {
|
||||
super(gui, handlerRef, new ArrayList<>());
|
||||
public Pre(GuiRecipe<?> gui, RecipeHandlerRef handlerRef, int width, int height, HandlerInfo handlerInfo) {
|
||||
super(gui, handlerRef, width, height, new ArrayList<>());
|
||||
this.handlerInfo = handlerInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends UpdateRecipeButtonsEvent {
|
||||
|
||||
public Post(GuiRecipe<?> gui, RecipeHandlerRef handlerRef, List<GuiRecipeButton> buttonList) {
|
||||
super(gui, handlerRef, buttonList);
|
||||
public Post(GuiRecipe<?> gui, RecipeHandlerRef handlerRef, int width, int height,
|
||||
List<GuiRecipeButton> buttonList) {
|
||||
super(gui, handlerRef, width, height, buttonList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +163,8 @@ public class RecipeWidget extends Widget {
|
||||
final UpdateRecipeButtonsEvent.Pre preEvent = new UpdateRecipeButtonsEvent.Pre(
|
||||
guiRecipe,
|
||||
ref,
|
||||
this.w,
|
||||
this.h,
|
||||
this.handlerInfo);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(preEvent)) {
|
||||
@@ -171,6 +173,8 @@ public class RecipeWidget extends Widget {
|
||||
final UpdateRecipeButtonsEvent.Post postEvent = new UpdateRecipeButtonsEvent.Post(
|
||||
guiRecipe,
|
||||
ref,
|
||||
this.w,
|
||||
this.h,
|
||||
getDefaultButtons(ref));
|
||||
MinecraftForge.EVENT_BUS.post(postEvent);
|
||||
return postEvent.buttonList;
|
||||
|
||||
Reference in new issue
Block a user