1
0
Fork 0
mirror of https://github.com/Theta-Dev/ConstructionWand.git synced 2025-01-11 05:24:56 +01:00

Added crafting recipes for wand cores

Wand core list in tooltip
Tooltips for wand cores
This commit is contained in:
Theta-Dev 2021-03-08 01:33:19 +01:00
parent ebf3ae9518
commit 39e02d8fe6
26 changed files with 186 additions and 18 deletions

BIN
images/crafting5.png Normal file

Binary file not shown.

After

(image error) Size: 2.2 KiB

BIN
images/crafting6.png Normal file

Binary file not shown.

After

(image error) Size: 2.3 KiB

Binary file not shown.

After

(image error) Size: 788 B

Binary file not shown.

After

(image error) Size: 783 B

Binary file not shown.

Binary file not shown.

Before

(image error) Size: 449 B

Binary file not shown.

Before

(image error) Size: 442 B

Binary file not shown.

Before

(image error) Size: 429 B

Binary file not shown.

Before

(image error) Size: 437 B

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"constructionwand:core_angel"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:feathers"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "constructionwand:core_angel"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"constructionwand:core_destruction"
]
},
"criteria": {
"has_item": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:diamond_pickaxe"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "constructionwand:core_destruction"
}
}
},
"requirements": [
[
"has_item",
"has_the_recipe"
]
]
}

View file

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" #X",
"#O#",
"X# "
],
"key": {
"O": {
"tag": "forge:feathers"
},
"X": {
"tag": "forge:ingots/gold"
},
"#": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "constructionwand:core_angel"
}
}

View file

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" #X",
"#O#",
"X# "
],
"key": {
"O": {
"item": "minecraft:diamond_pickaxe"
},
"X": {
"tag": "forge:gems/diamond"
},
"#": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "constructionwand:core_destruction"
}
}

View file

@ -72,4 +72,8 @@ public class WandUpgrades<T extends IWandUpgrade>
public boolean hasUpgrade(T upgrade) {
return upgrades.contains(upgrade);
}
public ArrayList<T> getUpgrades() {
return upgrades;
}
}

View file

