mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-24 10:13:36 +00:00
# Conflicts: # Minecraft.Client/Network/PlayerChunkMap.cpp # Minecraft.Client/Network/PlayerList.cpp # Minecraft.Client/Network/ServerChunkCache.cpp # Minecraft.Client/Platform/Common/Consoles_App.cpp # Minecraft.Client/Platform/Common/DLC/DLCManager.cpp # Minecraft.Client/Platform/Common/GameRules/LevelGenerationOptions.cpp # Minecraft.Client/Platform/Common/GameRules/LevelRuleset.cpp # Minecraft.Client/Platform/Common/Tutorial/Tutorial.cpp # Minecraft.Client/Platform/Common/Tutorial/TutorialTask.cpp # Minecraft.Client/Platform/Common/UI/IUIScene_CreativeMenu.cpp # Minecraft.Client/Platform/Common/UI/UIComponent_Panorama.cpp # Minecraft.Client/Platform/Common/UI/UIController.cpp # Minecraft.Client/Platform/Common/UI/UIController.h # Minecraft.Client/Platform/Extrax64Stubs.cpp # Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Input.h # Minecraft.Client/Platform/Windows64/4JLibs/inc/4J_Storage.h # Minecraft.Client/Player/EntityTracker.cpp # Minecraft.Client/Player/ServerPlayer.cpp # Minecraft.Client/Rendering/EntityRenderers/PlayerRenderer.cpp # Minecraft.Client/Textures/Packs/DLCTexturePack.cpp # Minecraft.Client/Textures/Stitching/StitchedTexture.cpp # Minecraft.Client/Textures/Stitching/TextureMap.cpp # Minecraft.Client/Textures/Textures.cpp # Minecraft.World/Blocks/NotGateTile.cpp # Minecraft.World/Blocks/PressurePlateTile.cpp # Minecraft.World/Blocks/TileEntities/PotionBrewing.cpp # Minecraft.World/Enchantments/EnchantmentHelper.cpp # Minecraft.World/Entities/HangingEntity.cpp # Minecraft.World/Entities/LeashFenceKnotEntity.cpp # Minecraft.World/Entities/LivingEntity.cpp # Minecraft.World/Entities/Mobs/Boat.cpp # Minecraft.World/Entities/Mobs/Minecart.cpp # Minecraft.World/Entities/Mobs/Witch.cpp # Minecraft.World/Entities/SyncedEntityData.cpp # Minecraft.World/Items/LeashItem.cpp # Minecraft.World/Items/PotionItem.cpp # Minecraft.World/Level/BaseMobSpawner.cpp # Minecraft.World/Level/CustomLevelSource.cpp # Minecraft.World/Level/Level.cpp # Minecraft.World/Level/Storage/DirectoryLevelStorage.cpp # Minecraft.World/Level/Storage/McRegionLevelStorage.cpp # Minecraft.World/Level/Storage/RegionFileCache.cpp # Minecraft.World/Player/Player.cpp # Minecraft.World/WorldGen/Biomes/BiomeCache.cpp # Minecraft.World/WorldGen/Features/RandomScatteredLargeFeature.cpp # Minecraft.World/WorldGen/Layers/BiomeOverrideLayer.cpp
71 lines
2.6 KiB
C++
71 lines
2.6 KiB
C++
#include "../../Platform/stdafx.h"
|
|
#include "../../Headers/net.minecraft.h"
|
|
#include "../../Headers/net.minecraft.world.phys.h"
|
|
#include "../../Headers/net.minecraft.world.damagesource.h"
|
|
#include "../../Headers/net.minecraft.world.level.tile.h"
|
|
#include "../../Headers/net.minecraft.world.level.h"
|
|
#include "../../Util/JavaMath.h"
|
|
#include "DragonFireball.h"
|
|
|
|
const double DragonFireball::SPLASH_RANGE = 4.0;
|
|
const double DragonFireball::SPLASH_RANGE_SQ =
|
|
DragonFireball::SPLASH_RANGE * DragonFireball::SPLASH_RANGE;
|
|
|
|
DragonFireball::DragonFireball(Level* level) : Fireball(level) {
|
|
setSize(5 / 16.0f, 5 / 16.0f);
|
|
}
|
|
|
|
DragonFireball::DragonFireball(Level* level, std::shared_ptr<LivingEntity> mob,
|
|
double xa, double ya, double za)
|
|
: Fireball(level, mob, xa, ya, za) {
|
|
setSize(5 / 16.0f, 5 / 16.0f);
|
|
}
|
|
|
|
DragonFireball::DragonFireball(Level* level, double x, double y, double z,
|
|
double xa, double ya, double za)
|
|
: Fireball(level, x, y, z, xa, ya, za) {
|
|
setSize(5 / 16.0f, 5 / 16.0f);
|
|
}
|
|
|
|
void DragonFireball::onHit(HitResult* res) {
|
|
if (!level->isClientSide) {
|
|
AABB aoe = bb.grow(SPLASH_RANGE, SPLASH_RANGE / 2, SPLASH_RANGE);
|
|
std::vector<std::shared_ptr<Entity> >* entitiesOfClass =
|
|
level->getEntitiesOfClass(typeid(LivingEntity), &aoe);
|
|
|
|
if (entitiesOfClass != nullptr && !entitiesOfClass->empty()) {
|
|
// for (Entity e : entitiesOfClass)
|
|
for (auto it = entitiesOfClass->begin();
|
|
it != entitiesOfClass->end(); ++it) {
|
|
// shared_ptr<Entity> e = *it;
|
|
std::shared_ptr<LivingEntity> e =
|
|
std::dynamic_pointer_cast<LivingEntity>(*it);
|
|
double dist = distanceToSqr(e);
|
|
if (dist < SPLASH_RANGE_SQ) {
|
|
double scale = 1.0 - (sqrt(dist) / SPLASH_RANGE);
|
|
if (e == res->entity) {
|
|
scale = 1;
|
|
}
|
|
e->hurt(DamageSource::dragonbreath, 8 * scale);
|
|
}
|
|
}
|
|
}
|
|
delete entitiesOfClass;
|
|
level->levelEvent(LevelEvent::ENDERDRAGON_FIREBALL_SPLASH,
|
|
(int)Math::round(x), (int)Math::round(y),
|
|
(int)Math::round(z), 0);
|
|
|
|
remove();
|
|
}
|
|
}
|
|
|
|
bool DragonFireball::isPickable() { return false; }
|
|
|
|
bool DragonFireball::hurt(DamageSource* source, float damage) { return false; }
|
|
|
|
ePARTICLE_TYPE DragonFireball::getTrailParticleType() {
|
|
return eParticleType_dragonbreath;
|
|
}
|
|
|
|
bool DragonFireball::shouldBurn() { return false; }
|