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

Update to 1.20

- Use GuiGraphics for rendering UI elements. Almost definitely some
   z-fighting issues slipped in here.

 - Use Forge's loot modifier system for handling treasure disks. I have
   mixed feelings about this - it's a nice system, but also is far less
   efficient than the previous approach.

 - Regenerate data. This is the brunt of the commit, but nothing
   especially interesting here.
This commit is contained in:
Jonathan Coates
2023-06-08 09:48:37 +01:00
parent ef19988c37
commit ff1e5f6823
218 changed files with 742 additions and 476 deletions

View File

@@ -130,7 +130,9 @@ public class Exporter {
dump.itemNames.put(location.toString(), stack.getHoverName().getString());
renderer.captureRender(itemDir.resolve(location.getNamespace()).resolve(location.getPath() + ".png"),
() -> Minecraft.getInstance().getItemRenderer().renderAndDecorateFakeItem(transform, stack, 0, 0)
() -> {
// TODO: Minecraft.getInstance().getItemRenderer().ren(transform, stack, 0, 0)
}
);
}
renderer.clearState();

View File

@@ -7,6 +7,7 @@ package dan200.computercraft.export;
import com.mojang.blaze3d.pipeline.TextureTarget;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.VertexSorting;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.FogRenderer;
import org.joml.Matrix4f;
@@ -36,7 +37,7 @@ public class ImageRenderer implements AutoCloseable {
public void setupState() {
projectionMatrix = RenderSystem.getProjectionMatrix();
RenderSystem.setProjectionMatrix(new Matrix4f().identity().ortho(0, 16, 0, 16, 1000, 3000));
RenderSystem.setProjectionMatrix(new Matrix4f().identity().ortho(0, 16, 0, 16, 1000, 3000), VertexSorting.DISTANCE_TO_ORIGIN);
var transform = RenderSystem.getModelViewStack();
transform.pushPose();
@@ -48,7 +49,7 @@ public class ImageRenderer implements AutoCloseable {
public void clearState() {
if (projectionMatrix == null) throw new IllegalStateException("Not currently rendering");
RenderSystem.setProjectionMatrix(projectionMatrix);
RenderSystem.setProjectionMatrix(projectionMatrix, VertexSorting.DISTANCE_TO_ORIGIN);
RenderSystem.getModelViewStack().popPose();
}

View File

@@ -58,36 +58,36 @@ class CCTestCommand {
.then(literal("marker").executes(context -> {
var player = context.getSource().getPlayerOrException();
var pos = StructureUtils.findNearestStructureBlock(player.blockPosition(), 15, player.getLevel());
var pos = StructureUtils.findNearestStructureBlock(player.blockPosition(), 15, player.serverLevel());
if (pos == null) return error(context.getSource(), "No nearby test");
var structureBlock = (StructureBlockEntity) player.getLevel().getBlockEntity(pos);
var structureBlock = (StructureBlockEntity) player.level().getBlockEntity(pos);
if (structureBlock == null) return error(context.getSource(), "No nearby structure block");
var info = GameTestRegistry.getTestFunction(structureBlock.getStructurePath());
// Kill the existing armor stand
player
.getLevel().getEntities(EntityType.ARMOR_STAND, x -> x.isAlive() && x.getName().getString().equals(info.getTestName()))
.serverLevel().getEntities(EntityType.ARMOR_STAND, x -> x.isAlive() && x.getName().getString().equals(info.getTestName()))
.forEach(Entity::kill);
// And create a new one
var nbt = new CompoundTag();
nbt.putBoolean("Marker", true);
nbt.putBoolean("Invisible", true);
var armorStand = assertNonNull(EntityType.ARMOR_STAND.create(player.getLevel()));
var armorStand = assertNonNull(EntityType.ARMOR_STAND.create(player.level()));
armorStand.readAdditionalSaveData(nbt);
armorStand.copyPosition(player);
armorStand.setCustomName(Component.literal(info.getTestName()));
player.getLevel().addFreshEntity(armorStand);
player.level().addFreshEntity(armorStand);
return 0;
}))
.then(literal("give-computer").executes(context -> {
var player = context.getSource().getPlayerOrException();
var pos = StructureUtils.findNearestStructureBlock(player.blockPosition(), 15, player.getLevel());
var pos = StructureUtils.findNearestStructureBlock(player.blockPosition(), 15, player.serverLevel());
if (pos == null) return error(context.getSource(), "No nearby test");
var structureBlock = (StructureBlockEntity) player.getLevel().getBlockEntity(pos);
var structureBlock = (StructureBlockEntity) player.level().getBlockEntity(pos);
if (structureBlock == null) return error(context.getSource(), "No nearby structure block");
var info = GameTestRegistry.getTestFunction(structureBlock.getStructurePath());

View File

@@ -13,8 +13,8 @@ import net.minecraft.gametest.framework.GameTestHelper
import net.minecraft.nbt.CompoundTag
import net.minecraft.world.entity.player.Player
import net.minecraft.world.inventory.AbstractContainerMenu
import net.minecraft.world.inventory.CraftingContainer
import net.minecraft.world.inventory.MenuType
import net.minecraft.world.inventory.TransientCraftingContainer
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.CraftingRecipe
@@ -31,7 +31,7 @@ class Recipe_Test {
@GameTest(template = Structures.DEFAULT)
fun Craft_result_has_nbt(context: GameTestHelper) = context.sequence {
thenExecute {
val container = CraftingContainer(DummyMenu, 3, 3)
val container = TransientCraftingContainer(DummyMenu, 3, 3)
container.setItem(0, ItemStack(Items.SKELETON_SKULL))
container.setItem(1, ItemStack(ModRegistry.Items.COMPUTER_ADVANCED.get()))

View File

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