Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support inventory preview on multi player server #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
5c017d3
23w51b-SNAP 0.20.0-snap
sakura-ryoko Dec 22, 2023
fc06971
fix Block/Entity Reach overrides
sakura-ryoko Dec 22, 2023
5e31dd5
1.20.x revert
sakura-ryoko Jan 2, 2024
fe17c34
IntelliJ Changes
sakura-ryoko Jan 2, 2024
19613e1
IntelliJ Changes
sakura-ryoko Jan 3, 2024
a8ef9f5
IntelliJ Changes
sakura-ryoko Jan 3, 2024
b378cdd
IntelliJ Changes
sakura-ryoko Jan 3, 2024
fcc826c
Update Configs.java
sakura-ryoko Jan 3, 2024
642790e
IntelliJ Changes
sakura-ryoko Jan 3, 2024
fca9c40
24w03a - No changes
sakura-ryoko Jan 17, 2024
1faaed7
24w03b - Adds debugLogger() and attempts to replace the deprecated ca…
sakura-ryoko Jan 20, 2024
11d5829
24w03b - Adds debugLogger() and attempts to replace the deprecated ca…
sakura-ryoko Jan 20, 2024
61eaa5b
24w04a - Removed some non-working dev code
sakura-ryoko Jan 29, 2024
d2b96bb
24w04a - gradle 8.6
sakura-ryoko Feb 5, 2024
483d48e
24w05b - half works and runs, but some features are broken due to ren…
sakura-ryoko Feb 7, 2024
6cfcc9a
24w06a - renderer issues nearly fixed. Still need to check visual ro…
sakura-ryoko Feb 8, 2024
b6211d6
24w06a - Matrix4f Renderer methods fixed & fully implemented.
sakura-ryoko Feb 8, 2024
48f9a76
24w06a - merge from 0.19.1 & 0.19.2, elytra swap fix & map preview re…
sakura-ryoko Feb 10, 2024
4e42446
Update gradle.properties
sakura-ryoko Feb 11, 2024
23ee7e2
24w06a - added option to disable Trial Vault particles
sakura-ryoko Feb 11, 2024
d80c681
24w06a - some code cleanups
sakura-ryoko Feb 13, 2024
3f002fe
24w06a - remove lame Trial spawner / vault particle rules and cleaned…
sakura-ryoko Feb 13, 2024
7515d6e
24w07a - some mixin target fixes
sakura-ryoko Feb 14, 2024
14507f6
24w07a - some debug loggers enabled to debug clicking issues for issu…
sakura-ryoko Feb 15, 2024
9a860fc
24w07a - added debuggers for tweakFastBlockPlacement workflow
sakura-ryoko Feb 15, 2024
bd0d509
24w07a - api / loom version bump
sakura-ryoko Feb 23, 2024
5976551
24w09a basic
sakura-ryoko Feb 28, 2024
a6bf4c9
24w09a - mostly works, check the Shulker Box Preview code yet.
sakura-ryoko Feb 29, 2024
969bba3
24w09a -- loom build 5
sakura-ryoko Feb 29, 2024
cb53dec
24w09a - loom build 6
sakura-ryoko Mar 1, 2024
4ed9570
24w09a -- loom build 8
sakura-ryoko Mar 1, 2024
128bf7d
Update gradle.properties
sakura-ryoko Mar 3, 2024
9a1c07a
24w09a - fabric api 0.96.6
sakura-ryoko Mar 3, 2024
3890db9
24w09a - add Bundle Preview
sakura-ryoko Mar 4, 2024
bd9f3d7
24w10a - basic item attribute modifier getValue() -> value() rename
sakura-ryoko Mar 6, 2024
b80f92e
24w10a ghost bug hunting
sakura-ryoko Mar 7, 2024
b7e4f98
24w10a - some cleanups and fixing TWEAK_GAMMA_OVERRIDE correctly this…
sakura-ryoko Mar 8, 2024
6a2e95b
24w10a - ModMenu 10.0.0-alpha.3 update
sakura-ryoko Mar 11, 2024
9b804be
24w10a - fabric 0.96.9 yarn build 8
sakura-ryoko Mar 13, 2024
54ba245
24w11a - yarn build 2
sakura-ryoko Mar 14, 2024
a73be23
24w11a - fabric 0.96.10 and shulker box preview fix
sakura-ryoko Mar 15, 2024
431c1b2
24w11a - chasing ghost bugs for ClickSlot packets -- Not finding any …
sakura-ryoko Mar 15, 2024
0283b3e
24w12a - fix itemStack.getItem().isDamagable() --> not yet working
sakura-ryoko Mar 20, 2024
2bbc193
24w12a - fix itemStack.getItem().isDamagable() ->
sakura-ryoko Mar 20, 2024
d85ca7c
24w12a - loom 1.6, yarn build 3, api 0.96.12
sakura-ryoko Mar 20, 2024
9ae4e4a
24w13a - chat Hud fix
sakura-ryoko Mar 27, 2024
2f70d15
24w13a - yarn build 7, api 0.96.13
sakura-ryoko Mar 29, 2024
19ddb9d
24w13a - add ModMenu parent for malilib
sakura-ryoko Mar 29, 2024
861c1f5
24w13a - update ModMenu Dependency to a custom SNAPSHOT build, becaus…
sakura-ryoko Mar 29, 2024
ffaaa67
24w14a - java 21, shulker box tooltip slight Mixin change
sakura-ryoko Apr 3, 2024
f43fc43
24w14a - some code cleanups
sakura-ryoko Apr 4, 2024
5511eeb
24w14a - some code cleanups
sakura-ryoko Apr 4, 2024
5713d0a
24w14a - Lava visibility math corrections
sakura-ryoko Apr 4, 2024
42f4bd1
24w14a - gradle 8.7, yarn build 6
sakura-ryoko Apr 8, 2024
4a24667
1.20.5-pre1 support -- rename mod_version to 0.20.0-beta.1
sakura-ryoko Apr 10, 2024
3184157
1.20.5-pre.1 - yarn build 4
sakura-ryoko Apr 11, 2024
6908122
1.20.5-pre.1 - yarn build 4
sakura-ryoko Apr 11, 2024
39699dd
merge from UPSTREAM: [QOL] Rehash Angel Block tweak using "floatato t…
sakura-ryoko Apr 11, 2024
11b3813
some import cleanups
sakura-ryoko Apr 11, 2024
8f81bf3
1.20.5-pre1-- code cleanups
sakura-ryoko Apr 12, 2024
9d28184
1.20.5-pre.1 - code cleanups
sakura-ryoko Apr 14, 2024
546f144
1.20.5-pre.1 - code cleanups
sakura-ryoko Apr 14, 2024
7a1f5c3
1.20.5-pre.1 - code cleanups
sakura-ryoko Apr 14, 2024
9d0504c
1.20.5-pre.1 - code cleanups
sakura-ryoko Apr 14, 2024
4ee285e
1.20.5-pre.2 support
sakura-ryoko Apr 15, 2024
780eccb
1.20.5-pre.3 support
sakura-ryoko Apr 17, 2024
d1589be
1.20.5-pre.3 - Update lava visibility values to closer resemble the v…
sakura-ryoko Apr 17, 2024
1b5fb32
1.20.5-pre.3 - Update lava visibility values to closer resemble the v…
sakura-ryoko Apr 17, 2024
8a5eb37
Merge remote-tracking branch 'origin/pre-rewrite/fabric/1.20.5-pre.3'…
sakura-ryoko Apr 17, 2024
4da86cc
1.20.5-pre.4 support
sakura-ryoko Apr 18, 2024
d9c96df
1.20.5-rc1 support
sakura-ryoko Apr 18, 2024
7945e7a
1.20.5-rc1 - code cleanups
sakura-ryoko Apr 19, 2024
025fd21
1.20.5-rc1 - reach distance fix
sakura-ryoko Apr 19, 2024
f97d288
1.20.5-rc1 - reach distance fix
sakura-ryoko Apr 19, 2024
62f75b2
remove Network Reference call
sakura-ryoko Apr 20, 2024
3f867b7
Fix code
sakura-ryoko Apr 21, 2024
5c2ad95
1.20.5-rc.3
sakura-ryoko Apr 23, 2024
b9a321d
code cleanups
sakura-ryoko Apr 23, 2024
9506725
1.20.5-DEV
sakura-ryoko Apr 23, 2024
42f578f
1.20.5-DEV
sakura-ryoko Apr 23, 2024
198a833
merge from PR
sakura-ryoko Apr 23, 2024
241433f
"sakura.1" branding until official release
sakura-ryoko Apr 25, 2024
d259609
"sakura.1" branding until official release
sakura-ryoko Apr 25, 2024
b16b1d3
DISABLE_WORLD_VIEW_BOB Mixin Conflict with Iris, lower priority fixes…
sakura-ryoko Apr 26, 2024
9bfc704
DISABLE_WORLD_VIEW_BOB Mixin Conflict with Iris, lower priority fixes…
sakura-ryoko Apr 27, 2024
89f9303
1.20.6 versioning
sakura-ryoko Apr 30, 2024
3522047
24w18a -- new Item Enchantments Components --> Does not yet compile,…
sakura-ryoko May 3, 2024
4eee15a
fixed enchantment level lookups, build 3, api 0.97.9
sakura-ryoko May 4, 2024
3204f88
fixed enchantment level lookups, build 3, api 0.97.9
sakura-ryoko May 4, 2024
1633808
Update gradle.properties
sakura-ryoko May 10, 2024
ec596b6
version bump
sakura-ryoko May 11, 2024
1b0322c
fix shulker box / item container display.
sakura-ryoko May 11, 2024
67ef211
Update RenderHandler.java
sakura-ryoko May 11, 2024
414fe2e
fix render call, add tickDelta fixes
sakura-ryoko May 16, 2024
d5155da
yarn build 3, waiting on FAPI
sakura-ryoko May 16, 2024
2752951
FAPI / modmenu update
sakura-ryoko May 17, 2024
fb763c5
Update fabric.mod.json
sakura-ryoko May 19, 2024
bcf2529
Upgrade Shulker Box stacking code -- this allows non-modded players a…
sakura-ryoko May 19, 2024
ff4b752
Revert last Commit
sakura-ryoko May 19, 2024
1bc8cff
fix config minorly
sakura-ryoko May 22, 2024
63dc3c3
24w21b - Waiting on FAPI
sakura-ryoko May 22, 2024
5ade0e0
yarn build 3
sakura-ryoko May 23, 2024
537bf83
FAPI update, and testing. All seems to be working.
sakura-ryoko May 23, 2024
491b035
getItemStackFromString check for null
sakura-ryoko May 23, 2024
a210ed5
yard build 4
sakura-ryoko May 23, 2024
5f95412
yarn build 5
sakura-ryoko May 25, 2024
48ac804
yarn build 8
sakura-ryoko May 29, 2024
bde605a
1.21-pre1
sakura-ryoko May 29, 2024
5a80de3
1.21-pre2 --> added tool / weapon swap parameters to check the item '…
sakura-ryoko May 31, 2024
7a45bce
Merge from 1.20.6 for Shulker Boxes not dropping fix
sakura-ryoko Jun 1, 2024
ff91332
Create jitpack.yml
sakura-ryoko Jun 1, 2024
eeac20b
Delete jitpack.yml
sakura-ryoko Jun 2, 2024
15c6b0d
ModMenu update
sakura-ryoko Jun 4, 2024
381489d
1.21-pre3 (Was toying with the Flat Presets code)
sakura-ryoko Jun 5, 2024
1f5b1fe
ItemStack.getMaxCount() fix for mod compatibility if max_stack_size i…
sakura-ryoko Jun 6, 2024
689b9b4
add jitpack
sakura-ryoko Jun 7, 2024
9972ce6
add jitpack
sakura-ryoko Jun 7, 2024
62a6cc6
1.21-pre4
sakura-ryoko Jun 7, 2024
a16c587
Create build.yml
sakura-ryoko Jun 8, 2024
adbc594
1.21-rc1
sakura-ryoko Jun 10, 2024
c604f37
1.21-rc1
sakura-ryoko Jun 11, 2024
644cea3
1.21-rc1
sakura-ryoko Jun 11, 2024
e77fe8b
1.21-rc1
sakura-ryoko Jun 12, 2024
6791c31
resync
sakura-ryoko Jun 12, 2024
e46b02c
1.21
sakura-ryoko Jun 13, 2024
9d4ef83
Disable Experimental Weapon / Tool swapping
sakura-ryoko Jun 14, 2024
6f99528
yarn build 2, modmenu beta2, version # bump
sakura-ryoko Jun 14, 2024
b2c3799
feat: support inventory preview on multi player server
zly2006 Jun 19, 2024
7c29698
fix
zly2006 Jun 19, 2024
61e4d5e
Merge branch 'pre-rewrite/fabric/1.21' into 1.21-sync-server-data
sakura-ryoko Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
package fi.dy.masa.tweakeroo.data;

