Fixes/Changes

Aphalaf Boss, Aphalaf Plant, and Dark Evupul can now attack all entities instead of just the player; they still only target the player though.
Packed Glass now has infinite color possibilities depending on the position it is placed.
Removed some redundant files.
This commit is contained in:
DeadVoxelx
2026-05-09 15:09:16 -04:00
committed by GitHub
15 changed files with 31 additions and 306 deletions

View File

@@ -32,7 +32,7 @@ AphalafBoss::AphalafBoss(Level *level) : Monster( level )
fireImmune = true;
getNavigation()->setAvoidWater(true);
goalSelector.addGoal(3, new MeleeAttackGoal(this, eTYPE_PLAYER, 1.0, true));
goalSelector.addGoal(3, new MeleeAttackGoal(this, 1.0, true));
goalSelector.addGoal(8, new RandomLookAroundGoal(this));
targetSelector.addGoal(1, new HurtByTargetGoal(this, true));
@@ -66,6 +66,14 @@ bool AphalafBoss::hurt(DamageSource *source, float dmg)
{
return false;
}
if (directEntity != nullptr && directEntity->GetType() == eTYPE_ENDERMAN)
{
return false;
}
if (directEntity != nullptr && directEntity->GetType() == eTYPE_WHITE_ENDERMAN)
{
return false;
}
if (Monster::hurt(source, dmg))
{
@@ -196,4 +204,4 @@ void AphalafBoss::explode2()
level->explode(shared_from_this(), x - 14, y, z + 14, r, false);
level->explode(shared_from_this(), x - 14, y, z - 14, r, false);
level->explode(shared_from_this(), x + 14, y, z - 14, r, false);
}
}

View File

@@ -32,7 +32,7 @@ AphalafPlant::AphalafPlant(Level *level) : Monster( level )
xpReward = Enemy::XP_REWARD_MEDIUM;
getNavigation()->setAvoidWater(true);
goalSelector.addGoal(3, new MeleeAttackGoal(this, eTYPE_PLAYER, 1.0, true));
goalSelector.addGoal(3, new MeleeAttackGoal(this, 1.0, true));
goalSelector.addGoal(8, new RandomLookAroundGoal(this));
targetSelector.addGoal(1, new HurtByTargetGoal(this, true));
@@ -208,4 +208,4 @@ MobGroupData* AphalafPlant::finalizeMobSpawn(MobGroupData* groupData, int extraD
}
return groupData;
}
}

View File

@@ -36,7 +36,7 @@ EvupulDark::EvupulDark(Level *level) : FlyingMonster( level )
getNavigation()->setAvoidWater(true);
goalSelector.addGoal(0, new FloatGoal(this));
goalSelector.addGoal(2, new LeapAtTargetGoal(this, 0.4));
goalSelector.addGoal(3, new MeleeAttackGoal(this, eTYPE_PLAYER, 1.0, false));
goalSelector.addGoal(3, new MeleeAttackGoal(this, 1.0, false));
goalSelector.addGoal(6, new RandomStrollGoal(this, 1.0));
goalSelector.addGoal(7, new LookAtPlayerGoal(this, typeid(Player), 8));

View File

@@ -1,21 +0,0 @@
#include "stdafx.h"
#include "net.minecraft.world.entity.h"
#include "net.minecraft.world.phys.h"
#include "HellSandTile.h"
HellSandTile::HellSandTile(int id) : Tile(id, Material::sand)
{
}
AABB *HellSandTile::getAABB(Level *level, int x, int y, int z)
{
float r = 2 / 16.0f;
return AABB::newTemp(x, y, z, x + 1, y + 1 - r, z + 1);
}
void HellSandTile::entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
{
entity->xd*=0.4;
entity->zd*=0.4;
}

View File

@@ -1,11 +0,0 @@
#pragma once
#include "Tile.h"
#include "Definitions.h"
class HellSandTile : public Tile
{
public:
HellSandTile(int id);
virtual AABB *getAABB(Level *level, int x, int y, int z);
virtual void entityInside(Level *level, int x, int y, int z, shared_ptr<Entity> entity);
};

View File

@@ -1,6 +0,0 @@
#include "stdafx.h"
#include "HellStoneTile.h"
HellStoneTile::HellStoneTile(int id) : Tile(id, Material::stone)
{
}

View File

