Skip to content

Commit

Permalink
6.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dqu1J committed Aug 6, 2023
1 parent 1f26884 commit cc86954
Show file tree
Hide file tree
Showing 24 changed files with 356 additions and 146 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx1G
minecraft_version=1.20.1
loader_version=0.14.4
# Mod Properties
mod_version=6.0.0
mod_version=6.0.1
maven_group=AdditionalAdditions
archives_base_name=AdditionalAdditions
# Dependencies
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/dqu/additionaladditions/AdditionalAdditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import dev.lambdaurora.lambdynlights.api.DynamicLightHandlers;
import dqu.additionaladditions.behaviour.BehaviourManager;
import dqu.additionaladditions.config.Config;
import dqu.additionaladditions.misc.CreativeAdder;
import dqu.additionaladditions.misc.LootHandler;
import dqu.additionaladditions.registry.*;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.packs.PackType;
import net.minecraft.world.item.CreativeModeTabs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -34,6 +37,8 @@ public void onInitialize() {
AdditionalPotions.registerAll();
AdditionalMusicDiscs.registerAll();

addItemsToCreative();

LootTableEvents.MODIFY.register(((resourceManager, lootManager, id, table, setter) -> {
LootHandler.handle(id, table);
}));
Expand All @@ -44,4 +49,14 @@ public void onInitialize() {
DynamicLightHandlers.registerDynamicLightHandler(AdditionalEntities.GLOW_STICK_ENTITY_ENTITY_TYPE, entity -> 12);
}
}

public void addItemsToCreative() {
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(CreativeAdder.TOOLS_AND_UTILITIES::pushAllTo);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS).register(CreativeAdder.INGREDIENTS::pushAllTo);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(CreativeAdder.BUILDING_BLOCKS::pushAllTo);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.REDSTONE_BLOCKS).register(CreativeAdder.REDSTONE_BLOCKS::pushAllTo);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FOOD_AND_DRINKS).register(CreativeAdder.FOOD_AND_DRINKS::pushAllTo);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FUNCTIONAL_BLOCKS).register(CreativeAdder.FUNCTIONAL_BLOCKS::pushAllTo);
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register(CreativeAdder.COMBAT::pushAllTo);
}
}
47 changes: 47 additions & 0 deletions src/main/java/dqu/additionaladditions/misc/CreativeAdder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package dqu.additionaladditions.misc;

import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries;
import net.minecraft.world.level.ItemLike;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

