1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-27 03:47:38 +00:00

Update to 1.19.4 (#1376)

This commit is contained in:
Jonathan Coates
2023-03-15 21:04:11 +00:00
committed by GitHub
parent 44f945c040
commit 3e6e3e70e5
132 changed files with 320 additions and 226 deletions

View File

@@ -10,6 +10,7 @@ import com.google.common.io.RecursiveDeleteOption;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
@@ -79,8 +80,9 @@ public class Exporter {
}
// Now find all CC recipes.
for (var recipe : Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING)) {
var result = recipe.getResultItem();
var level = Minecraft.getInstance().level;
for (var recipe : level.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING)) {
var result = recipe.getResultItem(level.registryAccess());
if (!RegistryWrappers.ITEMS.getKey(result.getItem()).getNamespace().equals(ComputerCraftAPI.MOD_ID)) {
continue;
}
@@ -120,13 +122,16 @@ public class Exporter {
if (Files.exists(itemDir)) MoreFiles.deleteRecursively(itemDir, RecursiveDeleteOption.ALLOW_INSECURE);
renderer.setupState();
var transform = new PoseStack();
transform.setIdentity();
for (var item : items) {
var stack = new ItemStack(item);
var location = RegistryWrappers.ITEMS.getKey(item);
dump.itemNames.put(location.toString(), stack.getHoverName().getString());
renderer.captureRender(itemDir.resolve(location.getNamespace()).resolve(location.getPath() + ".png"),
() -> Minecraft.getInstance().getItemRenderer().renderAndDecorateFakeItem(stack, 0, 0)
() -> Minecraft.getInstance().getItemRenderer().renderAndDecorateFakeItem(transform, stack, 0, 0)
);
}
renderer.clearState();

View File

@@ -97,7 +97,7 @@ class CCTestCommand {
var itemEntity = player.drop(item, false);
if (itemEntity != null) {
itemEntity.setNoPickUpDelay();
itemEntity.setOwner(player.getUUID());
itemEntity.setThrower(player.getUUID());
}
}

View File

@@ -1,24 +0,0 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2022. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.mixin.gametest;
import net.minecraft.SharedConstants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
// TODO(1.19.4): Remove this
@Mixin(SharedConstants.class)
class SharedConstantsMixin {
/**
* Disable DFU initialisation.
*
* @author SquidDev
* @reason This doesn't have any impact on gameplay, and slightly speeds up tests.
*/
@Overwrite
public static void enableDataFixerOptimizations() {
}
}

View File

@@ -39,6 +39,7 @@ class MinecraftMixin implements MinecraftExtensions {
private final AtomicBoolean isStable = new AtomicBoolean(false);
@Inject(method = "runTick", at = @At("TAIL"))
@SuppressWarnings("UnusedMethod")
private void updateStable(boolean render, CallbackInfo ci) {
isStable.set(
level != null && player != null &&

View File

@@ -23,6 +23,7 @@ public class WorldOpenFlowsMixin {
* @reason Makes it easier to run tests. We can switch to an @Inject if this becomes a problem.
*/
@Overwrite
@SuppressWarnings("UnusedMethod")
private void askForBackup(Screen screen, String level, boolean customised, Runnable action) {
action.run();
}

View File

@@ -40,7 +40,7 @@ class Recipe_Test {
.getRecipeFor(RecipeType.CRAFTING, container, context.level)
if (!recipe.isPresent) throw GameTestAssertException("No recipe matches")
val result = recipe.get().assemble(container)
val result = recipe.get().assemble(container, context.level.registryAccess())
val owner = CompoundTag()
owner.putString("Name", "dan200")

View File

@@ -6,6 +6,7 @@ import dan200.computercraft.gametest.api.setupForTest
import net.minecraft.client.CloudStatus
import net.minecraft.client.Minecraft
import net.minecraft.client.ParticleStatus
import net.minecraft.client.gui.screens.AccessibilityOnboardingScreen
import net.minecraft.client.gui.screens.Screen
import net.minecraft.client.gui.screens.TitleScreen
import net.minecraft.client.tutorial.TutorialSteps
@@ -49,7 +50,7 @@ object ClientTestHooks {
@JvmStatic
fun onOpenScreen(screen: Screen): Boolean = when {
enabled && !loadedWorld && screen is TitleScreen -> {
enabled && !loadedWorld && (screen is TitleScreen || screen is AccessibilityOnboardingScreen) -> {
loadedWorld = true
openWorld()
true

View File

@@ -11,7 +11,6 @@
"GameTestInfoAccessor",
"GameTestSequenceAccessor",
"GameTestSequenceMixin",
"SharedConstantsMixin",
"TestCommandAccessor"
],
"client": [

View File

@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 7,
"pack_format": 12,
"description": "CC: Test"
}
}