mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-14 01:33:47 +01:00
Renaming I
- Container -> Menu
This commit is contained in:
parent
3b4375f002
commit
624b2d71d1
56 changed files with 229 additions and 230 deletions
|
@ -1,20 +1,20 @@
|
|||
package com.simibubi.create;
|
||||
|
||||
import com.simibubi.create.content.curiosities.toolbox.ToolboxContainer;
|
||||
import com.simibubi.create.content.curiosities.toolbox.ToolboxMenu;
|
||||
import com.simibubi.create.content.curiosities.toolbox.ToolboxScreen;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintContainer;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintMenu;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintScreen;
|
||||
import com.simibubi.create.content.logistics.item.LinkedControllerContainer;
|
||||
import com.simibubi.create.content.logistics.item.LinkedControllerMenu;
|
||||
import com.simibubi.create.content.logistics.item.LinkedControllerScreen;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterMenu;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterScreen;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterContainer;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterMenu;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterScreen;
|
||||
import com.simibubi.create.content.logistics.trains.management.schedule.ScheduleContainer;
|
||||
import com.simibubi.create.content.logistics.trains.management.schedule.ScheduleMenu;
|
||||
import com.simibubi.create.content.logistics.trains.management.schedule.ScheduleScreen;
|
||||
import com.simibubi.create.content.schematics.block.SchematicTableContainer;
|
||||
import com.simibubi.create.content.schematics.block.SchematicTableMenu;
|
||||
import com.simibubi.create.content.schematics.block.SchematicTableScreen;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonContainer;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonMenu;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonScreen;
|
||||
import com.tterrag.registrate.builders.MenuBuilder.ForgeMenuFactory;
|
||||
import com.tterrag.registrate.builders.MenuBuilder.ScreenFactory;
|
||||
|
@ -25,31 +25,31 @@ import net.minecraft.client.gui.screens.Screen;
|
|||
import net.minecraft.client.gui.screens.inventory.MenuAccess;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
|
||||
public class AllContainerTypes {
|
||||
public class AllMenuTypes {
|
||||
|
||||
public static final MenuEntry<SchematicTableContainer> SCHEMATIC_TABLE =
|
||||
register("schematic_table", SchematicTableContainer::new, () -> SchematicTableScreen::new);
|
||||
public static final MenuEntry<SchematicTableMenu> SCHEMATIC_TABLE =
|
||||
register("schematic_table", SchematicTableMenu::new, () -> SchematicTableScreen::new);
|
||||
|
||||
public static final MenuEntry<SchematicannonContainer> SCHEMATICANNON =
|
||||
register("schematicannon", SchematicannonContainer::new, () -> SchematicannonScreen::new);
|
||||
public static final MenuEntry<SchematicannonMenu> SCHEMATICANNON =
|
||||
register("schematicannon", SchematicannonMenu::new, () -> SchematicannonScreen::new);
|
||||
|
||||
public static final MenuEntry<FilterContainer> FILTER =
|
||||
register("filter", FilterContainer::new, () -> FilterScreen::new);
|
||||
public static final MenuEntry<FilterMenu> FILTER =
|
||||
register("filter", FilterMenu::new, () -> FilterScreen::new);
|
||||
|
||||
public static final MenuEntry<AttributeFilterContainer> ATTRIBUTE_FILTER =
|
||||
register("attribute_filter", AttributeFilterContainer::new, () -> AttributeFilterScreen::new);
|
||||
public static final MenuEntry<AttributeFilterMenu> ATTRIBUTE_FILTER =
|
||||
register("attribute_filter", AttributeFilterMenu::new, () -> AttributeFilterScreen::new);
|
||||
|
||||
public static final MenuEntry<BlueprintContainer> CRAFTING_BLUEPRINT =
|
||||
register("crafting_blueprint", BlueprintContainer::new, () -> BlueprintScreen::new);
|
||||
public static final MenuEntry<BlueprintMenu> CRAFTING_BLUEPRINT =
|
||||
register("crafting_blueprint", BlueprintMenu::new, () -> BlueprintScreen::new);
|
||||
|
||||
public static final MenuEntry<LinkedControllerContainer> LINKED_CONTROLLER =
|
||||
register("linked_controller", LinkedControllerContainer::new, () -> LinkedControllerScreen::new);
|
||||
public static final MenuEntry<LinkedControllerMenu> LINKED_CONTROLLER =
|
||||
register("linked_controller", LinkedControllerMenu::new, () -> LinkedControllerScreen::new);
|
||||
|
||||
public static final MenuEntry<ToolboxContainer> TOOLBOX =
|
||||
register("toolbox", ToolboxContainer::new, () -> ToolboxScreen::new);
|
||||
public static final MenuEntry<ToolboxMenu> TOOLBOX =
|
||||
register("toolbox", ToolboxMenu::new, () -> ToolboxScreen::new);
|
||||
|
||||
public static final MenuEntry<ScheduleContainer> SCHEDULE =
|
||||
register("schedule", ScheduleContainer::new, () -> ScheduleScreen::new);
|
||||
public static final MenuEntry<ScheduleMenu> SCHEDULE =
|
||||
register("schedule", ScheduleMenu::new, () -> ScheduleScreen::new);
|
||||
|
||||
private static <C extends AbstractContainerMenu, S extends Screen & MenuAccess<C>> MenuEntry<C> register(
|
||||
String name, ForgeMenuFactory<C> factory, NonNullSupplier<ScreenFactory<C, S>> screenFactory) {
|
|
@ -109,7 +109,7 @@ public class Create {
|
|||
AllItems.register();
|
||||
AllFluids.register();
|
||||
AllPaletteBlocks.register();
|
||||
AllContainerTypes.register();
|
||||
AllMenuTypes.register();
|
||||
AllEntityTypes.register();
|
||||
AllTileEntities.register();
|
||||
AllEnchantments.register();
|
||||
|
|
|
@ -360,10 +360,10 @@ public class ConnectivityHandler {
|
|||
}
|
||||
}
|
||||
|
||||
if (be instanceof IMultiTileContainer.Inventory iinv && iinv.hasInventory())
|
||||
if (be instanceof IMultiTileContainer.Inventory inv && inv.hasInventory())
|
||||
be.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
||||
.invalidate();
|
||||
if (be instanceof IMultiTileContainer.Fluid ifluid && ifluid.hasTank())
|
||||
if (be instanceof IMultiTileContainer.Fluid fluid && fluid.hasTank())
|
||||
be.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
|
||||
.invalidate();
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import javax.annotation.ParametersAreNonnullByDefault;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintAssignCompleteRecipePacket;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintContainer;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintMenu;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
|
||||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
|
||||
|
@ -17,11 +17,11 @@ import net.minecraft.world.item.crafting.CraftingRecipe;
|
|||
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
public class BlueprintTransferHandler implements IRecipeTransferHandler<BlueprintContainer, CraftingRecipe> {
|
||||
public class BlueprintTransferHandler implements IRecipeTransferHandler<BlueprintMenu, CraftingRecipe> {
|
||||
|
||||
@Override
|
||||
public Class<BlueprintContainer> getContainerClass() {
|
||||
return BlueprintContainer.class;
|
||||
public Class<BlueprintMenu> getContainerClass() {
|
||||
return BlueprintMenu.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,7 @@ public class BlueprintTransferHandler implements IRecipeTransferHandler<Blueprin
|
|||
}
|
||||
|
||||
@Override
|
||||
public @Nullable IRecipeTransferError transferRecipe(BlueprintContainer container, CraftingRecipe craftingRecipe, IRecipeSlotsView recipeSlots, Player player, boolean maxTransfer, boolean doTransfer) {
|
||||
public @Nullable IRecipeTransferError transferRecipe(BlueprintMenu menu, CraftingRecipe craftingRecipe, IRecipeSlotsView recipeSlots, Player player, boolean maxTransfer, boolean doTransfer) {
|
||||
if (!doTransfer)
|
||||
return null;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ import com.simibubi.create.foundation.config.AllConfigs;
|
|||
import com.simibubi.create.foundation.config.CRecipes;
|
||||
import com.simibubi.create.foundation.config.ConfigBase.ConfigBool;
|
||||
import com.simibubi.create.foundation.data.recipe.LogStrippingFakeRecipes;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.recipe.IRecipeTypeInfo;
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import java.util.List;
|
|||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterScreen;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemContainer;
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemSubmitPacket;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemMenu;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemSubmitPacket;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
|
||||
import mezz.jei.api.gui.handlers.IGhostIngredientHandler;
|
||||
|
@ -19,7 +19,7 @@ import net.minecraft.world.item.ItemStack;
|
|||
|
||||
@MethodsReturnNonnullByDefault
|
||||
@ParametersAreNonnullByDefault
|
||||
public class GhostIngredientHandler<T extends GhostItemContainer<?>>
|
||||
public class GhostIngredientHandler<T extends GhostItemMenu<?>>
|
||||
implements IGhostIngredientHandler<AbstractSimiContainerScreen<T>> {
|
||||
|
||||
@Override
|
||||
|
@ -52,7 +52,7 @@ public class GhostIngredientHandler<T extends GhostItemContainer<?>>
|
|||
return true;
|
||||
}
|
||||
|
||||
private static class GhostTarget<I, T extends GhostItemContainer<?>> implements Target<I> {
|
||||
private static class GhostTarget<I, T extends GhostItemMenu<?>> implements Target<I> {
|
||||
|
||||
private final Rect2i area;
|
||||
private final AbstractSimiContainerScreen<T> gui;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.compat.jei;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
|
||||
import mezz.jei.api.gui.handlers.IGuiContainerHandler;
|
||||
import net.minecraft.client.renderer.Rect2i;
|
||||
|
|
|
@ -49,13 +49,13 @@ public class MovedDefaultDispenseItemBehaviour implements IMovedDispenseItemBeha
|
|||
facingVec.normalize();
|
||||
|
||||
Direction closestToFacing = getClosestFacingDirection(facingVec);
|
||||
Container iinventory = HopperBlockEntity.getContainerAt(context.world, pos.relative(closestToFacing));
|
||||
if (iinventory == null) {
|
||||
Container inventory = HopperBlockEntity.getContainerAt(context.world, pos.relative(closestToFacing));
|
||||
if (inventory == null) {
|
||||
this.playDispenseSound(context.world, pos);
|
||||
this.spawnDispenseParticles(context.world, pos, closestToFacing);
|
||||
return this.dispenseStack(itemStack, context, pos, facingVec);
|
||||
} else {
|
||||
if (HopperBlockEntity.addItem(null, iinventory, itemStack.copy()
|
||||
if (HopperBlockEntity.addItem(null, inventory, itemStack.copy()
|
||||
.split(1), closestToFacing.getOpposite())
|
||||
.isEmpty())
|
||||
itemStack.shrink(1);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class DeployerFakePlayer extends FakePlayer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public OptionalInt openMenu(MenuProvider container) {
|
||||
public OptionalInt openMenu(MenuProvider menuProvider) {
|
||||
return OptionalInt.empty();
|
||||
}
|
||||
|
||||
|
|
|
@ -141,16 +141,16 @@ public class DeployerMovementBehaviour implements MovementBehaviour {
|
|||
ItemStack contextStack = requiredItems.isEmpty() ? ItemStack.EMPTY : requiredItems.get(0).stack;
|
||||
|
||||
if (!context.contraption.hasUniversalCreativeCrate) {
|
||||
IItemHandler iItemHandler = context.contraption.getSharedInventory();
|
||||
IItemHandler itemHandler = context.contraption.getSharedInventory();
|
||||
for (ItemRequirement.StackRequirement required : requiredItems) {
|
||||
ItemStack stack= ItemHelper
|
||||
.extract(iItemHandler, required::matches, ExtractionCountMode.EXACTLY,
|
||||
.extract(itemHandler, required::matches, ExtractionCountMode.EXACTLY,
|
||||
required.stack.getCount(), true);
|
||||
if (stack.isEmpty())
|
||||
return;
|
||||
}
|
||||
for (ItemRequirement.StackRequirement required : requiredItems)
|
||||
contextStack = ItemHelper.extract(iItemHandler, required::matches,
|
||||
contextStack = ItemHelper.extract(itemHandler, required::matches,
|
||||
ExtractionCountMode.EXACTLY, required.stack.getCount(), false);
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ public class ToolboxBlock extends HorizontalDirectionalBlock implements SimpleWa
|
|||
return InteractionResult.SUCCESS;
|
||||
|
||||
withTileEntityDo(world, pos,
|
||||
toolbox -> NetworkHooks.openGui((ServerPlayer) player, toolbox, toolbox::sendToContainer));
|
||||
toolbox -> NetworkHooks.openGui((ServerPlayer) player, toolbox, toolbox::sendToMenu));
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.simibubi.create.content.curiosities.toolbox;
|
|||
|
||||
import static com.simibubi.create.content.curiosities.toolbox.ToolboxInventory.STACKS_PER_COMPARTMENT;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.foundation.gui.container.ContainerBase;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
import com.simibubi.create.foundation.gui.menu.MenuBase;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
@ -19,19 +19,19 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class ToolboxContainer extends ContainerBase<ToolboxTileEntity> {
|
||||
public class ToolboxMenu extends MenuBase<ToolboxTileEntity> {
|
||||
|
||||
public ToolboxContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
public ToolboxMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
public ToolboxContainer(MenuType<?> type, int id, Inventory inv, ToolboxTileEntity te) {
|
||||
public ToolboxMenu(MenuType<?> type, int id, Inventory inv, ToolboxTileEntity te) {
|
||||
super(type, id, inv, te);
|
||||
te.startOpen(player);
|
||||
}
|
||||
|
||||
public static ToolboxContainer create(int id, Inventory inv, ToolboxTileEntity te) {
|
||||
return new ToolboxContainer(AllContainerTypes.TOOLBOX.get(), id, inv, te);
|
||||
public static ToolboxMenu create(int id, Inventory inv, ToolboxTileEntity te) {
|
||||
return new ToolboxMenu(AllMenuTypes.TOOLBOX.get(), id, inv, te);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -11,8 +11,8 @@ import com.simibubi.create.AllBlockPartials;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
@ -25,7 +25,7 @@ import net.minecraft.world.inventory.Slot;
|
|||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class ToolboxScreen extends AbstractSimiContainerScreen<ToolboxContainer> {
|
||||
public class ToolboxScreen extends AbstractSimiContainerScreen<ToolboxMenu> {
|
||||
|
||||
protected static final AllGuiTextures BG = AllGuiTextures.TOOLBOX;
|
||||
protected static final AllGuiTextures PLAYER = AllGuiTextures.PLAYER_INVENTORY;
|
||||
|
@ -37,8 +37,8 @@ public class ToolboxScreen extends AbstractSimiContainerScreen<ToolboxContainer>
|
|||
|
||||
private List<Rect2i> extraAreas = Collections.emptyList();
|
||||
|
||||
public ToolboxScreen(ToolboxContainer container, Inventory inv, Component title) {
|
||||
super(container, inv, title);
|
||||
public ToolboxScreen(ToolboxMenu menu, Inventory inv, Component title) {
|
||||
super(menu, inv, title);
|
||||
init();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@ import net.minecraftforge.items.SlotItemHandler;
|
|||
|
||||
public class ToolboxSlot extends SlotItemHandler {
|
||||
|
||||
private ToolboxContainer toolboxMenu;
|
||||
private ToolboxMenu toolboxMenu;
|
||||
|
||||
public ToolboxSlot(ToolboxContainer container, IItemHandler itemHandler, int index, int xPosition, int yPosition) {
|
||||
public ToolboxSlot(ToolboxMenu menu, IItemHandler itemHandler, int index, int xPosition, int yPosition) {
|
||||
super(itemHandler, index, xPosition, yPosition);
|
||||
this.toolboxMenu = container;
|
||||
this.toolboxMenu = menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -203,8 +203,8 @@ public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider,
|
|||
}
|
||||
|
||||
private boolean isOpenInContainer(Player player) {
|
||||
return player.containerMenu instanceof ToolboxContainer
|
||||
&& ((ToolboxContainer) player.containerMenu).contentHolder == this;
|
||||
return player.containerMenu instanceof ToolboxMenu
|
||||
&& ((ToolboxMenu) player.containerMenu).contentHolder == this;
|
||||
}
|
||||
|
||||
public void unequipTracked() {
|
||||
|
@ -309,7 +309,7 @@ public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider,
|
|||
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) {
|
||||
return ToolboxContainer.create(id, inv, this);
|
||||
return ToolboxMenu.create(id, inv, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -330,8 +330,8 @@ public class ToolboxTileEntity extends SmartTileEntity implements MenuProvider,
|
|||
openCount = 0;
|
||||
|
||||
for (Player playerentity : level.getEntitiesOfClass(Player.class, new AABB(worldPosition).inflate(8)))
|
||||
if (playerentity.containerMenu instanceof ToolboxContainer
|
||||
&& ((ToolboxContainer) playerentity.containerMenu).contentHolder == this)
|
||||
if (playerentity.containerMenu instanceof ToolboxMenu
|
||||
&& ((ToolboxMenu) playerentity.containerMenu).contentHolder == this)
|
||||
openCount++;
|
||||
|
||||
if (prevOpenCount != openCount)
|
||||
|
|
|
@ -34,8 +34,8 @@ public class BlueprintAssignCompleteRecipePacket extends SimplePacketBase {
|
|||
.getSender();
|
||||
if (player == null)
|
||||
return;
|
||||
if (player.containerMenu instanceof BlueprintContainer) {
|
||||
BlueprintContainer c = (BlueprintContainer) player.containerMenu;
|
||||
if (player.containerMenu instanceof BlueprintMenu) {
|
||||
BlueprintMenu c = (BlueprintMenu) player.containerMenu;
|
||||
player.getLevel()
|
||||
.getRecipeManager()
|
||||
.byKey(recipeID)
|
||||
|
|
|
@ -538,7 +538,7 @@ public class BlueprintEntity extends HangingEntity
|
|||
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) {
|
||||
return BlueprintContainer.create(id, inv, this);
|
||||
return BlueprintMenu.create(id, inv, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.curiosities.tools;
|
|||
import java.util.Collection;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterMenu.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||
import com.simibubi.create.content.logistics.item.filter.ItemAttribute;
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.simibubi.create.content.curiosities.tools;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintSection;
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemContainer;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemMenu;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
|
@ -25,18 +25,18 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class BlueprintContainer extends GhostItemContainer<BlueprintSection> {
|
||||
public class BlueprintMenu extends GhostItemMenu<BlueprintSection> {
|
||||
|
||||
public BlueprintContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
public BlueprintMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
public BlueprintContainer(MenuType<?> type, int id, Inventory inv, BlueprintSection section) {
|
||||
public BlueprintMenu(MenuType<?> type, int id, Inventory inv, BlueprintSection section) {
|
||||
super(type, id, inv, section);
|
||||
}
|
||||
|
||||
public static BlueprintContainer create(int id, Inventory inv, BlueprintSection section) {
|
||||
return new BlueprintContainer(AllContainerTypes.CRAFTING_BLUEPRINT.get(), id, inv, section);
|
||||
public static BlueprintMenu create(int id, Inventory inv, BlueprintSection section) {
|
||||
return new BlueprintMenu(AllMenuTypes.CRAFTING_BLUEPRINT.get(), id, inv, section);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,8 +141,8 @@ public class BlueprintContainer extends GhostItemContainer<BlueprintSection> {
|
|||
|
||||
static class BlueprintCraftingInventory extends CraftingContainer {
|
||||
|
||||
public BlueprintCraftingInventory(AbstractContainerMenu container, ItemStackHandler items) {
|
||||
super(container, 3, 3);
|
||||
public BlueprintCraftingInventory(AbstractContainerMenu menu, ItemStackHandler items) {
|
||||
super(menu, 3, 3);
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
ItemStack stack = items.getStackInSlot(y * 3 + x);
|
|
@ -13,7 +13,7 @@ import com.simibubi.create.AllBlocks;
|
|||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintCraftingInventory;
|
||||
import com.simibubi.create.content.curiosities.tools.BlueprintEntity.BlueprintSection;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterMenu.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterItem;
|
||||
import com.simibubi.create.content.logistics.item.filter.ItemAttribute;
|
||||
import com.simibubi.create.content.logistics.trains.track.TrackPlacement.PlacementInfo;
|
||||
|
|
|
@ -13,8 +13,8 @@ import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket;
|
|||
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
@ -25,7 +25,7 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContainer> {
|
||||
public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintMenu> {
|
||||
|
||||
protected AllGuiTextures background;
|
||||
private List<Rect2i> extraAreas = Collections.emptyList();
|
||||
|
@ -33,8 +33,8 @@ public class BlueprintScreen extends AbstractSimiContainerScreen<BlueprintContai
|
|||
private IconButton resetButton;
|
||||
private IconButton confirmButton;
|
||||
|
||||
public BlueprintScreen(BlueprintContainer container, Inventory inv, Component title) {
|
||||
super(container, inv, title);
|
||||
public BlueprintScreen(BlueprintMenu menu, Inventory inv, Component title) {
|
||||
super(menu, inv, title);
|
||||
this.background = AllGuiTextures.BLUEPRINT;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ public class LinkedControllerItem extends Item implements MenuProvider {
|
|||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) {
|
||||
ItemStack heldItem = player.getMainHandItem();
|
||||
return LinkedControllerContainer.create(id, inv, heldItem);
|
||||
return LinkedControllerMenu.create(id, inv, heldItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.content.logistics.item;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemContainer;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemMenu;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
@ -12,18 +12,18 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class LinkedControllerContainer extends GhostItemContainer<ItemStack> {
|
||||
public class LinkedControllerMenu extends GhostItemMenu<ItemStack> {
|
||||
|
||||
public LinkedControllerContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
public LinkedControllerMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
public LinkedControllerContainer(MenuType<?> type, int id, Inventory inv, ItemStack filterItem) {
|
||||
public LinkedControllerMenu(MenuType<?> type, int id, Inventory inv, ItemStack filterItem) {
|
||||
super(type, id, inv, filterItem);
|
||||
}
|
||||
|
||||
public static LinkedControllerContainer create(int id, Inventory inv, ItemStack filterItem) {
|
||||
return new LinkedControllerContainer(AllContainerTypes.LINKED_CONTROLLER.get(), id, inv, filterItem);
|
||||
public static LinkedControllerMenu create(int id, Inventory inv, ItemStack filterItem) {
|
||||
return new LinkedControllerMenu(AllMenuTypes.LINKED_CONTROLLER.get(), id, inv, filterItem);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -10,8 +10,8 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import com.simibubi.create.foundation.utility.ControlsUtil;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
@ -22,7 +22,7 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedControllerContainer> {
|
||||
public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedControllerMenu> {
|
||||
|
||||
protected AllGuiTextures background;
|
||||
private List<Rect2i> extraAreas = Collections.emptyList();
|
||||
|
@ -30,8 +30,8 @@ public class LinkedControllerScreen extends AbstractSimiContainerScreen<LinkedCo
|
|||
private IconButton resetButton;
|
||||
private IconButton confirmButton;
|
||||
|
||||
public LinkedControllerScreen(LinkedControllerContainer container, Inventory inv, Component title) {
|
||||
super(container, inv, title);
|
||||
public LinkedControllerScreen(LinkedControllerMenu menu, Inventory inv, Component title) {
|
||||
super(menu, inv, title);
|
||||
this.background = AllGuiTextures.LINKED_CONTROLLER;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.logistics.item.filter;
|
||||
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemContainer;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemMenu;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
@ -11,13 +11,13 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class AbstractFilterContainer extends GhostItemContainer<ItemStack> {
|
||||
public abstract class AbstractFilterMenu extends GhostItemMenu<ItemStack> {
|
||||
|
||||
protected AbstractFilterContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
protected AbstractFilterMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
protected AbstractFilterContainer(MenuType<?> type, int id, Inventory inv, ItemStack contentHolder) {
|
||||
protected AbstractFilterMenu(MenuType<?> type, int id, Inventory inv, ItemStack contentHolder) {
|
||||
super(type, id, inv, contentHolder);
|
||||
}
|
||||
|
|
@ -11,8 +11,8 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
|||
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import com.simibubi.create.foundation.gui.widget.Indicator;
|
||||
import com.simibubi.create.foundation.gui.widget.Indicator.State;
|
||||
|
@ -25,7 +25,7 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
||||
public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> extends AbstractSimiContainerScreen<F> {
|
||||
public abstract class AbstractFilterScreen<F extends AbstractFilterMenu> extends AbstractSimiContainerScreen<F> {
|
||||
|
||||
protected AllGuiTextures background;
|
||||
private List<Rect2i> extraAreas = Collections.emptyList();
|
||||
|
@ -33,8 +33,8 @@ public abstract class AbstractFilterScreen<F extends AbstractFilterContainer> ex
|
|||
private IconButton resetButton;
|
||||
private IconButton confirmButton;
|
||||
|
||||
protected AbstractFilterScreen(F container, Inventory inv, Component title, AllGuiTextures background) {
|
||||
super(container, inv, title);
|
||||
protected AbstractFilterScreen(F menu, Inventory inv, Component title, AllGuiTextures background) {
|
||||
super(menu, inv, title);
|
||||
this.background = background;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.item.filter;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
import com.simibubi.create.foundation.utility.Components;
|
||||
import com.simibubi.create.foundation.utility.Pair;
|
||||
|
||||
|
@ -22,7 +22,7 @@ import net.minecraft.world.item.Items;
|
|||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class AttributeFilterContainer extends AbstractFilterContainer {
|
||||
public class AttributeFilterMenu extends AbstractFilterMenu {
|
||||
|
||||
public enum WhitelistMode {
|
||||
WHITELIST_DISJ, WHITELIST_CONJ, BLACKLIST;
|
||||
|
@ -31,16 +31,16 @@ public class AttributeFilterContainer extends AbstractFilterContainer {
|
|||
WhitelistMode whitelistMode;
|
||||
List<Pair<ItemAttribute, Boolean>> selectedAttributes;
|
||||
|
||||
public AttributeFilterContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
public AttributeFilterMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
public AttributeFilterContainer(MenuType<?> type, int id, Inventory inv, ItemStack stack) {
|
||||
public AttributeFilterMenu(MenuType<?> type, int id, Inventory inv, ItemStack stack) {
|
||||
super(type, id, inv, stack);
|
||||
}
|
||||
|
||||
public static AttributeFilterContainer create(int id, Inventory inv, ItemStack stack) {
|
||||
return new AttributeFilterContainer(AllContainerTypes.ATTRIBUTE_FILTER.get(), id, inv, stack);
|
||||
public static AttributeFilterMenu create(int id, Inventory inv, ItemStack stack) {
|
||||
return new AttributeFilterMenu(AllMenuTypes.ATTRIBUTE_FILTER.get(), id, inv, stack);
|
||||
}
|
||||
|
||||
public void appendSelectedAttribute(ItemAttribute itemAttribute, boolean inverted) {
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterMenu.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
|
@ -26,7 +26,7 @@ import net.minecraft.network.chat.MutableComponent;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterContainer> {
|
||||
public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterMenu> {
|
||||
|
||||
private static final String PREFIX = "gui.attribute_filter.";
|
||||
|
||||
|
@ -55,8 +55,8 @@ public class AttributeFilterScreen extends AbstractFilterScreen<AttributeFilterC
|
|||
private SelectionScrollInput attributeSelector;
|
||||
private Label attributeSelectorLabel;
|
||||
|
||||
public AttributeFilterScreen(AttributeFilterContainer container, Inventory inv, Component title) {
|
||||
super(container, inv, title, AllGuiTextures.ATTRIBUTE_FILTER);
|
||||
public AttributeFilterScreen(AttributeFilterMenu menu, Inventory inv, Component title) {
|
||||
super(menu, inv, title, AllGuiTextures.ATTRIBUTE_FILTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,7 +9,7 @@ import javax.annotation.Nonnull;
|
|||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllKeys;
|
||||
import com.simibubi.create.content.contraptions.processing.EmptyingByBasin;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterMenu.WhitelistMode;
|
||||
import com.simibubi.create.foundation.utility.Components;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
|
||||
|
@ -155,9 +155,9 @@ public class FilterItem extends Item implements MenuProvider {
|
|||
public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) {
|
||||
ItemStack heldItem = player.getMainHandItem();
|
||||
if (type == FilterType.REGULAR)
|
||||
return FilterContainer.create(id, inv, heldItem);
|
||||
return FilterMenu.create(id, inv, heldItem);
|
||||
if (type == FilterType.ATTRIBUTE)
|
||||
return AttributeFilterContainer.create(id, inv, heldItem);
|
||||
return AttributeFilterMenu.create(id, inv, heldItem);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.logistics.item.filter;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
|
@ -10,21 +10,21 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class FilterContainer extends AbstractFilterContainer {
|
||||
public class FilterMenu extends AbstractFilterMenu {
|
||||
|
||||
boolean respectNBT;
|
||||
boolean blacklist;
|
||||
|
||||
public FilterContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
public FilterMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
public FilterContainer(MenuType<?> type, int id, Inventory inv, ItemStack stack) {
|
||||
public FilterMenu(MenuType<?> type, int id, Inventory inv, ItemStack stack) {
|
||||
super(type, id, inv, stack);
|
||||
}
|
||||
|
||||
public static FilterContainer create(int id, Inventory inv, ItemStack stack) {
|
||||
return new FilterContainer(AllContainerTypes.FILTER.get(), id, inv, stack);
|
||||
public static FilterMenu create(int id, Inventory inv, ItemStack stack) {
|
||||
return new FilterMenu(AllMenuTypes.FILTER.get(), id, inv, stack);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -15,7 +15,7 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
||||
public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
|
||||
public class FilterScreen extends AbstractFilterScreen<FilterMenu> {
|
||||
|
||||
private static final String PREFIX = "gui.filter.";
|
||||
|
||||
|
@ -34,8 +34,8 @@ public class FilterScreen extends AbstractFilterScreen<FilterContainer> {
|
|||
private Indicator whitelistIndicator, blacklistIndicator;
|
||||
private Indicator respectNBTIndicator, ignoreNBTIndicator;
|
||||
|
||||
public FilterScreen(FilterContainer container, Inventory inv, Component title) {
|
||||
super(container, inv, title, AllGuiTextures.FILTER);
|
||||
public FilterScreen(FilterMenu menu, Inventory inv, Component title) {
|
||||
super(menu, inv, title, AllGuiTextures.FILTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.logistics.item.filter;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode;
|
||||
import com.simibubi.create.content.logistics.item.filter.AttributeFilterMenu.WhitelistMode;
|
||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -46,8 +46,8 @@ public class FilterScreenPacket extends SimplePacketBase {
|
|||
if (player == null)
|
||||
return;
|
||||
|
||||
if (player.containerMenu instanceof FilterContainer) {
|
||||
FilterContainer c = (FilterContainer) player.containerMenu;
|
||||
if (player.containerMenu instanceof FilterMenu) {
|
||||
FilterMenu c = (FilterMenu) player.containerMenu;
|
||||
if (option == Option.WHITELIST)
|
||||
c.blacklist = false;
|
||||
if (option == Option.BLACKLIST)
|
||||
|
@ -62,8 +62,8 @@ public class FilterScreenPacket extends SimplePacketBase {
|
|||
net.minecraft.world.item.ItemStack.of(data.getCompound("Item")));
|
||||
}
|
||||
|
||||
if (player.containerMenu instanceof AttributeFilterContainer) {
|
||||
AttributeFilterContainer c = (AttributeFilterContainer) player.containerMenu;
|
||||
if (player.containerMenu instanceof AttributeFilterMenu) {
|
||||
AttributeFilterMenu c = (AttributeFilterMenu) player.containerMenu;
|
||||
if (option == Option.WHITELIST)
|
||||
c.whitelistMode = WhitelistMode.WHITELIST_DISJ;
|
||||
if (option == Option.WHITELIST2)
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.logistics.trains.management.schedule;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
|
||||
import com.simibubi.create.content.logistics.trains.entity.CarriageContraption;
|
||||
|
@ -161,7 +161,7 @@ public class ScheduleItem extends Item implements MenuProvider {
|
|||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) {
|
||||
ItemStack heldItem = player.getMainHandItem();
|
||||
return new ScheduleContainer(AllContainerTypes.SCHEDULE.get(), id, inv, heldItem);
|
||||
return new ScheduleMenu(AllMenuTypes.SCHEDULE.get(), id, inv, heldItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.simibubi.create.content.logistics.trains.management.schedule;
|
||||
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemContainer;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemMenu;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.Container;
|
||||
|
@ -14,18 +14,18 @@ import net.minecraftforge.items.IItemHandler;
|
|||
import net.minecraftforge.items.ItemStackHandler;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class ScheduleContainer extends GhostItemContainer<ItemStack> {
|
||||
public class ScheduleMenu extends GhostItemMenu<ItemStack> {
|
||||
|
||||
public boolean slotsActive = true;
|
||||
public int targetSlotsActive = 1;
|
||||
|
||||
static final int slots = 2;
|
||||
|
||||
public ScheduleContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
public ScheduleMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
public ScheduleContainer(MenuType<?> type, int id, Inventory inv, ItemStack contentHolder) {
|
||||
public ScheduleMenu(MenuType<?> type, int id, Inventory inv, ItemStack contentHolder) {
|
||||
super(type, id, inv, contentHolder);
|
||||
}
|
||||
|
|
@ -32,9 +32,9 @@ import com.simibubi.create.foundation.gui.AllIcons;
|
|||
import com.simibubi.create.foundation.gui.ModularGuiLine;
|
||||
import com.simibubi.create.foundation.gui.ModularGuiLineBuilder;
|
||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemSubmitPacket;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemSubmitPacket;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import com.simibubi.create.foundation.gui.widget.Indicator;
|
||||
import com.simibubi.create.foundation.gui.widget.Indicator.State;
|
||||
|
@ -64,7 +64,7 @@ import net.minecraft.world.item.Items;
|
|||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.client.gui.GuiUtils;
|
||||
|
||||
public class ScheduleScreen extends AbstractSimiContainerScreen<ScheduleContainer> {
|
||||
public class ScheduleScreen extends AbstractSimiContainerScreen<ScheduleMenu> {
|
||||
|
||||
private static final int CARD_HEADER = 22;
|
||||
private static final int CARD_WIDTH = 195;
|
||||
|
@ -94,14 +94,14 @@ public class ScheduleScreen extends AbstractSimiContainerScreen<ScheduleContaine
|
|||
|
||||
private DestinationSuggestions destinationSuggestions;
|
||||
|
||||
public ScheduleScreen(ScheduleContainer container, Inventory inv, Component title) {
|
||||
super(container, inv, title);
|
||||
public ScheduleScreen(ScheduleMenu menu, Inventory inv, Component title) {
|
||||
super(menu, inv, title);
|
||||
schedule = new Schedule();
|
||||
CompoundTag tag = container.contentHolder.getOrCreateTag()
|
||||
CompoundTag tag = menu.contentHolder.getOrCreateTag()
|
||||
.getCompound("Schedule");
|
||||
if (!tag.isEmpty())
|
||||
schedule = Schedule.fromTag(tag);
|
||||
container.slotsActive = false;
|
||||
menu.slotsActive = false;
|
||||
editorSubWidgets = new ModularGuiLine();
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class SchematicTableBlock extends HorizontalDirectionalBlock implements I
|
|||
return InteractionResult.SUCCESS;
|
||||
|
||||
withTileEntityDo(worldIn, pos,
|
||||
te -> NetworkHooks.openGui((ServerPlayer) player, te, te::sendToContainer));
|
||||
te -> NetworkHooks.openGui((ServerPlayer) player, te, te::sendToMenu));
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.foundation.gui.container.ContainerBase;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
import com.simibubi.create.foundation.gui.menu.MenuBase;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
@ -15,21 +15,21 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class SchematicTableContainer extends ContainerBase<SchematicTableTileEntity> {
|
||||
public class SchematicTableMenu extends MenuBase<SchematicTableTileEntity> {
|
||||
|
||||
private Slot inputSlot;
|
||||
private Slot outputSlot;
|
||||
|
||||
public SchematicTableContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
public SchematicTableMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
public SchematicTableContainer(MenuType<?> type, int id, Inventory inv, SchematicTableTileEntity te) {
|
||||
public SchematicTableMenu(MenuType<?> type, int id, Inventory inv, SchematicTableTileEntity te) {
|
||||
super(type, id, inv, te);
|
||||
}
|
||||
|
||||
public static SchematicTableContainer create(int id, Inventory inv, SchematicTableTileEntity te) {
|
||||
return new SchematicTableContainer(AllContainerTypes.SCHEMATIC_TABLE.get(), id, inv, te);
|
||||
public static SchematicTableMenu create(int id, Inventory inv, SchematicTableTileEntity te) {
|
||||
return new SchematicTableMenu(AllMenuTypes.SCHEMATIC_TABLE.get(), id, inv, te);
|
||||
}
|
||||
|
||||
public boolean canWrite() {
|
|
@ -14,8 +14,8 @@ import com.simibubi.create.CreateClient;
|
|||
import com.simibubi.create.content.schematics.ClientSchematicLoader;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import com.simibubi.create.foundation.gui.widget.Label;
|
||||
import com.simibubi.create.foundation.gui.widget.ScrollInput;
|
||||
|
@ -30,7 +30,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicTableContainer> {
|
||||
public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicTableMenu> {
|
||||
|
||||
private final Component uploading = Lang.translateDirect("gui.schematicTable.uploading");
|
||||
private final Component finished = Lang.translateDirect("gui.schematicTable.finished");
|
||||
|
@ -55,9 +55,9 @@ public class SchematicTableScreen extends AbstractSimiContainerScreen<SchematicT
|
|||
|
||||
private List<Rect2i> extraAreas = Collections.emptyList();
|
||||
|
||||
public SchematicTableScreen(SchematicTableContainer container, Inventory playerInventory,
|
||||
public SchematicTableScreen(SchematicTableMenu menu, Inventory playerInventory,
|
||||
Component title) {
|
||||
super(container, playerInventory, title);
|
||||
super(menu, playerInventory, title);
|
||||
background = AllGuiTextures.SCHEMATIC_TABLE;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class SchematicTableTileEntity extends SmartTileEntity implements MenuPro
|
|||
uploadingProgress = 0;
|
||||
}
|
||||
|
||||
public void sendToContainer(FriendlyByteBuf buffer) {
|
||||
public void sendToMenu(FriendlyByteBuf buffer) {
|
||||
buffer.writeBlockPos(getBlockPos());
|
||||
buffer.writeNbt(getUpdateTag());
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class SchematicTableTileEntity extends SmartTileEntity implements MenuPro
|
|||
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) {
|
||||
return SchematicTableContainer.create(id, inv, this);
|
||||
return SchematicTableMenu.create(id, inv, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -51,7 +51,7 @@ public class SchematicannonBlock extends Block implements ITE<SchematicannonTile
|
|||
if (worldIn.isClientSide)
|
||||
return InteractionResult.SUCCESS;
|
||||
withTileEntityDo(worldIn, pos,
|
||||
te -> NetworkHooks.openGui((ServerPlayer) player, te, te::sendToContainer));
|
||||
te -> NetworkHooks.openGui((ServerPlayer) player, te, te::sendToMenu));
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.simibubi.create.content.schematics.block;
|
||||
|
||||
import com.simibubi.create.AllContainerTypes;
|
||||
import com.simibubi.create.foundation.gui.container.ContainerBase;
|
||||
import com.simibubi.create.AllMenuTypes;
|
||||
import com.simibubi.create.foundation.gui.menu.MenuBase;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
|
@ -14,18 +14,18 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
public class SchematicannonContainer extends ContainerBase<SchematicannonTileEntity> {
|
||||
public class SchematicannonMenu extends MenuBase<SchematicannonTileEntity> {
|
||||
|
||||
public SchematicannonContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf buffer) {
|
||||
public SchematicannonMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf buffer) {
|
||||
super(type, id, inv, buffer);
|
||||
}
|
||||
|
||||
public SchematicannonContainer(MenuType<?> type, int id, Inventory inv, SchematicannonTileEntity te) {
|
||||
public SchematicannonMenu(MenuType<?> type, int id, Inventory inv, SchematicannonTileEntity te) {
|
||||
super(type, id, inv, te);
|
||||
}
|
||||
|
||||
public static SchematicannonContainer create(int id, Inventory inv, SchematicannonTileEntity te) {
|
||||
return new SchematicannonContainer(AllContainerTypes.SCHEMATICANNON.get(), id, inv, te);
|
||||
public static SchematicannonMenu create(int id, Inventory inv, SchematicannonTileEntity te) {
|
||||
return new SchematicannonMenu(AllMenuTypes.SCHEMATICANNON.get(), id, inv, te);
|
||||
}
|
||||
|
||||
@Override
|
|
@ -16,8 +16,8 @@ import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPack
|
|||
import com.simibubi.create.content.schematics.packet.ConfigureSchematicannonPacket.Option;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import com.simibubi.create.foundation.gui.AllIcons;
|
||||
import com.simibubi.create.foundation.gui.container.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.element.GuiGameElement;
|
||||
import com.simibubi.create.foundation.gui.menu.AbstractSimiContainerScreen;
|
||||
import com.simibubi.create.foundation.gui.widget.IconButton;
|
||||
import com.simibubi.create.foundation.gui.widget.Indicator;
|
||||
import com.simibubi.create.foundation.gui.widget.Indicator.State;
|
||||
|
@ -33,7 +33,7 @@ import net.minecraft.network.chat.Component;
|
|||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class SchematicannonScreen extends AbstractSimiContainerScreen<SchematicannonContainer> {
|
||||
public class SchematicannonScreen extends AbstractSimiContainerScreen<SchematicannonMenu> {
|
||||
|
||||
private static final AllGuiTextures BG_BOTTOM = AllGuiTextures.SCHEMATICANNON_BOTTOM;
|
||||
private static final AllGuiTextures BG_TOP = AllGuiTextures.SCHEMATICANNON_TOP;
|
||||
|
@ -76,8 +76,8 @@ public class SchematicannonScreen extends AbstractSimiContainerScreen<Schematica
|
|||
|
||||
private List<Rect2i> extraAreas = Collections.emptyList();
|
||||
|
||||
public SchematicannonScreen(SchematicannonContainer container, Inventory inventory, Component title) {
|
||||
super(container, inventory, title);
|
||||
public SchematicannonScreen(SchematicannonMenu menu, Inventory inventory, Component title) {
|
||||
super(menu, inventory, title);
|
||||
placementSettingWidgets = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
|
|
@ -488,23 +488,23 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
// Find and apply damage
|
||||
if (usage == ItemUseType.DAMAGE) {
|
||||
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||
IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||
for (int slot = 0; slot < iItemHandler.getSlots(); slot++) {
|
||||
ItemStack extractItem = iItemHandler.extractItem(slot, 1, true);
|
||||
IItemHandler itemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||
for (int slot = 0; slot < itemHandler.getSlots(); slot++) {
|
||||
ItemStack extractItem = itemHandler.extractItem(slot, 1, true);
|
||||
if (!required.matches(extractItem))
|
||||
continue;
|
||||
if (!extractItem.isDamageableItem())
|
||||
continue;
|
||||
|
||||
if (!simulate) {
|
||||
ItemStack stack = iItemHandler.extractItem(slot, 1, false);
|
||||
ItemStack stack = itemHandler.extractItem(slot, 1, false);
|
||||
stack.setDamageValue(stack.getDamageValue() + 1);
|
||||
if (stack.getDamageValue() <= stack.getMaxDamage()) {
|
||||
if (iItemHandler.getStackInSlot(slot)
|
||||
if (itemHandler.getStackInSlot(slot)
|
||||
.isEmpty())
|
||||
iItemHandler.insertItem(slot, stack, false);
|
||||
itemHandler.insertItem(slot, stack, false);
|
||||
else
|
||||
ItemHandlerHelper.insertItem(iItemHandler, stack, false);
|
||||
ItemHandlerHelper.insertItem(itemHandler, stack, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,9 +519,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
boolean success = false;
|
||||
int amountFound = 0;
|
||||
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||
IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||
IItemHandler itemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||
amountFound += ItemHelper
|
||||
.extract(iItemHandler, required::matches, ExtractionCountMode.UPTO,
|
||||
.extract(itemHandler, required::matches, ExtractionCountMode.UPTO,
|
||||
required.stack.getCount(), true)
|
||||
.getCount();
|
||||
|
||||
|
@ -535,9 +535,9 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
if (!simulate && success) {
|
||||
amountFound = 0;
|
||||
for (LazyOptional<IItemHandler> cap : attachedInventories) {
|
||||
IItemHandler iItemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||
IItemHandler itemHandler = cap.orElse(EmptyHandler.INSTANCE);
|
||||
amountFound += ItemHelper
|
||||
.extract(iItemHandler, required::matches, ExtractionCountMode.UPTO,
|
||||
.extract(itemHandler, required::matches, ExtractionCountMode.UPTO,
|
||||
required.stack.getCount(), false)
|
||||
.getCount();
|
||||
if (amountFound < required.stack.getCount())
|
||||
|
@ -776,14 +776,14 @@ public class SchematicannonTileEntity extends SmartTileEntity implements MenuPro
|
|||
AllSoundEvents.SCHEMATICANNON_LAUNCH_BLOCK.playOnServer(level, worldPosition);
|
||||
}
|
||||
|
||||
public void sendToContainer(FriendlyByteBuf buffer) {
|
||||
public void sendToMenu(FriendlyByteBuf buffer) {
|
||||
buffer.writeBlockPos(getBlockPos());
|
||||
buffer.writeNbt(getUpdateTag());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractContainerMenu createMenu(int id, Inventory inv, Player player) {
|
||||
return SchematicannonContainer.create(id, inv, this);
|
||||
return SchematicannonMenu.create(id, inv, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.simibubi.create.content.schematics.packet;
|
|||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonContainer;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonMenu;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity;
|
||||
import com.simibubi.create.content.schematics.block.SchematicannonTileEntity.State;
|
||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||
|
@ -37,10 +37,10 @@ public class ConfigureSchematicannonPacket extends SimplePacketBase {
|
|||
public void handle(Supplier<Context> context) {
|
||||
context.get().enqueueWork(() -> {
|
||||
ServerPlayer player = context.get().getSender();
|
||||
if (player == null || !(player.containerMenu instanceof SchematicannonContainer))
|
||||
if (player == null || !(player.containerMenu instanceof SchematicannonMenu))
|
||||
return;
|
||||
|
||||
SchematicannonTileEntity te = ((SchematicannonContainer) player.containerMenu).contentHolder;
|
||||
SchematicannonTileEntity te = ((SchematicannonMenu) player.containerMenu).contentHolder;
|
||||
switch (option) {
|
||||
case DONT_REPLACE:
|
||||
case REPLACE_ANY:
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.schematics.packet;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.schematics.block.SchematicTableContainer;
|
||||
import com.simibubi.create.content.schematics.block.SchematicTableMenu;
|
||||
import com.simibubi.create.foundation.networking.SimplePacketBase;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -71,7 +71,7 @@ public class SchematicUploadPacket extends SimplePacketBase {
|
|||
if (player == null)
|
||||
return;
|
||||
if (code == BEGIN) {
|
||||
BlockPos pos = ((SchematicTableContainer) player.containerMenu).contentHolder
|
||||
BlockPos pos = ((SchematicTableMenu) player.containerMenu).contentHolder
|
||||
.getBlockPos();
|
||||
Create.SCHEMATIC_RECEIVER.handleNewUpload(player, schematic, size, pos);
|
||||
}
|
||||
|
|
|
@ -74,11 +74,11 @@ public abstract class ProcessingRecipeGen extends CreateRecipeProvider {
|
|||
Supplier<ItemLike> singleIngredient, UnaryOperator<ProcessingRecipeBuilder<T>> transform) {
|
||||
ProcessingRecipeSerializer<T> serializer = getSerializer();
|
||||
GeneratedRecipe generatedRecipe = c -> {
|
||||
ItemLike iItemProvider = singleIngredient.get();
|
||||
ItemLike itemLike = singleIngredient.get();
|
||||
transform
|
||||
.apply(new ProcessingRecipeBuilder<>(serializer.getFactory(),
|
||||
new ResourceLocation(namespace, RegisteredObjects.getKeyOrThrow(iItemProvider.asItem())
|
||||
.getPath())).withItemIngredients(Ingredient.of(iItemProvider)))
|
||||
new ResourceLocation(namespace, RegisteredObjects.getKeyOrThrow(itemLike.asItem())
|
||||
.getPath())).withItemIngredients(Ingredient.of(itemLike)))
|
||||
.build(c);
|
||||
};
|
||||
all.add(generatedRecipe);
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package com.simibubi.create.foundation.gui.container;
|
||||
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
|
||||
public interface IClearableContainer {
|
||||
|
||||
default void sendClearPacket() {
|
||||
AllPackets.channel.sendToServer(new ClearContainerPacket());
|
||||
}
|
||||
|
||||
public void clearContents();
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.gui.container;
|
||||
package com.simibubi.create.foundation.gui.menu;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.gui.container;
|
||||
package com.simibubi.create.foundation.gui.menu;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -8,11 +8,11 @@ import net.minecraft.network.FriendlyByteBuf;
|
|||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.network.NetworkEvent.Context;
|
||||
|
||||
public class ClearContainerPacket extends SimplePacketBase {
|
||||
public class ClearMenuPacket extends SimplePacketBase {
|
||||
|
||||
public ClearContainerPacket() {}
|
||||
public ClearMenuPacket() {}
|
||||
|
||||
public ClearContainerPacket(FriendlyByteBuf buffer) {}
|
||||
public ClearMenuPacket(FriendlyByteBuf buffer) {}
|
||||
|
||||
@Override
|
||||
public void write(FriendlyByteBuf buffer) {}
|
||||
|
@ -25,9 +25,9 @@ public class ClearContainerPacket extends SimplePacketBase {
|
|||
.getSender();
|
||||
if (player == null)
|
||||
return;
|
||||
if (!(player.containerMenu instanceof IClearableContainer))
|
||||
if (!(player.containerMenu instanceof IClearableMenu))
|
||||
return;
|
||||
((IClearableContainer) player.containerMenu).clearContents();
|
||||
((IClearableMenu) player.containerMenu).clearContents();
|
||||
});
|
||||
context.get()
|
||||
.setPacketHandled(true);
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.gui.container;
|
||||
package com.simibubi.create.foundation.gui.menu;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
@ -10,15 +10,15 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
public abstract class GhostItemContainer<T> extends ContainerBase<T> implements IClearableContainer {
|
||||
public abstract class GhostItemMenu<T> extends MenuBase<T> implements IClearableMenu {
|
||||
|
||||
public ItemStackHandler ghostInventory;
|
||||
|
||||
protected GhostItemContainer(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
protected GhostItemMenu(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id, inv, extraData);
|
||||
}
|
||||
|
||||
protected GhostItemContainer(MenuType<?> type, int id, Inventory inv, T contentHolder) {
|
||||
protected GhostItemMenu(MenuType<?> type, int id, Inventory inv, T contentHolder) {
|
||||
super(type, id, inv, contentHolder);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.gui.container;
|
||||
package com.simibubi.create.foundation.gui.menu;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -39,10 +39,9 @@ public class GhostItemSubmitPacket extends SimplePacketBase {
|
|||
if (player == null)
|
||||
return;
|
||||
|
||||
if (player.containerMenu instanceof GhostItemContainer) {
|
||||
GhostItemContainer<?> c = (GhostItemContainer<?>) player.containerMenu;
|
||||
c.ghostInventory.setStackInSlot(slot, item);
|
||||
c.getSlot(36 + slot).setChanged();
|
||||
if (player.containerMenu instanceof GhostItemMenu<?> menu) {
|
||||
menu.ghostInventory.setStackInSlot(slot, item);
|
||||
menu.getSlot(36 + slot).setChanged();
|
||||
}
|
||||
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
package com.simibubi.create.foundation.gui.menu;
|
||||
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
|
||||
public interface IClearableMenu {
|
||||
|
||||
default void sendClearPacket() {
|
||||
AllPackets.channel.sendToServer(new ClearMenuPacket());
|
||||
}
|
||||
|
||||
public void clearContents();
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.foundation.gui.container;
|
||||
package com.simibubi.create.foundation.gui.menu;
|
||||
|
||||
import com.simibubi.create.foundation.utility.IInteractionChecker;
|
||||
|
||||
|
@ -11,18 +11,18 @@ import net.minecraft.world.inventory.Slot;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class ContainerBase<T> extends AbstractContainerMenu {
|
||||
public abstract class MenuBase<T> extends AbstractContainerMenu {
|
||||
|
||||
public Player player;
|
||||
public Inventory playerInventory;
|
||||
public T contentHolder;
|
||||
|
||||
protected ContainerBase(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
protected MenuBase(MenuType<?> type, int id, Inventory inv, FriendlyByteBuf extraData) {
|
||||
super(type, id);
|
||||
init(inv, createOnClient(extraData));
|
||||
}
|
||||
|
||||
protected ContainerBase(MenuType<?> type, int id, Inventory inv, T contentHolder) {
|
||||
protected MenuBase(MenuType<?> type, int id, Inventory inv, T contentHolder) {
|
||||
super(type, id);
|
||||
init(inv, contentHolder);
|
||||
}
|
|
@ -82,8 +82,8 @@ import com.simibubi.create.content.schematics.packet.SchematicUploadPacket;
|
|||
import com.simibubi.create.foundation.command.HighlightPacket;
|
||||
import com.simibubi.create.foundation.command.SConfigureConfigPacket;
|
||||
import com.simibubi.create.foundation.config.ui.CConfigureConfigPacket;
|
||||
import com.simibubi.create.foundation.gui.container.ClearContainerPacket;
|
||||
import com.simibubi.create.foundation.gui.container.GhostItemSubmitPacket;
|
||||
import com.simibubi.create.foundation.gui.menu.ClearMenuPacket;
|
||||
import com.simibubi.create.foundation.gui.menu.GhostItemSubmitPacket;
|
||||
import com.simibubi.create.foundation.tileEntity.RemoveTileEntityPacket;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringCountUpdatePacket;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueUpdatePacket;
|
||||
|
@ -109,7 +109,7 @@ public enum AllPackets {
|
|||
PLAY_TO_SERVER),
|
||||
PLACE_SCHEMATIC(SchematicPlacePacket.class, SchematicPlacePacket::new, PLAY_TO_SERVER),
|
||||
UPLOAD_SCHEMATIC(SchematicUploadPacket.class, SchematicUploadPacket::new, PLAY_TO_SERVER),
|
||||
CLEAR_CONTAINER(ClearContainerPacket.class, ClearContainerPacket::new, PLAY_TO_SERVER),
|
||||
CLEAR_CONTAINER(ClearMenuPacket.class, ClearMenuPacket::new, PLAY_TO_SERVER),
|
||||
CONFIGURE_FILTER(FilterScreenPacket.class, FilterScreenPacket::new, PLAY_TO_SERVER),
|
||||
CONFIGURE_FILTERING_AMOUNT(FilteringCountUpdatePacket.class, FilteringCountUpdatePacket::new, PLAY_TO_SERVER),
|
||||
CONFIGURE_SCROLLABLE(ScrollValueUpdatePacket.class, ScrollValueUpdatePacket::new, PLAY_TO_SERVER),
|
||||
|
|
|
@ -221,7 +221,7 @@ public abstract class SmartTileEntity extends CachedRenderBBTileEntity implement
|
|||
worldPosition.getZ() + 0.5D) <= 64.0D;
|
||||
}
|
||||
|
||||
public void sendToContainer(FriendlyByteBuf buffer) {
|
||||
public void sendToMenu(FriendlyByteBuf buffer) {
|
||||
buffer.writeBlockPos(getBlockPos());
|
||||
buffer.writeNbt(getUpdateTag());
|
||||
}
|
||||
|
|
|
@ -24,9 +24,9 @@ import static com.simibubi.create.AllBlocks.SPEEDOMETER;
|
|||
import static com.simibubi.create.AllBlocks.STOCKPILE_SWITCH;
|
||||
import static com.simibubi.create.AllBlocks.STRESSOMETER;
|
||||
import static com.simibubi.create.AllItems.ATTRIBUTE_FILTER;
|
||||
import static com.simibubi.create.AllItems.CRAFTER_SLOT_COVER;
|
||||
import static com.simibubi.create.AllItems.COPPER_DIVING_BOOTS;
|
||||
import static com.simibubi.create.AllItems.COPPER_DIVING_HELMET;
|
||||
import static com.simibubi.create.AllItems.CRAFTER_SLOT_COVER;
|
||||
import static com.simibubi.create.AllItems.GOLDEN_SHEET;
|
||||
import static com.simibubi.create.AllItems.POWDERED_OBSIDIAN;
|
||||
import static com.simibubi.create.AllItems.SCHEMATIC;
|
||||
|
|
Loading…
Reference in a new issue