Additional Blocks and Items registry helpers
This commit is contained in:
parent
09f5cd60fa
commit
ee77b07561
7 changed files with 22 additions and 13 deletions
|
@ -36,7 +36,7 @@ public class EndBlockEntities {
|
|||
public static void register() {}
|
||||
|
||||
static Block[] getPedestals() {
|
||||
return BaseRegistry.getRegisteredBlocks().values().stream()
|
||||
return EndBlocks.getModBlocks().stream()
|
||||
.filter(item -> item instanceof BlockItem)
|
||||
.map(item -> ((BlockItem) item).getBlock())
|
||||
.filter(block -> block instanceof PedestalBlock &&
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.betterend.registry;
|
||||
|
||||
import net.minecraft.world.item.Item;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
|
@ -44,6 +45,8 @@ import ru.betterend.item.material.EndArmorMaterial;
|
|||
import ru.betterend.item.material.EndToolMaterial;
|
||||
import ru.betterend.tab.CreativeTabs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EndBlocks extends BlocksRegistry {
|
||||
// Terrain //
|
||||
public static final Block ENDSTONE_DUST = registerBlock("endstone_dust", new EndstoneDustBlock());
|
||||
|
@ -329,6 +332,10 @@ public class EndBlocks extends BlocksRegistry {
|
|||
super(creativeTab);
|
||||
}
|
||||
|
||||
public static List<Item> getModBlocks() {
|
||||
return getModBlocks(BetterEnd.MOD_ID);
|
||||
}
|
||||
|
||||
public static Block registerBlock(ResourceLocation id, Block block) {
|
||||
if (!Configs.BLOCK_CONFIG.getBooleanRoot(id.getPath(), true)) {
|
||||
return block;
|
||||
|
|
|
@ -39,6 +39,8 @@ import ru.betterend.item.material.EndToolMaterial;
|
|||
import ru.betterend.item.tool.EndHammerItem;
|
||||
import ru.betterend.tab.CreativeTabs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class EndItems extends ItemsRegistry {
|
||||
// Materials //
|
||||
public final static Item ENDER_DUST = registerEndItem("ender_dust");
|
||||
|
@ -127,6 +129,10 @@ public class EndItems extends ItemsRegistry {
|
|||
super(creativeTab);
|
||||
}
|
||||
|
||||
public static List<Item> getModItems() {
|
||||
return getModItems(BetterEnd.MOD_ID);
|
||||
}
|
||||
|
||||
public static Item registerEndDisc(String name, int power, SoundEvent sound) {
|
||||
return getItemRegistry().registerDisc(name, power, sound);
|
||||
}
|
||||
|
|
|
@ -81,8 +81,8 @@ public class EndTags {
|
|||
TagAPI.addEndGround(EndBlocks.THALLASIUM.ore);
|
||||
TagAPI.addEndGround(EndBlocks.ENDSTONE_DUST);
|
||||
TagAPI.addEndGround(EndBlocks.AMBER_ORE);
|
||||
|
||||
EndItems.getModBlocks(BetterEnd.MOD_ID).forEach(blockItem -> {
|
||||
|
||||
EndBlocks.getModBlocks().forEach(blockItem -> {
|
||||
Block block = ((BlockItem) blockItem).getBlock();
|
||||
if (block instanceof EndTerrainBlock) {
|
||||
TagAPI.addEndGround(block);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue