Skip to content

Commit

Permalink
Merge pull request #387 from lonefelidae16/port/1.21.4
Browse files Browse the repository at this point in the history
Port to 1.21.4
  • Loading branch information
juancarloscp52 authored Feb 26, 2025
2 parents 2275b18 + f3b8b63 commit 4c189f8
Show file tree
Hide file tree
Showing 165 changed files with 1,055 additions and 1,276 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 '1.7-SNAPSHOT'
id 'fabric-loom' version '1.9-SNAPSHOT'
id 'maven-publish'
}

Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
org.gradle.jvmargs=-Xmx2048m
# Fabric Properties
# check these on https://fabricmc.net/develop/
minecraft_version=1.21
yarn_mappings=1.21+build.9
loader_version=0.15.11
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.1
loader_version=0.16.9

# Mod Properties
mod_version = 1.10.1
maven_group = me.juancarloscp52
archives_base_name = bedrockify

# Dependencies
fabric_version=0.102.0+1.21
modmenu_version=11.0.1
cloth_config_version=15.0.128
apple_skin=mc1.21-3.0.5
dab_version=2.6.3+1.21-fabric
fabric_version=0.111.0+1.21.4
modmenu_version=13.0.0-beta.1
cloth_config_version=17.0.142
apple_skin=mc1.21.3-3.0.6
dab_version=2.6.3+1.21.3-fabric
iris_version=1.7.1+1.21
sodium_version=mc1.20.1-0.5.10
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
64 changes: 64 additions & 0 deletions recipeReplacer1_21_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/python3

""" Recipe Replacer for Minecraft 1.21.4
Created at Dec 12, 2024 by lonefelidae16 <[email protected]>
Usage:
> recipeReplacer1_21_4.py [--help | -h] [--test | -t] /path/to/target/recipe.json
"""

import json
import sys
import argparse

parser = argparse.ArgumentParser(
prog='RecipeReplacer',
description='Make recipe.json compatible with MC1.21.4')
parser.add_argument('filename')
parser.add_argument('-t', '--test', action='store_true', help='show result JSON to STDOUT, no changes to the specified file')
args = parser.parse_args()

if __name__ == '__main__':

struct = {}
replaced = False
with open(args.filename, 'r') as target_file:
struct = json.load(target_file)
if not 'type' in struct or not 'result' in struct:
exit()
if struct['type'] == 'minecraft:crafting_shapeless':
ingredient_arr = []
for ing in struct['ingredients']:
if 'item' in ing:
ingredient_arr.append(ing['item'])
elif 'tag' in ing:
ingredient_arr.append('#' + ing['tag'])
struct['ingredients'] = ingredient_arr
replaced = True
elif struct['type'] == 'minecraft:crafting_shaped':
if not 'key' in struct:
exit()
for k in struct['key']:
if 'item' in struct['key'][k]:
_item = struct['key'][k]['item']
del struct['key'][k]['item']
struct['key'][k] = _item
replaced = True
elif 'tag' in struct['key'][k]:
_tag = '#' + struct['key'][k]['tag']
del struct['key'][k]['tag']
struct['key'][k] = _tag
replaced = True
if type(struct['result']) is not str and not 'count' in struct['result']:
struct['result']['count'] = 1
replaced = True

if replaced:
if args.test:
print(json.dumps(struct, indent=2))
else:
with open(args.filename, 'w') as target_file:
json.dump(struct, target_file, indent=2)
else:
print(args.filename + ": no changes made")
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.EntityPose;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
import net.minecraft.resource.ResourceType;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -129,11 +130,12 @@ public void onInitializeClient() {
}

