mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-22 15:22:56 +01:00
Added custom block drag support
This commit is contained in:
parent
ba892ced05
commit
e62a837bf0
@ -568,8 +568,10 @@ public class Entity implements Viewable, Tickable, EventHandler, DataContainer,
|
||||
float drag;
|
||||
if (onGround) {
|
||||
final BlockPosition blockPosition = position.toBlockPosition();
|
||||
if (false) {
|
||||
// TODO: Handle drag for CustomBlock
|
||||
final Block block = finalChunk.getBlock(blockPosition);
|
||||
final BlockHandler handler = block.getHandler();
|
||||
if (handler != null) {
|
||||
drag = handler.getDrag(instance, block, blockPosition);
|
||||
} else {
|
||||
// Default ground drag
|
||||
drag = 0.5f;
|
||||
|
@ -10,7 +10,7 @@ import net.minestom.server.entity.pathfinding.PFColumnarSpace;
|
||||
import net.minestom.server.event.player.PlayerChunkLoadEvent;
|
||||
import net.minestom.server.event.player.PlayerChunkUnloadEvent;
|
||||
import net.minestom.server.instance.block.Block;
|
||||
import net.minestom.server.instance.block.BlockManager;
|
||||
import net.minestom.server.instance.block.BlockGetter;
|
||||
import net.minestom.server.network.packet.server.play.ChunkDataPacket;
|
||||
import net.minestom.server.network.packet.server.play.UpdateLightPacket;
|
||||
import net.minestom.server.network.player.PlayerConnection;
|
||||
@ -47,9 +47,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* You generally want to avoid storing references of this object as this could lead to a huge memory leak,
|
||||
* you should store the chunk coordinates instead.
|
||||
*/
|
||||
public abstract class Chunk implements Viewable, Tickable, DataContainer {
|
||||
public abstract class Chunk implements BlockGetter, Viewable, Tickable, DataContainer {
|
||||
|
||||
protected static final BlockManager BLOCK_MANAGER = MinecraftServer.getBlockManager();
|
||||
protected static final BiomeManager BIOME_MANAGER = MinecraftServer.getBiomeManager();
|
||||
|
||||
public static final int CHUNK_SIZE_X = 16;
|
||||
@ -124,16 +123,6 @@ public abstract class Chunk implements Viewable, Tickable, DataContainer {
|
||||
@Override
|
||||
public abstract void tick(long time);
|
||||
|
||||
/**
|
||||
* Gets the block at a position.
|
||||
*
|
||||
* @param x the block X
|
||||
* @param y the block Y
|
||||
* @param z the block Z
|
||||
* @return the block at the position
|
||||
*/
|
||||
public abstract @NotNull Block getBlock(int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Gets all the block entities in this chunk.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user