9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 04:29:05 +00:00

Merge branch 'master' of https://github.com/cyberpwnn/Iris into citizens

This commit is contained in:
Andrew Baker
2020-10-21 18:05:51 -07:00
77 changed files with 6298 additions and 890 deletions

View File

@@ -22,12 +22,11 @@ import lombok.experimental.Accessors;
@Data
public class IrisCaveFluid
{
@Required
@MaxNumber(255)
@MinNumber(0)
@DontObfuscate
@Desc("The cave zoom. Higher values makes caves spread out further and branch less often, but are thicker.")
@Desc("The fluid height of the cave")
private int fluidHeight = 35;
@DontObfuscate

View File

@@ -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();

View File

@@ -82,11 +82,6 @@ public class IrisDimension extends IrisRegistrant
@Desc("Reference loot tables in this area")
private IrisLootReference loot = new IrisLootReference();
@DontObfuscate
@MinNumber(0)
@Desc("Try to fill a container with loot up to this many times to avoid too many empty chests.")
private int lootTries = 5;
@Required
@MinNumber(0)
@DontObfuscate
@@ -168,6 +163,10 @@ public class IrisDimension extends IrisRegistrant
@Desc("Generate vanilla structures")
private boolean vanillaStructures = false;
@DontObfuscate
@Desc("If defined, If air is defined below the area, this fluid will always place")
private IrisCaveFluid forceFluid = new IrisCaveFluid();
@DontObfuscate
@Desc("Generate decorations or not")
private boolean decorate = true;

View File

@@ -6,10 +6,13 @@ import java.util.Random;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attributable;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Mob;
import org.bukkit.entity.Panda;
import org.bukkit.entity.Panda.Gene;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.loot.LootContext;
@@ -134,6 +137,18 @@ public class IrisEntity extends IrisRegistrant
@Desc("If specified, this entity will be leashed by this entity. I.e. THIS ENTITY Leashed by SPECIFIED. This has no effect on EnderDragons, Withers, Players, or Bats.Non-living entities excluding leashes will not persist as leashholders.")
private IrisEntity leashHolder = null;
@DontObfuscate
@Desc("The main gene for a panda if the entity type is a panda")
private Gene pandaMainGene = Gene.NORMAL;
@DontObfuscate
@Desc("The hidden gene for a panda if the entity type is a panda")
private Gene pandaHiddenGene = Gene.NORMAL;
@DontObfuscate
@Desc("The this entity is ageable, set it's baby status")
private boolean baby = false;
public Entity spawn(ParallaxTerrainProvider gen, Location at)
{
return spawn(gen, at, new RNG(at.hashCode()));
@@ -184,15 +199,10 @@ public class IrisEntity extends IrisRegistrant
{
KList<ItemStack> items = new KList<>();
for(int t = 0; t < gen.getDimension().getLootTries(); t++)
for(String fi : getLoot().getTables())
{
int b = 4;
for(String fi : getLoot().getTables())
{
IrisLootTable i = gen.getData().getLootLoader().load(fi);
b++;
items.addAll(i.getLoot(gen.isDev(), rng.nextParallelRNG(345911 * -t), InventorySlotType.STORAGE, at.getBlockX(), at.getBlockY(), at.getBlockZ(), t + b + b, b));
}
IrisLootTable i = gen.getData().getLootLoader().load(fi);
items.addAll(i.getLoot(gen.isDev(), false, rng.nextParallelRNG(345911), InventorySlotType.STORAGE, at.getBlockX(), at.getBlockY(), at.getBlockZ(), 8, 4));
}
return items;
@@ -256,6 +266,17 @@ public class IrisEntity extends IrisRegistrant
}
}
if(e instanceof Ageable && isBaby())
{
((Ageable) e).setBaby();
}
if(e instanceof Panda)
{
((Panda) e).setMainGene(getPandaMainGene());
((Panda) e).setMainGene(getPandaHiddenGene());
}
if(Iris.awareEntities && e instanceof Mob)
{
Mob m = (Mob) e;

View File

@@ -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)
{

View File

@@ -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;
}
}