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

Update to 1.19.2 #1

Draft
wants to merge 1 commit into
base: 1.18.2
Choose a base branch
from
Draft
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
17 changes: 7 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'


version = '1.0'
version = '1.19.2-2.1'
group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'modid'
archivesBaseName = 'LightMeals'

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Expand All @@ -43,7 +43,7 @@ minecraft {
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'official', version: '1.18.2'
mappings channel: 'official', version: '1.19.2'

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.

Expand Down Expand Up @@ -166,15 +166,12 @@ dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.18.2-40.1.68'
minecraft 'net.minecraftforge:forge:1.19.2-43.2.0'
annotationProcessor "org.spongepowered:mixin:0.8.5:processor"

implementation fg.deobf ("slimeknights.mantle:Mantle:1.18.2-1.9.27")
implementation fg.deobf ("slimeknights.tconstruct:TConstruct:1.18.2-3.5.1.31")
implementation fg.deobf("curse.maven:farmers_delight-398521:3834150")
implementation fg.deobf("curse.maven:farmers_delight-398521:3999157")

compileOnly fg.deobf ("mezz.jei:jei-1.18.2:9.7.1.232:api")
runtimeOnly fg.deobf ("mezz.jei:jei-1.18.2:9.7.1.232")
runtimeOnly fg.deobf ("mezz.jei:jei-1.19.2-forge:11.6.0.1013")
// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
Expand Down Expand Up @@ -224,4 +221,4 @@ publishing {

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
}
19 changes: 11 additions & 8 deletions src/main/java/hashmod/lightmeals/LightMeals.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoadingContext;
Expand All @@ -30,6 +28,8 @@
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegisterEvent;

import java.util.HashMap;
import java.util.Map;
Expand All @@ -52,6 +52,7 @@ public LightMeals() {
ModItems.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
ModBlocks.BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
ModFluids.FLUIDS.register(FMLJavaModLoadingContext.get().getModEventBus());
ModFluids.FLUID_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus());

MinecraftForge.EVENT_BUS.register(this);
}
Expand Down Expand Up @@ -95,8 +96,10 @@ public static void onModConfig(final ModConfigEvent event) {
}

@SubscribeEvent
public static void registerRecipeSerializers(final RegistryEvent.Register<RecipeSerializer<?>> event) {
CraftingHelper.register(ConfigEnabledCondition.Serializer.INSTANCE);
public static void registerSerializers(RegisterEvent event) {
event.register(ForgeRegistries.Keys.RECIPE_SERIALIZERS,
helper -> CraftingHelper.register(ConfigEnabledCondition.Serializer.INSTANCE)
);
}
}

