Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pysankers table test #3

Merged
merged 2 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions src/main/java/com/megatrex4/ukrainian_dlight/UkrainianDelight.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

import com.megatrex4.ukrainian_dlight.block.DrinkBottleBlock;
import com.megatrex4.ukrainian_dlight.block.FoodJarBlocks;
import com.megatrex4.ukrainian_dlight.block.ModBlocks;
import com.megatrex4.ukrainian_dlight.registry.BlockRegistry;
import com.megatrex4.ukrainian_dlight.block.entity.ModBlockEntities;
//import com.megatrex4.ukrainian_dlight.compat.patchouli.CustomBrewingRecipeProcessor;
import com.megatrex4.ukrainian_dlight.config.ModConfig;
import com.megatrex4.ukrainian_dlight.initialize.CustomizeLootTables;
import com.megatrex4.ukrainian_dlight.registry.initialize.CustomizeLootTables;
import com.megatrex4.ukrainian_dlight.item.ModItemGroups;
import com.megatrex4.ukrainian_dlight.item.ModItems;
import com.megatrex4.ukrainian_dlight.registry.ItemsRegistry;
import com.megatrex4.ukrainian_dlight.item.ToolTipHelper;
import com.megatrex4.ukrainian_dlight.networking.ModMessages;
import com.megatrex4.ukrainian_dlight.recipe.ModRecipes;
import com.megatrex4.ukrainian_dlight.screen.ModScreenHandlers;
import com.megatrex4.ukrainian_dlight.screen.ModScreens;
import com.megatrex4.ukrainian_dlight.registry.RecipesRegistry;
import com.megatrex4.ukrainian_dlight.registry.ScreenHandlersRegistry;
import com.megatrex4.ukrainian_dlight.registry.ScreensRegistry;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.item.ItemConvertible;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.MutableText;
Expand All @@ -41,15 +43,15 @@ public static MutableText i18n(String key, Object... args) {
public void onInitialize() {
FoodJarBlocks.registerFoodBlocks();
DrinkBottleBlock.registerDrinkBlock();
ModBlocks.registerModBlocks();
ModItems.registerModItems();
BlockRegistry.registerModBlocks();
ItemsRegistry.registerModItems();
ModItemGroups.registerItemGroups();
ToolTipHelper.registerTooltip();
ModBlockEntities.registerBlockEntities();
ModScreenHandlers.registerModScreenHandlers();
ScreenHandlersRegistry.registerModScreenHandlers();
ModMessages.registerS2CPackets();
ModRecipes.registerRecipes();
ModScreens.registerScreens();
RecipesRegistry.registerRecipes();
ScreensRegistry.registerScreens();
ModConfig.loadConfig();
CustomizeLootTables.register();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
package com.megatrex4.ukrainian_dlight;

import com.megatrex4.ukrainian_dlight.screen.BrewingKegScreen;
import com.megatrex4.ukrainian_dlight.screen.ModScreenHandlers;
import com.megatrex4.ukrainian_dlight.registry.ScreenHandlersRegistry;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.client.render.RenderLayer;

public class UkrainianDeligthClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
HandledScreens.register(ModScreenHandlers.BREWING_KEG_SCREEN_HANDLER, BrewingKegScreen::new);
HandledScreens.register(ScreenHandlersRegistry.BREWING_KEG_SCREEN_HANDLER, BrewingKegScreen::new);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.megatrex4.ukrainian_dlight.block.custom;
package com.megatrex4.ukrainian_dlight.block;

import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package com.megatrex4.ukrainian_dlight.block.custom;
package com.megatrex4.ukrainian_dlight.block;

import com.megatrex4.ukrainian_dlight.UkrainianDelight;
import com.megatrex4.ukrainian_dlight.block.entity.BrewingKegBlockEntity;
import com.megatrex4.ukrainian_dlight.block.entity.ModBlockEntities;
import com.megatrex4.ukrainian_dlight.screen.renderer.FluidStackRenderer;
import com.megatrex4.ukrainian_dlight.util.CompoundTagUtils;
import com.megatrex4.ukrainian_dlight.util.FluidStack;

import net.fabricmc.api.EnvType;
Expand All @@ -18,39 +17,30 @@
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventories;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.registry.Registries;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.state.property.Property;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
import net.minecraft.util.*;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;

import java.util.Iterator;
import java.util.List;

public class BrewingKegBlock extends BlockWithEntity implements BlockEntityProvider {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.megatrex4.ukrainian_dlight.block.custom;
package com.megatrex4.ukrainian_dlight.block;

import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.megatrex4.ukrainian_dlight.block;

import com.megatrex4.ukrainian_dlight.UkrainianDelight;
import com.megatrex4.ukrainian_dlight.block.custom.BottleBlock;
import com.megatrex4.ukrainian_dlight.item.DrinkBlockItem;
import net.minecraft.block.Block;
import net.minecraft.entity.effect.StatusEffectInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.megatrex4.ukrainian_dlight.block;

import com.megatrex4.ukrainian_dlight.UkrainianDelight;
import com.megatrex4.ukrainian_dlight.block.custom.JarBlock;
import com.megatrex4.ukrainian_dlight.item.FoodBlockItem;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.megatrex4.ukrainian_dlight.block.custom;
package com.megatrex4.ukrainian_dlight.block;

import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.megatrex4.ukrainian_dlight.block.custom;
package com.megatrex4.ukrainian_dlight.block;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.megatrex4.ukrainian_dlight.block.entity;

import com.megatrex4.ukrainian_dlight.block.custom.BrewingKegBlock;
import com.megatrex4.ukrainian_dlight.block.entity.inventory.ImplementedInventory;
import com.megatrex4.ukrainian_dlight.config.ModConfig;
import com.megatrex4.ukrainian_dlight.networking.ModMessages;
import com.megatrex4.ukrainian_dlight.recipe.BrewingRecipe;
import com.megatrex4.ukrainian_dlight.recipe.ModRecipes;
import com.megatrex4.ukrainian_dlight.registry.ModTags;
import com.megatrex4.ukrainian_dlight.registry.RecipesRegistry;
import com.megatrex4.ukrainian_dlight.screen.BrewingKegScreenHandler;
import com.megatrex4.ukrainian_dlight.util.CompoundTagUtils;
import com.megatrex4.ukrainian_dlight.util.FluidStack;
Expand All @@ -18,7 +16,6 @@
import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidConstants;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant;
import net.fabricmc.fabric.api.transfer.v1.storage.base.SingleVariantStorage;
import net.fabricmc.fabric.api.transfer.v1.transaction.Transaction;
Expand All @@ -31,16 +28,13 @@
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventories;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeType;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.server.network.ServerPlayerEntity;
Expand All @@ -53,13 +47,10 @@
import net.minecraft.util.math.*;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import vectorwing.farmersdelight.common.crafting.CookingPotRecipe;
import vectorwing.farmersdelight.common.mixin.accessor.RecipeManagerAccessor;
import vectorwing.farmersdelight.common.registry.ModRecipeTypes;

import java.util.*;

import static com.megatrex4.ukrainian_dlight.block.custom.BrewingKegBlock.FACING;
import static com.megatrex4.ukrainian_dlight.block.BrewingKegBlock.FACING;

public class BrewingKegBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory, ImplementedInventory {
private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize(INVENTORY_SIZE, ItemStack.EMPTY);
Expand Down Expand Up @@ -570,7 +561,7 @@ public void setFluidLevel(FluidVariant fluidVariant, long fluidLevel) {

private Optional<BrewingRecipe> getCurrentRecipe() {
if (world == null) return Optional.empty();
return world.getRecipeManager().getFirstMatch(ModRecipes.BREWING, this, world);
return world.getRecipeManager().getFirstMatch(RecipesRegistry.BREWING, this, world);
}

public boolean isContainerValid(ItemStack containerItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import com.megatrex4.ukrainian_dlight.UkrainianDelight;
import com.megatrex4.ukrainian_dlight.block.ModBlocks;
import com.megatrex4.ukrainian_dlight.registry.BlockRegistry;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorage;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.registry.Registries;
Expand All @@ -15,7 +15,7 @@ public static void registerBlockEntities() {
BREWING_KEG_BLOCK_ENTITY = Registry.register(Registries.BLOCK_ENTITY_TYPE,
new Identifier(UkrainianDelight.MOD_ID, "brewing_keg_be"),
FabricBlockEntityTypeBuilder.create(BrewingKegBlockEntity::new,
ModBlocks.BREWING_KEG).build(null));
BlockRegistry.BREWING_KEG).build(null));

FluidStorage.SIDED.registerForBlockEntity((blockEntity, direction) -> blockEntity.fluidStorage, BREWING_KEG_BLOCK_ENTITY);
UkrainianDelight.LOGGER.info("Registering Mod Block Entities for " + UkrainianDelight.MOD_ID);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.megatrex4.ukrainian_dlight.features;
package com.megatrex4.ukrainian_dlight.gen.features;

import com.megatrex4.ukrainian_dlight.UkrainianDelight;
import com.megatrex4.ukrainian_dlight.features.features.SaltCavesFeature;
import com.megatrex4.ukrainian_dlight.features.features.config.SaltCavesFeatureConfig;
import com.megatrex4.ukrainian_dlight.gen.features.features.SaltCavesFeature;
import com.megatrex4.ukrainian_dlight.gen.features.features.config.SaltCavesFeatureConfig;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.world.gen.feature.Feature;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.megatrex4.ukrainian_dlight.features.features;
package com.megatrex4.ukrainian_dlight.gen.features.features;


import com.megatrex4.ukrainian_dlight.features.features.config.SaltCavesFeatureConfig;
import com.megatrex4.ukrainian_dlight.gen.features.features.config.SaltCavesFeatureConfig;
import com.mojang.serialization.Codec;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.megatrex4.ukrainian_dlight.features.features.config;
package com.megatrex4.ukrainian_dlight.gen.features.features.config;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.megatrex4.ukrainian_dlight.item;

import com.megatrex4.ukrainian_dlight.UkrainianDelight;
import com.megatrex4.ukrainian_dlight.registry.ModTags;
import com.megatrex4.ukrainian_dlight.registry.TagsRegistry;
import com.megatrex4.ukrainian_dlight.util.StatusEffectUtil;
import com.mojang.datafixers.util.Pair;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
Expand All @@ -22,12 +22,10 @@
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

public class DrinkBlockItem extends BlockItem {
private final FoodComponent foodComponent;
Expand Down Expand Up @@ -155,13 +153,13 @@ public void appendTooltip(ItemStack stack, World world, List<Text> tooltip, Tool
}

// Check if the item is in the drink tags and add corresponding tooltip
if (stack.isIn(ModTags.LIGHT_DRINK)) {
if (stack.isIn(TagsRegistry.LIGHT_DRINK)) {
tooltip.add(Text.literal("").formatted(Formatting.GRAY));
tooltip.add(UkrainianDelight.i18n("tooltip.light_drink").formatted(Formatting.GREEN));
} else if (stack.isIn(ModTags.MID_DRINK)) {
} else if (stack.isIn(TagsRegistry.MID_DRINK)) {
tooltip.add(Text.literal("").formatted(Formatting.GRAY));
tooltip.add(UkrainianDelight.i18n("tooltip.mid_drink").formatted(Formatting.YELLOW));
} else if (stack.isIn(ModTags.STRONG_DRINK)) {
} else if (stack.isIn(TagsRegistry.STRONG_DRINK)) {
tooltip.add(Text.literal("").formatted(Formatting.GRAY));
tooltip.add(UkrainianDelight.i18n("tooltip.strong_drink").formatted(Formatting.RED));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;

public class ItemBuilder {
public class FoodItemBuilder {
private FoodComponent foodComponent;
private int maxCount = 64;
private Boolean returnsBowl = false;

public ItemBuilder food(FoodComponent foodComponent) {
public FoodItemBuilder food(FoodComponent foodComponent) {
this.foodComponent = foodComponent;
return this;
}

public ItemBuilder maxCount(int maxCount) {
public FoodItemBuilder maxCount(int maxCount) {
this.maxCount = maxCount;
return this;
}

public ItemBuilder returnsBowl() {
public FoodItemBuilder returnsBowl() {
this.returnsBowl = true;
return this;
}

public ItemBuilder returnsBowl(boolean returnsBowl) {
public FoodItemBuilder returnsBowl(boolean returnsBowl) {
this.returnsBowl = returnsBowl;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.megatrex4.ukrainian_dlight.item;

import net.minecraft.client.item.TooltipContext;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.world.World;

import java.util.List;

public class KrashankyItem extends Item {
public KrashankyItem(Settings settings) {
super(settings);
}
}
Loading