Arbitrary hierarchy

This commit is contained in:
paulevsGitch 2020-12-31 07:15:46 +03:00
parent 640671bfce
commit fc71ea4eba
10 changed files with 133 additions and 74 deletions

View file

@ -302,7 +302,7 @@ public class EndBlocks {
public static void register() {}
public static Block registerBlock(Identifier id, Block block) {
if (!Configs.BLOCK_CONFIG.getBoolean(id, "blocks", true)) {
if (!Configs.BLOCK_CONFIG.getBooleanRoot(id.getPath(), true)) {
return block;
}
Registry.register(Registry.BLOCK, id, block);

View file

@ -39,7 +39,7 @@ public class EndEntities {
protected static <T extends Entity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity) {
Identifier id = BetterEnd.makeID(name);
EntityType<T> type = FabricEntityTypeBuilder.<T>create(group, entity).dimensions(EntityDimensions.fixed(width, height)).build();
if (Configs.ENTITY_CONFIG.getBoolean(id, "entities", true)) {
if (Configs.ENTITY_CONFIG.getBooleanRoot(id.getPath(), true)) {
return Registry.register(Registry.ENTITY_TYPE, id, type);
}
return type;
@ -48,7 +48,7 @@ public class EndEntities {
private static <T extends LivingEntity> EntityType<T> register(String name, SpawnGroup group, float width, float height, EntityFactory<T> entity, Builder attributes, boolean fixedSize, int eggColor, int dotsColor) {
Identifier id = BetterEnd.makeID(name);
EntityType<T> type = FabricEntityTypeBuilder.<T>create(group, entity).dimensions(fixedSize ? EntityDimensions.fixed(width, height) : EntityDimensions.changing(width, height)).build();
if (Configs.ENTITY_CONFIG.getBoolean(id, "entities", true)) {
if (Configs.ENTITY_CONFIG.getBooleanRoot(id.getPath(), true)) {
FabricDefaultAttributeRegistry.register(type, attributes);
EndItems.registerEgg("spawn_egg_" + name, type, eggColor, dotsColor);
return Registry.register(Registry.ENTITY_TYPE, BetterEnd.makeID(name), type);

View file

@ -124,7 +124,7 @@ public class EndItems {
if (item instanceof ArmorItem) {
return registerArmor(id, item);
}
if (!Configs.ITEM_CONFIG.getBoolean(id, "items", true)) {
if (!Configs.ITEM_CONFIG.getBoolean("items", id.getPath(), true)) {
return item;
}
registerItem(id, item, MOD_ITEMS);
@ -144,7 +144,7 @@ public class EndItems {
}
private static Item registerArmor(Identifier id, Item item) {
if (!Configs.ITEM_CONFIG.getBoolean(id, "armor", true)) {
if (!Configs.ITEM_CONFIG.getBoolean("armor", id.getPath(), true)) {
return item;
}
registerItem(id, item, MOD_ITEMS);
@ -153,7 +153,7 @@ public class EndItems {
private static ToolItem registerTool(String name, ToolItem item) {
Identifier id = BetterEnd.makeID(name);
if (!Configs.ITEM_CONFIG.getBoolean(id, "tools", true)) {
if (!Configs.ITEM_CONFIG.getBoolean("tools", id.getPath(), true)) {
return item;
}
registerItem(id, item, MOD_ITEMS);