This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import net.minestom.server.MinecraftServer; | |
| import net.minestom.server.collision.BoundingBox; | |
| import net.minestom.server.collision.CollisionUtils; | |
| import net.minestom.server.collision.PhysicsResult; | |
| import net.minestom.server.coordinate.Pos; | |
| import net.minestom.server.coordinate.Vec; | |
| import net.minestom.server.entity.Entity; | |
| import net.minestom.server.entity.EntityType; | |
| import net.minestom.server.entity.PlayerExtended; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class EntityCollisionUtils { | |
| final static Vec power = new Vec(0.05, 0.05, 0.05); | |
| final static boolean[] isCollidable = new boolean[EntityType.values().size()]; | |
| static { | |
| Arrays.fill(isCollidable, true); | |
| isCollidable[EntityType.ITEM_FRAME.id()] = false; | |
| isCollidable[EntityType.PAINTING.id()] = false; | |
| isCollidable[EntityType.GLOW_ITEM_FRAME.id()] = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.minestom.server.instance; | |
| import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; | |
| import it.unimi.dsi.fastutil.ints.Int2ObjectMap; | |
| import it.unimi.dsi.fastutil.ints.IntIntImmutablePair; | |
| import net.minestom.server.MinecraftServer; | |
| import net.minestom.server.instance.block.Block; | |
| import net.minestom.server.instance.block.BlockHandler; | |
| import net.minestom.server.instance.palette.Palette; | |
| import net.minestom.server.utils.NamespaceID; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func rpCommand(p *SimpleProxy) brigodier.LiteralNodeBuilder { | |
| runCommand := command.Command(func(c *command.Context) error { | |
| player, ok := c.Source.(proxy.Player) | |
| if !ok { | |
| return c.Source.SendMessage(&Text{Content: "You must be a player to run this command."}) | |
| } | |
| rp := proxy.ResourcePackInfo{ | |
| URL: "http://localhost:8080/resourcepack?id=00000000-0000-0000-0000-000000000000" + "&" + strconv.FormatInt(time.Now().Unix(), 10), | |
| ShouldForce: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.worldseed.mobs; | |
| import com.google.common.collect.ImmutableList; | |
| import net.kyori.adventure.text.Component; | |
| import net.minestom.server.MinecraftServer; | |
| import net.minestom.server.collision.BoundingBox; | |
| import net.minestom.server.coordinate.Pos; | |
| import net.minestom.server.entity.*; | |
| import net.minestom.server.network.packet.server.SendablePacket; | |
| import net.minestom.server.network.packet.server.play.PlayerInfoPacket; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package net.minestom.server.collision; | |
| import net.minestom.server.MinecraftServer; | |
| import net.minestom.server.coordinate.Vec; | |
| import net.minestom.server.entity.Entity; | |
| import net.minestom.server.entity.EntityType; | |
| import net.minestom.server.entity.GameMode; | |
| import net.minestom.server.entity.PlayerExtended; | |
| import net.minestom.server.item.ItemStack; | |
| import net.minestom.server.item.Material; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import itertools | |
| values = [-2.24, 0.46, 2.69] | |
| toFind = 0.91 | |
| def solve(vals, target): | |
| counter = 0 | |
| while (counter < 2 ** (len(vals))): | |
| sum = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Extended from 2d implementation found here https://www.gamedev.net/tutorials/programming/general-and-gameplay-programming/swept-aabb-collision-detection-and-response-r3084/ | |
| // Broad-Phasing not implemented but needed to work accurately | |
| #include <iostream> | |
| #include <limits> | |
| #include <algorithm> | |
| #include <initializer_list> | |
| struct Box | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import math | |
| vec = (1.3*4, -2.7*4, 0) | |
| start = (1,1,0) | |
| bb = (2,-3, -1) | |
| bbSize = (1,1,2) | |
| xStep = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void updateLighting(Pos pos, Short level) { | |
| if (pos.blockY() < 0) | |
| return; | |
| int section = pos.blockY() / 16; | |
| int sectionY = pos.blockY() % 16; | |
| int chunkX = pos.blockX() / 16; | |
| int sectionX = pos.blockX() % 16; |
NewerOlder