mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-05 22:28:58 +01:00
CMDCam at home
- add a command to control/animate a players look direction - add a missing word in the display link ponder scene - fix sails coloring adjacent sails with different orientations
This commit is contained in:
parent
863e86f8e9
commit
1f96e61c14
24 changed files with 283 additions and 41 deletions
|
@ -559,22 +559,22 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
|
|||
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
|
||||
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
|
||||
f85edc574ee6de0de7693ffb031266643db6724a assets/create/lang/en_ud.json
|
||||
b0ae33dcf2591beea513e0844a40a16e06f6b2d2 assets/create/lang/en_us.json
|
||||
96f398b6b1637c2c5f17629a2f4ed30c9a971465 assets/create/lang/unfinished/de_de.json
|
||||
b1d2dc1cfa9e3cc712a8bd2ac2bd582a2390274e assets/create/lang/unfinished/es_cl.json
|
||||
aed94ed3482ad57469d36c9ae2c98fbd27bd0895 assets/create/lang/unfinished/es_es.json
|
||||
224895ac6e5d9d3de525e053b3303c07bd85943a assets/create/lang/unfinished/fr_fr.json
|
||||
4b70d6837b14199f750fcde7317947c7329dcb89 assets/create/lang/unfinished/it_it.json
|
||||
5371238a87b0474f9a73cc6e4a282b9fa4214cba assets/create/lang/unfinished/ja_jp.json
|
||||
bc3bc42af14ea68690f7e75623501404ac8b0bfd assets/create/lang/unfinished/ko_kr.json
|
||||
82567d426c1ff6847c49021d37f76b5cc5ec6975 assets/create/lang/unfinished/nl_nl.json
|
||||
8feedfe2057dd336dbca9e94024c6bd3fd317e55 assets/create/lang/unfinished/pl_pl.json
|
||||
c22d1ced7a13dfdf145fd9d38166061ff0d15ca7 assets/create/lang/unfinished/pt_br.json
|
||||
ec475c078178d0b7a81fbd9c43558913bda3a87f assets/create/lang/unfinished/pt_pt.json
|
||||
64bb5d22f8d84d739ffbcd4cc5c4b947393123fb assets/create/lang/unfinished/ro_ro.json
|
||||
c59de15228bbdaab6630c7172b0c1a0541c8b581 assets/create/lang/unfinished/ru_ru.json
|
||||
4dcae7592d23a22deba0a328840feeb49a940196 assets/create/lang/unfinished/zh_cn.json
|
||||
b80cc2eac8733fcc9158060086d47b6a07fb4e23 assets/create/lang/unfinished/zh_tw.json
|
||||
81efc69970d3c148f96da87f002c22ef6d31cadc assets/create/lang/en_us.json
|
||||
ca7d42dcc171b2469f970c8e3e127c578b957f60 assets/create/lang/unfinished/de_de.json
|
||||
4546ca6adf334b78e248bc9a49f7f1b00a435b69 assets/create/lang/unfinished/es_cl.json
|
||||
afda676294958a031f1418531e4b0fab88573134 assets/create/lang/unfinished/es_es.json
|
||||
8ae850ef9c7c9b61e2a961f6be0393cd2ee2bf03 assets/create/lang/unfinished/fr_fr.json
|
||||
5581c624b6dcce010d035673662ce6ebadd40bf7 assets/create/lang/unfinished/it_it.json
|
||||
27d5f7c0f72717aa1fa56a1d369ed6265055b649 assets/create/lang/unfinished/ja_jp.json
|
||||
ab5858e81ee94771f2c6568eda6dbcc53d8f6348 assets/create/lang/unfinished/ko_kr.json
|
||||
08a4ff9916f57631500a15f97a413521a1d21836 assets/create/lang/unfinished/nl_nl.json
|
||||
e9d309cfb46630bddced8ff2cdee7e8d546eb7a6 assets/create/lang/unfinished/pl_pl.json
|
||||
7059d1c3b099e5682e2023980af077c612c595e0 assets/create/lang/unfinished/pt_br.json
|
||||
5106a24eab9452ccc284b49d16426fe9b947af1b assets/create/lang/unfinished/pt_pt.json
|
||||
d4a554220c43bfe44d2c2a89b38ab372941c077c assets/create/lang/unfinished/ro_ro.json
|
||||
55fe46d635566e6a6772c0c0f57027eb2025c79e assets/create/lang/unfinished/ru_ru.json
|
||||
5f0f9403c74a6c29700c943cce5f2a8ea0651d25 assets/create/lang/unfinished/zh_cn.json
|
||||
e99b2cf4d9414b22ae148c635b6dad2a8dd9534b assets/create/lang/unfinished/zh_tw.json
|
||||
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
|
||||
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
|
||||
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json
|
||||
|
|
|
@ -2346,7 +2346,7 @@
|
|||
"create.ponder.display_board.text_6": "Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -2347,7 +2347,7 @@
|
|||
"create.ponder.display_board.text_6": "UNLOCALIZED: Lines can be reset by clicking them with an empty hand",
|
||||
|
||||
"create.ponder.display_link.header": "UNLOCALIZED: Setting up Display Links",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_1": "UNLOCALIZED: Display Links can be used to visualise dynamic information",
|
||||
"create.ponder.display_link.text_2": "UNLOCALIZED: First, right-click the target display...",
|
||||
"create.ponder.display_link.text_3": "UNLOCALIZED: ...then attach it to the block to read from",
|
||||
"create.ponder.display_link.text_4": "UNLOCALIZED: Open the Interface to select and configure what is sent",
|
||||
|
|
|
@ -90,7 +90,7 @@ public class SailBlock extends WrenchableDirectionalBlock {
|
|||
|
||||
if (heldItem.getItem() instanceof ShearsItem) {
|
||||
if (!world.isClientSide)
|
||||
applyDye(state, world, pos, null);
|
||||
applyDye(state, world, pos, ray.getLocation(), null);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -100,14 +100,14 @@ public class SailBlock extends WrenchableDirectionalBlock {
|
|||
DyeColor color = DyeColor.getColor(heldItem);
|
||||
if (color != null) {
|
||||
if (!world.isClientSide)
|
||||
applyDye(state, world, pos, color);
|
||||
applyDye(state, world, pos, ray.getLocation(), color);
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
protected void applyDye(BlockState state, Level world, BlockPos pos, @Nullable DyeColor color) {
|
||||
protected void applyDye(BlockState state, Level world, BlockPos pos, Vec3 hit, @Nullable DyeColor color) {
|
||||
BlockState newState =
|
||||
(color == null ? AllBlocks.SAIL_FRAME : AllBlocks.DYED_SAILS.get(color)).getDefaultState();
|
||||
newState = BlockHelper.copyProperties(state, newState);
|
||||
|
@ -119,15 +119,15 @@ public class SailBlock extends WrenchableDirectionalBlock {
|
|||
}
|
||||
|
||||
// Dye all adjacent
|
||||
for (Direction d : Iterate.directions) {
|
||||
if (d.getAxis() == state.getValue(FACING)
|
||||
.getAxis())
|
||||
continue;
|
||||
List<Direction> directions = IPlacementHelper.orderedByDistanceExceptAxis(pos, hit, state.getValue(FACING).getAxis());
|
||||
for (Direction d : directions) {
|
||||
BlockPos offset = pos.relative(d);
|
||||
BlockState adjacentState = world.getBlockState(offset);
|
||||
Block block = adjacentState.getBlock();
|
||||
if (!(block instanceof SailBlock) || ((SailBlock) block).frame)
|
||||
continue;
|
||||
if (state.getValue(FACING) != adjacentState.getValue(FACING))
|
||||
continue;
|
||||
if (state == adjacentState)
|
||||
continue;
|
||||
world.setBlockAndUpdate(offset, newState);
|
||||
|
@ -157,6 +157,8 @@ public class SailBlock extends WrenchableDirectionalBlock {
|
|||
Block block = adjacentState.getBlock();
|
||||
if (!(block instanceof SailBlock) || ((SailBlock) block).frame && color != null)
|
||||
continue;
|
||||
if (adjacentState.getValue(FACING) != state.getValue(FACING))
|
||||
continue;
|
||||
if (state != adjacentState)
|
||||
world.setBlockAndUpdate(offset, newState);
|
||||
frontier.add(offset);
|
||||
|
|
|
@ -61,6 +61,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.linked.LinkRenderer;
|
|||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueHandler;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueRenderer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.CameraAngleAnimationService;
|
||||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedClientWorld;
|
||||
|
@ -168,6 +169,7 @@ public class ClientEvents {
|
|||
DisplayLinkBlockItem.clientTick();
|
||||
CurvedTrackInteraction.clientTick();
|
||||
CameraDistanceModifier.tick();
|
||||
CameraAngleAnimationService.tick();
|
||||
TrainHUD.tick();
|
||||
}
|
||||
|
||||
|
@ -229,6 +231,17 @@ public class ClientEvents {
|
|||
ms.popPose();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onCameraSetup(EntityViewRenderEvent.CameraSetup event) {
|
||||
float partialTicks = AnimationTickHolder.getPartialTicks();
|
||||
|
||||
if (CameraAngleAnimationService.isYawAnimating())
|
||||
event.setYaw(CameraAngleAnimationService.getYaw(partialTicks));
|
||||
|
||||
if (CameraAngleAnimationService.isPitchAnimating())
|
||||
event.setPitch(CameraAngleAnimationService.getPitch(partialTicks));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void getItemTooltipColor(RenderTooltipEvent.Color event) {
|
||||
PonderTooltipHandler.handleTooltipColor(event);
|
||||
|
|
|
@ -57,6 +57,7 @@ public class AllCommands {
|
|||
.then(ReplaceInCommandBlocksCommand.register())
|
||||
.then(ClearBufferCacheCommand.register())
|
||||
.then(CameraDistanceCommand.register())
|
||||
.then(CameraAngleCommand.register())
|
||||
.then(FlySpeedCommand.register())
|
||||
//.then(KillTPSCommand.register())
|
||||
.build();
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
package com.simibubi.create.foundation.command;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.mojang.brigadier.arguments.FloatArgumentType;
|
||||
import com.mojang.brigadier.builder.ArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.CameraAngleAnimationService;
|
||||
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
|
||||
public class CameraAngleCommand {
|
||||
|
||||
public static ArgumentBuilder<CommandSourceStack, ?> register() {
|
||||
return Commands.literal("angle")
|
||||
.requires(cs -> cs.hasPermission(2))
|
||||
.then(Commands.argument("players", EntityArgument.players())
|
||||
.then(Commands.literal("yaw")
|
||||
.then(Commands.argument("degrees", FloatArgumentType.floatArg())
|
||||
.executes(context -> updateCameraAngle(context, true))
|
||||
)
|
||||
).then(Commands.literal("pitch")
|
||||
.then(Commands.argument("degrees", FloatArgumentType.floatArg())
|
||||
.executes(context -> updateCameraAngle(context, false))
|
||||
)
|
||||
).then(Commands.literal("mode")
|
||||
.then(Commands.literal("linear")
|
||||
.executes(context -> updateCameraAnimationMode(context, CameraAngleAnimationService.Mode.LINEAR.name()))
|
||||
.then(Commands.argument("speed", FloatArgumentType.floatArg(0))
|
||||
.executes(context -> updateCameraAnimationMode(context, CameraAngleAnimationService.Mode.LINEAR.name(), FloatArgumentType.getFloat(context, "speed")))
|
||||
)
|
||||
).then(Commands.literal("exponential")
|
||||
.executes(context -> updateCameraAnimationMode(context, CameraAngleAnimationService.Mode.EXPONENTIAL.name()))
|
||||
.then(Commands.argument("speed", FloatArgumentType.floatArg(0))
|
||||
.executes(context -> updateCameraAnimationMode(context, CameraAngleAnimationService.Mode.EXPONENTIAL.name(), FloatArgumentType.getFloat(context, "speed")))
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static int updateCameraAngle(CommandContext<CommandSourceStack> ctx, boolean yaw) throws CommandSyntaxException {
|
||||
AtomicInteger targets = new AtomicInteger(0);
|
||||
|
||||
float angleTarget = FloatArgumentType.getFloat(ctx, "degrees");
|
||||
String optionName = (yaw ? SConfigureConfigPacket.Actions.camAngleYawTarget : SConfigureConfigPacket.Actions.camAnglePitchTarget).name();
|
||||
|
||||
getPlayersFromContext(ctx).forEach(player -> {
|
||||
AllPackets.channel.send(
|
||||
PacketDistributor.PLAYER.with(() -> player),
|
||||
new SConfigureConfigPacket(optionName, String.valueOf(angleTarget))
|
||||
);
|
||||
targets.incrementAndGet();
|
||||
});
|
||||
|
||||
return targets.get();
|
||||
}
|
||||
|
||||
private static int updateCameraAnimationMode(CommandContext<CommandSourceStack> ctx, String value) throws CommandSyntaxException {
|
||||
AtomicInteger targets = new AtomicInteger(0);
|
||||
|
||||
getPlayersFromContext(ctx).forEach(player -> {
|
||||
AllPackets.channel.send(
|
||||
PacketDistributor.PLAYER.with(() -> player),
|
||||
new SConfigureConfigPacket(SConfigureConfigPacket.Actions.camAngleFunction.name(), value)
|
||||
);
|
||||
targets.incrementAndGet();
|
||||
});
|
||||
|
||||
return targets.get();
|
||||
}
|
||||
|
||||
private static int updateCameraAnimationMode(CommandContext<CommandSourceStack> ctx, String value, float speed) throws CommandSyntaxException {
|
||||
AtomicInteger targets = new AtomicInteger(0);
|
||||
|
||||
getPlayersFromContext(ctx).forEach(player -> {
|
||||
AllPackets.channel.send(
|
||||
PacketDistributor.PLAYER.with(() -> player),
|
||||
new SConfigureConfigPacket(SConfigureConfigPacket.Actions.camAngleFunction.name(), value + ":" + speed)
|
||||
);
|
||||
targets.incrementAndGet();
|
||||
});
|
||||
|
||||
return targets.get();
|
||||
}
|
||||
|
||||
private static Collection<ServerPlayer> getPlayersFromContext(CommandContext<CommandSourceStack> ctx) throws CommandSyntaxException {
|
||||
return EntityArgument.getPlayers(ctx, "players");
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase;
|
|||
import com.simibubi.create.foundation.ponder.PonderRegistry;
|
||||
import com.simibubi.create.foundation.ponder.ui.PonderIndexScreen;
|
||||
import com.simibubi.create.foundation.ponder.ui.PonderUI;
|
||||
import com.simibubi.create.foundation.utility.CameraAngleAnimationService;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -115,7 +116,10 @@ public class SConfigureConfigPacket extends SimplePacketBase {
|
|||
overlayReset(() -> Actions::overlayReset),
|
||||
openPonder(() -> Actions::openPonder),
|
||||
fabulousWarning(() -> Actions::fabulousWarning),
|
||||
zoomMultiplier(() -> Actions::zoomMultiplier)
|
||||
zoomMultiplier(() -> Actions::zoomMultiplier),
|
||||
camAngleYawTarget(() -> value -> camAngleTarget(value, true)),
|
||||
camAnglePitchTarget(() -> value -> camAngleTarget(value, false)),
|
||||
camAngleFunction(() -> Actions::camAngleFunction)
|
||||
|
||||
;
|
||||
|
||||
|
@ -227,6 +231,42 @@ public class SConfigureConfigPacket extends SimplePacketBase {
|
|||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void camAngleTarget(String value, boolean yaw) {
|
||||
try {
|
||||
float v = Float.parseFloat(value);
|
||||
|
||||
if (yaw) {
|
||||
CameraAngleAnimationService.setYawTarget(v);
|
||||
} else {
|
||||
CameraAngleAnimationService.setPitchTarget(v);
|
||||
}
|
||||
|
||||
} catch (NumberFormatException ignored) {
|
||||
Create.LOGGER.debug("Received non-float value {} in camAngle packet, ignoring", value);
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void camAngleFunction(String value) {
|
||||
CameraAngleAnimationService.Mode mode = CameraAngleAnimationService.Mode.LINEAR;
|
||||
String modeString = value;
|
||||
float speed = -1;
|
||||
String[] split = value.split(":");
|
||||
if (split.length > 1) {
|
||||
modeString = split[0];
|
||||
try {
|
||||
speed = Float.parseFloat(split[1]);
|
||||
} catch (NumberFormatException ignored) {}
|
||||
}
|
||||
try {
|
||||
mode = CameraAngleAnimationService.Mode.valueOf(modeString);
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
|
||||
CameraAngleAnimationService.setAnimationMode(mode);
|
||||
CameraAngleAnimationService.setAnimationSpeed(speed);
|
||||
}
|
||||
|
||||
private static MutableComponent boolToText(boolean b) {
|
||||
return b ? new TextComponent("enabled").withStyle(ChatFormatting.DARK_GREEN)
|
||||
: new TextComponent("disabled").withStyle(ChatFormatting.RED);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class DisplayScenes {
|
|||
|
||||
scene.overlay.showText(70)
|
||||
.attachKeyFrame()
|
||||
.text("Display Links can used to visualise dynamic information")
|
||||
.text("Display Links can be used to visualise dynamic information")
|
||||
.pointAt(util.vector.blockSurface(util.grid.at(2, 1, 2), Direction.WEST))
|
||||
.placeNearTarget();
|
||||
scene.idle(60);
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class CameraAngleAnimationService {
|
||||
|
||||
private static final LerpedFloat yRotation = LerpedFloat.angular().startWithValue(0);
|
||||
private static final LerpedFloat xRotation = LerpedFloat.angular().startWithValue(0);
|
||||
|
||||
private static Mode animationMode = Mode.LINEAR;
|
||||
private static float animationSpeed = -1;
|
||||
|
||||
public static void tick() {
|
||||
|
||||
if (Minecraft.getInstance().player != null) {
|
||||
if (!yRotation.settled())
|
||||
Minecraft.getInstance().player.setYRot(yRotation.getValue(1));
|
||||
|
||||
if (!xRotation.settled())
|
||||
Minecraft.getInstance().player.setXRot(xRotation.getValue(1));
|
||||
}
|
||||
|
||||
yRotation.tickChaser();
|
||||
xRotation.tickChaser();
|
||||
}
|
||||
|
||||
public static boolean isYawAnimating() {
|
||||
return !yRotation.settled();
|
||||
}
|
||||
|
||||
public static boolean isPitchAnimating() {
|
||||
return !xRotation.settled();
|
||||
}
|
||||
|
||||
public static float getYaw(float partialTicks) {
|
||||
return yRotation.getValue(partialTicks);
|
||||
}
|
||||
|
||||
public static float getPitch(float partialTicks) {
|
||||
return xRotation.getValue(partialTicks);
|
||||
}
|
||||
|
||||
public static void setAnimationMode(Mode mode) {
|
||||
animationMode = mode;
|
||||
}
|
||||
|
||||
public static void setAnimationSpeed(float speed) {
|
||||
animationSpeed = speed;
|
||||
}
|
||||
|
||||
public static void setYawTarget(float yaw) {
|
||||
yRotation.startWithValue(getCurrentYaw());
|
||||
setupChaser(yRotation, yaw);
|
||||
}
|
||||
|
||||
public static void setPitchTarget(float pitch) {
|
||||
xRotation.startWithValue(getCurrentPitch());
|
||||
setupChaser(xRotation, pitch);
|
||||
}
|
||||
|
||||
private static float getCurrentYaw() {
|
||||
if (Minecraft.getInstance().player == null)
|
||||
return 0;
|
||||
|
||||
return Minecraft.getInstance().player.getYRot();
|
||||
}
|
||||
|
||||
private static float getCurrentPitch() {
|
||||
if (Minecraft.getInstance().player == null)
|
||||
return 0;
|
||||
|
||||
return Minecraft.getInstance().player.getXRot();
|
||||
}
|
||||
|
||||
private static void setupChaser(LerpedFloat rotation, float target) {
|
||||
if (animationMode == Mode.LINEAR) {
|
||||
rotation.chase(target, animationSpeed > 0 ? animationSpeed : 2, LerpedFloat.Chaser.LINEAR);
|
||||
} else if (animationMode == Mode.EXPONENTIAL) {
|
||||
rotation.chase(target, animationSpeed > 0 ? animationSpeed : 0.25, LerpedFloat.Chaser.EXP);
|
||||
}
|
||||
}
|
||||
|
||||
public enum Mode {
|
||||
LINEAR,
|
||||
EXPONENTIAL
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue