feat: TU19 (Dec 2014) Features & Content (#155)

* try to resolve merge conflict

* feat: TU19 (Dec 2014) Features & Content (#32)

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
daoge
2026-03-03 03:04:10 +08:00
committed by GitHub
parent 84c31a2331
commit b3feddfef3
2069 changed files with 264842 additions and 139522 deletions

View File

@@ -6,6 +6,7 @@
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.item.h"
#include "net.minecraft.world.entity.h"
#include "net.minecraft.world.entity.ai.attributes.h"
#include "net.minecraft.world.entity.ai.goal.h"
#include "net.minecraft.world.entity.ai.navigation.h"
#include "net.minecraft.world.entity.item.h"
@@ -23,23 +24,20 @@ Pig::Pig(Level *level) : Animal( level )
// 4J Stu - This function call had to be moved here from the Entity ctor to ensure that
// the derived version of the function is called
this->defineSynchedData();
registerAttributes();
setHealth(getMaxHealth());
// 4J Stu - This function call had to be moved here from the Entity ctor to ensure that the derived version of the function is called
health = getMaxHealth();
this->textureIdx = TN_MOB_PIG; // 4J - was L"/mob/pig.png";
this->setSize(0.9f, 0.9f);
setSize(0.9f, 0.9f);
getNavigation()->setAvoidWater(true);
float walkSpeed = 0.25f;
goalSelector.addGoal(0, new FloatGoal(this));
goalSelector.addGoal(1, new PanicGoal(this, 0.38f));
goalSelector.addGoal(2, controlGoal = new ControlledByPlayerGoal(this, 0.34f, walkSpeed));
goalSelector.addGoal(3, new BreedGoal(this, walkSpeed));
goalSelector.addGoal(4, new TemptGoal(this, 0.3f, Item::carrotOnAStick_Id, false));
goalSelector.addGoal(4, new TemptGoal(this, 0.25f, Item::carrots_Id, false));
goalSelector.addGoal(5, new FollowParentGoal(this, 0.28f));
goalSelector.addGoal(6, new RandomStrollGoal(this, walkSpeed));
goalSelector.addGoal(1, new PanicGoal(this, 1.25));
goalSelector.addGoal(2, controlGoal = new ControlledByPlayerGoal(this, 0.3f, 0.25f));
goalSelector.addGoal(3, new BreedGoal(this, 1.0));
goalSelector.addGoal(4, new TemptGoal(this, 1.2, Item::carrotOnAStick_Id, false));
goalSelector.addGoal(4, new TemptGoal(this, 1.2, Item::carrots_Id, false));
goalSelector.addGoal(5, new FollowParentGoal(this, 1.1));
goalSelector.addGoal(6, new RandomStrollGoal(this, 1.0));
goalSelector.addGoal(7, new LookAtPlayerGoal(this, typeid(Player), 6));
goalSelector.addGoal(8, new RandomLookAroundGoal(this));
}
@@ -49,9 +47,17 @@ bool Pig::useNewAi()
return true;
}
int Pig::getMaxHealth()
void Pig::registerAttributes()
{
return 10;
Animal::registerAttributes();
getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(10);
getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.25f);
}
void Pig::newServerAiStep()
{
Animal::newServerAiStep();
}
bool Pig::canBeControlledByRider()
@@ -94,9 +100,14 @@ int Pig::getDeathSound()
return eSoundType_MOB_PIG_DEATH;
}
bool Pig::interact(shared_ptr<Player> player)
void Pig::playStepSound(int xt, int yt, int zt, int t)
{
if(!Animal::interact(player))
playSound(eSoundType_MOB_PIG_STEP, 0.15f, 1);
}
bool Pig::mobInteract(shared_ptr<Player> player)
{
if(!Animal::mobInteract(player))
{
if (hasSaddle() && !level->isClientSide && (rider.lock() == NULL || rider.lock() == player))
{
@@ -162,7 +173,7 @@ void Pig::thunderHit(const LightningBolt *lightningBolt)
void Pig::causeFallDamage(float distance)
{
Animal::causeFallDamage(distance);
if (distance > 5 && dynamic_pointer_cast<Player>( rider.lock() ) != NULL)
if ( (distance > 5) && rider.lock() != NULL && rider.lock()->instanceof(eTYPE_PLAYER) )
{
(dynamic_pointer_cast<Player>(rider.lock()))->awardStat(GenericStats::flyPig(),GenericStats::param_flyPig());
}