修复两处调用报错

This commit is contained in:
Light_Quanta 2025-04-04 04:57:22 +08:00
parent c42f0c18f7
commit b9cff51b28
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
3 changed files with 13 additions and 4 deletions

View file

@ -158,7 +158,14 @@ public class ContainerBlockItem extends BlockItem implements GeoItem {
var data = stack.get(DataComponents.CUSTOM_DATA);
var tag = data != null ? data.copyTag() : new CompoundTag();
tag.put("Entity", entity.serializeNBT(entity.level().registryAccess()));
var entityTag = new CompoundTag();
var encodedId = entity.getEncodeId();
if (encodedId != null) {
entityTag.putString("id", encodedId);
}
entity.saveWithoutId(entityTag);
tag.put("Entity", entityTag);
tag.putString("EntityType", EntityType.getKey(entity.getType()).toString());
BlockItem.setBlockEntityData(stack, ModBlockEntities.CONTAINER.get(), tag);
tag.putBoolean("CanPlacedAboveWater", canPlacedAboveWater);

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.item.armor;
import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.item.CustomRendererArmor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
@ -30,8 +31,8 @@ public class ArmorRendererRegister {
if (this.renderer == null)
this.renderer = armor.getRenderer();
// TODO other params?
this.renderer.prepForRender(livingEntity, itemStack, equipmentSlot, original);
var mc = Minecraft.getInstance();
this.renderer.prepForRender(livingEntity, itemStack, equipmentSlot, original, mc.levelRenderer.renderBuffers.bufferSource(), mc.getTimer().getGameTimeDeltaPartialTick(true), 0, 0, 0, 0);
return this.renderer;
}

View file

@ -3,3 +3,4 @@ public net.minecraft.world.entity.Entity passengers # passengers
public net.minecraft.world.entity.Entity boardingCooldown # boardingCooldown
public net.minecraft.client.player.LocalPlayer handsBusy # handsBusy
public net.minecraft.client.renderer.culling.Frustum matrix # matrix
public net.minecraft.client.renderer.LevelRenderer renderBuffers # renderBuffers