Skip to content

Commit

Permalink
Fix 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Jun 24, 2020
1 parent b842efc commit 705e80d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.16-rc1
yarn_mappings=1.16-rc1+build.12
minecraft_version=1.16.1
yarn_mappings=1.16.1+build.4
loader_version=0.8.8+build.202

# Mod Properties
mod_version = 1.2.0
mod_version = 1.3.0
maven_group = net.guavy
archives_base_name = gravestones

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.13.1+build.370-1.16
cloth_config_version=2.14.2
auto_config_version=2.0
cloth_config_version=4.5.6
auto_config_version=3.2.0-unstable
mod_menu_version=1.12.1+build.15
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
import net.guavy.gravestones.config.GravestonesConfig;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.Registry;

Expand All @@ -30,7 +33,7 @@ public void onInitializeClient() {

guiRegistry.registerAnnotationProvider((s, field, config, defaults, guiRegistryAccess) -> {
GravestonesConfig.UsePercentage bounds = field.getAnnotation(GravestonesConfig.UsePercentage.class);
return Collections.singletonList(ConfigEntryBuilder.create().startIntSlider(s, MathHelper.ceil(Utils.getUnsafely(field, config, 0.0) * 100), MathHelper.ceil(bounds.min() * 100), MathHelper.ceil(bounds.max() * 100)).setDefaultValue(() -> MathHelper.ceil((double) Utils.getUnsafely(field, defaults) * 100)).setSaveConsumer((newValue) -> Utils.setUnsafely(field, config, newValue / 100d)).setTextGetter(integer -> String.format("%d%%", integer)).build());
return Collections.singletonList(ConfigEntryBuilder.create().startIntSlider(new TranslatableText(s), MathHelper.ceil(Utils.getUnsafely(field, config, 0.0) * 100), MathHelper.ceil(bounds.min() * 100), MathHelper.ceil(bounds.max() * 100)).setDefaultValue(() -> MathHelper.ceil((double) Utils.getUnsafely(field, defaults) * 100)).setSaveConsumer((newValue) -> Utils.setUnsafely(field, config, newValue / 100d)).setTextGetter(integer -> new LiteralText(String.format("%d%%", integer))).build());
}, field -> field.getType() == Double.TYPE || field.getType() == Double.class, GravestonesConfig.UsePercentage.class);
}
}

0 comments on commit 705e80d

Please sign in to comment.