-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
356 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/dqu/additionaladditions/item/AdditionalSmithingTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package dqu.additionaladditions.item; | ||
|
||
import dqu.additionaladditions.AdditionalAdditions; | ||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.Util; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.SmithingTemplateItem; | ||
|
||
import java.util.List; | ||
|
||
public class AdditionalSmithingTemplate extends SmithingTemplateItem { | ||
private static final ChatFormatting TITLE_FORMAT = ChatFormatting.GRAY; | ||
private static final ChatFormatting DESCRIPTION_FORMAT = ChatFormatting.BLUE; | ||
|
||
private AdditionalSmithingTemplate(Component appliesTo, Component ingredients, Component upgradeDescription, Component baseSlotDescription, Component additionsSlotDescription, List<ResourceLocation> baseSlotEmptyIcons, List<ResourceLocation> additionalSlotEmptyIcons) { | ||
super(appliesTo, ingredients, upgradeDescription, baseSlotDescription, additionsSlotDescription, baseSlotEmptyIcons, additionalSlotEmptyIcons); | ||
} | ||
|
||
public static SmithingTemplateItem create(String id, List<ResourceLocation> baseSlotEmptyIcons, List<ResourceLocation> additionalSlotEmptyIcons) { | ||
var appliesTo = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(AdditionalAdditions.namespace, "smithing_template."+id+".applies_to"))).withStyle(DESCRIPTION_FORMAT); | ||
var upgradeDescription = Component.translatable(Util.makeDescriptionId("upgrade", new ResourceLocation(AdditionalAdditions.namespace, id))).withStyle(TITLE_FORMAT); | ||
var ingredients = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(AdditionalAdditions.namespace, "smithing_template."+id+".ingredients"))).withStyle(DESCRIPTION_FORMAT); | ||
var baseSlotDescription = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(AdditionalAdditions.namespace, "smithing_template."+id+".base_slot_description"))); | ||
var additionsSlotDescription = Component.translatable(Util.makeDescriptionId("item", new ResourceLocation(AdditionalAdditions.namespace, "smithing_template."+id+".additions_slot_description"))); | ||
|
||
return new AdditionalSmithingTemplate( | ||
appliesTo, | ||
ingredients, | ||
upgradeDescription, | ||
baseSlotDescription, | ||
additionsSlotDescription, | ||
baseSlotEmptyIcons, | ||
additionalSlotEmptyIcons | ||
); | ||
} | ||
|
||
public static List<ResourceLocation> iconsEquipment() { | ||
return List.of( | ||
SmithingIcon.HELMET.location(), | ||
SmithingIcon.CHESTPLATE.location(), | ||
SmithingIcon.LEGGINGS.location(), | ||
SmithingIcon.BOOTS.location(), | ||
SmithingIcon.HOE.location(), | ||
SmithingIcon.AXE.location(), | ||
SmithingIcon.PICKAXE.location(), | ||
SmithingIcon.SWORD.location(), | ||
SmithingIcon.SHOVEL.location() | ||
); | ||
} | ||
|
||
public enum SmithingIcon { | ||
HELMET(new ResourceLocation("item/empty_armor_slot_helmet")), | ||
CHESTPLATE(new ResourceLocation("item/empty_armor_slot_chestplate")), | ||
LEGGINGS(new ResourceLocation("item/empty_armor_slot_leggings")), | ||
BOOTS(new ResourceLocation("item/empty_armor_slot_boots")), | ||
HOE(new ResourceLocation("item/empty_slot_hoe")), | ||
AXE(new ResourceLocation("item/empty_slot_axe")), | ||
SWORD(new ResourceLocation("item/empty_slot_sword")), | ||
SHOVEL(new ResourceLocation("item/empty_slot_shovel")), | ||
PICKAXE(new ResourceLocation("item/empty_slot_pickaxe")), | ||
INGOT(new ResourceLocation("item/empty_slot_ingot")), | ||
REDSTONE_DUST(new ResourceLocation("item/empty_slot_redstone_dust")), | ||
QUARTZ(new ResourceLocation("item/empty_slot_quartz")), | ||
EMERALD(new ResourceLocation("item/empty_slot_emerald")), | ||
DIAMOND(new ResourceLocation("item/empty_slot_diamond")), | ||
LAPIS_LAZULI(new ResourceLocation("item/empty_slot_lapis_lazuli")), | ||
AMETHYST_SHARD(new ResourceLocation("item/empty_slot_amethyst_shard")), | ||
RING(new ResourceLocation(AdditionalAdditions.namespace, "item/empty_slot_ring")), | ||
ALLOY(new ResourceLocation(AdditionalAdditions.namespace, "item/empty_slot_alloy")); | ||
|
||
final ResourceLocation resourceLocation; | ||
|
||
SmithingIcon(ResourceLocation resourceLocation) { | ||
this.resourceLocation = resourceLocation; | ||
} | ||
|
||
public ResourceLocation location() { | ||
return resourceLocation; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/dqu/additionaladditions/misc/LootHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package dqu.additionaladditions.misc; | ||
|
||
import dqu.additionaladditions.AdditionalAdditions; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.storage.loot.LootPool; | ||
import net.minecraft.world.level.storage.loot.LootTable; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
public class LootHandler { | ||
private static final List<LootEntry> entries = new ArrayList<>(); | ||
|
||
public static void register(ResourceLocation table, Supplier<Boolean> condition, LootPool.Builder pool) { | ||
LootEntry entry = new LootEntry(table, condition, pool); | ||
entries.add(entry); | ||
} | ||
|
||
public static void register(List<ResourceLocation> tables, Supplier<Boolean> condition, LootPool.Builder pool) { | ||
for (ResourceLocation table : tables) { | ||
register(table, condition, pool); | ||
} | ||
} | ||
|
||
public static void postInit() { | ||
AdditionalAdditions.LOGGER.info("[" + AdditionalAdditions.namespace + "] Adding " + entries.size() + " loot pools"); | ||
} | ||
|
||
public static void handle(ResourceLocation id, LootTable.Builder table) { | ||
for (LootEntry entry : entries) { | ||
if (entry.table.equals(id)) { | ||
if (!entry.condition.get()) continue; | ||
|
||
table.withPool(entry.pool); | ||
} | ||
} | ||
} | ||
|
||
private record LootEntry( | ||
ResourceLocation table, | ||
Supplier<Boolean> condition, | ||
LootPool.Builder pool | ||
) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.