command entities

This commit is contained in:
Sen 2025-03-26 15:43:58 +01:00
parent e88958e2f4
commit 460a58e062
32 changed files with 293 additions and 37 deletions

View file

@ -2674,4 +2674,6 @@ public abstract class Entity
public Position getPos() {
return new Position(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch, this.worldObj.dimension.getDimensionId());
}
public abstract EntityType getType();
}

View 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);
}
}
}

View file

@ -3,6 +3,7 @@ package game.entity.animal;
import game.block.Block;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.npc.Alignment;
import game.entity.npc.EntityNPC;
import game.entity.types.EntityLiving;
@ -321,4 +322,8 @@ public class EntityBat extends EntityLiving
public Alignment getAlignment() {
return Alignment.NEUTRAL;
}
public EntityType getType() {
return EntityType.ANIMAL;
}
}

View file

@ -6,6 +6,7 @@ import game.collect.Lists;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.npc.Alignment;
import game.entity.npc.EntityNPC;
import game.entity.types.EntityLiving;
@ -617,4 +618,8 @@ public class EntityDragon extends EntityLiving implements IEntityMultiPart
public Alignment getAlignment() {
return Alignment.LAWFUL_EVIL;
}
public EntityType getType() {
return EntityType.ANIMAL;
}
}

View file

@ -2,6 +2,7 @@ package game.entity.animal;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.types.IEntityMultiPart;
import game.nbt.NBTTagCompound;
@ -72,4 +73,8 @@ public class EntityDragonPart extends Entity
public boolean isSendingVeloUpdates() {
return false;
}
public EntityType getType() {
return EntityType.ANIMAL;
}
}

View file

@ -6,6 +6,7 @@ import game.block.Block;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityDamageSourceIndirect;
import game.entity.EntityType;
import game.entity.npc.EntityNPC;
import game.entity.types.EntityLiving;
import game.init.Blocks;
@ -641,4 +642,8 @@ public class EntityBoat extends Entity
public Item getItem() {
return Items.boat;
}
public EntityType getType() {
return EntityType.VEHICLE;
}
}

View file

@ -5,6 +5,7 @@ import game.block.BlockRailBase;
import game.block.BlockRailPowered;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.types.EntityLiving;
import game.init.BlockRegistry;
import game.init.Blocks;
@ -1110,6 +1111,10 @@ public abstract class EntityCart extends Entity implements IWorldNameable
return Items.minecart;
}
}
public EntityType getType() {
return EntityType.VEHICLE;
}
public static enum EnumMinecartType
{

View file

@ -2,6 +2,7 @@ package game.entity.item;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.nbt.NBTTagCompound;
import game.world.World;
@ -122,4 +123,8 @@ public class EntityCrystal extends Entity
public boolean isSendingVeloUpdates() {
return false;
}
public EntityType getType() {
return EntityType.OBJECT;
}
}

View file

@ -1,6 +1,7 @@
package game.entity.item;
import game.entity.Entity;
import game.entity.EntityType;
import game.nbt.NBTTagCompound;
import game.world.Explosion;
import game.world.World;
@ -89,4 +90,8 @@ public class EntityExplosion extends Entity
public boolean isSendingVeloUpdates() {
return false;
}
public EntityType getType() {
return EntityType.EXPLOSIVE;
}
}

View file

@ -10,6 +10,7 @@ import game.block.BlockFalling;
import game.block.ITileEntityProvider;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.types.IObjectData;
import game.init.BlockRegistry;
import game.init.Blocks;
@ -339,4 +340,8 @@ public class EntityFalling extends Entity implements IObjectData
// public boolean hasSpawnVelocity() {
// return false;
// }
public EntityType getType() {
return EntityType.OBJECT;
}
}

View file

@ -1,6 +1,7 @@
package game.entity.item;
import game.entity.Entity;
import game.entity.EntityType;
import game.init.SoundEvent;
import game.item.ItemStack;
import game.nbt.NBTTagCompound;
@ -232,4 +233,8 @@ public class EntityFireworks extends Entity
public boolean isSendingVeloUpdates() {
return true;
}
public EntityType getType() {
return EntityType.EXPLOSIVE;
}
}

View file

@ -3,6 +3,7 @@ package game.entity.item;
import game.color.TextColor;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.npc.EntityNPC;
import game.entity.types.EntityLiving;
import game.init.Blocks;
@ -618,4 +619,8 @@ public class EntityItem extends Entity
return null;
return TextColor.DGREEN + "" + stack.stackSize;
}
public EntityType getType() {
return EntityType.OBJECT;
}
}

View file

@ -3,6 +3,7 @@ package game.entity.item;
import game.block.BlockFence;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.npc.EntityNPC;
import game.entity.types.EntityLiving;
import game.init.Items;
@ -439,6 +440,10 @@ public class EntityLeashKnot extends Entity
public Item getItem() {
return Items.lead;
}
public EntityType getType() {
return EntityType.OBJECT;
}
public static EntityLeashKnot createKnot(World worldIn, BlockPos fence)
{

View file

@ -1,6 +1,7 @@
package game.entity.item;
import game.entity.Entity;
import game.entity.EntityType;
import game.nbt.NBTTagCompound;
import game.renderer.particle.ParticleType;
import game.world.World;
@ -118,4 +119,8 @@ public class EntityNuke extends Entity
public boolean isSendingVeloUpdates() {
return true;
}
public EntityType getType() {
return EntityType.EXPLOSIVE;
}
}