public enum CreativeAdder {

TOOLS_AND_UTILITIES(),
INGREDIENTS(),
BUILDING_BLOCKS(),
REDSTONE_BLOCKS(),
FOOD_AND_DRINKS(),
FUNCTIONAL_BLOCKS(),
COMBAT();

private final List<CreativeEntry> entries = new ArrayList<>();

CreativeAdder() {}

public void add(Supplier<Boolean> condition, ItemLike after, ItemLike... items) {
CreativeEntry entry = new CreativeEntry(condition, false, after, items);
this.entries.add(entry);
}

public void addBefore(Supplier<Boolean> condition, ItemLike after, ItemLike... items) {
CreativeEntry entry = new CreativeEntry(condition, true, after, items);
this.entries.add(entry);
}

public void pushAllTo(FabricItemGroupEntries content) {
for (CreativeEntry entry : entries) {
if (entry.condition.get()) {
if (entry.before) {
content.addBefore(entry.anchor, entry.items);
} else {
content.addAfter(entry.anchor, entry.items);
}
}
}
}

private record CreativeEntry(Supplier<Boolean> condition, boolean before, ItemLike anchor, ItemLike... items) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import dqu.additionaladditions.config.Config;
import dqu.additionaladditions.config.ConfigValues;
import dqu.additionaladditions.item.CopperPatinaItem;
import dqu.additionaladditions.misc.CreativeAdder;
import dqu.additionaladditions.misc.LootHandler;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
Expand Down Expand Up @@ -74,20 +75,12 @@ public static void registerAll() {
.add(LootItem.lootTableItem(AdditionalBlocks.ROPE_BLOCK))
);

ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.REDSTONE_BLOCKS).register(content -> {
content.addAfter(Items.REDSTONE, COPPER_PATINA);
content.addAfter(Items.REDSTONE_LAMP, AMETHYST_LAMP);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FUNCTIONAL_BLOCKS).register(content -> {
content.addAfter(Items.REDSTONE_LAMP, AMETHYST_LAMP);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.BUILDING_BLOCKS).register(content -> {
content.addAfter(Items.REDSTONE_BLOCK, PATINA_BLOCK);
content.addAfter(Items.CHAIN, ROPE_BLOCK);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(content -> {
content.addAfter(Items.SPYGLASS, ROPE_BLOCK);
});
CreativeAdder.REDSTONE_BLOCKS.add(() -> Config.getBool(ConfigValues.COPPER_PATINA), Items.REDSTONE_BLOCK, COPPER_PATINA);
CreativeAdder.REDSTONE_BLOCKS.add(() -> Config.getBool(ConfigValues.AMETHYST_LAMP, "enabled"), Items.REDSTONE_LAMP, AMETHYST_LAMP);
CreativeAdder.FUNCTIONAL_BLOCKS.add(() -> Config.getBool(ConfigValues.AMETHYST_LAMP, "enabled"), Items.REDSTONE_LAMP, AMETHYST_LAMP);
CreativeAdder.BUILDING_BLOCKS.add(() -> Config.getBool(ConfigValues.COPPER_PATINA), Items.REDSTONE_BLOCK, PATINA_BLOCK);
CreativeAdder.BUILDING_BLOCKS.add(() -> Config.getBool(ConfigValues.ROPES), Items.CHAIN, ROPE_BLOCK);
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.ROPES), Items.SPYGLASS, ROPE_BLOCK);

// life is meaningless and we're all gonna die
}
Expand Down
40 changes: 16 additions & 24 deletions src/main/java/dqu/additionaladditions/registry/AdditionalItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import dqu.additionaladditions.config.Config;
import dqu.additionaladditions.config.ConfigValues;
import dqu.additionaladditions.item.*;
import dqu.additionaladditions.misc.CreativeAdder;
import dqu.additionaladditions.misc.LootHandler;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockSource;
Expand All @@ -17,7 +17,6 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.*;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DispenserBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
Expand Down Expand Up @@ -140,28 +139,21 @@ public ItemStack execute(BlockSource pointer, ItemStack stack) {
}

private static void putToItemGroups() {
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(content -> {
content.addAfter(Items.BONE_MEAL, WATERING_CAN, WRENCH_ITEM, GLOW_STICK_ITEM);
content.addAfter(Items.CLOCK, DEPTH_METER_ITEM);
content.addAfter(Items.ELYTRA, MYSTERIOUS_BUNDLE_ITEM);
content.addAfter(Items.SPYGLASS, POCKET_JUKEBOX_ITEM);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS).register(content -> {
content.addBefore(Items.NETHERITE_SCRAP, GOLD_RING, ROSE_GOLD_ALLOY);
content.addAfter(Items.PRISMARINE_CRYSTALS, TRIDENT_SHARD);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.REDSTONE_BLOCKS).register(content -> {
content.addAfter(Blocks.TARGET, WRENCH_ITEM);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register(content -> {
content.addAfter(Items.CROSSBOW, CROSSBOW_WITH_SPYGLASS);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.FOOD_AND_DRINKS).register(content -> {
content.addAfter(Items.COOKED_RABBIT, FRIED_EGG);
content.addAfter(Items.PUMPKIN_PIE, BERRY_PIE);
content.addAfter(Items.APPLE, HONEYED_APPLE);
content.addAfter(Items.ROTTEN_FLESH, CHICKEN_NUGGET);
});
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.WATERING_CAN), Items.BONE_MEAL, WATERING_CAN);
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.WRENCH), Items.BONE_MEAL, WRENCH_ITEM);
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.GLOW_STICK), Items.BONE_MEAL, GLOW_STICK_ITEM);
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.DEPTH_METER, "enabled"), Items.CLOCK, DEPTH_METER_ITEM);
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.MYSTERIOUS_BUNDLE), Items.ELYTRA, MYSTERIOUS_BUNDLE_ITEM);
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.POCKET_JUKEBOX), Items.SPYGLASS, POCKET_JUKEBOX_ITEM);
CreativeAdder.INGREDIENTS.addBefore(() -> Config.getBool(ConfigValues.GILDED_NETHERITE, "enabled"), Items.NETHERITE_SCRAP, GOLD_RING);
CreativeAdder.INGREDIENTS.addBefore(() -> Config.getBool(ConfigValues.ROSE_GOLD), Items.NETHERITE_SCRAP, ROSE_GOLD_ALLOY);
CreativeAdder.INGREDIENTS.add(() -> Config.getBool(ConfigValues.TRIDENT_SHARD), Items.PRISMARINE_CRYSTALS, TRIDENT_SHARD);
CreativeAdder.REDSTONE_BLOCKS.add(() -> Config.getBool(ConfigValues.WRENCH), Items.TARGET, WRENCH_ITEM);
CreativeAdder.COMBAT.add(() -> Config.getBool(ConfigValues.CROSSBOWS), Items.CROSSBOW, CROSSBOW_WITH_SPYGLASS);
CreativeAdder.FOOD_AND_DRINKS.add(() -> Config.getBool(ConfigValues.FOOD, "FriedEgg"), Items.COOKED_RABBIT, FRIED_EGG);
CreativeAdder.FOOD_AND_DRINKS.add(() -> Config.getBool(ConfigValues.FOOD, "BerryPie"), Items.PUMPKIN_PIE, BERRY_PIE);
CreativeAdder.FOOD_AND_DRINKS.add(() -> Config.getBool(ConfigValues.FOOD, "HoneyedApple"), Items.APPLE, HONEYED_APPLE);
CreativeAdder.FOOD_AND_DRINKS.add(() -> Config.getBool(ConfigValues.CHICKEN_NUGGET), Items.ROTTEN_FLESH, CHICKEN_NUGGET);
}

