diff options
| author | Linnea Gräf <nea@nea.moe> | 2024-04-26 13:16:32 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2024-04-26 13:16:32 +0200 |
| commit | e5f4ad3281cef4ec597d87450189b73afd9dff38 (patch) | |
| tree | bafb475095c446481b2a406fb353f6fcccc19b24 | |
| parent | a496e3f2af51dbf5c6f31488c8d18d52ddcfed15 (diff) | |
| download | LibGui-1.20.5.tar.gz LibGui-1.20.5.tar.bz2 LibGui-1.20.5.zip | |
Janky 1.20.5 fix1.20.5
34 files changed, 15 insertions, 1729 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 490b5c0..3ffbece 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,11 +9,11 @@ jobs: uses: actions/checkout@v2 - name: validate gradle wrapper uses: gradle/wrapper-validation-action@v1 - - name: setup jdk 17 + - name: setup jdk 21 uses: actions/setup-java@v2 with: distribution: temurin - java-version: 17 + java-version: 21 - name: make gradle wrapper executable if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew diff --git a/build.gradle b/build.gradle index 1bab429..b6ce02d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.4.+' + id 'fabric-loom' version '1.6.+' id 'maven-publish' id 'checkstyle' } @@ -117,8 +117,8 @@ java { withSourcesJar() withJavadocJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } tasks.withType(JavaCompile) { @@ -126,7 +126,7 @@ tasks.withType(JavaCompile) { // this fixes some edge cases with special characters not displaying correctly // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html options.encoding = "UTF-8" - options.release.set 17 + options.release.set 21 } jar { diff --git a/gradle.properties b/gradle.properties index 6c500b7..7fb3742 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,17 +3,17 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.20.2 - yarn_mappings=1.20.2+build.1 - loader_version=0.14.22 + minecraft_version=1.20.5 + yarn_mappings=1.20.5+build.1 + loader_version=0.15.10 # Mod Properties - mod_version = 9.2.2 + mod_version = 9.2.3 maven_group = io.github.cottonmc archives_base_name = LibGui # Dependencies - fabric_version=0.89.2+1.20.2 + fabric_version=0.97.6+1.20.5 jankson_version=6.0.0+j1.2.3 - modmenu_version=8.0.0 + modmenu_version=10.0.0-beta.1 libninepatch_version=1.2.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e09..a80b22c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java index b64ffce..d64e3d6 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java @@ -170,21 +170,6 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio /** WILL MODIFY toInsert! Returns true if anything was inserted. */ private boolean insertIntoExisting(ItemStack toInsert, Slot slot, PlayerEntity player) { ItemStack curSlotStack = slot.getStack(); - if (!curSlotStack.isEmpty() && ItemStack.canCombine(toInsert, curSlotStack) && slot.canInsert(toInsert)) { - int combinedAmount = curSlotStack.getCount() + toInsert.getCount(); - int maxAmount = Math.min(toInsert.getMaxCount(), slot.getMaxItemCount(toInsert)); - if (combinedAmount <= maxAmount) { - toInsert.setCount(0); - curSlotStack.setCount(combinedAmount); - slot.markDirty(); - return true; - } else if (curSlotStack.getCount() < maxAmount) { - toInsert.decrement(maxAmount - curSlotStack.getCount()); - curSlotStack.setCount(maxAmount); - slot.markDirty(); - return true; - } - } return false; } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java index b20fcec..45a5e04 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/ScreenNetworkingImpl.java @@ -61,13 +61,9 @@ public class ScreenNetworkingImpl implements ScreenNetworking { buf.writeVarInt(description.syncId); buf.writeIdentifier(message); writer.accept(buf); - description.getPacketSender().sendPacket(side == NetworkSide.SERVER ? SCREEN_MESSAGE_S2C : SCREEN_MESSAGE_C2S, buf); } public static void init() { - ServerPlayNetworking.registerGlobalReceiver(SCREEN_MESSAGE_C2S, (server, player, networkHandler, buf, responseSender) -> { - handle(server, player, buf); - }); } public static void handle(Executor executor, PlayerEntity player, PacketByteBuf buf) { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java index d6f8f4f..fbb2844 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/LibGuiClient.java @@ -28,10 +28,6 @@ public class LibGuiClient implements ClientModInitializer { public void onInitializeClient() { config = loadConfig(); - ClientPlayNetworking.registerGlobalReceiver(ScreenNetworkingImpl.SCREEN_MESSAGE_S2C, (client, networkHandler, buf, responseSender) -> { - ScreenNetworkingImpl.handle(client, client.player, buf); - }); - LibGuiShaders.register(); Proxy.proxy = new ClientProxy(); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7870abc..1620133 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -24,14 +24,9 @@ }, "mixins": ["mixins.libgui.json"], "depends": { - "java": ">=17", - "fabricloader": ">=0.14.22", - "fabric-api-base": ">=0.4.4", - "fabric-lifecycle-events-v1": "^2.0.2", - "fabric-networking-api-v1": "^3.0.5", - "fabric-rendering-v1": "^3.0.6", + "java": ">=21", "fabric-resource-loader-v0": "*", - "minecraft": ">=1.20.2", + "minecraft": ">=1.20.5", "jankson": "^6.0.0", "libninepatch": "^1.2.0" }, diff --git a/src/testMod/java/io/github/cottonmc/test/GuiBlock.java b/src/testMod/java/io/github/cottonmc/test/GuiBlock.java deleted file mode 100644 index 1b1666f..0000000 --- a/src/testMod/java/io/github/cottonmc/test/GuiBlock.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.github.cottonmc.test; - -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.Blocks; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class GuiBlock extends BlockWithEntity { - - public GuiBlock() { - super(FabricBlockSettings.copy(Blocks.IRON_BLOCK)); - } - - @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hitResult) { - player.openHandledScreen(state.createScreenHandlerFactory(world, pos)); - return ActionResult.SUCCESS; - } - - @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { - return new GuiBlockEntity(pos, state); - } - - @Override - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; - } -} diff --git a/src/testMod/java/io/github/cottonmc/test/GuiBlockEntity.java b/src/testMod/java/io/github/cottonmc/test/GuiBlockEntity.java deleted file mode 100644 index 16e7e3f..0000000 --- a/src/testMod/java/io/github/cottonmc/test/GuiBlockEntity.java +++ /dev/null @@ -1,43 +0,0 @@ -package io.github.cottonmc.test; - -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerContext; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; - -public class GuiBlockEntity extends BlockEntity implements ImplementedInventory, NamedScreenHandlerFactory { - static final int INVENTORY_SIZE = 8; - - DefaultedList<ItemStack> items = DefaultedList.ofSize(INVENTORY_SIZE, ItemStack.EMPTY); - - public GuiBlockEntity(BlockPos pos, BlockState state) { - super(LibGuiTest.GUI_BLOCKENTITY_TYPE, pos, state); - } - - @Override - public DefaultedList<ItemStack> getItems() { - return items; - } - - @Override - public boolean canPlayerUse(PlayerEntity player) { - return pos.isWithinDistance(player.getBlockPos(), 4.5); - } - - @Override - public Text getDisplayName() { - return Text.literal("test title"); - } - - @Override - public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player) { - return new TestDescription(LibGuiTest.GUI_SCREEN_HANDLER_TYPE, syncId, inv, ScreenHandlerContext.create(world, pos)); - } -} diff --git a/src/testMod/java/io/github/cottonmc/test/GuiItem.java b/src/testMod/java/io/github/cottonmc/test/GuiItem.java deleted file mode 100644 index 27c8d5f..0000000 --- a/src/testMod/java/io/github/cottonmc/test/GuiItem.java +++ /dev/null @@ -1,55 +0,0 @@ -package io.github.cottonmc.test; - -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.StackReference; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.network.PacketByteBuf; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Rarity; -import net.minecraft.util.TypedActionResult; -import net.minecraft.world.World; - -public class GuiItem extends Item { - public GuiItem() { - super(new Item.Settings().rarity(Rarity.EPIC)); - } - - @Override - public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { - player.openHandledScreen(createScreenHandlerFactory(player, hand)); - return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand)); - } - - private NamedScreenHandlerFactory createScreenHandlerFactory(PlayerEntity player, Hand hand) { - EquipmentSlot slot = switch (hand) { - case MAIN_HAND -> EquipmentSlot.MAINHAND; - case OFF_HAND -> EquipmentSlot.OFFHAND; - }; - ItemStack stack = player.getStackInHand(hand); - return new ExtendedScreenHandlerFactory() { - @Override - public Text getDisplayName() { - return stack.getName(); - } - - @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { - return new TestItemDescription(syncId, playerInventory, StackReference.of(player, slot)); - } - - @Override - public void writeScreenOpeningData(ServerPlayerEntity player, PacketByteBuf buf) { - buf.writeEnumConstant(slot); - } - }; - } -} diff --git a/src/testMod/java/io/github/cottonmc/test/ImplementedInventory.java b/src/testMod/java/io/github/cottonmc/test/ImplementedInventory.java deleted file mode 100644 index a1d3911..0000000 --- a/src/testMod/java/io/github/cottonmc/test/ImplementedInventory.java +++ /dev/null @@ -1,213 +0,0 @@ -package io.github.cottonmc.test; - -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.Direction; - -import java.util.List; - -/** - * A simple {@code SidedInventory} implementation with only default methods + an item list getter. - * - * <h2>Reading and writing to tags</h2> - * Use {@link Inventories#readNbt(net.minecraft.nbt.NbtCompound, DefaultedList)} and {@link Inventories#writeNbt(net.minecraft.nbt.NbtCompound, DefaultedList)} - * on {@linkplain #getItems() the item list}. - * - * <p>License: <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a> - * - * @author Juuz - */ -@FunctionalInterface -public interface ImplementedInventory extends SidedInventory { - /** - * Gets the item list of this inventory. - * Must return the same instance every time it's called. - * - * @return the item list - */ - DefaultedList<ItemStack> getItems(); - - // Creation - - /** - * Creates an inventory from the item list. - * - * @param items the item list - * @return a new inventory - */ - static ImplementedInventory of(DefaultedList<ItemStack> items) { - return () -> items; - } - - /** - * Creates a new inventory with the size. - * - * @param size the inventory size - * @return a new inventory - */ - static ImplementedInventory ofSize(int size) { - return of(DefaultedList.ofSize(size, ItemStack.EMPTY)); - } - - // SidedInventory - - /** - * Gets the available slots to automation on the side. - * - * <p>The default implementation returns an array of all slots. - * - * @param side the side - * @return the available slots - */ - @Override - default int[] getAvailableSlots(Direction side) { - int[] result = new int[getItems().size()]; - for (int i = 0; i < result.length; i++) { - result[i] = i; - } - - return result; - } - - /** - * Returns true if the stack can be inserted in the slot at the side. - * - * <p>The default implementation returns true. - * - * @param slot the slot - * @param stack the stack - * @param side the side - * @return true if the stack can be inserted - */ - @Override - default boolean canInsert(int slot, ItemStack stack, Direction side) { - return true; - } - - /** - * Returns true if the stack can be extracted from the slot at the side. - * - * <p>The default implementation returns true. - * - * @param slot the slot - * @param stack the stack - * @param side the side - * @return true if the stack can be extracted - */ - @Override - default boolean canExtract(int slot, ItemStack stack, Direction side) { - return true; - } - - // Inventory - - /** - * Returns the inventory size. - * - * <p>The default implementation returns the size of {@link #getItems()}. - * - * @return the inventory size - */ - @Override - default int size() { - return getItems().size(); - } - - /** - * @return true if this inventory has only empty stacks, false otherwise - */ - @Override - default boolean isEmpty() { - for (int i = 0; i < size(); i++) { - ItemStack stack = getStack(i); - if (!stack.isEmpty()) { - return false; - } - } - - return true; - } - - /** - * Gets the item in the slot. - * - * @param slot the slot - * @return the item in the slot - */ - @Override - default ItemStack getStack(int slot) { - return getItems().get(slot); - } - - /** - * Takes a stack of the size from the slot. - * - * <p>(default implementation) If there are less items in the slot than what are requested, - * takes all items in that slot. - * - * @param slot the slot - * @param count the item count - * @return a stack - */ - @Override - default ItemStack removeStack(int slot, int count) { - ItemStack result = Inventories.splitStack(getItems(), slot, count); - if (!result.isEmpty()) { - markDirty(); - } - - return result; - } - - /** - * Removes the current stack in the {@code slot} and returns it. - * - * <p>The default implementation uses {@link Inventories#removeStack(List, int)} - * - * @param slot the slot - * @return the removed stack - */ - @Override - default ItemStack removeStack(int slot) { - return Inventories.removeStack(getItems(), slot); - } - - /** - * Replaces the current stack in the {@code slot} with the provided stack. - * - * <p>If the stack is too big for this inventory ({@link Inventory#getMaxCountPerStack()} ()}), - * it gets resized to this inventory's maximum amount. - * - * @param slot the slot - * @param stack the stack - */ - @Override - default void setStack(int slot, ItemStack stack) { - getItems().set(slot, stack); - if (stack.getCount() > getMaxCountPerStack()) { - stack.setCount(getMaxCountPerStack()); - } - } - - /** - * Clears {@linkplain #getItems() the item list}}. - */ - @Override - default void clear() { - getItems().clear(); - } - - @Override - default void markDirty() { - // Override if you want behavior. - } - - @Override - default boolean canPlayerUse(PlayerEntity player) { - return true; - } -} diff --git a/src/testMod/java/io/github/cottonmc/test/LibGuiTest.java b/src/testMod/java/io/github/cottonmc/test/LibGuiTest.java deleted file mode 100644 index 1d48daa..0000000 --- a/src/testMod/java/io/github/cottonmc/test/LibGuiTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package io.github.cottonmc.test; - -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType; -import net.fabricmc.loader.api.FabricLoader; -import net.fabricmc.loader.api.ModContainer; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.StackReference; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.resource.featuretoggle.FeatureFlags; -import net.minecraft.resource.featuretoggle.FeatureSet; -import net.minecraft.screen.ScreenHandlerContext; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.util.Identifier; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Optional; - -public class LibGuiTest implements ModInitializer { - public static final String MODID = "libgui-test"; - - public static GuiBlock GUI_BLOCK; - public static Block NO_BLOCK_INVENTORY_BLOCK; - public static BlockItem GUI_BLOCK_ITEM; - public static BlockEntityType<GuiBlockEntity> GUI_BLOCKENTITY_TYPE; - public static ScreenHandlerType<TestDescription> GUI_SCREEN_HANDLER_TYPE; - public static ScreenHandlerType<TestItemDescription> ITEM_SCREEN_HANDLER_TYPE; - public static ScreenHandlerType<ReallySimpleDescription> REALLY_SIMPLE_SCREEN_HANDLER_TYPE; - - @Override - public void onInitialize() { - Registry.register(Registries.ITEM, new Identifier(MODID, "client_gui"), new GuiItem()); - - GUI_BLOCK = new GuiBlock(); - Registry.register(Registries.BLOCK, new Identifier(MODID, "gui"), GUI_BLOCK); - GUI_BLOCK_ITEM = new BlockItem(GUI_BLOCK, new Item.Settings()); - Registry.register(Registries.ITEM, new Identifier(MODID, "gui"), GUI_BLOCK_ITEM); - NO_BLOCK_INVENTORY_BLOCK = new NoBlockInventoryBlock(AbstractBlock.Settings.copy(Blocks.STONE)); - Registry.register(Registries.BLOCK, new Identifier(MODID, "no_block_inventory"), NO_BLOCK_INVENTORY_BLOCK); - Registry.register(Registries.ITEM, new Identifier(MODID, "no_block_inventory"), new BlockItem(NO_BLOCK_INVENTORY_BLOCK, new Item.Settings())); - GUI_BLOCKENTITY_TYPE = FabricBlockEntityTypeBuilder.create(GuiBlockEntity::new, GUI_BLOCK).build(null); - Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(MODID, "gui"), GUI_BLOCKENTITY_TYPE); - - GUI_SCREEN_HANDLER_TYPE = new ScreenHandlerType<>((int syncId, PlayerInventory inventory) -> { - return new TestDescription(GUI_SCREEN_HANDLER_TYPE, syncId, inventory, ScreenHandlerContext.EMPTY); - }, FeatureSet.of(FeatureFlags.VANILLA)); - Registry.register(Registries.SCREEN_HANDLER, new Identifier(MODID, "gui"), GUI_SCREEN_HANDLER_TYPE); - ITEM_SCREEN_HANDLER_TYPE = new ExtendedScreenHandlerType<>((syncId, inventory, buf) -> { - var equipmentSlot = buf.readEnumConstant(EquipmentSlot.class); - StackReference handStack = StackReference.of(inventory.player, equipmentSlot); - return new TestItemDescription(syncId, inventory, handStack); - }); - Registry.register(Registries.SCREEN_HANDLER, new Identifier(MODID, "item_gui"), ITEM_SCREEN_HANDLER_TYPE); - - REALLY_SIMPLE_SCREEN_HANDLER_TYPE = new ScreenHandlerType<>(ReallySimpleDescription::new, FeatureSet.of(FeatureFlags.VANILLA)); - Registry.register(Registries.SCREEN_HANDLER, new Identifier(MODID, "really_simple"), REALLY_SIMPLE_SCREEN_HANDLER_TYPE); - - Optional<ModContainer> containerOpt = FabricLoader.getInstance().getModContainer("jankson"); - if (containerOpt.isPresent()) { - ModContainer jankson = containerOpt.get(); - System.out.println("Jankson root path: "+jankson.getRootPath()); - try { - Files.list(jankson.getRootPath()).forEach((path)->{ - path.getFileSystem().getFileStores().forEach((store)->{ - System.out.println(" Filestore: "+store.name()); - }); - System.out.println(" "+path.toAbsolutePath()); - }); - } catch (IOException e) { - e.printStackTrace(); - } - Path modJson = jankson.getPath("/fabric.mod.json"); - System.out.println("Jankson fabric.mod.json path: "+modJson); - System.out.println(Files.exists(modJson) ? "Exists" : "Does Not Exist"); - } else { - System.out.println("Container isn't present!"); - } - } - -} diff --git a/src/testMod/java/io/github/cottonmc/test/NoBlockInventoryBlock.java b/src/testMod/java/io/github/cottonmc/test/NoBlockInventoryBlock.java deleted file mode 100644 index 2b784a6..0000000 --- a/src/testMod/java/io/github/cottonmc/test/NoBlockInventoryBlock.java +++ /dev/null @@ -1,39 +0,0 @@ -package io.github.cottonmc.test; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import org.jetbrains.annotations.Nullable; - -public class NoBlockInventoryBlock extends Block implements NamedScreenHandlerFactory { - public NoBlockInventoryBlock(Settings settings) { - super(settings); - } - - @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - player.openHandledScreen(this); - return world.isClient ? ActionResult.SUCCESS : ActionResult.CONSUME; - } - - @Override - public Text getDisplayName() { - return getName(); - } - - @Nullable - @Override - public ScreenHandler createMenu(int syncId, PlayerInventory inv, PlayerEntity player) { - return new ReallySimpleDescription(syncId, inv); - } -} diff --git a/src/testMod/java/io/github/cottonmc/test/ReallySimpleDescription.java b/src/testMod/java/io/github/cottonmc/test/ReallySimpleDescription.java deleted file mode 100644 index bcb9213..0000000 --- a/src/testMod/java/io/github/cottonmc/test/ReallySimpleDescription.java +++ /dev/null @@ -1,16 +0,0 @@ -package io.github.cottonmc.test; - -import net.minecraft.entity.player.PlayerInventory; - -import io.github.cottonmc.cotton.gui.SyncedGuiDescription; -import io.github.cottonmc.cotton.gui.widget.WGridPanel; - -// A really simple GUI description that only contains a player inventory panel. -public class ReallySimpleDescription extends SyncedGuiDescription { - public ReallySimpleDescription(int syncId, PlayerInventory playerInventory) { - super(LibGuiTest.REALLY_SIMPLE_SCREEN_HANDLER_TYPE, syncId, playerInventory); - setTitleVisible(false); - ((WGridPanel) getRootPanel()).add(createPlayerInventoryPanel(), 0, 0); - getRootPanel().validate(this); - } -} diff --git a/src/testMod/java/io/github/cottonmc/test/TestDescription.java b/src/testMod/java/io/github/cottonmc/test/TestDescription.java deleted file mode 100644 index 7c24610..0000000 --- a/src/testMod/java/io/github/cottonmc/test/TestDescription.java +++ /dev/null @@ -1,78 +0,0 @@ -package io.github.cottonmc.test; - -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.Items; -import net.minecraft.screen.ScreenHandlerContext; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; - -import io.github.cottonmc.cotton.gui.SyncedGuiDescription; -import io.github.cottonmc.cotton.gui.networking.NetworkSide; -import io.github.cottonmc.cotton.gui.networking.Scr |