@@ -1,8 +0,0 @@
#pragma once
#include "Tile.h"
class HellStoneTile : public Tile
{
public:
HellStoneTile(int id);
};

View File

@@ -1,22 +0,0 @@
#include "stdafx.h"
#include "LightGemTile.h"
#include "net.minecraft.world.item.h"
LightGemTile::LightGemTile(int id, Material *material) : Tile(id, material)
{
}
int LightGemTile::getResourceCountForLootBonus(int bonusLevel, Random *random)
{
return Mth::clamp(getResourceCount(random) + random->nextInt(bonusLevel + 1), 1, 4);
}
int LightGemTile::getResourceCount(Random *random)
{
return 2 + random->nextInt(3);
}
int LightGemTile::getResource(int data, Random *random, int playerBonusLevel)
{
return Item::yellowDust->id;
}

View File

@@ -1,13 +0,0 @@
#pragma once
#include "Tile.h"
class Random;
class LightGemTile : public Tile
{
public:
LightGemTile(int id, Material *material);
virtual int getResourceCountForLootBonus(int bonusLevel, Random *random);
virtual int getResourceCount(Random *random);
virtual int getResource(int data, Random *random, int playerBonusLevel);
};

View File

@@ -1,122 +0,0 @@
#include "stdafx.h"
#include "NetherStalkTile.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.biome.h"
#include "net.minecraft.world.item.h"
#include "net.minecraft.world.h"
const wstring NetherStalkTile::TEXTURE_NAMES[] = { L"netherStalk_0", L"netherStalk_1", L"netherStalk_2" };
NetherStalkTile::NetherStalkTile(int id) : Bush(id)
{
setTicking(true);
updateDefaultShape();
icons = NULL;
}
// 4J Added override
void NetherStalkTile::updateDefaultShape()
{
float ss = 0.5f;
this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.25f, 0.5f + ss);
}
bool NetherStalkTile::mayPlaceOn(int tile)
{
return tile == Tile::hellSand_Id;
}
// Brought forward to fix #60073 - TU7: Content: Gameplay: Nether Warts cannot be placed next to each other in the Nether
bool NetherStalkTile::canSurvive(Level *level, int x, int y, int z)
{
return mayPlaceOn(level->getTile(x, y - 1, z));
}
void NetherStalkTile::tick(Level *level, int x, int y, int z, Random *random)
{
int age = level->getData(x, y, z);
if (age < MAX_AGE)
{
//Biome *biome = biomeSource->getBiome(x, z);
//if (dynamic_cast<HellBiome *>(biome) != NULL)
//{
if (random->nextInt(10) == 0)
{
age++;
level->setData(x, y, z, age);
}
//}
}
Bush::tick(level, x, y, z, random);
}
void NetherStalkTile::growCropsToMax(Level *level, int x, int y, int z)
{
level->setData(x, y, z, MAX_AGE);
}
Icon *NetherStalkTile::getTexture(int face, int data)
{
if (data >= MAX_AGE)
{
return icons[2];
}
if (data > 0)
{
return icons[1];
}
return icons[0];
}
int NetherStalkTile::getRenderShape()
{
return Tile::SHAPE_ROWS;
}
void NetherStalkTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus)
{
if (level->isClientSide)
{
return;
}
int count = 1;
if (data >= MAX_AGE)
{
count = 2 + level->random->nextInt(3);
if (playerBonus > 0)
{
count += level->random->nextInt(playerBonus + 1);
}
}
for (int i = 0; i < count; i++)
{
popResource(level, x, y, z, shared_ptr<ItemInstance>(new ItemInstance(Item::netherStalkSeeds)));
}
}
int NetherStalkTile::getResource(int data, Random *random, int playerBonusLevel)
{
return 0;
}
int NetherStalkTile::getResourceCount(Random *random)
{
return 0;
}
int NetherStalkTile::cloneTileId(Level *level, int x, int y, int z)
{
return Item::netherStalkSeeds_Id;
}
void NetherStalkTile::registerIcons(IconRegister *iconRegister)
{
icons = new Icon*[NETHER_STALK_TEXTURE_COUNT];
for (int i = 0; i < NETHER_STALK_TEXTURE_COUNT; i++)
{
icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]);
}
}

View File

