-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc Additions #67
base: main
Are you sure you want to change the base?
Misc Additions #67
Conversation
Signed-off-by: solonovamax <[email protected]>
These will be re-added in other PRs (SilkMC#66 and SilkMC#67) Signed-off-by: solonovamax <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really needed, I feel like it is kind of unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not strictly necessary, however it does make it feel a bit nicer imo
import net.minecraft.world.inventory.Slot | ||
import net.silkmc.silk.core.mixin.client.AbstractContainerScreenAccessor | ||
|
||
val AbstractContainerScreen<*>.focusedSlot: Slot? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason the extension is not called hoveredSlot as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason is I forgored to update it
fun CollisionGetter.entityCollisions( | ||
entity: Entity? = null, | ||
box: AABB, | ||
): List<VoxelShape> { | ||
return getEntityCollisions(entity, box) | ||
} | ||
|
||
fun CollisionGetter.collisions( | ||
entity: Entity? = null, | ||
box: AABB, | ||
): Iterable<VoxelShape> { | ||
return getCollisions(entity, box) | ||
} | ||
|
||
fun CollisionGetter.blockCollisions( | ||
entity: Entity? = null, | ||
box: AABB, | ||
): Iterable<VoxelShape> { | ||
return getBlockCollisions(entity, box) | ||
} | ||
|
||
fun EntityGetter.entityCollisions( | ||
entity: Entity? = null, | ||
box: AABB, | ||
): List<VoxelShape> { | ||
return getEntityCollisions(entity, box) | ||
} | ||
|
||
fun EntityGetter.entities( | ||
except: Entity? = null, | ||
box: AABB, | ||
predicate: (Entity) -> Boolean = EntitySelector.NO_SPECTATORS::test, | ||
): List<Entity> { | ||
return getEntities(except, box, predicate) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't these functions just remove "get" from the name of the original function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah basically, though it does also make them have an optional parameter for the Entity
, which for all those methods if none is provided then it's ignored (I forget if there is an overload for this or not by default. I'd have to check.)
also, imo it feels a lot nicer without the get
, but that's just me
A bunch of misc additions split off from #59 that I wasn't sure how else to group.
Adds:
World
for getting entities by class/type/collision withAABB
MinecraftServer
for getting a world by their identifier (ResourceLocation
)AbstractContainerScreen
to get the focused slotIngredient
Container
contains & iterating through themthe
.iterator()
extension allows for