@Mixin(targets = "com.trongthang.bettercampfires.mixin.CampfireBlockEntityMixin")
public interface CampfireBlockEntityAccessor {
@Accessor(value = "campfireBurntime", remap = false)
int getCampfireBurntime();
@Accessor(value = "campfireBurntime", remap = false)
void setCampfireBurntime(int burnTime);
}
< /code>
Я пытаюсь получить доступ к @UNIQUE FIELS of the CampfireBlockentityMixin < /p>
@Mixin(CampfireBlockEntity.class)
class CampfireBlockEntityMixin {
private int buffCheckCounter = 0;
private static int buffRadius = ModConfig.getInstance().buffRadius;
// Add a custom burn time field
@Unique
private int campfireBurntime = 0;
}
< /code>
Вот, где я пытаюсь использовать аксессуар, я хочу, чтобы игроки могли заправить костер, взаимодействуя с ним: < /p>
@Mixin(CampfireBlock.class)
public class CampfireBlockFuel {
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
public void onPlayerInteract(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) {
// Only proceed if it's not a client-side interaction and the campfire is lit
if (!world.isClient && state.get(CampfireBlock.LIT) && !ModConfig.getInstance().campfireFuels.isEmpty() && ModConfig.getInstance().campfiresCanBurnOut) {
ItemStack heldItem = player.getStackInHand(hand);
String fuelId = heldItem.getItem().getTranslationKey();
// Normalize the translation key for block or item
String itemId = fuelId.replace("item.minecraft.", "minecraft:").replace("block.minecraft.", "minecraft:");
boolean fuelFound = false; // Flag to track if we found the fuel
for (ModConfig.CampfireFuels fuel : ModConfig.getInstance().campfireFuels) {
if (fuel.fuelId.equals(itemId)) {
fuelFound = true;
if (heldItem.getCount() > 0) {
heldItem.decrement(1);
int fuelTime = fuel.addBurnTime;
// Update the campfire's cooldown list
campfiresList.computeIfPresent(pos, (p, cooldown) -> {
cooldown.timeLeft += fuelTime;
return cooldown;
});
// Get the campfire BlockEntity
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof CampfireBlockEntity) {
CampfireBlockEntityAccessor campfireBlockEntityAccessor = (CampfireBlockEntityAccessor) blockEntity;
int currentBurnTime = campfireBlockEntityAccessor.getCampfireBurntime();
campfireBlockEntityAccessor.setCampfireBurntime(currentBurnTime + fuelTime);
LOGGER.info("BURN TIME: " + campfireBlockEntityAccessor.getCampfireBurntime());
}
// Send network packet if needed
ServerPlayNetworking.send(player.getServer().getPlayerManager().getPlayer(player.getUuid()), PLAY_BLOCK_LAVA_EXTINGUISH, PacketByteBufs.empty());
// Set the return value to indicate success
cir.setReturnValue(ActionResult.SUCCESS);
cir.cancel();
}
break; // Exit the loop once the fuel is found
}
}
}
}
}
< /code>
Вот ошибка, которую я продолжаю получать: < /p>
[13:41:22] [Server thread/ERROR]: Failed to handle packet net.minecraft.class_2885@2f1a1d1d, suppressing error
java.lang.RuntimeException: Mixin transformation of com.trongthang.bettercampfires.mixin.CampfireBlockEntityAccessor failed
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getPostMixinClassByteArray(KnotClassDelegate.java:427) ~[fabric-loader-0.16.10.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:323) ~[fabric-loader-0.16.10.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:218) ~[fabric-loader-0.16.10.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119) ~[fabric-loader-0.16.10.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
at net.minecraft.class_3922.handler$zdd000$bettercampfires$onPlayerInteract(class_3922.java:556) ~[client-intermediary.jar:?]
at net.minecraft.class_3922.method_9534(class_3922.java) ~[client-intermediary.jar:?]
at net.minecraft.class_4970$class_4971.method_26174(class_4970.java:1133) ~[client-intermediary.jar:?]
at net.minecraft.class_3225.method_14262(class_3225.java:343) ~[client-intermediary.jar:?]
at net.minecraft.class_3244.method_12046(class_3244.java:1140) ~[client-intermediary.jar:?]
at net.minecraft.class_2885.method_12547(class_2885.java:34) ~[client-intermediary.jar:?]
at net.minecraft.class_2885.method_11054(class_2885.java:8) ~[client-intermediary.jar:?]
at net.minecraft.class_2600.method_11072(class_2600.java:22) ~[client-intermediary.jar:?]
at net.minecraft.class_3738.run(class_3738.java:18) ~[client-intermediary.jar:?]
at net.minecraft.class_1255.method_18859(class_1255.java:156) ~[client-intermediary.jar:?]
at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:782) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:164) ~[client-intermediary.jar:?]
at net.minecraft.class_1255.method_16075(class_1255.java:130) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:764) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:758) ~[client-intermediary.jar:?]
at net.minecraft.class_1255.method_5383(class_1255.java:115) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:742) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:675) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[client-intermediary.jar:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.spongepowered.asm.mixin.transformer.throwables.IllegalClassLoadError: Illegal classload request for accessor mixin com.trongthang.bettercampfires.mixin.CampfireBlockEntityAccessor. The mixin is missing from bettercampfires.mixins.json which owns package com.trongthang.bettercampfires.mixin.* and the mixin has not been applied.
at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:334) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:234) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7]
at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClassBytes(MixinTransformer.java:202) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7]
at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getPostMixinClassByteArray(KnotClassDelegate.java:422) ~[fabric-loader-0.16.10.jar:?]
... 25 more
действительно надеюсь, что кто -то сможет мне помочь, я пытался уже несколько недель, но я не смог найти ответ.
Вот мой аксессура: < /p> [code]@Mixin(targets = "com.trongthang.bettercampfires.mixin.CampfireBlockEntityMixin") public interface CampfireBlockEntityAccessor {
@Accessor(value = "campfireBurntime", remap = false) int getCampfireBurntime();
@Accessor(value = "campfireBurntime", remap = false) void setCampfireBurntime(int burnTime); } < /code> Я пытаюсь получить доступ к @UNIQUE FIELS of the CampfireBlockentityMixin < /p> @Mixin(CampfireBlockEntity.class) class CampfireBlockEntityMixin {
private int buffCheckCounter = 0; private static int buffRadius = ModConfig.getInstance().buffRadius;
// Add a custom burn time field @Unique private int campfireBurntime = 0; } < /code> Вот, где я пытаюсь использовать аксессуар, я хочу, чтобы игроки могли заправить костер, взаимодействуя с ним: < /p> @Mixin(CampfireBlock.class) public class CampfireBlockFuel { @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) public void onPlayerInteract(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) { // Only proceed if it's not a client-side interaction and the campfire is lit if (!world.isClient && state.get(CampfireBlock.LIT) && !ModConfig.getInstance().campfireFuels.isEmpty() && ModConfig.getInstance().campfiresCanBurnOut) { ItemStack heldItem = player.getStackInHand(hand); String fuelId = heldItem.getItem().getTranslationKey();
// Normalize the translation key for block or item String itemId = fuelId.replace("item.minecraft.", "minecraft:").replace("block.minecraft.", "minecraft:");
boolean fuelFound = false; // Flag to track if we found the fuel for (ModConfig.CampfireFuels fuel : ModConfig.getInstance().campfireFuels) { if (fuel.fuelId.equals(itemId)) { fuelFound = true;
if (heldItem.getCount() > 0) { heldItem.decrement(1);
int fuelTime = fuel.addBurnTime;
// Update the campfire's cooldown list campfiresList.computeIfPresent(pos, (p, cooldown) -> { cooldown.timeLeft += fuelTime; return cooldown; });
// Get the campfire BlockEntity BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof CampfireBlockEntity) {
// Send network packet if needed ServerPlayNetworking.send(player.getServer().getPlayerManager().getPlayer(player.getUuid()), PLAY_BLOCK_LAVA_EXTINGUISH, PacketByteBufs.empty());
// Set the return value to indicate success cir.setReturnValue(ActionResult.SUCCESS); cir.cancel(); } break; // Exit the loop once the fuel is found } } } } } < /code> Вот ошибка, которую я продолжаю получать: < /p> [13:41:22] [Server thread/ERROR]: Failed to handle packet net.minecraft.class_2885@2f1a1d1d, suppressing error java.lang.RuntimeException: Mixin transformation of com.trongthang.bettercampfires.mixin.CampfireBlockEntityAccessor failed at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getPostMixinClassByteArray(KnotClassDelegate.java:427) ~[fabric-loader-0.16.10.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:323) ~[fabric-loader-0.16.10.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.loadClass(KnotClassDelegate.java:218) ~[fabric-loader-0.16.10.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:119) ~[fabric-loader-0.16.10.jar:?] at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?] at net.minecraft.class_3922.handler$zdd000$bettercampfires$onPlayerInteract(class_3922.java:556) ~[client-intermediary.jar:?] at net.minecraft.class_3922.method_9534(class_3922.java) ~[client-intermediary.jar:?] at net.minecraft.class_4970$class_4971.method_26174(class_4970.java:1133) ~[client-intermediary.jar:?] at net.minecraft.class_3225.method_14262(class_3225.java:343) ~[client-intermediary.jar:?] at net.minecraft.class_3244.method_12046(class_3244.java:1140) ~[client-intermediary.jar:?] at net.minecraft.class_2885.method_12547(class_2885.java:34) ~[client-intermediary.jar:?] at net.minecraft.class_2885.method_11054(class_2885.java:8) ~[client-intermediary.jar:?] at net.minecraft.class_2600.method_11072(class_2600.java:22) ~[client-intermediary.jar:?] at net.minecraft.class_3738.run(class_3738.java:18) ~[client-intermediary.jar:?] at net.minecraft.class_1255.method_18859(class_1255.java:156) ~[client-intermediary.jar:?] at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:782) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:164) ~[client-intermediary.jar:?] at net.minecraft.class_1255.method_16075(class_1255.java:130) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:764) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:758) ~[client-intermediary.jar:?] at net.minecraft.class_1255.method_5383(class_1255.java:115) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:742) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:675) ~[client-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[client-intermediary.jar:?] at java.lang.Thread.run(Thread.java:833) ~[?:?] Caused by: org.spongepowered.asm.mixin.transformer.throwables.IllegalClassLoadError: Illegal classload request for accessor mixin com.trongthang.bettercampfires.mixin.CampfireBlockEntityAccessor. The mixin is missing from bettercampfires.mixins.json which owns package com.trongthang.bettercampfires.mixin.* and the mixin has not been applied. at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:334) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:234) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7] at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClassBytes(MixinTransformer.java:202) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7] at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getPostMixinClassByteArray(KnotClassDelegate.java:422) ~[fabric-loader-0.16.10.jar:?] ... 25 more
[/code] действительно надеюсь, что кто -то сможет мне помочь, я пытался уже несколько недель, но я не смог найти ответ.
Когда я составляю свой мод Minecraft, он работает просто отлично, но когда я запускаю Minecraft, он сбои:
Time: 2025-02-27 15:21:02
Description: Rendering overlay
java.lang.IllegalStateException: Some intrusive holders were not registered: Hint:...
Когда я составляю свой мод Minecraft, он работает просто отлично, но когда я запускаю Minecraft, он сбои:
Time: 2025-02-27 15:21:02
Description: Rendering overlay
java.lang.IllegalStateException: Some intrusive holders were not registered: Hint:...
Привет, я пытаюсь воспроизвести матрицы, произведенные Matlab с помощью Python. Это 2D -матрица (n, 2) форма без значений NAN. Они все плавают. Эти значения генерируются с помощью определенных параметров. Прежде чем применять уникальные, матрицы...
У меня есть метод доступа, который возвращает один строковый результат (пример: «Готово» или «Текущий»…):
public function getMinimumStatusAttribute()
{
$statusIds = [];
$tasks = $this->tasks()->get();
foreach ($tasks as $task) {...