-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
72159ce
commit d221e73
Showing
34 changed files
with
386 additions
and
53 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
7 changes: 7 additions & 0 deletions
7
common/src/generated/resources/assets/blissful/models/item/potion_bong.json
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,7 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "blissful:item/bong_potion", | ||
"layer1": "blissful:item/bong_potion_overlay" | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
.../generated/resources/data/blissful/advancements/recipes/misc/weed_from_hemp_smelting.json
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,35 @@ | ||
{ | ||
"parent": "minecraft:recipes/root", | ||
"criteria": { | ||
"has_hemp": { | ||
"conditions": { | ||
"items": [ | ||
{ | ||
"items": [ | ||
"blissful:hemp" | ||
] | ||
} | ||
] | ||
}, | ||
"trigger": "minecraft:inventory_changed" | ||
}, | ||
"has_the_recipe": { | ||
"conditions": { | ||
"recipe": "blissful:weed_from_hemp_smelting" | ||
}, | ||
"trigger": "minecraft:recipe_unlocked" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"has_hemp", | ||
"has_the_recipe" | ||
] | ||
], | ||
"rewards": { | ||
"recipes": [ | ||
"blissful:weed_from_hemp_smelting" | ||
] | ||
}, | ||
"sends_telemetry_event": false | ||
} |
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
10 changes: 10 additions & 0 deletions
10
common/src/generated/resources/data/blissful/recipes/weed_from_hemp_smelting.json
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,10 @@ | ||
{ | ||
"type": "minecraft:smelting", | ||
"category": "misc", | ||
"cookingtime": 200, | ||
"experience": 0.25, | ||
"ingredient": { | ||
"item": "blissful:hemp" | ||
}, | ||
"result": "blissful:weed" | ||
} |
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,21 @@ | ||
package galena.blissful; | ||
|
||
import galena.blissful.index.BlissfuItems; | ||
import net.minecraft.client.color.item.ItemColor; | ||
import net.minecraft.world.item.alchemy.PotionUtils; | ||
import net.minecraft.world.level.ItemLike; | ||
|
||
import java.util.function.BiConsumer; | ||
|
||
public class BlissfulClient { | ||
|
||
private static final ItemColor POTION_COLORS = (stack, i) -> { | ||
if(i != 1) return -1; | ||
return PotionUtils.getColor(stack); | ||
}; | ||
|
||
public static void registerItemColors(BiConsumer<ItemColor, ItemLike> consumer) { | ||
consumer.accept(POTION_COLORS, BlissfuItems.POTION_BONG.get()); | ||
} | ||
|
||
} |
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,15 +1,20 @@ | ||
package galena.blissful; | ||
|
||
import galena.blissful.index.BlissfulBrewing; | ||
import galena.blissful.index.BlissfulEffects; | ||
import galena.blissful.index.BlissfulBlocks; | ||
import galena.blissful.index.BlissfuItems; | ||
import galena.blissful.platform.Services; | ||
import net.minecraft.core.registries.Registries; | ||
|
||
public class BlissfulCommon { | ||
|
||
public static void init() { | ||
BlissfulEffects.register(); | ||
BlissfulBlocks.register(); | ||
BlissfuItems.register(); | ||
|
||
Services.PLATFORM.getRegistrate().addRegisterCallback(Registries.POTION, BlissfulBrewing::register); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
common/src/main/java/galena/blissful/compat/BlissfulJeiPlugin.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,35 @@ | ||
package galena.blissful.compat; | ||
|
||
import galena.blissful.BlissfulConstants; | ||
import galena.blissful.index.BlissfuItems; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.JeiPlugin; | ||
import mezz.jei.api.ingredients.subtypes.IIngredientSubtypeInterpreter; | ||
import mezz.jei.api.registration.ISubtypeRegistration; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.alchemy.PotionUtils; | ||
|
||
@JeiPlugin | ||
public class BlissfulJeiPlugin implements IModPlugin { | ||
|
||
private static final ResourceLocation ID = new ResourceLocation(BlissfulConstants.MOD_ID, "jei"); | ||
|
||
private static final IIngredientSubtypeInterpreter<ItemStack> POTION_INTERPRETER = (ingredient, context) -> { | ||
var potion = PotionUtils.getPotion(ingredient); | ||
var effects = PotionUtils.getMobEffects(ingredient); | ||
var builder = new StringBuilder(potion.getName("")); | ||
effects.forEach(it -> builder.append(";").append(it)); | ||
return builder.toString(); | ||
}; | ||
|
||
@Override | ||
public ResourceLocation getPluginUid() { | ||
return ID; | ||
} | ||
|
||
@Override | ||
public void registerItemSubtypes(ISubtypeRegistration registration) { | ||
registration.registerSubtypeInterpreter(BlissfuItems.POTION_BONG.get(), POTION_INTERPRETER); | ||
} | ||
} |
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
53 changes: 53 additions & 0 deletions
53
common/src/main/java/galena/blissful/index/BlissfulBrewing.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,53 @@ | ||
package galena.blissful.index; | ||
|
||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.alchemy.Potion; | ||
import net.minecraft.world.item.alchemy.PotionBrewing; | ||
import net.minecraft.world.item.alchemy.PotionUtils; | ||
import net.minecraft.world.item.alchemy.Potions; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
import net.minecraft.world.level.ItemLike; | ||
|
||
import static galena.blissful.platform.Services.BREWING; | ||
|
||
public class BlissfulBrewing { | ||
|
||
private static ItemStack withPotion(ItemLike item, Potion potion) { | ||
var stack = new ItemStack(item); | ||
PotionUtils.setPotion(stack, potion); | ||
return stack; | ||
} | ||
|
||
private static void registerMix(ItemStack ingredient, ItemStack from) { | ||
var input = PotionUtils.getPotion(from) == Potions.WATER ? BlissfuItems.BONG.asStack() : from; | ||
var output = PotionBrewing.mix(ingredient, from); | ||
if (output == from) return; | ||
BREWING.addRecipe(Ingredient.of(input), Ingredient.of(ingredient), output); | ||
} | ||
|
||
private static void registerBongRecipes() { | ||
var waterBottle = withPotion(Items.POTION, Potions.WATER); | ||
|
||
BREWING.addRecipe(Ingredient.of(waterBottle), Ingredient.of(BlissfuItems.WEED), BlissfuItems.BONG.asStack()); | ||
|
||
var catalysts = BuiltInRegistries.ITEM.stream() | ||
.map(ItemStack::new) | ||
.filter(PotionBrewing::isIngredient) | ||
.toList(); | ||
|
||
BuiltInRegistries.POTION.stream().forEach(potion -> { | ||
var from = withPotion(BlissfuItems.POTION_BONG, potion); | ||
var potionStack = withPotion(Items.POTION, potion); | ||
catalysts.stream() | ||
.filter(it -> PotionBrewing.hasMix(potionStack, it)) | ||
.forEach(catalyst -> registerMix(catalyst, from)); | ||
}); | ||
} | ||
|
||
public static void register() { | ||
registerBongRecipes(); | ||
} | ||
|
||
} |
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
10 changes: 10 additions & 0 deletions
10
common/src/main/java/galena/blissful/platform/services/IBrewingRegistry.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,10 @@ | ||
package galena.blissful.platform.services; | ||
|
||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
|
||
public interface IBrewingRegistry { | ||
|
||
void addRecipe(Ingredient input, Ingredient ingredient, ItemStack output); | ||
|
||
} |
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.