import com.mojang.datafixers.util.Either;
import fi.dy.masa.tweakeroo.mixin.IMixinDataQueryHandler;
import net.minecraft.block.BlockEntityProvider;
import net.minecraft.block.BlockState;
import net.minecraft.block.ChestBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.block.enums.ChestType;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.DataQueryHandler;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.inventory.DoubleInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.Pair;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.WorldChunk;
import org.jetbrains.annotations.Nullable;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

@SuppressWarnings("deprecation")
public class ServerDataSyncer {
public static ServerDataSyncer INSTANCE;

/**
* key: BlockPos
* value: data, timestamp
*/
private final Map<BlockPos, Pair<BlockEntity, Long>> blockCache = new HashMap<>();
private final Map<Integer, Pair<Entity, Long>> entityCache = new HashMap<>();
private final Map<Integer, Either<BlockPos, Integer>> pendingQueries = new HashMap<>();
private final ClientWorld clientWorld;

public ServerDataSyncer(ClientWorld world) {
this.clientWorld = Objects.requireNonNull(world);
}

private @Nullable BlockEntity getCache(BlockPos pos) {
var data = blockCache.get(pos);
if (data != null && System.currentTimeMillis() - data.getRight() <= 1000) {
if (System.currentTimeMillis() - data.getRight() > 500) {
syncBlockEntity(clientWorld, pos);
}
return data.getLeft();
}

return null;
}

private @Nullable Entity getCache(int networkId) {
var data = entityCache.get(networkId);
if (data != null && System.currentTimeMillis() - data.getRight() <= 1000) {
if (System.currentTimeMillis() - data.getRight() > 500) {
syncEntity(networkId);
}
return data.getLeft();
}

return null;
}

public void handleQueryResponse(int transactionId, NbtCompound nbt) {
if (nbt == null) return;
if (pendingQueries.containsKey(transactionId)) {
Either<BlockPos, Integer> either = pendingQueries.remove(transactionId);
either.ifLeft(pos -> {
if (!clientWorld.isChunkLoaded(pos)) return;
BlockState state = clientWorld.getBlockState(pos);
if (state.getBlock() instanceof BlockEntityProvider provider) {
var be = provider.createBlockEntity(pos, state);
if (be != null) {
be.read(nbt, clientWorld.getRegistryManager());
blockCache.put(pos, new Pair<>(be, System.currentTimeMillis()));
}
}
}).ifRight(id -> {
Entity entity = clientWorld.getEntityById(id).getType().create(clientWorld);
if (entity != null) {
entity.readNbt(nbt);
entityCache.put(id, new Pair<>(entity, System.currentTimeMillis()));
}
});
}
if (blockCache.size() > 30) {
blockCache.entrySet().removeIf(entry -> System.currentTimeMillis() - entry.getValue().getRight() > 1000);
}
if (entityCache.size() > 30) {
entityCache.entrySet().removeIf(entry -> System.currentTimeMillis() - entry.getValue().getRight() > 1000);
}
}

public Inventory getBlockInventory(World world, BlockPos pos) {
if (!world.isChunkLoaded(pos)) return null;
var data = getCache(pos);
if (data instanceof Inventory inv) {
BlockState state = world.getBlockState(pos);
if (state.getBlock() instanceof ChestBlock && data instanceof ChestBlockEntity) {
ChestType type = state.get(ChestBlock.CHEST_TYPE);

if (type != ChestType.SINGLE) {
BlockPos posAdj = pos.offset(ChestBlock.getFacing(state));
if (!world.isChunkLoaded(posAdj)) return null;
BlockState stateAdj = world.getBlockState(posAdj);

var dataAdj = getCache(posAdj);
if (dataAdj == null) {
syncBlockEntity(world, posAdj);
}

if (stateAdj.getBlock() == state.getBlock() &&
dataAdj instanceof ChestBlockEntity inv2 &&
stateAdj.get(ChestBlock.CHEST_TYPE) != ChestType.SINGLE &&
stateAdj.get(ChestBlock.FACING) == state.get(ChestBlock.FACING)) {
Inventory invRight = type == ChestType.RIGHT ? inv : inv2;
Inventory invLeft = type == ChestType.RIGHT ? inv2 : inv;
inv = new DoubleInventory(invRight, invLeft);
}
}
}
return inv;
}

syncBlockEntity(world, pos);
return null;
}

public void syncBlockEntity(World world, BlockPos pos) {
if (MinecraftClient.getInstance().isIntegratedServerRunning()) {
BlockEntity blockEntity = MinecraftClient.getInstance().getServer().getWorld(world.getRegistryKey()).getWorldChunk(pos).getBlockEntity(pos, WorldChunk.CreationType.CHECK);
if (blockEntity != null) {
blockCache.put(pos, new Pair<>(blockEntity, System.currentTimeMillis()));
return;
}
}
Either<BlockPos, Integer> posEither = Either.left(pos);
if (MinecraftClient.getInstance().getNetworkHandler() != null && !pendingQueries.containsValue(posEither)) {
DataQueryHandler handler = MinecraftClient.getInstance().getNetworkHandler().getDataQueryHandler();
handler.queryBlockNbt(pos, it -> {});
pendingQueries.put(((IMixinDataQueryHandler) handler).currentTransactionId(), posEither);
}
}

public void syncEntity(int networkId) {
Either<BlockPos, Integer> idEither = Either.right(networkId);
if (MinecraftClient.getInstance().getNetworkHandler() != null && !pendingQueries.containsValue(idEither)) {
DataQueryHandler handler = MinecraftClient.getInstance().getNetworkHandler().getDataQueryHandler();
handler.queryEntityNbt(networkId, it -> {});
pendingQueries.put(((IMixinDataQueryHandler) handler).currentTransactionId(), idEither);
}
}

public @Nullable Entity getServerEntity(Entity entity) {
Entity serverEntity = getCache(entity.getId());
if (serverEntity == null) {
syncEntity(entity.getId());
return null;
}
return serverEntity;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package fi.dy.masa.tweakeroo.mixin;

import net.minecraft.client.network.DataQueryHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(DataQueryHandler.class)
public interface IMixinDataQueryHandler {
@Accessor("expectedTransactionId")
int currentTransactionId();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package fi.dy.masa.tweakeroo.mixin;

import fi.dy.masa.tweakeroo.data.ServerDataSyncer;
import net.minecraft.client.network.DataQueryHandler;
import net.minecraft.nbt.NbtCompound;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(DataQueryHandler.class)
public class MixinDataQueryHandler {
@Inject(
method = "handleQueryResponse",
at = @At("HEAD")
)
private void queryResponse(int transactionId, NbtCompound nbt, CallbackInfoReturnable<Boolean> cir) {
ServerDataSyncer.INSTANCE.handleQueryResponse(transactionId, nbt);
}
}
14 changes: 14 additions & 0 deletions src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fi.dy.masa.tweakeroo.mixin;

import fi.dy.masa.tweakeroo.data.ServerDataSyncer;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -130,4 +131,17 @@ private void onProcessKeybindsPre(CallbackInfo ci)
}
}
}

