Skip to content

Commit

Permalink
1.19.3 port (#4)
Browse files Browse the repository at this point in the history
* Initial 1.19.3 port
* Reformat code for checkstyle
* Finish 1.19.3 port
* Remove unused stuff left over from initial Forge port
* Add TacoMonkey to mod authors

Co-authored-by: NebelNidas <burnerjulian@gmail.com>
  • Loading branch information
TacoMonkey11 and NebelNidas authored Jan 22, 2023
1 parent 9c984bd commit 2d96a60
Show file tree
Hide file tree
Showing 161 changed files with 360 additions and 369 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Build the mod
run: ./gradlew build --stacktrace -x runDatagen

- name: Publish 1.17 version
- name: Publish mod
uses: Kir-Antipov/mc-publish@v3.2
with:
curseforge-id: 495731
Expand All @@ -47,17 +47,15 @@ jobs:

files-primary: build/libs/!(*-@(dev|sources)).jar

name: 3.1.0 for MC 1.19 to 1.19.2
version: 3.1.0+1.19
name: 3.1.0 for MC 1.19.3
version: 3.1.0+1.19.3
version-type: release

loaders: |
fabric
game-versions: |
1.19
1.19.1
1.19.2
1.19.3
dependencies: |
fabric-api | depends
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ dependencies {

// Required Fabric API modules
modImplementation(fabricApi.module("fabric-api-base", project.fabric_api_version))
modImplementation(fabricApi.module("fabric-item-api-v1", project.fabric_api_version))
modImplementation(fabricApi.module("fabric-item-groups-v0", project.fabric_api_version))
modImplementation(fabricApi.module("fabric-item-group-api-v1", project.fabric_api_version))
modImplementation(fabricApi.module("fabric-blockrenderlayer-v1", project.fabric_api_version))
modImplementation(fabricApi.module("fabric-object-builder-api-v1", project.fabric_api_version))
modImplementation(fabricApi.module("fabric-data-generation-api-v1", project.fabric_api_version))
Expand All @@ -72,7 +71,6 @@ dependencies {
modRuntimeOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
modRuntimeOnly "maven.modrinth:lazydfu:${project.lazydfu_version}"
modRuntimeOnly "maven.modrinth:sodium:${project.sodium_version}"
runtimeOnly "org.joml:joml:${project.sodium_joml_version}"
modRuntimeOnly "maven.modrinth:lithium:${project.lithium_version}"
modRuntimeOnly "maven.modrinth:starlight:${project.starlight_version}"
modRuntimeOnly "maven.modrinth:ferrite-core:${project.ferrite_core_version}"
Expand Down
19 changes: 9 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,25 @@ loom_quiltflower_version = 1.8.0
checkstyle_version = 10.5.0

# Mod Properties
mod_version = 3.1.0+1.19
mod_version = 3.1.0+1.19.3
maven_group = com.thenamesnano
archives_base_name = patterned-glass

# Mod Dependencies
minecraft_version = 1.19.2
fabric_loader_version = 0.14.11
fabric_api_version = 0.68.0+1.19.2
yarn_mappings = 1.19.2+build.28
minecraft_version = 1.19.3
fabric_loader_version = 0.14.13
fabric_api_version = 0.73.0+1.19.3
yarn_mappings = 1.19.3+build.5


# If true, third-party mods will be loaded during runtime in the developer run configurations
use_third_party_mods = true

modmenu_version = 4.1.1
modmenu_version = 5.0.2
lazydfu_version = 0.1.3
sodium_version = mc1.19.2-0.4.4
sodium_joml_version = 1.10.4
lithium_version = mc1.19.2-0.10.2
sodium_version = mc1.19.3-0.4.8
lithium_version = mc1.19.3-0.10.4
starlight_version = 1.1.1+1.19
ferrite_core_version = 5.0.3-fabric
ferrite_core_version = 5.1.0-fabric
smoothboot_version = 1.19-1.7.1
no_fade_version = 3550935
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thenamesnano.patternedglass;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
Expand All @@ -13,8 +13,9 @@ public class PatternedGlass implements ModInitializer {
public static final String MOD_ID = "patternedglass";

// ItemGroup Declaration
public static final ItemGroup PATTERNED_GLASS_BLOCKS = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "blocks"),
() -> new ItemStack(RegistryHandler.BLACK_PATTERNED_GLASS.asItem()));
public static final ItemGroup PATTERNED_GLASS_BLOCKS = FabricItemGroup.builder(new Identifier(MOD_ID, "blocks"))
.icon(() -> new ItemStack(RegistryHandler.BLACK_PATTERNED_GLASS.asItem()))
.build();

@Override
public void onInitialize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,44 @@

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.minecraft.block.Block;
import net.minecraft.tag.BlockTags;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import com.thenamesnano.patternedglass.PatternedGlass;
import com.thenamesnano.patternedglass.util.RegistryHandler;

public class PatternedGlassBlockTagProvider extends FabricTagProvider.BlockTagProvider {
public PatternedGlassBlockTagProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
public PatternedGlassBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}

@Override
protected void generateTags() {
List<FabricTagBuilder<Block>> glassBlockTagBuilders = Arrays.asList(
protected void configure(RegistryWrapper.WrapperLookup lookup) {
List<FabricTagBuilder> glassBlockTagBuilders = Arrays.asList(
getOrCreateTagBuilder(BlockTags.IMPERMEABLE),
getOrCreateTagBuilder(TagKey.of(Registry.BLOCK_KEY, new Identifier(PatternedGlass.MOD_ID, "glass_blocks"))),
getOrCreateTagBuilder(TagKey.of(Registry.BLOCK_KEY, new Identifier("c:glass"))));
getOrCreateTagBuilder(TagKey.of(RegistryKeys.BLOCK, new Identifier(PatternedGlass.MOD_ID, "glass_blocks"))),
getOrCreateTagBuilder(TagKey.of(RegistryKeys.BLOCK, new Identifier("c:glass"))));

List<FabricTagBuilder<Block>> glassPaneTagBuilders = Arrays.asList(
getOrCreateTagBuilder(TagKey.of(Registry.BLOCK_KEY, new Identifier(PatternedGlass.MOD_ID, "glass_panes"))),
getOrCreateTagBuilder(TagKey.of(Registry.BLOCK_KEY, new Identifier("c:glass_panes"))));
List<FabricTagBuilder> glassPaneTagBuilders = Arrays.asList(
getOrCreateTagBuilder(TagKey.of(RegistryKeys.BLOCK, new Identifier(PatternedGlass.MOD_ID, "glass_panes"))),
getOrCreateTagBuilder(TagKey.of(RegistryKeys.BLOCK, new Identifier("c:glass_panes"))));

for (Block block: RegistryHandler.GLASS_BLOCK_LIST) {
for (FabricTagBuilder<Block> tagBuilder : glassBlockTagBuilders) {
for (FabricTagBuilder tagBuilder : glassBlockTagBuilders) {
tagBuilder.add(block);
}
}

for (Block block: RegistryHandler.GLASS_PANE_BLOCK_LIST) {
for (FabricTagBuilder<Block> tagBuilder : glassPaneTagBuilders) {
for (FabricTagBuilder tagBuilder : glassPaneTagBuilders) {
tagBuilder.add(block);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
public class PatternedGlassDatagen implements DataGeneratorEntrypoint {
@Override
public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {
dataGenerator.addProvider(PatternedGlassLootTableProvider::new);
dataGenerator.addProvider(PatternedGlassBlockTagProvider::new);
dataGenerator.addProvider(PatternedGlassItemTagProvider::new);
dataGenerator.addProvider(PatternedGlassRecipeProvider::new);
FabricDataGenerator.Pack pack = dataGenerator.createPack();
pack.addProvider(PatternedGlassLootTableProvider::new);
pack.addProvider(PatternedGlassBlockTagProvider::new);
pack.addProvider(PatternedGlassItemTagProvider::new);
pack.addProvider(PatternedGlassRecipeProvider::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,42 @@

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.RegistryWrapper;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import com.thenamesnano.patternedglass.PatternedGlass;
import com.thenamesnano.patternedglass.util.RegistryHandler;

public class PatternedGlassItemTagProvider extends FabricTagProvider.ItemTagProvider {
public PatternedGlassItemTagProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
public PatternedGlassItemTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
super(output, registriesFuture);
}

@Override
protected void generateTags() {
List<FabricTagBuilder<Item>> glassBlockTagBuilders = Arrays.asList(
getOrCreateTagBuilder(TagKey.of(Registry.ITEM_KEY, new Identifier(PatternedGlass.MOD_ID, "glass_blocks"))),
getOrCreateTagBuilder(TagKey.of(Registry.ITEM_KEY, new Identifier("c:glass"))));
protected void configure(RegistryWrapper.WrapperLookup arg) {
List<FabricTagBuilder> glassBlockTagBuilders = Arrays.asList(
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier(PatternedGlass.MOD_ID, "glass_blocks"))),
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("c:glass"))));

List<FabricTagBuilder<Item>> glassPaneTagBuilders = Arrays.asList(
getOrCreateTagBuilder(TagKey.of(Registry.ITEM_KEY, new Identifier(PatternedGlass.MOD_ID, "glass_panes"))),
getOrCreateTagBuilder(TagKey.of(Registry.ITEM_KEY, new Identifier("c:glass_panes"))));
List<FabricTagBuilder> glassPaneTagBuilders = Arrays.asList(
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier(PatternedGlass.MOD_ID, "glass_panes"))),
getOrCreateTagBuilder(TagKey.of(RegistryKeys.ITEM, new Identifier("c:glass_panes"))));

for (Block block: RegistryHandler.GLASS_BLOCK_LIST) {
for (FabricTagBuilder<Item> tagBuilder : glassBlockTagBuilders) {
for (FabricTagBuilder tagBuilder : glassBlockTagBuilders) {
tagBuilder.add(block.asItem());
}
}

for (Block block: RegistryHandler.GLASS_PANE_BLOCK_LIST) {
for (FabricTagBuilder<Item> tagBuilder : glassPaneTagBuilders) {
for (FabricTagBuilder tagBuilder : glassPaneTagBuilders) {
tagBuilder.add(block.asItem());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package com.thenamesnano.patternedglass.datagen;

import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
import net.minecraft.block.Block;

import com.thenamesnano.patternedglass.util.RegistryHandler;

public class PatternedGlassLootTableProvider extends FabricBlockLootTableProvider {
public PatternedGlassLootTableProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
protected PatternedGlassLootTableProvider(FabricDataOutput dataOutput) {
super(dataOutput);
}

@Override
protected void generateBlockLootTables() {
public void generate() {
for (Block block: RegistryHandler.GLASS_BLOCK_LIST) {
addDropWithSilkTouch(block);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,23 @@

import java.util.function.Consumer;

import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.block.Blocks;
import net.minecraft.data.server.recipe.RecipeJsonProvider;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.item.ItemConvertible;
import net.minecraft.util.Identifier;
import net.minecraft.recipe.book.RecipeCategory;

import com.thenamesnano.patternedglass.PatternedGlass;
import com.thenamesnano.patternedglass.util.RegistryHandler;

public class PatternedGlassRecipeProvider extends FabricRecipeProvider {
public PatternedGlassRecipeProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator);
public PatternedGlassRecipeProvider(FabricDataOutput output) {
super(output);
}

@Override
protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier(PatternedGlass.MOD_ID, identifier.getPath());
}

@Override
protected void generateRecipes(Consumer<RecipeJsonProvider> exporter) {
public void generate(Consumer<RecipeJsonProvider> exporter) {
offerPatternedGlassDyeingRecipe(exporter, RegistryHandler.WHITE_PATTERNED_GLASS, Blocks.WHITE_GLAZED_TERRACOTTA);
offerPatternedGlassDyeingRecipe(exporter, RegistryHandler.ORANGE_PATTERNED_GLASS, Blocks.ORANGE_GLAZED_TERRACOTTA);
offerPatternedGlassDyeingRecipe(exporter, RegistryHandler.MAGENTA_PATTERNED_GLASS, Blocks.MAGENTA_GLAZED_TERRACOTTA);
Expand Down Expand Up @@ -78,7 +72,7 @@ protected void generateRecipes(Consumer<RecipeJsonProvider> exporter) {
}

private static void offerPatternedGlassDyeingRecipe(Consumer<RecipeJsonProvider> exporter, ItemConvertible output, ItemConvertible input) {
ShapedRecipeJsonBuilder.create(output, 8)
ShapedRecipeJsonBuilder.create(RecipeCategory.BUILDING_BLOCKS, output, 8)
.input('#', Blocks.GLASS)
.input('X', input)
.pattern("###")
Expand All @@ -91,7 +85,7 @@ private static void offerPatternedGlassDyeingRecipe(Consumer<RecipeJsonProvider>
}

private static void offerPatternedGlassPaneRecipe(Consumer<RecipeJsonProvider> exporter, ItemConvertible output, ItemConvertible input) {
ShapedRecipeJsonBuilder.create(output, 16)
ShapedRecipeJsonBuilder.create(RecipeCategory.BUILDING_BLOCKS, output, 16)
.input('#', input)
.pattern("###")
.pattern("###")
Expand All @@ -101,7 +95,7 @@ private static void offerPatternedGlassPaneRecipe(Consumer<RecipeJsonProvider> e
}

private static void offerPatternedGlassPaneDyeingRecipe(Consumer<RecipeJsonProvider> exporter, ItemConvertible output, ItemConvertible input) {
ShapedRecipeJsonBuilder.create(output, 8)
ShapedRecipeJsonBuilder.create(RecipeCategory.BUILDING_BLOCKS, output, 8)
.input('#', Blocks.GLASS_PANE)
.input('$', input)
.pattern("###")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package com.thenamesnano.patternedglass.init.blocks;

import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;

import com.thenamesnano.patternedglass.PatternedGlass;

public class BlockItemBase extends BlockItem {
public BlockItemBase(Block block) {
super(block, new FabricItemSettings().group(PatternedGlass.PATTERNED_GLASS_BLOCKS));
super(block, new Item.Settings());

ItemGroupEvents.modifyEntriesEvent(PatternedGlass.PATTERNED_GLASS_BLOCKS)
.register(entries -> entries.add(block));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import com.thenamesnano.patternedglass.PatternedGlass;
import com.thenamesnano.patternedglass.init.blocks.BlockItemBase;
Expand Down Expand Up @@ -55,13 +56,13 @@ public class RegistryHandler {

public static void init() {
for (PatternedGlassBlock block : GLASS_BLOCK_LIST) {
Registry.register(Registry.BLOCK, new Identifier(PatternedGlass.MOD_ID, block.getKey()), block);
Registry.register(Registry.ITEM, new Identifier(PatternedGlass.MOD_ID, block.getKey()), new BlockItemBase(block));
Registry.register(Registries.BLOCK, new Identifier(PatternedGlass.MOD_ID, block.getKey()), block);
Registry.register(Registries.ITEM, new Identifier(PatternedGlass.MOD_ID, block.getKey()), new BlockItemBase(block));
}

for (PatternedGlassPaneBlock block : GLASS_PANE_BLOCK_LIST) {
Registry.register(Registry.BLOCK, new Identifier(PatternedGlass.MOD_ID, block.getKey()), block);
Registry.register(Registry.ITEM, new Identifier(PatternedGlass.MOD_ID, block.getKey()), new BlockItemBase(block));
Registry.register(Registries.BLOCK, new Identifier(PatternedGlass.MOD_ID, block.getKey()), block);
Registry.register(Registries.ITEM, new Identifier(PatternedGlass.MOD_ID, block.getKey()), new BlockItemBase(block));
}
}
}
4 changes: 1 addition & 3 deletions src/main/resources/assets/patternedglass/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"config.patternedglass.modEnabled": "Mod Enabled",
"itemGroup.patternedglass.blocks": "Patterned Glass",
"block.patternedglass.test_block": "Test Block",
"block.patternedglass.white_patterned_glass": "White Patterned Glass",
"block.patternedglass.orange_patterned_glass": "Orange Patterned Glass",
"block.patternedglass.magenta_patterned_glass": "Magenta Patterned Glass",
Expand Down Expand Up @@ -34,4 +32,4 @@
"block.patternedglass.green_patterned_glass_pane": "Green Patterned Glass Pane",
"block.patternedglass.red_patterned_glass_pane": "Red Patterned Glass Pane",
"block.patternedglass.black_patterned_glass_pane": "Black Patterned Glass Pane"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parent": "patternedglass:block/template_patterned_glass",
"textures": {
"pattern": "patternedglass:blocks/black_patterned_glass"
"pattern": "patternedglass:block/black_patterned_glass"
}
}
}
Loading

0 comments on commit 2d96a60

Please sign in to comment.