Skip to content

Commit 57f23bd

Browse files
committed
Merge branch 'refs/heads/1.21.x' into recipe-condition-icons
# Conflicts: # src/client/java/aztech/modern_industrialization/compat/viewer/usage/MachineCategory.java # src/main/java/aztech/modern_industrialization/machines/recipe/condition/BiomeProcessCondition.java
2 parents 8c2381b + e8c4509 commit 57f23bd

File tree

243 files changed

+5434
-752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+5434
-752
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@ jobs:
2626
run: ./gradlew build
2727
env:
2828
MI_VERSION: git-${{ steps.var.outputs.commit_hash }}
29-
- name: Autotest Server
29+
- name: Gametest Server
3030
run: |
31-
rm -rf run || echo "no run directory to remove"
32-
mkdir run
33-
echo eula=true >> run/eula.txt
34-
./gradlew runAutotestServer --stacktrace
35-
! grep -q FATAL runs/server/logs/latest.log
36-
! grep -q JsonSyntaxException runs/server/logs/latest.log
31+
./gradlew runGameTestServer
3732
- name: Upload artifacts
3833
uses: actions/upload-artifact@v4
3934
with:

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ neoForge {
237237
programArguments.addAll '--mod', "modern_industrialization", '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
238238
}
239239

240-
autotestServer {
241-
server()
242-
systemProperty 'modern_industrialization.autoTest', 'true'
240+
gameTestServer {
241+
type = "gameTestServer"
242+
gameDirectory = project.file("build/gametest")
243243
}
244244
}
245245
}
@@ -252,7 +252,7 @@ configurations {
252252
dependencies {
253253
api jarJar("dev.technici4n:GrandPower:${project.grandpower_version}")
254254

255-
compileOnly "mezz.jei:jei-${project.jei_minecraft_version}-neoforge:${project.jei_version}"
255+
compileOnly "mezz.jei:jei-${project.jei_minecraft_version}-neoforge-api:${project.jei_version}"
256256
if (project.runtime_itemlist_mod == "jei") {
257257
localRuntimeOnly "mezz.jei:jei-${project.jei_minecraft_version}-neoforge:${project.jei_version}"
258258
}
@@ -280,7 +280,7 @@ dependencies {
280280

281281
implementation "me.shedaniel.cloth:cloth-config-neoforge:${project.cloth_config_version}"
282282

283-
/*localRuntimeOnly*/ compileOnly("curse.maven:jade-324717:${project.jade_file_id}")
283+
localRuntimeOnly compileOnly("curse.maven:jade-324717:${project.jade_file_id}")
284284

285285
// TODO: compileOnly because implementation will cause datagen to crash... hopefully kubejs fixes it soon
286286
/*localRuntimeOnly*/ compileOnly("dev.latvian.mods:kubejs-neoforge:${project.kubejs_version}")

docs/ADDING_MACHINES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ remember that the top, side and bottom textures of a casing must be `modern_indu
327327
For example:
328328
```js
329329
MIMachineEvents.registerCasings(event => {
330-
// Register two casings.
330+
// Register a casing.
331331
// This doesn't register any model! Either add models or add the top/side/bottom textures.
332-
event.register("my_fancy_casing", "my_other_casing");
332+
event.registerNamed("fancy_casing", "Fancy");
333333

334334
// This registers a new casing with the same model as a diamond block!
335-
event.registerBlockImitation("my_diamond_casing", "minecraft:diamond_block");
335+
event.registerBlockImitation("diamond_casing", "minecraft:diamond_block");
336336
})
337337
```
338338

docs/ADDING_RECIPES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The easiest way to add process conditions is via KubeJS, similarly to how inputs
3838
Here is the list of currently supported conditions:
3939
- `dimension(dimension key)`: Requires the machine to be in the specified dimension.
4040
- `biome(biome key)`: Requires the machine to be in the specified biome.
41+
- `biomeTag(biome tag key)`: Requires the machine to be in a biome of the specified tag.
4142
- `adjacentBlock(block, position)`: Requires a specific block to be next to the machine.
4243
- Position indicates where the block should be.
4344
- For multiblocks, the position is always relative to the controller.

gradle.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ emi_version=1.1.10
4242
ftb_quests_version=2100.1.3
4343
ftb_teams_version=2100.1.0
4444
jade_file_id=5493270
45-
jei_minecraft_version=1.21
46-
jei_version=19.8.2.99
47-
jei_version_range=[19.8.2.99,]
45+
# JEI Versions https://github.com/mezz/JustEnoughItems#1211
46+
jei_minecraft_version=1.21.1
47+
jei_version=19.20.0.241
48+
jei_version_range=[19.19.0,]
4849
kubejs_version=2100.7.0-build.102
4950
patchouli_version=1.21-87-NEOFORGE-SNAPSHOT
5051
rei_version=16.0.729

src/client/java/aztech/modern_industrialization/MIClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import aztech.modern_industrialization.blocks.storage.barrel.DeferredBarrelTextRenderer;
3030
import aztech.modern_industrialization.blocks.storage.barrel.client.BarrelTooltipComponent;
3131
import aztech.modern_industrialization.blocks.storage.tank.TankRenderer;
32+
import aztech.modern_industrialization.client.MIRenderTypes;
3233
import aztech.modern_industrialization.datagen.MIDatagenClient;
3334
import aztech.modern_industrialization.datagen.MIDatagenServer;
3435
import aztech.modern_industrialization.datagen.model.DelegatingModelBuilder;
@@ -96,6 +97,7 @@
9697
import net.neoforged.neoforge.client.event.RegisterGuiLayersEvent;
9798
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
9899
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
100+
import net.neoforged.neoforge.client.event.RegisterRenderBuffersEvent;
99101
import net.neoforged.neoforge.client.event.RenderFrameEvent;
100102
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
101103
import net.neoforged.neoforge.client.gui.VanillaGuiLayers;
@@ -163,6 +165,10 @@ private static void init(FMLConstructModEvent ignored) {
163165
IConfigScreenFactory.class,
164166
(mc, parentScreen) -> AutoConfig.getConfigScreen(MIConfig.class, parentScreen).get());
165167

168+
modBus.addListener(RegisterRenderBuffersEvent.class, event -> {
169+
event.registerRenderBuffer(MIRenderTypes.solidHighlight());
170+
});
171+
166172
// Warn if neither JEI nor REI is present!
167173
if (!ModList.get().isLoaded("emi") && !ModList.get().isLoaded("jei")
168174
&& !ModList.get().isLoaded("roughlyenoughitems")) {
@@ -210,7 +216,7 @@ private static void registerAdditionalModels(ModelEvent.RegisterAdditional event
210216

211217
private static final List<Runnable> blockEntityRendererRegistrations = new ArrayList<>();
212218

213-
public static <T extends BlockEntity, U extends T> void registerBlockEntityRenderer(Supplier<BlockEntityType<U>> bet,
219+
public static <T extends BlockEntity, U extends T> void registerBlockEntityRenderer(Supplier<? extends BlockEntityType<? extends U>> bet,
214220
BlockEntityRendererProvider<T> renderer) {
215221
blockEntityRendererRegistrations.add(() -> BlockEntityRenderers.register(bet.get(), renderer));
216222
}

src/client/java/aztech/modern_industrialization/client/DynamicTooltip.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424
package aztech.modern_industrialization.client;
2525

26-
import java.util.ArrayList;
26+
import aztech.modern_industrialization.util.RenderHelper;
2727
import java.util.List;
2828
import java.util.function.Supplier;
2929
import net.minecraft.client.Minecraft;
@@ -41,10 +41,6 @@ public DynamicTooltip(Supplier<List<Component>> tooltipSupplier) {
4141

4242
@Override
4343
public List<FormattedCharSequence> toCharSequence(Minecraft minecraft) {
44-
List<FormattedCharSequence> charSequences = new ArrayList<>();
45-
for (var component : tooltipSupplier.get()) {
46-
charSequences.addAll(Tooltip.splitTooltip(minecraft, component));
47-
}
48-
return charSequences;
44+
return RenderHelper.splitTooltip(tooltipSupplier.get());
4945
}
5046
}

src/client/java/aztech/modern_industrialization/client/MIRenderTypes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ private static RenderType makeMachineOverlay() {
6464
}
6565

6666
private static RenderType makeSolidHighlight() {
67-
return create("solid_highlight", DefaultVertexFormat.POSITION_COLOR_NORMAL, VertexFormat.Mode.QUADS, 65536, false, false,
67+
// Use block vertex format to use the fast path in BufferBuilder, even if the shader doesn't use the extra vertex attributes.
68+
return create("solid_highlight", DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS, 65536, false, false,
6869
CompositeState.builder()
6970
.setTransparencyState(NO_TRANSPARENCY)
7071
.setTextureState(NO_TEXTURE)

src/client/java/aztech/modern_industrialization/compat/viewer/impl/MachineScreenPredicateTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,8 @@ public static boolean test(ReiMachineRecipes.MachineScreenPredicate predicate, M
3434
case ANY -> true;
3535
case MULTIBLOCK -> {
3636
for (GuiComponentClient client : screen.getMenu().components) {
37-
if (client instanceof CraftingMultiblockGuiClient cmGui) {
38-
if (cmGui.isShapeValid) {
39-
yield true;
40-
}
37+
if (client instanceof CraftingMultiblockGuiClient cmGui && cmGui.isShapeValid) {
38+
yield true;
4139
}
4240
}
4341
yield false;
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2020 Azercoco & Technici4n
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
package aztech.modern_industrialization.compat.viewer.impl.jei;
25+
26+
import aztech.modern_industrialization.compat.viewer.abstraction.ViewerCategory;
27+
import mezz.jei.api.gui.drawable.IDrawable;
28+
import mezz.jei.api.helpers.IGuiHelper;
29+
import net.minecraft.client.gui.GuiGraphics;
30+
31+
public class DrawableIcon implements IDrawable {
32+
private final ViewerCategory.Icon.Texture texture;
33+
34+
public static IDrawable create(IGuiHelper guiHelper, ViewerCategory.Icon icon) {
35+
return switch (icon) {
36+
case ViewerCategory.Icon.Stack stack -> guiHelper.createDrawableItemStack(stack.stack());
37+
case ViewerCategory.Icon.Texture texture -> new DrawableIcon(texture);
38+
case null -> throw new NullPointerException("Icon cannot be null");
39+
};
40+
}
41+
42+
public DrawableIcon(ViewerCategory.Icon.Texture texture) {
43+
this.texture = texture;
44+
}
45+
46+
@Override
47+
public int getWidth() {
48+
return 18;
49+
}
50+
51+
@Override
52+
public int getHeight() {
53+
return 18;
54+
}
55+
56+
@Override
57+
public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset) {
58+
guiGraphics.blit(texture.loc(), xOffset - 1, yOffset - 1, 0, texture.u(), texture.v(), 18, 18, 256, 256);
59+
}
60+
}

0 commit comments

Comments
 (0)