Skip to content

Commit

Permalink
Merge branch '1.20.1' into 1.19.4
Browse files Browse the repository at this point in the history
# Conflicts:
#	fabric/build.gradle.kts
#	fabric/src/main/java/xaeroplus/fabric/mixin/client/MixinSodium6OptionsGUI.java
#	forge/src/main/java/xaeroplus/forge/XaeroPlusEmbeddiumOptionsInit.java
#	forge/src/main/java/xaeroplus/forge/mixin/client/MixinSodium6OptionsGUI.java
  • Loading branch information
rfresh2 committed Sep 11, 2024
2 parents 6f2d011 + 2dcd519 commit ab34203
Show file tree
Hide file tree
Showing 24 changed files with 146 additions and 95 deletions.
16 changes: 16 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Auto detect text files and perform LF normalization
*.java text=auto eol=lf
*.xml text=auto eol=lf
*.json text=auto eol=lf
*.md text=auto eol=lf
*.yml text=auto eol=lf
*.template text=auto eol=lf
*.txt text=auto eol=lf
*.bat text=auto eol=lf
*.gradle text=auto eol=lf
*.sh text=auto eol=lf
*.html text=auto eol=lf
*.settings text=auto eol=lf
Jenkinsfile text=auto eol=lf
gradlew test=auto eol=lf
*.py text=auto eol=lf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package xaeroplus.event;

public record ClientPlaySessionFinalizedEvent() {
public static ClientPlaySessionFinalizedEvent INSTANCE = new ClientPlaySessionFinalizedEvent();
public static final ClientPlaySessionFinalizedEvent INSTANCE = new ClientPlaySessionFinalizedEvent();
}
4 changes: 2 additions & 2 deletions common/src/main/java/xaeroplus/event/ClientTickEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

