Skip to content

Commit

Permalink
Minecraft 1.21.2/3
Browse files Browse the repository at this point in the history
Signed-off-by: Hendrix-Shen <[email protected]>
  • Loading branch information
Hendrix-Shen committed Oct 25, 2024
1 parent cb8f764 commit a8f4798
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 10 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ preprocess {
Node mc12004_fabric = createNode("1.20.4-fabric", 1_20_04, "mojang")
Node mc12006_fabric = createNode("1.20.6-fabric", 1_20_06, "mojang")
Node mc12101_fabric = createNode("1.21.1-fabric", 1_21_01, "mojang")
Node mc12103_fabric = createNode("1.21.3-fabric", 1_21_03, "mojang")

mc11404_fabric.link(mc11502_fabric, null)
mc11502_fabric.link(mc11605_fabric, file("versions/mapping-fabric-1.15.2-1.16.5.txt"))
Expand All @@ -35,6 +36,7 @@ preprocess {
mc12002_fabric.link(mc12004_fabric, null)
mc12004_fabric.link(mc12006_fabric, null)
mc12006_fabric.link(mc12101_fabric, null)
mc12101_fabric.link(mc12103_fabric, null)

// NeoForge
Node mc12101_neoforge = createNode("1.21.1-neoforge", 1_21_01, "mojang")
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ mod.version=4.0
## Annotation processor
dependencies.lombok_version=1.18.34
## MagicLib
dependencies.magiclib_dependency=0.8.633
dependencies.magiclib_version=0.8.633
dependencies.magiclib_dependency=0.8.635
dependencies.magiclib_version=0.8.635-beta

# Gradle Plugins
architectury_loom_version=1.7-SNAPSHOT
Expand Down
1 change: 1 addition & 0 deletions settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"1.20.4-fabric",
"1.20.6-fabric",
"1.21.1-fabric",
"1.21.3-fabric",

"1.21.1-neoforge"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
import top.hendrixshen.magiclib.MagicLib;
import top.hendrixshen.magiclib.api.compat.minecraft.util.ProfilerCompat;
import top.hendrixshen.magiclib.api.compat.minecraft.world.entity.EntityCompat;
import top.hendrixshen.magiclib.util.collect.ValueContainer;

Expand Down Expand Up @@ -191,7 +192,7 @@ public boolean getLastInventoryPreviewStatus() {
}

public void endClientTickCallback() {
ProfilerFiller profiler = Minecraft.getInstance().getProfiler();
ProfilerFiller profiler = ProfilerCompat.get();
Level level = WorldUtils.getBestWorld(Minecraft.getInstance());

if (level == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
import fi.dy.masa.malilib.render.RenderUtils;
import net.minecraft.resources.ResourceLocation;

//#if MC > 12101
//$$ import net.minecraft.client.gui.GuiGraphics;
//#endif

public enum MasaGadgetIcons implements IGuiIcon {
FAVORITE(0, 0, 16, 16, 16, 16);

Expand Down Expand Up @@ -47,7 +51,16 @@ public int getV() {
}

@Override
public void renderAt(int x, int y, float zLevel, boolean enabled, boolean selected) {
public void renderAt(
int x,
int y,
float zLevel,
boolean enabled,
boolean selected
//#if MC > 12101
//$$ , GuiGraphics guiGraphics
//#endif
) {
int u = this.u;
int v = this.v;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,23 @@ public void render(
int mouseY,
boolean selected
//#if MC > 11904
//$$ , GuiGraphics gui
//$$ , GuiGraphics guiGraphicsOrPoseStack
//#elseif MC > 11502
, PoseStack poseStack
, PoseStack guiGraphicsOrPoseStack
//#endif
) {
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
this.bindTexture(icon.getTexture());
icon.renderAt(this.x, this.y, (float) this.zLevel, this.status, this.isMouseOver(mouseX, mouseY));
icon.renderAt(
this.x,
this.y,
(float) this.zLevel,
this.status,
this.isMouseOver(mouseX, mouseY)
//#if MC > 12101
//$$ , guiGraphicsOrPoseStack
//#endif
);

if (this.isMouseOver(mouseX, mouseY)) {
RenderUtils.drawOutlinedBox(this.x, this.y, this.width, this.height, 0x20C0C0C0, -520093697);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import org.jetbrains.annotations.Nullable;
import top.hendrixshen.magiclib.api.render.context.RenderContext;

//#if MC > 12101
//$$ import net.minecraft.client.renderer.RenderType;
//#endif

//#if MC < 12000
import com.plusls.MasaGadget.mixin.accessor.AccessorGuiComponent;
import net.minecraft.network.chat.Component;
Expand All @@ -28,6 +32,7 @@
//#endif

//#if MC > 11404
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.MultiBufferSource;
import top.hendrixshen.magiclib.util.minecraft.render.RenderUtil;
//#endif
Expand Down Expand Up @@ -243,7 +248,9 @@ private void moveSelectedSlot(int n) {
}

private void renderSlotHighlight(@NotNull RenderContext renderContext, int x, int y) {
//#if MC > 11605
//#if MC > 12101
//$$ renderContext.getGuiComponent().fillGradient(RenderType.guiOverlay(), x, y, x + 16, y + 16, 0x80FFFFFF, 0x80FFFFFF, 0);
//#elseif MC > 11605
//$$ AbstractContainerScreen.renderSlotHighlight(
//#if MC > 11904
//$$ renderContext.getGuiComponent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,14 @@ private static void fixDoEasyPlaceAction0(Minecraft mc, CallbackInfoReturnable<I
}
}

mc.player.connection.send(new ServerboundMovePlayerPacket.Rot(playerCompat.getYRot(), playerCompat.getXRot(), playerCompat.isOnGround()));
mc.player.connection.send(new ServerboundMovePlayerPacket.Rot(
playerCompat.getYRot(),
playerCompat.getXRot(),
playerCompat.isOnGround()
//#if MC > 12101
//$$ , false
//#endif
));
}

if (stateSchematic.getBlock() instanceof FenceGateBlock && stateSchematic.getValue(BlockStateProperties.OPEN)) {
Expand Down Expand Up @@ -264,7 +271,14 @@ private static void fixDoEasyPlaceAction1(Minecraft mc, CallbackInfoReturnable<I
if (MixinWorldUtils.masa_gadget_mod$easyPlaceActionOldYaw.get() != null) {
PlayerCompat playerCompat = PlayerCompat.of(Objects.requireNonNull(mc.player));
playerCompat.setYRot(masa_gadget_mod$easyPlaceActionOldYaw.get());
mc.player.connection.send(new ServerboundMovePlayerPacket.Rot(playerCompat.getYRot(), playerCompat.getXRot(), playerCompat.isOnGround()));
mc.player.connection.send(new ServerboundMovePlayerPacket.Rot(
playerCompat.getYRot(),
playerCompat.getXRot(),
playerCompat.isOnGround()
//#if MC > 12101
//$$ , false
//#endif
));
}
}
}
12 changes: 12 additions & 0 deletions versions/1.21.3-fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Dependency Versions
dependencies.minecraft_dependency=>=1.21.2- <1.21.4-
dependencies.minecraft_version=1.21.3

# Compatible Libraries
dependencies.api.itemscroller_version=1.21.3-0.25.0-sakura.2
dependencies.api.litematica_version=1.21.3-0.20.0-sakura.2
dependencies.api.minihud_version=1.21.3-0.33.0-sakura.2
dependencies.api.tweakeroo_version=b105ff1

# Publish properties
publish.game_version=1.21.2\n1.21.3

0 comments on commit a8f4798

Please sign in to comment.