-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recipes, Tweaks/Fixes, More Organization (TM)
- Loading branch information
1 parent
ef4aa25
commit 5b242be
Showing
105 changed files
with
2,259 additions
and
94 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
75 changes: 75 additions & 0 deletions
75
src/main/java/com/starfish_studios/seasons_greetings/crafting/GiftBoxColoring.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,75 @@ | ||
package com.starfish_studios.seasons_greetings.crafting; | ||
|
||
import com.starfish_studios.seasons_greetings.block.GiftBoxBlock; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.world.item.DyeItem; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.Items; | ||
import net.minecraft.world.item.crafting.CraftingBookCategory; | ||
import net.minecraft.world.item.crafting.CraftingInput; | ||
import net.minecraft.world.item.crafting.CustomRecipe; | ||
import net.minecraft.world.item.crafting.RecipeSerializer; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class GiftBoxColoring extends CustomRecipe { | ||
public GiftBoxColoring(CraftingBookCategory craftingBookCategory) { | ||
super(craftingBookCategory); | ||
} | ||
|
||
public boolean matches(CraftingInput craftingInput, Level level) { | ||
int i = 0; | ||
int j = 0; | ||
|
||
for(int k = 0; k < craftingInput.size(); ++k) { | ||
ItemStack itemStack = craftingInput.getItem(k); | ||
if (!itemStack.isEmpty()) { | ||
if (Block.byItem(itemStack.getItem()) instanceof GiftBoxBlock) { | ||
++i; | ||
} else { | ||
if (!(itemStack.getItem() instanceof DyeItem)) { | ||
return false; | ||
} | ||
|
||
++j; | ||
} | ||
|
||
if (j > 1 || i > 1) { | ||
return false; | ||
} | ||
} | ||
} | ||
|
||
return i == 1 && j == 1; | ||
} | ||
|
||
public @NotNull ItemStack assemble(CraftingInput craftingInput, HolderLookup.Provider provider) { | ||
ItemStack itemStack = ItemStack.EMPTY; | ||
DyeItem dyeItem = (DyeItem) Items.WHITE_DYE; | ||
|
||
for(int i = 0; i < craftingInput.size(); ++i) { | ||
ItemStack itemStack2 = craftingInput.getItem(i); | ||
if (!itemStack2.isEmpty()) { | ||
Item item = itemStack2.getItem(); | ||
if (Block.byItem(item) instanceof GiftBoxBlock) { | ||
itemStack = itemStack2; | ||
} else if (item instanceof DyeItem) { | ||
dyeItem = (DyeItem)item; | ||
} | ||
} | ||
} | ||
|
||
Block block = GiftBoxBlock.getBlockByColor(dyeItem.getDyeColor()); | ||
return itemStack.transmuteCopy(block, 1); | ||
} | ||
|
||
public boolean canCraftInDimensions(int i, int j) { | ||
return i * j >= 2; | ||
} | ||
|
||
public @NotNull RecipeSerializer<?> getSerializer() { | ||
return SGRecipeSerializer.GIFT_BOX_COLORING; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/starfish_studios/seasons_greetings/crafting/SGRecipeSerializer.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,19 @@ | ||
package com.starfish_studios.seasons_greetings.crafting; | ||
|
||
import com.starfish_studios.seasons_greetings.SeasonsGreetings; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.world.item.crafting.Recipe; | ||
import net.minecraft.world.item.crafting.RecipeSerializer; | ||
import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; | ||
|
||
public interface SGRecipeSerializer { | ||
SimpleCraftingRecipeSerializer<GiftBoxColoring> GIFT_BOX_COLORING = register("gift_box_coloring", new SimpleCraftingRecipeSerializer<>(GiftBoxColoring::new)); | ||
|
||
static void registerCustomRecipes() { | ||
} | ||
|
||
static <S extends RecipeSerializer<T>, T extends Recipe<?>> S register(String string, S recipeSerializer) { | ||
return Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, SeasonsGreetings.id(string), recipeSerializer); | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/starfish_studios/seasons_greetings/inventory/GiftBoxSlot.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,15 @@ | ||
package com.starfish_studios.seasons_greetings.inventory; | ||
|
||
import net.minecraft.world.Container; | ||
import net.minecraft.world.inventory.Slot; | ||
import net.minecraft.world.item.ItemStack; | ||
|
||
public class GiftBoxSlot extends Slot { | ||
public GiftBoxSlot(Container container, int i, int j, int k) { | ||
super(container, i, j, k); | ||
} | ||
|
||
public boolean mayPlace(ItemStack itemStack) { | ||
return itemStack.getItem().canFitInsideContainerItems(); | ||
} | ||
} |
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
4 changes: 3 additions & 1 deletion
4
src/main/java/com/starfish_studios/seasons_greetings/registry/SGRegistry.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
Binary file modified
BIN
+59 Bytes
(110%)
src/main/resources/assets/seasonsgreetings/textures/block/peppermint_top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions
32
...in/resources/data/seasonsgreetings/advancement/recipes/building_blocks/chiseled_snow.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,32 @@ | ||
{ | ||
"parent": "minecraft:recipes/root", | ||
"criteria": { | ||
"has_item": { | ||
"conditions": { | ||
"items": [ | ||
{ | ||
"items": "minecraft:snowball" | ||
} | ||
] | ||
}, | ||
"trigger": "minecraft:inventory_changed" | ||
}, | ||
"has_recipe": { | ||
"conditions": { | ||
"recipe": "seasonsgreetings:chiseled_snow" | ||
}, | ||
"trigger": "minecraft:recipe_unlocked" | ||
} | ||
}, | ||
"requirements": [ | ||
[ | ||
"has_recipe", | ||
"has_item" | ||
] | ||
], | ||
"rewards": { | ||
"recipes": [ | ||
"seasonsgreetings:chiseled_snow" | ||
] | ||
} | ||
} |
Oops, something went wrong.