Skip to content

Instantly share code, notes, and snippets.

View OMAR-3OOV's full-sized avatar
📚
Learning kotlin!

omar OMAR-3OOV

📚
Learning kotlin!
View GitHub Profile
@OMAR-3OOV
OMAR-3OOV / AnimationCircle.kt
Created February 27, 2023 03:03
Animation circle that gives a different colors and spend around the player as a circle and move up and down
fun animateParticles(player: Player) {
val particleType = Particle.REDSTONE
val colors1 = arrayOf(
Color.fromRGB(247,202,201), Color.fromRGB(222,194,203), Color.fromRGB(197,185,205),
Color.fromRGB(171,177,207), Color.fromRGB(146,168,209)
)
val radius = 1.0 // radius of the pentagon
val period = 80L // time for one full rotation (in ticks)
@OMAR-3OOV
OMAR-3OOV / HeartCurve.kt
Created February 26, 2023 21:11
Draw a heart under player but it won't rotate
fun drawHeart(player: Player) {
val loc = player.location.add(0.0, -1.0, 0.0)
val radius = 0.1
val particleType = Particle.REDSTONE
val step = Math.PI / 32
for (i in 0..63) {
val theta = i * step
val x = radius * (16 * sin(theta).pow(3))
val z = radius * (13 * cos(theta) - 5 * cos(2 * theta) - 2 * cos(3 * theta) - cos(4 * theta))
@OMAR-3OOV
OMAR-3OOV / HeartCurve.kt
Last active February 26, 2023 21:12
Draw heart under player and make it rotate depends on player direction
fun drawHeart(player: Player) {
val loc = player.location.add(0.0 , 0.5, 0.0)
val radius = 0.1
val particleType = Particle.REDSTONE
val step = Math.PI / 32
for (i in 0..63) {
val theta = i * step
val x = radius * (16 * sin(theta).pow(3))
val z = radius * (13 * cos(theta) - 5 * cos(2 * theta) - 2 * cos(3 * theta) - cos(4 * theta))
@OMAR-3OOV
OMAR-3OOV / ItemUtil.java
Created February 24, 2023 18:17
NMS 1.19.3 SPIGOT, Change ItemStack Size
class ChangeMaxStackSize {
private net.minecraft.world.item.ItemStack stack;
private Item nmsItem;
private ItemStack item;
public ChangeMaxStackSize(ItemStack itemStack, int maxStackSize) throws NoSuchFieldException, IllegalAccessException {
this.item = itemStack;
this.stack = CraftItemStack.asNMSCopy(itemStack);
this.nmsItem = stack.o().c();