Skip to content

Commit

Permalink
[v2.3.2+1.19] support Minecraft 1.19.4 (#54)
Browse files Browse the repository at this point in the history
* bump fabric loom 1.1

* bump gradle 8

* bump fabric deps

* bump reinforced storages

* bump quick shulker

* fix code

* update release target

* rename release job

* add mod_id prop

* bump shulker box tooltip

* bump version 2.3.2+1.19

* fix shulker box tooltip integ

* update quick shulker integ

* add shulkerutils deps
  • Loading branch information
Aton-Kish committed Mar 21, 2023
1 parent def8f32 commit 267f7d3
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 116 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- v[0-9]+.[0-9]+.[0-9]+*

jobs:
build:
release:
runs-on: ubuntu-22.04
env:
JAVA_VERSION: 17
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "fabric-loom" version "1.0-SNAPSHOT"
id "fabric-loom" version "1.1-SNAPSHOT"
id "maven-publish"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.modrinth.minotaur" version "2.+"
Expand Down Expand Up @@ -68,6 +68,8 @@ dependencies {

// 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 Down Expand Up @@ -134,7 +136,7 @@ curseforge {

addGameVersion "Fabric"
addGameVersion "Java 17"
addGameVersion "1.19.3"
addGameVersion "1.19.4"

relations {
requiredDependency "fabric-api"
Expand All @@ -158,7 +160,7 @@ modrinth {
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.3"]
gameVersions = ["1.19.4"]
loaders = ["fabric"]

dependencies {
Expand Down
21 changes: 12 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
loader_version=0.14.14
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1
loader_version=0.14.17

# Mod Properties
mod_version=2.3.1+1.19
mod_version=2.3.2+1.19
mod_id=reinfshulker
maven_group=atonkish.reinfshulker
archives_base_name=reinforced-shulker-boxes

# Dependencies
fabric_version=0.74.0+1.19.3
reinforced_core_version=3.0.5+1.19
reinforced_chests_version=2.3.1+1.19
quick_shulker_version=1.3.10-1.19.3
shulker_box_tooltip_version=3.2.4+1.19.3
fabric_version=0.76.0+1.19.4
reinforced_core_version=3.0.6+1.19
reinforced_chests_version=2.3.2+1.19
quick_shulker_version=1.3.10-1.19.4
shulker_box_tooltip_version=3.2.5+1.19.4
# Quick Shulker deps
shulkerutils_version=1.0.4-1.19

# Distribution platform
curseforge_id=529874
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.render.model.json.ModelTransformationMode;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
Expand Down Expand Up @@ -69,7 +69,7 @@ private static void initializeReinforcedShulkerBoxesClient() {

// Item Renderer
for (Block block : ModBlocks.REINFORCED_SHULKER_BOX_MAP.get(material).values()) {
BuiltinItemRendererRegistry.INSTANCE.register(block, (ItemStack stack, ModelTransformation.Mode mode,
BuiltinItemRendererRegistry.INSTANCE.register(block, (ItemStack stack, ModelTransformationMode mode,
MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) -> {
BlockEntity blockEntity = new ReinforcedShulkerBoxBlockEntity(material, BlockPos.ORIGIN,
block.getDefaultState());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import net.kyrptonaught.quickshulker.api.ItemStackInventory;
import net.kyrptonaught.quickshulker.api.QuickOpenableRegistry;
import net.kyrptonaught.quickshulker.api.QuickShulkerData;
import net.kyrptonaught.quickshulker.api.RegisterQuickShulker;

import net.minecraft.block.entity.BlockEntityType;
Expand All @@ -26,8 +25,11 @@ public class QuickShulker implements RegisterQuickShulker {

@Override
public void registerProviders() {
QuickOpenableRegistry.register(ReinforcedShulkerBoxBlock.class,
new QuickShulkerData(REINFORCED_SHULKER_BOX_CONSUMER, false));
new QuickOpenableRegistry.Builder()
.setItem(ReinforcedShulkerBoxBlock.class)
.supportsBundleing(true)
.setOpenAction(REINFORCED_SHULKER_BOX_CONSUMER)
.register();
}

static {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package atonkish.reinfshulker.integration.shulkerboxtooltip;

import com.misterpemodder.shulkerboxtooltip.api.PreviewContext;
import com.misterpemodder.shulkerboxtooltip.api.color.ColorKey;
import com.misterpemodder.shulkerboxtooltip.api.provider.BlockEntityPreviewProvider;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;

import net.minecraft.block.Block;
import net.minecraft.util.DyeColor;

import atonkish.reinfcore.util.ReinforcingMaterial;
import atonkish.reinfshulker.block.ReinforcedShulkerBoxBlock;

public class ReinforcedShulkerBoxPreviewProvider extends BlockEntityPreviewProvider {
private static float[] SHULKER_BOX_COLOR = new float[] { 0.592f, 0.403f, 0.592f };
protected final int maxRowSize;
private final ReinforcingMaterial material;

Expand All @@ -29,15 +32,30 @@ public boolean showTooltipHints(PreviewContext context) {
}

@Override
public float[] getWindowColor(PreviewContext context) {
@Environment(EnvType.CLIENT)
public ColorKey getWindowColorKey(PreviewContext context) {
DyeColor dye = ((ReinforcedShulkerBoxBlock) Block.getBlockFromItem(context.stack().getItem())).getColor();
if (dye != null) {
float[] components = dye.getColorComponents();
return new float[] { Math.max(0.15f, components[0]), Math.max(0.15f, components[1]),
Math.max(0.15f, components[2]) };
} else {
return SHULKER_BOX_COLOR;
}

if (dye == null)
return ColorKey.SHULKER_BOX;
return switch (dye) {
case ORANGE -> ColorKey.ORANGE_SHULKER_BOX;
case MAGENTA -> ColorKey.MAGENTA_SHULKER_BOX;
case LIGHT_BLUE -> ColorKey.LIGHT_BLUE_SHULKER_BOX;
case YELLOW -> ColorKey.YELLOW_SHULKER_BOX;
case LIME -> ColorKey.LIME_SHULKER_BOX;
case PINK -> ColorKey.PINK_SHULKER_BOX;
case GRAY -> ColorKey.GRAY_SHULKER_BOX;
case LIGHT_GRAY -> ColorKey.LIGHT_GRAY_SHULKER_BOX;
case CYAN -> ColorKey.CYAN_SHULKER_BOX;
case PURPLE -> ColorKey.PURPLE_SHULKER_BOX;
case BLUE -> ColorKey.BLUE_SHULKER_BOX;
case BROWN -> ColorKey.BROWN_SHULKER_BOX;
case GREEN -> ColorKey.GREEN_SHULKER_BOX;
case RED -> ColorKey.RED_SHULKER_BOX;
case BLACK -> ColorKey.BLACK_SHULKER_BOX;
default -> ColorKey.WHITE_SHULKER_BOX;
};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.recipe.SpecialCraftingRecipe;
import net.minecraft.recipe.book.CraftingRecipeCategory;
import net.minecraft.registry.DynamicRegistryManager;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;

import org.jetbrains.annotations.Nullable;

import atonkish.reinfcore.util.ReinforcingMaterial;
import atonkish.reinfcore.util.ReinforcingMaterials;
import atonkish.reinfshulker.block.ReinforcedShulkerBoxBlock;

public class ReinforcedShulkerBoxColoringRecipe extends SpecialCraftingRecipe {
Expand All @@ -28,44 +30,55 @@ public boolean matches(CraftingInventory craftingInventory, World world) {

for (int k = 0; k < craftingInventory.size(); ++k) {
ItemStack itemStack = craftingInventory.getStack(k);
if (!itemStack.isEmpty()) {
if (Block.getBlockFromItem(itemStack.getItem()) instanceof ReinforcedShulkerBoxBlock) {
++i;
} else {
if (!(itemStack.getItem() instanceof DyeItem)) {
return false;
}

++j;
}

if (j > 1 || i > 1) {
return false;
}
if (itemStack.isEmpty()) {
continue;
}

if (Block.getBlockFromItem(itemStack.getItem()) instanceof ReinforcedShulkerBoxBlock) {
++i;
} else if (itemStack.getItem() instanceof DyeItem) {
++j;
} else {
return false;
}

if (j <= 1 && i <= 1) {
continue;
}

return false;
}

return i == 1 && j == 1;
}

@Override
public ItemStack craft(CraftingInventory craftingInventory) {
public ItemStack craft(CraftingInventory craftingInventory, DynamicRegistryManager dynamicRegistryManager) {
ItemStack itemStack = ItemStack.EMPTY;
DyeItem dyeItem = (DyeItem) Items.WHITE_DYE;
ReinforcingMaterial material = ReinforcingMaterials.MAP.get("copper");

@Nullable
ReinforcingMaterial material = null;

for (int i = 0; i < craftingInventory.size(); ++i) {
ItemStack itemStack2 = craftingInventory.getStack(i);
if (!itemStack2.isEmpty()) {
Item item = itemStack2.getItem();
Block block = Block.getBlockFromItem(item);
if (block instanceof ReinforcedShulkerBoxBlock) {
itemStack = itemStack2;
material = ((ReinforcedShulkerBoxBlock) block).getMaterial();
} else if (item instanceof DyeItem) {
dyeItem = (DyeItem) item;
}
if (itemStack2.isEmpty()) {
continue;
}

Item item = itemStack2.getItem();
Block block = Block.getBlockFromItem(item);
if (block instanceof ReinforcedShulkerBoxBlock) {
itemStack = itemStack2;
material = ((ReinforcedShulkerBoxBlock) block).getMaterial();
continue;
}

if (!(item instanceof DyeItem)) {
continue;
}

dyeItem = (DyeItem) item;
}

ItemStack itemStack3 = ReinforcedShulkerBoxBlock.getItemStack(material, dyeItem.getColor());
Expand Down
Loading

0 comments on commit 267f7d3

Please sign in to comment.