public BlockExistsAtCondition(Coordinates location, string block, int dataValue = -1, NBTObject NBT = null) { this.block = block; this.NBT = NBT == null ? new NBTObject() : NBT; this.dataValue = dataValue; this.coordinates = location; }
public void ReplaceBlockItem(Coordinates location, string slot, string item, int amount = 1, int dataValue = 0, NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { NBT = new NBTObject(); } CombineCommand(new Command("replaceitem block " + location.ToString() + " " + slot + " " + item + " " + amount + " " + dataValue + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public void ReplaceEntityItem(Entities entities, string slot, string item, int amount = 1, int dataValue = 0, NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { NBT = new NBTObject(); } CombineCommand(new Command("replaceitem entity " + entities.GetSelectorString() + " " + slot + " " + item + " " + amount + " " + dataValue + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public void SetBlock(Coordinates location, string block, int dataValue = 0, string mode = "replace", NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { NBT = new NBTObject(); } CombineCommand(new Command("setblock " + location.ToString() + " " + block + " " + dataValue + " " + mode + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public void TestForEntity(Entities entities, NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { NBT = new NBTObject(); } CombineCommand(new Command("testfor " + entities.GetSelectorString() + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public void RemoveTag(string tag, Entities entities, NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { NBT = new NBTObject(); } EntityCommand(new Command("scoreboard players tag " + entities.GetSelectorString() + " remove " + tag + " " + NBT.ToString(), CurrentType(ifPrevious)), entities); }
public void TestForBlock(Coordinates location, string block, int dataValue = -1, NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { NBT = new NBTObject(); } CombineCommand(new Command("testforblock " + location.ToString() + " " + block + " " + dataValue + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public void GiveItem(Entities players, string item, int amount = 1, int dataValue = 0, NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { NBT = new NBTObject(); } EntityCommand(new Command("give " + players.GetSelectorString() + " " + item + " " + amount + " " + dataValue + " " + NBT.ToString(), CurrentType(ifPrevious)), players); }
public EntityCanBeFoundCondition(Entities entities, NBTObject NBT = null, string detectBlock = null, Coordinates detectCoords = null, int?detectDataValue = null) { this.entities = entities; this.NBT = NBT == null ? new NBTObject() : NBT; this.detectBlock = detectBlock; this.detectCoords = detectCoords; this.detectDataValue = detectDataValue; }
public void FillArea(Area area, string block, int dataValue = 0, string mode = "keep", NBTObject NBT = null, bool ifPrevious = false) { if (mode == "replace") { throw new ArgumentException("Cannot use mode \"replace\". Use ReplaceArea() instead."); } if (NBT == null) { NBT = new NBTObject(); } CombineCommand(new Command("fill " + area.ToString() + " " + block + " " + dataValue + " " + mode + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public void Kill(Entities entities, NBTObject NBT = null, bool ifPrevious = false) { if (NBT == null) { EntityCommand(new Command("kill " + entities.GetSelectorString(), CurrentType(ifPrevious)), entities); } else { AddTag("MCGL_KILL", entities, NBT); Kill(entities.WithTag("MCGL_KILL")); } }
public void SummonEntity(EntityType type, Coordinates location, NBTObject NBT = null, bool ifPrevious = false) { if (type == EntityType.ANY) { throw new ArgumentException("Cannot summon an entity with type ANY."); } if (NBT == null) { NBT = new NBTObject(); } CombineCommand(new Command("summon " + type.ToString() + " " + location.ToString() + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public static NBTObject Combine(params NBTObject[] objects) { NBTObject NBT = new NBTObject(); foreach (var part in objects) { foreach (var data in part.data) { NBT.SetCustom(data.Key, data.Value); } } return(NBT); }
public Chain(CommandType type = CommandType.IMPULSE, bool hideBaseEntity = false) { System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; next = type; var id = Entities.RandomString(32); baseEntity = Entities.GetSingle(EntityType.ArmorStand).WithName(id); baseNBT = new NBTObject().Set("CustomName", id); if (hideBaseEntity) { baseNBT = baseNBT.Set("Invisible", true); } SummonEntity(EntityType.ArmorStand, new RelativeCoordinates(0, 0, 0), baseNBT); }
public void PushExecutionAs(Entities entities, NBTObject NBT = null, Coordinates coordinates = null, string detectBlock = null, Coordinates detectCoordinates = null, int?detectDataValue = null) { string detect = null; if (detectBlock != null && (detectCoordinates == null || detectDataValue == null)) { throw new ArgumentNullException("All of the detect parameters have to be set."); } if (detectBlock != null) { detect = "detect " + detectCoordinates.ToString() + " " + detectBlock + " " + detectDataValue; } if (coordinates == null) { coordinates = RelativeCoordinates.Zero; } if (NBT == null) { NBT = new NBTObject(); } if (execution != null) { RemoveTag("MCGL_EXECUTING", executionWithout); execution = null; var cond = new EntityCanBeFoundCondition(executionWithout, executionNBT); cond.Init(this); executions.Push(cond); } AddTag("MCGL_EXECUTING", entities, NBT); executionWithout = entities; execution = entities.WithTag("MCGL_EXECUTING"); executionNBT = NBT; executionCoords.Push(coordinates); detects.Push(detect); }
public void SetEntityData(Entities entities, NBTObject NBT, bool ifPrevious = false) { EntityCommand(new Command("entitydata " + entities.GetSelectorString() + " " + NBT.ToString(), CurrentType(ifPrevious)), entities); }
public Condition EntityCanBeFound(Entities entities, NBTObject NBT = null, string detectBlock = null, Coordinates detectCoords = null, int?detectDataValue = null) { return(new EntityCanBeFoundCondition(entities, NBT, detectBlock, detectCoords, detectDataValue)); }
public Condition BlockExistsAt(Coordinates location, string block, int dataValue = -1, NBTObject NBT = null) { return(new BlockExistsAtCondition(location, block, dataValue, NBT)); }
public Chain ExecuteAs(Entities entities, NBTObject NBT = null, Coordinates coordinates = null, string detectBlock = null, Coordinates detectCoordinates = null, int?detectDataValue = null) { PushExecutionAs(entities, NBT, coordinates, detectBlock, detectCoordinates, detectDataValue); singleExecution++; return(this); }
public NBTObject Set(string key, NBTObject value) { data[key] = value.ToString(); return(this); }
// Players public void SetScore(Entities entities, string objective, int score, NBTObject NBT = null, bool ifPrevious = false) { EntityCommand(new Command("scoreboard players set " + entities.GetSelectorString() + " " + objective + " " + score + " " + NBT.ToString(), CurrentType(ifPrevious)), entities); }
public void SetBlockData(Coordinates coordinates, NBTObject NBT, bool ifPrevious = false) { CombineCommand(new Command("blockdata " + coordinates.ToString() + " " + NBT.ToString(), CurrentType(ifPrevious))); }
public void RemoveFromScore(Entities entities, string objective, int amount, NBTObject NBT = null, bool ifPrevious = false) { EntityCommand(new Command("scoreboard players remove " + entities.GetSelectorString() + " " + objective + " " + amount + " " + NBT.ToString(), CurrentType(ifPrevious)), entities); }
public NBTArray Add(NBTObject value) { data.Add(value.ToString()); return(this); }