Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
ae90d5f
almost satisfied
Zorbatron Jun 26, 2025
641a188
SelectorWidget is kil :sob:
Zorbatron Jun 26, 2025
0b1c551
Always add sus record when in dev env
Zorbatron Jun 26, 2025
44e9cb5
Looks better
Zorbatron Jun 26, 2025
924cb69
The list widget has been tamed
Zorbatron Jun 26, 2025
3f2d459
Fix the sound being stopped when the gui is opened and probably fix s…
Zorbatron Jun 26, 2025
758a2ba
Unbrick on servers
Zorbatron Jun 27, 2025
cf8356d
Speaker icon for sound popup button
Zorbatron Jun 27, 2025
dd56f09
Basic port to get things working
Zorbatron Jul 1, 2025
e2a70e0
Forgot to copy over setting the closest tier when entering a voltage
Zorbatron Jul 1, 2025
fef6cda
Add tooltip to + and - buttons
Zorbatron Jul 1, 2025
9fb0e9c
When set back to source, don't set everything to 0
Zorbatron Jul 2, 2025
65311aa
Use layout widgets instead of magic pos numbers
Zorbatron Jul 2, 2025
bdb9d46
Replace tier button with slider
Zorbatron Jul 2, 2025
b1c05b1
Make `tierSync` a `DoubleSyncValue` so it can be used directly in the…
Zorbatron Jul 2, 2025
b5e1b95
Change the `MetaTileEntityCreativeEnergy` constructor to take the res…
Zorbatron Jul 2, 2025
d6c318e
spotless
Zorbatron Jul 2, 2025
d275cfa
Basic port of data access hatches
Zorbatron Jul 2, 2025
f2284d6
Add logo icon that displays the provided recipes of the data items
Zorbatron Jul 2, 2025
e224379
Add a small amount of space after the tooltip title
Zorbatron Jul 2, 2025
51f2e62
Merge branch 'zb/creative-energy-mui2' into zb/alarm-mui2
Zorbatron Jul 2, 2025
d4815e7
Basic port of turbo charger block
Zorbatron Jul 2, 2025
f85f04d
Add colored overlay to charger slots that indicate the charge level o…
Zorbatron Jul 2, 2025
4aee3ad
ough I'm lerping
Zorbatron Jul 3, 2025
b97bced
Port item collectors to MUI2
Zorbatron Jul 3, 2025
5a8a8fd
Move mark dirty into server check
Zorbatron Jul 3, 2025
2884466
spotless
Zorbatron Jul 4, 2025
bc93a1f
Change GTValues FOOLS and XMAS from a `Supplier<Boolean>` to a `Boole…
Zorbatron Jul 4, 2025
70fe50c
spotless
Zorbatron Jul 4, 2025
bd20ac0
Oops fogor
Zorbatron Jul 4, 2025
f834668
Delete TapeItemStackHandler and replace usage with FilteredItemStackH…
Zorbatron Jul 4, 2025
f0e40e2
Merge branch 'master' into zb/alarm-mui2
Zorbatron Jul 4, 2025
f7eee09
maintenance hatch port start
Zorbatron Jul 4, 2025
ebf5e07
sorry no commit message i fogor
Zorbatron Jul 8, 2025
aa92100
Refactor how fixing problems with tools and toolbelts is done.
Zorbatron Jul 8, 2025
3ad2888
Finish toolbelt maintenance handling refactor
Zorbatron Jul 10, 2025
762b0d5
minor consumeDuctTape refactor
Zorbatron Jul 10, 2025
8201a32
Add shift clicking to the tape slot
Zorbatron Jul 10, 2025
543ed7b
Clean up time/duration multiplier code
Zorbatron Jul 11, 2025
d92d082
add FloatSyncValue
Zorbatron Jul 11, 2025
12a77dc
Use slider instead of +/- buttons (whoopsies text widgets have wayyy …
Zorbatron Jul 11, 2025
934485d
forgot a stopper point
Zorbatron Jul 11, 2025
a4e6531
Better slider and hide stoppers
Zorbatron Jul 11, 2025
982342e
Almost working drawing the static wire images
Zorbatron Jul 12, 2025
8c6373f
Kill among us imposter
Zorbatron Nov 25, 2025
cfa9c54
Merge branch 'master' into zb/alarm-mui2
Zorbatron Nov 25, 2025
a7f5c59
Post merge fixes
Zorbatron Nov 25, 2025
bcfe780
FlappyGreg is pretty functional now
Zorbatron Nov 26, 2025
294be61
Use MUI stencil instead of manual scissoring
Zorbatron Nov 26, 2025
2c93606
Remove comment about NotNull buildUI
Zorbatron Nov 26, 2025
7fe8793
Use enum for game state and refactor how FOOLS and XMAS event are han…
Zorbatron Nov 26, 2025
bc3e8d8
Use MetaTileEntityGuiData instead of PosGuiData
Zorbatron Nov 27, 2025
5a5f5d0
Fix how the bytes are copied from the gui data buffer to the s -> c p…
Zorbatron Nov 27, 2025
fffe4b3
Remove `return true` debug from april fools function
Zorbatron Nov 27, 2025
ae48b1c
Don't use tall panel when it's not april fools
Zorbatron Nov 27, 2025
4b08fff
Fix fixAllMaintenance setting the bits to broken
Zorbatron Nov 27, 2025
7441b64
Revert "Remove comment about NotNull buildUI"
Zorbatron Nov 27, 2025
fbec85e
Re-refactor MUI2 MTEs into an interface and instanceof check
Zorbatron Nov 29, 2025
3e31d69
Add warning about read only buffer
Zorbatron Nov 29, 2025
1e8970d
skull emoji
Zorbatron Nov 29, 2025
73e1f47
Add descriptive javadoc to IMetaTileEntityGuiHolder
Zorbatron Nov 29, 2025
3f9705e
Correct nullability
Zorbatron Nov 29, 2025
39913d7
Change around UI checks in onRightClick
Zorbatron Nov 29, 2025
4ff4dde
Forgot to remove image files
Zorbatron Dec 6, 2025
61a360a
Clamp charge between 0-1
Zorbatron Dec 6, 2025
73b6a6c
Actually register range sync handler
Zorbatron Dec 6, 2025
ba64936
wrong overlay text
Zorbatron Dec 6, 2025
a5ccc60
Add javadoc about new UIs on MTEs and fix not returning true from onR…
Zorbatron Dec 7, 2025
21cc7ae
fix isItemChargable
Zorbatron Dec 7, 2025
b068759
Add javadoc to isItemChargableWithEU
Zorbatron Dec 7, 2025
1c56346
fix xmas
Zorbatron Dec 8, 2025
349ad95
add todo about legacy mui mtes
Zorbatron Dec 8, 2025
76905a5
Move single TooltipUtil method to TooltipHelper
Zorbatron Dec 8, 2025
6456ed6
todo on combineRGB
Zorbatron Dec 8, 2025
d04c55b
make item collectors default to auto output false
Zorbatron Dec 8, 2025
ac93b8e
remove unused class
Zorbatron Dec 8, 2025
997692f
Fix dedicated servers
Zorbatron Dec 10, 2025
2754b04
refactor maintenance stuff
Zorbatron Dec 10, 2025
c835e0d
fix error widget
Zorbatron Dec 10, 2025
892fb58
simplify tool checking method
Zorbatron Dec 10, 2025
d33f004
merge ifs
Zorbatron Dec 10, 2025
3b0d64b
actually fix the problems bruh
Zorbatron Dec 10, 2025
a56bab8
use mui synced actions, required update to 3.0.5
Zorbatron Dec 10, 2025
e7f44a2
modular panels can't have custom names anymore
Zorbatron Dec 10, 2025
e0d9233
if maintenance slot clicked with item, only use that item
Zorbatron Dec 10, 2025
f1cf851
MathHelper.clamp
Zorbatron Dec 10, 2025
c2e51ef
remove ui-less mtes from todo list
Zorbatron Dec 10, 2025
0299d6e
remove two more unused classes
Zorbatron Dec 10, 2025
fe3c47b
Remove unused classes pt2 :cry:
Zorbatron Dec 10, 2025
58db060
remove among us vestigial
Zorbatron Dec 10, 2025
c511e21
check special events config
Zorbatron Dec 10, 2025
c636b3e
limit data hatch slot to stack size of 1
Zorbatron Dec 10, 2025
bb588b2
use proper mteguidata class in MultiblockUIFactory
Zorbatron Dec 10, 2025
9cfd168
data hatch logo blinks yellow when no recipes
Zorbatron Dec 10, 2025
acfd69d
Remove unnecessary setters
Zorbatron Dec 10, 2025
a9851aa
Merge branch 'master' into zb/alarm-mui2
Zorbatron Dec 10, 2025
1af23ad
Delete the old among us textures that I'm pretty sure I already deleted
Zorbatron Dec 10, 2025
4b57778
directly return panel
Zorbatron Dec 14, 2025
2b639b8
improve creative emitter slider
Zorbatron Dec 14, 2025
c89770f
spotl
Zorbatron Dec 14, 2025
0f426e5
Use MetaItems.DUCT_TAPE directly
Zorbatron Dec 15, 2025
bd8c2a9
Remove uses of deprecated PanelSyncHandler#panel
Zorbatron Dec 15, 2025
3002d2f
slightly improve alarm ui code
Zorbatron Dec 15, 2025
0cdeaf5
add sound preview button to alarm
Zorbatron Dec 15, 2025
76ec40f
Remove among us trap remix
Zorbatron Dec 15, 2025
3b06909
Remove among us trap remix pt2
Zorbatron Dec 15, 2025
f9590f4
spotless
Zorbatron Dec 15, 2025
d274ad1
Be less API breaking
Zorbatron Dec 16, 2025
33b0c7e
spot
Zorbatron Dec 16, 2025
67dcd3d
Don't use custom rectangle class
Zorbatron Dec 16, 2025
cbcc7eb
that actually makes it worse
Zorbatron Dec 16, 2025
69c0c2b
turns out these were needed after all
Zorbatron Dec 19, 2025
790ba9b
don't open ui if clicking maint hatch with toolbelt
Zorbatron Dec 19, 2025
d718d92
Move getIncrementValue from CoverWithUI to GTUtility
Zorbatron Dec 19, 2025
559af08
Move createAdjustOverlay from CoverWithUI to KeyUtil
Zorbatron Dec 19, 2025
d096bb7
make the amp +/- buttons affected by modifier keys
Zorbatron Dec 19, 2025
e2ee90e
Separate the source and sink voltage/amperage
Zorbatron Dec 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
dependencies {
// Published dependencies
api("codechicken:codechickenlib:3.2.3.358")
api("com.cleanroommc:modularui:3.0.4") { transitive = false }
api("com.cleanroommc:modularui:3.0.5") { transitive = false }
api("com.cleanroommc:groovyscript:1.2.0-hotfix1") { transitive = false }
api("curse.maven:inventory-bogosorter-632327:7102721-deobf-6717233-sources-6717234") // Inventory BogoSorter − v1.5.0
api("curse.maven:key-binding-patch-928895:5951859") // Key Binding Patch v1.3.3.3, needed by Inventory BogoSorter v1.5.0+
Expand Down
36 changes: 26 additions & 10 deletions src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package gregtech.api;

import gregtech.api.util.GTUtility;
import gregtech.api.util.random.XoShiRo256PlusPlusRandom;
import gregtech.common.ConfigHolder;

import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.FMLLaunchHandler;
import net.minecraftforge.oredict.OreDictionary;

import java.time.LocalDate;
import java.time.MonthDay;
import java.util.Random;
import java.util.function.Supplier;

Expand Down Expand Up @@ -191,14 +192,29 @@ public static boolean isDeobfEnvironment() {
*/
public static final int FALLBACK = -1;

public static Supplier<Boolean> FOOLS = () -> {
String[] yearMonthDay = LocalDate.now().toString().split("-");
return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("04") && yearMonthDay[2].equals("01");
};
public static final MonthDay DAY_APRIL_FOOLS = MonthDay.of(4, 1);
public static final MonthDay DAY_XMAS_EVE = MonthDay.of(12, 24);
public static final MonthDay DAY_XMAS = MonthDay.of(12, 25);

public static Supplier<Boolean> XMAS = () -> {
String[] yearMonthDay = LocalDate.now().toString().split("-");
return ConfigHolder.misc.specialEvents && yearMonthDay[1].equals("12") &&
(yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25"));
};
/**
* Check if today is April 1st.
*/
public static boolean isAprilFools() {
if (!ConfigHolder.misc.specialEvents) return false;
return GTUtility.isToday(DAY_APRIL_FOOLS);
}

/**
* Check if today is the day of, or eve of Xmas.
*/
public static boolean isXMAS() {
if (!ConfigHolder.misc.specialEvents) return false;
return GTUtility.isToday(DAY_XMAS_EVE) || GTUtility.isToday(DAY_XMAS);
}

@Deprecated
public static final Supplier<Boolean> FOOLS = GTValues::isAprilFools;

@Deprecated
public static final Supplier<Boolean> XMAS = GTValues::isXMAS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public static int assignId() {
public static final int STORE_TAPED = assignId();
public static final int RECIPE_MAP_INDEX = assignId();
public static final int IS_FRONT_FACE_FREE = assignId();
public static final int MAINTENANCE_MULTIPLIER = assignId();
public static final int UPDATE_UPWARDS_FACING = assignId();
public static final int UPDATE_FLIP = assignId();
public static final int LOCK_FILL = assignId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ public interface IMaintenanceHatch {
*/
Tuple<Byte, Integer> readMaintenanceData();

double getDurationMultiplier();
default double getDurationMultiplier() {
return 1.0d;
}

double getTimeMultiplier();
default double getTimeMultiplier() {
return 1.0d;
}

boolean startWithoutProblems();
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public FilteredItemHandler(MetaTileEntity metaTileEntity, int size) {
super(metaTileEntity, size);
}

public FilteredItemHandler(MetaTileEntity metaTileEntity, int size, Predicate<ItemStack> fillPredicate) {
super(metaTileEntity, size);
this.fillPredicate = fillPredicate;
}

public FilteredItemHandler(MetaTileEntity metaTileEntity, NonNullList<ItemStack> stacks) {
super(metaTileEntity, stacks);
}
Expand All @@ -36,6 +41,18 @@ public FilteredItemHandler setFillPredicate(Predicate<ItemStack> fillPredicate)
return this;
}

@Override
public @NotNull ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) {
if (!isItemValid(slot, stack)) return stack;
return super.insertItem(slot, stack, simulate);
}

@Override
public void setStackInSlot(int slot, @NotNull ItemStack stack) {
if (!isItemValid(slot, stack)) return;
super.setStackInSlot(slot, stack);
}

@Override
public boolean isItemValid(int slot, @NotNull ItemStack stack) {
return fillPredicate == null || fillPredicate.test(stack);
Expand Down
28 changes: 0 additions & 28 deletions src/main/java/gregtech/api/cover/CoverWithUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import com.cleanroommc.modularui.screen.ModularScreen;
import com.cleanroommc.modularui.screen.UISettings;
import com.cleanroommc.modularui.utils.Alignment;
import com.cleanroommc.modularui.utils.Color;
import com.cleanroommc.modularui.utils.MouseData;
import com.cleanroommc.modularui.value.BoolValue;
import com.cleanroommc.modularui.value.sync.EnumSyncValue;
import com.cleanroommc.modularui.value.sync.IntSyncValue;
Expand Down Expand Up @@ -148,32 +146,6 @@ default IKey createEnabledKey(@NotNull String keyBase, @NotNull BooleanSupplier
return IKey.lang(() -> enabledState.getAsBoolean() ? enabled : disabled);
}

default int getIncrementValue(MouseData data) {
int adjust = 1;
if (data.shift) adjust *= 4;
if (data.ctrl) adjust *= 16;
if (data.alt) adjust *= 64;
return adjust;
}

default IKey createAdjustOverlay(boolean increment) {
final StringBuilder builder = new StringBuilder();
builder.append(increment ? '+' : '-');
builder.append(getIncrementValue(MouseData.create(-1)));

float scale = 1f;
if (builder.length() == 3) {
scale = 0.8f;
} else if (builder.length() == 4) {
scale = 0.6f;
} else if (builder.length() > 4) {
scale = 0.5f;
}
return IKey.str(builder.toString())
.color(Color.WHITE.main)
.scale(scale);
}

/**
* Get a BoolValue for use with toggle buttons which are "linked together,"
* meaning only one of them can be pressed at a time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import net.minecraft.util.NonNullList;
import net.minecraftforge.items.ItemStackHandler;

import org.jetbrains.annotations.NotNull;

public class GTItemStackHandler extends ItemStackHandler {

final private MetaTileEntity metaTileEntity;
Expand All @@ -26,7 +28,7 @@ public GTItemStackHandler(MetaTileEntity metaTileEntity, NonNullList<ItemStack>
}

@Override
public void setStackInSlot(int slot, ItemStack stack) {
public void setStackInSlot(int slot, @NotNull ItemStack stack) {
if (ItemStack.areItemStacksEqual(stack, getStackInSlot(slot)))
return;

Expand Down
47 changes: 23 additions & 24 deletions src/main/java/gregtech/api/items/toolitem/ItemGTToolbelt.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import gregtech.api.items.IDyeableItem;
import gregtech.api.items.gui.ItemUIFactory;
import gregtech.api.items.toolitem.behavior.IToolBehavior;
import gregtech.api.metatileentity.MetaTileEntityHolder;
import gregtech.api.mui.GTGuiTextures;
import gregtech.api.mui.GTGuis;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.api.unification.material.properties.ToolProperty;
import gregtech.api.util.GTUtility;
import gregtech.api.util.LocalizationUtils;
import gregtech.api.util.TextFormattingUtil;
import gregtech.client.utils.TooltipHelper;
Expand Down Expand Up @@ -59,6 +59,7 @@
import com.cleanroommc.modularui.widgets.slot.SlotGroup;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
Expand All @@ -70,6 +71,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.IntSupplier;
import java.util.function.Supplier;

Expand Down Expand Up @@ -106,6 +108,19 @@ public ItemStack getToolInSlot(@NotNull ItemStack toolbelt, int slot) {
return handler.getStackInSlot(slot);
}

/**
* Iterate over non-empty slots of the given toolbelt.
*/
public void iterateSlots(@NotNull ItemStack toolBelt, @NotNull Consumer<@NotNull ItemStack> stackConsumer) {
ToolStackHandler handler = getHandler(toolBelt);
if (handler == FALLBACK) return;
for (int index = 0; index < handler.getSlots(); index++) {
ItemStack stack = handler.getStackInSlot(index);
if (stack.isEmpty()) continue;
stackConsumer.accept(stack);
}
}

@Override
public ModularPanel buildUI(HandGuiData guiData, PanelSyncManager guiSyncManager, UISettings settings) {
final var usedStack = guiData.getUsedItemStack();
Expand Down Expand Up @@ -406,11 +421,6 @@ public void setOnCraftIngredient(ItemStack stack, Ingredient ingredient) {
}
}

public boolean damageAgainstMaintenanceProblem(ItemStack stack, String toolClass,
@Nullable EntityPlayer entityPlayer) {
return getHandler(stack).checkMaintenanceAgainstTools(toolClass, true, entityPlayer);
}

public boolean supportsIngredient(ItemStack stack, Ingredient ingredient) {
return getHandler(stack).checkIngredientAgainstTools(ingredient) != -1;
}
Expand Down Expand Up @@ -478,12 +488,13 @@ public void setSelectedTool(int slot, ItemStack stack) {
float hitY, float hitZ, @NotNull EnumHand hand) {
EnumActionResult result = IDyeableItem.super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand);
if (result == EnumActionResult.PASS) {
ItemStack stack = player.getHeldItem(hand);
ToolStackHandler handler = getHandler(stack);
if (handler.getSelectedStack().isEmpty() &&
world.getTileEntity(pos) instanceof MetaTileEntityHolder holder &&
holder.getMetaTileEntity() instanceof MetaTileEntityMaintenanceHatch maintenance) {
maintenance.fixMaintenanceProblemsWithToolbelt(player, this, stack);
ItemStack toolbeltStack = player.getHeldItem(hand);
ToolStackHandler handler = getHandler(toolbeltStack);
if (handler.getSelectedStack().isEmpty() && GTUtility.getMetaTileEntity(world,
pos) instanceof MetaTileEntityMaintenanceHatch maintenanceHatch) {
List<ItemStack> tools = new ObjectArrayList<>();
iterateSlots(toolbeltStack, tools::add);
maintenanceHatch.fixMaintenanceProblemsWithTools(player, tools);
return EnumActionResult.SUCCESS;
}
return super.onItemUseFirst(player, world, pos, side, hitX, hitY, hitZ, hand);
Expand Down Expand Up @@ -739,18 +750,6 @@ protected void update() {
}
}

public boolean checkMaintenanceAgainstTools(String toolClass, boolean doCraftingDamage,
@Nullable EntityPlayer entityPlayer) {
for (int i = 0; i < this.getSlots(); i++) {
ItemStack stack = this.getStackInSlot(i);
if (ToolHelper.isTool(stack, toolClass)) {
if (doCraftingDamage) ToolHelper.damageItemWhenCrafting(stack, entityPlayer);
return true;
}
}
return false;
}

public int checkIngredientAgainstTools(Ingredient ingredient) {
for (int i = 0; i < this.getSlots(); i++) {
ItemStack stack = this.getStackInSlot(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public static void onActionDone(@NotNull EntityPlayer player, @NotNull World wor
/**
* @return if any of the specified tool classes exists in the tool
*/
public static boolean isTool(ItemStack tool, String... toolClasses) {
public static boolean isTool(@NotNull ItemStack tool, @Nullable String @NotNull... toolClasses) {
if (toolClasses.length == 1) {
return tool.getItem().getToolClasses(tool).contains(toolClasses[0]);
}
Expand Down
Loading
Loading