command entities
This commit is contained in:
parent
e88958e2f4
commit
460a58e062
32 changed files with 293 additions and 37 deletions
|
@ -1,12 +1,14 @@
|
||||||
package game.command;
|
package game.command;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import game.collect.Lists;
|
import game.collect.Lists;
|
||||||
import game.collect.Sets;
|
import game.collect.Sets;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.init.EntityRegistry;
|
import game.init.EntityRegistry;
|
||||||
import game.network.Player;
|
import game.network.Player;
|
||||||
|
@ -45,26 +47,67 @@ public class EntityListParser extends EntityParser {
|
||||||
throw new RunException("Keine Spieler gefunden");
|
throw new RunException("Keine Spieler gefunden");
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
Set<Entity> set = Sets.newHashSet();
|
Set<Class<? extends Entity>> classes = Sets.newHashSet();
|
||||||
|
Set<EntityType> types = Sets.newHashSet();
|
||||||
|
Set<Entity> entities = Sets.newHashSet();
|
||||||
|
Set<Class<? extends Entity>> nclasses = Sets.newHashSet();
|
||||||
|
Set<EntityType> ntypes = Sets.newHashSet();
|
||||||
|
Set<Entity> nentities = Sets.newHashSet();
|
||||||
|
Boolean living = null;
|
||||||
|
Boolean player = null;
|
||||||
for(String tok : input.split(",", -1)) {
|
for(String tok : input.split(",", -1)) {
|
||||||
|
boolean negate = tok.startsWith("!");
|
||||||
|
tok = negate ? tok.substring(1) : tok;
|
||||||
Class<? extends Entity> clazz = EntityRegistry.getEntityClass(tok);
|
Class<? extends Entity> clazz = EntityRegistry.getEntityClass(tok);
|
||||||
if(clazz != null) {
|
if(clazz != null) {
|
||||||
|
if(classes.contains(clazz) || nclasses.contains(clazz))
|
||||||
|
throw new RunException("Objekttyp %s mehrfach angegeben", EntityRegistry.getEntityName(EntityRegistry.getEntityString(clazz)));
|
||||||
if(this.livingOnly && !EntityLiving.class.isAssignableFrom(clazz))
|
if(this.livingOnly && !EntityLiving.class.isAssignableFrom(clazz))
|
||||||
throw new RunException("Objekttyp %s ist nicht lebendig", EntityRegistry.getEntityName(EntityRegistry.getEntityString(clazz)));
|
throw new RunException("Objekttyp %s ist nicht lebendig", EntityRegistry.getEntityName(EntityRegistry.getEntityString(clazz)));
|
||||||
for(WorldServer world : env.getServer().getWorlds()) {
|
(negate ? nclasses : classes).add(clazz);
|
||||||
for(Entity ent : world.getEntities()) {
|
}
|
||||||
if(clazz.isAssignableFrom(ent.getClass()))
|
else if(tok.equals("Player")) {
|
||||||
set.add(ent);
|
if(player != null)
|
||||||
}
|
throw new RunException("'Player' mehrfach angegeben");
|
||||||
}
|
player = !negate;
|
||||||
|
}
|
||||||
|
else if(tok.equals("Living")) {
|
||||||
|
if(living != null)
|
||||||
|
throw new RunException("'Living' mehrfach angegeben");
|
||||||
|
if(this.livingOnly)
|
||||||
|
throw new RunException("Kann nicht 'Living' als Objekttypen angeben");
|
||||||
|
living = !negate;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
set.add((Entity)super.parse(env, tok));
|
EntityType type = EntityType.getByName(tok);
|
||||||
|
if(type != null) {
|
||||||
|
if(types.contains(type) || ntypes.contains(type))
|
||||||
|
throw new RunException("Objekttyp %s mehrfach angegeben", type.getDisplay());
|
||||||
|
(negate ? ntypes : types).add(type);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Entity ent = (Entity)super.parse(env, tok);
|
||||||
|
if(entities.contains(ent) || nentities.contains(ent))
|
||||||
|
throw new RunException("Objekt '%s' mehrfach angegeben", tok);
|
||||||
|
(negate ? nentities : entities).add(ent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(set.isEmpty())
|
List<Entity> filtered = Lists.newArrayList(entities);
|
||||||
|
boolean negateOnly = (living == null && player == null && types.isEmpty() && classes.isEmpty() && entities.isEmpty());
|
||||||
|
for(WorldServer world : env.getServer().getWorlds()) {
|
||||||
|
for(Entity ent : world.getEntities()) {
|
||||||
|
if((!this.livingOnly || ent instanceof EntityLiving) &&
|
||||||
|
(negateOnly || (living != null && living == (ent instanceof EntityLiving)) || (player != null && player == ent.isPlayer()) || types.contains(ent.getType()) ||
|
||||||
|
classes.contains(ent.getClass())) &&
|
||||||
|
(living == null || living == (ent instanceof EntityLiving)) && (player == null || player == ent.isPlayer()) &&
|
||||||
|
!ntypes.contains(ent.getType()) && !nclasses.contains(ent.getClass()) && !nentities.contains(ent) && !entities.contains(ent))
|
||||||
|
filtered.add(ent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(filtered.isEmpty())
|
||||||
throw new RunException("Keine Objekte gefunden");
|
throw new RunException("Keine Objekte gefunden");
|
||||||
return Lists.newArrayList(set);
|
return filtered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getDefault(CommandEnvironment env) {
|
public Object getDefault(CommandEnvironment env) {
|
||||||
|
@ -79,7 +122,10 @@ public class EntityListParser extends EntityParser {
|
||||||
if(!this.livingOnly || EntityLiving.class.isAssignableFrom(clazz))
|
if(!this.livingOnly || EntityLiving.class.isAssignableFrom(clazz))
|
||||||
comp.add(EntityRegistry.getEntityString(clazz));
|
comp.add(EntityRegistry.getEntityString(clazz));
|
||||||
}
|
}
|
||||||
comp.add("**");
|
for(EntityType type : EntityType.values()) {
|
||||||
|
comp.add(type.getName());
|
||||||
|
}
|
||||||
|
Collections.addAll(comp, "Player", "Living", "**");
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class EntityParser extends PlayerEntityParser {
|
||||||
if(entity == null)
|
if(entity == null)
|
||||||
throw new RunException("Objekt '%s' wurde nicht gefunden", input);
|
throw new RunException("Objekt '%s' wurde nicht gefunden", input);
|
||||||
else if(this.livingOnly && !(entity instanceof EntityLiving))
|
else if(this.livingOnly && !(entity instanceof EntityLiving))
|
||||||
throw new RunException("Objekt muss lebendig sein");
|
throw new RunException("Objekt '%s' muss lebendig sein", input);
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,10 @@ package game.command;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import game.collect.Lists;
|
import game.collect.Lists;
|
||||||
|
import game.collect.Sets;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.network.Player;
|
import game.network.Player;
|
||||||
|
@ -23,7 +26,13 @@ public class PlayerEntityListParser extends PlayerEntityParser {
|
||||||
throw new RunException("Keine Spieler gefunden");
|
throw new RunException("Keine Spieler gefunden");
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
return Lists.newArrayList((EntityNPC)super.parse(env, input));
|
Set<EntityNPC> set = Sets.newHashSet();
|
||||||
|
for(String tok : input.split(",", -1)) {
|
||||||
|
set.add((EntityNPC)super.parse(env, tok));
|
||||||
|
}
|
||||||
|
if(set.isEmpty())
|
||||||
|
throw new RunException("Keine Spieler gefunden");
|
||||||
|
return Lists.newArrayList(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getDefault(CommandEnvironment env) {
|
public Object getDefault(CommandEnvironment env) {
|
||||||
|
|
|
@ -2,7 +2,10 @@ package game.command;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import game.collect.Lists;
|
import game.collect.Lists;
|
||||||
|
import game.collect.Sets;
|
||||||
import game.network.Player;
|
import game.network.Player;
|
||||||
|
|
||||||
public class PlayerListParser extends PlayerParser {
|
public class PlayerListParser extends PlayerParser {
|
||||||
|
@ -16,7 +19,13 @@ public class PlayerListParser extends PlayerParser {
|
||||||
throw new RunException("Keine Spieler gefunden");
|
throw new RunException("Keine Spieler gefunden");
|
||||||
return Lists.newArrayList(env.getServer().getPlayers());
|
return Lists.newArrayList(env.getServer().getPlayers());
|
||||||
}
|
}
|
||||||
return Lists.newArrayList((Player)super.parse(env, input));
|
Set<Player> set = Sets.newHashSet();
|
||||||
|
for(String tok : input.split(",", -1)) {
|
||||||
|
set.add((Player)super.parse(env, tok));
|
||||||
|
}
|
||||||
|
if(set.isEmpty())
|
||||||
|
throw new RunException("Keine Spieler gefunden");
|
||||||
|
return Lists.newArrayList(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getDefault(CommandEnvironment env) {
|
public Object getDefault(CommandEnvironment env) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import game.entity.Entity;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.init.EntityRegistry;
|
import game.init.EntityRegistry;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
|
import game.network.Player;
|
||||||
import game.util.Util;
|
import game.util.Util;
|
||||||
import game.world.Vec3;
|
import game.world.Vec3;
|
||||||
import game.world.WorldServer;
|
import game.world.WorldServer;
|
||||||
|
@ -26,6 +27,7 @@ public class CommandSpawn extends Command {
|
||||||
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
|
for(Class<? extends Entity> clazz : EntityRegistry.getAllClasses()) {
|
||||||
names.add(EntityRegistry.getEntityString(clazz));
|
names.add(EntityRegistry.getEntityString(clazz));
|
||||||
}
|
}
|
||||||
|
names.add("Lightning");
|
||||||
this.addEnum("type", String.class, names);
|
this.addEnum("type", String.class, names);
|
||||||
this.setParamsOptional();
|
this.setParamsOptional();
|
||||||
this.addVector("position", true, true);
|
this.addVector("position", true, true);
|
||||||
|
@ -38,30 +40,51 @@ public class CommandSpawn extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object exec(CommandEnvironment env, Executor exec, String type, Vec3 pos, WorldServer world, NBTTagCompound tag, boolean noinit, int count, NBTTagCompound postTag) {
|
public Object exec(CommandEnvironment env, Executor exec, String type, Vec3 pos, WorldServer world, NBTTagCompound tag, boolean noinit, int count, NBTTagCompound postTag) {
|
||||||
List<String> spawned = Lists.newArrayList();
|
if(type.equalsIgnoreCase("Lightning")) {
|
||||||
for(int z = 0; z < count; z++) {
|
for(int z = 0; z < count; z++) {
|
||||||
Entity entity = EntityRegistry.createEntityByName(type, world);
|
int color = 0xffffff;
|
||||||
if(entity == null)
|
if(tag != null && tag.hasKey("color", 3))
|
||||||
throw new RunException("Objekt konnte nicht erzeugt werden");
|
color = tag.getInteger("color");
|
||||||
entity.setLocationAndAngles(pos.xCoord, pos.yCoord, pos.zCoord, world.rand.floatv() * 360.0f, 0.0f);
|
else if(tag != null && tag.hasKey("color", 8)) {
|
||||||
if(tag != null) {
|
try {
|
||||||
NBTTagCompound ent = new NBTTagCompound();
|
color = Integer.parseUnsignedInt(tag.getString("color"), 16);
|
||||||
entity.writeToNBT(ent);
|
}
|
||||||
ent.merge(tag);
|
catch(NumberFormatException e) {
|
||||||
entity.readFromNBT(ent);
|
}
|
||||||
|
}
|
||||||
|
world.strikeLightning(pos.xCoord, pos.yCoord, pos.zCoord, color,
|
||||||
|
tag != null && tag.hasKey("damage", 3) ? tag.getInteger("damage") : 0, tag != null && tag.hasKey("fire", 1) && tag.getBoolean("fire"),
|
||||||
|
exec instanceof Player && tag != null && tag.hasKey("summoned", 1) && tag.getBoolean("summoned") ? ((Player)exec).getEntity() : null);
|
||||||
}
|
}
|
||||||
if(!noinit && (entity instanceof EntityLiving))
|
exec.logConsole("%sBlitz bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), (int)pos.xCoord, (int)pos.yCoord, (int)pos.zCoord, world.dimension.getFormattedName(false));
|
||||||
((EntityLiving)entity).onInitialSpawn(null);
|
return null;
|
||||||
world.spawnEntityInWorld(entity);
|
}
|
||||||
if(postTag != null) {
|
else {
|
||||||
NBTTagCompound ent = new NBTTagCompound();
|
List<String> spawned = Lists.newArrayList();
|
||||||
entity.writeToNBT(ent);
|
for(int z = 0; z < count; z++) {
|
||||||
ent.merge(postTag);
|
Entity entity = EntityRegistry.createEntityByName(type, world);
|
||||||
entity.readFromNBT(ent);
|
if(entity == null)
|
||||||
}
|
throw new RunException("Objekt konnte nicht erzeugt werden");
|
||||||
spawned.add("#" + entity.getId());
|
entity.setLocationAndAngles(pos.xCoord, pos.yCoord, pos.zCoord, world.rand.floatv() * 360.0f, 0.0f);
|
||||||
|
if(tag != null) {
|
||||||
|
NBTTagCompound ent = new NBTTagCompound();
|
||||||
|
entity.writeToNBT(ent);
|
||||||
|
ent.merge(tag);
|
||||||
|
entity.readFromNBT(ent);
|
||||||
|
}
|
||||||
|
if(!noinit && (entity instanceof EntityLiving))
|
||||||
|
((EntityLiving)entity).onInitialSpawn(null);
|
||||||
|
world.spawnEntityInWorld(entity);
|
||||||
|
if(postTag != null) {
|
||||||
|
NBTTagCompound ent = new NBTTagCompound();
|
||||||
|
entity.writeToNBT(ent);
|
||||||
|
ent.merge(postTag);
|
||||||
|
entity.readFromNBT(ent);
|
||||||
|
}
|
||||||
|
spawned.add("#" + entity.getId());
|
||||||
|
}
|
||||||
|
exec.logConsole("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), (int)pos.xCoord, (int)pos.yCoord, (int)pos.zCoord, world.dimension.getFormattedName(false));
|
||||||
|
return Util.buildLines(",", spawned);
|
||||||
}
|
}
|
||||||
exec.logConsole("%s%s bei %d, %d, %d in %s erschaffen", count == 1 ? "" : (count + "x "), EntityRegistry.getEntityName(type), (int)pos.xCoord, (int)pos.yCoord, (int)pos.zCoord, world.dimension.getFormattedName(false));
|
|
||||||
return Util.buildLines(",", spawned);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2674,4 +2674,6 @@ public abstract class Entity
|
||||||
public Position getPos() {
|
public Position getPos() {
|
||||||
return new Position(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch, this.worldObj.dimension.getDimensionId());
|
return new Position(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch, this.worldObj.dimension.getDimensionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract EntityType getType();
|
||||||
}
|
}
|
||||||
|
|
42
java/src/game/entity/EntityType.java
Normal file
42
java/src/game/entity/EntityType.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package game.entity;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import game.collect.Maps;
|
||||||
|
|
||||||
|
public enum EntityType {
|
||||||
|
OBJECT("Object", "Objekt"),
|
||||||
|
VEHICLE("Vehicle", "Fahrzeug"),
|
||||||
|
PROJECTILE("Projectile", "Projektil"),
|
||||||
|
EXPLOSIVE("Explosive", "Sprengstoff"),
|
||||||
|
ANIMAL("Animal", "Tier"),
|
||||||
|
NPC("NPC", "NPC");
|
||||||
|
|
||||||
|
private static final Map<String, EntityType> LOOKUP = Maps.newHashMap();
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final String display;
|
||||||
|
|
||||||
|
private EntityType(String name, String display) {
|
||||||
|
this.name = name;
|
||||||
|
this.display = display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplay() {
|
||||||
|
return this.display;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityType getByName(String name) {
|
||||||
|
return LOOKUP.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
for(EntityType type : values()) {
|
||||||
|
LOOKUP.put(type.name, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package game.entity.animal;
|
||||||
import game.block.Block;
|
import game.block.Block;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.Alignment;
|
import game.entity.npc.Alignment;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
|
@ -321,4 +322,8 @@ public class EntityBat extends EntityLiving
|
||||||
public Alignment getAlignment() {
|
public Alignment getAlignment() {
|
||||||
return Alignment.NEUTRAL;
|
return Alignment.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.ANIMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import game.collect.Lists;
|
||||||
|
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.Alignment;
|
import game.entity.npc.Alignment;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
|
@ -617,4 +618,8 @@ public class EntityDragon extends EntityLiving implements IEntityMultiPart
|
||||||
public Alignment getAlignment() {
|
public Alignment getAlignment() {
|
||||||
return Alignment.LAWFUL_EVIL;
|
return Alignment.LAWFUL_EVIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.ANIMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package game.entity.animal;
|
||||||
|
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.IEntityMultiPart;
|
import game.entity.types.IEntityMultiPart;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
@ -72,4 +73,8 @@ public class EntityDragonPart extends Entity
|
||||||
public boolean isSendingVeloUpdates() {
|
public boolean isSendingVeloUpdates() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.ANIMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import game.block.Block;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
import game.entity.EntityDamageSourceIndirect;
|
import game.entity.EntityDamageSourceIndirect;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.init.Blocks;
|
import game.init.Blocks;
|
||||||
|
@ -641,4 +642,8 @@ public class EntityBoat extends Entity
|
||||||
public Item getItem() {
|
public Item getItem() {
|
||||||
return Items.boat;
|
return Items.boat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.VEHICLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import game.block.BlockRailBase;
|
||||||
import game.block.BlockRailPowered;
|
import game.block.BlockRailPowered;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.init.BlockRegistry;
|
import game.init.BlockRegistry;
|
||||||
import game.init.Blocks;
|
import game.init.Blocks;
|
||||||
|
@ -1111,6 +1112,10 @@ public abstract class EntityCart extends Entity implements IWorldNameable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.VEHICLE;
|
||||||
|
}
|
||||||
|
|
||||||
public static enum EnumMinecartType
|
public static enum EnumMinecartType
|
||||||
{
|
{
|
||||||
RIDEABLE,
|
RIDEABLE,
|
||||||
|
|
|
@ -2,6 +2,7 @@ package game.entity.item;
|
||||||
|
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
import game.world.World;
|
import game.world.World;
|
||||||
|
|
||||||
|
@ -122,4 +123,8 @@ public class EntityCrystal extends Entity
|
||||||
public boolean isSendingVeloUpdates() {
|
public boolean isSendingVeloUpdates() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.OBJECT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package game.entity.item;
|
package game.entity.item;
|
||||||
|
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
import game.world.Explosion;
|
import game.world.Explosion;
|
||||||
import game.world.World;
|
import game.world.World;
|
||||||
|
@ -89,4 +90,8 @@ public class EntityExplosion extends Entity
|
||||||
public boolean isSendingVeloUpdates() {
|
public boolean isSendingVeloUpdates() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.EXPLOSIVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import game.block.BlockFalling;
|
||||||
import game.block.ITileEntityProvider;
|
import game.block.ITileEntityProvider;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.IObjectData;
|
import game.entity.types.IObjectData;
|
||||||
import game.init.BlockRegistry;
|
import game.init.BlockRegistry;
|
||||||
import game.init.Blocks;
|
import game.init.Blocks;
|
||||||
|
@ -339,4 +340,8 @@ public class EntityFalling extends Entity implements IObjectData
|
||||||
// public boolean hasSpawnVelocity() {
|
// public boolean hasSpawnVelocity() {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.OBJECT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package game.entity.item;
|
package game.entity.item;
|
||||||
|
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.init.SoundEvent;
|
import game.init.SoundEvent;
|
||||||
import game.item.ItemStack;
|
import game.item.ItemStack;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
|
@ -232,4 +233,8 @@ public class EntityFireworks extends Entity
|
||||||
public boolean isSendingVeloUpdates() {
|
public boolean isSendingVeloUpdates() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.EXPLOSIVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package game.entity.item;
|
||||||
import game.color.TextColor;
|
import game.color.TextColor;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.init.Blocks;
|
import game.init.Blocks;
|
||||||
|
@ -618,4 +619,8 @@ public class EntityItem extends Entity
|
||||||
return null;
|
return null;
|
||||||
return TextColor.DGREEN + "" + stack.stackSize;
|
return TextColor.DGREEN + "" + stack.stackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.OBJECT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package game.entity.item;
|
||||||
import game.block.BlockFence;
|
import game.block.BlockFence;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.init.Items;
|
import game.init.Items;
|
||||||
|
@ -440,6 +441,10 @@ public class EntityLeashKnot extends Entity
|
||||||
return Items.lead;
|
return Items.lead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
public static EntityLeashKnot createKnot(World worldIn, BlockPos fence)
|
public static EntityLeashKnot createKnot(World worldIn, BlockPos fence)
|
||||||
{
|
{
|
||||||
EntityLeashKnot entityleashknot = new EntityLeashKnot(worldIn, fence);
|
EntityLeashKnot entityleashknot = new EntityLeashKnot(worldIn, fence);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package game.entity.item;
|
package game.entity.item;
|
||||||
|
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
import game.renderer.particle.ParticleType;
|
import game.renderer.particle.ParticleType;
|
||||||
import game.world.World;
|
import game.world.World;
|
||||||
|
@ -118,4 +119,8 @@ public class EntityNuke extends Entity
|
||||||
public boolean isSendingVeloUpdates() {
|
public boolean isSendingVeloUpdates() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.EXPLOSIVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package game.entity.item;
|
package game.entity.item;
|
||||||
|
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.entity.types.IObjectData;
|
import game.entity.types.IObjectData;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
|
@ -155,4 +156,8 @@ public class EntityTnt extends Entity implements IObjectData
|
||||||
// public boolean hasSpawnVelocity() {
|
// public boolean hasSpawnVelocity() {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.EXPLOSIVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package game.entity.item;
|
||||||
import game.color.TextColor;
|
import game.color.TextColor;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.types.IObjectData;
|
import game.entity.types.IObjectData;
|
||||||
import game.init.Config;
|
import game.init.Config;
|
||||||
|
@ -404,4 +405,8 @@ public class EntityXp extends Entity implements IObjectData
|
||||||
// }
|
// }
|
||||||
return this.hasCustomName() ? TextColor.GREEN + this.getCustomNameTag() : null;
|
return this.hasCustomName() ? TextColor.GREEN + this.getCustomNameTag() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.OBJECT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import game.enchantment.Enchantment;
|
||||||
import game.enchantment.EnchantmentHelper;
|
import game.enchantment.EnchantmentHelper;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.animal.EntityDragonPart;
|
import game.entity.animal.EntityDragonPart;
|
||||||
import game.entity.animal.EntityHorse;
|
import game.entity.animal.EntityHorse;
|
||||||
import game.entity.animal.EntityPig;
|
import game.entity.animal.EntityPig;
|
||||||
|
@ -4643,4 +4644,8 @@ public abstract class EntityNPC extends EntityLiving
|
||||||
public void setHovering(boolean hover)
|
public void setHovering(boolean hover)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.NPC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import game.block.Block;
|
||||||
import game.enchantment.EnchantmentHelper;
|
import game.enchantment.EnchantmentHelper;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.entity.types.IObjectData;
|
import game.entity.types.IObjectData;
|
||||||
|
@ -631,4 +632,8 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
|
||||||
public boolean hasSpawnVelocity() {
|
public boolean hasSpawnVelocity() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.PROJECTILE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import game.enchantment.EnchantmentHelper;
|
import game.enchantment.EnchantmentHelper;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.entity.types.IObjectData;
|
import game.entity.types.IObjectData;
|
||||||
import game.entity.types.IProjectile;
|
import game.entity.types.IProjectile;
|
||||||
|
@ -403,4 +404,8 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData
|
||||||
public boolean hasSpawnVelocity() {
|
public boolean hasSpawnVelocity() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.PROJECTILE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package game.entity.projectile;
|
package game.entity.projectile;
|
||||||
|
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.entity.types.EntityThrowable;
|
import game.entity.types.EntityThrowable;
|
||||||
import game.entity.types.IObjectData;
|
import game.entity.types.IObjectData;
|
||||||
|
@ -77,4 +78,8 @@ public class EntityDynamite extends EntityThrowable implements IObjectData
|
||||||
// public boolean hasSpawnVelocity() {
|
// public boolean hasSpawnVelocity() {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.EXPLOSIVE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import game.block.Block;
|
||||||
import game.enchantment.EnchantmentHelper;
|
import game.enchantment.EnchantmentHelper;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.item.EntityItem;
|
import game.entity.item.EntityItem;
|
||||||
import game.entity.item.EntityXp;
|
import game.entity.item.EntityXp;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
|
@ -662,6 +663,10 @@ public class EntityHook extends Entity implements IObjectData
|
||||||
return this.angler != null ? this.angler.getId() : this.getId();
|
return this.angler != null ? this.angler.getId() : this.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.PROJECTILE;
|
||||||
|
}
|
||||||
|
|
||||||
// public boolean hasSpawnVelocity() {
|
// public boolean hasSpawnVelocity() {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import game.block.Block;
|
import game.block.Block;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.types.EntityLiving;
|
import game.entity.types.EntityLiving;
|
||||||
import game.init.BlockRegistry;
|
import game.init.BlockRegistry;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
|
@ -385,4 +386,8 @@ public abstract class EntityProjectile extends Entity
|
||||||
// public boolean hasSpawnVelocity() {
|
// public boolean hasSpawnVelocity() {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.PROJECTILE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import game.collect.Sets;
|
||||||
|
|
||||||
import game.block.Block;
|
import game.block.Block;
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.Alignment;
|
import game.entity.npc.Alignment;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.init.Blocks;
|
import game.init.Blocks;
|
||||||
|
@ -315,4 +316,8 @@ public abstract class EntityAnimal extends EntityLiving
|
||||||
public Alignment getAlignment() {
|
public Alignment getAlignment() {
|
||||||
return Alignment.LAWFUL;
|
return Alignment.LAWFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.ANIMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import game.block.Block;
|
import game.block.Block;
|
||||||
import game.block.BlockPortal;
|
import game.block.BlockPortal;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.init.BlockRegistry;
|
import game.init.BlockRegistry;
|
||||||
import game.init.Blocks;
|
import game.init.Blocks;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
|
@ -389,4 +390,8 @@ public abstract class EntityThrowable extends Entity implements IProjectile
|
||||||
public boolean isSendingVeloUpdates() {
|
public boolean isSendingVeloUpdates() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.PROJECTILE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package game.entity.types;
|
package game.entity.types;
|
||||||
|
|
||||||
import game.entity.DamageSource;
|
import game.entity.DamageSource;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.entity.npc.EntityNPC;
|
import game.entity.npc.EntityNPC;
|
||||||
import game.init.Config;
|
import game.init.Config;
|
||||||
import game.world.World;
|
import game.world.World;
|
||||||
|
@ -108,4 +109,8 @@ public abstract class EntityWaterMob extends EntityLiving
|
||||||
{
|
{
|
||||||
return this.posY > 45.0D && this.posY < (double)this.worldObj.getSeaLevel();
|
return this.posY > 45.0D && this.posY < (double)this.worldObj.getSeaLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.ANIMAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package game.entity.types;
|
package game.entity.types;
|
||||||
|
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
import game.world.World;
|
import game.world.World;
|
||||||
|
|
||||||
|
@ -29,4 +30,8 @@ public abstract class EntityWeatherEffect extends Entity {
|
||||||
|
|
||||||
protected final void writeEntityToNBT(NBTTagCompound tagCompound) {
|
protected final void writeEntityToNBT(NBTTagCompound tagCompound) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final EntityType getType() {
|
||||||
|
return EntityType.OBJECT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package game.renderer.particle;
|
||||||
|
|
||||||
import game.Game;
|
import game.Game;
|
||||||
import game.entity.Entity;
|
import game.entity.Entity;
|
||||||
|
import game.entity.EntityType;
|
||||||
import game.nbt.NBTTagCompound;
|
import game.nbt.NBTTagCompound;
|
||||||
import game.renderer.RenderBuffer;
|
import game.renderer.RenderBuffer;
|
||||||
import game.renderer.texture.TextureAtlasSprite;
|
import game.renderer.texture.TextureAtlasSprite;
|
||||||
|
@ -282,4 +283,8 @@ public class EntityFX extends Entity
|
||||||
public boolean isSendingVeloUpdates() {
|
public boolean isSendingVeloUpdates() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EntityType getType() {
|
||||||
|
return EntityType.OBJECT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue