mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-20 03:04:08 +00:00
Entities support baby & panda genes
This commit is contained in:
parent
8a241bb671
commit
598962f5f3
@ -6,10 +6,13 @@ import java.util.Random;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.attribute.Attributable;
|
import org.bukkit.attribute.Attributable;
|
||||||
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Mob;
|
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.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.loot.LootContext;
|
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.")
|
@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;
|
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)
|
public Entity spawn(ParallaxTerrainProvider gen, Location at)
|
||||||
{
|
{
|
||||||
return spawn(gen, at, new RNG(at.hashCode()));
|
return spawn(gen, at, new RNG(at.hashCode()));
|
||||||
@ -184,15 +199,10 @@ public class IrisEntity extends IrisRegistrant
|
|||||||
{
|
{
|
||||||
KList<ItemStack> items = new KList<>();
|
KList<ItemStack> items = new KList<>();
|
||||||
|
|
||||||
for(int t = 0; t < gen.getDimension().getLootTries(); t++)
|
|
||||||
{
|
|
||||||
int b = 4;
|
|
||||||
for(String fi : getLoot().getTables())
|
for(String fi : getLoot().getTables())
|
||||||
{
|
{
|
||||||
IrisLootTable i = gen.getData().getLootLoader().load(fi);
|
IrisLootTable i = gen.getData().getLootLoader().load(fi);
|
||||||
b++;
|
items.addAll(i.getLoot(gen.isDev(), false, rng.nextParallelRNG(345911), InventorySlotType.STORAGE, at.getBlockX(), at.getBlockY(), at.getBlockZ(), 8, 4));
|
||||||
items.addAll(i.getLoot(gen.isDev(), rng.nextParallelRNG(345911 * -t), InventorySlotType.STORAGE, at.getBlockX(), at.getBlockY(), at.getBlockZ(), t + b + b, b));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
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)
|
if(Iris.awareEntities && e instanceof Mob)
|
||||||
{
|
{
|
||||||
Mob m = (Mob) e;
|
Mob m = (Mob) e;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user