@@ -1,33 +0,0 @@
#pragma once
#include "Bush.h"
class ChunkRebuildData;
class NetherStalkTile : public Bush
{
friend class ChunkRebuildData;
private:
static const int MAX_AGE = 3;
static const int NETHER_STALK_TEXTURE_COUNT = 3;
static const wstring TEXTURE_NAMES[];
Icon **icons;
public:
NetherStalkTile(int id);
virtual void updateDefaultShape(); // 4J Added override
virtual bool mayPlaceOn(int tile);
// Brought forward to fix #60073 - TU7: Content: Gameplay: Nether Warts cannot be placed next to each other in the Nether
virtual bool canSurvive(Level *level, int x, int y, int z);
virtual void tick(Level *level, int x, int y, int z, Random *random);
virtual void growCropsToMax(Level *level, int x, int y, int z);
virtual Icon *getTexture(int face, int data);
virtual int getRenderShape();
virtual void spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonus);
virtual int getResource(int data, Random *random, int playerBonusLevel);
virtual int getResourceCount(Random *random);
virtual int cloneTileId(Level *level, int x, int y, int z);
void registerIcons(IconRegister *iconRegister);
};

View File

@@ -34,11 +34,15 @@ void NetherWartTile::tick(Level *level, int x, int y, int z, Random *random)
int age = level->getData(x, y, z);
if (age < MAX_AGE)
{
//Biome *biome = biomeSource->getBiome(x, z);
//if (dynamic_cast<HellBiome *>(biome) != NULL)
//{
if (random->nextInt(10) == 0)
{
age++;
level->setData(x, y, z, age, Tile::UPDATE_CLIENTS);
}
//}
}
Bush::tick(level, x, y, z, random);

View File

@@ -14,4 +14,14 @@ int PackedGlassTile::getResourceCount(Random *random)
shared_ptr<ItemInstance> PackedGlassTile::getSilkTouchItemInstance(int data)
{
return shared_ptr<ItemInstance>(new ItemInstance(Tile::blueIce));
}
}
int PackedGlassTile::getColor(LevelSource *level, int x, int y, int z)
{
return (x * x * 3187961 + x * 987243 + y * y * 43297126 + y * 987121 + z * z * 927469861 + z * 1861) & 0xffffff;
}
int PackedGlassTile::getColor(LevelSource *level, int x, int y, int z, int data)
{
return (x * x * 3187961 + x * 987243 + y * y * 43297126 + y * 987121 + z * z * 927469861 + z * 1861) & 0xffffff;
}

View File

@@ -10,4 +10,6 @@ protected:
public:
virtual int getResourceCount(Random *random);
};
virtual int getColor(LevelSource *level, int x, int y, int z);
virtual int getColor(LevelSource *level, int x, int y, int z, int data);
};

View File

@@ -1,63 +0,0 @@
#include "stdafx.h"
#include "SkyIslandDimension.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.level.biome.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.levelgen.h"
void SkyIslandDimension::init()
{
biomeSource = new FixedBiomeSource(Biome::sky, 0.5f, 0);
id = 1;
}
ChunkSource *SkyIslandDimension::createRandomLevelSource() const
{
return new SkyIslandRandomLevelSource(level, level->getSeed());
}
float SkyIslandDimension::getTimeOfDay(int64_t time, float a) const
{
return 0.0f;
}
float *SkyIslandDimension::getSunriseColor(float td, float a)
{
return nullptr;
}
Vec3 *SkyIslandDimension::getFogColor(float td, float a) const
{
int fogColor = 0x8080a0;
float br = Mth::cos(td * PI * 2) * 2 + 0.5f;
if (br < 0.0f) br = 0.0f;
if (br > 1.0f) br = 1.0f;
float r = ((fogColor >> 16) & 0xff) / 255.0f;
float g = ((fogColor >> 8) & 0xff) / 255.0f;
float b = ((fogColor) & 0xff) / 255.0f;
r *= br * 0.94f + 0.06f;
g *= br * 0.94f + 0.06f;
b *= br * 0.91f + 0.09f;
return Vec3::newTemp(r, g, b);
}
bool SkyIslandDimension::hasGround()
{
return false;
}
float SkyIslandDimension::getCloudHeight()
{
return 8;
}
bool SkyIslandDimension::isValidSpawn(int x, int z) const
{
int topTile = level->getTopTile(x, z);
if (topTile == 0) return false;
return Tile::tiles[topTile]->material->blocksMotion();
}