Temporarily remove the dynamic gui system until i have the energy to properly implement it
This commit is contained in:
parent
be1f961175
commit
a989d1fe65
7 changed files with 71 additions and 61 deletions
|
@ -5,5 +5,5 @@ org.gradle.daemon=false
|
|||
|
||||
mc_version=1.18.2
|
||||
forge_version=40.2.1
|
||||
myversion=1.0.5.0228232222
|
||||
myversion=1.0.5.0302231748
|
||||
parchment_version=2022.11.06
|
|
@ -1,17 +1,25 @@
|
|||
package dev.zontreck.libzontreck.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
import dev.zontreck.libzontreck.dynamicchest.ChestGuiContainer;
|
||||
import dev.zontreck.libzontreck.util.heads.CreditsEntry;
|
||||
import dev.zontreck.libzontreck.util.heads.HeadCache;
|
||||
import dev.zontreck.libzontreck.util.heads.HeadUtilities;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.PlayerHeadItem;
|
||||
|
||||
public class CreditsCommand {
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatch)
|
||||
{
|
||||
dispatch.register(Commands.literal("aria_credits").executes(s->credits(s.getSource())));
|
||||
dispatch.register(Commands.literal("credits_ariasmods").executes(s->credits(s.getSource())));
|
||||
}
|
||||
|
||||
private static int credits(CommandSourceStack source) {
|
||||
|
@ -19,7 +27,7 @@ public class CreditsCommand {
|
|||
if(source.getEntity() instanceof Player)
|
||||
{
|
||||
// OK.
|
||||
ServerPlayer play = (ServerPlayer)source.getEntity();
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
package dev.zontreck.libzontreck.dynamicchest;
|
||||
|
||||
import dev.zontreck.libzontreck.networking.structures.OpenGUIRequest;
|
||||
import dev.zontreck.libzontreck.types.ModMenuTypes;
|
||||
import net.minecraft.core.BlockPos;
|
||||
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.Slot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class ChestGuiMenu extends AbstractContainerMenu
|
||||
{
|
||||
public final Player player;
|
||||
|
||||
public ChestGuiMenu(int id, Inventory player)
|
||||
{
|
||||
this(id, player, new ItemStackHandler(36), BlockPos.ZERO, player.player, null);
|
||||
}
|
||||
|
||||
public ChestGuiMenu(int id, Inventory player, IItemHandler handler, BlockPos pos, Player play, OpenGUIRequest request)
|
||||
{
|
||||
super(ModMenuTypes.CHESTGUI.get(), id);
|
||||
this.player=play;
|
||||
|
||||
int slotSize=18;
|
||||
int startX=11;
|
||||
int startY=11;
|
||||
|
||||
for(int row=0; row<4; row++)
|
||||
{
|
||||
for(int column = 0; column<9;column++)
|
||||
{
|
||||
addSlot(new SlotItemHandler(handler, row * 9 + column, startX + column * slotSize, startY + row * slotSize));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stillValid(Player pPlayer) {
|
||||
return true; // This is dynamic. We have no block entity!
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package dev.zontreck.libzontreck.dynamicchest;
|
||||
|
||||
public class ChestGuiScreen {
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package dev.zontreck.libzontreck.dynamicchest;
|
||||
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
public class ReadOnlyItemStackHandler extends ItemStackHandler
|
||||
{
|
||||
private final ItemStackHandler slot;
|
||||
private Runnable onClick;
|
||||
protected ReadOnlyItemStackHandler(ItemStackHandler item)
|
||||
{
|
||||
super();
|
||||
slot=item;
|
||||
}
|
||||
|
||||
public ReadOnlyItemStackHandler(ItemStackHandler item, Runnable onClick)
|
||||
{
|
||||
this(item);
|
||||
this.onClick=onClick;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSize(int size)
|
||||
{
|
||||
stacks = NonNullList.<ItemStack>withSize(size, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStackInSlot(int num, ItemStack stack) {
|
||||
slot.setStackInSlot(num, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlots() {
|
||||
return slot.getSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int num) {
|
||||
return slot.getStackInSlot(num);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(int num, int amount, boolean simulate) {
|
||||
if(onClick != null){
|
||||
onClick.run();
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
|
@ -6,9 +6,7 @@ import java.util.UUID;
|
|||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class OpenGUIRequest {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package dev.zontreck.libzontreck.types;
|
||||
|
||||
import dev.zontreck.libzontreck.LibZontreck;
|
||||
import dev.zontreck.libzontreck.dynamicchest.ChestGuiMenu;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraftforge.common.extensions.IForgeMenuType;
|
||||
|
@ -14,8 +13,6 @@ import net.minecraftforge.registries.RegistryObject;
|
|||
public class ModMenuTypes {
|
||||
public static DeferredRegister<MenuType<?>> REGISTER = DeferredRegister.create(ForgeRegistries.CONTAINERS, LibZontreck.MOD_ID);
|
||||
|
||||
public static final RegistryObject<MenuType<ChestGuiMenu>> CHESTGUI = REGISTER.register("dynchest", ()->new MenuType<>(ChestGuiMenu::new));
|
||||
|
||||
public static void register(IEventBus bus)
|
||||
{
|
||||
REGISTER.register(bus);
|
||||
|
|
Reference in a new issue