Lang sendStatus
This commit is contained in:
parent
d59e748c01
commit
560042d781
5 changed files with 46 additions and 34 deletions
|
@ -115,7 +115,9 @@ public class SuperGlueSelectionHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstPos != null && !firstPos.closerThan(hovered, 24)) {
|
if (firstPos != null && !firstPos.closerThan(hovered, 24)) {
|
||||||
Lang.sendStatus(player, FAIL, "super_glue.too_far");
|
Lang.translate("super_glue.too_far")
|
||||||
|
.color(FAIL)
|
||||||
|
.sendStatus(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,15 +133,23 @@ public class SuperGlueSelectionHandler {
|
||||||
if (currentCluster != null) {
|
if (currentCluster != null) {
|
||||||
boolean canReach = currentCluster.contains(hovered);
|
boolean canReach = currentCluster.contains(hovered);
|
||||||
boolean canAfford = SuperGlueSelectionHelper.collectGlueFromInventory(player, glueRequired, true);
|
boolean canAfford = SuperGlueSelectionHelper.collectGlueFromInventory(player, glueRequired, true);
|
||||||
|
int color = HIGHLIGHT;
|
||||||
|
String key = "super_glue.click_to_confirm";
|
||||||
|
|
||||||
if (!canReach)
|
if (!canReach) {
|
||||||
Lang.sendStatus(player, FAIL, "super_glue.cannot_reach");
|
color = FAIL;
|
||||||
else if (!canAfford)
|
key = "super_glue.cannot_reach";
|
||||||
Lang.sendStatus(player, FAIL, "super_glue.not_enough");
|
} else if (!canAfford) {
|
||||||
else if (cancel)
|
color = FAIL;
|
||||||
Lang.sendStatus(player, FAIL, "super_glue.click_to_discard");
|
key = "super_glue.not_enough";
|
||||||
else
|
} else if (cancel) {
|
||||||
Lang.sendStatus(player, HIGHLIGHT, "super_glue.click_to_confirm");
|
color = FAIL;
|
||||||
|
key = "super_glue.click_to_discard";
|
||||||
|
}
|
||||||
|
|
||||||
|
Lang.translate(key)
|
||||||
|
.color(color)
|
||||||
|
.sendStatus(player);
|
||||||
|
|
||||||
if (currentSelectionBox != null)
|
if (currentSelectionBox != null)
|
||||||
CreateClient.OUTLINER.showAABB(bbOutlineSlot, currentSelectionBox)
|
CreateClient.OUTLINER.showAABB(bbOutlineSlot, currentSelectionBox)
|
||||||
|
@ -223,7 +233,8 @@ public class SuperGlueSelectionHandler {
|
||||||
firstPos = hoveredPos;
|
firstPos = hoveredPos;
|
||||||
if (face != null)
|
if (face != null)
|
||||||
SuperGlueItem.spawnParticles(level, firstPos, face, true);
|
SuperGlueItem.spawnParticles(level, firstPos, face, true);
|
||||||
Lang.sendStatus(player, "super_glue.first_pos");
|
Lang.translate("super_glue.first_pos")
|
||||||
|
.sendStatus(player);
|
||||||
AllSoundEvents.SLIME_ADDED.playAt(level, firstPos, 0.5F, 0.85F, false);
|
AllSoundEvents.SLIME_ADDED.playAt(level, firstPos, 0.5F, 0.85F, false);
|
||||||
level.playSound(player, firstPos, SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.BLOCKS, 0.75f, 1);
|
level.playSound(player, firstPos, SoundEvents.ITEM_FRAME_ADD_ITEM, SoundSource.BLOCKS, 0.75f, 1);
|
||||||
return true;
|
return true;
|
||||||
|
@ -233,7 +244,8 @@ public class SuperGlueSelectionHandler {
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
currentCluster = null;
|
currentCluster = null;
|
||||||
firstPos = null;
|
firstPos = null;
|
||||||
Lang.sendStatus(player, "super_glue.abort");
|
Lang.translate("super_glue.abort")
|
||||||
|
.sendStatus(player);
|
||||||
clusterCooldown = 0;
|
clusterCooldown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +263,8 @@ public class SuperGlueSelectionHandler {
|
||||||
.lineWidth(1 / 24f);
|
.lineWidth(1 / 24f);
|
||||||
|
|
||||||
discard();
|
discard();
|
||||||
Lang.sendStatus(player, "super_glue.sucess");
|
Lang.translate("super_glue.success")
|
||||||
|
.sendStatus(player);
|
||||||
clusterCooldown = 40;
|
clusterCooldown = 40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,8 @@ public class CartAssemblerBlockItem extends BlockItem {
|
||||||
if (player == null)
|
if (player == null)
|
||||||
return false;
|
return false;
|
||||||
if (!(block instanceof BaseRailBlock)) {
|
if (!(block instanceof BaseRailBlock)) {
|
||||||
Lang.sendStatus(player, "block.cart_assembler.invalid");
|
Lang.translate("block.cart_assembler.invalid")
|
||||||
|
.sendStatus(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,9 +196,10 @@ public class LinkedControllerClientHandler {
|
||||||
LinkBehaviour linkBehaviour = TileEntityBehaviour.get(mc.level, selectedLocation, LinkBehaviour.TYPE);
|
LinkBehaviour linkBehaviour = TileEntityBehaviour.get(mc.level, selectedLocation, LinkBehaviour.TYPE);
|
||||||
if (linkBehaviour != null) {
|
if (linkBehaviour != null) {
|
||||||
AllPackets.channel.sendToServer(new LinkedControllerBindPacket(integer, selectedLocation));
|
AllPackets.channel.sendToServer(new LinkedControllerBindPacket(integer, selectedLocation));
|
||||||
Lang.sendStatus(mc.player, "linked_controller.key_bound", controls.get(integer)
|
Lang.translate("linked_controller.key_bound", controls.get(integer)
|
||||||
.getTranslatedKeyMessage()
|
.getTranslatedKeyMessage()
|
||||||
.getString());
|
.getString())
|
||||||
|
.sendStatus(mc.player);
|
||||||
}
|
}
|
||||||
MODE = Mode.IDLE;
|
MODE = Mode.IDLE;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -90,8 +90,10 @@ public class SchematicAndQuillHandler {
|
||||||
|
|
||||||
firstPos = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
firstPos = new BlockPos(bb.minX, bb.minY, bb.minZ);
|
||||||
secondPos = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
secondPos = new BlockPos(bb.maxX, bb.maxY, bb.maxZ);
|
||||||
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.dimensions", (int) bb.getXsize() + 1,
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
(int) bb.getYsize() + 1, (int) bb.getZsize() + 1);
|
Lang.translate("schematicAndQuill.dimensions", (int) bb.getXsize() + 1, (int) bb.getYsize() + 1,
|
||||||
|
(int) bb.getZsize() + 1)
|
||||||
|
.sendStatus(player);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -115,25 +117,29 @@ public class SchematicAndQuillHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedPos == null) {
|
if (selectedPos == null) {
|
||||||
Lang.sendStatus(player, "schematicAndQuill.noTarget");
|
Lang.translate("schematicAndQuill.noTarget")
|
||||||
|
.sendStatus(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (firstPos != null) {
|
if (firstPos != null) {
|
||||||
secondPos = selectedPos;
|
secondPos = selectedPos;
|
||||||
Lang.sendStatus(player, "schematicAndQuill.secondPos");
|
Lang.translate("schematicAndQuill.secondPos")
|
||||||
|
.sendStatus(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
firstPos = selectedPos;
|
firstPos = selectedPos;
|
||||||
Lang.sendStatus(player, "schematicAndQuill.firstPos");
|
Lang.translate("schematicAndQuill.firstPos")
|
||||||
|
.sendStatus(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void discard() {
|
public void discard() {
|
||||||
LocalPlayer player = Minecraft.getInstance().player;
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
firstPos = null;
|
firstPos = null;
|
||||||
secondPos = null;
|
secondPos = null;
|
||||||
Lang.sendStatus(player, "schematicAndQuill.abort");
|
Lang.translate("schematicAndQuill.abort")
|
||||||
|
.sendStatus(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
@ -239,7 +245,9 @@ public class SchematicAndQuillHandler {
|
||||||
}
|
}
|
||||||
firstPos = null;
|
firstPos = null;
|
||||||
secondPos = null;
|
secondPos = null;
|
||||||
Lang.sendStatus(Minecraft.getInstance().player, "schematicAndQuill.saved", filepath);
|
LocalPlayer player = Minecraft.getInstance().player;
|
||||||
|
Lang.translate("schematicAndQuill.saved", filepath)
|
||||||
|
.sendStatus(player);
|
||||||
|
|
||||||
if (!convertImmediately)
|
if (!convertImmediately)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,7 +9,6 @@ import com.simibubi.create.Create;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TextComponent;
|
import net.minecraft.network.chat.TextComponent;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
import net.minecraft.world.entity.player.Player;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
@ -27,16 +26,6 @@ public class Lang {
|
||||||
return new TranslatableComponent(Create.ID + "." + key, resolveBuilders(args));
|
return new TranslatableComponent(Create.ID + "." + key, resolveBuilders(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated // use Lang.translate(...).sendStatus(player)
|
|
||||||
public static void sendStatus(Player player, String key, Object... args) {
|
|
||||||
translate(key, args).sendStatus(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated // use Lang.translate(...).color(color).sendStatus(player)
|
|
||||||
public static void sendStatus(Player player, int color, String key, Object... args) {
|
|
||||||
translate(key, args).color(color).sendStatus(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String asId(String name) {
|
public static String asId(String name) {
|
||||||
return name.toLowerCase(Locale.ROOT);
|
return name.toLowerCase(Locale.ROOT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue