2019-07-11 09:03:08 +02:00
|
|
|
package com.simibubi.create;
|
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
import com.simibubi.create.foundation.block.IWithoutBlockItem;
|
2019-12-19 22:35:45 +01:00
|
|
|
import com.simibubi.create.foundation.item.IAddedByOther;
|
2019-09-12 10:00:15 +02:00
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
2019-07-11 09:03:08 +02:00
|
|
|
import net.minecraft.item.ItemGroup;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2019-09-12 10:00:15 +02:00
|
|
|
import net.minecraft.util.NonNullList;
|
2019-07-11 09:03:08 +02:00
|
|
|
|
|
|
|
public final class CreateItemGroup extends ItemGroup {
|
|
|
|
|
|
|
|
public CreateItemGroup() {
|
|
|
|
super(getGroupCountSafe(), Create.ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack createIcon() {
|
2019-10-05 19:00:43 +02:00
|
|
|
return new ItemStack(AllBlocks.COGWHEEL.get());
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|
2019-12-19 22:35:45 +01:00
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
@Override
|
|
|
|
public void fill(NonNullList<ItemStack> items) {
|
2019-12-19 22:35:45 +01:00
|
|
|
addItems(items, true);
|
|
|
|
addBlocks(items);
|
|
|
|
addItems(items, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addBlocks(NonNullList<ItemStack> items) {
|
2019-09-12 10:00:15 +02:00
|
|
|
for (AllBlocks block : AllBlocks.values()) {
|
|
|
|
if (block.get() == null)
|
|
|
|
continue;
|
|
|
|
if (!block.module.isEnabled())
|
|
|
|
continue;
|
|
|
|
if (block.get() instanceof IWithoutBlockItem)
|
|
|
|
continue;
|
2019-12-19 22:35:45 +01:00
|
|
|
if (block.get() instanceof IAddedByOther)
|
|
|
|
continue;
|
|
|
|
|
2019-09-12 10:00:15 +02:00
|
|
|
block.get().asItem().fillItemGroup(this, items);
|
|
|
|
for (Block alsoRegistered : block.alsoRegistered)
|
|
|
|
alsoRegistered.asItem().fillItemGroup(this, items);
|
|
|
|
}
|
|
|
|
}
|
2019-12-19 22:35:45 +01:00
|
|
|
|
|
|
|
public void addItems(NonNullList<ItemStack> items, boolean prioritized) {
|
|
|
|
for (AllItems item : AllItems.values()) {
|
|
|
|
if (item.get() == null)
|
|
|
|
continue;
|
|
|
|
if (!item.module.isEnabled())
|
|
|
|
continue;
|
|
|
|
if (item.firstInCreativeTab != prioritized)
|
|
|
|
continue;
|
|
|
|
if (item.get() instanceof IAddedByOther)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
item.get().fillItemGroup(this, items);
|
|
|
|
}
|
|
|
|
}
|
2019-07-11 09:03:08 +02:00
|
|
|
}
|