-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor to SkillCheck, add mod menu support
- Loading branch information
Showing
42 changed files
with
280 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 9 additions & 3 deletions
12
...ttonmc/skillworks/CharacterSheetItem.java → ...ttonmc/skillcheck/CharacterSheetItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
package io.github.cottonmc.skillworks; | ||
package io.github.cottonmc.skillcheck; | ||
|
||
import net.fabricmc.fabric.api.container.ContainerProviderRegistry; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.Rarity; | ||
import net.minecraft.util.TypedActionResult; | ||
import net.minecraft.world.World; | ||
|
||
public class CharacterSheetItem extends Item { | ||
|
||
public CharacterSheetItem() { | ||
super(new Item.Settings().itemGroup(Skillworks.SKILLWORKS_GROUP).stackSize(1)); | ||
super(new Item.Settings().itemGroup(SkillCheck.SKILLCHECK_GROUP).stackSize(1)); | ||
} | ||
|
||
@Override | ||
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) { | ||
if (world.isClient) return new TypedActionResult<>(ActionResult.PASS, player.getStackInHand(hand)); | ||
ContainerProviderRegistry.INSTANCE.openContainer(Skillworks.CHARACTER_SHEET_CONTAINER, player, buf -> buf.writeBlockPos(player.getBlockPos())); | ||
ContainerProviderRegistry.INSTANCE.openContainer(SkillCheck.CHARACTER_SHEET_CONTAINER, player, buf -> buf.writeBlockPos(player.getBlockPos())); | ||
return new TypedActionResult<>(ActionResult.SUCCESS, player.getStackInHand(hand)); | ||
} | ||
|
||
@Override | ||
public Rarity getRarity(ItemStack stack) { | ||
return Rarity.UNCOMMON; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/io/github/cottonmc/skillcheck/SkillCheckClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package io.github.cottonmc.skillcheck; | ||
|
||
import io.github.cottonmc.skillcheck.container.CharacterSheetScreen; | ||
import io.github.prospector.modmenu.api.ModMenuApi; | ||
import me.shedaniel.cloth.api.ConfigScreenBuilder; | ||
import me.shedaniel.cloth.gui.ClothConfigScreen; | ||
import me.shedaniel.cloth.gui.entries.BooleanListEntry; | ||
import me.shedaniel.cloth.gui.entries.IntegerSliderEntry; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.Screen; | ||
|
||
import java.util.function.Function; | ||
|
||
public class SkillCheckClient implements ClientModInitializer, ModMenuApi { | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
ScreenProviderRegistry.INSTANCE.registerFactory(SkillCheck.CHARACTER_SHEET_CONTAINER, (syncId, id, player, buf) -> new CharacterSheetScreen(syncId, player)); | ||
} | ||
|
||
@Override | ||
public String getModId() { | ||
return SkillCheck.MOD_ID; | ||
} | ||
|
||
@Override | ||
public Function<Screen, ? extends Screen> getConfigScreenFactory() { | ||
return (prevScreen) -> { | ||
ClothConfigScreen.Builder builder = new ClothConfigScreen.Builder(MinecraftClient.getInstance().currentScreen, "SkillCheck Config", null); | ||
builder.addCategories("General Settings", "Dice Roll Requirements"); | ||
ConfigScreenBuilder.CategoryBuilder gameplay = builder.getCategory("General Settings"); | ||
gameplay.addOption(new BooleanListEntry("Disable class requirements", SkillCheck.config.disableClasses, "text.cloth-config.reset_value", () -> false, null)); | ||
gameplay.addOption(new BooleanListEntry("Invert slippery tag", SkillCheck.config.invertSlipperyTag, "text.cloth-config.reset_value", () -> false, null)); | ||
gameplay.addOption(new BooleanListEntry("Show dice rolls in chat", SkillCheck.config.showDiceRolls, "text.cloth-config.reset_value", () -> false, null)); | ||
gameplay.addOption(new BooleanListEntry("Enable critical failures", SkillCheck.config.haveCriticalFailures, "text.cloth-config.reset_value", () -> true, null)); | ||
ConfigScreenBuilder.CategoryBuilder dice = builder.getCategory("Dice Roll Requirements"); | ||
dice.addOption(new IntegerSliderEntry("Arrow catch (1d20+thief)", 1, 26, SkillCheck.config.arrowCatchRoll, "text.cloth-config.reset_value", () -> 15, null)); | ||
dice.addOption(new IntegerSliderEntry("Armor theft (1d20+thief)", 1, 26, SkillCheck.config.stealArmorRoll, "text.cloth-config.reset_value", () -> 8, null)); | ||
dice.addOption(new IntegerSliderEntry("Silent armor theft (1d20+thief)", 1, 26, SkillCheck.config.silentStealArmorRoll, "text.cloth-config.reset_value", () -> 12, null)); | ||
dice.addOption(new IntegerSliderEntry("Enemy weaken (1d20+brawler)", 1, 31, SkillCheck.config.weakenEnemyRoll, "text.cloth-config.reset_value", () -> 12, null)); | ||
return builder.build(); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.