Cuberite
A lightweight, fast and extensible game server for Minecraft
Functions | Variables
Explodinator Namespace Reference

Functions

static Vector3f AbsoluteToRelative (const Vector3f a_Position, const cChunkCoords a_ChunkPosition)
 Converts an absolute floating-point Position into a Chunk-relative one. More...
 
static bool BlockAlwaysDrops (const BLOCKTYPE a_Block)
 Returns true if block should always drop when exploded. More...
 
static float CalculateEntityExposure (const cChunk &a_Chunk, const cEntity &a_Entity, const Vector3f a_Position, const int a_SquareRadius)
 Calculates the approximate percentage of an Entity's bounding box that is exposed to an explosion centred at Position. More...
 
static void DamageBlocks (cChunk &a_Chunk, const Vector3f a_Position, const int a_Power, const bool a_Fiery, const cEntity *const a_ExplodingEntity)
 Sends out Explosion Lazors (tm) originating from the given position that destroy blocks. More...
 
static void DamageEntities (const cChunk &a_Chunk, const Vector3f a_Position, const int a_Power)
 Applies distance-based damage and knockback to all entities within the explosion's effect range. More...
 
static void DestroyBlock (cChunk &a_Chunk, const Vector3i a_Position, const int a_Power, const bool a_Fiery, const cEntity *const a_ExplodingEntity)
 Work out what should happen when an explosion destroys the given block. More...
 
static void DestructionTrace (cChunk *a_Chunk, Vector3f a_Origin, const Vector3f a_Direction, const int a_Power, const bool a_Fiery, float a_Intensity, const cEntity *const a_ExplodingEntity)
 Traces the path taken by one Explosion Lazor (tm) with given direction and intensity, that will destroy blocks until it is exhausted. More...
 
static float GetExplosionAbsorption (const BLOCKTYPE Block)
 Returns how much of an explosion Destruction Lazor's (tm) intensity the given block attenuates. More...
 
void Kaboom (cWorld &World, Vector3f Position, int Power, bool Fiery, const cEntity *a_ExplodingEntity)
 Creates an explosion of Power, centred at Position, with ability to set fires as provided. More...
 
static void LagTheClient (cChunk &a_Chunk, const Vector3f a_Position, const int a_Power)
 Sends an explosion packet to all clients in the given chunk. More...
 
static float RandomIntensity (MTRand &a_Random, const int a_Power)
 Returns a random intensity for an Explosion Lazor (tm) as a function of the explosion's power. More...
 
static Vector3f RebaseRelativePosition (const cChunkCoords a_From, const cChunkCoords a_To, const Vector3f a_Position)
 Make a From Chunk-relative Position into a To Chunk-relative position. More...
 
static void SetBlock (cWorld &a_World, cChunk &a_Chunk, const Vector3i a_AbsolutePosition, const Vector3i a_RelativePosition, const BLOCKTYPE a_DestroyedBlock, const BLOCKTYPE a_NewBlock, const cEntity *const a_ExplodingEntity)
 Sets the block at the given position, updating surroundings. More...
 

Variables

static const auto BoundingBoxStepUnit = 0.5
 
static const auto KnockbackFactor = 25U
 
static const auto StepAttenuation = 0.225f
 
static const auto StepUnit = 0.3f
 
static const auto TraceCubeSideLength = 16U
 

Function Documentation

◆ AbsoluteToRelative()

static Vector3f Explodinator::AbsoluteToRelative ( const Vector3f  a_Position,
const cChunkCoords  a_ChunkPosition 
)
static

Converts an absolute floating-point Position into a Chunk-relative one.

Definition at line 26 of file Explodinator.cpp.

◆ BlockAlwaysDrops()

static bool Explodinator::BlockAlwaysDrops ( const BLOCKTYPE  a_Block)
static

Returns true if block should always drop when exploded.

Currently missing conduits from 1.13

Definition at line 242 of file Explodinator.cpp.

◆ CalculateEntityExposure()

static float Explodinator::CalculateEntityExposure ( const cChunk a_Chunk,
const cEntity a_Entity,
const Vector3f  a_Position,
const int  a_SquareRadius 
)
static

Calculates the approximate percentage of an Entity's bounding box that is exposed to an explosion centred at Position.

Definition at line 163 of file Explodinator.cpp.

◆ DamageBlocks()

static void Explodinator::DamageBlocks ( cChunk a_Chunk,
const Vector3f  a_Position,
const int  a_Power,
const bool  a_Fiery,
const cEntity *const  a_ExplodingEntity 
)
static

