Skip to content

Commit

Permalink
tring some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeCraftPlugin committed Feb 18, 2025
1 parent d6291dc commit 6a7d818
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 25 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'fabric-loom' version '1.9-SNAPSHOT'
id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

version = project.mod_version
Expand Down Expand Up @@ -35,7 +35,7 @@ processResources {
}
}

def targetJavaVersion = 17
def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ org.gradle.daemon=false
# Fabric Properties
# check these on https://fabricmc.net/develop/
# Mod Properties
mod_version=1.20.2-1.0.0
mod_version=1.21.1-1.0.0
maven_group=io.github.codecraftplugin
archives_base_name=registry-lib
#Minecraft
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.25

minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.9
#Fabric api
fabric_version=0.91.1+1.20.2
fabric_version=0.114.0+1.21.1
Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.codecraftplugin.registrylib.utils;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
//import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.fabricmc.loader.api.FabricLoader;
Expand Down Expand Up @@ -34,7 +34,7 @@ public class Registry {
* @return the item will be created and returned
*/
public static Item registerItems(String name, String MOD_ID, Item item, RegistryKey<ItemGroup> itemGroup){
Item createditem = net.minecraft.registry.Registry.register(Registries.ITEM,new Identifier(MOD_ID,name),item);
Item createditem = net.minecraft.registry.Registry.register(Registries.ITEM,Identifier.of(MOD_ID,name),item);
addToItemGroup(itemGroup,createditem);
return createditem;
}
Expand All @@ -48,7 +48,7 @@ public static Item registerItems(String name, String MOD_ID, Item item, Registry
*/
public static Block registerBlocks(String name, String MOD_ID, Block block, RegistryKey<ItemGroup> itemGroup){
registerBlockItem(name,MOD_ID,block,itemGroup);
return net.minecraft.registry.Registry.register(Registries.BLOCK,new Identifier(MOD_ID,name),block);
return net.minecraft.registry.Registry.register(Registries.BLOCK,Identifier.of(MOD_ID,name),block);
}

/**
Expand All @@ -60,8 +60,8 @@ public static Block registerBlocks(String name, String MOD_ID, Block block, Regi
* @return the block item without creating the block (for crops)
*/
public static Item registerBlockItem(String name, String MOD_ID, Block block, RegistryKey<ItemGroup> itemGroup) {
Item blockItem = net.minecraft.registry.Registry.register(Registries.ITEM,new Identifier(MOD_ID,name),
new BlockItem(block,new FabricItemSettings()));
Item blockItem = net.minecraft.registry.Registry.register(Registries.ITEM,Identifier.of(MOD_ID,name),
new BlockItem(block,new Item.Settings()));
addToItemGroup(itemGroup,blockItem);
return blockItem;
}
Expand All @@ -75,7 +75,7 @@ public static Item registerBlockItem(String name, String MOD_ID, Block block, Re
*/
public static RegistryKey<ItemGroup> registerItemGroup(String name, String MOD_ID, Supplier<ItemStack> itemStack){
String displayName = formatString(name);
RegistryKey<ItemGroup> customItemGroup = RegistryKey.of(RegistryKeys.ITEM_GROUP,new Identifier(MOD_ID,name));
RegistryKey<ItemGroup> customItemGroup = RegistryKey.of(RegistryKeys.ITEM_GROUP,Identifier.of(MOD_ID,name));
net.minecraft.registry.Registry.register(Registries.ITEM_GROUP, customItemGroup, FabricItemGroup.builder()
.icon(itemStack).displayName(Text.literal(displayName)).build());

Expand All @@ -101,7 +101,7 @@ public static void addToItemGroup(RegistryKey<ItemGroup> group, Item item) {
*/
public static Block registerBlocksWithoutBlockItem(String name, String MOD_ID, Block block){
//register the block without block items, so you have to register it manually using registerItems
return net.minecraft.registry.Registry.register(Registries.BLOCK,new Identifier(MOD_ID,name),block);
return net.minecraft.registry.Registry.register(Registries.BLOCK,Identifier.of(MOD_ID,name),block);
}

/**
Expand All @@ -113,7 +113,7 @@ public static Block registerBlocksWithoutBlockItem(String name, String MOD_ID, B
* @return the enchantment
*/
public static Enchantment registerEnchantments(String name, Enchantment enchantment, String MOD_ID){
return net.minecraft.registry.Registry.register(Registries.ENCHANTMENT, new Identifier(MOD_ID, name),enchantment);
return net.minecraft.registry.Registry.register(Registries., Identifier.of(MOD_ID, name),enchantment);

}

Expand All @@ -125,7 +125,7 @@ public static Enchantment registerEnchantments(String name, Enchantment enchantm
* @return
*/
private static FlowableFluid registerFluids(String name, String MOD_ID,FlowableFluid flowableFluid) {
return net.minecraft.registry.Registry.register(Registries.FLUID, new Identifier(MOD_ID, name), flowableFluid);
return net.minecraft.registry.Registry.register(Registries.FLUID, Identifier.of(MOD_ID, name), flowableFluid);
}
public static void registerRegistry(Logger logger){
logger.info("registered all the registry");
Expand All @@ -140,7 +140,7 @@ public static void registerRegistry(Logger logger){
* @return The Entity
*/
public static EntityType registerEntity(String name,String MOD_ID, EntityType entity){
return net.minecraft.registry.Registry.register(Registries.ENTITY_TYPE, new Identifier(MOD_ID,name),entity);
return net.minecraft.registry.Registry.register(Registries.ENTITY_TYPE, Identifier.of(MOD_ID,name),entity);
}
//register status effects

Expand All @@ -153,15 +153,15 @@ public static EntityType registerEntity(String name,String MOD_ID, EntityType en
* @return the status effect
*/
public static StatusEffect registerStatusEffects(String name,String MOD_ID, StatusEffect statusEffect){
return net.minecraft.registry.Registry.register(Registries.STATUS_EFFECT, new Identifier(MOD_ID, name), statusEffect);
return net.minecraft.registry.Registry.register(Registries.STATUS_EFFECT, Identifier.of(MOD_ID, name), statusEffect);
}
//register entities with spawn egg

public static <T extends Entity> EntityType<T> buildEntity(EntityType.EntityFactory<T> entity, Class<T> entityClass,
float width, float height, SpawnGroup group, String MOD_ID) {
if (FabricLoader.getInstance().isDevelopmentEnvironment()) {
String name = entityClass.getSimpleName().toLowerCase();
return EntityRegistryBuilder.<T>createBuilder(new Identifier(MOD_ID, name)).entity(entity)
return EntityRegistryBuilder.<T>createBuilder(Identifier.of(MOD_ID, name)).entity(entity)
.category(group).dimensions(EntityDimensions.changing(width, height)).build();
}
return null;
Expand Down

0 comments on commit 6a7d818

Please sign in to comment.