Skip to content

Commit

Permalink
Merge branch 'master' into exnihilo
Browse files Browse the repository at this point in the history
  • Loading branch information
Irgendwer01 authored Dec 18, 2023
2 parents 7469e97 + c4060fa commit 6bbfaa3
Show file tree
Hide file tree
Showing 45 changed files with 987 additions and 395 deletions.
6 changes: 2 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ dependencies {
// the CCL deobf jar uses very old MCP mappings, making it error at runtime in runClient/runServer
// therefore we manually deobf the regular jar
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358
implementation "curse.maven:modularui-624243:4856895-deobf-4856896-sources-4856897" // MUI 2.3.1
implementation("com.cleanroommc:modularui:2.4.1") { transitive = false }

// Soft Dependencies
// Can change any of these from compileOnlyApi -> implementation to test them in-game.

implementation "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.684"
implementation rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
implementation ("com.cleanroommc:groovyscript:0.7.1") {
transitive = false
}
implementation("com.cleanroommc:groovyscript:0.7.1") { transitive = false }
implementation rfg.deobf("curse.maven:ae2-extended-life-570458:4402048") // AE2UEL 0.55.6

compileOnlyApi rfg.deobf("curse.maven:opencomputers-223008:4526246") // OpenComputers 1.8.0+9833087
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modGroup = gregtech

# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion = 2.8.3-beta
modVersion = 2.8.5-beta

# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar = true
Expand Down
15 changes: 11 additions & 4 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.modules.ModuleContainerRegistryEvent;
import gregtech.api.util.oreglob.OreGlob;
import gregtech.client.utils.BloomEffectUtil;
import gregtech.common.covers.filter.oreglob.impl.OreGlobParser;
import gregtech.modules.GregTechModules;
import gregtech.modules.ModuleManager;

Expand All @@ -15,7 +13,17 @@
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLLoadCompleteEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartedEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppedEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;

@Mod(modid = GTValues.MODID,
name = "GregTech",
Expand Down Expand Up @@ -44,7 +52,6 @@ public GregTechMod() {
public void onConstruction(FMLConstructionEvent event) {
moduleManager = ModuleManager.getInstance();
GregTechAPI.moduleManager = moduleManager;
OreGlob.setCompiler(input -> new OreGlobParser(input).compile());
moduleManager.registerContainer(new GregTechModules());
MinecraftForge.EVENT_BUS.post(new ModuleContainerRegistryEvent());
moduleManager.setup(event.getASMHarvestedData(), Loader.instance().getConfigDir());
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/gregtech/api/cover/CoverWithUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
import gregtech.api.gui.IUIHolder;
import gregtech.api.gui.ModularUI;
import gregtech.api.mui.GTGuiTheme;
import gregtech.api.mui.GTGuis;
import gregtech.api.mui.GregTechGuiScreen;
import gregtech.api.mui.factory.CoverGuiFactory;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import com.cleanroommc.modularui.api.IGuiHolder;
import com.cleanroommc.modularui.manager.GuiCreationContext;
import com.cleanroommc.modularui.factory.SidedPosGuiData;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.screen.ModularScreen;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import org.jetbrains.annotations.ApiStatus;

public interface CoverWithUI extends Cover, IUIHolder, IGuiHolder {
public interface CoverWithUI extends Cover, IUIHolder, IGuiHolder<SidedPosGuiData> {

@ApiStatus.Experimental
default boolean usesMui2() {
Expand All @@ -27,8 +27,7 @@ default boolean usesMui2() {

default void openUI(EntityPlayerMP player) {
if (usesMui2()) {
GTGuis.getCoverUiInfo(getAttachedSide())
.open(player, getCoverableView().getWorld(), getCoverableView().getPos());
CoverGuiFactory.open(player, this);
} else {
CoverUIFactory.INSTANCE.openUI(this, player);
}
Expand All @@ -42,7 +41,7 @@ default ModularUI createUI(EntityPlayer player) {
@ApiStatus.NonExtendable
@SideOnly(Side.CLIENT)
@Override
default ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) {
default ModularScreen createScreen(SidedPosGuiData guiData, ModularPanel mainPanel) {
return new GregTechGuiScreen(mainPanel, getUITheme());
}

Expand All @@ -51,8 +50,7 @@ default GTGuiTheme getUITheme() {
}

@Override
default ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager,
boolean isClient) {
default ModularPanel buildUI(SidedPosGuiData guiData, GuiSyncManager guiSyncManager) {
return null;
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/gregtech/api/gui/GuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ public class GuiTextures {
.fullImage("textures/items/metaitems/cover.controller.png");

// Ore Filter
public static final TextureArea ORE_FILTER_BUTTON_CASE_SENSITIVE = TextureArea
.fullImage("textures/gui/widget/ore_filter/button_case_sensitive.png");
public static final TextureArea ORE_FILTER_BUTTON_MATCH_ALL = TextureArea
.fullImage("textures/gui/widget/ore_filter/button_match_all.png");
public static final TextureArea ORE_FILTER_INFO = TextureArea.fullImage("textures/gui/widget/ore_filter/info.png");
public static final TextureArea ORE_FILTER_SUCCESS = TextureArea
.fullImage("textures/gui/widget/ore_filter/success.png");
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/gregtech/api/items/gui/ItemUIFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import net.minecraftforge.fml.relauncher.SideOnly;

import com.cleanroommc.modularui.api.IGuiHolder;
import com.cleanroommc.modularui.manager.GuiCreationContext;
import com.cleanroommc.modularui.factory.HandGuiData;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.screen.ModularScreen;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
import org.jetbrains.annotations.ApiStatus;

public interface ItemUIFactory extends IItemComponent, IGuiHolder {
public interface ItemUIFactory extends IItemComponent, IGuiHolder<HandGuiData> {

/**
* Creates new UI basing on given holder. Holder contains information
Expand All @@ -30,7 +30,7 @@ default ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlay
@ApiStatus.NonExtendable
@SideOnly(Side.CLIENT)
@Override
default ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) {
default ModularScreen createScreen(HandGuiData creationContext, ModularPanel mainPanel) {
return new GregTechGuiScreen(mainPanel, getUITheme());
}

Expand All @@ -39,8 +39,7 @@ default GTGuiTheme getUITheme() {
}

@Override
default ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager,
boolean isClient) {
default ModularPanel buildUI(HandGuiData guiData, GuiSyncManager guiSyncManager) {
return null;
}
}
13 changes: 6 additions & 7 deletions src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.metatileentity.interfaces.ISyncedTileEntity;
import gregtech.api.mui.GTGuiTheme;
import gregtech.api.mui.GTGuis;
import gregtech.api.mui.GregTechGuiScreen;
import gregtech.api.mui.factory.MetaTileEntityGuiFactory;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.util.GTLog;
import gregtech.api.util.GTTransferUtils;
Expand Down Expand Up @@ -70,7 +70,7 @@
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Matrix4;
import com.cleanroommc.modularui.api.IGuiHolder;
import com.cleanroommc.modularui.manager.GuiCreationContext;
import com.cleanroommc.modularui.factory.PosGuiData;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.screen.ModularScreen;
import com.cleanroommc.modularui.value.sync.GuiSyncManager;
Expand All @@ -90,7 +90,7 @@

import static gregtech.api.capability.GregtechDataCodes.*;

public abstract class MetaTileEntity implements ISyncedTileEntity, CoverHolder, IVoidable, IGuiHolder {
public abstract class MetaTileEntity implements ISyncedTileEntity, CoverHolder, IVoidable, IGuiHolder<PosGuiData> {

public static final IndexedCuboid6 FULL_CUBE_COLLISION = new IndexedCuboid6(null, Cuboid6.full);

Expand Down Expand Up @@ -437,7 +437,7 @@ public boolean usesMui2() {

@SideOnly(Side.CLIENT)
@Override
public final ModularScreen createScreen(GuiCreationContext creationContext, ModularPanel mainPanel) {
public final ModularScreen createScreen(PosGuiData posGuiData, ModularPanel mainPanel) {
return new GregTechGuiScreen(mainPanel, getUITheme());
}

Expand All @@ -446,8 +446,7 @@ public GTGuiTheme getUITheme() {
}

@Override
public ModularPanel buildUI(GuiCreationContext guiCreationContext, GuiSyncManager guiSyncManager,
boolean isClient) {
public ModularPanel buildUI(PosGuiData guiData, GuiSyncManager guiSyncManager) {
return null;
}

Expand All @@ -469,7 +468,7 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac
if (!playerIn.isSneaking() && openGUIOnRightClick()) {
if (getWorld() != null && !getWorld().isRemote) {
if (usesMui2()) {
GTGuis.MTE.open(playerIn, getWorld(), getPos());
MetaTileEntityGuiFactory.open(playerIn, this);
} else {
MetaTileEntityUIFactory.INSTANCE.openUI(getHolder(), (EntityPlayerMP) playerIn);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import org.jetbrains.annotations.MustBeInvokedByOverriders;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -28,24 +29,34 @@ protected void invalidateNeighbors() {
}
}

@MustBeInvokedByOverriders
@Override
public void setWorld(@NotNull World worldIn) {
super.setWorld(worldIn);
invalidateNeighbors();
}

@MustBeInvokedByOverriders
@Override
public void setPos(@NotNull BlockPos posIn) {
super.setPos(posIn);
invalidateNeighbors();
}

@MustBeInvokedByOverriders
@Override
public void invalidate() {
super.invalidate();
invalidateNeighbors();
}

@MustBeInvokedByOverriders
@Override
public void onChunkUnload() {
super.onChunkUnload();
invalidateNeighbors();
}

@Override
public @Nullable TileEntity getNeighbor(@NotNull EnumFacing facing) {
if (world == null || pos == null) return null;
Expand Down
37 changes: 26 additions & 11 deletions src/main/java/gregtech/api/mui/GTGuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.cleanroommc.modularui.drawable.UITexture;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

/**
* GT MUI textures.<br>
Expand Down Expand Up @@ -52,7 +53,15 @@ public static class IDs {
.location(GTValues.MODID, "textures/gui/base/background.png")
.imageSize(176, 166)
.adaptable(3)
.registerAsBackground(IDs.STANDARD_BACKGROUND, true)
.name(IDs.STANDARD_BACKGROUND)
.canApplyTheme()
.build();

public static final UITexture BACKGROUND_POPUP = UITexture.builder()
.location(GTValues.MODID, "textures/gui/base/background_popup.png")
.imageSize(195, 136)
.adaptable(4)
.canApplyTheme()
.build();

// todo BORDERED/BOXED backgrounds will not be ported, if possible
Expand All @@ -61,22 +70,22 @@ public static class IDs {
.location(GTValues.MODID, "textures/gui/base/background_bronze.png")
.imageSize(176, 166)
.adaptable(3)
.registerAsBackground(IDs.BRONZE_BACKGROUND)
.name(IDs.BRONZE_BACKGROUND)
.build();

public static final UITexture BACKGROUND_STEEL = UITexture.builder()
.location(GTValues.MODID, "textures/gui/base/background_steel.png")
.imageSize(176, 166)
.adaptable(3)
.registerAsBackground(IDs.STEEL_BACKGROUND)
.name(IDs.STEEL_BACKGROUND)
.build();

// todo move to textures/gui/base
public static final UITexture BACKGROUND_PRIMITIVE = UITexture.builder()
.location(GTValues.MODID, "textures/gui/primitive/primitive_background.png")
.imageSize(176, 166)
.adaptable(3)
.registerAsBackground(IDs.PRIMITIVE_BACKGROUND)
.name(IDs.PRIMITIVE_BACKGROUND)
.build();

// todo clipboard backgrounds, may deserve some redoing
Expand Down Expand Up @@ -108,36 +117,38 @@ public static class IDs {
.location(GTValues.MODID, "textures/gui/base/slot.png")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground(IDs.STANDARD_SLOT, true)
.name(IDs.STANDARD_SLOT)
.canApplyTheme()
.build();

public static final UITexture SLOT_BRONZE = new UITexture.Builder()
.location(GTValues.MODID, "textures/gui/base/slot_bronze.png")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground(IDs.BRONZE_SLOT)
.name(IDs.BRONZE_SLOT)
.build();

public static final UITexture SLOT_STEEL = new UITexture.Builder()
.location(GTValues.MODID, "textures/gui/base/slot_steel.png")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground(IDs.STEEL_SLOT)
.name(IDs.STEEL_SLOT)
.build();

// todo move to textures/gui/base
public static final UITexture SLOT_PRIMITIVE = new UITexture.Builder()
.location(GTValues.MODID, "textures/gui/primitive/primitive_slot.png")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground(IDs.PRIMITIVE_SLOT)
.name(IDs.PRIMITIVE_SLOT)
.build();

public static final UITexture FLUID_SLOT = new UITexture.Builder()
.location(GTValues.MODID, "textures/gui/base/fluid_slot.png")
.imageSize(18, 18)
.adaptable(1)
.registerAsBackground(IDs.STANDARD_FLUID_SLOT, true)
.name(IDs.STANDARD_FLUID_SLOT)
.canApplyTheme()
.build();

// todo bronze/steel/primitive fluid slots?
Expand Down Expand Up @@ -253,7 +264,7 @@ public static class IDs {
.location(GTValues.MODID, "textures/gui/widget/button.png")
.imageSize(18, 18)
.adaptable(1)
.registerAsIcon(IDs.STANDARD_BUTTON)
.name(IDs.STANDARD_BUTTON)
.canApplyTheme()
.build();

Expand Down Expand Up @@ -444,7 +455,11 @@ private static UITexture progressBar(String path, int width, int height, boolean
}

// todo steam logos? multi indicator blinking logos?
public static UITexture getLogo() {
public static @NotNull UITexture getLogo(GTGuiTheme theme) {
if (theme != null) {
UITexture logo = theme.getLogo();
if (logo != null) return logo;
}
return GTValues.XMAS.get() ? GREGTECH_LOGO_XMAS : GREGTECH_LOGO;
}
}
Loading

0 comments on commit 6bbfaa3

Please sign in to comment.