generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增: + 增加了使用容器预览查看玩家背包和末影箱的功能(如果在服务器取决于服务器的实现,PCA 默认只有 op 才能查看其它玩家,或者可以查看 bot) 改变: + 优化了存储矿车同步的逻辑,矿车不再鬼畜
- Loading branch information
Showing
9 changed files
with
103 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...ls/MasaGadget/mixin/tweakeroo/feature/inventoryPreviewSupportPlayer/MixinRenderUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.plusls.MasaGadget.mixin.tweakeroo.feature.inventoryPreviewSupportPlayer; | ||
|
||
import fi.dy.masa.malilib.render.InventoryOverlay; | ||
import fi.dy.masa.malilib.util.GuiUtils; | ||
import fi.dy.masa.tweakeroo.renderer.RenderUtils; | ||
import net.minecraft.block.ShulkerBoxBlock; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.util.math.MatrixStack; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.LivingEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.inventory.Inventory; | ||
import net.minecraft.util.DyeColor; | ||
import net.minecraft.util.hit.HitResult; | ||
import net.minecraft.world.World; | ||
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.ModifyVariable; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
|
||
@Mixin(value = RenderUtils.class, remap = false) | ||
public abstract class MixinRenderUtils { | ||
|
||
static private Entity traceEntity = null; | ||
|
||
@Inject(method = "renderInventoryOverlay", | ||
at = @At(value = "INVOKE_ASSIGN", | ||
target = "Lnet/minecraft/util/hit/EntityHitResult;getEntity()Lnet/minecraft/entity/Entity;", | ||
ordinal = 0, remap = true), locals = LocalCapture.CAPTURE_FAILHARD) | ||
private static void getTraceEntity(MinecraftClient mc, MatrixStack matrixStack, CallbackInfo ci, | ||
World world, PlayerEntity player, HitResult trace, Inventory inv, ShulkerBoxBlock block, | ||
LivingEntity entityLivingBase, Entity entity) { | ||
traceEntity = entity; | ||
} | ||
|
||
@ModifyVariable(method = "renderInventoryOverlay", | ||
at = @At(value = "INVOKE", | ||
target = "Lfi/dy/masa/malilib/util/GuiUtils;getScaledWindowWidth()I", | ||
ordinal = 0, remap = false), ordinal = 0) | ||
private static Inventory modifyInv(Inventory inv) { | ||
Inventory ret = inv; | ||
if (ret == null && traceEntity instanceof PlayerEntity) { | ||
PlayerEntity playerEntity = (PlayerEntity) traceEntity; | ||
ret = playerEntity.inventory; | ||
|
||
int x = GuiUtils.getScaledWindowWidth() / 2 - 88; | ||
int y = GuiUtils.getScaledWindowHeight() / 2 + 10; | ||
int slotOffsetX = 8; | ||
int slotOffsetY = 8; | ||
InventoryOverlay.InventoryRenderType type = InventoryOverlay.InventoryRenderType.GENERIC; | ||
DyeColor dye = DyeColor.GRAY; | ||
float[] colors = dye.getColorComponents(); | ||
|
||
fi.dy.masa.malilib.render.RenderUtils.color(colors[0], colors[1], colors[2], 1.0F); | ||
InventoryOverlay.renderInventoryBackground(type, x, y, 9, 27, MinecraftClient.getInstance()); | ||
InventoryOverlay.renderInventoryStacks(type, playerEntity.getEnderChestInventory(), x + slotOffsetX, y + slotOffsetY, 9, 9, 27, MinecraftClient.getInstance()); | ||
fi.dy.masa.malilib.render.RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F); | ||
} | ||
traceEntity = null; | ||
return ret; | ||
} | ||
} |
39 changes: 0 additions & 39 deletions
39
...va/com/plusls/MasaGadget/mixin/tweakeroo/feature/pcaSyncProtocol/MixinMerchantEntity.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
accessWidener v1 named | ||
accessible field net/minecraft/entity/vehicle/StorageMinecartEntity inventory Lnet/minecraft/util/collection/DefaultedList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters