Skip to content

Commit

Permalink
Implement potion cauldrons
Browse files Browse the repository at this point in the history
No brewing yet, but bottling and tipped arrows works
  • Loading branch information
KnightMiner committed Oct 30, 2022
1 parent f540299 commit 947ff4f
Show file tree
Hide file tree
Showing 40 changed files with 455 additions and 447 deletions.
10 changes: 2 additions & 8 deletions src/generated/resources/.cache/cache
Expand Up @@ -296,6 +296,7 @@ f280ee000a52a10701153862211a994503d2dcc7 data/inspirations/loot_tables/blocks/pi
7206af2b677328855b9a8c284326b308f0bf7968 data/inspirations/loot_tables/blocks/pipe.json
4e0d3a3ec09d691c73314948aa7dce9441acc96a data/inspirations/loot_tables/blocks/plain_mulch.json
454e0edadb6f3abe01e7d41dff87502f4f689ef4 data/inspirations/loot_tables/blocks/potato_soup_cauldron.json
454e0edadb6f3abe01e7d41dff87502f4f689ef4 data/inspirations/loot_tables/blocks/potion_cauldron.json
fd327a16d7fecc67ed0602589d5992d985573eb2 data/inspirations/loot_tables/blocks/potted_cyan.json
7e18036dec955f36c49b3e5b8423562a7a24a0af data/inspirations/loot_tables/blocks/potted_paeonia.json
3c3d0d49ae0b7d68544698a754a21a36b7991818 data/inspirations/loot_tables/blocks/potted_rose.json
Expand Down Expand Up @@ -518,16 +519,9 @@ a5dbcf365ff37b5617a28a057f057ec6ffa6eca1 data/inspirations/recipes/cauldron/ice/
55b751b5237c3c8dbe171f55604e7c7a94df5923 data/inspirations/recipes/cauldron/potato_soup/item.json
4bc0c49d46ca8634ad03920ad3fc73aa655f3db1 data/inspirations/recipes/cauldron/potion/forge_brewing.json
c9de2e3800af3d019d81be1eace6d08e6deb7195 data/inspirations/recipes/cauldron/potion/lingering_bottle.json
3c4d644f1f1072d8a9ada2ff147de2b0bcf15354 data/inspirations/recipes/cauldron/potion/lingering_empty.json
d9c611348b17634f9ea886a154104241a274db34 data/inspirations/recipes/cauldron/potion/lingering_fill.json
47424706c9c3dd50cc12453931821682d18a9f5c data/inspirations/recipes/cauldron/potion/normal_empty.json
49b05c1a42d06cfe853c8519028b6cfe07c2b8d9 data/inspirations/recipes/cauldron/potion/normal_fill.json
386ad3be1ee2b6d03ad0b8ea9024e7eab367f389 data/inspirations/recipes/cauldron/potion/potion_brewing.json
d7c18d79d56bd1d40532e86276130c76809f56af data/inspirations/recipes/cauldron/potion/potion_ferment.json
f8323b474fafb97b99f72e735540059420e4daf3 data/inspirations/recipes/cauldron/potion/splash_bottle.json
19f63976122e48ba4c58d5966fc3e3f88ba2633b data/inspirations/recipes/cauldron/potion/splash_empty.json
c7e3e2f5fd5b1366c14b1877727c3ba4e2e3dde6 data/inspirations/recipes/cauldron/potion/splash_fill.json
b0846b0af6bfeb156fbc5cbbc5cb23b188ab10b2 data/inspirations/recipes/cauldron/potion/tipped_arrow.json
16a719f79bdc48f49c973b2ccd36073b4601d990 data/inspirations/recipes/tools/barometer.json
fcb024c548dc92aa8e9f95e9a558faa00b0a629b data/inspirations/recipes/tools/charged_arrow.json
22d286d6b42e779b94afc402e616f6c1d0bfe320 data/inspirations/recipes/tools/dimension_compass.json
Expand Down Expand Up @@ -579,7 +573,7 @@ ed609d879b511fc63075a70306670eca432041c0 data/inspirations/tags/items/small_flow
6a070b00a6a93fa6077bad494c8ddc4ab303c4b8 data/inspirations/tags/items/terracotta.json
99552ca43885337f75f5a3b8813d495bf4f7d799 data/minecraft/tags/blocks/bamboo_plantable_on.json
85ffca6ba9dbf11c357e030212a6d171e185ac2e data/minecraft/tags/blocks/carpets.json
481a2abd45593c65e26e102436e3bd78d309904c data/minecraft/tags/blocks/cauldrons.json
16d653c5513b56a9bc7cd437dbaa6806aeadbfcc data/minecraft/tags/blocks/cauldrons.json
5f68bb98fe3d1964c24b8e6a95116911769d5fe8 data/minecraft/tags/blocks/climbable.json
de86ddaf84d20985b4cce5e7df18a2fff7832076 data/minecraft/tags/blocks/doors.json
00df993619a2f7d35c51e653f41bc1cda4577e0f data/minecraft/tags/blocks/flower_pots.json
Expand Down
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:item",
"name": "minecraft:cauldron"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -6,6 +6,7 @@
"inspirations:potato_soup_cauldron",
"inspirations:rabbit_stew_cauldron",
"inspirations:honey_cauldron",
"inspirations:dye_cauldron"
"inspirations:dye_cauldron",
"inspirations:potion_cauldron"
]
}
Expand Up @@ -92,6 +92,7 @@ private void addRecipes() {
this.dropOther(InspirationsRecipes.rabbitStewCauldron, Blocks.CAULDRON);
this.dropOther(InspirationsRecipes.honeyCauldron, Blocks.CAULDRON);
this.dropOther(InspirationsRecipes.dyeCauldron, Blocks.CAULDRON);
this.dropOther(InspirationsRecipes.potionCauldron, Blocks.CAULDRON);
}

private void addTools() {
Expand Down
Expand Up @@ -68,7 +68,8 @@ private void registerVanillaTags() {
);
this.tag(BlockTags.CAULDRONS).add(InspirationsRecipes.beetrootSoupCauldron, InspirationsRecipes.mushroomStewCauldron,
InspirationsRecipes.potatoSoupCauldron, InspirationsRecipes.rabbitStewCauldron,
InspirationsRecipes.honeyCauldron, InspirationsRecipes.dyeCauldron);
InspirationsRecipes.honeyCauldron,
InspirationsRecipes.dyeCauldron, InspirationsRecipes.potionCauldron);
}

private void registerHarvestTags() {
Expand Down
@@ -0,0 +1,50 @@
package knightminer.inspirations.common.network;

import knightminer.inspirations.library.MiscUtil;
import knightminer.inspirations.recipes.block.entity.PotionCauldronBlockEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraftforge.network.NetworkEvent.Context;
import net.minecraftforge.registries.ForgeRegistries;
import slimeknights.mantle.network.packet.IThreadsafePacket;
import slimeknights.mantle.util.BlockEntityHelper;

/** Packet to update the potion in a cauldron */
public class CauldronPotionUpdatePacket implements IThreadsafePacket {
private final BlockPos pos;
private final Potion potion;

public CauldronPotionUpdatePacket(BlockPos pos, Potion potion) {
this.pos = pos;
this.potion = potion;
}

public CauldronPotionUpdatePacket(FriendlyByteBuf buffer) {
this.pos = buffer.readBlockPos();
this.potion = buffer.readRegistryIdUnsafe(ForgeRegistries.POTIONS);
}

@Override
public void encode(FriendlyByteBuf buffer) {
buffer.writeBlockPos(pos);
buffer.writeRegistryIdUnsafe(ForgeRegistries.POTIONS, potion);
}

@Override
public void handleThreadsafe(Context context) {
HandleClient.handle(this);
}

/** Once removed client class */
private static class HandleClient {
private static void handle(CauldronPotionUpdatePacket packet) {
BlockEntityHelper.get(PotionCauldronBlockEntity.class, Minecraft.getInstance().level, packet.pos, true).ifPresent(te -> {
if (te.setPotion(packet.potion)) {
MiscUtil.notifyClientUpdate(te);
}
});
}
}
}
Expand Up @@ -27,6 +27,7 @@ public void setup() {
registerPacket(MilkablePacket.class, MilkablePacket::new, NetworkDirection.PLAY_TO_CLIENT);
registerPacket(CauldronStateUpdatePacket.class, CauldronStateUpdatePacket::new, NetworkDirection.PLAY_TO_CLIENT);
registerPacket(CauldronColorUpdatePacket.class, CauldronColorUpdatePacket::new, NetworkDirection.PLAY_TO_CLIENT);
registerPacket(CauldronPotionUpdatePacket.class, CauldronPotionUpdatePacket::new, NetworkDirection.PLAY_TO_CLIENT);
registerPacket(CauldronTransformUpatePacket.class, CauldronTransformUpatePacket::new, NetworkDirection.PLAY_TO_CLIENT);
registerPacket(DimensionCompassPositionPacket.class, DimensionCompassPositionPacket::new, NetworkDirection.PLAY_TO_CLIENT);
}
Expand Down
Expand Up @@ -3,8 +3,6 @@
import knightminer.inspirations.Inspirations;
import knightminer.inspirations.library.recipe.cauldron.recipe.CauldronRecipe;
import knightminer.inspirations.library.recipe.cauldron.recipe.CauldronTransform;
import knightminer.inspirations.library.recipe.cauldron.special.EmptyPotionCauldronRecipe;
import knightminer.inspirations.library.recipe.cauldron.special.FillPotionCauldronRecipe;
import knightminer.inspirations.library.recipe.crafting.ShapelessNoContainerRecipe;
import knightminer.inspirations.recipes.recipe.cauldron.BrewingCauldronRecipe;
import knightminer.inspirations.recipes.recipe.cauldron.PotionFermentCauldronTransform;
Expand All @@ -25,9 +23,6 @@ public class RecipeSerializers {
*/
public static final CauldronRecipe.Serializer CAULDRON = injected();
public static final CauldronTransform.Serializer CAULDRON_TRANSFORM = injected();
// advanced recipes
public static final EmptyPotionCauldronRecipe.Serializer CAULDRON_EMPTY_POTION = injected();
public static final FillPotionCauldronRecipe.Serializer CAULDRON_FILL_POTION = injected();
// special recipes
public static final BrewingCauldronRecipe.Serializer CAULDRON_POTION_BREWING = injected();
public static final BrewingCauldronRecipe.Serializer CAULDRON_FORGE_BREWING = injected();
Expand Down

0 comments on commit 947ff4f

Please sign in to comment.