@ -1,6 +1,7 @@
package thetadev.constructionwand.data;
import net.minecraft.data.*;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.SpecialRecipeSerializer;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.IItemProvider;
@ -27,6 +28,9 @@ public class RecipeGenerator extends RecipeProvider
wandRecipe(consumer, ModItems.WAND_DIAMOND, Inp.fromTag(Tags.Items.GEMS_DIAMOND));
wandRecipe(consumer, ModItems.WAND_INFINITY, Inp.fromTag(Tags.Items.NETHER_STARS));
coreRecipe(consumer, ModItems.CORE_ANGEL, Inp.fromTag(Tags.Items.FEATHERS), Inp.fromTag(Tags.Items.INGOTS_GOLD));
coreRecipe(consumer, ModItems.CORE_DESTRUCTION, Inp.fromItem(Items.DIAMOND_PICKAXE), Inp.fromTag(Tags.Items.GEMS_DIAMOND));
specialRecipe(consumer, RecipeWandUpgrade.SERIALIZER);
}
@ -41,6 +45,18 @@ public class RecipeGenerator extends RecipeProvider
.build(consumer);
}
private void coreRecipe(Consumer<IFinishedRecipe> consumer, IItemProvider core, Inp item1, Inp item2) {
ShapedRecipeBuilder.shapedRecipe(core)
.key('O', item1.ingredient)
.key('X', item2.ingredient)
.key('#', Tags.Items.GLASS_PANES)
.patternLine(" #X")
.patternLine("#O#")
.patternLine("X# ")
.addCriterion("has_item", hasItem(item1.predicate))
.build(consumer);
}
private void specialRecipe(Consumer<IFinishedRecipe> consumer, SpecialRecipeSerializer<?> serializer) {
ResourceLocation name = Registry.RECIPE_SERIALIZER.getKey(serializer);
CustomRecipeBuilder.customRecipe(serializer).build(consumer, ConstructionWand.loc("dynamic/" + name.getPath()).toString());

View file

@ -30,14 +30,14 @@ import java.util.HashSet;
public class ModItems
{
// Wands
public static final Item WAND_STONE = new ItemWandBasic("stone_wand", itemprops(), ItemTier.STONE);
public static final Item WAND_IRON = new ItemWandBasic("iron_wand", itemprops(), ItemTier.IRON);
public static final Item WAND_DIAMOND = new ItemWandBasic("diamond_wand", itemprops(), ItemTier.DIAMOND);
public static final Item WAND_INFINITY = new ItemWandInfinity("infinity_wand", itemprops());
public static final Item WAND_STONE = new ItemWandBasic("stone_wand", propWand(), ItemTier.STONE);
public static final Item WAND_IRON = new ItemWandBasic("iron_wand", propWand(), ItemTier.IRON);
public static final Item WAND_DIAMOND = new ItemWandBasic("diamond_wand", propWand(), ItemTier.DIAMOND);
public static final Item WAND_INFINITY = new ItemWandInfinity("infinity_wand", propWand());
// Upgrades
public static final Item CORE_ANGEL = new ItemCoreAngel("core_angel", unstackable());
public static final Item CORE_DESTRUCTION = new ItemCoreDestruction("core_destruction", unstackable());
// Cores
public static final Item CORE_ANGEL = new ItemCoreAngel("core_angel", propUpgrade());
public static final Item CORE_DESTRUCTION = new ItemCoreDestruction("core_destruction", propUpgrade());
// Collections
public static final Item[] WANDS = {WAND_STONE, WAND_IRON, WAND_DIAMOND, WAND_INFINITY};
@ -55,12 +55,12 @@ public class ModItems
registerItem(r, CORE_DESTRUCTION);
}
public static Item.Properties itemprops() {
public static Item.Properties propWand() {
return new Item.Properties().group(ItemGroup.TOOLS);
}
private static Item.Properties unstackable() {
return itemprops().maxStackSize(1);
private static Item.Properties propUpgrade() {
return new Item.Properties().group(ItemGroup.MISC).maxStackSize(1);
}
private static void registerItem(IForgeRegistry<Item> reg, Item item) {

View file

@ -0,0 +1,31 @@
package thetadev.constructionwand.items.core;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.api.IWandCore;
import thetadev.constructionwand.items.ItemBase;
import javax.annotation.Nonnull;
import java.util.List;
public abstract class ItemCore extends ItemBase implements IWandCore
{
public ItemCore(String name, Properties properties) {
super(name, properties);
}
@OnlyIn(Dist.CLIENT)
public void addInformation(@Nonnull ItemStack itemstack, World worldIn, @Nonnull List<ITextComponent> lines, @Nonnull ITooltipFlag extraInfo) {
lines.add(new TranslationTextComponent(ConstructionWand.MODID + ".option.cores." + getRegistryName().toString() + ".desc")
.mergeStyle(TextFormatting.GRAY));
lines.add(new TranslationTextComponent(ConstructionWand.MODID + ".tooltip.core_tip")
.mergeStyle(TextFormatting.AQUA));
}
}

View file

@ -1,11 +1,9 @@
package thetadev.constructionwand.items.core;
import thetadev.constructionwand.api.IWandAction;
import thetadev.constructionwand.api.IWandCore;
import thetadev.constructionwand.items.ItemBase;
import thetadev.constructionwand.wand.action.ActionAngel;
public class ItemCoreAngel extends ItemBase implements IWandCore
public class ItemCoreAngel extends ItemCore
{
public ItemCoreAngel(String name, Properties properties) {
super(name, properties);

View file

@ -1,11 +1,9 @@
package thetadev.constructionwand.items.core;
import thetadev.constructionwand.api.IWandAction;
import thetadev.constructionwand.api.IWandCore;
import thetadev.constructionwand.items.ItemBase;
import thetadev.constructionwand.wand.action.ActionDestruction;
public class ItemCoreDestruction extends ItemBase implements IWandCore
public class ItemCoreDestruction extends ItemCore
{
public ItemCoreDestruction(String name, Properties properties) {
super(name, properties);

View file

@ -19,7 +19,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.generators.ModelFile;
import thetadev.constructionwand.ConstructionWand;
import thetadev.constructionwand.basics.ConfigServer;
import thetadev.constructionwand.api.IWandCore;
import thetadev.constructionwand.basics.WandUtil;
import thetadev.constructionwand.basics.option.IOption;
import thetadev.constructionwand.basics.option.WandOptions;
@ -102,6 +102,7 @@ public abstract class ItemWand extends ItemBase implements ICustomItemModel
String langTooltip = ConstructionWand.MODID + ".tooltip.";
// +SHIFT tooltip: show all options + installed cores
if(Screen.hasShiftDown()) {
for(int i = 1; i < options.allOptions.length; i++) {
IOption<?> opt = options.allOptions[i];
@ -109,7 +110,16 @@ public abstract class ItemWand extends ItemBase implements ICustomItemModel
.append(new TranslationTextComponent(opt.getValueTranslation()).mergeStyle(TextFormatting.GRAY))
);
}
if(!options.cores.getUpgrades().isEmpty()) {
lines.add(new StringTextComponent(""));
lines.add(new TranslationTextComponent(langTooltip + "cores").mergeStyle(TextFormatting.GRAY));
for(IWandCore core : options.cores.getUpgrades()) {
lines.add(new TranslationTextComponent(options.cores.getKeyTranslation() + "." + core.getRegistryName().toString()));
}
}
}
// Default tooltip: show block limit + active wand core
else {
IOption<?> opt = options.allOptions[0];
lines.add(new TranslationTextComponent(langTooltip + "blocks", limit).mergeStyle(TextFormatting.GRAY));

View file

@ -1,6 +1,5 @@
package thetadev.constructionwand.items.wand;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.IItemTier;
import net.minecraft.item.ItemStack;
import thetadev.constructionwand.basics.ConfigServer;

View file

@ -8,6 +8,8 @@
"constructionwand.tooltip.blocks": "Max. %d Blöcke",
"constructionwand.tooltip.shift": "Drücke [SHIFT]",
"constructionwand.tooltip.cores": "Kristalle im Stab:",
"constructionwand.tooltip.core_tip": "Kombiniere den Kristall mit deinem Stab im Craftingfeld",
"constructionwand.option.cores": "",
"constructionwand.option.cores.constructionwand:default": "Kristall der Konstruktion",

View file

@ -8,6 +8,8 @@
"constructionwand.tooltip.blocks": "Max. %d blocks",
"constructionwand.tooltip.shift": "Press [SHIFT]",
"constructionwand.tooltip.cores": "Wand cores:",
"constructionwand.tooltip.core_tip": "Combine the core with your wand in a crafting grid",
"constructionwand.option.cores": "",
"constructionwand.option.cores.constructionwand:default": "Construction Core",

Binary file not shown.

Before

(image error) Size: 660 B

After

(image error) Size: 788 B

Binary file not shown.

Before

(image error) Size: 662 B

After

(image error) Size: 783 B