Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 23 20:27
    u9g synchronize #596
  • May 23 20:26

    u9g on op-thing

    Added andriycraft's suggestion (compare)

  • May 23 19:14
    andriycraft edited #594
  • May 22 18:28
    rom1504 commented #491
  • May 22 18:28
    rom1504 commented #491
  • May 22 17:32
    vantezzen commented #491
  • May 21 20:34
    u9g opened #596
  • May 21 20:34

    u9g on op-thing

    Commands(OP): Make player non-c… (compare)

  • May 21 16:56
    Saiv46 commented #595
  • May 21 09:05
    kf106 commented #595
  • May 21 08:33
    kf106 commented #595
  • May 21 07:05
    Saiv46 commented #595
  • May 21 07:02
    Saiv46 synchronize #595
  • May 20 17:06
    kf106 commented #595
  • May 20 16:49
    kf106 commented #595
  • May 20 16:42
    kf106 commented #595
  • May 20 12:22
    Saiv46 synchronize #595
  • May 20 12:19
    Saiv46 opened #595
  • May 19 21:36
    kf106 commented #566
  • May 19 20:58
    kf106 commented #566
rom1504bot
@rom1504bot
rom1504bot
@rom1504bot
<paradise> so I can see that cancelling is implemented here https://github.com/PrismarineJS/flying-squid/blob/master/src/lib/behavior.js but is there any way to set it from within an event? eg js player.on('connected', () => { this.cancelled = true; });
<paradise> without having to manually do it
rom1504bot
@rom1504bot
<U9G> I have no idea how that works
<paradise> same
<paradise> I did experiment with js serv.on('changeTime', (data, cancelled, cancelCount) => { cancelled = true; }); for example but im not sure if it'd actually work
<U9G> but imo it could be implemented much simpler like this: before any {event} fires, first check server._events if there is a listener on pre_{event}, emit an event and await the result of that event whether its true or false to decide whether to do that action
<U9G> if not, just continue forward
<U9G> the whole cancel count etc is confusing imo
rom1504bot
@rom1504bot
<U9G> @rom1504 what do you think about that
rom1504bot
@rom1504bot
<rom1504> cool, do you have it online somewhere ?
<rom1504> don't use canceling
<rom1504> it will be removed
<rom1504> there's an open issue to remove it
<paradise> damn alright thanks
rom1504bot
@rom1504bot
<paradise> im confused even more now, I can see this right here https://github.com/PrismarineJS/flying-squid/blob/73dd100d6f29c9e8b053e6f176da339254df102f/src/lib/plugins/placeBlock.js#L28 yet if I try js module.exports.server = function(serv) { // Create your server events here serv.onItemPlace('stone', () => { console.log('stone'); }); }; I get TypeError: serv.onItemPlace is not a function
rom1504bot
@rom1504bot
<Karang> thats because you are calling it too soon
<PrismarineJS> Showing lines 111 to 129 of 73dd100d6f29c9e8b053e6f176da339254df102f/src/lib/plugins/redstone.js
 111   const notifyEndOfLine = async (world, pos, dir, tick) => {
 112     const blockPos = pos.plus(dir)
 113     const block = await world.getBlock(blockPos)
 114     if (isSolid(block) && await isWireDirectedIn(world, pos, dir)) {
 115       serv.updateBlock(world, blockPos, tick, tick)
 116       serv.notifyNeighborsOfStateChangeDirectional(world, pos, dir, tick, tick)
 117     }
 118   }
 119 
>120   serv.on('asap', () => {
 121     serv.onItemPlace('redstone', () => {
 122       return { id: redstoneWireType, data: 0 }
 123     })
 124 
 125     serv.onItemPlace('redstone_torch', ({ direction }) => {
 126       const directionToData = [0, 5, 4, 3, 2, 1]
 127       // Placing an unlit torch allows to detect change on the first update
 128       // and reduce the block updates
 129       return { id: unlitRedstoneTorchType, data: directionToData[direction] }
<Karang> the asap event gets triggered once every plugins are registered
rom1504bot
@rom1504bot
<paradise> o yeah I remember something about that tx
rom1504bot
@rom1504bot
<paradise> Are there any issues with comparing blocks by their name property over id except that they might change?
rom1504bot
@rom1504bot
<Ic3Tank> I think most people use mcData to get the id off a block for a specific version and then compare with the id.
<paradise> Makes sense, just that the function annoyed me so I implemented regex to check the name property instead of ID and I'm wondering if there's an actual downside
rom1504bot
@rom1504bot
<Ic3Tank> If the name changes you have to change the name checking at multiple places. Were as with mcData you only have to change the name at one place.
<Karang> comparing id is faster than comparing name (especially when using a regex) that being said if you do it only once or twice, it shouldn't be an issue
rom1504bot
@rom1504bot
<paradise> I c
<paradise> Well ty guess I won't do a pr then 👍
rom1504bot
@rom1504bot
<DrunkMoon> In my about me
rom1504bot
@rom1504bot
<rom1504> I mean the code
<DrunkMoon> It’s uh
<DrunkMoon> Not online anywhere yet since it’s just a pretty primitive modification of diamond-square
rom1504bot
@rom1504bot
<DrunkMoon> drop iron axe -> drops coral fan
use axe -> place coral fan
break coral fan -> drops axe
drop coral fan -> drops black shulker box
break black shulker box -> drop coral fan
drop black shulker box -> nothing
<DrunkMoon> block id and item id discrepancy is pain
<U9G> yeah, its an easy fix
<U9G> submit a pr where you match based on name not based on number
<U9G> ie find the cooresponding name in blocks that was just placed
<DrunkMoon> drop iron axe -> drops coral fan
use axe -> place coral fan
break coral fan -> drops axe
use coral fan -> place coral fan
drop coral fan -> drops black shulker box
break black shulker box -> drop coral fan
drop black shulker box -> nothing
rom1504bot
@rom1504bot
<paradise> How would I go by making an entity invisible?
rom1504bot
@rom1504bot
<DrunkMoon> why does opening the crafting window alter the entire player.inventory?
https://cdn.discordapp.com/attachments/413438265475989534/880989540960043048/unknown.png
<U9G> how?
<DrunkMoon> not entirely sure what happened
<DrunkMoon> can't reproduce now
<DrunkMoon> but basically since the actual player.inventory's IDs are one lower than that of the crafting table window's
<DrunkMoon> the items in the player.inventory got moved to their respective positions as in the crafting table
rom1504bot
@rom1504bot
<DrunkMoon> Btw it doesn’t send the confirmation packets for actions right?
rom1504bot
@rom1504bot
<DrunkMoon> the inventory management is quite a mess rn
rom1504bot
@rom1504bot
<nickelpro> Lol using flying squid