Skip to content

Commit

Permalink
update to 1.20.x
Browse files Browse the repository at this point in the history
  • Loading branch information
UpcraftLP committed Aug 2, 2023
1 parent 911f988 commit 0f6497e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ jobs:
github-token: ${{ github.token }}

game-versions: |
1.19.4
1.20
1.20.1
loaders: |
fabric
quilt
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.14.21
#Fabric api
fabric_version=0.86.1+1.19.4
fabric_version=0.86.1+1.20.1
# Dependencies
25 changes: 17 additions & 8 deletions src/main/java/dev/upcraft/glassential/Glassential.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@
import net.minecraft.item.*;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import org.jetbrains.annotations.Nullable;

import java.util.Comparator;
Expand All @@ -28,16 +32,21 @@ public class Glassential implements ModInitializer {
public static Block REDSTONE_GLASS;

@SuppressWarnings("unused")
public static final ItemGroup GLASSENTIAL_ITEM_GROUP = FabricItemGroup.builder(new Identifier(MODID, "items")).icon(() -> new ItemStack(LIGHT_GLASS))
.entries((displayContext, entries) -> Registries.ITEM.streamEntries()
.filter(itemReference -> itemReference.registryKey().getValue().getNamespace().equals(MODID))
.sorted(Comparator.comparing(itemReference -> itemReference.registryKey().getValue().getPath()))
.map(RegistryEntry.Reference::value)
.forEachOrdered(entries::add))
.build();
public static final RegistryKey<ItemGroup> GLASSENTIAL_ITEM_GROUP = RegistryKey.of(RegistryKeys.ITEM_GROUP, new Identifier(MODID, "items"));

@Override
public void onInitialize() {
Registry.register(Registries.ITEM_GROUP, GLASSENTIAL_ITEM_GROUP, FabricItemGroup.builder()
.displayName(Text.translatable(Util.createTranslationKey("itemGroup", new Identifier(MODID, "items"))))
.icon(() -> new ItemStack(LIGHT_GLASS))
.entries((displayContext, entries) -> Registries.ITEM.streamEntries()
.filter(itemReference -> itemReference.registryKey().getValue().getNamespace().equals(MODID))
.sorted(Comparator.comparing(itemReference -> itemReference.registryKey().getValue().getPath()))
.map(RegistryEntry.Reference::value)
.forEachOrdered(entries::add))
.build()
);

TINTED_ETHEREAL_GLASS = registerBlock("tinted_ethereal_glass", new GlassentialGlassBlock(AbstractBlock.Settings::noCollision, BlockProperties.TINTED, BlockProperties.ETHEREAL));
TINTED_REVERSE_ETHEREAL_GLASS = registerBlock("tinted_reverse_ethereal_glass", new GlassentialGlassBlock(AbstractBlock.Settings::noCollision, BlockProperties.TINTED, BlockProperties.REVERSE_ETHEREAL));
ETHEREAL_GLASS = registerBlock("ethereal_glass", new GlassentialGlassBlock(AbstractBlock.Settings::noCollision, BlockProperties.ETHEREAL));
Expand All @@ -47,7 +56,7 @@ public void onInitialize() {
REDSTONE_GLASS = registerBlock("redstone_glass", new GlassentialGlassBlock(BlockProperties.REDSTONE), ItemGroups.REDSTONE);
}

private static Block registerBlock(String name, Block block, @Nullable ItemGroup itemGroup) {
private static Block registerBlock(String name, Block block, @Nullable RegistryKey<ItemGroup> itemGroup) {
Identifier blockName = new Identifier(MODID, name);
block = Registry.register(Registries.BLOCK, blockName, block);
Item item = Registry.register(Registries.ITEM, blockName, new BlockItem(block, new Item.Settings()));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"depends": {
"fabricloader": ">=0.14.9",
"fabric-api": "*",
"minecraft": "1.19.4",
"minecraft": "1.20.x",
"java": ">=17"
}
}

0 comments on commit 0f6497e

Please sign in to comment.