Skip to content

Commit

Permalink
Port to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
realguyman committed Oct 16, 2024
1 parent bb33f60 commit 1541e85
Show file tree
Hide file tree
Showing 32 changed files with 105 additions and 81 deletions.
63 changes: 31 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id "fabric-loom" version "1.7-SNAPSHOT"
id "com.modrinth.minotaur" version "2.+"
id "maven-publish"
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'com.modrinth.minotaur' version '2.+'
id 'maven-publish'
}

version = project.mod_version
Expand All @@ -12,13 +12,12 @@ base {
}

repositories {
maven { url "https://maven.terraformersmc.com/" }
maven { url "https://maven.wispforest.io/" }
maven { url "https://jitpack.io/" }
maven { url "https://maven.blamejared.com/" }
maven { url "https://api.modrinth.com/maven" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.gegy.dev/" }
maven { url 'https://maven.terraformersmc.com/' }
maven { url 'https://maven.wispforest.io/' }
maven { url 'https://jitpack.io/' }
maven { url 'https://maven.blamejared.com/' }
maven { url 'https://api.modrinth.com/maven' }
maven { url 'https://maven.shedaniel.me/' }
}

dependencies {
Expand All @@ -31,9 +30,8 @@ dependencies {

// Local dependencies
modLocalRuntime "com.terraformersmc:modmenu:${project.mod_menu}"
// modLocalRuntime "maven.modrinth:lithium:${project.lithium}"
// modLocalRuntime "dev.lambdaurora:lambdynamiclights:${project.lambdynamiclights}"
// modLocalRuntime "vazkii.patchouli:Patchouli:${project.patchouli}"
modLocalRuntime "maven.modrinth:lithium:${project.lithium}"
modLocalRuntime "vazkii.patchouli:Patchouli:${project.patchouli}"
// modLocalRuntime "me.shedaniel:RoughlyEnoughItems-fabric:${project.rei}"
// modLocalRuntime "dev.emi:emi:${project.emi}"
}
Expand All @@ -46,7 +44,7 @@ loom {
splitEnvironmentSourceSets()

mods {
"totally_lit" {
'totally_lit' {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
Expand All @@ -55,10 +53,10 @@ loom {
runs {
gametest {
inherit server
name "Gametest"
vmArg "-Dfabric-api.gametest"
name 'Gametest'
vmArg '-Dfabric-api.gametest'
vmArg "-Dfabric-api.gametest.report-file=${project.buildDir}/junit.xml"
runDir "build/gametest"
runDir 'build/gametest'
}
}
}
Expand All @@ -71,16 +69,16 @@ java {
}

jar {
from("LICENSE") {
from('LICENSE') {
rename { "${it}_${project.base.archivesName.get()}" }
}
}

processResources {
inputs.property "version", project.version
inputs.property 'version', project.version

filesMatching("fabric.mod.json") {
expand "version": project.version
filesMatching('fabric.mod.json') {
expand 'version': project.version
}
}

Expand All @@ -89,28 +87,29 @@ tasks.withType(JavaCompile).configureEach {
}

modrinth {
if (project.version.contains("-alpha")) {
versionType = "alpha"
} else if (project.version.contains("-beta")) {
versionType = "beta"
if (project.version.contains('-alpha')) {
versionType = 'alpha'
} else if (project.version.contains('-beta')) {
versionType = 'beta'
}

projectId = "hbKDMT6l"
projectId = 'hbKDMT6l'
uploadFile = remapJar
additionalFiles = [remapSourcesJar]
loaders = ["fabric", "quilt"]
loaders = ['fabric', 'quilt']
gameVersions = [project.minecraft]
dependencies {
required.project "fabric-api"
required.project "owo-lib"
optional.project "modmenu"
incompatible.project "hardcore-torches"
required.project 'fabric-api'
required.project 'owo-lib'
optional.project 'modmenu'
incompatible.project 'hardcore-torches'
}
}

publishing {
publications {
create("mavenJava", MavenPublication) {
create('mavenJava', MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
Expand Down
24 changes: 12 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true

# Required dependencies
minecraft=1.20.6
mappings=1.20.6+build.3
fabric_loader=0.16.5
fabric_api=0.100.8+1.20.6
owo_lib=0.12.9+1.20.5
minecraft=1.21.1
mappings=1.21.1+build.3
fabric_loader=0.16.7
fabric_api=0.106.0+1.21.1
owo_lib=0.12.15+1.21

# Local dependencies
mod_menu=10.0.0
lithium=mc1.20.6-0.12.5
lambdynamiclights=2.3.4+1.20.4-local
patchouli=1.20.6-86-FABRIC
rei=15.0.775
emi=1.1.13+1.20.6+fabric
mod_menu=11.0.3
lithium=mc1.21.1-0.13.1
patchouli=1.21-87-FABRIC
rei=16.0.783
emi=1.1.16+1.21.1+fabric

# Project detail
mod_version=0.15.0+1.20.6
mod_version=0.15.0+1.21.1
maven_group=io.github.realguyman
archives_base_name=totally_lit
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private ActionResult igniteUnlitBlock(
return ActionResult.FAIL;
}

stack.damage(1, player, EquipmentSlot.fromTypeIndex(EquipmentSlot.Type.HAND, hand.ordinal()));
stack.damage(1, player, EquipmentSlot.values()[hand.ordinal()]);
world.playSound(null, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 0.125F, world.getRandom().nextFloat() * 0.5F + 0.125F);
return ActionResult.SUCCESS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.access.CampfireBlockEntityAccess;
import java.util.List;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.CampfireBlock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.access.CampfireBlockEntityAccess;
import io.github.realguyman.totally_lit.registry.TagRegistry;
import java.util.List;
import net.minecraft.block.BlockState;
import net.minecraft.block.CampfireBlock;
import net.minecraft.block.entity.CampfireBlockEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.CampfireBlock;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.stat.Stats;
Expand Down Expand Up @@ -48,7 +50,7 @@ private void ignite(ItemStack stack, BlockState state, World world, BlockPos pos
cir.setReturnValue(ItemActionResult.FAIL);
}

stack.damage(1, player, EquipmentSlot.fromTypeIndex(EquipmentSlot.Type.HAND, hand.ordinal()));
stack.damage(1, player, EquipmentSlot.values()[hand.ordinal()]);
world.playSound(null, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 0.125F, world.getRandom().nextFloat() * 0.5F + 0.125F);
player.incrementStat(Stats.INTERACT_WITH_CAMPFIRE);
cir.setReturnValue(ItemActionResult.SUCCESS);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.realguyman.totally_lit.mixin.candle;

import io.github.realguyman.totally_lit.TotallyLit;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.predicate.entity.EntityPredicates;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.github.realguyman.totally_lit.mixin.jack_o_lantern;

import io.github.realguyman.totally_lit.TotallyLit;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.predicate.entity.EntityPredicates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.registry.TagRegistry;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.predicate.entity.EntityPredicates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.realguyman.totally_lit.TotallyLit;
import io.github.realguyman.totally_lit.registry.TagRegistry;
import java.util.List;
import net.minecraft.block.*;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.predicate.entity.EntityPredicates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class BlockRegistry {
public static final Block UNLIT_WALL_TORCH;

private static Block add(String path, Block block) {
return Registry.register(Registries.BLOCK, new Identifier(TotallyLit.MOD_ID, path), block);
return Registry.register(Registries.BLOCK, Identifier.of(TotallyLit.MOD_ID, path), block);
}

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ItemRegistry {
public static final Item UNLIT_TORCH = new VerticallyAttachableBlockItem(BlockRegistry.UNLIT_TORCH, BlockRegistry.UNLIT_WALL_TORCH, new Item.Settings(), Direction.DOWN);

private static Item add(String path, Item item) {
return Registry.register(Registries.ITEM, new Identifier(TotallyLit.MOD_ID, path), item);
return Registry.register(Registries.ITEM, Identifier.of(TotallyLit.MOD_ID, path), item);
}

public static void register() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,58 @@
import net.minecraft.block.Block;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;

public class TagRegistry {
public static final TagKey<Block> SOUL_FIRE_VARIANT_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "soul_fire_variants"));
public static final TagKey<Item> SOUL_FIRE_VARIANT_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "soul_fire_variants"));

public static final TagKey<Block> CAMPFIRE_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "campfires"));
public static final TagKey<Block> CAMPFIRE_IGNITER_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "campfire_igniters"));
public static final TagKey<Fluid> CAMPFIRE_IGNITER_FLUIDS = TagKey.of(RegistryKeys.FLUID, new Identifier(TotallyLit.MOD_ID, "campfire_igniters"));
public static final TagKey<Item> CAMPFIRE_IGNITER_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "campfire_igniters"));
public static final TagKey<Item> CAMPFIRE_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "campfires"));

public static final TagKey<Block> CANDLE_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "candles"));
public static final TagKey<Block> CANDLE_IGNITER_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "candle_igniters"));
public static final TagKey<Fluid> CANDLE_IGNITER_FLUIDS = TagKey.of(RegistryKeys.FLUID, new Identifier(TotallyLit.MOD_ID, "candle_igniters"));
public static final TagKey<Item> CANDLE_IGNITER_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "candle_igniters"));
public static final TagKey<Item> CANDLE_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "candles"));

public static final TagKey<Block> JACK_O_LANTERN_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "jack_o_lanterns"));
public static final TagKey<Block> JACK_O_LANTERN_IGNITER_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "jack_o_lantern_igniters"));
public static final TagKey<Fluid> JACK_O_LANTERN_IGNITER_FLUIDS = TagKey.of(RegistryKeys.FLUID, new Identifier(TotallyLit.MOD_ID, "jack_o_lantern_igniters"));
public static final TagKey<Item> JACK_O_LANTERN_IGNITER_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "jack_o_lantern_igniters"));
public static final TagKey<Item> JACK_O_LANTERN_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "jack_o_lanterns"));

public static final TagKey<Block> LANTERN_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "lanterns"));
public static final TagKey<Block> LANTERN_IGNITER_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "lantern_igniters"));
public static final TagKey<Fluid> LANTERN_IGNITER_FLUIDS = TagKey.of(RegistryKeys.FLUID, new Identifier(TotallyLit.MOD_ID, "lantern_igniters"));
public static final TagKey<Item> LANTERN_IGNITER_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "lantern_igniters"));
public static final TagKey<Item> LANTERN_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "lanterns"));

public static final TagKey<Block> TORCH_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "torches"));
public static final TagKey<Block> TORCH_IGNITER_BLOCKS = TagKey.of(RegistryKeys.BLOCK, new Identifier(TotallyLit.MOD_ID, "torch_igniters"));
public static final TagKey<Fluid> TORCH_IGNITER_FLUIDS = TagKey.of(RegistryKeys.FLUID, new Identifier(TotallyLit.MOD_ID, "torch_igniters"));
public static final TagKey<Item> TORCH_IGNITER_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "torch_igniters"));
public static final TagKey<Item> TORCH_ITEMS = TagKey.of(RegistryKeys.ITEM, new Identifier(TotallyLit.MOD_ID, "torches"));
private static TagKey add(RegistryKey registryKey, String path) {
return TagKey.of(registryKey, Identifier.of(TotallyLit.MOD_ID, path));
}