Sends out Explosion Lazors (tm) originating from the given position that destroy blocks.

Definition at line 383 of file Explodinator.cpp.

◆ DamageEntities()

static void Explodinator::DamageEntities ( const cChunk a_Chunk,
const Vector3f  a_Position,
const int  a_Power 
)
static

Applies distance-based damage and knockback to all entities within the explosion's effect range.

Definition at line 205 of file Explodinator.cpp.

◆ DestroyBlock()

static void Explodinator::DestroyBlock ( cChunk a_Chunk,
const Vector3i  a_Position,
const int  a_Power,
const bool  a_Fiery,
const cEntity *const  a_ExplodingEntity 
)
static

Work out what should happen when an explosion destroys the given block.

Tasks include lighting TNT, dropping pickups, setting fire and flinging shrapnel according to Minecraft rules. OK, mostly Minecraft rules.

Definition at line 277 of file Explodinator.cpp.

◆ DestructionTrace()

static void Explodinator::DestructionTrace ( cChunk a_Chunk,
Vector3f  a_Origin,
const Vector3f  a_Direction,
const int  a_Power,
const bool  a_Fiery,
float  a_Intensity,
const cEntity *const  a_ExplodingEntity 
)
static

Traces the path taken by one Explosion Lazor (tm) with given direction and intensity, that will destroy blocks until it is exhausted.

Definition at line 333 of file Explodinator.cpp.

◆ GetExplosionAbsorption()

static float Explodinator::GetExplosionAbsorption ( const BLOCKTYPE  Block)
static

Returns how much of an explosion Destruction Lazor's (tm) intensity the given block attenuates.

Values are scaled as 0.3 * (0.3 + Wiki) since some compilers miss the constant folding optimisation. Wiki values are https://minecraft.wiki/w/Explosion#Blast_resistance as of 2021-02-06.

Definition at line 45 of file Explodinator.cpp.

◆ Kaboom()

void Explodinator::Kaboom ( cWorld World,
Vector3f  Position,
int  Power,
bool  Fiery,
const cEntity a_ExplodingEntity 
)

Creates an explosion of Power, centred at Position, with ability to set fires as provided.

For maximum efficiency, Position should be in the centre of the entity or block that exploded. The entity pointer is used to trigger OnBreak for the destroyed blocks. Kaboom indeed, you drunken wretch.

Definition at line 432 of file Explodinator.cpp.

◆ LagTheClient()

static void Explodinator::LagTheClient ( cChunk a_Chunk,
const Vector3f  a_Position,
const int  a_Power 
)
static

Sends an explosion packet to all clients in the given chunk.

Definition at line 424 of file Explodinator.cpp.

◆ RandomIntensity()

static float Explodinator::RandomIntensity ( MTRand a_Random,
const int  a_Power 
)
static

Returns a random intensity for an Explosion Lazor (tm) as a function of the explosion's power.

Definition at line 377 of file Explodinator.cpp.

◆ RebaseRelativePosition()

static Vector3f Explodinator::RebaseRelativePosition ( const cChunkCoords  a_From,
const cChunkCoords  a_To,
const Vector3f  a_Position 
)
static

Make a From Chunk-relative Position into a To Chunk-relative position.

Definition at line 32 of file Explodinator.cpp.

◆ SetBlock()

static void Explodinator::SetBlock ( cWorld a_World,
cChunk a_Chunk,
const Vector3i  a_AbsolutePosition,
const Vector3i  a_RelativePosition,
const BLOCKTYPE  a_DestroyedBlock,
const BLOCKTYPE  a_NewBlock,
const cEntity *const  a_ExplodingEntity 
)
static

Sets the block at the given position, updating surroundings.

Definition at line 260 of file Explodinator.cpp.

Variable Documentation

◆ BoundingBoxStepUnit

const auto Explodinator::BoundingBoxStepUnit = 0.5
static

Definition at line 23 of file Explodinator.cpp.

◆ KnockbackFactor

const auto Explodinator::KnockbackFactor = 25U
static

Definition at line 20 of file Explodinator.cpp.

◆ StepAttenuation

const auto Explodinator::StepAttenuation = 0.225f
static

Definition at line 21 of file Explodinator.cpp.

◆ StepUnit

const auto Explodinator::StepUnit = 0.3f
static

Definition at line 19 of file Explodinator.cpp.

◆ TraceCubeSideLength

const auto Explodinator::TraceCubeSideLength = 16U
static

Definition at line 22 of file Explodinator.cpp.