forked from Nyancatpig/Cultural-Delights-1.18.2
-
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.
Added JEI compat Gave blocks correct tools FIxed Avocado Log -> Jungle Planks recipe Started Wild Crop generation Food bug fixes
- Loading branch information
1 parent
b6b8a62
commit 238fb4c
Showing
15 changed files
with
254 additions
and
18 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
71 changes: 71 additions & 0 deletions
71
src/main/java/com/ncpbails/culturaldelights/integration/BambooMatRecipeCategory.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,71 @@ | ||
package com.ncpbails.culturaldelights.integration; | ||
|
||
import com.ncpbails.culturaldelights.CulturalDelights; | ||
import com.ncpbails.culturaldelights.block.ModBlocks; | ||
import com.ncpbails.culturaldelights.item.ModItems; | ||
import com.ncpbails.culturaldelights.recipe.BambooMatRecipe; | ||
import mezz.jei.api.constants.VanillaTypes; | ||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; | ||
import mezz.jei.api.gui.drawable.IDrawable; | ||
import mezz.jei.api.helpers.IGuiHelper; | ||
import mezz.jei.api.recipe.IFocusGroup; | ||
import mezz.jei.api.recipe.RecipeIngredientRole; | ||
import mezz.jei.api.recipe.category.IRecipeCategory; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.network.chat.TextComponent; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class BambooMatRecipeCategory implements IRecipeCategory<BambooMatRecipe> { | ||
public final static ResourceLocation UID = new ResourceLocation(CulturalDelights.MOD_ID, "mat_rolling"); | ||
public final static ResourceLocation TEXTURE = | ||
new ResourceLocation(CulturalDelights.MOD_ID, "textures/gui/bamboo_mat_gui.png"); | ||
|
||
private final IDrawable background; | ||
private final IDrawable icon; | ||
|
||
public BambooMatRecipeCategory(IGuiHelper helper) { | ||
this.background = helper.createDrawable(TEXTURE, 0, 0, 176, 85); | ||
this.icon = helper.createDrawableIngredient(VanillaTypes.ITEM, new ItemStack(ModBlocks.BAMBOO_MAT.get())); | ||
} | ||
|
||
@Override | ||
public ResourceLocation getUid() { | ||
return UID; | ||
} | ||
|
||
@Override | ||
public Class<? extends BambooMatRecipe> getRecipeClass() { | ||
return BambooMatRecipe.class; | ||
} | ||
|
||
@Override | ||
public Component getTitle() { | ||
return new TextComponent("Bamboo Mat"); | ||
} | ||
|
||
@Override | ||
public IDrawable getBackground() { | ||
return this.background; | ||
} | ||
|
||
@Override | ||
public IDrawable getIcon() { | ||
return this.icon; | ||
} | ||
|
||
@Override | ||
public void setRecipe(@Nonnull IRecipeLayoutBuilder builder, @Nonnull BambooMatRecipe recipe, @Nonnull IFocusGroup focusGroup) { | ||
builder.addSlot(RecipeIngredientRole.INPUT, 39, 46).addIngredients(recipe.getIngredients().get(0)); | ||
builder.addSlot(RecipeIngredientRole.INPUT, 57, 46).addIngredients(recipe.getIngredients().get(1)); | ||
builder.addSlot(RecipeIngredientRole.INPUT, 30, 22).addIngredients(recipe.getIngredients().get(2)); | ||
builder.addSlot(RecipeIngredientRole.INPUT, 48, 22).addIngredients(recipe.getIngredients().get(3)); | ||
builder.addSlot(RecipeIngredientRole.INPUT, 66, 22).addIngredients(recipe.getIngredients().get(4)); | ||
|
||
builder.addSlot(RecipeIngredientRole.OUTPUT, 129, 22).addItemStack(recipe.getResultItem()); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/ncpbails/culturaldelights/integration/JEICulturalDelightsPlugin.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,36 @@ | ||
package com.ncpbails.culturaldelights.integration; | ||
|
||
import com.ncpbails.culturaldelights.CulturalDelights; | ||
import com.ncpbails.culturaldelights.recipe.BambooMatRecipe; | ||
import mezz.jei.api.IModPlugin; | ||
import mezz.jei.api.JeiPlugin; | ||
import mezz.jei.api.recipe.RecipeType; | ||
import mezz.jei.api.registration.IRecipeCategoryRegistration; | ||
import mezz.jei.api.registration.IRecipeRegistration; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.item.crafting.RecipeManager; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
@JeiPlugin | ||
public class JEICulturalDelightsPlugin implements IModPlugin { | ||
@Override | ||
public ResourceLocation getPluginUid() { | ||
return new ResourceLocation(CulturalDelights.MOD_ID, "jei_plugin"); | ||
} | ||
|
||
@Override | ||
public void registerCategories(IRecipeCategoryRegistration registration) { | ||
registration.addRecipeCategories(new | ||
BambooMatRecipeCategory(registration.getJeiHelpers().getGuiHelper())); | ||
} | ||
|
||
@Override | ||
public void registerRecipes(IRecipeRegistration registration) { | ||
RecipeManager rm = Objects.requireNonNull(Minecraft.getInstance().level).getRecipeManager(); | ||
List<BambooMatRecipe> recipes = rm.getAllRecipesFor(BambooMatRecipe.Type.INSTANCE); | ||
registration.addRecipes(new RecipeType<>(BambooMatRecipeCategory.UID, BambooMatRecipe.class), recipes); | ||
} | ||
} |
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
43 changes: 43 additions & 0 deletions
43
src/main/java/com/ncpbails/culturaldelights/world/gen/ModWildCropGeneration.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,43 @@ | ||
package com.ncpbails.culturaldelights.world.gen; | ||
|
||
import com.ncpbails.culturaldelights.world.feature.ModPlacedFeatures; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.world.level.biome.Biome; | ||
import net.minecraft.world.level.levelgen.GenerationStep; | ||
import net.minecraft.world.level.levelgen.placement.PlacedFeature; | ||
import net.minecraftforge.common.BiomeDictionary; | ||
import net.minecraftforge.event.world.BiomeLoadingEvent; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class ModWildCropGeneration { | ||
public static void generateFlowers(final BiomeLoadingEvent event) { | ||
ResourceKey<Biome> key = ResourceKey.create(Registry.BIOME_REGISTRY, event.getName()); | ||
Set<BiomeDictionary.Type> types = BiomeDictionary.getTypes(key); | ||
|
||
if(types.contains(BiomeDictionary.Type.PLAINS)) { | ||
List<Holder<PlacedFeature>> base = | ||
event.getGeneration().getFeatures(GenerationStep.Decoration.VEGETAL_DECORATION); | ||
|
||
base.add(ModPlacedFeatures.WILD_CORN_PLACED); | ||
} | ||
|
||
if(types.contains(BiomeDictionary.Type.SWAMP)) { | ||
List<Holder<PlacedFeature>> base = | ||
event.getGeneration().getFeatures(GenerationStep.Decoration.VEGETAL_DECORATION); | ||
|
||
base.add(ModPlacedFeatures.WILD_EGGPLANTS_PLACED); | ||
base.add(ModPlacedFeatures.WILD_CUCUMBERS_PLACED); | ||
} | ||
|
||
if(types.contains(BiomeDictionary.Type.JUNGLE)) { | ||
List<Holder<PlacedFeature>> base = | ||
event.getGeneration().getFeatures(GenerationStep.Decoration.VEGETAL_DECORATION); | ||
|
||
base.add(ModPlacedFeatures.WILD_EGGPLANTS_PLACED); | ||
} | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/main/resources/data/culturaldelights/recipes/jungle_planks.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,13 @@ | ||
{ | ||
"type": "minecraft:crafting_shapeless", | ||
"group": "planks", | ||
"ingredients": [ | ||
{ | ||
"tag": "culturaldelights:avocado_logs" | ||
} | ||
], | ||
"result": { | ||
"item": "minecraft:jungle_planks", | ||
"count": 4 | ||
} | ||
} |
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
src/main/resources/data/culturaldelights/tags/items/avocado_logs.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 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"culturaldelights:avocado_log", | ||
"culturaldelights:avocado_wood" | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/resources/data/minecraft/tags/blocks/mineable/axe.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,8 @@ | ||
{ | ||
"replace": false, | ||
"values": [ | ||
"culturaldelights:avocado_wood", | ||
"culturaldelights:avocado_log", | ||
"culturaldelights:bamboo_mat" | ||
] | ||
} |
Oops, something went wrong.