Skip to content

Commit

Permalink
Make it work with 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sakura-ryoko committed Dec 30, 2024
1 parent 5c19c50 commit e1c5edc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.*;
import net.minecraft.client.util.Handle;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.util.profiler.Profilers;

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/fi/dy/masa/malilib/interfaces/IRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
import java.util.function.Supplier;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.Fog;
import net.minecraft.client.render.Frustum;
import net.minecraft.util.profiler.Profiler;
import org.joml.Matrix4f;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.profiler.Profiler;

public interface IRenderer
{
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/fi/dy/masa/malilib/render/InventoryOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

Expand All @@ -15,6 +14,7 @@
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
Expand All @@ -28,8 +28,10 @@
import net.minecraft.entity.vehicle.HopperMinecartEntity;
import net.minecraft.inventory.DoubleInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.*;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BundleItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.tooltip.TooltipType;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtList;
Expand All @@ -43,9 +45,10 @@
import fi.dy.masa.malilib.MaLiLibReference;
import fi.dy.masa.malilib.event.RenderEventHandler;
import fi.dy.masa.malilib.gui.GuiBase;
import fi.dy.masa.malilib.mixin.IMixinAbstractHorseEntity;
import fi.dy.masa.malilib.mixin.IMixinPiglinEntity;
import fi.dy.masa.malilib.util.*;
import fi.dy.masa.malilib.util.Constants;
import fi.dy.masa.malilib.util.IEntityOwnedInventory;
import fi.dy.masa.malilib.util.MathUtils;
import fi.dy.masa.malilib.util.WorldUtils;
import fi.dy.masa.malilib.util.game.wrap.GameWrap;
import fi.dy.masa.malilib.util.nbt.NbtBlockUtils;
import fi.dy.masa.malilib.util.nbt.NbtEntityUtils;
Expand Down
27 changes: 26 additions & 1 deletion src/main/java/fi/dy/masa/malilib/test/TestRenderHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.world.World;
import net.minecraft.util.profiler.Profilers;
import net.minecraft.world.World;

import fi.dy.masa.malilib.MaLiLib;
import fi.dy.masa.malilib.MaLiLibConfigs;
Expand Down Expand Up @@ -579,4 +579,29 @@ else if (context.nbt() != null)
InventoryOverlay.renderEquipmentStacks(entityLivingBase, x, y, mc, drawContext);
}
}

@Nullable
public Pair<BlockEntity, NbtCompound> requestBlockEntityAt(World world, BlockPos pos)
{
if (!(world instanceof ServerWorld))
{
Pair<BlockEntity, NbtCompound> pair = TestDataSyncer.getInstance().requestBlockEntity(world, pos);

BlockState state = world.getBlockState(pos);

if (state.getBlock() instanceof ChestBlock)
{
ChestType type = state.get(ChestBlock.CHEST_TYPE);

if (type != ChestType.SINGLE)
{
return TestDataSyncer.getInstance().requestBlockEntity(world, pos.offset(ChestBlock.getFacing(state)));
}
}

return pair;
}

return null;
}
}

0 comments on commit e1c5edc

Please sign in to comment.