public static void registerAll() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import dqu.additionaladditions.config.ConfigValues;
import dqu.additionaladditions.item.*;
import dqu.additionaladditions.material.*;
import dqu.additionaladditions.misc.CreativeAdder;
import dqu.additionaladditions.misc.LootHandler;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.core.Registry;
Expand Down Expand Up @@ -79,20 +80,15 @@ public static void registerAll() {
.add(LootItem.lootTableItem(GILDED_NETHERITE_UPGRADE))
);

ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(content -> {
content.addAfter(Items.GOLDEN_HOE, ROSE_GOLD_SHOVEL, ROSE_GOLD_PICKAXE, ROSE_GOLD_AXE, ROSE_GOLD_HOE);
content.addAfter(Items.NETHERITE_HOE, GILDED_NETHERITE_SHOVEL, GILDED_NETHERITE_PICKAXE, GILDED_NETHERITE_AXE, GILDED_NETHERITE_HOE);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.COMBAT).register(content -> {
content.addAfter(Items.GOLDEN_SWORD, ROSE_GOLD_SWORD);
content.addAfter(Items.NETHERITE_SWORD, GILDED_NETHERITE_SWORD);
content.addAfter(Items.GOLDEN_AXE, ROSE_GOLD_AXE);
content.addAfter(Items.NETHERITE_AXE, GILDED_NETHERITE_AXE);
content.addAfter(Items.GOLDEN_BOOTS, ROSE_GOLD_HELMET, ROSE_GOLD_CHESTPLATE, ROSE_GOLD_LEGGINGS, ROSE_GOLD_BOOTS);
content.addAfter(Items.NETHERITE_BOOTS, GILDED_NETHERITE_HELMET, GILDED_NETHERITE_CHESTPLATE, GILDED_NETHERITE_LEGGINGS, GILDED_NETHERITE_BOOTS);
});
ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.INGREDIENTS).register(content -> {
content.addAfter(Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, GILDED_NETHERITE_UPGRADE, ROSE_GOLD_UPGRADE);
});
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.ROSE_GOLD), Items.GOLDEN_HOE, ROSE_GOLD_SHOVEL, ROSE_GOLD_PICKAXE, ROSE_GOLD_AXE, ROSE_GOLD_HOE);
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.GILDED_NETHERITE, "enabled"), Items.NETHERITE_HOE, GILDED_NETHERITE_SHOVEL, GILDED_NETHERITE_PICKAXE, GILDED_NETHERITE_AXE, GILDED_NETHERITE_HOE);
CreativeAdder.COMBAT.add(() -> Config.getBool(ConfigValues.ROSE_GOLD), Items.GOLDEN_SWORD, ROSE_GOLD_SWORD);
CreativeAdder.COMBAT.add(() -> Config.getBool(ConfigValues.ROSE_GOLD), Items.GOLDEN_AXE, ROSE_GOLD_AXE);
CreativeAdder.COMBAT.add(() -> Config.getBool(ConfigValues.ROSE_GOLD), Items.GOLDEN_BOOTS, ROSE_GOLD_HELMET, ROSE_GOLD_CHESTPLATE, ROSE_GOLD_LEGGINGS, ROSE_GOLD_BOOTS);
CreativeAdder.COMBAT.add(() -> Config.getBool(ConfigValues.GILDED_NETHERITE, "enabled"), Items.NETHERITE_SWORD, GILDED_NETHERITE_SWORD);
CreativeAdder.COMBAT.add(() -> Config.getBool(ConfigValues.GILDED_NETHERITE, "enabled"), Items.NETHERITE_AXE, GILDED_NETHERITE_AXE);
CreativeAdder.COMBAT.add(() -> Config.getBool(ConfigValues.GILDED_NETHERITE, "enabled"), Items.NETHERITE_BOOTS, GILDED_NETHERITE_HELMET, GILDED_NETHERITE_CHESTPLATE, GILDED_NETHERITE_LEGGINGS, GILDED_NETHERITE_BOOTS);
CreativeAdder.INGREDIENTS.add(() -> Config.getBool(ConfigValues.ROSE_GOLD), Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, ROSE_GOLD_UPGRADE);
CreativeAdder.INGREDIENTS.add(() -> Config.getBool(ConfigValues.GILDED_NETHERITE, "enabled"), Items.NETHERITE_UPGRADE_SMITHING_TEMPLATE, GILDED_NETHERITE_UPGRADE);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package dqu.additionaladditions.registry;

