Skip to content

Commit

Permalink
[v2.2.0+1.17] sync with v2.2.0+1.19 (#49)
Browse files Browse the repository at this point in the history
* bump version from 1.1.2 to 1.1.3+1.18 (#8)

* chore: update gradles

* chore: update build flow

* fix: fix onBreak method

* fix: fix loot tables

* fix: fix breaking tools

* chore: bump Fabric ASM version from v2.2 to v2.3

* chore: bump version from 1.1.2 to 1.1.3+1.18

* docs: update README.md

* fix tags error (#9)

* fix: define empty tags

* refactor: remove unnecessary lines

* bump version from 1.1.3+1.18 to 1.1.4+1.18 (#11)

* chore: bump fabric versions

* fix: fix ShulkerEntity method

* chore: bump Reinforced Core version from 1.1.1+1.18 to 1.1.2+1.18

* feat: re-integrate with Quick Shulker

* fix: fix spaces

* chore: bump version from 1.1.3+1.18 to 1.1.4+1.18

* bump version from 1.1.4+1.18 to 1.1.5+1.18 (#13)

* chore: bump fabric versions

* refactor: move dep versions

* chore: update gradle

* fix: fix craft method

* chore: bump version from 1.1.4+1.18 to 1.1.5+1.18

* bump version from 1.1.5+1.18 to 1.1.6+1.18 (#17)

* chore: bump fabric versions

* fix: fix dyeing recipe conflict

* chore: bump version from 1.1.5+1.18 to 1.1.6+1.18

* style: add last line

* bump version from 1.1.6+1.18 to 1.1.7+1.18 (#20)

* chore: bump fabric versions

* fix: add getAvailableSlots method

* chore: bump version from 1.1.6+1.18 to 1.1.7+1.18

* Add Simplified Chinese translation (#22)

* bump version from 1.1.7+1.18 to 1.1.8+1.18 (#23)

* chore: bump fabric versions

* chore: bump version from 1.1.7+1.18 to 1.1.8+1.18

* chore: add FUNDING.yml

* chore: bump deps versions

* bump version from 1.1.8+1.18 to 2.0.0-beta.1+1.18 (#26)

* chore: bump fabric versions

* chore: bump Reinforced Core version from 1.1.3+1.18 to 2.0.0-beta.1+1.18

* fix: fix errors

* refactor: refactor entrypoints

* refactor: refactor ModStats

* refactor: refactor ModBlocks

* refactor: refactor ModBlockEntityType

* refactor: refactor ModItems

* fix: change HashMap to LinkedHashMap

* refactor: refactor ModTexturedRenderLayers

* feat: add api

* fix: fix a typo

* fix: rename consts

* fix: fix class name

* feat: add entrypoints

* fix: add line

* refactor: require namespace

* fix: fix ISSUE_TEMPLATE

* fix: prevent duplicate

* refactor: change logger

* fix: fix TexturedRenderLayersMixin

* fix: fix imports order

* chore: update fabric properties link

* chore: bump version from 1.1.8+1.18 to 2.0.0-beta.1+1.18

* bump version from 2.0.0-beta.1+1.18 to 2.0.0-beta.2+1.18 (#28)

* chore: bump fabric versions

* chore: remove common tags

* fix: fix advancements and recipes

* feat: integrate with Reinforced Chests

* feat: add reinfchest loaded flag

* feat: remove missing resource identifiers dynamically

* chore: bump version from 2.0.0-beta.1+1.18 to 2.0.0-beta.2+1.18

* bump version from 2.0.0-beta.2+1.18 to 2.0.0-beta.3+1.18 (#30)

* chore: bump fabric versions

* fix: fix shulker stackable bug

* chore: bump version from 2.0.0-beta.2+1.18 to 2.0.0-beta.3+1.18

* bump version from 2.0.0-beta.3+1.18 to 2.0.0+1.18 (#32)

* chore: update loom and gradles

* chore: bump fabric versions

* chore: bump deps version

* fix: fix coloring recipes

* chore: update configs

* chore: bump version from 2.0.0-beta.3+1.18 to 2.0.0+1.18

* chore: add publish flow

* bump version from 2.0.0+1.18 to 2.0.1+1.18.2 (#34)

* chore: bump deps versions

* fix: yaml extensions

* style: prettier json

* bump version from 2.0.0+1.18 to 2.0.1+1.18.2

* version 2.0.1 support for Minecraft 1.19-rc2 (#35)

* chore: bump deps versions

* fix: remove integrations

* fix: fix types

* chore: mod version 2.0.1+1.19-rc2

* docs: update README.md

* bump version from 2.0.1+1.19-rc2 to 2.0.2+1.19 (#36)

* chore: bump deps versions

* feat: add integrations

* chore: bump version from 2.0.1+1.19-rc2 to 2.0.2+1.19

* bump version from 2.0.2+1.19 to 2.0.3+1.19 (#37)

* chore: bump deps versions

* chore: bump version from 2.0.2+1.19 to 2.0.3+1.19

* bump version from 2.0.3+1.19 to 2.0.4+1.19 (#39)

* chore: bump deps versions

* feat: add client sprite registry callback

* chore: rename yml to yaml

* docs: fix badge link

* chore: bump version from 2.0.3+1.19 to 2.0.4+1.19

* fix: fix indent

* bump version from 2.0.4+1.19 to 2.1.0+1.19 (#40)

* chore: bump deps versions

* chore: add Override deco

* chore: bump deps versions

* refactor: block entity accessor

* chore: add tag trigger

* docs: add config section

* chore: bump version from 2.0.4+1.19 to 2.1.0+1.19

* fix: fix image

* bump version from 2.1.0+1.19 to 2.1.1+1.19 (#41)

* chore: bump deps versions

* chore: leave out branch trigger

* chore: bump version from 2.1.0+1.19 to 2.1.1+1.19

* [v2.2.0+1.19] add some features (#47)

* bump deps

* add modmenu entrypoint

* add newline

* refactor onBreak

* add portable container tags

* fix quickshulker deprecated warning

* bump version

* fix chests deps

* organize imports

* remove common tags

* bump version

Co-authored-by: Lyaiya <[email protected]>
  • Loading branch information
Aton-Kish and Lyaiya committed Oct 9, 2022
1 parent 7d5c336 commit 00e2bf7
Show file tree
Hide file tree
Showing 29 changed files with 176 additions and 80 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.14.9

# Mod Properties
mod_version = 2.1.1+1.17
mod_version = 2.2.0+1.17
maven_group = atonkish.reinfshulker
archives_base_name = reinforced-shulker-boxes

# Dependencies
fabric_version=0.46.1+1.17
reinforced_core_version=3.0.2+1.17
reinforced_chests_version=2.1.2+1.17
reinforced_core_version=3.0.3+1.17
reinforced_chests_version=2.2.0+1.17
quick_shulker_version=1.3.0-1.17
shulker_box_tooltip_version=3.0.6+1.17.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
import net.fabricmc.loader.api.FabricLoader;

import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;

import net.minecraft.util.DyeColor;

import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.mob.PiglinBrain;
import net.minecraft.entity.mob.ShulkerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.ActionResult;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Hand;
Expand Down Expand Up @@ -85,34 +83,6 @@ private static boolean canOpen(BlockState state, World world, BlockPos pos, Shul
}
}

@Override
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof ReinforcedShulkerBoxBlockEntity) {
ReinforcedShulkerBoxBlockEntity reinforcedShulkerBoxBlockEntity = (ReinforcedShulkerBoxBlockEntity) blockEntity;
if (!world.isClient && player.isCreative() && !reinforcedShulkerBoxBlockEntity.isEmpty()) {
ItemStack itemStack = getItemStack(this.material, this.getColor());
NbtCompound nbtCompound = reinforcedShulkerBoxBlockEntity.writeInventoryNbt(new NbtCompound());
if (!nbtCompound.isEmpty()) {
itemStack.setSubNbt("BlockEntityTag", nbtCompound);
}

if (reinforcedShulkerBoxBlockEntity.hasCustomName()) {
itemStack.setCustomName(reinforcedShulkerBoxBlockEntity.getCustomName());
}

ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D,
(double) pos.getZ() + 0.5D, itemStack);
itemEntity.setToDefaultPickupDelay();
world.spawnEntity(itemEntity);
} else {
reinforcedShulkerBoxBlockEntity.checkLootInteraction(player);
}
}

super.onBreak(world, pos, state, player);
}

public static Block get(ReinforcingMaterial material, @Nullable DyeColor color) {
return ModBlocks.REINFORCED_SHULKER_BOX_MAP.get(material).get(color);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Map;

import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntityType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;

import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.DyeColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

import net.minecraft.block.BlockState;
import net.minecraft.block.ShulkerBoxBlock;
import net.minecraft.client.model.ModelPart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

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;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
Expand All @@ -25,7 +27,8 @@ public class QuickShulker implements RegisterQuickShulker {

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

static {
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/atonkish/reinfshulker/mixin/ItemStackAccessor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package atonkish.reinfshulker.mixin;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(ItemStack.class)
public interface ItemStackAccessor {
@Mutable
@Accessor("item")
public void setItem(Item item);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

import com.google.gson.JsonElement;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.recipe.RecipeManager;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import atonkish.reinfshulker.ReinforcedShulkerBoxesMod;

@Mixin(RecipeManager.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

import com.google.gson.JsonElement;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import net.minecraft.resource.ResourceManager;
import net.minecraft.server.ServerAdvancementLoader;
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import atonkish.reinfshulker.ReinforcedShulkerBoxesMod;

@Mixin(ServerAdvancementLoader.class)
Expand Down
26 changes: 12 additions & 14 deletions src/main/java/atonkish/reinfshulker/mixin/ShulkerBoxBlockMixin.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
package atonkish.reinfshulker.mixin;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShulkerBoxBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import atonkish.reinfshulker.block.ReinforcedShulkerBoxBlock;
import atonkish.reinfshulker.block.entity.ReinforcedShulkerBoxBlockEntity;

@Mixin(ShulkerBoxBlock.class)
public class ShulkerBoxBlockMixin extends Block {
// Dummy
private ShulkerBoxBlockMixin(AbstractBlock.Settings settings) {
super(settings);
}

@Inject(at = @At("HEAD"), method = "onBreak", cancellable = true)
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo info) {
BlockEntity blockEntity = world.getBlockEntity(pos);
public class ShulkerBoxBlockMixin {
@Inject(method = "onBreak", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/ShulkerBoxBlockEntity;writeInventoryNbt(Lnet/minecraft/nbt/NbtCompound;)Lnet/minecraft/nbt/NbtCompound;"), locals = LocalCapture.CAPTURE_FAILHARD)
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player, CallbackInfo info,
BlockEntity blockEntity, ShulkerBoxBlockEntity shulkerBoxBlockEntity, ItemStack itemStack) {
if (blockEntity instanceof ReinforcedShulkerBoxBlockEntity) {
super.onBreak(world, pos, state, player);
info.cancel();
ReinforcedShulkerBoxBlockEntity entity = (ReinforcedShulkerBoxBlockEntity) blockEntity;
((ItemStackAccessor) (Object) itemStack)
.setItem(ReinforcedShulkerBoxBlock.get(entity.getMaterial(), entity.getColor()).asItem());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

import net.minecraft.client.render.TexturedRenderLayers;
import net.minecraft.client.util.SpriteIdentifier;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package atonkish.reinfshulker.util;

import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;

import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
Expand Down
4 changes: 0 additions & 4 deletions src/main/resources/data/c/tags/items/copper_chests.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/resources/data/c/tags/items/diamond_chests.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/resources/data/c/tags/items/gold_chests.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/resources/data/c/tags/items/iron_chests.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/resources/data/c/tags/items/netherite_chests.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"replace": false,
"values": [
"#reinfshulker:copper_shulker_boxes",
"#reinfshulker:iron_shulker_boxes",
"#reinfshulker:gold_shulker_boxes",
"#reinfshulker:diamond_shulker_boxes",
"#reinfshulker:netherite_shulker_boxes"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"replace": false,
"values": [
"reinfshulker:copper_shulker_box",
"reinfshulker:black_copper_shulker_box",
"reinfshulker:blue_copper_shulker_box",
"reinfshulker:brown_copper_shulker_box",
"reinfshulker:cyan_copper_shulker_box",
"reinfshulker:gray_copper_shulker_box",
"reinfshulker:green_copper_shulker_box",
"reinfshulker:light_blue_copper_shulker_box",
"reinfshulker:light_gray_copper_shulker_box",
"reinfshulker:lime_copper_shulker_box",
"reinfshulker:magenta_copper_shulker_box",
"reinfshulker:orange_copper_shulker_box",
"reinfshulker:pink_copper_shulker_box",
"reinfshulker:purple_copper_shulker_box",
"reinfshulker:red_copper_shulker_box",
"reinfshulker:white_copper_shulker_box",
"reinfshulker:yellow_copper_shulker_box"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"replace": false,
"values": [
"reinfshulker:diamond_shulker_box",
"reinfshulker:black_diamond_shulker_box",
"reinfshulker:blue_diamond_shulker_box",
"reinfshulker:brown_diamond_shulker_box",
"reinfshulker:cyan_diamond_shulker_box",
"reinfshulker:gray_diamond_shulker_box",
"reinfshulker:green_diamond_shulker_box",
"reinfshulker:light_blue_diamond_shulker_box",
"reinfshulker:light_gray_diamond_shulker_box",
"reinfshulker:lime_diamond_shulker_box",
"reinfshulker:magenta_diamond_shulker_box",
"reinfshulker:orange_diamond_shulker_box",
"reinfshulker:pink_diamond_shulker_box",
"reinfshulker:purple_diamond_shulker_box",
"reinfshulker:red_diamond_shulker_box",
"reinfshulker:white_diamond_shulker_box",
"reinfshulker:yellow_diamond_shulker_box"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"replace": false,
"values": [
"reinfshulker:gold_shulker_box",
"reinfshulker:black_gold_shulker_box",
"reinfshulker:blue_gold_shulker_box",
"reinfshulker:brown_gold_shulker_box",
"reinfshulker:cyan_gold_shulker_box",
"reinfshulker:gray_gold_shulker_box",
"reinfshulker:green_gold_shulker_box",
"reinfshulker:light_blue_gold_shulker_box",
"reinfshulker:light_gray_gold_shulker_box",
"reinfshulker:lime_gold_shulker_box",
"reinfshulker:magenta_gold_shulker_box",
"reinfshulker:orange_gold_shulker_box",
"reinfshulker:pink_gold_shulker_box",
"reinfshulker:purple_gold_shulker_box",
"reinfshulker:red_gold_shulker_box",
"reinfshulker:white_gold_shulker_box",
"reinfshulker:yellow_gold_shulker_box"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"replace": false,
"values": [
"reinfshulker:iron_shulker_box",
"reinfshulker:black_iron_shulker_box",
"reinfshulker:blue_iron_shulker_box",
"reinfshulker:brown_iron_shulker_box",
"reinfshulker:cyan_iron_shulker_box",
"reinfshulker:gray_iron_shulker_box",
"reinfshulker:green_iron_shulker_box",
"reinfshulker:light_blue_iron_shulker_box",
"reinfshulker:light_gray_iron_shulker_box",
"reinfshulker:lime_iron_shulker_box",
"reinfshulker:magenta_iron_shulker_box",
"reinfshulker:orange_iron_shulker_box",
"reinfshulker:pink_iron_shulker_box",
"reinfshulker:purple_iron_shulker_box",
"reinfshulker:red_iron_shulker_box",
"reinfshulker:white_iron_shulker_box",
"reinfshulker:yellow_iron_shulker_box"
]
}
Loading

0 comments on commit 00e2bf7

Please sign in to comment.