From c05e537f4f18ffd1f0a34d78e60994812287e347 Mon Sep 17 00:00:00 2001 From: ExDrill <72329798+ExDrill@users.noreply.github.com> Date: Sun, 30 Jul 2023 13:35:36 -0500 Subject: [PATCH] Update to 1.20.1 --- build.gradle | 4 +-- gradle.properties | 8 ++--- .../java/com/teamabode/guarding/Guarding.java | 29 ++++++++++++++--- .../client/model/NetheriteShieldModel.java | 16 ++++------ .../render/NetheriteShieldRenderer.java | 13 +++----- .../enchantment/RetributionEnchantment.java | 1 - .../guarding/core/init/GuardingConfig.java | 31 ------------------- 7 files changed, 41 insertions(+), 61 deletions(-) delete mode 100644 src/main/java/com/teamabode/guarding/core/init/GuardingConfig.java diff --git a/build.gradle b/build.gradle index 8d4ecdf..a0a1f0b 100644 --- a/build.gradle +++ b/build.gradle @@ -20,8 +20,8 @@ repositories { maven { url = uri("https://maven.pkg.github.com/team-abode/scribe-wip") credentials { - username = "ExDrill" - password = "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" + username = System.getenv("GITHUB_USER") + password = System.getenv("GITHUB_TOKEN") } } } diff --git a/gradle.properties b/gradle.properties index b881ada..099f73e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G org.gradle.parallel=true # Fabric Properties - minecraft_version=1.20 + minecraft_version=1.20.1 loader_version=0.14.21 # Mod Properties @@ -11,7 +11,7 @@ org.gradle.parallel=true archives_base_name = guarding # Dependencies - fabric_version=0.83.0+1.20 - scribe_version=1.20-0.4.1 - parchment_version=1.19.3:2023.03.12 + fabric_version=0.86.1+1.20.1 + scribe_version=1.20.1-0.4.7 + parchment_version=1.20.1:2023.07.23 fabric_asm_version=v2.3 diff --git a/src/main/java/com/teamabode/guarding/Guarding.java b/src/main/java/com/teamabode/guarding/Guarding.java index 6e28f79..5a0f8f9 100644 --- a/src/main/java/com/teamabode/guarding/Guarding.java +++ b/src/main/java/com/teamabode/guarding/Guarding.java @@ -16,11 +16,30 @@ public class Guarding implements ModInitializer { public static final EnchantmentCategory GUARDING_SHIELD = ClassTinkerers.getEnum(EnchantmentCategory.class, "GUARDING_SHIELD"); public static final Config CONFIG = new ConfigBuilder(MOD_ID) - .addGroup(GuardingConfig.GENERAL) - .addGroup(GuardingConfig.PARRY) - .addGroup(GuardingConfig.BARBED) - .addGroup(GuardingConfig.PUMMELING) - .addGroup(GuardingConfig.RETRIBUTION) + .addGroup("general", builder -> { + builder.addBooleanProperty("no_shield_block_delay", true); + return builder; + }) + .addGroup("parry", builder -> { + builder.addFloatProperty("exhaustion_cost", 2.0f); + builder.addFloatProperty("knockback_strength", 0.5f); + builder.addFloatProperty("projectile_launch_strength", 1.25f); + return builder; + }) + .addGroup("barbed", builder -> { + builder.addFloatProperty("damage_amount", 2.0f); + builder.addFloatProperty("damage_chance", 0.2f); + return builder; + }) + .addGroup("pummeling", builder -> { + builder.addFloatProperty("additional_knockback_strength_per_level", 0.15f); + return builder; + }) + .addGroup("retribution", builder -> { + builder.addIntProperty("slowness_amplifier", 1); + builder.addBooleanProperty("is_treasure", true); + return builder; + }) .build(); public void onInitialize() { diff --git a/src/main/java/com/teamabode/guarding/client/model/NetheriteShieldModel.java b/src/main/java/com/teamabode/guarding/client/model/NetheriteShieldModel.java index b0d58a5..15a313a 100644 --- a/src/main/java/com/teamabode/guarding/client/model/NetheriteShieldModel.java +++ b/src/main/java/com/teamabode/guarding/client/model/NetheriteShieldModel.java @@ -3,7 +3,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.teamabode.guarding.Guarding; -import net.minecraft.client.Minecraft; import net.minecraft.client.model.ShieldModel; import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelPart; @@ -14,32 +13,29 @@ import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.resources.model.Material; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.armortrim.ArmorTrim; -import java.security.Guard; - public class NetheriteShieldModel extends ShieldModel { public static final ModelLayerLocation LAYER = new ModelLayerLocation(new ResourceLocation(Guarding.MOD_ID, "netherite_shield"), "main"); public static final ResourceLocation TEXTURE = new ResourceLocation(Guarding.MOD_ID, "textures/entity/netherite_shield.png"); - public NetheriteShieldModel(ModelPart modelPart) { + private final TextureAtlas atlas; + + public NetheriteShieldModel(ModelPart modelPart, TextureAtlas atlas) { super(modelPart); + this.atlas = atlas; } public void renderTrim(PoseStack poseStack, MultiBufferSource bufferSource, int light, ArmorTrim trim) { - TextureAtlas atlas = Minecraft.getInstance().getModelManager().getAtlas(Sheets.ARMOR_TRIMS_SHEET); TextureAtlasSprite sprite = atlas.getSprite(trimTexture(trim)); - VertexConsumer buffer = bufferSource.getBuffer(Sheets.armorTrimsSheet()); - - VertexConsumer vertex = sprite.wrap(buffer); + VertexConsumer vertex = sprite.wrap(bufferSource.getBuffer(RenderType.entityCutout(Sheets.ARMOR_TRIMS_SHEET))); this.renderToBuffer(poseStack, vertex, light, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f); } public void renderGlint(PoseStack poseStack, MultiBufferSource bufferSource, int light) { - this.renderToBuffer(poseStack, bufferSource.getBuffer(RenderType.armorEntityGlint()), light, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f); + this.renderToBuffer(poseStack, ItemRenderer.getFoilBuffer(bufferSource, RenderType.armorGlint(), false, true), light, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f); } private static ResourceLocation trimTexture(ArmorTrim trim) { diff --git a/src/main/java/com/teamabode/guarding/client/render/NetheriteShieldRenderer.java b/src/main/java/com/teamabode/guarding/client/render/NetheriteShieldRenderer.java index 62de7bb..d08f502 100644 --- a/src/main/java/com/teamabode/guarding/client/render/NetheriteShieldRenderer.java +++ b/src/main/java/com/teamabode/guarding/client/render/NetheriteShieldRenderer.java @@ -2,7 +2,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.mojang.math.Axis; import com.teamabode.guarding.Guarding; import com.teamabode.guarding.client.model.NetheriteShieldModel; import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; @@ -10,14 +9,14 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.Sheets; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.util.datafix.fixes.ChunkPalettedStorageFix; import net.minecraft.world.item.ItemDisplayContext; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.armortrim.ArmorTrim; -import org.joml.Quaternionf; + +import java.util.Optional; public class NetheriteShieldRenderer implements BuiltinItemRendererRegistry.DynamicItemRenderer, SimpleSynchronousResourceReloadListener { private NetheriteShieldModel model; @@ -31,8 +30,7 @@ public void render(ItemStack stack, ItemDisplayContext displayContext, PoseStack poseStack.scale(1.0f, -1.0f, -1.0f); VertexConsumer buffer = bufferSource.getBuffer(model.renderType(NetheriteShieldModel.TEXTURE)); - model.handle().render(poseStack, buffer, light, overlay, 1.0f, 1.0f, 1.0f, 1.0f); - model.plate().render(poseStack, buffer, light, overlay, 1.0f, 1.0f, 1.0f, 1.0f); + model.renderToBuffer(poseStack, buffer, light, overlay, 1.0f, 1.0f, 1.0f, 1.0f); ClientLevel level = Minecraft.getInstance().level; if (level != null) { @@ -40,7 +38,6 @@ public void render(ItemStack stack, ItemDisplayContext displayContext, PoseStack model.renderTrim(poseStack, bufferSource, light, armorTrim); }); } - if (stack.hasFoil()) { model.renderGlint(poseStack, bufferSource, light); } @@ -48,6 +45,6 @@ public void render(ItemStack stack, ItemDisplayContext displayContext, PoseStack } public void onResourceManagerReload(ResourceManager manager) { - this.model = new NetheriteShieldModel(Minecraft.getInstance().getEntityModels().bakeLayer(NetheriteShieldModel.LAYER)); + this.model = new NetheriteShieldModel(Minecraft.getInstance().getEntityModels().bakeLayer(NetheriteShieldModel.LAYER), Minecraft.getInstance().getModelManager().getAtlas(Sheets.ARMOR_TRIMS_SHEET)); } } diff --git a/src/main/java/com/teamabode/guarding/common/enchantment/RetributionEnchantment.java b/src/main/java/com/teamabode/guarding/common/enchantment/RetributionEnchantment.java index ba98711..fc0bc6a 100644 --- a/src/main/java/com/teamabode/guarding/common/enchantment/RetributionEnchantment.java +++ b/src/main/java/com/teamabode/guarding/common/enchantment/RetributionEnchantment.java @@ -1,7 +1,6 @@ package com.teamabode.guarding.common.enchantment; import com.teamabode.guarding.Guarding; -import com.teamabode.guarding.core.init.GuardingConfig; import net.minecraft.world.item.enchantment.Enchantment; public class RetributionEnchantment extends GuardingEnchantment { diff --git a/src/main/java/com/teamabode/guarding/core/init/GuardingConfig.java b/src/main/java/com/teamabode/guarding/core/init/GuardingConfig.java deleted file mode 100644 index 3d009a3..0000000 --- a/src/main/java/com/teamabode/guarding/core/init/GuardingConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.teamabode.guarding.core.init; - -import com.teamabode.scribe.core.api.config.Group; -import com.teamabode.scribe.core.api.config.GroupBuilder; - -public class GuardingConfig { - - public static final Group GENERAL = new GroupBuilder("general") - .addBooleanProperty("no_shield_block_delay", true) - .build(); - - public static final Group PARRY = new GroupBuilder("parry") - .addFloatProperty("exhaustion_cost", 2.0f) - .addFloatProperty("knockback_strength", 0.5f) - .addFloatProperty("projectile_launch_strength", 1.25f) - .build(); - - public static final Group BARBED = new GroupBuilder("barbed") - .addFloatProperty("damage_amount", 2.0f) - .addFloatProperty("damage_chance", 0.2f) - .build(); - - public static final Group PUMMELING = new GroupBuilder("pummeling") - .addFloatProperty("additional_knockback_strength_per_level", 0.15f) - .build(); - - public static final Group RETRIBUTION = new GroupBuilder("retribution") - .addIntProperty("slowness_amplifier", 1) - .addBooleanProperty("is_treasure", true) - .build(); -}