Skip to content

Commit

Permalink
Various fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: 秋雨落 <[email protected]>
  • Loading branch information
qyl27 committed Oct 26, 2024
1 parent b245abf commit 8e2614e
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ parchment_version=2024.07.28
fabric_version=0.106.1+1.21.3

# Mod Properties
mod_version=1.6.4
mod_version=1.7.0
maven_group=net.kyrptonaught
archives_base_name=diggusmaximus

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21.3 2024-10-26T11:59:22.1834771 Diggus Maximus Reborn/Language (zh_cn)
// 1.21.3 2024-10-26T13:12:21.3346544 Diggus Maximus Reborn/Language (zh_cn)
a47eabd72ece16008affcf519cb4fad68445442e assets\diggusmaximus\lang\zh_cn.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// 1.21.3 2024-10-26T11:59:22.1846003 Diggus Maximus Reborn/Language (en_us)
// 1.21.3 2024-10-26T13:12:21.3346544 Diggus Maximus Reborn/Language (en_us)
3a42786b84d8dd234f362d52f0e8f8526b19f18a assets\diggusmaximus\lang\en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public void onInitializeClient() {
selected %= shapesCount;
}
config.shapes.selectedShape = ExcavateTypes.Shape.values()[selected];
ConfigHelper.save();
Minecraft.getInstance().player.displayClientMessage(Component.translatable("diggusmaximus.shape." + ExcavateTypes.Shape.values()[selected].toString().toLowerCase(Locale.ROOT)), true);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void registerConfig() {

private static ConfigHolder<ModConfig> holder;

public static ModConfig getConfig() {
private static ConfigHolder<ModConfig> getHolder() {
if (holder == null) {
holder = AutoConfig.getConfigHolder(ModConfig.class);
holder.registerSaveListener((holder, config) -> {
Expand All @@ -41,7 +41,15 @@ public static ModConfig getConfig() {
return InteractionResult.SUCCESS;
});
}
return holder.get();
return holder;
}

public static ModConfig getConfig() {
return getHolder().get();
}

public static void save() {
getHolder().save();
}

public static Either<ResourceKey<Block>, TagKey<Block>> parseBlockOrTag(String s) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class Options implements ConfigData {
@Comment("Other items to be considered tools ie: \"minecraft:stick\"")
public List<String> tools = new ArrayList<>();

@ConfigEntry.Gui.Excluded
public final Set<Either<ResourceKey<Item>, TagKey<Item>>> customTools = new HashSet<>();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,20 @@ public abstract class MixinClientPlayerInteractionManager {
@Inject(method = "destroyBlock", at = @At(value = "HEAD"))
private void beforeDestroyBlock(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
var config = ConfigHelper.getConfig();
if (config.config.enabled) {
var pressed = config.config.invertActivation;
while (DiggusMaximusClientMod.EXCAVATE.consumeClick()) {
pressed = !config.config.invertActivation;
}
if (!config.config.enabled) {
return;
}

{
var pressed = config.config.invertActivation ^ DiggusMaximusClientMod.EXCAVATE.isDown();
if (pressed) {
diggus$activate(pos, null, -1);
return;
}
return;
}

if (config.shapes.enableShapes) {
var pressed = config.config.invertActivation;
while (DiggusMaximusClientMod.SHAPED.consumeClick()) {
pressed = !config.config.invertActivation;
}
var pressed = config.config.invertActivation ^ DiggusMaximusClientMod.SHAPED.isDown();
if (pressed) {
Direction facing = null;
HitResult result = minecraft.player.pick(10, 0, false);
Expand Down

0 comments on commit 8e2614e

Please sign in to comment.