// Stop elytra flying by pressing space
if(null != client.player && settings.elytraStop && client.player.isFallFlying() && timeFlying > 10 && client.options.jumpKey.isPressed()){
client.player.stopFallFlying();
if(null != client.player && settings.elytraStop && client.player.getPose().equals(EntityPose.GLIDING) && timeFlying > 10 && client.options.jumpKey.isPressed()){
client.player.getAbilities().flying = false;
client.player.sendAbilitiesUpdate();
client.player.networkHandler.sendPacket(new ClientCommandC2SPacket(client.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING));
}
if(null != client.player && client.player.isFallFlying() && !client.options.jumpKey.isPressed())
if(null != client.player && client.player.getPose().equals(EntityPose.GLIDING) && !client.options.jumpKey.isPressed())
timeFlying++;
else
timeFlying = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public final class BedrockSunGlareShading {
private final MinecraftClient client;

public BedrockSunGlareShading() {
onSunlightIntensityChanged();
this.sunVector3f = new Vector3f();
this.client = MinecraftClient.getInstance();
}
Expand Down Expand Up @@ -265,10 +264,11 @@ public float getSunAngleDiff() {
}

public float getSkyAttenuation() {
return this.skyAttenuation;
return getSkyAttenuation(false);
}

public void onSunlightIntensityChanged() {
this.skyAttenuation = MathHelper.clampedLerp(1f, 0.60f, BedrockifyClient.getInstance().settings.sunlightIntensity / 100f);
public float getSkyAttenuation(boolean darker) {
this.skyAttenuation = MathHelper.clampedLerp(1f, darker? 0.40f:0.60f, BedrockifyClient.getInstance().settings.sunlightIntensity / 100f);
return this.skyAttenuation;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package me.juancarloscp52.bedrockify.client.features.eatingAnimations;

import net.minecraft.util.Hand;

import java.util.Optional;

public interface IEatingState {
default void setEatingHand(Hand hand) {
}

default Optional<Hand> getEatingHand() {
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@
import me.juancarloscp52.bedrockify.Bedrockify;
import net.minecraft.client.model.*;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.EntityModelLayer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.projectile.FishingBobberEntity;
import net.minecraft.client.render.entity.state.FishingBobberEntityState;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.ColorHelper;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

public class FishingBobber3DModel<T extends FishingBobberEntity> extends EntityModel<T> {
public class FishingBobber3DModel<T extends FishingBobberEntityState> extends EntityModel<T> {
public static final EntityModelLayer MODEL_LAYER = new EntityModelLayer(Identifier.of(Bedrockify.MOD_ID, "fishing_hook"), "main");
public static final Identifier TEXTURE = Identifier.of(Bedrockify.MOD_ID, "textures/entity/fishing_hook.png");
public static final RenderLayer RENDER_LAYER = RenderLayer.getEntityTranslucent(TEXTURE);
Expand All @@ -26,14 +20,8 @@ public class FishingBobber3DModel<T extends FishingBobberEntity> extends EntityM
private static final String NAME_HOOK = "hook";
private static final float ANGLE_180_DEGREES = (float) (1f * Math.PI);

private final List<ModelPart> black = new ArrayList<>();
private final List<ModelPart> textured = new ArrayList<>();

public FishingBobber3DModel(@NotNull ModelPart root) {
this.black.add(root.getChild(NAME_HEAD_X));
this.black.add(root.getChild(NAME_HEAD_Z));
this.textured.add(root.getChild(NAME_BOBBER));
this.textured.add(root.getChild(NAME_HOOK));
super(root);
}

@NotNull
Expand All @@ -50,13 +38,6 @@ public static TexturedModelData generateModel() {
}

@Override
public void setAngles(T entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) {

}

@Override
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
this.black.forEach(modelPart -> modelPart.render(matrices, vertices, light, overlay, ColorHelper.Argb.getArgb(ColorHelper.Argb.getAlpha(color),0,0,0)));
this.textured.forEach(modelPart -> modelPart.render(matrices, vertices, light, overlay, color));
public void setAngles(T state) {
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package me.juancarloscp52.bedrockify.client.features.heldItemTooltips;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import me.juancarloscp52.bedrockify.client.BedrockifyClient;
import me.juancarloscp52.bedrockify.client.BedrockifyClientSettings;
import me.juancarloscp52.bedrockify.client.features.heldItemTooltips.tooltip.ContainerTooltip;
import me.juancarloscp52.bedrockify.client.features.heldItemTooltips.tooltip.EnchantmentTooltip;
import me.juancarloscp52.bedrockify.client.features.heldItemTooltips.tooltip.PotionTooltip;
import me.juancarloscp52.bedrockify.client.features.heldItemTooltips.tooltip.Tooltip;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
Expand All @@ -22,13 +24,16 @@
import net.minecraft.util.Formatting;
import net.minecraft.util.math.MathHelper;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class HeldItemTooltips {

private final int tooltipSize = 6;

private static final boolean B_DAB_LOADED = FabricLoader.getInstance().isModLoaded("detailab");

public int drawItemWithCustomTooltips(DrawContext drawContext, TextRenderer fontRenderer, Text text, float x, float y, int color, ItemStack currentStack) {
final BedrockifyClientSettings settings = BedrockifyClient.getInstance().settings;
final int screenBorder = settings.getScreenSafeArea();
Expand All @@ -40,7 +45,7 @@ public int drawItemWithCustomTooltips(DrawContext drawContext, TextRenderer font
return 0;
if(MinecraftClient.getInstance().interactionManager.hasStatusBars()){
y-=16;
if(player.getArmor()>0){
if(player.getArmor()>0 || (B_DAB_LOADED && Sets.newHashSet(player.getArmorItems()).stream().anyMatch(stack -> stack.contains(DataComponentTypes.GLIDER)))){
y-=10;
}
if(player.getAbsorptionAmount()>0){
Expand Down Expand Up @@ -91,7 +96,7 @@ public int drawItemWithCustomTooltips(DrawContext drawContext, TextRenderer font
* @param currentStack Current item stack of the player.
* @return List with the tooltip information.
*/
public List<Tooltip> getTooltips(ItemStack currentStack) {
public static List<Tooltip> getTooltips(ItemStack currentStack) {
final Item item = currentStack.getItem();
final List<Tooltip> result = Lists.newArrayList();
//If the item is a enchanted book, retrieve the enchantments.
Expand All @@ -104,6 +109,13 @@ public List<Tooltip> getTooltips(ItemStack currentStack) {
// Lingering Potion has its own multiplier of duration, and it is hardcoded.
item.appendTooltip(currentStack, Item.TooltipContext.DEFAULT, generated, TooltipType.BASIC);
generateTooltipsForPotion(generated, result);
} else if (item == Items.OMINOUS_BOTTLE) {
var ominousComponent = currentStack.getComponents().get(DataComponentTypes.OMINOUS_BOTTLE_AMPLIFIER);
if (ominousComponent != null) {
List<Text> generated = Lists.newArrayList();
ominousComponent.appendTooltip(Item.TooltipContext.DEFAULT, generated::add, TooltipType.BASIC);
generateTooltipsForPotion(generated, result);
}
} else if(currentStack.getComponents().contains(DataComponentTypes.CONTAINER)){
var container = currentStack.getComponents().get(DataComponentTypes.CONTAINER);
if(container != null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class ContainerTooltip extends Tooltip {
String translationKey;

public ContainerTooltip(ItemStack item){
this.translationKey = item.getTranslationKey();
this.translationKey = item.getItem().getTranslationKey();
this.primaryValue = item.getCount();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package me.juancarloscp52.bedrockify.client.features.loadingScreens;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.LogoDrawer;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;

import java.util.List;
import java.util.Random;
import java.util.Set;


public class LoadingScreenWidget {
Expand All @@ -22,7 +24,7 @@ public class LoadingScreenWidget {
private static final int TIPS_NUM = 107;
private final Identifier WIDGET_TEXTURE = Identifier.of("bedrockify", "textures/gui/bedrockify_widgets.png");
private Text tip;
private static final List<Integer> EXCLUDED_TIPS = Lists.asList(15,new Integer[]{23,28,29,32,33,34,35,62});
private static final Set<Integer> EXCLUDED_TIPS = Sets.newHashSet(15,23,28,29,32,33,34,35,62);
private long lastTipUpdate = 0;
private final ExternalLoadingTips externalLoadingTips;
private final LogoDrawer logoDrawer;
Expand Down Expand Up @@ -88,7 +90,7 @@ public void render(DrawContext drawContext, int width, int height, Text title, T
private void renderLoadingWidget(DrawContext drawContext, int x, int y) {
RenderSystem.enableBlend();
RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
drawContext.drawTexture(WIDGET_TEXTURE, x - 256 / 2, y - 89 / 2, 0, 0, 256, 89);
drawContext.drawTexture(RenderLayer::getGuiTextured, WIDGET_TEXTURE, x - 256 / 2, y - 89 / 2, 0, 0, 256, 89, 256, 256);
}


Expand Down Expand Up @@ -116,9 +118,9 @@ private int getMaxLineWidth(TextRenderer textRenderer, List<OrderedText> text) {

private void renderLoadingBar(DrawContext drawContext, int x, int y, int progress) {
int barProgress = (int) ((MathHelper.clamp(progress,0,100)/100.0f) * 223.0f);
drawContext.drawTexture(WIDGET_TEXTURE, x - 111, y + 26, 0, 89, 222, 5);
drawContext.drawTexture(RenderLayer::getGuiTextured, WIDGET_TEXTURE, x - 111, y + 26, 0, 89, 222, 5, 256, 256);
if (barProgress > 0)
drawContext.drawTexture(WIDGET_TEXTURE, x - 111, y + 26, 0, 94, barProgress, 5);
drawContext.drawTexture(RenderLayer::getGuiTextured, WIDGET_TEXTURE, x - 111, y + 26, 0, 94, barProgress, 5, 256, 256);
}

}
Loading

0 comments on commit 4c189f8

Please sign in to comment.