mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-26 21:26:38 +01:00
Patch Notes: Blocks + Colored shulker boxes + Concrete powder + Concrete + Glazed terracotta Items + Shulker shell + Iron nugget UI Changes + Added Custom Controls to Keyboard & Mouse, as well as Controller + Added Custom SuperFlat + Added Edit Server Menu + Added Firework Crafting Feature Changes + Host Options + Added Pick Block + Added off-hand slot for maps and arrows. Bug Fixes & changes + TU47: Banner hitbox wrong (and inventory model fixed) + TU47/48: Ice not melting properly + TU48: Dead bushes not dropping sticks + TU48: Guardians and polar bears not dropping cooked fish when on fire + TU48: Bonus chest missing saplings and seeds + TU48: Frosted ice obtainable + TU48: Hoppers not collecting items + TU48: Wither skeletons spawning in 2-high gaps + TU48: End crystals exploding with “TNT Explodes” off + TU48: Tamed ocelots staying hostile + TU48: Signs not placing on tall grass + TU51: Skeleton hitbox wrong + TU53: Fall damage in shallow water + TU53: Squids not spawning in man-made pools + Elytra has been improved to be more accurate to the source material + Removed Spectral Arrow from crafting + Fixed several broken item descriptions + You can no longer cook Pufferfish or Clownfish + Fixed scaling issue with paperdoll and chat + Iron and gold armor can now be smelted into nuggets. + More items can now be used as fuel in a furnace. + Using a firework rocket while gliding with elytra will now give the player a boost. + Changed the color of dyes, wool, carpets, and banners. + Reordered all colored blocks and items in the Creative inventory. Banners now have the same order of colors as all other colored blocks and items. + Fishing rods can now hook on entities without causing knockback or pseudo-damage. + Fixed banner crafting + Fixed Map colors for certain blocks + Fixed Path block height + Fixed String block issues + Fixed Item frame culling. + Fixed Tutorial world NBT/Block State issues + Fixed World Slider + Fixed Enderman AI + Fixed Player animation bug + HUD Flash text changes + Generation accuracy changes + Many other small accuracy changes and fixes
121 lines
3.8 KiB
C++
121 lines
3.8 KiB
C++
#include "stdafx.h"
|
|
#include "net.minecraft.world.level.h"
|
|
#include "net.minecraft.world.entity.player.h"
|
|
#include "net.minecraft.world.level.tile.h"
|
|
#include "net.minecraft.world.level.tile.entity.h"
|
|
#include "net.minecraft.world.effect.h"
|
|
#include "net.minecraft.h"
|
|
#include "net.minecraft.world.h"
|
|
#include "FishFoodItem.h"
|
|
|
|
const unsigned int FishFoodItem::NAMES[FISH_COUNT] = { IDS_ITEM_FISH_RAW, IDS_ITEM_SALMON_RAW, IDS_ITEM_CLOWNFISH, IDS_ITEM_PUFFERFISH };
|
|
const unsigned int FishFoodItem::COOKED_NAMES[FISH_COUNT] = { IDS_ITEM_FISH_COOKED, IDS_ITEM_SALMON_COOKED, NULL, NULL };
|
|
|
|
const unsigned int FishFoodItem::DESCRIPTIONS[FISH_COUNT] = { IDS_DESC_FISH_RAW, IDS_DESC_SALMON_RAW, IDS_DESC_CLOWNFISH, IDS_DESC_PUFFERFISH };
|
|
const unsigned int FishFoodItem::COOKED_DESCRIPTIONS[FISH_COUNT] = { IDS_DESC_FISH_COOKED, IDS_DESC_SALMON_COOKED, NULL, NULL };
|
|
// making cod temporarily fish
|
|
const FishType FISH_TYPES[] = {
|
|
{ 0, L"fish", 2, 0.1f, 5, 0.6f, true },
|
|
{ 1, L"salmon", 2, 0.1f, 6, 0.8f, true },
|
|
{ 2, L"clownfish", 1, 0.1f, 0, 0.0f, false },
|
|
{ 3, L"pufferfish", 1, 0.1f, 0, 0.0f, false },
|
|
};
|
|
|
|
FishFoodItem::FishFoodItem(int id, bool cooked) : FoodItem(id, 0, 0, true)
|
|
{
|
|
this->cooked = cooked;
|
|
auxValue = 0;
|
|
}
|
|
|
|
void FishFoodItem::addEatEffect(shared_ptr<ItemInstance> instance, Level* level, shared_ptr<Player> player)
|
|
{
|
|
if (!level->isClientSide)
|
|
{
|
|
if (FISH_TYPES[auxValue].name == L"pufferfish") {
|
|
player->addEffect(new MobEffectInstance(MobEffect::poison->id, 60 * SharedConstants::TICKS_PER_SECOND, 3));
|
|
player->addEffect(new MobEffectInstance(MobEffect::hunger->id, 15 * SharedConstants::TICKS_PER_SECOND, 2));
|
|
player->addEffect(new MobEffectInstance(MobEffect::confusion->id, 15 * SharedConstants::TICKS_PER_SECOND, 1));
|
|
}
|
|
}
|
|
FoodItem::addEatEffect(instance, level, player);
|
|
}
|
|
|
|
shared_ptr<ItemInstance> FishFoodItem::use(shared_ptr<ItemInstance> instance, Level* level, shared_ptr<Player> player)
|
|
{
|
|
// really really REALLY janky way of doing this
|
|
auxValue = instance->getAuxValue();
|
|
return FoodItem::use(instance, level, player);
|
|
}
|
|
|
|
float FishFoodItem::getSaturationModifier()
|
|
{
|
|
return this->cooked && FISH_TYPES[auxValue].cookable ? FISH_TYPES[auxValue].cookedSaturationModifier : FISH_TYPES[auxValue].uncookedSaturationModifier;
|
|
}
|
|
|
|
int FishFoodItem::getNutrition()
|
|
{
|
|
return this->cooked && FISH_TYPES[auxValue].cookable ? FISH_TYPES[auxValue].cookedHealAmount : FISH_TYPES[auxValue].uncookedHealAmount;
|
|
}
|
|
|
|
Icon* FishFoodItem::getIcon(int itemAuxValue)
|
|
{
|
|
if (itemAuxValue < 0 || itemAuxValue >= FISH_COUNT)
|
|
{
|
|
itemAuxValue = 0;
|
|
}
|
|
|
|
if (cooked && FISH_TYPES[itemAuxValue].cookable) {
|
|
return icons_cooked[itemAuxValue];
|
|
}
|
|
return icons_raw[itemAuxValue];
|
|
}
|
|
|
|
unsigned int FishFoodItem::getDescriptionId(int iData)
|
|
{
|
|
if (iData < 0 || iData >= FISH_COUNT)
|
|
{
|
|
iData = 0;
|
|
}
|
|
|
|
if (cooked)
|
|
return COOKED_DESCRIPTIONS[iData];
|
|
|
|
return DESCRIPTIONS[iData];
|
|
}
|
|
|
|
unsigned int FishFoodItem::getDescriptionId(shared_ptr<ItemInstance> instance)
|
|
{
|
|
auxValue = instance->getAuxValue();
|
|
if (auxValue < 0 || auxValue >= FISH_COUNT)
|
|
{
|
|
auxValue = 0;
|
|
}
|
|
|
|
if (cooked) {
|
|
return COOKED_NAMES[auxValue];
|
|
}
|
|
|
|
return NAMES[auxValue];
|
|
}
|
|
|
|
unsigned int FishFoodItem::getUseDescriptionId(shared_ptr<ItemInstance> instance)
|
|
{
|
|
int data = instance != nullptr ? instance->getAuxValue() : 0;
|
|
if (data < 0 || data >= FISH_COUNT) data = 0;
|
|
unsigned int id = cooked ? COOKED_DESCRIPTIONS[data] : DESCRIPTIONS[data];
|
|
return id != 0 ? id : Item::getUseDescriptionId(instance);
|
|
}
|
|
|
|
void FishFoodItem::registerIcons(IconRegister* iconRegister)
|
|
{
|
|
for (int i = 0; i < FISH_COUNT; i++)
|
|
{
|
|
if (FISH_TYPES[i].cookable) {
|
|
icons_raw[i] = iconRegister->registerIcon(FISH_TYPES[i].name + L"Raw");
|
|
icons_cooked[i] = iconRegister->registerIcon(FISH_TYPES[i].name + L"Cooked");
|
|
}
|
|
else {
|
|
icons_raw[i] = iconRegister->registerIcon(FISH_TYPES[i].name);
|
|
}
|
|
}
|
|
} |