Skip to content

Commit

Permalink
1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatGravyBoat committed Jun 14, 2024
1 parent 30fe26e commit 2eccbdf
Show file tree
Hide file tree
Showing 56 changed files with 90 additions and 1,302 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,6 @@ jobs:
release_version: ${{ steps.version.outputs.version }}
github_token: ${{ secrets.TEAM_RESOURCEFUL_BOT }}

# ### Need to duplicate this block for fabric
# - name: Upload Forge Releases (Curse/Modrinth/Github)
# if: contains(steps.props.outputs.enabled_platforms, 'forge')
# uses: Kir-Antipov/mc-publish@v3.3
# with:
# curseforge-id: ${{ vars.CURSE_ID }}
# curseforge-token: ${{ secrets.CURSE_API_KEY }}
#
# modrinth-id: ${{ vars.MODRINTH_ID }}
# modrinth-token: ${{ secrets.MODRINTH_API_KEY }}
#
# github-tag: "v${{ steps.version.outputs.version }}"
# github-token: ${{ secrets.TEAM_RESOURCEFUL_BOT }}
#
# files: ./forge/build/libs/!(*-@(dev|sources|dev-shadow)).jar
# name: "[Forge] Resourceful Lib ${{ steps.version.outputs.version }}"
# version: ${{ steps.version.outputs.version }}
# changelog-file: changelog.md
# loaders: forge
# game-versions: ${{ steps.props.outputs.mc_version }}
# version-resolver: exact

- name: Upload NeoForge Releases (Curse/Modrinth/Github)
id: forge_release
if: contains(steps.props.outputs.enabled_platforms, 'neoforge')
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ resourcefulGradle {
"neoforge_version": neoforge_version,
"fabric_version": fabric_loader_version,
"fabric_link": fabricLink,
"forge_link": forgeLink
"neoforge_link": forgeLink
]

