From 90316ae8cab2a96899963838d2fa256a0ace3bf5 Mon Sep 17 00:00:00 2001 From: Zelophed Date: Fri, 27 Mar 2020 13:58:16 +0100 Subject: [PATCH] added a tooltip to sandpaper - sandpaper is now enchantable - sandpaper now repairs tools for 50% of the current damage --- .../create/foundation/command/CreateCommand.java | 14 +++++--------- .../create/foundation/command/KillTPSCommand.java | 8 ++++---- .../create/foundation/item/TooltipHelper.java | 4 ++++ .../modules/curiosities/tools/SandPaperItem.java | 5 +++++ .../tools/SandPaperPolishingRecipe.java | 2 +- src/main/resources/assets/create/lang/en_us.json | 9 ++++++++- 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/command/CreateCommand.java b/src/main/java/com/simibubi/create/foundation/command/CreateCommand.java index cc55eb455..27de9b3b2 100644 --- a/src/main/java/com/simibubi/create/foundation/command/CreateCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/CreateCommand.java @@ -1,7 +1,6 @@ package com.simibubi.create.foundation.command; import com.mojang.brigadier.CommandDispatcher; -import com.mojang.brigadier.builder.ArgumentBuilder; import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; @@ -9,13 +8,10 @@ import net.minecraft.command.Commands; public class CreateCommand { public CreateCommand(CommandDispatcher dispatcher) { - // KillTPSCommand.register(dispatcher); Commented out for release - addCreateCommand(dispatcher, ToggleDebugCommand.register()); - addCreateCommand(dispatcher, ClearBufferCacheCommand.register()); - } - - public void addCreateCommand(CommandDispatcher dispatcher, - ArgumentBuilder register) { - dispatcher.register(Commands.literal("create").then(register)); + dispatcher.register(Commands.literal("create") + .then(ToggleDebugCommand.register()) + .then(ClearBufferCacheCommand.register()) + //.then(KillTPSCommand.register()) //Commented out for release + ); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java b/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java index 9a6e54b04..d82d9e7df 100644 --- a/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java @@ -1,7 +1,7 @@ package com.simibubi.create.foundation.command; -import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.IntegerArgumentType; +import com.mojang.brigadier.builder.ArgumentBuilder; import com.simibubi.create.Create; import com.simibubi.create.foundation.utility.Lang; @@ -10,8 +10,8 @@ import net.minecraft.command.Commands; public class KillTPSCommand { - public static void register(CommandDispatcher dispatcher) { - dispatcher.register(Commands.literal(Lang.translate("command.killTPSCommand")) + public static ArgumentBuilder register() { + return Commands.literal("killtps") .requires(cs -> cs.hasPermissionLevel(2)).executes(ctx -> { // killtps no arguments ctx.getSource().sendFeedback( @@ -63,6 +63,6 @@ public class KillTPSCommand { Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.2"), false); return 1; - }))); + })); } } diff --git a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java index 337895676..84c13ec57 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java @@ -16,6 +16,7 @@ import com.simibubi.create.modules.contraptions.base.IRotate; import com.simibubi.create.modules.contraptions.components.flywheel.engine.EngineBlock; import com.simibubi.create.modules.curiosities.tools.AllToolTiers; +import com.simibubi.create.modules.curiosities.tools.SandPaperItem; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.resources.I18n; @@ -177,6 +178,9 @@ public class TooltipHelper { } } + if (stack.getItem() instanceof SandPaperItem) + return "tool.create.sand_paper.tooltip"; + return stack.getItem().getTranslationKey(stack) + ".tooltip"; } diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java index 64732c7fb..ff23eafc6 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java @@ -188,6 +188,11 @@ public class SandPaperItem extends Item implements IHaveCustomItemModel { return 8; } + @Override + public int getItemEnchantability() { + return 5; + } + @Override @OnlyIn(Dist.CLIENT) public CustomRenderedItemModel createModel(IBakedModel original) { diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperPolishingRecipe.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperPolishingRecipe.java index 92eaf69c2..d4cf72eb3 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperPolishingRecipe.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperPolishingRecipe.java @@ -47,7 +47,7 @@ public class SandPaperPolishingRecipe extends ProcessingRecipe { return matchingRecipes.get(0).getCraftingResult(new SandPaperInv(stack)).copy(); if (stack.isDamageable() && isPolishingEnabled()) { - stack.setDamage(stack.getDamage() - (stack.getMaxDamage() - stack.getDamage()) / 2); + stack.setDamage(stack.getDamage() / 2); int fortuneLevel = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, sandPaperStack); float chanceToPunish = (float) (1 / Math.pow(2, fortuneLevel + 1)); diff --git a/src/main/resources/assets/create/lang/en_us.json b/src/main/resources/assets/create/lang/en_us.json index 9b03596d7..e0768f536 100644 --- a/src/main/resources/assets/create/lang/en_us.json +++ b/src/main/resources/assets/create/lang/en_us.json @@ -309,6 +309,8 @@ "create.action.discard": "Discard", "create.keyinfo.toolmenu": "Focus Tool Menu", + "create.keyinfo.scrollup": "Simulate Mousewheel Up (inworld)", + "create.keyinfo.scrolldown": "Simulate Mousewheel Down (inworld)", "create.gui.scrollInput.defaultTitle": "Choose an Option:", "create.gui.scrollInput.scrollToModify": "Scroll to Modify", @@ -625,7 +627,7 @@ "advancement.create:sand_paper.desc": "Create some Sand Paper to make things pretty.", "advancement.create:polished_rose_quartz": "Pink Diamonds", "advancement.create:polished_rose_quartz.desc": "Polish Rose Quartz until you can see through it.", - "advancement.create:sand_paper_secret": "Polishception", + "advancement.create:sand_paper_secret": "9001 Grit Sand Paper", "advancement.create:sand_paper_secret.desc": "Use your Sand Paper to sand some Sand Paper.", "advancement.create:press": "'Bonk!' ", "advancement.create:press.desc": "Make a Mechanical Press and use it to create some Plates.", @@ -1115,6 +1117,11 @@ "block.create.stress_gauge.tooltip.condition1": "When Rotated", "block.create.stress_gauge.tooltip.behaviour1": "Indicates a color corresponding to the level of stress. _Over-stressed_ _networks_ will cease to move. Stress can be relieved by adding more _rotational_ _sources_ to the network.", + "tool.create.sand_paper.tooltip": "SAND PAPER", + "tool.create.sand_paper.tooltip.summary": "A rough paper that can be used to _polish_ _materials_ or sharpen your _tools_.", + "tool.create.sand_paper.tooltip.condition1": "When Used", + "tool.create.sand_paper.tooltip.behaviour1": "Applies polish to items held in the _offhand_ or lying on the _floor_ when _looking_ _at_ _them_", + "item.create.refined_radiance.tooltip": "REFINED RADIANCE", "item.create.refined_radiance.tooltip.summary": "A Chromatic material forged from _absorbed_ _light_.",