Skip to content

Commit

Permalink
Support 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
RubixDev committed Jan 22, 2023
1 parent da213f5 commit 32db776
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 135 deletions.
28 changes: 16 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,33 @@ org.gradle.jvmargs = -Xmx4G

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version = 1.19.2
minecraft_minimum_version = 1.19
yarn_mappings = 1.19.2+build.1
loader_version = 0.14.9
minecraft_version = 1.19.3
minecraft_minimum_version = 1.19.3
yarn_mappings = 1.19.3+build.5
loader_version = 0.14.13

# Mod Properties
mod_version = 1.0.4
mod_version = 1.0.5
maven_group = de.rubixdev
archives_base_name = enchantedshulkers

# Dependencies
fabric_version = 0.59.0+1.19.2
fabric_version = 0.73.0+1.19.3
# https://github.com/Chocohead/Fabric-ASM/tags
fabric_asm_version = 2.3
# https://mvnrepository.com/artifact/com.moandjiezana.toml/toml4j
toml4j_version = 0.7.2
cloth_version = 8.0.75
modmenu_version = 4.0.6
# https://modrinth.com/mod/cloth-config/versions
cloth_version = 9.0.94
# https://modrinth.com/mod/modmenu/versions
modmenu_version = 5.0.2

# Release Action properties
release_curse_versions = Minecraft 1.19:1.19,Minecraft 1.19:1.19.1,Minecraft 1.19:1.19.2
release_modrinth_versions = 1.19,1.19.1,1.19.2
release_display_version = 1.19+
release_curse_versions = Minecraft 1.19:1.19.3
release_modrinth_versions = 1.19.3
release_display_version = 1.19.3

release_extra_branch = true
release_extra_branch = false
release_extra_branch_name = 1.18
release_extra_curse_versions = Minecraft 1.18:1.18.2
release_extra_modrinth_versions = 1.18.2
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Binary file added gradle/wrapper/paper.zip
Binary file not shown.
32 changes: 32 additions & 0 deletions src/main/java/de/rubixdev/enchantedshulkers/ClientMod.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
package de.rubixdev.enchantedshulkers;

import com.google.common.collect.ImmutableList;
import de.rubixdev.enchantedshulkers.config.ClientConfig;
import java.util.List;
import java.util.stream.Stream;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.render.TexturedRenderLayers;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;

@SuppressWarnings("BooleanMethodIsAlwaysInverted")
@Environment(EnvType.CLIENT)
public class ClientMod implements ClientModInitializer {
public static final SpriteIdentifier CLOSED_ENDER_TEXTURE_ID =
new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, new Identifier("entity/chest/closed_ender"));
public static final SpriteIdentifier CLOSED_SHULKER_TEXTURE_ID = new SpriteIdentifier(
TexturedRenderLayers.SHULKER_BOXES_ATLAS_TEXTURE, new Identifier("entity/shulker/closed_shulker"));
public static final List<SpriteIdentifier> CLOSED_COLORED_SHULKER_BOXES_TEXTURE_IDS = Stream.of(
"white",
"orange",
"magenta",
"light_blue",
"yellow",
"lime",
"pink",
"gray",
"light_gray",
"cyan",
"purple",
"blue",
"brown",
"green",
"red",
"black")
.map(string -> new SpriteIdentifier(
TexturedRenderLayers.SHULKER_BOXES_ATLAS_TEXTURE,
new Identifier("entity/shulker/closed_shulker_" + string)))
.collect(ImmutableList.toImmutableList());

private static boolean hasCloth = false;

@Override
Expand Down
20 changes: 7 additions & 13 deletions src/main/java/de/rubixdev/enchantedshulkers/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import de.rubixdev.enchantedshulkers.enchantment.RefillEnchantment;
import de.rubixdev.enchantedshulkers.enchantment.SiphonEnchantment;
import de.rubixdev.enchantedshulkers.interfaces.InventoryState;
import java.util.Arrays;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
Expand All @@ -18,10 +17,11 @@
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.tag.TagKey;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.tag.TagKey;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -42,7 +42,7 @@ public class Mod implements ModInitializer {
}

public static final TagKey<Item> PORTABLE_CONTAINER_TAG =
TagKey.of(Registry.ITEM_KEY, new Identifier(MOD_ID, "portable_container"));
TagKey.of(RegistryKeys.ITEM, new Identifier(MOD_ID, "portable_container"));
public static final EnchantmentTarget PORTABLE_CONTAINER_TARGET =
ClassTinkerers.getEnum(EnchantmentTarget.class, "PORTABLE_CONTAINER");

Expand All @@ -54,14 +54,8 @@ public class Mod implements ModInitializer {

@Override
public void onInitialize() {
Registry.register(Registry.ENCHANTMENT, new Identifier(MOD_ID, "siphon"), SIPHON_ENCHANTMENT);
Registry.register(Registry.ENCHANTMENT, new Identifier(MOD_ID, "refill"), REFILL_ENCHANTMENT);

// Add enchantments to DECORATIONS ItemGroup
EnchantmentTarget[] currentTargets = ItemGroup.DECORATIONS.getEnchantments();
EnchantmentTarget[] newTargets = Arrays.copyOf(currentTargets, currentTargets.length + 1);
newTargets[newTargets.length - 1] = PORTABLE_CONTAINER_TARGET;
ItemGroup.DECORATIONS.setEnchantments(newTargets);
Registry.register(Registries.ENCHANTMENT, new Identifier(MOD_ID, "siphon"), SIPHON_ENCHANTMENT);
Registry.register(Registries.ENCHANTMENT, new Identifier(MOD_ID, "refill"), REFILL_ENCHANTMENT);

// Add enchanted_ender_chest data pack when enabled in config
FabricLoader.getInstance()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,7 @@
package de.rubixdev.enchantedshulkers;

import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.stream.Stream;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.texture.SpriteAtlasTexture;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;

@Environment(EnvType.CLIENT)
public class SpriteAtlasStorage {
public static final Identifier CLOSED_CONTAINERS_ATLAS_TEXTURE_ID =
new Identifier("enchantedshulkers:textures/atlas/closed_containers.png");
public static final SpriteIdentifier CLOSED_ENDER_TEXTURE_ID = new SpriteIdentifier(
CLOSED_CONTAINERS_ATLAS_TEXTURE_ID, new Identifier("enchantedshulkers:entity/chest/closed_ender"));
public static final SpriteIdentifier CLOSED_SHULKER_TEXTURE_ID = new SpriteIdentifier(
CLOSED_CONTAINERS_ATLAS_TEXTURE_ID, new Identifier("enchantedshulkers:entity/shulker/closed_shulker"));
public static final List<SpriteIdentifier> CLOSED_COLORED_SHULKER_BOXES_TEXTURE_IDS = Stream.of(
"white",
"orange",
"magenta",
"light_blue",
"yellow",
"lime",
"pink",
"gray",
"light_gray",
"cyan",
"purple",
"blue",
"brown",
"green",
"red",
"black")
.map(string -> new SpriteIdentifier(
CLOSED_CONTAINERS_ATLAS_TEXTURE_ID,
new Identifier("enchantedshulkers:entity/shulker/closed_shulker_" + string)))
.collect(ImmutableList.toImmutableList());
public static SpriteAtlasTexture closedContainersAtlasTexture =
new SpriteAtlasTexture(CLOSED_CONTAINERS_ATLAS_TEXTURE_ID);
}
public class SpriteAtlasStorage {}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.network.encryption.PlayerPublicKey;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -31,9 +29,8 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntity implements In
@Unique
private boolean hasOpenInventory = false;

public ServerPlayerEntityMixin(
World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) {
super(world, pos, yaw, gameProfile, publicKey);
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile) {
super(world, pos, yaw, gameProfile);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package de.rubixdev.enchantedshulkers.mixin.client;

import static de.rubixdev.enchantedshulkers.ClientMod.CLOSED_ENDER_TEXTURE_ID;

import de.rubixdev.enchantedshulkers.ClientMod;
import de.rubixdev.enchantedshulkers.SpriteAtlasStorage;
import de.rubixdev.enchantedshulkers.Utils;
import net.minecraft.block.AbstractChestBlock;
import net.minecraft.block.Block;
Expand Down Expand Up @@ -151,9 +152,9 @@ private void renderGlintWhenClosed(
|| !Utils.shouldGlint(entity)
|| g > 0.01f) return;

SpriteIdentifier spriteIdentifier = SpriteAtlasStorage.CLOSED_ENDER_TEXTURE_ID;
VertexConsumer vertexConsumer = SpriteAtlasStorage.closedContainersAtlasTexture
.getSprite(spriteIdentifier.getTextureId())
SpriteIdentifier spriteIdentifier = CLOSED_ENDER_TEXTURE_ID;
VertexConsumer vertexConsumer = spriteIdentifier
.getSprite()
.getTextureSpecificVertexConsumer(ItemRenderer.getDirectItemGlintConsumer(
vertexConsumers, spriteIdentifier.getRenderLayer(RenderLayer::getEntityCutout), false, true));
CLOSED_CHEST.render(matrices, vertexConsumer, i, overlay, 1.0f, 1.0f, 1.0f, 1.0f);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package de.rubixdev.enchantedshulkers.mixin.client;

import static de.rubixdev.enchantedshulkers.SpriteAtlasStorage.CLOSED_COLORED_SHULKER_BOXES_TEXTURE_IDS;
import static de.rubixdev.enchantedshulkers.SpriteAtlasStorage.CLOSED_SHULKER_TEXTURE_ID;
import static de.rubixdev.enchantedshulkers.ClientMod.CLOSED_COLORED_SHULKER_BOXES_TEXTURE_IDS;
import static de.rubixdev.enchantedshulkers.ClientMod.CLOSED_SHULKER_TEXTURE_ID;

import de.rubixdev.enchantedshulkers.ClientMod;
import de.rubixdev.enchantedshulkers.SpriteAtlasStorage;
import de.rubixdev.enchantedshulkers.Utils;
import java.util.function.Function;
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
Expand Down Expand Up @@ -86,8 +85,8 @@ private void renderGlint(
? CLOSED_SHULKER_TEXTURE_ID
: CLOSED_COLORED_SHULKER_BOXES_TEXTURE_IDS.get(dyeColor.getId());

VertexConsumer vertexConsumer = SpriteAtlasStorage.closedContainersAtlasTexture
.getSprite(spriteIdentifier.getTextureId())
VertexConsumer vertexConsumer = spriteIdentifier
.getSprite()
.getTextureSpecificVertexConsumer(ItemRenderer.getDirectItemGlintConsumer(
vertexConsumerProvider,
spriteIdentifier.getRenderLayer(RenderLayer::getEntityCutout),
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/enchantedshulkers.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"client.BuiltinModelItemRendererMixin_optifabric",
"client.ChestBlockEntityRendererMixin",
"client.MinecraftClientMixin",
"client.ModelLoaderMixin",
"client.ShulkerBoxBlockEntityRendererMixin"
],
"injectors": {
Expand Down

0 comments on commit 32db776

Please sign in to comment.