Expand All @@ -105,10 +108,10 @@ public static class ForgeRegistry {

@SubscribeEvent
public static void onLivingDrops(final LivingDropsEvent event) {
if (!event.getEntityLiving().isBaby()) {
if (!event.getEntity().isBaby()) {
for (Class<?> entityClass : DROP_LIST.keySet()) {
if (entityClass.isInstance(event.getEntityLiving())) {
ItemEntity item = DROP_LIST.get(entityClass).getDrop(event.getEntityLiving());
if (entityClass.isInstance(event.getEntity())) {
ItemEntity item = DROP_LIST.get(entityClass).getDrop(event.getEntity());
if (item != null) {
event.getDrops().add(item);
}
Expand Down Expand Up @@ -142,4 +145,4 @@ public ItemEntity getDrop(LivingEntity entity) {
return null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ResourceLocation getID() {
}

@Override
public boolean test() {
public boolean test(IContext context) {
try {
return !LightMealsConfig.class.getField(config_key).getBoolean(null);
} catch (IllegalAccessException | NoSuchFieldException e) {
Expand Down
43 changes: 31 additions & 12 deletions src/main/java/hashmod/lightmeals/fluids/CaramelFluid.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,47 @@
import hashmod.lightmeals.LightMealsUtils;
import hashmod.lightmeals.registry.ModFluids;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
import net.minecraftforge.common.SoundActions;
import net.minecraftforge.fluids.FluidType;
import net.minecraftforge.fluids.ForgeFlowingFluid;
import net.minecraftforge.registries.RegistryObject;

import static hashmod.lightmeals.registry.ModBlocks.CARAMEL_BLOCK;
import static hashmod.lightmeals.registry.ModItems.CARAMEL_BUCKET;
import java.util.function.Consumer;

import static hashmod.lightmeals.registry.ModBlocks.*;
import static hashmod.lightmeals.registry.ModItems.*;

public class CaramelFluid {

private static final String id = "caramel";
public static RegistryObject<FlowingFluid> STILL = ModFluids.FLUIDS.register(id, () -> new ForgeFlowingFluid.Source(makeProperties()));
public static RegistryObject<FlowingFluid> FLOWING = ModFluids.FLUIDS.register(id + "_flowing", () -> new ForgeFlowingFluid.Flowing(makeProperties()));
public static RegistryObject<FluidType> TYPE = ModFluids.FLUID_TYPES.register(id, () -> new FluidType(FluidType.Properties.create()
.fallDistanceModifier(0.0F).canExtinguish(true).supportsBoating(true)
.sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL).sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_FILL)
.sound(SoundActions.FLUID_VAPORIZE, SoundEvents.FIRE_EXTINGUISH)) {
public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) {
consumer.accept(new IClientFluidTypeExtensions() {
private static final ResourceLocation STILL = new ResourceLocation(LightMealsUtils.MODID, "fluid/caramel_still");
private static final ResourceLocation FLOW = new ResourceLocation(LightMealsUtils.MODID, "fluid/caramel_flow");

public ResourceLocation getStillTexture() {
return STILL;
}

public ResourceLocation getFlowingTexture() {
return FLOW;
}
});
}
});

private static ForgeFlowingFluid.Properties makeProperties() {
return new ForgeFlowingFluid.Properties(
STILL,
FLOWING,
FluidAttributes.builder(
new ResourceLocation(LightMealsUtils.MODID + ":fluid/" + id + "_still"),
new ResourceLocation(LightMealsUtils.MODID + ":fluid/" + id + "_flow")))
.bucket(CARAMEL_BUCKET)
.block(CARAMEL_BLOCK);
return new ForgeFlowingFluid.Properties(TYPE, STILL, FLOWING)
.bucket(CARAMEL_BUCKET)
.block(CARAMEL_BLOCK);
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/hashmod/lightmeals/items/BasicDishItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public ItemStack finishUsingItem(ItemStack itemStack, Level worldIn, LivingEntit
}

@Override
public boolean hasContainerItem(ItemStack stack){
public boolean hasCraftingRemainingItem(ItemStack stack){
return true;
}

@Override
public ItemStack getContainerItem(ItemStack itemStack){
public ItemStack getCraftingRemainingItem(ItemStack itemStack){
return new ItemStack(ModItems.PLATE.get());
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/hashmod/lightmeals/items/BasicDrinkItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public ItemStack finishUsingItem(ItemStack stack, Level worldIn, LivingEntity en
}

@Override
public boolean hasContainerItem(ItemStack stack){
public boolean hasCraftingRemainingItem(ItemStack stack){
return true;
}

@Override
public ItemStack getContainerItem(ItemStack itemStack){
public ItemStack getCraftingRemainingItem(ItemStack itemStack){
return new ItemStack(Items.GLASS_BOTTLE);
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/hashmod/lightmeals/items/BasicSoupItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ public ItemStack finishUsingItem(ItemStack itemStack, Level worldIn, LivingEntit
}

@Override
public boolean hasContainerItem(ItemStack stack){
public boolean hasCraftingRemainingItem(ItemStack stack){
return true;
}

@Override
public ItemStack getContainerItem(ItemStack itemStack){
public ItemStack getCraftingRemainingItem(ItemStack itemStack){
return new ItemStack(Items.BOWL);
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/hashmod/lightmeals/registry/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ public class ModBlocks {
public static final RegistryObject<Block> HONEY_CAKE = BLOCKS.register("honey_cake", () -> new HoneyCakeBlock(BlockBehaviour.Properties.of(Material.CAKE).strength(0.5F).sound(SoundType.WOOL)));
public static final RegistryObject<Block> PUMPKIN_CAKE = BLOCKS.register("pumpkin_cake", () -> new PumpkinCakeBlock(BlockBehaviour.Properties.of(Material.CAKE).strength(0.5F).sound(SoundType.WOOL)));

public static final RegistryObject<LiquidBlock> CARAMEL_BLOCK = BLOCKS.register("caramel_block", () -> new CaramelFluidBlock(STILL, Block.Properties.of(Material.LAVA).noCollission().strength(100.0F).noDrops()));
public static final RegistryObject<LiquidBlock> CARAMEL_BLOCK = BLOCKS.register("caramel_block", () -> new CaramelFluidBlock(STILL, Block.Properties.of(Material.LAVA).noCollission().strength(100.0F).noLootTable()));
}
2 changes: 2 additions & 0 deletions src/main/java/hashmod/lightmeals/registry/ModFluids.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import hashmod.lightmeals.LightMealsUtils;
import hashmod.lightmeals.fluids.CaramelFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.fluids.FluidType;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class ModFluids {
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, LightMealsUtils.MODID);
public static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, LightMealsUtils.MODID);

public static final CaramelFluid CARAMEL_FLUID = new CaramelFluid();
}
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ description="Add numerous foods within the vanilla system."
[[dependencies.lightmeals]]
modId="minecraft"
mandatory=true
versionRange="[1.18.1,1.18.2]"
versionRange="[1.19.2,1.20)"
ordering="NONE"
side="BOTH"
side="BOTH"
3 changes: 2 additions & 1 deletion src/main/resources/assets/lightmeals/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
"item.lightmeals.cooked_rabbit_foot": "Cooked Rabbit Foot",
"item.lightmeals.glow_ink_soup": "Glow Ink Soup",
"itemGroup.lightmeals": "Light Meals",
"fluid.lightmeals.caramel": "Caramel",
"block.lightmeals.caramel_block": "Caramel",
"fluid_type.lightmeals.caramel": "Caramel",
"item.lightmeals.caramel_bucket": "Caramel Bucket",
"material.tconstruct.caramel": "Caramel"
}
3 changes: 2 additions & 1 deletion src/main/resources/assets/lightmeals/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
"item.lightmeals.cooked_rabbit_foot": "烤兔子脚",
"item.lightmeals.glow_ink_soup": "荧光墨汁汤",
"itemGroup.lightmeals": "轻食物语",
"fluid.lightmeals.caramel": "焦糖",
"block.lightmeals.caramel_block": "焦糖",
"fluid_type.lightmeals.caramel": "焦糖",
"item.lightmeals.caramel_bucket": "焦糖桶",
"material.tconstruct.caramel": "焦糖"
}