mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-09-23 11:06:34 +00:00
format everything
This commit is contained in:
@@ -26,9 +26,7 @@ public:
|
||||
static int floor(double v) { return (int)::floor(v); }
|
||||
static int64_t lfloor(double v) { return (int64_t)::floor(v); }
|
||||
|
||||
static int fastFloor(double x) {
|
||||
return (int)(x + 1024.0) - 1024;
|
||||
}
|
||||
static int fastFloor(double x) { return (int)(x + 1024.0) - 1024; }
|
||||
|
||||
static float abs(float v) { return v >= 0.0f ? v : -v; }
|
||||
static int abs(int v) { return v >= 0 ? v : -v; }
|
||||
|
||||
@@ -37,7 +37,8 @@ WeighedRandomItem* WeighedRandom::getRandomItem(
|
||||
return getRandomItem(random, items, getTotalWeight(items));
|
||||
}
|
||||
|
||||
int WeighedRandom::getTotalWeight(const std::vector<WeighedRandomItem*>& items) {
|
||||
int WeighedRandom::getTotalWeight(
|
||||
const std::vector<WeighedRandomItem*>& items) {
|
||||
int totalWeight = 0;
|
||||
for (unsigned int i = 0; i < items.size(); i++) {
|
||||
totalWeight += items[i]->randomWeight;
|
||||
@@ -45,9 +46,9 @@ int WeighedRandom::getTotalWeight(const std::vector<WeighedRandomItem*>& items)
|
||||
return totalWeight;
|
||||
}
|
||||
|
||||
WeighedRandomItem* WeighedRandom::getRandomItem(Random* random,
|
||||
const std::vector<WeighedRandomItem*>& items,
|
||||
int totalWeight) {
|
||||
WeighedRandomItem* WeighedRandom::getRandomItem(
|
||||
Random* random, const std::vector<WeighedRandomItem*>& items,
|
||||
int totalWeight) {
|
||||
if (totalWeight <= 0) {
|
||||
__debugbreak();
|
||||
}
|
||||
@@ -62,7 +63,7 @@ WeighedRandomItem* WeighedRandom::getRandomItem(Random* random,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WeighedRandomItem* WeighedRandom::getRandomItem(Random* random,
|
||||
const std::vector<WeighedRandomItem*>& items) {
|
||||
WeighedRandomItem* WeighedRandom::getRandomItem(
|
||||
Random* random, const std::vector<WeighedRandomItem*>& items) {
|
||||
return getRandomItem(random, items, getTotalWeight(items));
|
||||
}
|
||||
@@ -27,9 +27,9 @@ public:
|
||||
static WeighedRandomItem* getRandomItem(
|
||||
Random* random, std::vector<WeighedRandomItem*>* items);
|
||||
static int getTotalWeight(const std::vector<WeighedRandomItem*>& items);
|
||||
static WeighedRandomItem* getRandomItem(Random* random,
|
||||
const std::vector<WeighedRandomItem*>& items,
|
||||
int totalWeight);
|
||||
static WeighedRandomItem* getRandomItem(Random* random,
|
||||
const std::vector<WeighedRandomItem*>& items);
|
||||
static WeighedRandomItem* getRandomItem(
|
||||
Random* random, const std::vector<WeighedRandomItem*>& items,
|
||||
int totalWeight);
|
||||
static WeighedRandomItem* getRandomItem(
|
||||
Random* random, const std::vector<WeighedRandomItem*>& items);
|
||||
};
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
WeighedTreasure::WeighedTreasure(int itemId, int auxValue, int minCount,
|
||||
int maxCount, int weight)
|
||||
: WeighedRandomItem(weight) {
|
||||
this->item =
|
||||
std::make_shared<ItemInstance>(itemId, 1, auxValue);
|
||||
this->item = std::make_shared<ItemInstance>(itemId, 1, auxValue);
|
||||
this->minCount = minCount;
|
||||
this->maxCount = maxCount;
|
||||
}
|
||||
@@ -21,7 +20,8 @@ WeighedTreasure::WeighedTreasure(std::shared_ptr<ItemInstance> item,
|
||||
this->maxCount = maxCount;
|
||||
}
|
||||
|
||||
void WeighedTreasure::addChestItems(Random* random, const std::vector<WeighedTreasure*>& items,
|
||||
void WeighedTreasure::addChestItems(Random* random,
|
||||
const std::vector<WeighedTreasure*>& items,
|
||||
std::shared_ptr<Container> dest,
|
||||
int numRolls) {
|
||||
for (int r = 0; r < numRolls; r++) {
|
||||
@@ -73,8 +73,8 @@ void WeighedTreasure::addDispenserItems(
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<WeighedTreasure*> WeighedTreasure::addToTreasure(std::vector<WeighedTreasure*>& items,
|
||||
WeighedTreasure* extra) {
|
||||
std::vector<WeighedTreasure*> WeighedTreasure::addToTreasure(
|
||||
std::vector<WeighedTreasure*>& items, WeighedTreasure* extra) {
|
||||
std::vector<WeighedTreasure*> result(items.size() + 1);
|
||||
int i = 0;
|
||||
|
||||
|
||||
@@ -24,11 +24,13 @@ public:
|
||||
WeighedTreasure(std::shared_ptr<ItemInstance> item, int minCount,
|
||||
int maxCount, int weight);
|
||||
|
||||
static void addChestItems(Random* random, const std::vector<WeighedTreasure*>& items,
|
||||
static void addChestItems(Random* random,
|
||||
const std::vector<WeighedTreasure*>& items,
|
||||
std::shared_ptr<Container> dest, int numRolls);
|
||||
static void addDispenserItems(Random* random, const std::vector<WeighedTreasure*>& items,
|
||||
static void addDispenserItems(Random* random,
|
||||
const std::vector<WeighedTreasure*>& items,
|
||||
std::shared_ptr<DispenserTileEntity> dest,
|
||||
int numRolls);
|
||||
static std::vector<WeighedTreasure*> addToTreasure(std::vector<WeighedTreasure*>& items,
|
||||
WeighedTreasure* extra);
|
||||
static std::vector<WeighedTreasure*> addToTreasure(
|
||||
std::vector<WeighedTreasure*>& items, WeighedTreasure* extra);
|
||||
};
|
||||
Reference in New Issue
Block a user