public class ClientTickEvent {
public static class Pre extends ClientTickEvent {
public static Pre INSTANCE = new Pre();
public static final Pre INSTANCE = new Pre();
}

public static class Post extends ClientTickEvent {
public static Post INSTANCE = new Post();
public static final Post INSTANCE = new Post();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public synchronized void drawMinimapFeatures(
final VertexConsumer overlayBufferBuilder,
MinimapRendererHelper helper
) {
var matrix = matrixStack.last().pose();
for (int i = 0; i < sortedKeySet.size(); i++) {
var k = sortedKeySet.get(i);
var feature = chunkHighlightDrawFeatures.get(k);
Expand Down Expand Up @@ -97,7 +98,7 @@ public synchronized void drawMinimapFeatures(
var left = drawX + 16 * (chunkPosX - cx * 4);
var top = drawZ + 16 * (chunkPosZ - cz * 4);
helper.addColoredRectToExistingBuffer(
matrixStack.last().pose(), overlayBufferBuilder,
matrix, overlayBufferBuilder,
left, top, 16, 16,
r, g, b, a
);
Expand All @@ -115,6 +116,7 @@ public synchronized void drawWorldMapFeatures(
final PoseStack matrixStack,
final VertexConsumer overlayBuffer
) {
var matrix = matrixStack.last().pose();
for (int i = 0; i < sortedKeySet.size(); i++) {
var k = sortedKeySet.get(i);
var feature = chunkHighlightDrawFeatures.get(k);
Expand All @@ -138,7 +140,7 @@ public synchronized void drawWorldMapFeatures(
final float right = left + 16;
final float bottom = top + 16;
MinimapBackgroundDrawHelper.fillIntoExistingBuffer(
matrixStack.last().pose(), overlayBuffer,
matrix, overlayBuffer,
left, top, right, bottom,
r, g, b, a
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.gui.GuiComponent;
import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
Expand All @@ -23,7 +24,8 @@

@Mixin(targets = "xaero.common.gui.GuiWaypoints$List", remap = false)
public abstract class MixinGuiWaypointsList {
private GuiWaypoints thisGuiWaypoints;
@Unique private final WaypointSet waypointsSortedSet = WaypointSet.Builder.begin().setName("xp-wp-sorted").build();
@Unique private GuiWaypoints thisGuiWaypoints;

@Inject(method = "<init>", at = @At("RETURN"))
public void init(final GuiWaypoints this$0, final CallbackInfo ci) throws NoSuchFieldException, IllegalAccessException {
Expand All @@ -49,11 +51,10 @@ public void getWaypointCount(final CallbackInfoReturnable<Integer> cir) {
target = "Lxaero/hud/minimap/world/MinimapWorld;getCurrentWaypointSet()Lxaero/hud/minimap/waypoint/set/WaypointSet;"
))
public WaypointSet getWaypointList(final MinimapWorld instance) {
// todo: could be optimized to reduce unnecessary list allocs
WaypointSet currentWaypointSet = instance.getCurrentWaypointSet();
var wpSet = WaypointSet.Builder.begin().setName(currentWaypointSet.getName()).build();
wpSet.addAll(((AccessorGuiWaypoints) thisGuiWaypoints).getWaypointsSorted());
return wpSet;
// reusing waypoint set to avoid allocating an arraylist every call to this method
waypointsSortedSet.clear();
waypointsSortedSet.addAll(((AccessorGuiWaypoints) thisGuiWaypoints).getWaypointsSorted());
return waypointsSortedSet;
}

@Inject(method = "drawWaypointSlot", at = @At(
Expand Down
21 changes: 10 additions & 11 deletions common/src/main/java/xaeroplus/module/impl/LiquidNewChunks.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import it.unimi.dsi.fastutil.objects.ReferenceSet;
import net.lenni0451.lambdaevents.EventHandler;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
Expand All @@ -24,11 +25,9 @@
import xaeroplus.util.ChunkScanner;
import xaeroplus.util.ChunkUtils;
import xaeroplus.util.ColorHelper;
import xaeroplus.util.MutableBlockPos;

import java.time.Duration;

import static java.util.Arrays.asList;
import static xaeroplus.util.ChunkUtils.getActualDimension;
import static xaeroplus.util.ColorHelper.getColor;

Expand All @@ -46,14 +45,11 @@ public class LiquidNewChunks extends Module {
private int newChunksColor = getColor(255, 0, 0, 100);
private int inverseColor = getColor(0, 255, 0, 100);
private static final Direction[] searchDirs = new Direction[] { Direction.EAST, Direction.NORTH, Direction.WEST, Direction.SOUTH, Direction.UP };
private static final ReferenceSet<Block> liquidBlockTypeFilter = new ReferenceOpenHashSet<>(2);
private static final ReferenceSet<Block> liquidBlockTypeFilter = ReferenceOpenHashSet.of(
Blocks.WATER,
Blocks.LAVA
);
private static final String inverseDrawFeatureId = "LiquidNewChunksInverse";
static {
liquidBlockTypeFilter.addAll(asList(
Blocks.WATER,
Blocks.LAVA
));
}

public void setDiskCache(boolean disk) {
newChunksCache.setDiskCache(disk, isEnabled());
Expand Down Expand Up @@ -84,11 +80,12 @@ private void handleBlockUpdate(Level level, BlockPos pos, BlockState state) {
if (newChunksCache.get().isHighlighted(chunkX, chunkZ, getActualDimension())) return;
final int srcX = pos.getX();
final int srcY = pos.getY();
if (XaeroPlusSettingRegistry.liquidNewChunksOnlyAboveY0Setting.getValue() && srcY <= 0) return;
final int srcZ = pos.getZ();
MutableBlockPos bp = new MutableBlockPos(srcX, srcY, srcZ);
for (int i = 0; i < searchDirs.length; i++) {
final Direction dir = searchDirs[i];
bp.setPos(srcX + dir.getStepX(), srcY + dir.getStepY(), srcZ + dir.getStepZ());
bp.set(srcX + dir.getStepX(), srcY + dir.getStepY(), srcZ + dir.getStepZ());
if (level.getBlockState(bp).getFluidState().isSource()) {
newChunksCache.get().addHighlight(chunkX, chunkZ);
return;
Expand Down Expand Up @@ -137,7 +134,9 @@ public void onChunkData(final ChunkDataEvent event) {
}
}
return false;
}, level.getMinBuildHeight());
}, XaeroPlusSettingRegistry.liquidNewChunksOnlyAboveY0Setting.getValue()
? Math.max(1, level.getMinBuildHeight())
: level.getMinBuildHeight());
}

@EventHandler
Expand Down
102 changes: 57 additions & 45 deletions common/src/main/java/xaeroplus/settings/XaeroPlusSettingRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,51 +237,6 @@ public String getTranslationKey() {
false,
(b) -> ModuleManager.getModule(PaletteNewChunks.class).setInverse(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting liquidNewChunksEnabledSetting = XaeroPlusBooleanSetting.create(
"NewChunks Highlighting",
"setting.world_map.new_chunks_highlighting",
"setting.world_map.new_chunks_highlighting.tooltip",
false,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setEnabled(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting liquidNewChunksSaveLoadToDisk = XaeroPlusBooleanSetting.create(
"Save/Load NewChunks to Disk",
"setting.world_map.new_chunks_save_load_to_disk",
"setting.world_map.new_chunks_save_load_to_disk.tooltip",
true,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setDiskCache(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusFloatSetting liquidNewChunksAlphaSetting = XaeroPlusFloatSetting.create(
"New Chunks Opacity",
"setting.world_map.new_chunks_opacity",
"setting.world_map.new_chunks_opacity.tooltip",
0f, 255f, 10f,
100,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setAlpha(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusEnumSetting<ColorHelper.HighlightColor> liquidNewChunksColorSetting = XaeroPlusEnumSetting.create(
"New Chunks Color",
"setting.world_map.new_chunks_color",
"setting.world_map.new_chunks_color.tooltip",
ColorHelper.HighlightColor.values(),
ColorHelper.HighlightColor.RED,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setRgbColor(b.getColor()),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting liquidNewChunksInverseHighlightsSetting = XaeroPlusBooleanSetting.create(
"New Chunks Render Inverse",
"setting.world_map.new_chunks_inverse_enabled",
"setting.world_map.new_chunks_inverse_enabled.tooltip",
false,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setInverseRenderEnabled(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusEnumSetting<ColorHelper.HighlightColor> liquidNewChunksInverseColorSetting = XaeroPlusEnumSetting.create(
"New Chunks Inverse Color",
"setting.world_map.new_chunks_inverse_color",
"setting.world_map.new_chunks_inverse_color.tooltip",
ColorHelper.HighlightColor.values(),
ColorHelper.HighlightColor.GREEN,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setInverseRgbColor(b.getColor()),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting oldChunksEnabledSetting = XaeroPlusBooleanSetting.create(
"OldChunks Highlighting",
"setting.world_map.old_chunks_highlighting",
Expand Down Expand Up @@ -349,6 +304,57 @@ public String getTranslationKey() {
ColorHelper.HighlightColor.MAGENTA,
(b) -> ModuleManager.getModule(Portals.class).setRgbColor(b.getColor()),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting liquidNewChunksEnabledSetting = XaeroPlusBooleanSetting.create(
"NewChunks Highlighting",
"setting.world_map.new_chunks_highlighting",
"setting.world_map.new_chunks_highlighting.tooltip",
false,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setEnabled(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting liquidNewChunksSaveLoadToDisk = XaeroPlusBooleanSetting.create(
"Save/Load NewChunks to Disk",
"setting.world_map.new_chunks_save_load_to_disk",
"setting.world_map.new_chunks_save_load_to_disk.tooltip",
true,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setDiskCache(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusFloatSetting liquidNewChunksAlphaSetting = XaeroPlusFloatSetting.create(
"New Chunks Opacity",
"setting.world_map.new_chunks_opacity",
"setting.world_map.new_chunks_opacity.tooltip",
0f, 255f, 10f,
100,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setAlpha(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusEnumSetting<ColorHelper.HighlightColor> liquidNewChunksColorSetting = XaeroPlusEnumSetting.create(
"New Chunks Color",
"setting.world_map.new_chunks_color",
"setting.world_map.new_chunks_color.tooltip",
ColorHelper.HighlightColor.values(),
ColorHelper.HighlightColor.RED,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setRgbColor(b.getColor()),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting liquidNewChunksInverseHighlightsSetting = XaeroPlusBooleanSetting.create(
"New Chunks Render Inverse",
"setting.world_map.new_chunks_inverse_enabled",
"setting.world_map.new_chunks_inverse_enabled.tooltip",
false,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setInverseRenderEnabled(b),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusEnumSetting<ColorHelper.HighlightColor> liquidNewChunksInverseColorSetting = XaeroPlusEnumSetting.create(
"New Chunks Inverse Color",
"setting.world_map.new_chunks_inverse_color",
"setting.world_map.new_chunks_inverse_color.tooltip",
ColorHelper.HighlightColor.values(),
ColorHelper.HighlightColor.GREEN,
(b) -> ModuleManager.getModule(LiquidNewChunks.class).setInverseRgbColor(b.getColor()),
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting liquidNewChunksOnlyAboveY0Setting = XaeroPlusBooleanSetting.create(
"Liquid NewChunks Only Y > 0",
"setting.world_map.new_chunks_only_above_y0",
"setting.world_map.new_chunks_only_above_y0.tooltip",
false,
SettingLocation.CHUNK_HIGHLIGHTS);
public static final XaeroPlusBooleanSetting worldToolsEnabledSetting = XaeroPlusBooleanSetting.create(
"WorldTools Highlights",
"setting.world_map.world_tools",
Expand Down Expand Up @@ -649,4 +655,10 @@ public String getTranslationKey() {
"setting.world_map.expanded_settings.tooltip",
false,
SettingLocation.WORLD_MAP_MAIN);
public static final XaeroPlusBooleanSetting sodiumSettingIntegration = XaeroPlusBooleanSetting.create(
"Sodium/Embeddium Setting Integration",
"setting.xaeroplus.sodium_embeddium_integration",
"setting.xaeroplus.sodium_embeddium_integration.tooltip",
true,
SettingLocation.WORLD_MAP_MAIN);
}
27 changes: 0 additions & 27 deletions common/src/main/java/xaeroplus/util/MutableBlockPos.java

This file was deleted.

4 changes: 4 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
"setting.world_map.new_chunks_inverse_enabled.tooltip": "Highlights chunks that have already been loaded by checking if any flowing liquid is present.\n\nKeep in mind there will be false positives. Multiple biomes and structures like bastions and basalt deltas can generate with flowing liquid.",
"setting.world_map.new_chunks_inverse_color": "Liquid NewChunks Inverse Color",
"setting.world_map.new_chunks_inverse_color.tooltip": "Changes the color of Liquid NewChunks inverse highlights",
"setting.world_map.new_chunks_only_above_y0": "Liquid NewChunks Only Y > 0",
"setting.world_map.new_chunks_only_above_y0.tooltip": "Limits Liquid NewChunks search to Y levels greater than 0",
"setting.world_map.old_chunks_highlighting": "OldChunks",
"setting.world_map.old_chunks_highlighting.tooltip": "Highlights OldChunks on the Minimap and WorldMap. An OldChunk is a chunk that was generated in 1.12.2 or lower based on the blocks present in the chunk. Intended for use on 2b2t.",
"setting.world_map.old_chunks_inverse": "OldChunks Inverse",
Expand Down Expand Up @@ -168,6 +170,8 @@
"setting.world_map.disable_internet.tooltip": "Disables WorldMap and Minimap mods from using the internet to check for updates and patreon subscriptions at launch.\n Xaero mods do not expose this setting in the GUI normally.\n XaeroPlus does not use the internet regardless of this setting.",
"setting.world_map.expanded_settings": "Expanded Settings",
"setting.world_map.expanded_settings.tooltip": "Increases the number of settings shown per page on larger screens",
"setting.xaeroplus.sodium_embeddium_integration": "Sodium/Embeddium Settings Integration",
"setting.xaeroplus.sodium_embeddium_integration.tooltip": "Enables the XaeroPlus settings page in Sodium/Embeddium",
"gui.world_map.toggle_follow_mode": "Toggle Follow Mode",
"gui.xaeroplus.on": "On",
"gui.xaeroplus.off": "Off",
Expand Down
4 changes: 4 additions & 0 deletions common/src/main/resources/assets/xaeroplus/lang/es_ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
"setting.world_map.palette_new_chunks_color.tooltip": "Establece el color de los destacados de Paleta NewChunks",
"setting.world_map.palette_new_chunks_inverse": "Paleta NuevosChuncks Inversa",
"setting.world_map.palette_new_chunks_inverse.tooltip": "Renderiza la inversa de Paleta NuevosChuncks, lo que significa que los fragmentos que cargues ya se habían generado",
"setting.world_map.new_chunks_only_above_y0": "NuevosFragmentos Líquidos Y>0",
"setting.world_map.new_chunks_only_above_y0.tooltip": "Limita la búsqueda de NuevosFragmentos Líquidos a niveles Y superiores a 0",
"setting.world_map.new_chunks_highlighting": "Líquido NewChunks",
"setting.world_map.new_chunks_highlighting.tooltip": "Detecta NewChunks basado en los estados de flujo de líquido en chunks. No funciona en chunks sin flujo de líquido o en el End",
"setting.world_map.new_chunks_save_load_to_disk": "Guardar/Cargar Líquido NewChunks en Disco",
Expand Down Expand Up @@ -168,6 +170,8 @@
"setting.world_map.disable_internet.tooltip": "Desactiva el uso de Internet de las modificaciones de WorldMap y Minimap para buscar actualizaciones y suscripciones a Patreon en el momento del lanzamiento.\n Los mods de Xaero normalmente no exponen esta configuración en la GUI.\n XaeroPlus no utiliza Internet independientemente de esta configuración.",
"setting.world_map.expanded_settings": "Configuración ampliada",
"setting.world_map.expanded_settings.tooltip": "Aumenta la cantidad de configuraciones que se muestran por página en pantallas más grandes",
"setting.xaeroplus.sodium_embeddium_integration": "Integración de Configuración de Sodium/Embeddium",
"setting.xaeroplus.sodium_embeddium_integration.tooltip": "Habilita la página de configuración de XaeroPlus en Sodium/Embeddium",
"gui.world_map.toggle_follow_mode": "Alternar Modo Seguimiento",
"gui.xaeroplus.on": "Encendido",
"gui.xaeroplus.off": "Apagado",
Expand Down
Loading

0 comments on commit ab34203

Please sign in to comment.