generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
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
MCZME
committed
Aug 22, 2024
1 parent
0044742
commit b497f79
Showing
41 changed files
with
1,511 additions
and
52 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d
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,6 @@ | ||
// 1.21 2024-08-13T03:55:33.7091711 Loot Tables | ||
// 1.21 2024-08-22T18:03:26.4830973 Loot Tables | ||
032b2242788b8411178136ca48214246ef2af8a9 data/lingshi/loot_table/blocks/chopping_board.json | ||
63e60d75a79e0a64eb6338f6bc98dddd6a8d6a0b data/lingshi/loot_table/blocks/cooking_pot.json | ||
67cc122cf5e7e5865ff9bc81fec6e8371225b0d6 data/lingshi/loot_table/blocks/skillet.json | ||
c843630bb0739aad37078f0119c9cc31f5316c3a data/lingshi/loot_table/blocks/tea_leaf.json | ||
3cd0ced47f090fec162cddcb8b2f75284fa134cb data/lingshi/loot_table/blocks/tea_tree.json |
4 changes: 2 additions & 2 deletions
4
src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361
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,2 +1,2 @@ | ||
// 1.21 2024-08-21T06:16:10.9126133 Languages: zh_cn for mod: lingshi | ||
18193d8163c50d2682857150071f4b38892474cb assets/lingshi/lang/zh_cn.json | ||
// 1.21 2024-08-22T18:03:26.4900985 Languages: zh_cn for mod: lingshi | ||
2012858b997388159ffda305994f25429de3d030 assets/lingshi/lang/zh_cn.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
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
21 changes: 21 additions & 0 deletions
21
src/generated/resources/data/lingshi/loot_table/blocks/cooking_pot.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,21 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "lingshi:cooking_pot" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "lingshi:blocks/cooking_pot" | ||
} |
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
158 changes: 158 additions & 0 deletions
158
src/main/java/mczme/lingshi/client/menu/CookingPotMenu.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,158 @@ | ||
package mczme.lingshi.client.menu; | ||
|
||
import mczme.lingshi.client.menu.Slot.CookingItemStackHandler; | ||
import mczme.lingshi.client.menu.Slot.ResultSlot; | ||
import mczme.lingshi.common.block.entity.CookingPotBlockEntity; | ||
import mczme.lingshi.common.recipe.CookingPotRecipe; | ||
import mczme.lingshi.common.recipe.input.CookingFoodRecipeInput; | ||
import mczme.lingshi.common.registry.ModMenuTypes; | ||
import net.minecraft.network.FriendlyByteBuf; | ||
import net.minecraft.world.entity.player.Inventory; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.entity.player.StackedContents; | ||
import net.minecraft.world.inventory.RecipeBookMenu; | ||
import net.minecraft.world.inventory.RecipeBookType; | ||
import net.minecraft.world.inventory.Slot; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.crafting.RecipeHolder; | ||
import net.minecraft.world.level.Level; | ||
import net.neoforged.neoforge.items.ItemStackHandler; | ||
import net.neoforged.neoforge.items.SlotItemHandler; | ||
|
||
import static mczme.lingshi.client.recipebook.ModRecipeBookType.COOKING_POT; | ||
|
||
public class CookingPotMenu extends RecipeBookMenu<CookingFoodRecipeInput, CookingPotRecipe> { | ||
|
||
public CookingPotBlockEntity blockEntity; | ||
protected final Level level; | ||
private final CookingItemStackHandler itemStackHandler; | ||
|
||
public CookingPotMenu(int pContainerId, Inventory pPlayerInventory, FriendlyByteBuf pContext) { | ||
this(pContainerId, pPlayerInventory,(CookingPotBlockEntity) pPlayerInventory.player.level().getBlockEntity(pContext.readBlockPos())); | ||
} | ||
|
||
public CookingPotMenu(int pContainerId,Inventory pPlayerInventory, CookingPotBlockEntity blockEntity) { | ||
super(ModMenuTypes.COOKING_POT_MENU.get(), pContainerId); | ||
checkContainerSize(pPlayerInventory, 1); | ||
this.blockEntity = blockEntity; | ||
this.level = pPlayerInventory.player.level(); | ||
this.itemStackHandler = blockEntity.getItemStacks(); | ||
this.addWorkSlot(itemStackHandler); | ||
layoutPlayerInventorySlots(pPlayerInventory); | ||
} | ||
|
||
private void addWorkSlot(ItemStackHandler itemStacks) { | ||
int[] X = {33, 51, 69,33, 51, 69, 93, 127}; | ||
int[] Y = {29, 29, 29,47, 47, 47, 29, 47}; | ||
for (int i = 0; i < blockEntity.getMAX(); i++) { | ||
SlotItemHandler slot = new SlotItemHandler(itemStackHandler, i, X[i], Y[i]); | ||
slot.set(itemStacks.getStackInSlot(i)); | ||
this.addSlot(slot); | ||
} | ||
itemStackHandler.setStackInSlot(6,blockEntity.container); | ||
this.addSlot(new ResultSlot(itemStackHandler, 6, X[6], Y[6])); | ||
itemStackHandler.setStackInSlot(7,blockEntity.result); | ||
this.addSlot(new ResultSlot(itemStackHandler, 7, X[7], Y[7])); | ||
} | ||
|
||
private void layoutPlayerInventorySlots(Inventory playerInventory) { | ||
// Player inventory | ||
for (int i = 0; i < 3; ++i) { | ||
for (int l = 0; l < 9; ++l) { | ||
this.addSlot(new Slot(playerInventory, l + i * 9 + 9, 8 + l * 18, 84 + i * 18)); | ||
} | ||
} | ||
// Hotbar | ||
for (int i = 0; i < 9; ++i) { | ||
this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); | ||
} | ||
} | ||
|
||
@Override | ||
public void fillCraftSlotsStackedContents(StackedContents pItemHelper) { | ||
for (int i = 0; i < blockEntity.getMAX(); i++) { | ||
pItemHelper.accountSimpleStack(itemStackHandler.getStackInSlot(i)); | ||
} | ||
} | ||
|
||
@Override | ||
public void clearCraftingContent() { | ||
for (int i = 0; i < blockEntity.getMAX()-2; i++) { | ||
this.getSlot(i).set(ItemStack.EMPTY); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean recipeMatches(RecipeHolder<CookingPotRecipe> pRecipe) { | ||
return pRecipe.value().matches(new CookingFoodRecipeInput(itemStackHandler,blockEntity.getFluid()), this.level); | ||
} | ||
|
||
@Override | ||
public int getResultSlotIndex() { | ||
return 7; | ||
} | ||
|
||
@Override | ||
public int getGridWidth() { | ||
return 6; | ||
} | ||
|
||
@Override | ||
public int getGridHeight() { | ||
return 1; | ||
} | ||
|
||
@Override | ||
public int getSize() { | ||
return 8; | ||
} | ||
|
||
@Override | ||
public RecipeBookType getRecipeBookType() { | ||
return COOKING_POT; | ||
} | ||
|
||
@Override | ||
public boolean shouldMoveToInventory(int pSlotIndex) { | ||
return pSlotIndex != this.getResultSlotIndex(); | ||
} | ||
|
||
@Override | ||
public ItemStack quickMoveStack(Player pPlayer, int pIndex) { | ||
ItemStack quickMovedStack = ItemStack.EMPTY; | ||
Slot quickMovedSlot = this.slots.get(pIndex); | ||
if (quickMovedSlot.hasItem()) { | ||
ItemStack rawStack = quickMovedSlot.getItem(); | ||
quickMovedStack = rawStack.copy(); | ||
if (pIndex >= 8 && pIndex < 43) { | ||
if (!this.moveItemStackTo(rawStack, 0, 6, false)) { | ||
if (pIndex < 32) { | ||
if (!this.moveItemStackTo(rawStack, 34, 43, false)) { | ||
return ItemStack.EMPTY; | ||
} | ||
} else if (!this.moveItemStackTo(rawStack, 8, 34, false)) { | ||
return ItemStack.EMPTY; | ||
} | ||
} | ||
} else if (!this.moveItemStackTo(rawStack, 7, 43, false)) { | ||
return ItemStack.EMPTY; | ||
} | ||
|
||
if (rawStack.isEmpty()) { | ||
quickMovedSlot.set(ItemStack.EMPTY); | ||
} else { | ||
quickMovedSlot.setChanged(); | ||
} | ||
if (rawStack.getCount() == quickMovedStack.getCount()) { | ||
return ItemStack.EMPTY; | ||
} | ||
quickMovedSlot.onTake(pPlayer, rawStack); | ||
} | ||
return quickMovedStack; | ||
} | ||
|
||
@Override | ||
public boolean stillValid(Player pPlayer) { | ||
return true; | ||
} | ||
} |
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.