private static TagKey<Block> addBlock(String path) {
return add(RegistryKeys.BLOCK, path);
}

private static TagKey<Item> addItem(String path) {
return add(RegistryKeys.ITEM, path);
}

private static TagKey<Fluid> addFluid(String path) {
return add(RegistryKeys.FLUID, path);
}

public static final TagKey<Block> SOUL_FIRE_VARIANT_BLOCKS = addBlock("soul_fire_variants");
public static final TagKey<Item> SOUL_FIRE_VARIANT_ITEMS = addItem("soul_fire_variants");

public static final TagKey<Block> CAMPFIRE_BLOCKS = addBlock("campfires");
public static final TagKey<Block> CAMPFIRE_IGNITER_BLOCKS = addBlock("campfire_igniters");
public static final TagKey<Fluid> CAMPFIRE_IGNITER_FLUIDS = addFluid("campfire_igniters");
public static final TagKey<Item> CAMPFIRE_IGNITER_ITEMS = addItem("campfire_igniters");
public static final TagKey<Item> CAMPFIRE_ITEMS = addItem("campfires");

public static final TagKey<Block> CANDLE_BLOCKS = addBlock("candles");
public static final TagKey<Block> CANDLE_IGNITER_BLOCKS = addBlock("candle_igniters");
public static final TagKey<Fluid> CANDLE_IGNITER_FLUIDS = addFluid("candle_igniters");
public static final TagKey<Item> CANDLE_IGNITER_ITEMS = addItem("candle_igniters");
public static final TagKey<Item> CANDLE_ITEMS = addItem("candles");

public static final TagKey<Block> JACK_O_LANTERN_BLOCKS = addBlock("jack_o_lanterns");
public static final TagKey<Block> JACK_O_LANTERN_IGNITER_BLOCKS = addBlock("jack_o_lantern_igniters");
public static final TagKey<Fluid> JACK_O_LANTERN_IGNITER_FLUIDS = addFluid("jack_o_lantern_igniters");
public static final TagKey<Item> JACK_O_LANTERN_IGNITER_ITEMS = addItem("jack_o_lantern_igniters");
public static final TagKey<Item> JACK_O_LANTERN_ITEMS = addItem("jack_o_lanterns");

public static final TagKey<Block> LANTERN_BLOCKS = addBlock("lanterns");
public static final TagKey<Block> LANTERN_IGNITER_BLOCKS = addBlock("lantern_igniters");
public static final TagKey<Fluid> LANTERN_IGNITER_FLUIDS = addFluid("lantern_igniters");
public static final TagKey<Item> LANTERN_IGNITER_ITEMS = addItem("lantern_igniters");
public static final TagKey<Item> LANTERN_ITEMS = addItem("lanterns");

public static final TagKey<Block> TORCH_BLOCKS = addBlock("torches");
public static final TagKey<Block> TORCH_IGNITER_BLOCKS = addBlock("torch_igniters");
public static final TagKey<Fluid> TORCH_IGNITER_FLUIDS = addFluid("torch_igniters");
public static final TagKey<Item> TORCH_IGNITER_ITEMS = addItem("torch_igniters");
public static final TagKey<Item> TORCH_ITEMS = addItem("torches");
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"depends": {
"java": ">=21",
"minecraft": "1.20.6",
"minecraft": "1.21.1",
"fabricloader": ">=0.15.0",
"fabric-api": "*",
"owo-lib": ">=0.12.0"
Expand Down

0 comments on commit 1541e85

Please sign in to comment.