Skip to content

Commit

Permalink
Update to Minecraft 1.19.3, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Dec 11, 2022
1 parent 2aa6d47 commit e0bcfeb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
8 changes: 4 additions & 4 deletions GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package io.github.cottonmc.test;

import io.github.cottonmc.cotton.gui.client.CottonClientScreen;
import io.github.cottonmc.test.client.TestClientGui;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
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;

import io.github.cottonmc.cotton.gui.client.CottonClientScreen;
import io.github.cottonmc.test.client.TestClientGui;

public class GuiItem extends Item {

public GuiItem() {
super(new Item.Settings().group(ItemGroup.TOOLS).rarity(Rarity.EPIC));
super(new Item.Settings().rarity(Rarity.EPIC));
}

@Override
Expand Down
22 changes: 11 additions & 11 deletions GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -34,25 +34,25 @@ public class LibGuiTest implements ModInitializer {

@Override
public void onInitialize() {
Registry.register(Registry.ITEM, new Identifier(MODID, "client_gui"), new GuiItem());
Registry.register(Registries.ITEM, new Identifier(MODID, "client_gui"), new GuiItem());

GUI_BLOCK = new GuiBlock();
Registry.register(Registry.BLOCK, new Identifier(MODID, "gui"), GUI_BLOCK);
GUI_BLOCK_ITEM = new BlockItem(GUI_BLOCK, new Item.Settings().group(ItemGroup.MISC));
Registry.register(Registry.ITEM, new Identifier(MODID, "gui"), GUI_BLOCK_ITEM);
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(Registry.BLOCK, new Identifier(MODID, "no_block_inventory"), NO_BLOCK_INVENTORY_BLOCK);
Registry.register(Registry.ITEM, new Identifier(MODID, "no_block_inventory"), new BlockItem(NO_BLOCK_INVENTORY_BLOCK, new Item.Settings().group(ItemGroup.MISC)));
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(Registry.BLOCK_ENTITY_TYPE, new Identifier(MODID, "gui"), GUI_BLOCKENTITY_TYPE);
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);
});
Registry.register(Registry.SCREEN_HANDLER, new Identifier(MODID, "gui"), GUI_SCREEN_HANDLER_TYPE);
Registry.register(Registries.SCREEN_HANDLER, new Identifier(MODID, "gui"), GUI_SCREEN_HANDLER_TYPE);

REALLY_SIMPLE_SCREEN_HANDLER_TYPE = new ScreenHandlerType<>(ReallySimpleDescription::new);
Registry.register(Registry.SCREEN_HANDLER, new Identifier(MODID, "really_simple"), REALLY_SIMPLE_SCREEN_HANDLER_TYPE);
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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void addSlotPeer(ValidatedSlot slot) {
}

@Override
public ItemStack transferSlot(PlayerEntity player, int index) {
public ItemStack quickMove(PlayerEntity player, int index) {
ItemStack result = ItemStack.EMPTY;
Slot slot = slots.get(index);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public GuiDescription getDescription() {
@Override
public void init() {
super.init();
client.keyboard.setRepeatEvents(true);


WPanel root = description.getRootPanel();
if (root != null) root.addPainters();
description.addPainters();
Expand All @@ -73,7 +72,6 @@ public void init() {
@Override
public void removed() {
super.removed();
this.client.keyboard.setRepeatEvents(false);
VisualLogger.reset();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ public CottonInventoryScreen(T description, PlayerEntity player, Text title) {
@Override
public void init() {
super.init();
client.keyboard.setRepeatEvents(true);


WPanel root = description.getRootPanel();
if (root != null) root.addPainters();
description.addPainters();
Expand All @@ -108,7 +107,6 @@ public void init() {
@Override
public void removed() {
super.removed();
this.client.keyboard.setRepeatEvents(false);
VisualLogger.reset();
}

Expand Down

0 comments on commit e0bcfeb

Please sign in to comment.