def template = nightly.toBoolean() ? "nightly_embed.json.template" : "release_embed.json.template"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ default void renderOverlay(Minecraft minecraft, PoseStack stack) {
BlockPos blockpos = BlockPos.containing(player.getX(), player.getEyeY(), player.getZ());
float brightness = LightTexture.getBrightness(player.level().dimensionType(), player.level().getMaxLocalRawBrightness(blockpos));

BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder();
BufferBuilder bufferbuilder = Tesselator.getInstance().begin(
VertexFormat.Mode.QUADS,
DefaultVertexFormat.POSITION_TEX
);
RenderSystem.enableBlend();
RenderSystem.setShaderColor(brightness, brightness, brightness, 0.1F);
float f7 = -player.getYRot() / 64.0F;
float f8 = player.getXRot() / 64.0F;
Matrix4f matrix4f = stack.last().pose();
bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX);
bufferbuilder.vertex(matrix4f, -1.0F, -1.0F, -0.5F).uv(4.0F + f7, 4.0F + f8).endVertex();
bufferbuilder.vertex(matrix4f, 1.0F, -1.0F, -0.5F).uv(0.0F + f7, 4.0F + f8).endVertex();
bufferbuilder.vertex(matrix4f, 1.0F, 1.0F, -0.5F).uv(0.0F + f7, 0.0F + f8).endVertex();
bufferbuilder.vertex(matrix4f, -1.0F, 1.0F, -0.5F).uv(4.0F + f7, 0.0F + f8).endVertex();
BufferUploader.drawWithShader(bufferbuilder.end());
bufferbuilder.addVertex(matrix4f, -1.0F, -1.0F, -0.5F).setUv(4.0F + f7, 4.0F + f8);
bufferbuilder.addVertex(matrix4f, 1.0F, -1.0F, -0.5F).setUv(0.0F + f7, 4.0F + f8);
bufferbuilder.addVertex(matrix4f, 1.0F, 1.0F, -0.5F).setUv(0.0F + f7, 0.0F + f8);
bufferbuilder.addVertex(matrix4f, -1.0F, 1.0F, -0.5F).setUv(4.0F + f7, 0.0F + f8);
BufferUploader.drawWithShader(bufferbuilder.buildOrThrow());
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public RegistryEntry<ClientFluidProperties> register(String id, ClientFluidPrope

@Override
public <I extends ClientFluidProperties> RegistryEntry<I> register(String id, Supplier<I> supplier) {
REGISTRY.put(new ResourceLocation(this.modid, id), supplier.get());
return entries.add(new Entry<>(new ResourceLocation(this.modid, id), supplier.get()));
REGISTRY.put(ResourceLocation.fromNamespaceAndPath(this.modid, id), supplier.get());
return entries.add(new Entry<>(ResourceLocation.fromNamespaceAndPath(this.modid, id), supplier.get()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,56 +11,60 @@

public record HighlightLine(Vector3f start, Vector3f end, Vector3f normal) {

public static final Codec<HighlightLine> CODEC = Codec.FLOAT.listOf().comapFlatMap((floats) -> Util.fixedSize(floats, 6).map(HighlightLine::new), HighlightLine::getAsList);
public static final Codec<HighlightLine> CODEC = Codec.FLOAT.listOf().comapFlatMap((floats) -> Util.fixedSize(floats, 6).map(HighlightLine::new), HighlightLine::getAsList);

public HighlightLine(Vector3f start, Vector3f end) {
this(start, end, normal(start, end));
}
public HighlightLine(Vector3f start, Vector3f end) {
this(start, end, normal(start, end));
}

public HighlightLine(List<Float> list) {
this(new Vector3f(list.get(0), list.get(1), list.get(2)), new Vector3f(list.get(3), list.get(4), list.get(5)));
}
public HighlightLine(List<Float> list) {
this(new Vector3f(list.get(0), list.get(1), list.get(2)), new Vector3f(list.get(3), list.get(4), list.get(5)));
}

public List<Float> getAsList() {
return List.of(start.x(), start.y(), start.z(), end.x(), end.y(), end.z());
}
public List<Float> getAsList() {
return List.of(start.x(), start.y(), start.z(), end.x(), end.y(), end.z());
}

public HighlightLine copy() {
return new HighlightLine(new Vector3f(start), new Vector3f(end));
}
public HighlightLine copy() {
return new HighlightLine(new Vector3f(start), new Vector3f(end));
}

public void recalculateNormal() {
Vector3f normal = normal(start, end);
this.normal.set(normal.x(), normal.y(), normal.z());
}
public void recalculateNormal() {
Vector3f normal = normal(start, end);
this.normal.set(normal.x(), normal.y(), normal.z());
}

public void render(PoseStack poseStack, VertexConsumer consumer, float x, float y, float z) {
render(
poseStack, consumer,
0f, 0f, 0f, 0.4f,
x, y, z,
start.x(), start.y(), start.z(),
end.x(), end.y(), end.z(),
normal.x(), normal.y(), normal.z()
);
}
public void render(PoseStack poseStack, VertexConsumer consumer, float x, float y, float z) {
render(
poseStack, consumer,
0f, 0f, 0f, 0.4f,
x, y, z,
start.x(), start.y(), start.z(),
end.x(), end.y(), end.z(),
normal.x(), normal.y(), normal.z()
);
}

public static void render(
public static void render(
PoseStack stack, VertexConsumer consumer,
float r, float g, float b, float a,
float x, float y, float z,
float x1, float y1, float z1,
float x2, float y2, float z2,
float normalX, float normalY, float normalZ
) {
PoseStack.Pose last = stack.last();
consumer.vertex(last.pose(), x + x1, y + y1, z + z1).color(r, g, b, a).normal(last, normalX, normalY, normalZ).endVertex();
consumer.vertex(last.pose(), x + x2, y + y2, z + z2).color(r, g, b, a).normal(last, normalX, normalY, normalZ).endVertex();
}
) {
PoseStack.Pose last = stack.last();
consumer.addVertex(last.pose(), x + x1, y + y1, z + z1)
.setColor(r, g, b, a)
.setNormal(last, normalX, normalY, normalZ);
consumer.addVertex(last.pose(), x + x2, y + y2, z + z2)
.setColor(r, g, b, a)
.setNormal(last, normalX, normalY, normalZ);
}

private static Vector3f normal(Vector3f start, Vector3f end) {
Vector3f diff = new Vector3f(start.x() - end.x(), start.y() - end.y(), start.z() - end.z());
float sqrt = Mth.sqrt(diff.x() * diff.x() + diff.y() * diff.y() + diff.z() * diff.z());
return new Vector3f(diff.x() / sqrt, diff.y() / sqrt, diff.z() / sqrt);
}
}
private static Vector3f normal(Vector3f start, Vector3f end) {
Vector3f diff = new Vector3f(start.x() - end.x(), start.y() - end.y(), start.z() - end.z());
float sqrt = Mth.sqrt(diff.x() * diff.x() + diff.y() * diff.y() + diff.z() * diff.z());
return new Vector3f(diff.x() / sqrt, diff.y() / sqrt, diff.z() / sqrt);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraft.client.gui.components.EditBox;
import net.minecraft.client.gui.components.MultiLineEditBox;
import net.minecraft.client.gui.components.events.GuiEventListener;
import org.jetbrains.annotations.ApiStatus;

import java.util.List;

Expand All @@ -15,21 +14,12 @@ public interface CursorScreen {


default void setCursor(List<? extends GuiEventListener> listeners, double mouseX, double mouseY) {
setCursor(listeners);
for (GuiEventListener child : listeners) {
boolean hovered = child.isMouseOver(mouseX, mouseY);
if (child instanceof CursorWidget widget && child.isMouseOver(mouseX, mouseY) && widget.getCursor() != Cursor.DEFAULT) {
setCursor(widget.getCursor());
break;
}
}
}

@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "21.0")
default void setCursor(List<? extends GuiEventListener> listeners) {
for (GuiEventListener child : listeners) {
if (child instanceof CursorWidget) continue;
if (child instanceof AbstractWidget widget && widget.isHovered() && widget.visible) {
} else if (child instanceof AbstractWidget widget && hovered && widget.visible) {
if (widget.active) {
setCursor(widget instanceof EditBox || widget instanceof MultiLineEditBox ? Cursor.TEXT : Cursor.POINTER);
} else {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import com.teamresourceful.resourcefullib.client.scissor.ClosingScissorBox;
import com.teamresourceful.resourcefullib.client.scissor.ScissorBoxStack;
import com.teamresourceful.resourcefullib.common.exceptions.UtilityClassException;
import com.teamresourceful.resourcefullib.common.utils.types.Bound;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.renderer.Rect2i;
import org.jetbrains.annotations.ApiStatus;
import org.joml.Matrix4f;
import org.joml.Vector2i;
import org.joml.Vector2ic;
Expand All @@ -21,20 +19,6 @@ private RenderUtils() throws UtilityClassException {
throw new UtilityClassException();
}

/**
* Get the current bounds for a GL scissor.
* @deprecated Use {@link #getScissorRect(Minecraft, PoseStack, int, int, int, int)} instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "21.0")
public static Bound getScissorBounds(Minecraft minecraft, PoseStack stack, int x, int y, int width, int height) {
float guiScale = (float) minecraft.getWindow().getGuiScale();
Vector2ic translation = getTranslation(stack);
float translationX = translation.x() * guiScale;
float translationY = translation.y() * guiScale;
return new Bound((int) (translationX + x * guiScale), (int) (Minecraft.getInstance().getWindow().getHeight() - y * guiScale - translationY - height * guiScale), (int) (width * guiScale), (int) (height * guiScale));
}

/**
* Get the current bounds for a GL scissor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private ExtraByteCodecs() throws UtilityClassException {
throw new UtilityClassException();
}

public static final ByteCodec<ResourceLocation> RESOURCE_LOCATION = ByteCodec.STRING.map(ResourceLocation::new, ResourceLocation::toString);
public static final ByteCodec<ResourceLocation> RESOURCE_LOCATION = ByteCodec.STRING.map(ResourceLocation::parse, ResourceLocation::toString);
public static final ByteCodec<ResourceKey<Level>> DIMENSION = resourceKey(Registries.DIMENSION);

public static final ByteCodec<BlockPos> BLOCK_POS = ByteCodec.LONG.map(BlockPos::of, BlockPos::asLong);
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2eccbdf

Please sign in to comment.