Skip to content

Commit

Permalink
Merge pull request #326 from FTBTeam/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
desht authored Oct 30, 2024
2 parents 34a1493 + aca009c commit 4a97153
Show file tree
Hide file tree
Showing 130 changed files with 4,483 additions and 2,658 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Java CI - Build Release

on:
release:
types: [ published ]
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-[a-z]+'
- 'v[0-9]+\.[0-9]+\.[0-9]+-[a-z]+\.[0-9]+'

jobs:
build:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2101.1.2]

### Added
* Added many more entity face map icons and improved several existing ones
* Also added a config option in client config (Minimap section) to toggle individual entity types on & off
* New & improved waypoint addition screen

### Fixed
* Possible fix for occasional problem where some regions just don't render on the map or minimap
* Can't be sure, the problem is very hard to reproduce

## [2101.1.1]

### Added
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
}

apply from: 'https://raw.githubusercontent.com/FTBTeam/mods-meta/main/gradle/changelog.gradle'

architectury {
minecraft = rootProject.minecraft_version
}
Expand Down Expand Up @@ -93,7 +95,7 @@ allprojects {

publishMods {
dryRun = providers.environmentVariable("CURSEFORGE_KEY").getOrNull() == null
changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided")
changelog = createChangelog(project)
version = mod_version

// TODO: Migrate to something else
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package dev.ftb.mods.ftbchunks;

import com.mojang.logging.LogUtils;
import dev.ftb.mods.ftbchunks.client.gui.EntityIconSettingsScreen;
import dev.ftb.mods.ftblibrary.config.ConfigCallback;
import dev.ftb.mods.ftblibrary.config.ConfigGroup;
import dev.ftb.mods.ftblibrary.config.ConfigValue;
import dev.ftb.mods.ftblibrary.snbt.SNBTCompoundTag;
import dev.ftb.mods.ftblibrary.snbt.config.BaseValue;
import dev.ftb.mods.ftblibrary.snbt.config.SNBTConfig;
import dev.ftb.mods.ftblibrary.ui.Widget;
import dev.ftb.mods.ftblibrary.ui.input.MouseButton;
import net.minecraft.ResourceLocationException;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;

import java.util.HashMap;
import java.util.Map;

public class EntityTypeBoolMapValue extends BaseValue<Map<ResourceKey<EntityType<?>>, Boolean>> {

private static final Logger LOGGER = LogUtils.getLogger();

public EntityTypeBoolMapValue(@Nullable SNBTConfig c, String n, Map<ResourceKey<EntityType<?>>, Boolean> def) {
super(c, n, def);
super.set(new HashMap<>(def));
}

@Override
public void write(SNBTCompoundTag tag) {
Map<ResourceKey<EntityType<?>>, Boolean> map = get();
SNBTCompoundTag mapTag = new SNBTCompoundTag();

for (Map.Entry<ResourceKey<EntityType<?>>, Boolean> entry : map.entrySet()) {
mapTag.putBoolean(entry.getKey().location().toString(), entry.getValue());
}

tag.put(key, mapTag);
}

@Override
public void read(SNBTCompoundTag tag) {
Map<ResourceKey<EntityType<?>>, Boolean> map = new HashMap<>();

SNBTCompoundTag compound = tag.getCompound(key);
for (String key : compound.getAllKeys()) {
try {
ResourceLocation parse = ResourceLocation.parse(key);
map.put(ResourceKey.create(Registries.ENTITY_TYPE, parse), compound.getBoolean(key));
} catch (ResourceLocationException e) {
LOGGER.error("Failed to parse {} skipping", key, e);
}
}

set(map);
}

@Override
public void createClientConfig(ConfigGroup group) {
group.add(key, new EntityTypeBoolMapConfigValue(), get(), stringBooleanMap -> {
}, defaultValue);
}

public static class EntityTypeBoolMapConfigValue extends ConfigValue<Map<ResourceKey<EntityType<?>>, Boolean>> {

@Override
public void onClicked(Widget clickedWidget, MouseButton button, ConfigCallback callback) {
new EntityIconSettingsScreen(false).openGui();
}

@Override
public Component getStringForGUI(@Nullable Map<ResourceKey<EntityType<?>>, Boolean> v) {
if (v == null) {
return super.getStringForGUI(null);
}
int enabled = 0;
int disabled = 0;
for (ResourceKey<EntityType<?>> entityTypeResourceKey : v.keySet()) {
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(entityTypeResourceKey);
if (entityType != null) {
if (v.get(entityTypeResourceKey)) {
enabled++;
} else {
disabled++;
}
}
}
return Component.translatable("ftbchunks.gui.enabled_disabled_count", enabled, disabled);
}
}

}
Loading

0 comments on commit 4a97153

Please sign in to comment.