mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-31 09:37:56 +00:00
Update to Minecraft 1.26.1
Still one TODO left, but around data fixers, so fairly small.
- GUI rendering got a big overhaul. I avoided the worst of it with
9272e2efcd
, but things like terminals
and printouts still require some custom rendering.
- Item models are now de-duplicated when rendering in the UI, so we
need to keep track of their identity with
(appendModelidentityElement). I'm not sure I've got this entirely
right — whole thing feels unfortunately error-prone.
- BE serialisation now goes through a Value{Input,Output} class, rather
than using NBT directly. Fairly simple change, but has changed the
format of the GameProfile used in turtle's owners. Need a DFU patch
for this.
This commit is contained in:
@@ -61,6 +61,10 @@ public final class BasicUpgradeModel implements TurtleUpgradeModel {
|
||||
|
||||
@Override
|
||||
public void renderForItem(UpgradeData<ITurtleUpgrade> upgrade, TurtleSide side, ItemStackRenderState renderer, ItemModelResolver resolver, ItemTransform transform, int seed) {
|
||||
renderer.appendModelIdentityElement(this);
|
||||
renderer.appendModelIdentityElement(side);
|
||||
renderer.appendModelIdentityElement(transform);
|
||||
|
||||
var layer = renderer.newLayer();
|
||||
layer.setTransform(transform);
|
||||
getModel(side).setupItemLayer(layer);
|
||||
|
@@ -26,8 +26,11 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import org.joml.Matrix4f;
|
||||
import org.joml.Vector3f;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* A sic {@link TurtleUpgradeModel} that renders the upgrade's {@linkplain ITurtleUpgrade#getUpgradeItem(DataComponentPatch)
|
||||
* upgrade item}.
|
||||
@@ -59,9 +62,14 @@ public final class ItemUpgradeModel implements TurtleUpgradeModel {
|
||||
|
||||
@Override
|
||||
public void renderForItem(UpgradeData<ITurtleUpgrade> upgrade, TurtleSide side, ItemStackRenderState renderer, ItemModelResolver resolver, ItemTransform transform, int seed) {
|
||||
renderer.appendModelIdentityElement(this);
|
||||
|
||||
var childState = new ItemStackRenderState();
|
||||
resolver.updateForTopItem(childState, upgrade.getUpgradeItem(), ItemDisplayContext.NONE, null, null, seed);
|
||||
if (!childState.isEmpty()) {
|
||||
renderer.appendModelIdentityElement(childState.getModelIdentity());
|
||||
renderer.appendModelIdentityElement(transform);
|
||||
|
||||
var layer = renderer.newLayer();
|
||||
layer.setTransform(transform);
|
||||
layer.setupSpecialModel(getRenderer(side), childState);
|
||||
@@ -122,6 +130,10 @@ public final class ItemUpgradeModel implements TurtleUpgradeModel {
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getExtents(Set<Vector3f> set) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable ItemStackRenderState extractArgument(ItemStack itemStack) {
|
||||
return null;
|
||||
|
@@ -57,6 +57,9 @@ public interface TurtleUpgradeModel {
|
||||
|
||||
/**
|
||||
* Render this upgrade to an {@link ItemStackRenderState}. This is used for rendering the item form of the upgrade.
|
||||
* <p>
|
||||
* Like with {@link ItemModel}, implementations must be careful to call {@link ItemStackRenderState#appendModelIdentityElement}
|
||||
* where appropriate.
|
||||
*
|
||||
* @param upgrade The upgrade being rendered.
|
||||
* @param side Which side of the turtle (left or right) the upgrade is equipped on.
|
||||
|
Reference in New Issue
Block a user