mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 07:27:15 +01:00
Merge remote-tracking branch 'origin/mc1.18/dev' into mc1.18/dev
This commit is contained in:
commit
398eb64880
21 changed files with 154 additions and 52 deletions
|
@ -3329,7 +3329,7 @@ c2b075008849e152f20e8da946e89c9722325df6 data/create/loot_tables/blocks/content_
|
|||
69b4b25d7d271458177fbbaeba2c797daccc38a2 data/create/loot_tables/blocks/contraption_controls.json
|
||||
28856dc862efc6bcc421d035d26386740458f868 data/create/loot_tables/blocks/controller_rail.json
|
||||
2c2785e39e1891dff2c50cba93e814b56d935154 data/create/loot_tables/blocks/controls.json
|
||||
3abf04f6132955275ad490668cd28f481afb4ec2 data/create/loot_tables/blocks/copper_backtank.json
|
||||
830949a5dc64982392db2c1f651d2a9d0ff659a8 data/create/loot_tables/blocks/copper_backtank.json
|
||||
6697e619d5c6dcb81aad4f5c88ba319d13665b35 data/create/loot_tables/blocks/copper_bars.json
|
||||
8010db6b2427536c74312c85425b3ba83abc363c data/create/loot_tables/blocks/copper_casing.json
|
||||
ea5fb942c8dfb792daac538e09d286ac120aa199 data/create/loot_tables/blocks/copper_door.json
|
||||
|
@ -3590,7 +3590,7 @@ afdff197c9d1a6940e988c00435135f9705fd0e5 data/create/loot_tables/blocks/metal_gi
|
|||
b83a90fbe83906b171fc0de6bdc2d9aa3a8c542e data/create/loot_tables/blocks/millstone.json
|
||||
5c1df8443043b3fe3b665dba348e2ff188bcbe31 data/create/loot_tables/blocks/minecart_anchor.json
|
||||
1e73d28fdd2e54910074aeadbe5617425a8ae656 data/create/loot_tables/blocks/mysterious_cuckoo_clock.json
|
||||
a5fa8fdc10efe534e5c7d8bdb687f226b39f63ef data/create/loot_tables/blocks/netherite_backtank.json
|
||||
9be92bab82bc1e83533f1d4679b09bd0513b07eb data/create/loot_tables/blocks/netherite_backtank.json
|
||||
2e21a06c0d671e543bffecb0b67d97b51fa83ddc data/create/loot_tables/blocks/nixie_tube.json
|
||||
f6b4095a518a01081f3663d7268d67063bdb44ee data/create/loot_tables/blocks/nozzle.json
|
||||
d378be8f13fc7ed625813eae3a50b68e8706a297 data/create/loot_tables/blocks/oak_window.json
|
||||
|
@ -5012,7 +5012,7 @@ e6aa8895186358e9d069f5a99909132be49f3bf1 data/create/recipes/diorite_from_stone_
|
|||
a90268d38f976327ff5e1b87ff1d72ca2d1ebad6 data/create/recipes/dripstone_block_from_stone_types_dripstone_stonecutting.json
|
||||
27d9bf05a610447e90314e658dbbcd191f378fc9 data/create/recipes/dripstone_pillar_from_stone_types_dripstone_stonecutting.json
|
||||
d81ceba2946286d374801e698a4ca2116395cbad data/create/recipes/emptying/builders_tea.json
|
||||
318ab703224ff1d6f7200675e1e0a4c138b28456 data/create/recipes/emptying/compat/alexsmobs/lava_bottle.json
|
||||
d62f4682fe6cc61df5a1c0231a2004a4ee78a329 data/create/recipes/emptying/compat/alexsmobs/lava_bottle.json
|
||||
c26d003e921720308c05ad7b9f3cb57de94a10a8 data/create/recipes/emptying/compat/farmersdelight/milk_bottle.json
|
||||
60c0edfb5b759e4f13427b631861f503f8552923 data/create/recipes/emptying/compat/neapolitan/milk_bottle.json
|
||||
20b7c7c62fa2e33199e08188dd8836844a6d9cfd data/create/recipes/emptying/honey_bottle.json
|
||||
|
|
|
@ -8,6 +8,17 @@
|
|||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"function": "minecraft:copy_nbt",
|
||||
"source": "block_entity",
|
||||
"ops": [
|
||||
{
|
||||
"source": "FullNBT",
|
||||
"target": "{}",
|
||||
"op": "merge"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "minecraft:copy_name",
|
||||
"source": "block_entity"
|
||||
|
|
|
@ -8,6 +8,17 @@
|
|||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"function": "minecraft:copy_nbt",
|
||||
"source": "block_entity",
|
||||
"ops": [
|
||||
{
|
||||
"source": "FullNBT",
|
||||
"target": "{}",
|
||||
"op": "merge"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"function": "minecraft:copy_name",
|
||||
"source": "block_entity"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
],
|
||||
"conditions": [
|
||||
{
|
||||
"modid": "atmospheric",
|
||||
"modid": "alexsmobs",
|
||||
"type": "forge:mod_loaded"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -3,12 +3,14 @@ package com.simibubi.create.content.decoration.encasing;
|
|||
import java.util.List;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
|
@ -31,9 +33,16 @@ public interface EncasableBlock {
|
|||
return InteractionResult.SUCCESS;
|
||||
|
||||
encased.handleEncasing(state, level, pos, heldItem, player, hand, ray);
|
||||
playEncaseSound(level, pos);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
default void playEncaseSound(Level level, BlockPos pos) {
|
||||
BlockState newState = level.getBlockState(pos);
|
||||
SoundType soundType = newState.getSoundType();
|
||||
level.playSound(null, pos, soundType.getPlaceSound(), SoundSource.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
|||
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -33,8 +34,8 @@ public class PlacardRenderer extends SafeBlockEntityRenderer<PlacardBlockEntity>
|
|||
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||
.getItemRenderer();
|
||||
boolean blockItem = itemRenderer.getModel(heldItem, null, null, 0)
|
||||
.isGui3d();
|
||||
BakedModel bakedModel = itemRenderer.getModel(heldItem, null, null, 0);
|
||||
boolean blockItem = bakedModel.isGui3d();
|
||||
|
||||
ms.pushPose();
|
||||
TransformStack.cast(ms)
|
||||
|
@ -46,7 +47,7 @@ public class PlacardRenderer extends SafeBlockEntityRenderer<PlacardBlockEntity>
|
|||
.translate(0, 0, 4.5 / 16f)
|
||||
.scale(blockItem ? .5f : .375f);
|
||||
|
||||
itemRenderer.renderStatic(heldItem, TransformType.FIXED, light, overlay, ms, buffer, 0);
|
||||
itemRenderer.render(heldItem, TransformType.FIXED, false, ms, buffer, light, overlay, bakedModel);
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class BacktankBlock extends HorizontalKineticBlock
|
|||
@Override
|
||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState,
|
||||
LevelAccessor world, BlockPos pos, BlockPos neighbourPos) {
|
||||
if (state.getValue(BlockStateProperties.WATERLOGGED))
|
||||
if (state.getValue(BlockStateProperties.WATERLOGGED))
|
||||
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
|
||||
return state;
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ public class BacktankBlock extends HorizontalKineticBlock
|
|||
be.setEnchantmentTag(stack.getEnchantmentTags());
|
||||
if (stack.hasCustomHoverName())
|
||||
be.setCustomName(stack.getHoverName());
|
||||
be.setFullNbt(stack.getOrCreateTag());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -157,9 +158,10 @@ public class BacktankBlock extends HorizontalKineticBlock
|
|||
ItemStack stack = new ItemStack(item);
|
||||
Optional<BacktankBlockEntity> blockEntityOptional = getBlockEntityOptional(blockGetter, pos);
|
||||
|
||||
CompoundTag tag = blockEntityOptional.map(BacktankBlockEntity::getFullNbt).orElse(stack.getOrCreateTag());
|
||||
|
||||
int air = blockEntityOptional.map(BacktankBlockEntity::getAirLevel)
|
||||
.orElse(0);
|
||||
CompoundTag tag = stack.getOrCreateTag();
|
||||
tag.putInt("Air", air);
|
||||
|
||||
ListTag enchants = blockEntityOptional.map(BacktankBlockEntity::getEnchantmentTag)
|
||||
|
@ -174,6 +176,7 @@ public class BacktankBlock extends HorizontalKineticBlock
|
|||
.orElse(null);
|
||||
if (customName != null)
|
||||
stack.setHoverName(customName);
|
||||
stack.setTag(tag);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -187,7 +190,7 @@ public class BacktankBlock extends HorizontalKineticBlock
|
|||
public Class<BacktankBlockEntity> getBlockEntityClass() {
|
||||
return BacktankBlockEntity.class;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends BacktankBlockEntity> getBlockEntityType() {
|
||||
return AllBlockEntityTypes.BACKTANK.get();
|
||||
|
|
|
@ -37,10 +37,13 @@ public class BacktankBlockEntity extends KineticBlockEntity implements Nameable
|
|||
private int capacityEnchantLevel;
|
||||
private ListTag enchantmentTag;
|
||||
|
||||
private CompoundTag fullNbt;
|
||||
|
||||
public BacktankBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
defaultName = getDefaultName(state);
|
||||
enchantmentTag = new ListTag();
|
||||
fullNbt = new CompoundTag();
|
||||
}
|
||||
|
||||
public static Component getDefaultName(BlockState state) {
|
||||
|
@ -118,6 +121,7 @@ public class BacktankBlockEntity extends KineticBlockEntity implements Nameable
|
|||
if (this.customName != null)
|
||||
compound.putString("CustomName", Component.Serializer.toJson(this.customName));
|
||||
compound.put("Enchantments", enchantmentTag);
|
||||
compound.put("FullNBT", fullNbt);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -128,6 +132,7 @@ public class BacktankBlockEntity extends KineticBlockEntity implements Nameable
|
|||
airLevel = compound.getInt("Air");
|
||||
airLevelTimer = compound.getInt("Timer");
|
||||
enchantmentTag = compound.getList("Enchantments", Tag.TAG_COMPOUND);
|
||||
this.fullNbt = compound.getCompound("FullNBT");
|
||||
if (compound.contains("CustomName", 8))
|
||||
this.customName = Component.Serializer.fromJson(compound.getString("CustomName"));
|
||||
if (prev != 0 && prev != airLevel && airLevel == BacktankUtil.maxAir(capacityEnchantLevel) && clientPacket)
|
||||
|
@ -182,4 +187,14 @@ public class BacktankBlockEntity extends KineticBlockEntity implements Nameable
|
|||
this.capacityEnchantLevel = capacityEnchantLevel;
|
||||
}
|
||||
|
||||
public CompoundTag getFullNbt()
|
||||
{
|
||||
return fullNbt;
|
||||
}
|
||||
|
||||
public void setFullNbt(CompoundTag fullNbt)
|
||||
{
|
||||
this.fullNbt = fullNbt;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
|||
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -78,8 +79,8 @@ public class ItemDrainRenderer extends SmartBlockEntityRenderer<ItemDrainBlockEn
|
|||
.getItemRenderer();
|
||||
int count = (int) (Mth.log2((int) (itemStack.getCount()))) / 2;
|
||||
boolean renderUpright = BeltHelper.isItemUpright(itemStack);
|
||||
boolean blockItem = itemRenderer.getModel(itemStack, null, null, 0)
|
||||
.isGui3d();
|
||||
BakedModel bakedModel = itemRenderer.getModel(itemStack, null, null, 0);
|
||||
boolean blockItem = bakedModel.isGui3d();
|
||||
|
||||
if (renderUpright)
|
||||
ms.translate(0, 3 / 32d, 0);
|
||||
|
@ -117,7 +118,7 @@ public class ItemDrainRenderer extends SmartBlockEntityRenderer<ItemDrainBlockEn
|
|||
ms.scale(.5f, .5f, .5f);
|
||||
if (!blockItem && !renderUpright)
|
||||
msr.rotateX(90);
|
||||
itemRenderer.renderStatic(itemStack, TransformType.FIXED, light, overlay, ms, buffer, 0);
|
||||
itemRenderer.render(itemStack, TransformType.FIXED, false, ms, buffer, light, overlay, bakedModel);
|
||||
ms.popPose();
|
||||
|
||||
if (!renderUpright) {
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.Direction.AxisDirection;
|
||||
|
@ -194,14 +195,12 @@ public class BeltRenderer extends SafeBlockEntityRenderer<BeltBlockEntity> {
|
|||
boolean slopeAlongX = beltFacing
|
||||
.getAxis() == Axis.X;
|
||||
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
ItemRenderer itemRenderer = mc.getItemRenderer();
|
||||
boolean onContraption = be.getLevel() instanceof WrappedWorld;
|
||||
|
||||
for (TransportedItemStack transported : be.getInventory()
|
||||
.getTransportedItems()) {
|
||||
ms.pushPose();
|
||||
TransformStack.cast(ms)
|
||||
.nudge(transported.angle);
|
||||
|
||||
float offset;
|
||||
float sideOffset;
|
||||
float verticalMovement;
|
||||
|
@ -228,6 +227,18 @@ public class BeltRenderer extends SafeBlockEntityRenderer<BeltBlockEntity> {
|
|||
.getAxis() == Axis.Z);
|
||||
float slopeAngle = onSlope ? tiltForward ? -45 : 45 : 0;
|
||||
|
||||
Vec3 itemPos = beltStartOffset.add(
|
||||
be.getBlockPos().getX(),
|
||||
be.getBlockPos().getY(),
|
||||
be.getBlockPos().getZ())
|
||||
.add(offsetVec);
|
||||
|
||||
if (this.shouldCullItem(itemPos)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ms.pushPose();
|
||||
TransformStack.cast(ms).nudge(transported.angle);
|
||||
ms.translate(offsetVec.x, offsetVec.y, offsetVec.z);
|
||||
|
||||
boolean alongX = beltFacing
|
||||
|
@ -238,12 +249,15 @@ public class BeltRenderer extends SafeBlockEntityRenderer<BeltBlockEntity> {
|
|||
ms.translate(alongX ? sideOffset : 0, 0, alongX ? 0 : sideOffset);
|
||||
|
||||
int stackLight = onContraption ? light : getPackedLight(be, offset);
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||
.getItemRenderer();
|
||||
|
||||
boolean renderUpright = BeltHelper.isItemUpright(transported.stack);
|
||||
boolean blockItem = itemRenderer.getModel(transported.stack, be.getLevel(), null, 0)
|
||||
.isGui3d();
|
||||
int count = (int) (Mth.log2((int) (transported.stack.getCount()))) / 2;
|
||||
BakedModel bakedModel = itemRenderer.getModel(transported.stack, be.getLevel(), null, 0);
|
||||
boolean blockItem = bakedModel.isGui3d();
|
||||
|
||||
int count = 0;
|
||||
if (mc.player.getEyePosition(1.0F).distanceTo(itemPos) < 16)
|
||||
count = (int) (Mth.log2((int) (transported.stack.getCount()))) / 2;
|
||||
|
||||
Random r = new Random(transported.angle);
|
||||
|
||||
boolean slopeShadowOnly = renderUpright && onSlope;
|
||||
|
@ -264,7 +278,7 @@ public class BeltRenderer extends SafeBlockEntityRenderer<BeltBlockEntity> {
|
|||
}
|
||||
|
||||
if (renderUpright) {
|
||||
Entity renderViewEntity = Minecraft.getInstance().cameraEntity;
|
||||
Entity renderViewEntity = mc.cameraEntity;
|
||||
if (renderViewEntity != null) {
|
||||
Vec3 positionVec = renderViewEntity.position();
|
||||
Vec3 vectorForOffset = BeltHelper.getVectorForOffset(be, offset);
|
||||
|
@ -289,7 +303,7 @@ public class BeltRenderer extends SafeBlockEntityRenderer<BeltBlockEntity> {
|
|||
}
|
||||
|
||||
ms.scale(.5f, .5f, .5f);
|
||||
itemRenderer.renderStatic(null, transported.stack, TransformType.FIXED, false, ms, buffer, be.getLevel(), stackLight, overlay, 0);
|
||||
itemRenderer.render(transported.stack, TransformType.FIXED, false, ms, buffer, stackLight, overlay, bakedModel);
|
||||
ms.popPose();
|
||||
|
||||
if (!renderUpright) {
|
||||
|
|
|
@ -378,6 +378,8 @@ public class BeltInventory {
|
|||
float min = offset;
|
||||
float max = offset + 1;
|
||||
for (TransportedItemStack stack : items) {
|
||||
if (toRemove.contains(stack))
|
||||
continue;
|
||||
if (stack.beltPosition > max)
|
||||
continue;
|
||||
if (stack.beltPosition > min)
|
||||
|
|
|
@ -50,13 +50,15 @@ public class ItemHandlerBeltSegment implements IItemHandler {
|
|||
return ItemStack.EMPTY;
|
||||
|
||||
amount = Math.min(amount, transported.stack.getCount());
|
||||
ItemStack extracted = simulate ? transported.stack.copy().split(amount) : transported.stack.split(amount);
|
||||
ItemStack extracted = simulate ? transported.stack.copy()
|
||||
.split(amount) : transported.stack.split(amount);
|
||||
if (!simulate) {
|
||||
if (transported.stack.isEmpty())
|
||||
this.beltInventory.toRemove.add(transported);
|
||||
this.beltInventory.belt.setChanged();
|
||||
this.beltInventory.belt.sendData();
|
||||
beltInventory.toRemove.add(transported);
|
||||
else
|
||||
beltInventory.belt.notifyUpdate();
|
||||
}
|
||||
|
||||
return extracted;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
|
@ -89,9 +90,8 @@ public class DeployerRenderer extends SafeBlockEntityRenderer<DeployerBlockEntit
|
|||
.getItemRenderer();
|
||||
|
||||
TransformType transform = TransformType.NONE;
|
||||
boolean isBlockItem = (be.heldItem.getItem() instanceof BlockItem)
|
||||
&& itemRenderer.getModel(be.heldItem, be.getLevel(), null, 0)
|
||||
.isGui3d();
|
||||
BakedModel bakedModel = itemRenderer.getModel(be.heldItem, be.getLevel(), null, 0);
|
||||
boolean isBlockItem = (be.heldItem.getItem() instanceof BlockItem) && bakedModel.isGui3d();
|
||||
|
||||
if (displayMode) {
|
||||
float scale = isBlockItem ? 1.25f : 1;
|
||||
|
@ -106,7 +106,7 @@ public class DeployerRenderer extends SafeBlockEntityRenderer<DeployerBlockEntit
|
|||
transform = punching ? TransformType.THIRD_PERSON_RIGHT_HAND : TransformType.FIXED;
|
||||
}
|
||||
|
||||
itemRenderer.renderStatic(be.heldItem, transform, light, overlay, ms, buffer, 0);
|
||||
itemRenderer.render(be.heldItem, transform, false, ms, buffer, light, overlay, bakedModel);
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -45,9 +46,8 @@ public class ArmRenderer extends KineticBlockEntityRenderer<ArmBlockEntity> {
|
|||
ItemRenderer itemRenderer = Minecraft.getInstance()
|
||||
.getItemRenderer();
|
||||
|
||||
boolean isBlockItem =
|
||||
hasItem && (item.getItem() instanceof BlockItem) && itemRenderer.getModel(item, be.getLevel(), null, 0)
|
||||
.isGui3d();
|
||||
BakedModel bakedModel = itemRenderer.getModel(item, be.getLevel(), null, 0);
|
||||
boolean isBlockItem = hasItem && (item.getItem() instanceof BlockItem) && bakedModel.isGui3d();
|
||||
|
||||
VertexConsumer builder = buffer.getBuffer(be.goggles ? RenderType.cutout() : RenderType.solid());
|
||||
BlockState blockState = be.getBlockState();
|
||||
|
@ -102,7 +102,7 @@ public class ArmRenderer extends KineticBlockEntityRenderer<ArmBlockEntity> {
|
|||
.multiply(msLocal.last()
|
||||
.pose());
|
||||
|
||||
itemRenderer.renderStatic(item, TransformType.FIXED, light, overlay, ms, buffer, 0);
|
||||
itemRenderer.render(item, TransformType.FIXED, false, ms, buffer, light, overlay, bakedModel);
|
||||
ms.popPose();
|
||||
}
|
||||
|
||||
|
@ -141,13 +141,13 @@ public class ArmRenderer extends KineticBlockEntityRenderer<ArmBlockEntity> {
|
|||
.renderInto(ms, builder);
|
||||
|
||||
transformHead(msr, headAngle);
|
||||
|
||||
|
||||
if (inverted)
|
||||
msr.rotateZ(180);
|
||||
|
||||
|
||||
claw.transform(msLocal)
|
||||
.renderInto(ms, builder);
|
||||
|
||||
|
||||
if (inverted)
|
||||
msr.rotateZ(180);
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public class SawRenderer extends SafeBlockEntityRenderer<SawBlockEntity> {
|
|||
if (alongZ)
|
||||
ms.mulPose(Vector3f.YP.rotationDegrees(90));
|
||||
ms.mulPose(Vector3f.XP.rotationDegrees(90));
|
||||
itemRenderer.renderStatic(stack, ItemTransforms.TransformType.FIXED, light, overlay, ms, buffer, 0);
|
||||
itemRenderer.render(stack, ItemTransforms.TransformType.FIXED, false, ms, buffer, light, overlay, modelWithOverrides);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.client.renderer.MultiBufferSource;
|
|||
import net.minecraft.client.renderer.block.model.ItemTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.ItemRenderer;
|
||||
import net.minecraft.client.resources.model.BakedModel;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
@ -104,8 +105,8 @@ public class DepotRenderer extends SafeBlockEntityRenderer<DepotBlockEntity> {
|
|||
TransformStack msr = TransformStack.cast(ms);
|
||||
int count = (int) (Mth.log2((int) (itemStack.getCount()))) / 2;
|
||||
boolean renderUpright = BeltHelper.isItemUpright(itemStack);
|
||||
boolean blockItem = itemRenderer.getModel(itemStack, null, null, 0)
|
||||
.isGui3d();
|
||||
BakedModel bakedModel = itemRenderer.getModel(itemStack, null, null, 0);
|
||||
boolean blockItem = bakedModel.isGui3d();
|
||||
|
||||
ms.pushPose();
|
||||
msr.rotateY(angle);
|
||||
|
@ -131,7 +132,7 @@ public class DepotRenderer extends SafeBlockEntityRenderer<DepotBlockEntity> {
|
|||
ms.translate(0, -3 / 16f, 0);
|
||||
msr.rotateX(90);
|
||||
}
|
||||
itemRenderer.renderStatic(itemStack, TransformType.FIXED, light, overlay, ms, buffer, 0);
|
||||
itemRenderer.render(itemStack, TransformType.FIXED, false, ms, buffer, light, overlay, bakedModel);
|
||||
ms.popPose();
|
||||
|
||||
if (!renderUpright) {
|
||||
|
|
|
@ -2,10 +2,14 @@ package com.simibubi.create.foundation.blockEntity.renderer;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.culling.Frustum;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public abstract class SafeBlockEntityRenderer<T extends BlockEntity> implements BlockEntityRenderer<T> {
|
||||
@Override
|
||||
|
@ -23,4 +27,21 @@ public abstract class SafeBlockEntityRenderer<T extends BlockEntity> implements
|
|||
return !be.hasLevel() || be.getBlockState()
|
||||
.getBlock() == Blocks.AIR;
|
||||
}
|
||||
|
||||
public boolean shouldCullItem(Vec3 itemPos) {
|
||||
Frustum frustum = Minecraft.getInstance().levelRenderer.capturedFrustum != null ?
|
||||
Minecraft.getInstance().levelRenderer.capturedFrustum :
|
||||
Minecraft.getInstance().levelRenderer.cullingFrustum;
|
||||
|
||||
AABB itemBB = new AABB(
|
||||
itemPos.x - 0.25,
|
||||
itemPos.y - 0.25,
|
||||
itemPos.z - 0.25,
|
||||
itemPos.x + 0.25,
|
||||
itemPos.y + 0.25,
|
||||
itemPos.z + 0.25
|
||||
);
|
||||
|
||||
return !frustum.isVisible(itemBB);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -435,6 +435,8 @@ public class BuilderTransformers {
|
|||
.when(survivesExplosion)
|
||||
.setRolls(ConstantValue.exactly(1))
|
||||
.add(LootItem.lootTableItem(drop.get())
|
||||
.apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY)
|
||||
.copy("FullNBT", "{}", CopyNbtFunction.MergeStrategy.MERGE))
|
||||
.apply(CopyNameFunction.copyName(CopyNameFunction.NameSource.BLOCK_ENTITY))
|
||||
.apply(CopyNbtFunction.copyData(ContextNbtProvider.BLOCK_ENTITY)
|
||||
.copy("Air", "Air"))
|
||||
|
|
|
@ -49,6 +49,14 @@ public class FluidHelper {
|
|||
public static boolean isLava(Fluid fluid) {
|
||||
return convertToStill(fluid) == Fluids.LAVA;
|
||||
}
|
||||
|
||||
public static boolean isSame(FluidStack fluidStack, FluidStack fluidStack2) {
|
||||
return fluidStack.getFluid() == fluidStack2.getFluid();
|
||||
}
|
||||
|
||||
public static boolean isSame(FluidStack fluidStack, Fluid fluid) {
|
||||
return fluidStack.getFluid() == fluid;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static boolean isTag(Fluid fluid, TagKey<Fluid> tag) {
|
||||
|
|
|
@ -152,7 +152,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
|
||||
@Override
|
||||
protected boolean testInternal(FluidStack t) {
|
||||
if (t.getFluid() != fluid)
|
||||
if (!FluidHelper.isSame(t, fluid))
|
||||
return false;
|
||||
if (tagToMatch.isEmpty())
|
||||
return true;
|
||||
|
@ -200,16 +200,14 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
|
|||
|
||||
protected TagKey<Fluid> tag;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected boolean testInternal(FluidStack t) {
|
||||
if (tag == null) {
|
||||
for (FluidStack accepted : getMatchingFluidStacks())
|
||||
if (accepted.getFluid() != t.getFluid())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
return t.getFluid().is(tag);
|
||||
if (tag != null)
|
||||
return FluidHelper.isTag(t, tag);
|
||||
for (FluidStack accepted : getMatchingFluidStacks())
|
||||
if (FluidHelper.isSame(accepted, t))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,3 +42,6 @@ public net.minecraft.client.model.AgeableListModel f_102012_ # bodyYOffset
|
|||
|
||||
public net.minecraft.client.gui.components.CommandSuggestions f_93866_ # suggestions
|
||||
public net.minecraft.client.gui.components.CommandSuggestions$SuggestionsList <init>(Lnet/minecraft/client/gui/components/CommandSuggestions;IIILjava/util/List;Z)V # <init>
|
||||
|
||||
public net.minecraft.client.renderer.LevelRenderer f_172938_ # cullingFrustum
|
||||
public net.minecraft.client.renderer.LevelRenderer f_109442_ # capturedFrustum
|
||||
|
|
Loading…
Reference in a new issue