import dqu.additionaladditions.AdditionalAdditions;
import dqu.additionaladditions.config.Config;
import dqu.additionaladditions.config.ConfigValues;
import dqu.additionaladditions.item.AdditionalMusicDiscItem;
import dqu.additionaladditions.misc.CreativeAdder;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
Expand Down Expand Up @@ -33,9 +36,7 @@ private static void registerDiscs() {
Registry.register(BuiltInRegistries.ITEM, new ResourceLocation(AdditionalAdditions.namespace, "music_disc_1007"), MUSIC_DISC_1007);
Registry.register(BuiltInRegistries.ITEM, new ResourceLocation(AdditionalAdditions.namespace, "music_disc_1507"), MUSIC_DISC_1507);

ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(content -> {
content.addAfter(Items.MUSIC_DISC_WAIT, MUSIC_DISC_0308, MUSIC_DISC_1007, MUSIC_DISC_1507);
});
CreativeAdder.TOOLS_AND_UTILITIES.add(() -> Config.getBool(ConfigValues.MUSIC_DISCS), Items.MUSIC_DISC_WAIT, MUSIC_DISC_0308, MUSIC_DISC_1007, MUSIC_DISC_1507);
}

public static void registerAll() {
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/assets/additionaladditions/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"item.additionaladditions.berry_pie": "Süßbeerenkuchen",
"item.additionaladditions.watering_can": "Gießkanne",
"item.additionaladditions.crossbow_with_spyglass": "Armbrust mit Fernrohr",

"item.additionaladditions.rose_gold_sword": "Roségoldschwert",
"item.additionaladditions.rose_gold_axe": "Roségoldaxt",
"item.additionaladditions.rose_gold_pickaxe": "Roségoldspitzhacke",
Expand All @@ -11,12 +12,20 @@
"item.additionaladditions.rose_gold_chestplate": "Roségoldharnisch",
"item.additionaladditions.rose_gold_leggings": "Roségoldbeinschutz",
"item.additionaladditions.rose_gold_boots": "Roségoldstiefel",

"item.additionaladditions.smithing_template.rose_gold_upgrade.additions_slot_description": "Add Rose Gold Alloy",
"item.additionaladditions.smithing_template.rose_gold_upgrade.applies_to": "Iron Equipment",
"item.additionaladditions.smithing_template.rose_gold_upgrade.base_slot_description": "Add iron armor, weapon, or tool",
"item.additionaladditions.smithing_template.rose_gold_upgrade.ingredients": "Rose Gold Alloy",
"upgrade.additionaladditions.rose_gold_upgrade": "Rose Gold Upgrade",

"item.additionaladditions.wrench": "Schraubenschlüssel",
"item.additionaladditions.fried_egg": "Spiegelei",
"item.additionaladditions.trident_shard": "Dreizack-Splitter",
"item.additionaladditions.glow_stick": "Leuchtstab",
"item.additionaladditions.honeyed_apple": "Honigapfel",
"item.additionaladditions.depth_meter": "Tiefenmesser",

"item.additionaladditions.gilded_netherite_sword": "Vergoldetes Netheritschwert",
"item.additionaladditions.gilded_netherite_axe": "Vergoldete Netheritaxt",
"item.additionaladditions.gilded_netherite_pickaxe": "Vergoldete Netheritspitzhacke",
Expand All @@ -26,6 +35,13 @@
"item.additionaladditions.gilded_netherite_chestplate": "Vergoldeter Netheritharnisch",
"item.additionaladditions.gilded_netherite_leggings": "Vergoldeter Netheritbeinschutz",
"item.additionaladditions.gilded_netherite_boots": "Vergoldete Netheritstiefel",

"item.additionaladditions.smithing_template.gilded_netherite_upgrade.additions_slot_description": "Add Gold Ring",
"item.additionaladditions.smithing_template.gilded_netherite_upgrade.applies_to": "Netherite Equipment",
"item.additionaladditions.smithing_template.gilded_netherite_upgrade.base_slot_description": "Add netherite armor, weapon, or tool",
"item.additionaladditions.smithing_template.gilded_netherite_upgrade.ingredients": "Gold Ring",
"upgrade.additionaladditions.gilded_netherite_upgrade": "Gilded Netherite Upgrade",

"item.additionaladditions.music_disc_0308": "Schallplatte",
"item.additionaladditions.music_disc_1007": "Schallplatte",
"item.additionaladditions.music_disc_1507": "Schallplatte",
Expand Down
Loading

0 comments on commit cc86954

Please sign in to comment.