View file

@ -1,6 +1,7 @@
package game.entity.item;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.types.EntityLiving;
import game.entity.types.IObjectData;
import game.nbt.NBTTagCompound;
@ -155,4 +156,8 @@ public class EntityTnt extends Entity implements IObjectData
// public boolean hasSpawnVelocity() {
// return false;
// }
public EntityType getType() {
return EntityType.EXPLOSIVE;
}
}

View file

@ -3,6 +3,7 @@ package game.entity.item;
import game.color.TextColor;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.npc.EntityNPC;
import game.entity.types.IObjectData;
import game.init.Config;
@ -404,4 +405,8 @@ public class EntityXp extends Entity implements IObjectData
// }
return this.hasCustomName() ? TextColor.GREEN + this.getCustomNameTag() : null;
}
public EntityType getType() {
return EntityType.OBJECT;
}
}

View file

@ -28,6 +28,7 @@ import game.enchantment.Enchantment;
import game.enchantment.EnchantmentHelper;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.animal.EntityDragonPart;
import game.entity.animal.EntityHorse;
import game.entity.animal.EntityPig;
@ -4643,4 +4644,8 @@ public abstract class EntityNPC extends EntityLiving
public void setHovering(boolean hover)
{
}
public EntityType getType() {
return EntityType.NPC;
}
}

View file

@ -6,6 +6,7 @@ import game.block.Block;
import game.enchantment.EnchantmentHelper;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.npc.EntityNPC;
import game.entity.types.EntityLiving;
import game.entity.types.IObjectData;
@ -631,4 +632,8 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData
public boolean hasSpawnVelocity() {
return true;
}
public EntityType getType() {
return EntityType.PROJECTILE;
}
}

View file

@ -5,6 +5,7 @@ import java.util.List;
import game.enchantment.EnchantmentHelper;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.types.EntityLiving;
import game.entity.types.IObjectData;
import game.entity.types.IProjectile;
@ -403,4 +404,8 @@ public class EntityBullet extends Entity implements IProjectile, IObjectData
public boolean hasSpawnVelocity() {
return true;
}
public EntityType getType() {
return EntityType.PROJECTILE;
}
}

View file

@ -1,6 +1,7 @@
package game.entity.projectile;
import game.entity.DamageSource;
import game.entity.EntityType;
import game.entity.types.EntityLiving;
import game.entity.types.EntityThrowable;
import game.entity.types.IObjectData;
@ -77,4 +78,8 @@ public class EntityDynamite extends EntityThrowable implements IObjectData
// public boolean hasSpawnVelocity() {
// return false;
// }
public EntityType getType() {
return EntityType.EXPLOSIVE;
}
}

View file

@ -6,6 +6,7 @@ import game.block.Block;
import game.enchantment.EnchantmentHelper;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.item.EntityItem;
import game.entity.item.EntityXp;
import game.entity.npc.EntityNPC;
@ -661,6 +662,10 @@ public class EntityHook extends Entity implements IObjectData
public int getPacketData() {
return this.angler != null ? this.angler.getId() : this.getId();
}
public EntityType getType() {
return EntityType.PROJECTILE;
}
// public boolean hasSpawnVelocity() {
// return false;

View file

@ -5,6 +5,7 @@ import java.util.List;
import game.block.Block;
import game.entity.DamageSource;
import game.entity.Entity;
import game.entity.EntityType;
import game.entity.types.EntityLiving;
import game.init.BlockRegistry;
import game.nbt.NBTTagCompound;
@ -385,4 +386,8 @@ public abstract class EntityProjectile extends Entity
// public boolean hasSpawnVelocity() {
// return false;
// }
public EntityType getType() {
return EntityType.PROJECTILE;
}
}

View file

@ -6,6 +6,7 @@ import game.collect.Sets;
import game.block.Block;
import game.entity.DamageSource;
import game.entity.EntityType;
import game.entity.npc.Alignment;
import game.entity.npc.EntityNPC;
import game.init.Blocks;
@ -315,4 +316,8 @@ public abstract class EntityAnimal extends EntityLiving
public Alignment getAlignment() {
return Alignment.LAWFUL;
}
public EntityType getType() {
return EntityType.ANIMAL;
}
}

View file

@ -5,6 +5,7 @@ import java.util.List;
import game.block.Block;
import game.block.BlockPortal;
import game.entity.Entity;
import game.entity.EntityType;
import game.init.BlockRegistry;
import game.init.Blocks;
import game.nbt.NBTTagCompound;
@ -389,4 +390,8 @@ public abstract class EntityThrowable extends Entity implements IProjectile
public boolean isSendingVeloUpdates() {
return true;
}
public EntityType getType() {
return EntityType.PROJECTILE;
}
}

View file

@ -1,6 +1,7 @@
package game.entity.types;
import game.entity.DamageSource;
import game.entity.EntityType;
import game.entity.npc.EntityNPC;
import game.init.Config;
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();
}
public EntityType getType() {
return EntityType.ANIMAL;
}
}

View file

@ -1,6 +1,7 @@
package game.entity.types;
import game.entity.Entity;
import game.entity.EntityType;
import game.nbt.NBTTagCompound;
import game.world.World;
@ -29,4 +30,8 @@ public abstract class EntityWeatherEffect extends Entity {
protected final void writeEntityToNBT(NBTTagCompound tagCompound) {
}
public final EntityType getType() {
return EntityType.OBJECT;
}
}