@Inject(
method = "setWorld",
at = @At("HEAD")
)
private void onWorldChanged(ClientWorld world, CallbackInfo ci)
{
if (world == null) {
ServerDataSyncer.INSTANCE = null;
} else {
ServerDataSyncer.INSTANCE = new ServerDataSyncer(world);
}
}
}
43 changes: 25 additions & 18 deletions src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@

import java.util.Set;
import com.mojang.blaze3d.systems.RenderSystem;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;
import fi.dy.masa.malilib.util.EntityUtils;
import fi.dy.masa.malilib.util.GuiUtils;
import fi.dy.masa.tweakeroo.config.Configs;
import fi.dy.masa.tweakeroo.data.ServerDataSyncer;
import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity;
import fi.dy.masa.tweakeroo.util.MiscUtils;
import fi.dy.masa.tweakeroo.util.RayTraceUtils;
import fi.dy.masa.tweakeroo.util.SnapAimMode;

import net.minecraft.block.Block;
import net.minecraft.block.ShulkerBoxBlock;
Expand Down Expand Up @@ -31,14 +37,10 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;

import fi.dy.masa.malilib.util.EntityUtils;
import fi.dy.masa.malilib.util.GuiUtils;
import fi.dy.masa.tweakeroo.config.Configs;
import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity;
import fi.dy.masa.tweakeroo.util.MiscUtils;
import fi.dy.masa.tweakeroo.util.RayTraceUtils;
import fi.dy.masa.tweakeroo.util.SnapAimMode;
import java.util.Set;

