Skip to content

Commit

Permalink
[v2.4.0+1.20] support Minecraft 1.20 (#57)
Browse files Browse the repository at this point in the history
* support 1.20

* update badges

* fix netherite smithing recipes

* add to item groups

* remove quick shulker metadata

* bump version
  • Loading branch information
Aton-Kish committed Jun 9, 2023
1 parent 0ef9066 commit 8019506
Show file tree
Hide file tree
Showing 35 changed files with 219 additions and 188 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

[![Mod Loader: Fabric](https://img.shields.io/static/v1?label=modloader&message=fabric&color=brightgreen)](https://www.curseforge.com/minecraft/mc-mods/fabric-api)
![Mod Environment](https://img.shields.io/static/v1?label=environment&message=client%2Fserver&color=yellow)
[![Downloads](https://raw.githubusercontent.com/Aton-Kish/mcmod-stats/main/reinforced-shulker-boxes/downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/reinforced-shulker-boxes)
![Version](https://cf.way2muchnoise.eu/versions/529874.svg)
[![CurseForge](https://cf.way2muchnoise.eu/529874.svg)](https://www.curseforge.com/minecraft/mc-mods/reinforced-shulker-boxes)
[![Modrinth](https://img.shields.io/modrinth/dt/xlOwuSdN?color=%2300AF5C&logo=modrinth)](https://modrinth.com/mod/reinforced-shulker-boxes)
[![MIT License](https://img.shields.io/static/v1?label=licence&message=MIT&color=blue)](./LICENSE)
[![build](https://github.com/Aton-Kish/reinforced-shulker-boxes/actions/workflows/build.yaml/badge.svg?branch=1.19)](https://github.com/Aton-Kish/reinforced-shulker-boxes/actions/workflows/build.yaml?query=branch:1.19)

# Reinforced Shulker Boxes

Expand Down
56 changes: 29 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ plugins {
id "com.modrinth.minotaur" version "2.+"
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

base {
archivesName = project.archives_base_name
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
Expand All @@ -34,11 +34,6 @@ repositories {
url "https://maven.shedaniel.me/"
}

// Quick Shulker
maven {
url "https://maven.kyrptonaught.dev"
}

// Shulker Box Tooltip
maven {
url "https://maven.misterpemodder.com/libs-release"
Expand All @@ -50,6 +45,17 @@ repositories {
}
}

loom {
splitEnvironmentSourceSets()

mods {
"reinfshulker" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}
}

dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
Expand All @@ -66,11 +72,6 @@ dependencies {
// Reinforced Chests
modImplementation "atonkish.reinfchest:reinforced-chests:${project.reinforced_chests_version}"

// Quick Shulker
modImplementation "net.kyrptonaught:quickshulker:${project.quick_shulker_version}"
// Quick Shulker deps
modImplementation "net.kyrptonaught:shulkerutils:${project.shulkerutils_version}"

// Shulker Box Tooltip
modImplementation "com.misterpemodder:shulkerboxtooltip-fabric:${project.shulker_box_tooltip_version}"
}
Expand All @@ -93,6 +94,9 @@ java {
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

jar {
Expand Down Expand Up @@ -136,39 +140,37 @@ curseforge {

addGameVersion "Fabric"
addGameVersion "Java 17"
addGameVersion "1.19.4"
addGameVersion "1.20"

relations {
requiredDependency "fabric-api"
embeddedLibrary "cloth-config"
optionalDependency "modmenu"
optionalDependency "shulkerboxtooltip"
optionalDependency "quick-shulker"
optionalDependency "reinforced-chests"
}
}
}

modrinth {
token = project.findProperty("modrinth_token") ?: "Missing token"
token = project.findProperty("modrinth_token") ?: "Missing token"

projectId = project.modrinth_id
projectId = project.modrinth_id

uploadFile = remapJar
versionNumber = project.version
uploadFile = remapJar
versionNumber = project.version
versionName = "Reinforced Shulker Boxes v${project.version}"
versionType = "release"
versionType = "release"
changelog = "[v${project.version}](https://github.com/Aton-Kish/reinforced-shulker-boxes/releases/tag/v" + java.net.URLEncoder.encode(project.version, "UTF-8") + ")"

gameVersions = ["1.19.4"]
loaders = ["fabric"]
gameVersions = ["1.20"]
loaders = ["fabric"]

dependencies {
required.project "fabric-api"
dependencies {
required.project "fabric-api"
embedded.project "cloth-config"
optional.project "modmenu"
optional.project "shulkerboxtooltip"
optional.project "quickshulker"
optional.project "reinforced-chests"
}
}
}
17 changes: 7 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,21 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.2
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21

# Mod Properties
mod_version=2.3.3+1.19
mod_version=2.4.0+1.20
mod_id=reinfshulker
maven_group=atonkish.reinfshulker
archives_base_name=reinforced-shulker-boxes

# Dependencies
fabric_version=0.83.0+1.19.4
reinforced_core_version=3.1.0+1.19
reinforced_chests_version=2.3.3+1.19
quick_shulker_version=1.3.10-1.19.4
shulker_box_tooltip_version=3.3.1+1.19.4
# Quick Shulker deps
shulkerutils_version=1.0.4-1.19
fabric_version=0.83.0+1.20
reinforced_core_version=3.1.1+1.20
reinforced_chests_version=2.4.0+1.20
shulker_box_tooltip_version=4.0.1+1.20

# Distribution platform
curseforge_id=529874
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package atonkish.reinfshulker.mixin;
package atonkish.reinfshulker.mixin.client;

import java.util.function.Consumer;

Expand Down
10 changes: 10 additions & 0 deletions src/client/resources/reinfshulker.client.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"required": true,
"minVersion": "0.8",
"package": "atonkish.reinfshulker.mixin.client",
"compatibilityLevel": "JAVA_17",
"client": ["TexturedRenderLayersMixin"],
"injectors": {
"defaultRequire": 1
}
}

This file was deleted.

5 changes: 4 additions & 1 deletion src/main/java/atonkish/reinfshulker/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.DyeColor;
Expand Down Expand Up @@ -40,6 +41,8 @@ public static Item registerMaterialDyeColor(ReinforcingMaterial material, DyeCol
Item item = ModItems.register(
new BlockItem(ModBlocks.REINFORCED_SHULKER_BOX_MAP.get(material).get(color),
REINFORCED_SHULKER_BOX_SETTINGS_MAP.get(material).get(color)));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COLORED_BLOCKS).register(content -> content.add(item));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item));
ItemGroupEvents.modifyEntriesEvent(ModItemGroups.REINFORCED_STORAGE).register(content -> content.add(item));
REINFORCED_SHULKER_BOX_MAP.get(material).put(color, item);
}
Expand All @@ -49,7 +52,7 @@ public static Item registerMaterialDyeColor(ReinforcingMaterial material, DyeCol

public static void registerMaterialDyeColorItemGroupIcon(ReinforcingMaterial material, DyeColor color) {
Item item = REINFORCED_SHULKER_BOX_MAP.get(material).get(color);
ModItemGroup.setIcon(ModItemGroups.REINFORCED_STORAGE, item);
ModItemGroup.setIcon(Registries.ITEM_GROUP.get(ModItemGroups.REINFORCED_STORAGE), item);
}

private static Item register(BlockItem item) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package atonkish.reinfshulker.mixin;

import net.minecraft.block.Block;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.ShulkerBoxColoringRecipe;
import net.minecraft.world.World;
Expand All @@ -16,10 +16,10 @@
@Mixin(ShulkerBoxColoringRecipe.class)
public class ShulkerBoxColoringRecipeMixin {
@Inject(at = @At("HEAD"), method = "matches", cancellable = true)
public void matches(CraftingInventory craftingInventory, World world,
public void matches(RecipeInputInventory recipeInputInventory, World world,
CallbackInfoReturnable<Boolean> infoReturnable) {
for (int k = 0; k < craftingInventory.size(); ++k) {
ItemStack itemStack = craftingInventory.getStack(k);
for (int k = 0; k < recipeInputInventory.size(); ++k) {
ItemStack itemStack = recipeInputInventory.getStack(k);
if (Block.getBlockFromItem(itemStack.getItem()) instanceof ReinforcedShulkerBoxBlock) {
infoReturnable.setReturnValue(false);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package atonkish.reinfshulker.recipe;

import net.minecraft.block.Block;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.DyeItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
Expand All @@ -24,12 +24,12 @@ public ReinforcedShulkerBoxColoringRecipe(Identifier identifier, CraftingRecipeC
}

@Override
public boolean matches(CraftingInventory craftingInventory, World world) {
public boolean matches(RecipeInputInventory recipeInputInventory, World world) {
int i = 0;
int j = 0;

for (int k = 0; k < craftingInventory.size(); ++k) {
ItemStack itemStack = craftingInventory.getStack(k);
for (int k = 0; k < recipeInputInventory.size(); ++k) {
ItemStack itemStack = recipeInputInventory.getStack(k);
if (itemStack.isEmpty()) {
continue;
}
Expand All @@ -53,15 +53,15 @@ public boolean matches(CraftingInventory craftingInventory, World world) {
}

@Override
public ItemStack craft(CraftingInventory craftingInventory, DynamicRegistryManager dynamicRegistryManager) {
public ItemStack craft(RecipeInputInventory recipeInputInventory, DynamicRegistryManager dynamicRegistryManager) {
ItemStack itemStack = ItemStack.EMPTY;
DyeItem dyeItem = (DyeItem) Items.WHITE_DYE;

@Nullable
ReinforcingMaterial material = null;

for (int i = 0; i < craftingInventory.size(); ++i) {
ItemStack itemStack2 = craftingInventory.getStack(i);
for (int i = 0; i < recipeInputInventory.size(); ++i) {
ItemStack itemStack2 = recipeInputInventory.getStack(i);
if (itemStack2.isEmpty()) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;

import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.RecipeInputInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.network.PacketByteBuf;
Expand Down Expand Up @@ -42,9 +42,9 @@ public RecipeSerializer<?> getSerializer() {
}

@Override
public ItemStack craft(CraftingInventory craftingInventory, DynamicRegistryManager dynamicRegistryManager) {
public ItemStack craft(RecipeInputInventory recipeInputInventory, DynamicRegistryManager dynamicRegistryManager) {
ItemStack itemStack = this.getOutput(dynamicRegistryManager).copy();
NbtCompound nbtCompound = craftingInventory.getStack(4).getNbt();
NbtCompound nbtCompound = recipeInputInventory.getStack(4).getNbt();

if (nbtCompound != null) {
itemStack.setNbt(nbtCompound.copy());
Expand Down
Loading

0 comments on commit 8019506

Please sign in to comment.