private void RenderBbox(Entity entity) { if (fake == null) { fake = RenderBoundingBox(this); } fake.SetPosition(new PlayerLocation(entity.KnownPosition, 0, 0, 0)); }
public void Human(Player player, string name) { //TODO: Fix space in pets name, too difficult damn.. PlayerMob p = new PlayerMob(name, player.Level) { NameTag = name, KnownPosition = (PlayerLocation)player.KnownPosition.Clone() }; p.SpawnEntity(); //}); }
public void SpawnPlayer(Player player, string name) { string pluginDirectory = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); byte[] bytes = Skin.GetTextureFromFile(Path.Combine(pluginDirectory, "IMG_0220.png")); //byte[] bytes = Skin.GetTextureFromFile(Path.Combine(pluginDirectory, "Char8.png")); PlayerMob fake = new PlayerMob("§6§lSurvival Games" + name + "§r\n§9 ", player.Level) { Skin = new Skin {Slim = false, Texture = bytes}, KnownPosition = player.KnownPosition, ItemInHand = new ItemStack(267), Helmet = 302, Chest = 303, Leggings = 304, Boots = 305, }; fake.SpawnEntity(); }
public static Entity Create(this EntityType entityType, Level world) { Entity entity = null; switch (entityType) { case EntityType.None: return(null); case EntityType.Chicken: entity = new Chicken(world); break; case EntityType.Cow: entity = new Cow(world); break; case EntityType.Pig: entity = new Pig(world); break; case EntityType.Sheep: entity = new Sheep(world); break; case EntityType.Wolf: entity = new Wolf(world); break; case EntityType.Villager: entity = new Villager(world); break; case EntityType.MushroomCow: entity = new MushroomCow(world); break; case EntityType.Squid: entity = new Squid(world); break; case EntityType.Rabbit: entity = new Rabbit(world); break; case EntityType.Bat: entity = new Bat(world); break; case EntityType.IronGolem: entity = new IronGolem(world); break; case EntityType.SnowGolem: entity = new SnowGolem(world); break; case EntityType.Ocelot: entity = new Ocelot(world); break; case EntityType.Zombie: entity = new Zombie(world); break; case EntityType.Creeper: entity = new Creeper(world); break; case EntityType.Skeleton: entity = new Skeleton(world); break; case EntityType.Spider: entity = new Spider(world); break; case EntityType.ZombiePigman: entity = new ZombiePigman(world); break; case EntityType.Slime: entity = new Slime(world); break; case EntityType.Enderman: entity = new Enderman(world); break; case EntityType.Silverfish: entity = new Silverfish(world); break; case EntityType.CaveSpider: entity = new CaveSpider(world); break; case EntityType.Ghast: entity = new Ghast(world); break; case EntityType.MagmaCube: entity = new MagmaCube(world); break; case EntityType.Blaze: entity = new Blaze(world); break; case EntityType.ZombieVillager: entity = new ZombieVillager(world); break; case EntityType.Witch: entity = new Witch(world); break; case EntityType.Stray: entity = new Stray(world); break; case EntityType.Husk: entity = new Husk(world); break; case EntityType.WitherSkeleton: entity = new WitherSkeleton(world); break; case EntityType.Guardian: entity = new Guardian(world); break; case EntityType.ElderGuardian: entity = new ElderGuardian(world); break; case EntityType.Horse: var random = new Random(); entity = new Horse(world, random.NextDouble() < 0.10, random); break; case EntityType.PolarBear: entity = new PolarBear(world); break; case EntityType.Shulker: entity = new Shulker(world); break; case EntityType.Dragon: entity = new Dragon(world); break; case EntityType.SkeletonHorse: entity = new SkeletonHorse(world); break; case EntityType.Wither: entity = new Wither(world); break; case EntityType.Evoker: entity = new Evoker(world); break; case EntityType.Vindicator: entity = new Vindicator(world); break; case EntityType.Vex: entity = new Vex(world); break; case EntityType.Npc: entity = new PlayerMob("test", world); break; default: return(null); } return(entity); }
public PlayerMob RenderBoundingBox(Mob theMob) { var coordinates = theMob.KnownPosition; byte[] skinBytes = Encoding.Default.GetBytes(new string('Z', 64 * 64 * 4)); int geoW = (int)Math.Floor(theMob.Width * 16f); int geoH = (int)Math.Floor(theMob.Height * 16f); Log.Error($"Height={geoH}, Width={geoW}"); var skinGeometryName = "geometry.flat." + Guid.NewGuid(); GeometryModel model = new GeometryModel() { Geometry = new List <Geometry>() { new Geometry() { Description = new Description() { Identifier = skinGeometryName }, Name = skinGeometryName, TextureHeight = 64, TextureWidth = 64, Bones = new List <Bone>() { new Bone() { Name = BoneName.Body, Pivot = new float[3], Cubes = new List <Cube>() { //Origin = new float[3], //Size = new float[] {geoW, geoH, geoW}, // sides new Cube() { Origin = new float[] { -(geoW / 2f), 0, -(geoW / 2f) }, Size = new float[] { 1, geoH, 1 }, Uv = new float[] { 64, 0 }, }, new Cube() { Origin = new float[] { -(geoW / 2f), 0, +(geoW / 2f) }, Size = new float[] { 1, geoH, 1 }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { +(geoW / 2f), 0, -(geoW / 2f) }, //Origin = new float[3], Size = new float[] { 1, geoH, 1 }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { +(geoW / 2f), 0, +(geoW / 2f) }, //Origin = new float[3], Size = new float[] { 1, geoH, 1 }, Uv = new float[] { 64, 0 } }, // bottom new Cube() { Origin = new float[] { -(geoW / 2f), 0, -(geoW / 2f) }, Size = new float[] { 1, 1, geoW }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { -(geoW / 2f), 0, -(geoW / 2f) }, //Origin = new float[3], Size = new float[] { geoW, 1, 1 }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { -(geoW / 2f), 0, +(geoW / 2f) }, Size = new float[] { geoW, 1, 1 }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { +(geoW / 2f), 0, -(geoW / 2f) }, //Origin = new float[3], Size = new float[] { 1, 1, geoW }, Uv = new float[] { 64, 0 } }, // top new Cube() { Origin = new float[] { -(geoW / 2f), geoH, -(geoW / 2f) }, Size = new float[] { 1, 1, geoW }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { -(geoW / 2f), geoH, -(geoW / 2f) }, //Origin = new float[3], Size = new float[] { geoW, 1, 1 }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { -(geoW / 2f), geoH, +(geoW / 2f) }, Size = new float[] { geoW, 1, 1 }, Uv = new float[] { 64, 0 } }, new Cube() { Origin = new float[] { +(geoW / 2f), geoH, -(geoW / 2f) }, //Origin = new float[3], Size = new float[] { 1, 1, geoW }, Uv = new float[] { 64, 0 } }, } } } } }, }; PlayerMob fake = new PlayerMob(string.Empty, theMob.Level) { Width = theMob.Width, Length = theMob.Width, Height = theMob.Height, Skin = new Skin { SkinId = "testing" + new Guid(), Slim = false, Data = skinBytes, Cape = new Cape(), GeometryName = skinGeometryName, GeometryData = Skin.ToJson(model), }, KnownPosition = new PlayerLocation(coordinates) }; fake.SpawnEntity(); return(fake); }