Jump to content

Exception in Server tick loop, HELP!


uhmuluh

Recommended Posts

---- Minecraft Crash Report ----
// Shall we play a game?

Time: 1/18/22 5:00 PM
Description: Exception in server tick loop

net.minecraftforge.fml.config.ConfigFileTypeHandler$ConfigLoadingException: Failed loading config file carryon-server.toml of type SERVER for modid carryon
    at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:61) ~[forge:?] {re:classloading}
    at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:104) ~[forge:?] {re:classloading}
    at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:83) ~[forge:?] {re:classloading}
    at java.lang.Iterable.forEach(Unknown Source) ~[?:1.8.0_301] {re:computing_frames}
    at java.util.Collections$SynchronizedCollection.forEach(Unknown Source) ~[?:1.8.0_301] {}
    at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:83) ~[forge:?] {re:classloading}
    at net.minecraftforge.fml.server.ServerLifecycleHooks.handleServerAboutToStart(ServerLifecycleHooks.java:94) ~[forge:?] {re:classloading}
    at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:166) ~[?:?] {re:classloading,pl:accesstransformer:B}
    at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:621) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
    at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:structure_gel.mixins.json:MinecraftServerMixin,pl:mixin:A,pl:runtimedistcleaner:A}
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_301] {}
Caused by: com.electronwill.nightconfig.core.io.ParsingException: Not enough data available
    at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.io.ReaderInput.directReadChar(ReaderInput.java:36) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.io.AbstractInput.readChar(AbstractInput.java:49) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.io.AbstractInput.readCharsUntil(AbstractInput.java:123) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.toml.TableParser.parseKey(TableParser.java:166) ~[toml-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.toml.TableParser.parseDottedKey(TableParser.java:145) ~[toml-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:55) ~[toml-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:44) ~[toml-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37) ~[toml-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:202) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73) ~[core-3.6.3.jar:?] {}
    at com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85) ~[core-3.6.3.jar:?] {}
    at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:57) ~[forge:?] {re:classloading}
    ... 10 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
    Minecraft Version: 1.16.5
    Minecraft Version ID: 1.16.5
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_301, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 1874928408 bytes (1788 MB) / 2735734784 bytes (2609 MB) up to 6547308544 bytes (6244 MB)
    CPUs: 12
    JVM Flags: 2 total; -Xmx7024M -Xms256M
    ModLauncher: 8.0.9+86+master.3cf110c
    ModLauncher launch target: fmlserver
    ModLauncher naming: srg
    ModLauncher services: 
        /mixin-0.8.4.jar mixin PLUGINSERVICE 
        /eventbus-4.0.0.jar eventbus PLUGINSERVICE 
        /forge-1.16.5-36.2.20.jar object_holder_definalize PLUGINSERVICE 
        /forge-1.16.5-36.2.20.jar runtime_enum_extender PLUGINSERVICE 
        /accesstransformers-3.0.1.jar accesstransformer PLUGINSERVICE 
        /forge-1.16.5-36.2.20.jar capability_inject_definalize PLUGINSERVICE 
        /forge-1.16.5-36.2.20.jar runtimedistcleaner PLUGINSERVICE 
        /mixin-0.8.4.jar mixin TRANSFORMATIONSERVICE 
        /forge-1.16.5-36.2.20.jar fml TRANSFORMATIONSERVICE 
    FML: 36.2
    Forge: net.minecraftforge:36.2.20
    FML Language Providers: 
        [email protected]
        minecraft@1
    Mod List: 
        BorderlessWindow-1.16.5-1.2.1.jar                 |Borderless Window             |borderlesswindow              |1.16.5-1.2.1        |DONE      |Manifest: NOSIGNATURE
        SkyVillage_1.0.0_1.16.5.jar                       |Sky Villages                  |skyvillages                   |1.0.0               |DONE      |Manifest: NOSIGNATURE
        BetterDungeons-1.16.4-1.2.1.jar                   |YUNG's Better Dungeons        |betterdungeons                |1.16.4-1.2.1        |DONE      |Manifest: NOSIGNATURE
        jei-1.16.5-7.7.1.145.jar                          |Just Enough Items             |jei                           |7.7.1.145           |DONE      |Manifest: NOSIGNATURE
        dungeons_mobs-1.16.5-1.0.10.jar                   |Dungeons Mobs                 |dungeons_mobs                 |1.0.10              |DONE      |Manifest: NOSIGNATURE
        abnormals_core-1.16.5-3.3.1.jar                   |Abnormals Core                |abnormals_core                |3.3.1               |DONE      |Manifest: NOSIGNATURE
        mcw-windows-2.0.2-mc1.16.5.jar                    |Macaw's Windows               |mcwwindows                    |2.0.2               |DONE      |Manifest: NOSIGNATURE
        InsaneLib-1.4.2-mc1.16.5.jar                      |InsaneLib                     |insanelib                     |1.4.2               |DONE      |Manifest: NOSIGNATURE
        Space-BossTools-1.16.5-5.5b.jar                   |Space-BossTools               |boss_tools                    |5.5                 |DONE      |Manifest: NOSIGNATURE
        BetterCaves-Forge-1.16.4-1.1.2.jar                |YUNG's Better Caves           |bettercaves                   |1.16.4-1.1.2        |DONE      |Manifest: NOSIGNATURE
        jev-1.16.3-2.0.1.jar                              |Just Enough Vehicles          |jev                           |2.0.1               |DONE      |Manifest: NOSIGNATURE
        citadel-1.8.1-1.16.5.jar                          |Citadel                       |citadel                       |1.8.1               |DONE      |Manifest: NOSIGNATURE
        YungsApi-1.16.4-Forge-13.jar                      |YUNG's API                    |yungsapi                      |1.16.4-Forge-13     |DONE      |Manifest: NOSIGNATURE
        Shark_Mod-0.2.jar                                 |Shark Mod                     |shark_mod                     |1.0.0               |DONE      |Manifest: NOSIGNATURE
        macawsbridgesbop-1.16.5-1.2.jar                   |Macaw's Bridges - Biome O' Ple|macawsbridgesbop              |1.16.5-1.2          |DONE      |Manifest: NOSIGNATURE
        ProgressiveBosses-3.4.2-mc1.16.5.jar              |Progressive Bosses            |progressivebosses             |3.4.2               |DONE      |Manifest: NOSIGNATURE
        iChunUtil-1.16.5-10.5.1.jar                       |iChunUtil                     |ichunutil                     |10.5.1              |DONE      |Manifest: NOSIGNATURE
        carryon-1.16.5-1.15.5.22.jar                      |Carry On                      |carryon                       |1.15.5.22           |DONE      |Manifest: NOSIGNATURE
        chat_heads-0.6.0-forge-1.16.5.jar                 |Chat Heads                    |chat_heads                    |0.6.0               |DONE      |Manifest: NOSIGNATURE
        recast_1.16.5-1.5.jar                             |Recast                        |recast                        |1.5                 |DONE      |Manifest: NOSIGNATURE
        forge-1.16.5-36.2.20-universal.jar                |Forge                         |forge                         |36.2.20             |DONE      |Manifest: 22:af:21:d8:19:82:7f:93:94:fe:2b:ac:b7:e4:41:57:68:39:87:b1:a7:5c:c6:44:f9:25:74:21:14:f5:0d:90
        Morph-1.16.5-10.1.0.jar                           |Morph                         |morph                         |10.1.0              |DONE      |Manifest: NOSIGNATURE
        structure_gel-1.16.5-1.7.8.jar                    |Structure Gel API             |structure_gel                 |1.7.8               |DONE      |Manifest: NOSIGNATURE
        forge-1.16.5-36.2.20-server.jar                   |Minecraft                     |minecraft                     |1.16.5              |DONE      |Manifest: NOSIGNATURE
        upgrade_aquatic-1.16.5-3.1.2.jar                  |Upgrade Aquatic               |upgrade_aquatic               |3.1.2               |DONE      |Manifest: NOSIGNATURE
        mcw-bridges-2.0.1-mc1.16.5.jar                    |Macaw's Bridges               |mcwbridges                    |2.0.1               |DONE      |Manifest: NOSIGNATURE
        FarmersDelight-1.16.5-0.5.4.jar                   |Farmer's Delight              |farmersdelight                |1.16.5-0.5.4        |DONE      |Manifest: NOSIGNATURE
        customizableelytra-1.16.4-1.5.7.jar               |Customizable Elytra           |customizableelytra            |1.16.4-1.5.7        |DONE      |Manifest: NOSIGNATURE
        repurposed_structures_forge-3.4.5+1.16.5.jar      |Repurposed Structures         |repurposed_structures         |3.4.5+1.16.5        |DONE      |Manifest: NOSIGNATURE
        silent-lib-1.16.5-4.10.0.jar                      |Silent Lib                    |silentlib                     |4.10.0              |DONE      |Manifest: NOSIGNATURE
        BiomesOPlenty-1.16.5-13.1.0.485-universal.jar     |Biomes O' Plenty              |biomesoplenty                 |1.16.5-13.1.0.485   |DONE      |Manifest: NOSIGNATURE
        ironfurnaces-1.16.5-2.7.6.jar                     |Iron Furnaces                 |ironfurnaces                  |2.7.6               |DONE      |Manifest: NOSIGNATURE
        dungeons_plus-1.16.5-1.1.5.jar                    |Dungeons Plus                 |dungeons_plus                 |1.1.5               |DONE      |Manifest: NOSIGNATURE
        mcw-trapdoors-1.0.4-mc1.16.5.jar                  |Macaw's Trapdoors             |mcwtrpdoors                   |1.0.4               |DONE      |Manifest: NOSIGNATURE
        mcw-fences-1.0.2-mc1.16.5.jar                     |Macaw's Fences and Walls      |mcwfences                     |1.0.2               |DONE      |Manifest: NOSIGNATURE
        Botania-1.16.5-420.2.jar                          |Botania                       |botania                       |1.16.5-420.2        |DONE      |Manifest: NOSIGNATURE
        pamhc2foodextended-1.16.3-1.0.4.jar               |Pam's HarvestCraft 2 Food Exte|pamhc2foodextended            |version             |DONE      |Manifest: NOSIGNATURE
        paintings-1.16.4-7.0.0.1.jar                      |Paintings ++                  |paintings                     |1.16.4-6.0.1.5      |DONE      |Manifest: NOSIGNATURE
        mostructures-forge-1.2.0-1.16.5.jar               |Mo' Structures                |mostructures                  |1.2.0-1.16.5        |DONE      |Manifest: NOSIGNATURE
        curios-forge-1.16.5-4.0.5.3.jar                   |Curios API                    |curios                        |1.16.5-4.0.5.3      |DONE      |Manifest: NOSIGNATURE
        Patchouli-1.16.4-53.2.jar                         |Patchouli                     |patchouli                     |1.16.4-53.2         |DONE      |Manifest: NOSIGNATURE
        collective-1.16.5-3.7.jar                         |Collective                    |collective                    |3.7                 |DONE      |Manifest: NOSIGNATURE
        betterweather-2.0.1.jar                           |Better Weather                |betterweather                 |2.0.1               |DONE      |Manifest: NOSIGNATURE
        xercapaint-1.16.5-1.0.jar                         |Joy of Painting               |xercapaint                    |1.16.5-1.0          |DONE      |Manifest: NOSIGNATURE
        obfuscate-0.6.2-1.16.3.jar                        |Obfuscate                     |obfuscate                     |0.6.2               |DONE      |Manifest: e1:59:1a:56:ec:97:b3:d0:b3:4b:25:06:1f:83:b0:f4:fd:0c:24:e3:6d:ea:94:b1:9f:22:b0:38:13:60:88:ea
        vehicle-mod-0.45.2-1.16.3 (1).jar                 |MrCrayfish's Vehicle Mod      |vehicle                       |0.45.2              |DONE      |Manifest: NOSIGNATURE
        nethers_delight-2.1.jar                           |Nethers Delight               |nethers_delight               |2.1                 |DONE      |Manifest: NOSIGNATURE
        cfm-7.0.0pre22-1.16.3.jar                         |MrCrayfish's Furniture Mod    |cfm                           |7.0.0-pre22         |DONE      |Manifest: NOSIGNATURE
        morecfm-1.3.1-1.16.3.jar                          |MrCrayfish's More Furniture Mo|morecfm                       |1.3.1               |DONE      |Manifest: NOSIGNATURE
        mcw-furniture-2.0.1-mc1.16.5.jar                  |Macaw's Furniture             |mcwfurnitures                 |2.0.1               |DONE      |Manifest: NOSIGNATURE
        Aquaculture-1.16.5-2.1.21.jar                     |Aquaculture 2                 |aquaculture                   |1.16.5-2.1.21       |DONE      |Manifest: NOSIGNATURE
        BetterShieldsMC1.16.3-1.2.jar                     |Better Shields                |bettershields                 |1.2                 |DONE      |Manifest: NOSIGNATURE
        valhelsia_core-16.0.15.jar                        |Valhelsia Core                |valhelsia_core                |16.0.15             |DONE      |Manifest: NOSIGNATURE
        valhelsia_structures-1.16.5-0.1.6.jar             |Valhelsia Structures          |valhelsia_structures          |1.16.5-0.1.6        |DONE      |Manifest: NOSIGNATURE
        DynamicTrees-1.16.5-0.10.0-Beta29.jar             |Dynamic Trees                 |dynamictrees                  |1.16.5-0.10.0-Beta29|DONE      |Manifest: NOSIGNATURE
        DynamicTreesBOP-1.16.5-2.0.8.jar                  |Dynamic Trees for Biomes o' Pl|dtbop                         |1.16.5-2.0.8        |DONE      |Manifest: NOSIGNATURE
        geckolib-forge-1.16.5-3.0.59.jar                  |GeckoLib                      |geckolib3                     |3.0.59              |DONE      |Manifest: NOSIGNATURE
        healingcf_1.16.5-3.1.jar                          |Healing Campfire              |healingcf                     |3.1                 |DONE      |Manifest: NOSIGNATURE
    Crash Report UUID: 7f9b4ad2-792a-4703-b560-6e26cfe858a3
    Player Count: 0 / 20; []
    Data Packs: vanilla, mod:skyvillages, mod:betterdungeons, mod:mcwwindows, mod:insanelib, mod:bettercaves (incompatible), mod:citadel (incompatible), mod:yungsapi, mod:macawsbridgesbop, mod:progressivebosses, mod:carryon, mod:chat_heads, mod:morph, mod:structure_gel, mod:mcwbridges, mod:farmersdelight, mod:customizableelytra, mod:repurposed_structures, mod:biomesoplenty, mod:ironfurnaces, mod:dungeons_plus, mod:mcwtrpdoors, mod:mcwfences, mod:botania, mod:pamhc2foodextended (incompatible), mod:mostructures, mod:curios, mod:patchouli (incompatible), mod:collective, mod:betterweather, mod:xercapaint (incompatible), mod:obfuscate (incompatible), mod:vehicle (incompatible), mod:cfm (incompatible), mod:morecfm, mod:mcwfurnitures, mod:bettershields, mod:dynamictrees, mod:geckolib3 (incompatible), mod:borderlesswindow (incompatible), mod:dtbop, mod:jei, mod:dungeons_mobs (incompatible), mod:abnormals_core, mod:boss_tools, mod:jev, mod:shark_mod, mod:ichunutil, mod:recast, mod:forge, mod:upgrade_aquatic, mod:silentlib (incompatible), mod:paintings (incompatible), mod:nethers_delight, mod:aquaculture (incompatible), mod:valhelsia_core, mod:valhelsia_structures, mod:healingcf
    Is Modded: Definitely; Server brand changed to 'forge'
    Type: Dedicated Server (map_server.txt)

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I am creating a mod that adds new armor sets and changes how armor sets are crafted. When the player interacts with the block it fails to open the gui, but I get no error or stacktrace. All of my registration classes are being called correctly. LightArmorBenchScreen's constructor, render, and renderbg methods are not being called at all. Here is the code: package net.leeveygames.celestial.blocks.custom; import net.leeveygames.celestial.Celestial; import net.leeveygames.celestial.blocks.entity.CelestialBlockEntities; import net.leeveygames.celestial.blocks.entity.LightArmorBenchBlockEntity; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.network.NetworkHooks; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class LightArmorBenchBlock extends BaseEntityBlock { public static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 12, 16); public LightArmorBenchBlock(Properties pProperties) { super(pProperties); } @Override public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { return SHAPE; } @Override public RenderShape getRenderShape(BlockState pState) { return RenderShape.MODEL; } @Override public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) { if (pState.getBlock() != pNewState.getBlock()) { BlockEntity blockEntity = pLevel.getBlockEntity(pPos); if (blockEntity instanceof LightArmorBenchBlockEntity) { ((LightArmorBenchBlockEntity) blockEntity).drops(); } } super.onRemove(pState, pLevel, pPos, pNewState, pIsMoving); } @NotNull @Override public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) { if(pLevel.isClientSide()) return InteractionResult.SUCCESS; BlockEntity be = pLevel.getBlockEntity(pPos); if (be instanceof LightArmorBenchBlockEntity blockEntity) { ServerPlayer player = (ServerPlayer)pPlayer; Celestial.LOGGER.info("Opening Screen."); NetworkHooks.openScreen(player, blockEntity, pPos); } return InteractionResult.CONSUME; } @Nullable @Override public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { return new LightArmorBenchBlockEntity(pPos, pState); } @Nullable @Override public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level pLevel, BlockState pState, BlockEntityType<T> pBlockEntityType) { if(pLevel.isClientSide()) { return null; } return createTickerHelper(pBlockEntityType, CelestialBlockEntities.LIGHT_ARMOR_BENCH_BLOCK_ENTITY.get(), (pLevel1, pPos, pState1, pBlockEntity) -> pBlockEntity.tick(pLevel1, pPos, pState1)); } }   package net.leeveygames.celestial.screen; import net.leeveygames.celestial.Celestial; import net.leeveygames.celestial.blocks.CelestialBlocks; import net.leeveygames.celestial.blocks.entity.LightArmorBenchBlockEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.*; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.items.SlotItemHandler; public class LightArmorBenchMenu extends AbstractContainerMenu { public final LightArmorBenchBlockEntity blockEntity; private final Level level; public LightArmorBenchMenu(int pContainerId, Inventory inv, FriendlyByteBuf extraData) { this(pContainerId, inv, inv.player.level().getBlockEntity(extraData.readBlockPos())); Celestial.LOGGER.info("Creating Light Armor Bench Menu. Client"); } public LightArmorBenchMenu(int pContainerId, Inventory inv, BlockEntity entity) { super(CelestialMenuTypes.LIGHT_ARMOR_BENCH_MENU.get(), pContainerId); Celestial.LOGGER.info("Creating Light Armor Bench Menu. Server"); checkContainerSize(inv, 2); blockEntity = ((LightArmorBenchBlockEntity) entity); this.level = inv.player.level(); addPlayerInventory(inv); addPlayerHotbar(inv); createLightArmorBenchSlots(blockEntity); } private void createLightArmorBenchSlots(LightArmorBenchBlockEntity blockEntity) { Celestial.LOGGER.info("Creating Light Armor Bench Slots."); this.blockEntity.getCapability(ForgeCapabilities.ITEM_HANDLER).ifPresent(iItemHandler -> { this.addSlot(new SlotItemHandler(iItemHandler, 0, 11, 15)); this.addSlot(new SlotItemHandler(iItemHandler, 1, 82, 33)); this.addSlot(new SlotItemHandler(iItemHandler, 2, 133, 33)); }); } // CREDIT GOES TO: diesieben07 | https://github.com/diesieben07/SevenCommons // must assign a slot number to each of the slots used by the GUI. // For this container, we can see both the tile inventory's slots as well as the player inventory slots and the hotbar. // Each time we add a Slot to the container, it automatically increases the slotIndex, which means // 0 - 8 = hotbar slots (which will map to the InventoryPlayer slot numbers 0 - 8) // 9 - 35 = player inventory slots (which map to the InventoryPlayer slot numbers 9 - 35) // 36 - 44 = TileInventory slots, which map to our TileEntity slot numbers 0 - 8) private static final int HOTBAR_SLOT_COUNT = 9; private static final int PLAYER_INVENTORY_ROW_COUNT = 3; private static final int PLAYER_INVENTORY_COLUMN_COUNT = 9; private static final int PLAYER_INVENTORY_SLOT_COUNT = PLAYER_INVENTORY_COLUMN_COUNT * PLAYER_INVENTORY_ROW_COUNT; private static final int VANILLA_SLOT_COUNT = HOTBAR_SLOT_COUNT + PLAYER_INVENTORY_SLOT_COUNT; private static final int VANILLA_FIRST_SLOT_INDEX = 0; private static final int TE_INVENTORY_FIRST_SLOT_INDEX = VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT; // THIS YOU HAVE TO DEFINE! private static final int TE_INVENTORY_SLOT_COUNT = 2; // must be the number of slots you have! @Override public ItemStack quickMoveStack(Player playerIn, int pIndex) { Slot sourceSlot = slots.get(pIndex); if (sourceSlot == null || !sourceSlot.hasItem()) return ItemStack.EMPTY; //EMPTY_ITEM ItemStack sourceStack = sourceSlot.getItem(); ItemStack copyOfSourceStack = sourceStack.copy(); // Check if the slot clicked is one of the vanilla container slots if (pIndex < VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT) { // This is a vanilla container slot so merge the stack into the tile inventory if (!moveItemStackTo(sourceStack, TE_INVENTORY_FIRST_SLOT_INDEX, TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT, false)) { return ItemStack.EMPTY; // EMPTY_ITEM } } else if (pIndex < TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT) { // This is a TE slot so merge the stack into the players inventory if (!moveItemStackTo(sourceStack, VANILLA_FIRST_SLOT_INDEX, VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT, false)) { return ItemStack.EMPTY; } } else { System.out.println("Invalid slotIndex:" + pIndex); return ItemStack.EMPTY; } // If stack size == 0 (the entire stack was moved) set slot contents to null if (sourceStack.getCount() == 0) { sourceSlot.set(ItemStack.EMPTY); } else { sourceSlot.setChanged(); } sourceSlot.onTake(playerIn, sourceStack); return copyOfSourceStack; } @Override public boolean stillValid(Player pPlayer) { return stillValid(ContainerLevelAccess.create(level, blockEntity.getBlockPos()), pPlayer, CelestialBlocks.LIGHT_ARMOR_BENCH.get()); } private void addPlayerInventory(Inventory playerInventory) { Celestial.LOGGER.info("Creating Player Inventory."); for (int i = 0; i < 3; ++i) { for (int l = 0; l < 9; ++l) { this.addSlot(new Slot(playerInventory, l + i * 9 + 9, 8 + l * 18, 84 + i * 18)); } } } private void addPlayerHotbar(Inventory playerInventory) { Celestial.LOGGER.info("Creating Player Hotbar."); for (int i = 0; i < 9; ++i) { this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); } } }   package net.leeveygames.celestial.screen; import com.mojang.blaze3d.systems.RenderSystem; import net.leeveygames.celestial.Celestial; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; public class LightArmorBenchScreen extends AbstractContainerScreen<LightArmorBenchMenu> { private static final ResourceLocation TEXTURE = new ResourceLocation(Celestial.MOD_ID, "textures/gui/LightArmorBenchGUI.png"); public LightArmorBenchScreen(LightArmorBenchMenu pMenu, Inventory pPlayerInventory, Component pTitle) { super(pMenu, pPlayerInventory, pTitle); Celestial.LOGGER.info("Creating Light Armor Bench Screen."); this.imageWidth = 176; this.imageHeight = 166; } @Override protected void init() { Celestial.LOGGER.info("Screen init."); super.init(); } @Override protected void renderBg(GuiGraphics guiGraphics, float pPartialTick, int pMouseX, int pMouseY) { Celestial.LOGGER.info("Render Background Method."); RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShaderTexture(0, TEXTURE); guiGraphics.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight); } @Override public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float delta) { Celestial.LOGGER.info("Render Method."); renderBackground(guiGraphics); super.render(guiGraphics, mouseX, mouseY, delta); renderTooltip(guiGraphics, mouseX, mouseY); } }   package net.leeveygames.celestial.blocks.entity; import net.leeveygames.celestial.screen.LightArmorBenchMenu; import net.minecraft.client.gui.screens.inventory.FurnaceScreen; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.Container; import net.minecraft.world.Containers; import net.minecraft.world.MenuProvider; import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ContainerData; import net.minecraft.world.inventory.FurnaceMenu; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemStackHandler; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class LightArmorBenchBlockEntity extends BlockEntity implements MenuProvider { private final ItemStackHandler itemHandler = new ItemStackHandler(3) { @Override protected void onContentsChanged(int slot) { super.onContentsChanged(slot); LightArmorBenchBlockEntity.this.setChanged(); } }; private static final int INPUT_SLOT = 0; private static final int OUTPUT_SLOT = 1; private LazyOptional<IItemHandler> lazyItemHandler = LazyOptional.empty(); public LightArmorBenchBlockEntity(BlockPos pPos, BlockState pBlockState) { super(CelestialBlockEntities.LIGHT_ARMOR_BENCH_BLOCK_ENTITY.get(), pPos, pBlockState); } @Override public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) { if(cap == ForgeCapabilities.ITEM_HANDLER) { return lazyItemHandler.cast(); } return super.getCapability(cap, side); } @Override public void onLoad() { super.onLoad(); lazyItemHandler = LazyOptional.of(() -> itemHandler); } @Override public void invalidateCaps() { super.invalidateCaps(); lazyItemHandler.invalidate(); } public void drops() { SimpleContainer inventory = new SimpleContainer(itemHandler.getSlots()); for(int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, itemHandler.getStackInSlot(i)); } Containers.dropContents(this.level, this.worldPosition, inventory); } @Override public Component getDisplayName() { return Component.translatable("block.celestial.light_armor_bench"); } @Nullable @Override public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) { return new LightArmorBenchMenu(pContainerId, pPlayerInventory, this); } @Override protected void saveAdditional(CompoundTag pTag) { pTag.put("inventory", itemHandler.serializeNBT()); super.saveAdditional(pTag); } @Override public void load(CompoundTag pTag) { super.load(pTag); itemHandler.deserializeNBT(pTag.getCompound("inventory")); } public void tick(Level pLevel, BlockPos pPos, BlockState pState) { } }   Here is the console output: https://pastebin.com/krgExnYT
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.