net.minecraft.item.ItemGroup Java Examples

The following examples show how to use net.minecraft.item.ItemGroup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OxygenTankItem.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendStacks(ItemGroup itemGroup_1, DefaultedList<ItemStack> list) {
    if (this.isIn(itemGroup_1)) {
        list.add(applyDefaultTags(new ItemStack(this), 0));
        list.add(applyDefaultTags(new ItemStack(this), maxOxygen));
    }
}
 
Example #2
Source File: BatteryItem.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void appendStacks(ItemGroup group, DefaultedList<ItemStack> groupStacks) {
    if (this.isIn(group)) {
        ItemStack charged = new ItemStack(this);
        GalacticraftEnergy.setEnergy(charged, MAX_ENERGY);
        groupStacks.add(charged);

        ItemStack depleted = new ItemStack(this);
        GalacticraftEnergy.setEnergy(depleted, 0);
        depleted.setDamage(depleted.getMaxDamage() - 1);
        groupStacks.add(depleted);
    }
}
 
Example #3
Source File: LibGuiTest.java    From LibGui with MIT License 5 votes vote down vote up
@Override
public void onInitialize() {
	Registry.register(Registry.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);
	GUI_BLOCKENTITY_TYPE = BlockEntityType.Builder.create(GuiBlockEntity::new, GUI_BLOCK).build(null);
	Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(MODID, "gui"), GUI_BLOCKENTITY_TYPE);
	
	GUI_SCREEN_HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(new Identifier(MODID, "gui"), (int syncId, PlayerInventory inventory) -> {
		return new TestDescription(GUI_SCREEN_HANDLER_TYPE, syncId, inventory, ScreenHandlerContext.EMPTY);
	});

	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!");
	}
}
 
Example #4
Source File: MiningGadget.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void fillItemGroup(@Nonnull ItemGroup group, @Nonnull NonNullList<ItemStack> items) {
    super.fillItemGroup(group, items);
    if (!isInGroup(group))
        return;

    ItemStack charged = new ItemStack(this);
    charged.getOrCreateTag().putDouble("energy", Config.MININGGADGET_MAXPOWER.get());
    items.add(charged);
}
 
Example #5
Source File: MinecraftItems.java    From the-hallow with MIT License 4 votes vote down vote up
public static void init() {
	if (HallowedConfig.Tweaks.pumpkinPieBlock) {
		replaceEntry(Registry.ITEM, Items.PUMPKIN_PIE, new BlockItem(HallowedBlocks.PUMPKIN_PIE, new Item.Settings().group(ItemGroup.FOOD).food(FoodComponents.PUMPKIN_PIE)));
	}
}
 
Example #6
Source File: GuiItem.java    From LibGui with MIT License 4 votes vote down vote up
public GuiItem() {
	super(new Item.Settings().group(ItemGroup.TOOLS).rarity(Rarity.EPIC));
}
 
Example #7
Source File: MixinItem.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Inject(method = "isIn(Lnet/minecraft/item/ItemGroup;)Z", at = @At("HEAD"), cancellable = true)
private void isInGroups(ItemGroup group, CallbackInfoReturnable<Boolean> info) {
	if (getCreativeTabs().contains(group)) {
		info.setReturnValue(true);
	}
}
 
Example #8
Source File: ItemEnderPouch.java    From EnderStorage with MIT License 4 votes vote down vote up
public ItemEnderPouch() {
    super(new Item.Properties()//
            .maxStackSize(1)//
            .group(ItemGroup.TRANSPORTATION)//
    );
}
 
Example #9
Source File: ItemEnderStorage.java    From EnderStorage with MIT License 4 votes vote down vote up
public ItemEnderStorage(Block block) {
    super(block, new Properties()//
            .group(ItemGroup.TRANSPORTATION)//
    );
}
 
Example #10
Source File: IForgeItem.java    From patchwork-api with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * Gets a list of tabs that items belonging to this class can display on,
 * combined properly with {@link Item#getGroup()} allows for a single item to span many
 * sub-items across many tabs.
 *
 * @return A list of all tabs that this item could possibly be one.
 */
default Collection<ItemGroup> getCreativeTabs() {
	return Collections.singletonList(getItem().getGroup());
}