public class RenderUtils
{
Expand Down Expand Up @@ -133,13 +135,8 @@ public static void renderInventoryOverlay(MinecraftClient mc, DrawContext drawCo

HitResult trace = RayTraceUtils.getRayTraceFromEntity(world, cameraEntity, false);

if (trace == null)
{
return;
}

Inventory inv = null;
ShulkerBoxBlock block = null;
ShulkerBoxBlock shulkerBoxBlock = null;
LivingEntity entityLivingBase = null;

if (trace.getType() == HitResult.Type.BLOCK)
Expand All @@ -149,14 +146,24 @@ public static void renderInventoryOverlay(MinecraftClient mc, DrawContext drawCo

if (blockTmp instanceof ShulkerBoxBlock)
{
block = (ShulkerBoxBlock) blockTmp;
shulkerBoxBlock = (ShulkerBoxBlock) blockTmp;
}

inv = fi.dy.masa.malilib.util.InventoryUtils.getInventory(world, pos);
if (world instanceof ServerWorld realWorld) {
inv = fi.dy.masa.malilib.util.InventoryUtils.getInventory(realWorld, pos);
} else {
inv = ServerDataSyncer.INSTANCE.getBlockInventory(world, pos);
}
}
else if (trace.getType() == HitResult.Type.ENTITY)
{
Entity entity = ((EntityHitResult) trace).getEntity();
if (entity.getWorld().isClient) {
Entity serverEntity = ServerDataSyncer.INSTANCE.getServerEntity(entity);
if (serverEntity != null) {
entity = serverEntity;
}
}

if (entity instanceof LivingEntity)
{
Expand Down Expand Up @@ -207,7 +214,7 @@ else if (entity instanceof AbstractHorseEntity)
yInv = Math.min(yInv, yCenter - 92);
}

fi.dy.masa.malilib.render.RenderUtils.setShulkerboxBackgroundTintColor(block, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue());
fi.dy.masa.malilib.render.RenderUtils.setShulkerboxBackgroundTintColor(shulkerBoxBlock, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue());

if (isHorse)
{
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,9 @@ private static void repairModeHandleSlot(PlayerEntity player, EquipmentSlot type
}
}

/**
* Adds the enchantment checks for Tools or Weapons
*/
private static int findRepairableItemNotInRepairableSlot(Slot targetSlot, PlayerEntity player)
{
ScreenHandler containerPlayer = player.currentScreenHandler;
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/mixins.tweakeroo.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"IMixinClientWorld",
"IMixinCommandBlockExecutor",
"IMixinCustomizeFlatLevelScreen",
"IMixinDataQueryHandler",
"IMixinShovelItem",
"IMixinSimpleOption",
"MixinAbstractClientPlayerEntity",
Expand All @@ -36,6 +37,7 @@
"MixinCloneCommand",
"MixinCommandBlockScreen",
"MixinCreativeInventoryScreen",
"MixinDataQueryHandler",
"MixinDimensionEffects_Nether",
"MixinEntity",
"MixinEntityRenderDispatcher",
Expand Down
Loading