mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-30 04:29:05 +00:00
Fix loot
This commit is contained in:
@@ -94,8 +94,16 @@ public class IrisCompat
|
||||
return txf;
|
||||
}
|
||||
|
||||
int nomore = 64;
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(nomore < 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
}
|
||||
|
||||
nomore--;
|
||||
if(err-- <= 0)
|
||||
{
|
||||
break;
|
||||
@@ -127,9 +135,17 @@ public class IrisCompat
|
||||
{
|
||||
return tx.getType();
|
||||
}
|
||||
nomore = 64;
|
||||
|
||||
searching: while(true)
|
||||
{
|
||||
if(nomore < 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
}
|
||||
|
||||
nomore--;
|
||||
|
||||
if(err-- <= 0)
|
||||
{
|
||||
return B.parseBlockDataOrNull("STONE").getType();
|
||||
|
||||
@@ -217,14 +217,14 @@ public class IrisLoot
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
public ItemStack get(boolean debug, IrisLootTable table, RNG rng, int x, int y, int z)
|
||||
public ItemStack get(boolean debug, boolean giveSomething, IrisLootTable table, RNG rng, int x, int y, int z)
|
||||
{
|
||||
if(debug)
|
||||
{
|
||||
chance.reset();
|
||||
}
|
||||
|
||||
if(chance.aquire(() -> NoiseStyle.STATIC.create(rng)).fit(1, rarity * table.getRarity(), x, y, z) == 1)
|
||||
if(giveSomething || chance.aquire(() -> NoiseStyle.STATIC.create(rng)).fit(1, rarity * table.getRarity(), x, y, z) == 1)
|
||||
{
|
||||
if(getType() == null)
|
||||
{
|
||||
|
||||
@@ -39,14 +39,19 @@ public class IrisLootTable extends IrisRegistrant
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum amount of loot that can be picked in this table at a time.")
|
||||
private int maxPicked = 3;
|
||||
private int maxPicked = 5;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The minimum amount of loot that can be picked in this table at a time.")
|
||||
private int minPicked = 1;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The loot in this table")
|
||||
@ArrayType(min = 1, type = IrisLoot.class)
|
||||
private KList<IrisLoot> loot = new KList<>();
|
||||
|
||||
public KList<ItemStack> getLoot(boolean debug, RNG rng, InventorySlotType slot, int x, int y, int z, int gg, int ffs)
|
||||
public KList<ItemStack> getLoot(boolean debug, boolean doSomething, RNG rng, InventorySlotType slot, int x, int y, int z, int gg, int ffs)
|
||||
{
|
||||
KList<ItemStack> lootf = new KList<>();
|
||||
|
||||
@@ -56,7 +61,7 @@ public class IrisLootTable extends IrisRegistrant
|
||||
{
|
||||
if(i.getSlotTypes().equals(slot))
|
||||
{
|
||||
ItemStack item = i.get(debug, this, rng, x, y, z);
|
||||
ItemStack item = i.get(debug, false, this, rng, x, y, z);
|
||||
|
||||
if(item != null)
|
||||
{
|
||||
@@ -72,6 +77,18 @@ public class IrisLootTable extends IrisRegistrant
|
||||
}
|
||||
}
|
||||
|
||||
if(lootf.size() < getMinPicked())
|
||||
{
|
||||
for(int i = 0; i < getMinPicked() - lootf.size(); i++)
|
||||
{
|
||||
ItemStack item = loot.get(rng.nextParallelRNG(3945).nextInt(loot.size())).get(debug, doSomething, this, rng, x, y, z);
|
||||
if(item != null)
|
||||
{
|
||||
lootf.add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lootf;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user