CC: Tweaked

CC: Tweaked

57M Downloads

Pocket Computer Left Click

kitsu opened this issue ยท 8 comments

commented

Hi, thanks for maintaining and enhancing this great old mod! For background I am building a questing modpack around the "ComputerCraft Challenge", so I'm thinking about ways to introduce and motivate the use of all the features of CC. I've got a pretty extensive set of quests focused on turtle automation, but now I'm trying to hit some of the other high points.

This morning I was thinking about ways to use a Pocket Computer, and I thought a waypoint program would be cool: something that could record a series of GPS coordinates for turtle pathing/POIs. Should be pretty simple to write, but operating it will be kind of awkward: needing to open the UI and interact for every point.

One of the coolest features of the pocket comp is the map-like display: being able to get live feedback without interacting with the UI. So I thought - wouldn't it be great if you could also use the pocket comp without the UI? After a quick search and checking the Wiki it doesn't seem like anything like this is possible, so I'm adding this request.

The simplest version is: add an event that fires when the user left clicks with the pocket comp.
Preferably the pocomp's coordinates would also be set to the block normal to the clicked face.
Getting user facing (n,e,s,w,u,d) is probably out of scope, but would also be handy.
Being able to inspect the clicked block could also be very useful.

commented

CC has been developed up to this point with idea of not exposing current player coordinates and facing to code directly. While some peripheral mods do that you will find that vanilla CC don't let you really see what your coordinates and facing are. This leads you to use GPS like systems to get that information. I would find it unlikely for pocket to get ability to get positional information ex nihilo.

I'm not suggesting "giving" the coordinates. AFAIK pocket computers can equip a wireless modem, and they can run gps locate. I'm just saying while you're waving it around the GPS coords should be its position i.e. the clicked block.

You might be however interested in Plethora mod for CC that allows you to get information about blocks around the player.

I'm sort of interested in Plethora, but it isn't available for 1.16 currently, and it is getting partially folded into CC:Tweaked.

BTW I played around with a wrapped barrel yesterday, but pushItem just returned a number without moving anything?

commented

Preferably the pocomp's coordinates would also be set to the block normal to the clicked face.
Getting user facing (n,e,s,w,u,d) is probably out of scope, but would also be handy.

CC has been developed up to this point with idea of not exposing current player coordinates and facing to code directly. While some peripheral mods do that you will find that vanilla CC don't let you really see what your coordinates and facing are. This leads you to use GPS like systems to get that information. I would find it unlikely for pocket to get ability to get positional information ex nihilo.

Being able to inspect the clicked block could also be very useful.

You might be however interested in Plethora mod for CC that allows you to get information about blocks around the player.

The simplest version is: add an event that fires when the user left clicks with the pocket comp.

This part of idea i personally really like.. Having a way to cause a event (may i boldly suggest pocket_wave ) using left click would be a lovely way to send a signal to pocket.

commented

I'm not suggesting "giving" the coordinates. AFAIK pocket computers can equip a wireless modem, and they can run gps locate. I'm just saying while you're waving it around the GPS coords should be its position i.e. the clicked block.

I believe that the plethora block scanner gives coords relative to the scanner, so a more CC way (or plethora way?) of doing this would be to have the coords of the clicked block be relative to the player position (which is what the GPS of the pocet computer would tell while it's held)

BTW I played around with a wrapped barrel yesterday, but pushItem just returned a number without moving anything?

A ex nehilo barrel? I think you have to push items one at a time into them

commented

BTW I played around with a wrapped barrel yesterday, but pushItem just returned a number without moving anything?

A ex nehilo barrel? I think you have to push items one at a time into them

I imagine a vanilla one. I'll have a fiddle locally, but could you post the code you ran?

commented

BTW I played around with a wrapped barrel yesterday, but pushItem just returned a number without moving anything?

A ex nehilo barrel? I think you have to push items one at a time into them

I imagine a vanilla one. I'll have a fiddle locally, but could you post the code you ran?

Yeah, a vanilla barrel. Unfortunately I was running interactive, so I don't have any code.
IIRC it was just:

barrel = peripheral.wrap("bottom");
barrel.pushItems("up", 1);

Of course that was amongst a bunch of other experiments, including a lot of LuaException( "Target '" + toName + "' does not exist" ) output. My only successful commands just printed the target slot's item count though. I was just checking if this was far enough for a quest line, but I think it's best to wait until it has stabilized, I just left a mention in the last quest if players want to investigate.

BTW my pack is ready to release, but porting to Twitch/Curse is giving me fits. I had to switch to MC 1.16.4 and Forge 35 because of mod bugs/updates, but everything is working fine in MultMC. A bunch of mods aren't tagged as 1.16.4 compatible on Curse though so Twitch won't even show me those mods...

commented

I had a go at implementing this back in November when this issue was created using the onEntitySwing hook. However, it's very much not ideal. To quote my commit message:

I'm not sure the right way to implement this event, but this isn't it.
The "swing arm" animation occurs for both left and right click (we only
want left). It also appears to be fired twice (I guess this may be me
being silly and running on the client)

commented

Would it not be a onItemUseFirst use case instead of onEntitySwing ?

commented

IIRC that only applies when right clicking a block. Though yes, I guess you could hook into that and Forge's clicking on entities and air hooks.