From 21eb3e14078c221a831f642614e954850a0d0244 Mon Sep 17 00:00:00 2001 From: Marcel Konrad Date: Sun, 24 May 2020 20:48:09 +0200 Subject: [PATCH] Add command stack, Move butcher to entities category --- .../component/impl/ComponentCustom.java | 262 +------- .../builder/component/impl/EntityNBT.java | 430 +++++++++++++ .../builder/impl/BuilderSummon.java | 566 ++++++++++++------ .../worldhandler/gui/category/Categories.java | 25 +- .../worldhandler/gui/category/Category.java | 2 +- .../worldhandler/gui/content/Content.java | 12 +- .../worldhandler/gui/content/Contents.java | 85 +-- .../gui/content/impl/ContentButcher.java | 25 +- .../gui/content/impl/ContentCommandStack.java | 271 +++++++++ .../gui/content/impl/ContentMain.java | 10 +- .../gui/content/impl/ContentSummon.java | 4 +- .../worldhandler/util/NBTHelper.java | 117 ++++ .../assets/worldhandler/lang/de_de.json | 12 +- .../assets/worldhandler/lang/en_us.json | 13 +- .../assets/worldhandler/lang/fr_fr.json | 13 +- .../assets/worldhandler/lang/ru_ru.json | 13 +- .../assets/worldhandler/lang/zh_cn.json | 13 +- 17 files changed, 1338 insertions(+), 535 deletions(-) create mode 100644 src/main/java/exopandora/worldhandler/builder/component/impl/EntityNBT.java create mode 100644 src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java create mode 100644 src/main/java/exopandora/worldhandler/util/NBTHelper.java diff --git a/src/main/java/exopandora/worldhandler/builder/component/impl/ComponentCustom.java b/src/main/java/exopandora/worldhandler/builder/component/impl/ComponentCustom.java index 2e04a26..bb9c8d5 100644 --- a/src/main/java/exopandora/worldhandler/builder/component/impl/ComponentCustom.java +++ b/src/main/java/exopandora/worldhandler/builder/component/impl/ComponentCustom.java @@ -1,149 +1,41 @@ package exopandora.worldhandler.builder.component.impl; -import java.util.Random; - -import javax.annotation.Nullable; - -import org.apache.commons.lang3.StringUtils; - import exopandora.worldhandler.builder.component.IBuilderComponent; -import exopandora.worldhandler.util.ResourceHelper; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.EntityType; -import net.minecraft.nbt.ByteNBT; -import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.INBT; -import net.minecraft.nbt.IntNBT; -import net.minecraft.nbt.ListNBT; -import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.registries.ForgeRegistries; @OnlyIn(Dist.CLIENT) -public class ComponentSummon implements IBuilderComponent +public class ComponentCustom implements IBuilderComponent { - private final Random random = new Random(); - + private INBT nbt; private String tag; - private String name; - private ResourceLocation entity; - private boolean hasPassenger; - public void setEntity(ResourceLocation entityName) + public void setNBT(INBT nbt) { - this.entity = entityName; + this.nbt = nbt; } - public ResourceLocation getEntity() + public void setTag(String tag) { - return this.entity; + this.tag = tag; + } + + public void set(String tag, INBT nbt) + { + this.setTag(tag); + this.setNBT(nbt); } - public void setHasPassenger(boolean hasPassenger) + public void reset() { - this.hasPassenger = hasPassenger; - } - - public boolean hasPassenger() - { - return this.hasPassenger; - } - - public String getName() - { - return this.name; - } - - public void setName(String name) - { - this.name = name; + this.set(null, null); } @Override public INBT serialize() { - if(this.name != null) - { - if(this.name.equalsIgnoreCase("Cat")) - { - this.tag = "CatType"; - return IntNBT.valueOf(this.random.nextInt(3) + 1); - } - else if(this.name.equalsIgnoreCase("Farmer") || this.name.equalsIgnoreCase("Fisherman") || this.name.equalsIgnoreCase("Shepherd") || this.name.equalsIgnoreCase("Fletcher")) - { - this.tag = "Profession"; - return IntNBT.valueOf(0); - } - else if(this.name.equalsIgnoreCase("Librarian") || this.name.equalsIgnoreCase("Carthographer")) - { - this.tag = "Profession"; - return IntNBT.valueOf(1); - } - else if(this.name.equalsIgnoreCase("Cleric") || this.name.equalsIgnoreCase("Priest")) - { - this.tag = "Profession"; - return IntNBT.valueOf(2); - } - else if(this.name.equalsIgnoreCase("Armorer") || this.name.equalsIgnoreCase("Blacksmith") || this.name.equalsIgnoreCase("WeaponSmith") || this.name.equalsIgnoreCase("ToolSmith")) - { - this.tag = "Profession"; - return IntNBT.valueOf(3); - } - else if(this.name.equalsIgnoreCase("Butcher") || this.name.equalsIgnoreCase("Leatherworker")) - { - this.tag = "Profession"; - return IntNBT.valueOf(4); - } - else if(this.name.equalsIgnoreCase("Nitwit")) - { - this.tag = "Profession"; - return IntNBT.valueOf(5); - } - - if(this.entity != null) - { - if(this.entity.equals(EntityType.ZOMBIE.getRegistryName())) - { - if(StringUtils.containsIgnoreCase(this.name, "Baby")) - { - this.tag = "IsBaby"; - return ByteNBT.valueOf((byte) 1); - } - } - else if(this.entity.equals(EntityType.CHICKEN.getRegistryName())) - { - if(StringUtils.containsIgnoreCase(this.name, "Jockey") && !this.hasPassenger) - { - CompoundNBT passenger = new CompoundNBT(); - ListNBT list = new ListNBT(); - - passenger.putString("id", EntityType.ZOMBIE.getRegistryName().toString()); - passenger.putBoolean("IsBaby", true); - list.add(passenger); - - this.tag = "Passengers"; - return list; - } - } - else if(this.entity.equals(EntityType.SPIDER.getRegistryName())) - { - if(StringUtils.containsIgnoreCase(this.name, "Jockey") && !this.hasPassenger) - { - CompoundNBT passenger = new CompoundNBT(); - ListNBT list = new ListNBT(); - - passenger.putString("id", EntityType.SKELETON.getRegistryName().toString()); - list.add(passenger); - - this.tag = "Passengers"; - return list; - } - } - } - } - - return null; + return this.nbt; } @Override @@ -151,128 +43,4 @@ public class ComponentSummon implements IBuilderComponent { return this.tag; } - - @Nullable - public static ResourceLocation resolve(String entityName) - { - String name = ResourceHelper.stripToResourceLocation(entityName); - - for(EntityType type : ForgeRegistries.ENTITIES.getValues()) - { - if(type.isSummonable() && entityName.equalsIgnoreCase(I18n.format(type.getTranslationKey()))) - { - return type.getRegistryName(); - } - } - - String entity = name.replaceAll("_", ""); - - if(entity.equalsIgnoreCase("RedCow")) - { - return EntityType.MOOSHROOM.getRegistryName(); - } - else if(entity.equalsIgnoreCase("ChickenJockey")) - { - return EntityType.CHICKEN.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Pigman") || entity.equalsIgnoreCase("ZombiePig") || entity.equalsIgnoreCase("ZombiePigman")) - { - return EntityType.ZOMBIE_PIGMAN.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Wither")) - { - return EntityType.WITHER.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Dog")) - { - return EntityType.WOLF.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Dragon")) - { - return EntityType.ENDER_DRAGON.getRegistryName(); - } - else if(entity.equalsIgnoreCase("minecraft:SnowGolem")) - { - return EntityType.SNOW_GOLEM.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Horse") || entity.equalsIgnoreCase("ZombieHorse") || entity.equalsIgnoreCase("SkeletonHorse")) - { - return EntityType.HORSE.getRegistryName(); - } - else if(entity.equalsIgnoreCase("LavaCube")|| entity.equalsIgnoreCase("MagmaSlime") || entity.equalsIgnoreCase("MagmaCube")) - { - return EntityType.MAGMA_CUBE.getRegistryName(); - } - else if(entity.equalsIgnoreCase("SpiderJockey")) - { - return EntityType.SPIDER.getRegistryName(); - } - else if(entity.equalsIgnoreCase("IronGolem")) - { - return EntityType.IRON_GOLEM.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Ozelot") || entity.equals("Ocelot") || entity.equalsIgnoreCase("Cat") || entity.equalsIgnoreCase("Kitty") || entity.equalsIgnoreCase("Kitten")) - { - return EntityType.OCELOT.getRegistryName(); - } - else if(entity.equalsIgnoreCase("TESTIFICATE") || entity.equalsIgnoreCase("Blacksmith") || entity.equalsIgnoreCase("Farmer") || entity.equalsIgnoreCase("Fisherman") || entity.equalsIgnoreCase("Shepherd") || entity.equalsIgnoreCase("Fletcher") || entity.equalsIgnoreCase("Librarian") || entity.equalsIgnoreCase("Cleric") || entity.equalsIgnoreCase("Priest") || entity.equalsIgnoreCase("Armorer") || entity.equalsIgnoreCase("WeaponSmith") || entity.equalsIgnoreCase("ToolSmith") || entity.equalsIgnoreCase("Butcher") || entity.equalsIgnoreCase("Leatherworker") || entity.equalsIgnoreCase("Carthographer") || entity.equalsIgnoreCase("Nitwit")) - { - return EntityType.VILLAGER.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Octopus") || entity.equalsIgnoreCase("Kraken")) - { - return EntityType.SQUID.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Exwife")) - { - return EntityType.GHAST.getRegistryName(); - } - else if(entity.equalsIgnoreCase("TNTMinecart")) - { - return EntityType.TNT_MINECART.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Minecart")) - { - return EntityType.MINECART.getRegistryName(); - } - else if(entity.equalsIgnoreCase("HopperMinecart")) - { - return EntityType.HOPPER_MINECART.getRegistryName(); - } - else if(entity.equalsIgnoreCase("ChestMinecart")) - { - return EntityType.CHEST_MINECART.getRegistryName(); - } - else if(entity.equalsIgnoreCase("SpawnerMinecart")) - { - return EntityType.SPAWNER_MINECART.getRegistryName(); - } - else if(entity.equalsIgnoreCase("FurnaceMinecart")) - { - return EntityType.FURNACE_MINECART.getRegistryName(); - } - else if(entity.equalsIgnoreCase("CommandBlockMinecart") || entity.equalsIgnoreCase("MinecartCommand") || entity.equalsIgnoreCase("CommandMinecart")) - { - return EntityType.COMMAND_BLOCK_MINECART.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Wizard")) - { - return EntityType.EVOKER.getRegistryName(); - } - else if(entity.equalsIgnoreCase("Johnny")) - { - return EntityType.VINDICATOR.getRegistryName(); - } - else if(entity.equalsIgnoreCase("BabyZombie")) - { - return EntityType.ZOMBIE.getRegistryName(); - } - - if(entity == null || entity.isEmpty()) - { - return null; - } - - return ResourceHelper.stringToResourceLocation(name); - } } diff --git a/src/main/java/exopandora/worldhandler/builder/component/impl/EntityNBT.java b/src/main/java/exopandora/worldhandler/builder/component/impl/EntityNBT.java new file mode 100644 index 0000000..b741fa0 --- /dev/null +++ b/src/main/java/exopandora/worldhandler/builder/component/impl/EntityNBT.java @@ -0,0 +1,430 @@ +package exopandora.worldhandler.builder.component.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.apache.commons.lang3.ArrayUtils; + +import exopandora.worldhandler.builder.component.IBuilderComponent; +import exopandora.worldhandler.builder.impl.EnumAttributes; +import exopandora.worldhandler.builder.impl.EnumAttributes.Applyable; +import exopandora.worldhandler.util.MutableStringTextComponent; +import exopandora.worldhandler.util.NBTHelper; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.item.Item; +import net.minecraft.nbt.ByteNBT; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.INBT; +import net.minecraft.nbt.IntNBT; +import net.minecraft.nbt.StringNBT; +import net.minecraft.potion.Effect; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +public class EntityNBT implements IBuilderComponent +{ + private ResourceLocation id; + private String command; + private Integer time; + private double[] motion = {0.0, 0.0, 0.0}; + private boolean isBaby; + private BlockState blockState; + private ComponentCustom entity = new ComponentCustom(); + private ComponentAttributeMob attribute = new ComponentAttributeMob(attribute -> attribute.getApplyable().equals(Applyable.BOTH) || attribute.getApplyable().equals(Applyable.MOB)); + private MutableStringTextComponent customName = new MutableStringTextComponent(); + private List passengers = new ArrayList(); + private ResourceLocation[] armorItems = {Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName()}; + private ResourceLocation[] handItems = {Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName()}; + private ComponentPotionMob potion = new ComponentPotionMob(); + + public EntityNBT() + { + super(); + } + + public EntityNBT(ResourceLocation id) + { + this.id = id; + } + + public void setId(ResourceLocation id) + { + this.id = id; + } + + public ResourceLocation getId() + { + return this.id; + } + + public void setAttribute(EnumAttributes attribute, double ammount) + { + this.attribute.set(attribute, ammount); + } + + public void removeAttribute(EnumAttributes attribute) + { + this.attribute.remove(attribute); + } + + public double getAttributeAmmount(EnumAttributes attribute) + { + return this.attribute.getAmmount(attribute); + } + + public Set getAttributes() + { + return this.attribute.getAttributes(); + } + + public void setCustomName(String name) + { + this.customName.setText(name); + } + + @Nullable + public MutableStringTextComponent getCustomName() + { + return this.customName; + } + + public void setPassenger(int index, EntityNBT entity) + { + if(index < 0 || index >= this.passengers.size()) + { + this.passengers.add(entity); + } + else + { + this.passengers.set(index, entity); + } + } + + public void setPassenger(int index, ResourceLocation id) + { + this.setPassenger(index, new EntityNBT(id)); + } + + public void addPassenger(EntityNBT entity) + { + this.passengers.add(entity); + } + + public void addPassenger(int index, EntityNBT entity) + { + this.passengers.add(index, entity); + } + + public void removePassenger(int index) + { + this.passengers.remove(index); + } + + public int getPassengerCount() + { + return this.passengers.size(); + } + + public List getPassengers() + { + return this.passengers; + } + + @Nullable + public EntityNBT getPassenger(int index) + { + if(index >= 0 && index <= this.passengers.size()) + { + return this.passengers.get(index); + } + + return null; + } + + public boolean hasPassengers() + { + for(EntityNBT entity : this.passengers) + { + if(entity.serialize() != null) + { + return true; + } + } + + return false; + } + + public void setArmorItem(int index, Block block) + { + this.setArmorItem(index, block.getRegistryName()); + } + + public void setArmorItem(int index, Item item) + { + this.setArmorItem(index, item.getRegistryName()); + } + + public void setArmorItem(int index, ResourceLocation location) + { + if(ArrayUtils.isArrayIndexValid(this.armorItems, index) && location != null) + { + this.armorItems[index] = location; + } + } + + public void setArmorItems(ResourceLocation[] armor) + { + this.armorItems = armor; + } + + @Nonnull + public ResourceLocation getArmorItem(int slot) + { + if(ArrayUtils.isArrayIndexValid(this.armorItems, slot)) + { + return this.armorItems[slot]; + } + + return Blocks.AIR.getRegistryName(); + } + + public void setHandItem(int index, Block block) + { + this.setHandItem(index, block.getRegistryName()); + } + + public void setHandItem(int index, Item item) + { + this.setHandItem(index, item.getRegistryName()); + } + + public void setHandItem(int index, ResourceLocation location) + { + if(ArrayUtils.isArrayIndexValid(this.handItems, index) && location != null) + { + this.handItems[index] = location; + } + } + + @Nonnull + public ResourceLocation getHandItem(int slot) + { + if(ArrayUtils.isArrayIndexValid(this.handItems, slot)) + { + return this.handItems[slot]; + } + + return Blocks.AIR.getRegistryName(); + } + + public double[] getMotion() + { + return this.motion; + } + + public void setMotion(double x, double y, double z) + { + this.setMotionX(x); + this.setMotionY(y); + this.setMotionZ(z); + } + + public double getMotionX() + { + return this.motion[0]; + } + + public double getMotionY() + { + return this.motion[1]; + } + + public double getMotionZ() + { + return this.motion[2]; + } + + public void setMotionX(double x) + { + this.motion[0] = x; + } + + public void setMotionY(double y) + { + this.motion[1] = y; + } + + public void setMotionZ(double z) + { + this.motion[2] = z; + } + + public void setAmplifier(Effect potion, byte amplifier) + { + this.potion.setAmplifier(potion, amplifier); + } + + public void setSeconds(Effect potion, int seconds) + { + this.potion.setSeconds(potion, seconds); + } + + public void setMinutes(Effect potion, int minutes) + { + this.potion.setMinutes(potion, minutes); + } + + public void setHours(Effect potion, int hours) + { + this.potion.setHours(potion, hours); + } + + public void setShowParticles(Effect potion, boolean showParticles) + { + this.potion.setShowParticles(potion, showParticles); + } + + public void setAmbient(Effect potion, boolean ambient) + { + this.potion.setAmbient(potion, ambient); + } + + public byte getAmplifier(Effect potion) + { + return this.potion.getAmplifier(potion); + } + + public int getSeconds(Effect potion) + { + return this.potion.getSeconds(potion); + } + + public int getMinutes(Effect potion) + { + return this.potion.getMinutes(potion); + } + + public int getHours(Effect potion) + { + return this.potion.getHours(potion); + } + + public boolean getShowParticles(Effect potion) + { + return this.potion.getShowParticles(potion); + } + + public boolean getAmbient(Effect potion) + { + return this.potion.getAmbient(potion); + } + + public Set getEffects() + { + return this.potion.getEffects(); + } + + public void setBlockState(BlockState blockState) + { + this.blockState = blockState; + } + + public BlockState getBlockState() + { + return this.blockState; + } + + public void setTime(int time) + { + this.time = time; + } + + public int getTime() + { + return this.time; + } + + public void setCustomComponent(String tag, INBT nbt) + { + this.entity.set(tag, nbt); + } + + public void resetCustomComponent() + { + this.entity.set(null, null); + } + + public void setIsBaby(boolean baby) + { + this.isBaby = baby; + } + + public boolean isBaby() + { + return this.isBaby; + } + + public void setCommand(String command) + { + this.command = command; + } + + public String getCommand() + { + return this.command; + } + + @Override + public CompoundNBT serialize() + { + CompoundNBT nbt = new CompoundNBT(); + + if(this.time != null) + { + NBTHelper.append(nbt, "Time", IntNBT.valueOf(this.time)); + } + + if(this.command != null) + { + NBTHelper.append(nbt, "Command", StringNBT.valueOf(this.command)); + } + + if(this.isBaby) + { + NBTHelper.append(nbt, "IsBaby", ByteNBT.valueOf(true)); + } + + NBTHelper.append(nbt, "id", NBTHelper.serialize(this.id)); + NBTHelper.append(nbt, "Motion", NBTHelper.serialize(this.motion)); + NBTHelper.append(nbt, "Passengers", NBTHelper.serialize(this.passengers)); + NBTHelper.append(nbt, "ArmorItems", NBTHelper.serialize(this.armorItems)); + NBTHelper.append(nbt, "BlockState", NBTHelper.serialize(this.blockState)); + + NBTHelper.append(nbt, "CustomName", this.customName); + + NBTHelper.append(nbt, this.entity); + NBTHelper.append(nbt, this.potion); + NBTHelper.append(nbt, this.attribute); + + if(nbt.isEmpty()) + { + return null; + } + + return nbt; + } + + @Override + public String getTag() + { + return null; + } +} diff --git a/src/main/java/exopandora/worldhandler/builder/impl/BuilderSummon.java b/src/main/java/exopandora/worldhandler/builder/impl/BuilderSummon.java index 1b5b9f5..4864593 100644 --- a/src/main/java/exopandora/worldhandler/builder/impl/BuilderSummon.java +++ b/src/main/java/exopandora/worldhandler/builder/impl/BuilderSummon.java @@ -1,69 +1,65 @@ package exopandora.worldhandler.builder.impl; +import java.util.List; +import java.util.Random; import java.util.Set; -import java.util.function.Consumer; -import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.apache.commons.lang3.StringUtils; + import exopandora.worldhandler.builder.CommandBuilderNBT; import exopandora.worldhandler.builder.CommandSyntax; -import exopandora.worldhandler.builder.component.impl.ComponentAttributeMob; -import exopandora.worldhandler.builder.component.impl.ComponentPotionMob; -import exopandora.worldhandler.builder.component.impl.ComponentSummon; -import exopandora.worldhandler.builder.component.impl.ComponentTag; -import exopandora.worldhandler.builder.impl.EnumAttributes.Applyable; -import exopandora.worldhandler.builder.types.Coordinate.CoordinateType; -import exopandora.worldhandler.util.MutableStringTextComponent; -import exopandora.worldhandler.builder.types.CoordinateDouble; +import exopandora.worldhandler.builder.component.impl.EntityNBT; import exopandora.worldhandler.builder.types.ArgumentType; +import exopandora.worldhandler.builder.types.Coordinate.EnumType; +import exopandora.worldhandler.builder.types.CoordinateDouble; +import exopandora.worldhandler.util.MutableStringTextComponent; +import exopandora.worldhandler.util.ResourceHelper; import net.minecraft.block.Block; -import net.minecraft.block.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.merchant.villager.VillagerProfession; import net.minecraft.item.Item; +import net.minecraft.item.Items; +import net.minecraft.nbt.ByteNBT; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.nbt.INBT; +import net.minecraft.nbt.IntNBT; import net.minecraft.nbt.ListNBT; -import net.minecraft.nbt.StringNBT; import net.minecraft.potion.Effect; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.registries.ForgeRegistries; @OnlyIn(Dist.CLIENT) public class BuilderSummon extends CommandBuilderNBT { - private final ComponentAttributeMob attribute; - private final ComponentTag customName; - private final ComponentTag passengers; - private final ComponentTag armorItems; - private final ComponentTag handItems; - private final ComponentPotionMob potion; - private final ComponentSummon summon; - private final ResourceLocation[] armorItemsArray = {Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName()}; - private final ResourceLocation[] handItemsArray = {Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName()}; + private final EntityNBT nbt = new EntityNBT(); public BuilderSummon() { - this.attribute = this.registerNBTComponent(new ComponentAttributeMob(attribute -> attribute.getApplyable().equals(Applyable.BOTH) || attribute.getApplyable().equals(Applyable.MOB))); - this.customName = this.registerNBTComponent(new ComponentTag("CustomName", new MutableStringTextComponent(), this::textComponentSerializer)); - this.passengers = this.registerNBTComponent(new ComponentTag("Passengers")); - this.armorItems = this.registerNBTComponent(new ComponentTag("ArmorItems", this::itemListSerializer)); - this.handItems = this.registerNBTComponent(new ComponentTag("HandItems", this::itemListSerializer)); - this.summon = this.registerNBTComponent(new ComponentSummon(), "summon"); - this.potion = this.registerNBTComponent(new ComponentPotionMob()); - this.setX(new CoordinateDouble(0.0, CoordinateType.LOCAL)); - this.setY(new CoordinateDouble(0.0, CoordinateType.LOCAL)); - this.setZ(new CoordinateDouble(2.0, CoordinateType.LOCAL)); + this.setX(new CoordinateDouble(0.0, EnumType.LOCAL)); + this.setY(new CoordinateDouble(0.0, EnumType.LOCAL)); + this.setZ(new CoordinateDouble(2.0, EnumType.LOCAL)); } - public void setEntity(String entityName) + public void setName(String name) { - ResourceLocation location = ComponentSummon.resolve(entityName); - - this.summon.setName(entityName); - this.summon.setEntity(location); - - this.setNode(0, location); + this.setEntity(BuilderSummon.parseEntityName(name)); + this.updateCustomComponent(name); + } + + public void setNameAndId(String name) + { + this.setName(name); + this.nbt.setId(this.getEntity()); + } + + public void setEntity(ResourceLocation entity) + { + this.setNode(0, entity); } public ResourceLocation getEntity() @@ -101,258 +97,282 @@ public class BuilderSummon extends CommandBuilderNBT return this.getNodeAsCoordinateDouble(3); } + public void setId(ResourceLocation resource) + { + this.nbt.setId(resource); + } + + public ResourceLocation getId() + { + return this.nbt.getId(); + } + public void setAttribute(EnumAttributes attribute, double ammount) { - this.attribute.set(attribute, ammount); + this.nbt.setAttribute(attribute, ammount); } public void removeAttribute(EnumAttributes attribute) { - this.attribute.remove(attribute); + this.nbt.removeAttribute(attribute); } public double getAttributeAmmount(EnumAttributes attribute) { - return this.attribute.getAmmount(attribute); + return this.nbt.getAttributeAmmount(attribute); } public Set getAttributes() { - return this.attribute.getAttributes(); - } - - public void setCustomName(MutableStringTextComponent name) - { - this.customName.setValue(name); + return this.nbt.getAttributes(); } public void setCustomName(String name) { - this.customName.getValue().setText(name); - } - - @Nonnull - public MutableStringTextComponent getCustomName() - { - if(this.customName.getValue() != null) - { - return this.customName.getValue(); - } - - return null; - } - - public void setPassenger(String entityName) - { - this.setPassenger(ComponentSummon.resolve(entityName)); - } - - public void setPassenger(ResourceLocation entityName) - { - if(entityName != null) - { - CompoundNBT passenger = new CompoundNBT(); - passenger.putString("id", entityName.toString()); - - ListNBT list = new ListNBT(); - list.add(passenger); - - this.passengers.setValue(list); - } - else - { - this.passengers.setValue(null); - } + this.nbt.setCustomName(name); } @Nullable - public ResourceLocation getPassenger() + public MutableStringTextComponent getCustomName() { - ListNBT list = this.passengers.getValue(); - - if(list != null && !list.isEmpty()) - { - return new ResourceLocation(list.getCompound(0).getString("id")); - } - - return null; + return this.nbt.getCustomName(); + } + + public void setPassenger(int index, String name) + { + this.nbt.setPassenger(index, BuilderSummon.parseEntityName(name)); + } + + public void setPassenger(int index, EntityNBT entity) + { + this.nbt.setPassenger(index, entity); + } + + public void setPassenger(int index, ResourceLocation id) + { + this.setPassenger(index, new EntityNBT(id)); + } + + public void addPassenger(EntityNBT entity) + { + this.nbt.addPassenger(entity); + } + + public void addPassenger(int index, EntityNBT entity) + { + this.nbt.addPassenger(index, entity); + } + + public void removePassenger(int index) + { + this.nbt.removePassenger(index); + } + + public int getPassengerCount() + { + return this.nbt.getPassengerCount(); + } + + public List getPassengers() + { + return this.nbt.getPassengers(); + } + + @Nullable + public EntityNBT getPassenger(int index) + { + return this.nbt.getPassenger(index); + } + + public boolean hasPassengers() + { + return this.nbt.hasPassengers(); } public void setArmorItem(int index, Block block) { - this.setArmorItem(index, block.getRegistryName()); + this.nbt.setArmorItem(index, block); } public void setArmorItem(int index, Item item) { - this.setArmorItem(index, item.getRegistryName()); + this.nbt.setArmorItem(index, item); } public void setArmorItem(int index, ResourceLocation location) { - this.changeNBTList(index, location, this.armorItemsArray, this::setArmorItems); + this.nbt.setArmorItem(index, location); } public void setArmorItems(ResourceLocation[] armor) { - ListNBT list = new ListNBT(); - - for(ResourceLocation item : armor) - { - CompoundNBT compound = new CompoundNBT(); - compound.putString("id", item.toString()); - compound.putInt("Count", 1); - list.add(compound); - } - - this.armorItems.setValue(list); + this.nbt.setArmorItems(armor); } - + public ResourceLocation getArmorItem(int slot) { - if(slot < this.armorItemsArray.length) - { - return this.armorItemsArray[slot]; - } - - return Blocks.AIR.getRegistryName(); + return this.nbt.getArmorItem(slot); } public void setHandItem(int index, Block block) { - this.setHandItem(index, block.getRegistryName()); + this.nbt.setHandItem(index, block); } public void setHandItem(int index, Item item) { - this.setHandItem(index, item.getRegistryName()); + this.nbt.setHandItem(index, item); } public void setHandItem(int index, ResourceLocation location) { - this.changeNBTList(index, location, this.handItemsArray, this::setHandItems); - } - - private void changeNBTList(int index, ResourceLocation location, ResourceLocation[] array, Consumer consumer) - { - if(index < array.length) - { - array[index] = location; - consumer.accept(array); - } - } - - public void setHandItems(ResourceLocation[] armor) - { - ListNBT list = new ListNBT(); - - for(ResourceLocation item : armor) - { - CompoundNBT compound = new CompoundNBT(); - compound.putString("id", item.toString()); - compound.putInt("Count", 1); - list.add(compound); - } - - this.handItems.setValue(list); + this.nbt.setHandItem(index, location); } public ResourceLocation getHandItem(int slot) { - if(slot < this.handItemsArray.length) - { - return this.handItemsArray[slot]; - } - - return Blocks.AIR.getRegistryName(); + return this.nbt.getHandItem(slot); + } + + public double[] getMotion() + { + return this.nbt.getMotion(); + } + + public void setMotion(double x, double y, double z) + { + this.nbt.setMotion(x, y, z); + } + + public double getMotionX() + { + return this.nbt.getMotionX(); + } + + public double getMotionY() + { + return this.nbt.getMotionY(); + } + + public double getMotionZ() + { + return this.nbt.getMotionZ(); + } + + public void setMotionX(double x) + { + this.nbt.setMotionX(x); + } + + public void setMotionY(double y) + { + this.nbt.setMotionY(y); + } + + public void setMotionZ(double z) + { + this.nbt.setMotionZ(z); } public void setAmplifier(Effect potion, byte amplifier) { - this.potion.setAmplifier(potion, amplifier); + this.nbt.setAmplifier(potion, amplifier); } public void setSeconds(Effect potion, int seconds) { - this.potion.setSeconds(potion, seconds); + this.nbt.setSeconds(potion, seconds); } public void setMinutes(Effect potion, int minutes) { - this.potion.setMinutes(potion, minutes); + this.nbt.setMinutes(potion, minutes); } public void setHours(Effect potion, int hours) { - this.potion.setHours(potion, hours); + this.nbt.setHours(potion, hours); } public void setShowParticles(Effect potion, boolean showParticles) { - this.potion.setShowParticles(potion, showParticles); + this.nbt.setShowParticles(potion, showParticles); } public void setAmbient(Effect potion, boolean ambient) { - this.potion.setAmbient(potion, ambient); + this.nbt.setAmbient(potion, ambient); } public byte getAmplifier(Effect potion) { - return this.potion.getAmplifier(potion); + return this.nbt.getAmplifier(potion); } public int getSeconds(Effect potion) { - return this.potion.getSeconds(potion); + return this.nbt.getSeconds(potion); } public int getMinutes(Effect potion) { - return this.potion.getMinutes(potion); + return this.nbt.getMinutes(potion); } public int getHours(Effect potion) { - return this.potion.getHours(potion); + return this.nbt.getHours(potion); } public boolean getShowParticles(Effect potion) { - return this.potion.getShowParticles(potion); + return this.nbt.getShowParticles(potion); } public boolean getAmbient(Effect potion) { - return this.potion.getAmbient(potion); + return this.nbt.getAmbient(potion); } public Set getEffects() { - return this.potion.getEffects(); + return this.nbt.getEffects(); } - private INBT itemListSerializer(ListNBT list) + public void setBlockState(BlockState blockState) { - for(int x = 0; x < list.size(); x++) - { - if(!list.getCompound(x).getString("id").equals(Blocks.AIR.getRegistryName().toString())) - { - return list; - } - } - - return null; + this.nbt.setBlockState(blockState); } - private INBT textComponentSerializer(MutableStringTextComponent string) + public BlockState getBlockState() { - if(string.getUnformattedComponentText() != null && !string.getUnformattedComponentText().isEmpty()) - { - return StringNBT.valueOf(string.serialize()); - } - - return null; + return this.nbt.getBlockState(); + } + + public void setTime(int time) + { + this.nbt.setTime(time); + } + + public int getTime() + { + return this.nbt.getTime(); + } + + public void setCommand(String command) + { + this.nbt.setCommand(command); + } + + public String getCommand() + { + return this.nbt.getCommand(); + } + + @Override + protected CompoundNBT buildNBT() + { + return this.nbt.serialize(); } @Override @@ -381,12 +401,196 @@ public class BuilderSummon extends CommandBuilderNBT return syntax; } - @Override - public String toCommand() + private void updateCustomComponent(String name) { - this.summon.setEntity(this.getEntity()); - this.summon.setHasPassenger(this.getPassenger() != null); + if(name != null && this.getEntity() != null) + { + if(EntityType.CAT.getRegistryName().equals(this.getEntity())) + { + this.nbt.setCustomComponent("CatType", IntNBT.valueOf(new Random().nextInt(11))); + } + else if(EntityType.VILLAGER.getRegistryName().equals(this.getEntity())) + { + for(VillagerProfession profession : ForgeRegistries.PROFESSIONS) + { + if(StringUtils.equalsIgnoreCase(name, profession.toString())) + { + CompoundNBT villagerData = new CompoundNBT(); + villagerData.putString("profession", profession.getRegistryName().toString()); + + this.nbt.setCustomComponent("VillagerData", villagerData); + break; + } + } + } + else if(EntityType.ZOMBIE.getRegistryName().equals(this.getEntity())) + { + if(StringUtils.containsIgnoreCase(name, "Baby")) + { + this.nbt.setCustomComponent("IsBaby", ByteNBT.valueOf((byte) 1)); + } + } + else if(EntityType.CHICKEN.getRegistryName().equals(this.getEntity())) + { + if(StringUtils.containsIgnoreCase(name, "Jockey") && !this.nbt.hasPassengers()) + { + ListNBT list = new ListNBT(); + EntityNBT zombie = new EntityNBT(EntityType.ZOMBIE.getRegistryName()); + + zombie.setIsBaby(true); + list.add(zombie.serialize()); + this.nbt.setCustomComponent("Passengers", list); + } + } + else if(EntityType.SPIDER.getRegistryName().equals(this.getEntity())) + { + if(StringUtils.containsIgnoreCase(name, "Jockey") && !this.nbt.hasPassengers()) + { + ListNBT list = new ListNBT(); + EntityNBT skeleton = new EntityNBT(EntityType.SKELETON.getRegistryName()); + + skeleton.setHandItem(0, Items.BOW); + list.add(skeleton.serialize()); + + this.nbt.setCustomComponent("Passengers", list); + } + } + else + { + this.nbt.resetCustomComponent(); + } + } + else + { + this.nbt.resetCustomComponent(); + } + } + + @Nullable + public static ResourceLocation parseEntityName(String entityName) + { + String name = ResourceHelper.stripToResourceLocation(entityName); - return super.toCommand(); + for(EntityType type : ForgeRegistries.ENTITIES.getValues()) + { + if(type.isSummonable() && entityName.equalsIgnoreCase(I18n.format(type.getTranslationKey()))) + { + return type.getRegistryName(); + } + } + + String entity = name.replaceAll("_", ""); + + if(entity.equalsIgnoreCase("RedCow")) + { + return EntityType.MOOSHROOM.getRegistryName(); + } + else if(entity.equalsIgnoreCase("ChickenJockey")) + { + return EntityType.CHICKEN.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Pigman") || entity.equalsIgnoreCase("ZombiePig") || entity.equalsIgnoreCase("ZombiePigman")) + { + return EntityType.ZOMBIE_PIGMAN.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Wither")) + { + return EntityType.WITHER.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Dog")) + { + return EntityType.WOLF.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Dragon")) + { + return EntityType.ENDER_DRAGON.getRegistryName(); + } + else if(entity.equalsIgnoreCase("SnowMan")) + { + return EntityType.SNOW_GOLEM.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Horse") || entity.equalsIgnoreCase("ZombieHorse") || entity.equalsIgnoreCase("SkeletonHorse")) + { + return EntityType.HORSE.getRegistryName(); + } + else if(entity.equalsIgnoreCase("LavaCube")|| entity.equalsIgnoreCase("MagmaSlime") || entity.equalsIgnoreCase("MagmaCube")) + { + return EntityType.MAGMA_CUBE.getRegistryName(); + } + else if(entity.equalsIgnoreCase("SpiderJockey")) + { + return EntityType.SPIDER.getRegistryName(); + } + else if(entity.equalsIgnoreCase("IronGolem")) + { + return EntityType.IRON_GOLEM.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Ozelot") || entity.equals("Ocelot")) + { + return EntityType.OCELOT.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Kitty") || entity.equalsIgnoreCase("Kitten")) + { + return EntityType.CAT.getRegistryName(); + } + else if(entity.equalsIgnoreCase("TESTIFICATE") || entity.equalsIgnoreCase("Blacksmith") || entity.equalsIgnoreCase("Farmer") || entity.equalsIgnoreCase("Fisherman") || entity.equalsIgnoreCase("Shepherd") || entity.equalsIgnoreCase("Fletcher") || entity.equalsIgnoreCase("Librarian") || entity.equalsIgnoreCase("Cleric") || entity.equalsIgnoreCase("Priest") || entity.equalsIgnoreCase("Armorer") || entity.equalsIgnoreCase("WeaponSmith") || entity.equalsIgnoreCase("ToolSmith") || entity.equalsIgnoreCase("Butcher") || entity.equalsIgnoreCase("Leatherworker") || entity.equalsIgnoreCase("Carthographer") || entity.equalsIgnoreCase("Nitwit")) + { + return EntityType.VILLAGER.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Octopus") || entity.equalsIgnoreCase("Kraken")) + { + return EntityType.SQUID.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Exwife")) + { + return EntityType.GHAST.getRegistryName(); + } + else if(entity.equalsIgnoreCase("TNTMinecart")) + { + return EntityType.TNT_MINECART.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Minecart")) + { + return EntityType.MINECART.getRegistryName(); + } + else if(entity.equalsIgnoreCase("HopperMinecart")) + { + return EntityType.HOPPER_MINECART.getRegistryName(); + } + else if(entity.equalsIgnoreCase("ChestMinecart")) + { + return EntityType.CHEST_MINECART.getRegistryName(); + } + else if(entity.equalsIgnoreCase("SpawnerMinecart")) + { + return EntityType.SPAWNER_MINECART.getRegistryName(); + } + else if(entity.equalsIgnoreCase("FurnaceMinecart")) + { + return EntityType.FURNACE_MINECART.getRegistryName(); + } + else if(entity.equalsIgnoreCase("CommandBlockMinecart") || entity.equalsIgnoreCase("MinecartCommand") || entity.equalsIgnoreCase("CommandMinecart")) + { + return EntityType.COMMAND_BLOCK_MINECART.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Wizard")) + { + return EntityType.EVOKER.getRegistryName(); + } + else if(entity.equalsIgnoreCase("Johnny")) + { + return EntityType.VINDICATOR.getRegistryName(); + } + else if(entity.equalsIgnoreCase("BabyZombie")) + { + return EntityType.ZOMBIE.getRegistryName(); + } + + if(entity == null || entity.isEmpty()) + { + return null; + } + + return ResourceHelper.stringToResourceLocation(name); } } diff --git a/src/main/java/exopandora/worldhandler/gui/category/Categories.java b/src/main/java/exopandora/worldhandler/gui/category/Categories.java index 802e9de..f56f1ca 100644 --- a/src/main/java/exopandora/worldhandler/gui/category/Categories.java +++ b/src/main/java/exopandora/worldhandler/gui/category/Categories.java @@ -8,24 +8,13 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class Categories { - public static final Category MAIN; - public static final Category ENTITIES; - public static final Category ITEMS; - public static final Category BLOCKS; - public static final Category WORLD; - public static final Category PLAYER; - public static final Category SCOREBOARD; - - static - { - MAIN = Categories.getRegisteredCategory("main"); - ENTITIES = Categories.getRegisteredCategory("entities"); - ITEMS = Categories.getRegisteredCategory("items"); - BLOCKS = Categories.getRegisteredCategory("blocks"); - WORLD = Categories.getRegisteredCategory("world"); - PLAYER = Categories.getRegisteredCategory("player"); - SCOREBOARD = Categories.getRegisteredCategory("scoreboard"); - } + public static final Category MAIN = Categories.getRegisteredCategory("main"); + public static final Category ENTITIES = Categories.getRegisteredCategory("entities"); + public static final Category ITEMS = Categories.getRegisteredCategory("items"); + public static final Category BLOCKS = Categories.getRegisteredCategory("blocks"); + public static final Category WORLD = Categories.getRegisteredCategory("world"); + public static final Category PLAYER = Categories.getRegisteredCategory("player"); + public static final Category SCOREBOARD = Categories.getRegisteredCategory("scoreboard"); public static Category getRegisteredCategory(String name) { diff --git a/src/main/java/exopandora/worldhandler/gui/category/Category.java b/src/main/java/exopandora/worldhandler/gui/category/Category.java index 533a82d..c208bad 100644 --- a/src/main/java/exopandora/worldhandler/gui/category/Category.java +++ b/src/main/java/exopandora/worldhandler/gui/category/Category.java @@ -93,7 +93,7 @@ public class Category extends ForgeRegistryEntry public static void register(Register event) { RegistryHelper.register(event.getRegistry(), "main", new Category("main", "containers", "multiplayer")); - RegistryHelper.register(event.getRegistry(), "entities", new Category("summon")); + RegistryHelper.register(event.getRegistry(), "entities", new Category("summon", "butcher")); RegistryHelper.register(event.getRegistry(), "items", new Category("custom_item", "enchantment", "recipes")); RegistryHelper.register(event.getRegistry(), "blocks", new Category("edit_blocks", "sign_editor", "note_editor")); RegistryHelper.register(event.getRegistry(), "world", new Category("world", "gamerules")); diff --git a/src/main/java/exopandora/worldhandler/gui/content/Content.java b/src/main/java/exopandora/worldhandler/gui/content/Content.java index 3f74b32..0c8faad 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/Content.java +++ b/src/main/java/exopandora/worldhandler/gui/content/Content.java @@ -9,6 +9,7 @@ import exopandora.worldhandler.gui.content.impl.ContentAdvancements; import exopandora.worldhandler.gui.content.impl.ContentButcher; import exopandora.worldhandler.gui.content.impl.ContentButcherSettings; import exopandora.worldhandler.gui.content.impl.ContentChangeWorld; +import exopandora.worldhandler.gui.content.impl.ContentCommandStack; import exopandora.worldhandler.gui.content.impl.ContentContainers; import exopandora.worldhandler.gui.content.impl.ContentContinue; import exopandora.worldhandler.gui.content.impl.ContentCustomItem; @@ -100,6 +101,7 @@ public abstract class Content extends ForgeRegistryEntry implements ICo //NO CATEGORY RegistryHelper.register(event.getRegistry(), "potions", new ContentPotions()); + RegistryHelper.register(event.getRegistry(), "command_stack", new ContentCommandStack()); RegistryHelper.register(event.getRegistry(), "butcher", new ContentButcher()); RegistryHelper.register(event.getRegistry(), "butcher_settings", new ContentButcherSettings()); RegistryHelper.register(event.getRegistry(), "settings", new ContentSettings()); @@ -130,14 +132,6 @@ public abstract class Content extends ForgeRegistryEntry implements ICo this.persistence = new HashMap(); } - if(this.persistence.containsKey(id)) - { - return (T) this.persistence.get(id); - } - - T object = supplier.get(); - this.persistence.put(id, object); - - return object; + return (T) this.persistence.computeIfAbsent(id, key -> supplier.get()); } } diff --git a/src/main/java/exopandora/worldhandler/gui/content/Contents.java b/src/main/java/exopandora/worldhandler/gui/content/Contents.java index 1431b6d..888601d 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/Contents.java +++ b/src/main/java/exopandora/worldhandler/gui/content/Contents.java @@ -10,74 +10,39 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class Contents { - public static final Content MAIN; - public static final Content CONTAINERS; - public static final Content MULTIPLAYER; + public static final Content MAIN = Contents.getRegisteredContent("main"); + public static final Content CONTAINERS = Contents.getRegisteredContent("containers"); + public static final Content MULTIPLAYER = Contents.getRegisteredContent("multiplayer"); - public static final Content SUMMON; + public static final Content SUMMON = Contents.getRegisteredContent("summon"); - public static final Content CUSTOM_ITEM; - public static final Content ENCHANTMENT; + public static final Content CUSTOM_ITEM = Contents.getRegisteredContent("custom_item"); + public static final Content ENCHANTMENT = Contents.getRegisteredContent("enchantment"); - public static final Content EDIT_BLOCKS; - public static final Content SIGN_EDITOR; - public static final Content NOTE_EDITOR; + public static final Content EDIT_BLOCKS = Contents.getRegisteredContent("edit_blocks"); + public static final Content SIGN_EDITOR = Contents.getRegisteredContent("sign_editor"); + public static final Content NOTE_EDITOR = Contents.getRegisteredContent("note_editor"); - public static final Content WORLD_INFO; - public static final Content GAMERULES; - public static final Content RECIPES; + public static final Content WORLD_INFO = Contents.getRegisteredContent("world"); + public static final Content GAMERULES = Contents.getRegisteredContent("gamerules"); + public static final Content RECIPES = Contents.getRegisteredContent("recipes"); - public static final Content PLAYER; - public static final Content EXPERIENCE; - public static final Content ADVANCEMENTS; + public static final Content PLAYER = Contents.getRegisteredContent("player"); + public static final Content EXPERIENCE = Contents.getRegisteredContent("experience"); + public static final Content ADVANCEMENTS = Contents.getRegisteredContent("advancements"); - public static final Content SCOREBOARD_OBJECTIVES; - public static final Content SCOREBOARD_TEAMS; - public static final Content SCOREBOARD_PLAYERS; + public static final Content SCOREBOARD_OBJECTIVES = Contents.getRegisteredContent("scoreboard_objectives"); + public static final Content SCOREBOARD_TEAMS = Contents.getRegisteredContent("scoreboard_teams"); + public static final Content SCOREBOARD_PLAYERS = Contents.getRegisteredContent("scoreboard_players"); - public static final ContentChild CHANGE_WORLD; - public static final ContentContinue CONTINUE; + public static final ContentChild CHANGE_WORLD = (ContentChild) Contents.getRegisteredContent("change_world"); + public static final ContentContinue CONTINUE = (ContentContinue) Contents.getRegisteredContent("continue"); - public static final ContentChild POTIONS; - public static final ContentChild BUTCHER; - public static final ContentChild BUTCHER_SETTINGS; - public static final ContentChild SETTINGS; - - static - { - MAIN = Contents.getRegisteredContent("main"); - CONTAINERS = Contents.getRegisteredContent("containers"); - MULTIPLAYER = Contents.getRegisteredContent("multiplayer"); - - SUMMON = Contents.getRegisteredContent("summon"); - - CUSTOM_ITEM = Contents.getRegisteredContent("custom_item"); - ENCHANTMENT = Contents.getRegisteredContent("enchantment"); - - EDIT_BLOCKS = Contents.getRegisteredContent("edit_blocks"); - SIGN_EDITOR = Contents.getRegisteredContent("sign_editor"); - NOTE_EDITOR = Contents.getRegisteredContent("note_editor"); - - WORLD_INFO = Contents.getRegisteredContent("world"); - GAMERULES = Contents.getRegisteredContent("gamerules"); - RECIPES = Contents.getRegisteredContent("recipes"); - - PLAYER = Contents.getRegisteredContent("player"); - EXPERIENCE = Contents.getRegisteredContent("experience"); - ADVANCEMENTS = Contents.getRegisteredContent("advancements"); - - SCOREBOARD_OBJECTIVES = Contents.getRegisteredContent("scoreboard_objectives"); - SCOREBOARD_TEAMS = Contents.getRegisteredContent("scoreboard_teams"); - SCOREBOARD_PLAYERS = Contents.getRegisteredContent("scoreboard_players"); - - CHANGE_WORLD = (ContentChild) Contents.getRegisteredContent("change_world"); - CONTINUE = (ContentContinue) Contents.getRegisteredContent("continue"); - - POTIONS = (ContentChild) Contents.getRegisteredContent("potions"); - BUTCHER = (ContentChild) Contents.getRegisteredContent("butcher"); - BUTCHER_SETTINGS = (ContentChild) Contents.getRegisteredContent("butcher_settings"); - SETTINGS = (ContentChild) Contents.getRegisteredContent("settings"); - } + public static final ContentChild POTIONS = (ContentChild) Contents.getRegisteredContent("potions"); + public static final ContentChild COMMAND_STACK = (ContentChild) Contents.getRegisteredContent("command_stack"); + public static final Content BUTCHER = Contents.getRegisteredContent("butcher"); + public static final ContentChild BUTCHER_SETTINGS = (ContentChild) Contents.getRegisteredContent("butcher_settings"); + public static final ContentChild SETTINGS = (ContentChild) Contents.getRegisteredContent("settings"); public static Content getRegisteredContent(String name) { diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java index 9fd24aa..7b70a3c 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentButcher.java @@ -5,8 +5,11 @@ import exopandora.worldhandler.builder.impl.BuilderButcher; import exopandora.worldhandler.config.Config; import exopandora.worldhandler.gui.button.GuiButtonBase; import exopandora.worldhandler.gui.button.GuiTextFieldTooltip; +import exopandora.worldhandler.gui.category.Categories; +import exopandora.worldhandler.gui.category.Category; import exopandora.worldhandler.gui.container.Container; import exopandora.worldhandler.gui.container.impl.GuiWorldHandler; +import exopandora.worldhandler.gui.content.Content; import exopandora.worldhandler.gui.content.Contents; import exopandora.worldhandler.util.ActionHelper; import exopandora.worldhandler.util.CommandHelper; @@ -17,7 +20,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) -public class ContentButcher extends ContentChild +public class ContentButcher extends Content { private GuiTextFieldTooltip radiusField; private String radius; @@ -109,9 +112,27 @@ public class ContentButcher extends ContentChild this.radiusField.renderButton(mouseX, mouseY, partialTicks); } + @Override + public Category getCategory() + { + return Categories.ENTITIES; + } + @Override public String getTitle() { - return I18n.format("gui.worldhandler.title.butcher"); + return I18n.format("gui.worldhandler.title.entities.butcher"); + } + + @Override + public String getTabTitle() + { + return I18n.format("gui.worldhandler.tab.entities.butcher"); + } + + @Override + public Content getActiveContent() + { + return Contents.BUTCHER; } } diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java new file mode 100644 index 0000000..4defef1 --- /dev/null +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentCommandStack.java @@ -0,0 +1,271 @@ +package exopandora.worldhandler.gui.content.impl; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Consumer; + +import com.google.common.base.Predicates; + +import exopandora.worldhandler.builder.ICommandBuilder; +import exopandora.worldhandler.builder.component.impl.EntityNBT; +import exopandora.worldhandler.builder.impl.BuilderButcher; +import exopandora.worldhandler.builder.impl.BuilderFill; +import exopandora.worldhandler.builder.impl.BuilderSetBlock; +import exopandora.worldhandler.builder.impl.BuilderSetBlock.EnumMode; +import exopandora.worldhandler.builder.impl.BuilderSummon; +import exopandora.worldhandler.builder.types.BlockResourceLocation; +import exopandora.worldhandler.builder.types.Coordinate.EnumType; +import exopandora.worldhandler.builder.types.CoordinateDouble; +import exopandora.worldhandler.builder.types.CoordinateInt; +import exopandora.worldhandler.gui.button.EnumIcon; +import exopandora.worldhandler.gui.button.GuiButtonBase; +import exopandora.worldhandler.gui.button.GuiButtonIcon; +import exopandora.worldhandler.gui.button.GuiButtonTooltip; +import exopandora.worldhandler.gui.button.GuiTextFieldTooltip; +import exopandora.worldhandler.gui.container.Container; +import exopandora.worldhandler.util.ActionHelper; +import net.minecraft.block.Blocks; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.EntityType; +import net.minecraft.nbt.CompoundNBT; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +public class ContentCommandStack extends ContentChild +{ + private static final int HEAD_LENGTH = 1; + private static final int TAIL_LENGTH = 2; + + private final List textfields = new ArrayList(); + private int scroll; + private GuiButtonBase buttonCopy; + + private final BuilderSummon builderCommandStack = new BuilderSummon(); + + public ContentCommandStack() + { + this.builderCommandStack.setEntity(EntityType.FALLING_BLOCK.getRegistryName()); + this.builderCommandStack.setX(new CoordinateDouble(0.0D, EnumType.GLOBAL)); + this.builderCommandStack.setY(new CoordinateDouble(0.5D, EnumType.GLOBAL)); + this.builderCommandStack.setZ(new CoordinateDouble(0.0D, EnumType.GLOBAL)); + this.builderCommandStack.setMotion(0.0D, 0.315D, 0.0D); + this.builderCommandStack.setTime(1); + this.builderCommandStack.setBlockState(Blocks.ACTIVATOR_RAIL.getDefaultState()); + + EntityNBT redstoneBlock = new EntityNBT(EntityType.FALLING_BLOCK.getRegistryName()); + redstoneBlock.setTime(1); + redstoneBlock.setBlockState(Blocks.REDSTONE_BLOCK.getDefaultState()); + this.builderCommandStack.addPassenger(redstoneBlock); + + this.addCommand(0); + + EntityNBT blockRemover = new EntityNBT(EntityType.COMMAND_BLOCK_MINECART.getRegistryName()); + BuilderSetBlock builder = new BuilderSetBlock(new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(-2, EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), Blocks.REPEATING_COMMAND_BLOCK.getRegistryName(), EnumMode.DESTROY); + CompoundNBT commandBlock = new CompoundNBT(); + commandBlock.putByte("auto", (byte) 1); + commandBlock.putString("Command", new BuilderFill(new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(2, EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new BlockResourceLocation(Blocks.AIR.getRegistryName())).toActualCommand()); + builder.setBlockNBT(commandBlock); + blockRemover.setCommand(builder.toActualCommand()); + this.builderCommandStack.addPassenger(blockRemover); + + EntityNBT entityRemover = new EntityNBT(EntityType.COMMAND_BLOCK_MINECART.getRegistryName()); + entityRemover.setCommand(new BuilderButcher(EntityType.COMMAND_BLOCK_MINECART.getRegistryName(), 1).toActualCommand()); + this.builderCommandStack.addPassenger(entityRemover); + } + + @Override + public ICommandBuilder getCommandBuilder() + { + return this.builderCommandStack; + } + + @Override + public void initGui(Container container, int x, int y) + { + this.textfields.clear(); + + for(int index = 0; index < 3; index++) + { + int command = index + this.scroll; + + GuiTextFieldTooltip textfield = new GuiTextFieldTooltip(x, y + 24 * index, 232 - 48, 20, I18n.format("gui.worldhandler.command_stack.command_n", command + 1)); + textfield.setValidator(Predicates.notNull()); + textfield.setText(command < this.getCommandCount() ? this.getCommand(command) : null); + textfield.setResponder(text -> + { + this.setCommand(command, text); + this.updateCopyButton(); + }); + this.textfields.add(textfield); + } + } + + @Override + public void initButtons(Container container, int x, int y) + { + GuiButtonBase buttonScrollUp; + GuiButtonBase buttonScrollDown; + + container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this))); + container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame)); + + this.iterate(index -> + { + GuiButtonBase buttonUp; + GuiButtonBase buttonDown; + GuiButtonBase buttonRemove; + + container.add(buttonUp = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 - 1, 20, 10, EnumIcon.ARROW_UP, I18n.format("gui.worldhandler.actions.move_up"), () -> + { + this.swapCommands(index + this.scroll, index + this.scroll - 1); + container.init(); + })); + container.add(buttonDown = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 + 11, 20, 10, EnumIcon.ARROW_DOWN, I18n.format("gui.worldhandler.actions.move_down"), () -> + { + this.swapCommands(index + this.scroll, index + this.scroll + 1); + container.init(); + })); + container.add(buttonRemove = new GuiButtonTooltip(x + 232 - 20, y + index * 24 - 1, 20, 10, "-", I18n.format("gui.worldhandler.command_stack.remove_command"), () -> + { + int pos = index + this.scroll; + this.removeCommand(pos); + + if(this.scroll + 3 > this.getCommandCount()) + { + this.scrollUp(); + } + + container.init(); + })); + container.add(new GuiButtonTooltip(x + 232 - 20, y + index * 24 + 11, 20, 10, "+", I18n.format("gui.worldhandler.command_stack.insert_command"), () -> + { + int pos = index + this.scroll + 1; + this.addCommand(pos); + + if(index == 2) + { + this.scrollDown(); + } + + container.init(); + })); + container.add(this.textfields.get(index)); + + buttonRemove.active = this.getCommandCount() > 1; + buttonUp.active = index + this.scroll > 0; + buttonDown.active = index + this.scroll + 1 < this.getCommandCount(); + }); + + container.add(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.command_stack.copy_command"), () -> + { + Minecraft.getInstance().keyboardListener.setClipboardString(this.builderCommandStack.toActualCommand()); + })); + container.add(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, I18n.format("gui.worldhandler.actions.move_up"), () -> + { + this.scrollUp(); + container.init(); + })); + container.add(buttonScrollDown = new GuiButtonIcon(x + 118 + 60, y + 72, 54, 20, EnumIcon.ARROW_DOWN, I18n.format("gui.worldhandler.actions.move_down"), () -> + { + this.scrollDown(); + container.init(); + })); + + this.updateCopyButton(); + buttonScrollUp.active = this.scroll > 0; + buttonScrollDown.active = this.scroll < this.getCommandCount() - 3; + } + + @Override + public void tick(Container container) + { + this.iterate(index -> + { + this.textfields.get(index).tick(); + }); + } + + @Override + public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks) + { + this.iterate(index -> + { + this.textfields.get(index).renderButton(mouseX, mouseY, partialTicks); + }); + } + + private void iterate(Consumer consumer) + { + for(int x = 0; x < this.textfields.size() && x + this.scroll < this.getCommandCount(); x++) + { + consumer.accept(x); + } + } + + private void scrollUp() + { + this.scroll = Math.max(0, this.scroll - (Screen.hasShiftDown() ? 10 : 1)); + } + + private void scrollDown() + { + this.scroll = Math.min(this.getCommandCount() - 3, this.scroll + (Screen.hasShiftDown() ? 10 : 1)); + } + + private void updateCopyButton() + { + boolean active = false; + + for(int x = 0; x < this.getCommandCount() && !active; x++) + { + String command = this.getCommand(x); + + if(command != null && !command.isEmpty()) + { + active = true; + } + } + + this.buttonCopy.active = active; + } + + private void setCommand(int index, String command) + { + this.builderCommandStack.getPassenger(index + HEAD_LENGTH).setCommand(command); + } + + private void addCommand(int index) + { + this.builderCommandStack.addPassenger(index + HEAD_LENGTH, new EntityNBT(EntityType.COMMAND_BLOCK_MINECART.getRegistryName())); + } + + private void removeCommand(int index) + { + this.builderCommandStack.removePassenger(index + HEAD_LENGTH); + } + + private String getCommand(int index) + { + return this.builderCommandStack.getPassenger(index + HEAD_LENGTH).getCommand(); + } + + private int getCommandCount() + { + return this.builderCommandStack.getPassengerCount() - HEAD_LENGTH - TAIL_LENGTH; + } + + private void swapCommands(int i, int j) + { + Collections.swap(this.builderCommandStack.getPassengers(), i + HEAD_LENGTH, j + HEAD_LENGTH); + } + + @Override + public String getTitle() + { + return I18n.format("gui.worldhandler.title.command_stack"); + } +} diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMain.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMain.java index 25912a1..66c58e2 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMain.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentMain.java @@ -40,14 +40,14 @@ public class ContentMain extends Content container.add(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear)); container.add(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain)); container.add(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder)); - container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.BUTCHER, I18n.format("gui.worldhandler.shortcuts.tooltip.butcher"), () -> - { - Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.BUTCHER.withParent(Contents.MAIN))); - })); - container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.POTION, I18n.format("gui.worldhandler.shortcuts.tooltip.potions"), () -> + container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, I18n.format("gui.worldhandler.shortcuts.tooltip.potions"), () -> { Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.POTIONS.withParent(Contents.MAIN))); })); + container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, I18n.format("gui.worldhandler.shortcuts.tooltip.command_stack"), () -> + { + Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.COMMAND_STACK.withParent(Contents.MAIN))); + })); container.add(new GuiButtonIcon(x + 26 * 5 + 2, y + 24, 23, 20, EnumIcon.GAMEMODE_SURVIVAL, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival)); container.add(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative)); container.add(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure)); diff --git a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java index c600548..3dc70c1 100644 --- a/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java +++ b/src/main/java/exopandora/worldhandler/gui/content/impl/ContentSummon.java @@ -105,7 +105,7 @@ public class ContentSummon extends Content this.mobField.setResponder(text -> { this.mob = text; - this.builderSummon.setEntity(this.mob); + this.builderSummon.setName(this.mob); container.initButtons(); }); @@ -125,7 +125,7 @@ public class ContentSummon extends Content this.passengerField.setResponder(text -> { this.passenger = this.passengerField.getText(); - this.builderSummon.setPassenger(this.passenger); + this.builderSummon.setPassenger(0, this.passenger); container.initButtons(); }); diff --git a/src/main/java/exopandora/worldhandler/util/NBTHelper.java b/src/main/java/exopandora/worldhandler/util/NBTHelper.java new file mode 100644 index 0000000..adb002a --- /dev/null +++ b/src/main/java/exopandora/worldhandler/util/NBTHelper.java @@ -0,0 +1,117 @@ +package exopandora.worldhandler.util; + +import java.util.Arrays; +import java.util.List; + +import exopandora.worldhandler.builder.INBTWritable; +import exopandora.worldhandler.builder.component.IBuilderComponent; +import exopandora.worldhandler.builder.component.impl.EntityNBT; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.DoubleNBT; +import net.minecraft.nbt.INBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.nbt.NBTUtil; +import net.minecraft.nbt.StringNBT; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +@OnlyIn(Dist.CLIENT) +public class NBTHelper +{ + public static INBT serialize(BlockState blockState) + { + return blockState != null ? NBTUtil.writeBlockState(blockState) : null; + } + + public static INBT serialize(double[] vector) + { + if(vector.length == 3 && (vector[0] != 0D || vector[1] != 0D || vector[2] != 0D)) + { + ListNBT list = new ListNBT(); + + list.add(DoubleNBT.valueOf(vector[0])); + list.add(DoubleNBT.valueOf(vector[1])); + list.add(DoubleNBT.valueOf(vector[2])); + + return list; + } + + return null; + } + + public static INBT serialize(ResourceLocation resource) + { + if(resource != null) + { + return StringNBT.valueOf(resource.toString()); + } + + return null; + } + + public static INBT serialize(ResourceLocation[] itemArray) + { + if(Arrays.stream(itemArray).allMatch(resource -> Blocks.AIR.getRegistryName().equals(resource))) + { + return null; + } + + ListNBT list = new ListNBT(); + + for(ResourceLocation item : itemArray) + { + CompoundNBT compound = new CompoundNBT(); + compound.putString("id", item.toString()); + compound.putInt("Count", 1); + list.add(compound); + } + + return list; + } + + public static INBT serialize(List entities) + { + ListNBT list = new ListNBT(); + + for(EntityNBT entity : entities) + { + INBT nbt = entity.serialize(); + + if(nbt != null) + { + list.add(nbt); + } + } + + if(list.isEmpty()) + { + return null; + } + + return list; + } + + public static void append(CompoundNBT compound, String tag, INBTWritable writable) + { + NBTHelper.append(compound, tag, writable.serialize()); + } + + public static void append(CompoundNBT compound, IBuilderComponent component) + { + NBTHelper.append(compound, component.getTag(), component.serialize()); + } + + public static void append(CompoundNBT compound, String tag, INBT nbt) + { + if(nbt != null) + { + if(!compound.contains(tag)) + { + compound.put(tag, nbt); + } + } + } +} diff --git a/src/main/resources/assets/worldhandler/lang/de_de.json b/src/main/resources/assets/worldhandler/lang/de_de.json index 1b57ed0..4a0d7d8 100644 --- a/src/main/resources/assets/worldhandler/lang/de_de.json +++ b/src/main/resources/assets/worldhandler/lang/de_de.json @@ -84,6 +84,7 @@ "gui.worldhandler.tab.multiplayer": "Mehrspieler", "gui.worldhandler.title.entities.summon": "Beschwören", + "gui.worldhandler.title.entities.butcher": "Metzler", "gui.worldhandler.title.items.custom_item": "Item Erstellen", "gui.worldhandler.title.items.enchantment": "Verzaubern", @@ -102,7 +103,7 @@ "gui.worldhandler.title.player.experience": "Erfahrung", "gui.worldhandler.title.player.advancements": "Fortschritt", - "gui.worldhandler.title.butcher": "Metzler", + "gui.worldhandler.title.command_stack": "Kommando Stapel", "gui.worldhandler.title.change_world": "Welt Wechseln", "gui.worldhandler.title.potions": "Tränke", @@ -158,6 +159,11 @@ "gui.worldhandler.potions.effect.lingering": "Verweil", "gui.worldhandler.potions.effect.tipped_arrow": "Pfeil", + "gui.worldhandler.command_stack.insert_command": "Kommando Einfügen", + "gui.worldhandler.command_stack.remove_command": "Kommando Entfernen", + "gui.worldhandler.command_stack.copy_command": "Kommando Kopieren", + "gui.worldhandler.command_stack.command_n": "Kommando %d", + "gui.worldhandler.entities": "Lebewesen", "gui.worldhandler.items": "Items", "gui.worldhandler.scoreboard": "Anzeigetafel", @@ -354,7 +360,7 @@ "gui.worldhandler.potion.time.seconds": "Sekunden", "gui.worldhandler.shortcuts.tooltip.home": "Home", - "gui.worldhandler.shortcuts.tooltip.butcher": "Metzeln", + "gui.worldhandler.shortcuts.tooltip.command_stack": "Kommando Stapel", "gui.worldhandler.shortcuts.tooltip.settings": "Einstellungen", "gui.worldhandler.shortcuts.tooltip.potions": "Tränke", @@ -402,6 +408,8 @@ "gui.worldhandler.actions.send": "Senden", "gui.worldhandler.actions.copy": "Kopieren", "gui.worldhandler.actions.place_command_block": "Platziere Befehlsblock", + "gui.worldhandler.actions.move_up": "Nach unten", + "gui.worldhandler.actions.move_down": "Nach oben", "gui.worldhandler.color": "Farbe", "gui.worldhandler.color.black": "Schwarz", diff --git a/src/main/resources/assets/worldhandler/lang/en_us.json b/src/main/resources/assets/worldhandler/lang/en_us.json index 50f3dd0..26e03e4 100644 --- a/src/main/resources/assets/worldhandler/lang/en_us.json +++ b/src/main/resources/assets/worldhandler/lang/en_us.json @@ -67,6 +67,7 @@ "gui.worldhandler.tab.player.advancements": "Advancements", "gui.worldhandler.tab.entities.summon": "Summon", + "gui.worldhandler.tab.entities.butcher": "Butcher", "gui.worldhandler.tab.world.world": "World", "gui.worldhandler.tab.world.gamerules": "Gamerules", @@ -83,6 +84,7 @@ "gui.worldhandler.tab.multiplayer": "Multiplayer", "gui.worldhandler.title.entities.summon": "Summon", + "gui.worldhandler.title.entities.butcher": "Butcher", "gui.worldhandler.title.items.custom_item": "Custom Item", "gui.worldhandler.title.items.enchantment": "Enchantment", @@ -101,7 +103,7 @@ "gui.worldhandler.title.player.experience": "Experience", "gui.worldhandler.title.player.advancements": "Advancements", - "gui.worldhandler.title.butcher": "Butcher", + "gui.worldhandler.title.command_stack": "Command Stack", "gui.worldhandler.title.change_world": "Change World", "gui.worldhandler.title.potions": "Potions", @@ -157,6 +159,11 @@ "gui.worldhandler.potions.effect.lingering": "Lingering", "gui.worldhandler.potions.effect.tipped_arrow": "Arrow", + "gui.worldhandler.command_stack.insert_command": "Insert Command", + "gui.worldhandler.command_stack.remove_command": "Remove Command", + "gui.worldhandler.command_stack.copy_command": "Copy Command", + "gui.worldhandler.command_stack.command_n": "Command %d", + "gui.worldhandler.entities": "Entities", "gui.worldhandler.items": "Items", "gui.worldhandler.scoreboard": "Scoreboard", @@ -353,7 +360,7 @@ "gui.worldhandler.potion.time.seconds": "Seconds", "gui.worldhandler.shortcuts.tooltip.home": "Home", - "gui.worldhandler.shortcuts.tooltip.butcher": "Butcher", + "gui.worldhandler.shortcuts.tooltip.command_stack": "Command Stack", "gui.worldhandler.shortcuts.tooltip.settings": "Settings", "gui.worldhandler.shortcuts.tooltip.potions": "Potions", @@ -401,6 +408,8 @@ "gui.worldhandler.actions.send": "Send", "gui.worldhandler.actions.copy": "Copy", "gui.worldhandler.actions.place_command_block": "Place Command Block", + "gui.worldhandler.actions.move_up": "Move Up", + "gui.worldhandler.actions.move_down": "Move Down", "gui.worldhandler.color": "Color", "gui.worldhandler.color.black": "Black", diff --git a/src/main/resources/assets/worldhandler/lang/fr_fr.json b/src/main/resources/assets/worldhandler/lang/fr_fr.json index 1bc293a..0bf3528 100644 --- a/src/main/resources/assets/worldhandler/lang/fr_fr.json +++ b/src/main/resources/assets/worldhandler/lang/fr_fr.json @@ -67,6 +67,7 @@ "gui.worldhandler.tab.player.advancements": "Progrès", "gui.worldhandler.tab.entities.summon": "Invoquer", + "gui.worldhandler.tab.entities.butcher": "Butcher", "gui.worldhandler.tab.world.world": "Monde", "gui.worldhandler.tab.world.gamerules": "Règles de jeu", @@ -83,6 +84,7 @@ "gui.worldhandler.tab.multiplayer": "Multijoueur", "gui.worldhandler.title.entities.summon": "Invoquer", + "gui.worldhandler.title.entities.butcher": "Butcher", "gui.worldhandler.title.items.custom_item": "Objet personnalisé", "gui.worldhandler.title.items.enchantment": "Enchantement", @@ -101,7 +103,7 @@ "gui.worldhandler.title.player.experience": "Expérience ", "gui.worldhandler.title.player.advancements": "Progrès", - "gui.worldhandler.title.butcher": "Boucher", + "gui.worldhandler.title.command_stack": "Command Stack", "gui.worldhandler.title.change_world": "Changer de monde", "gui.worldhandler.title.potions": "Potions", @@ -157,6 +159,11 @@ "gui.worldhandler.potions.effect.lingering": "Persistant", "gui.worldhandler.potions.effect.tipped_arrow": "Flèche", + "gui.worldhandler.command_stack.insert_command": "Insert Command", + "gui.worldhandler.command_stack.remove_command": "Remove Command", + "gui.worldhandler.command_stack.copy_command": "Copy Command", + "gui.worldhandler.command_stack.command_n": "Command %d", + "gui.worldhandler.entities": "Entités", "gui.worldhandler.items": "Objets", "gui.worldhandler.scoreboard": "Scores", @@ -353,7 +360,7 @@ "gui.worldhandler.potion.time.seconds": "Secondes ", "gui.worldhandler.shortcuts.tooltip.home": "Accueil", - "gui.worldhandler.shortcuts.tooltip.butcher": "Boucher", + "gui.worldhandler.shortcuts.tooltip.command_stack": "Command Stack", "gui.worldhandler.shortcuts.tooltip.settings": "Paramètres", "gui.worldhandler.shortcuts.tooltip.potions": "Potions", @@ -401,6 +408,8 @@ "gui.worldhandler.actions.send": "Envoyer", "gui.worldhandler.actions.copy": "Copier", "gui.worldhandler.actions.place_command_block": "Placer bloc commande", + "gui.worldhandler.actions.move_up": "Move Up", + "gui.worldhandler.actions.move_down": "Move Down", "gui.worldhandler.color": "Couleur", "gui.worldhandler.color.black": "Noir", diff --git a/src/main/resources/assets/worldhandler/lang/ru_ru.json b/src/main/resources/assets/worldhandler/lang/ru_ru.json index 195009a..98d6418 100644 --- a/src/main/resources/assets/worldhandler/lang/ru_ru.json +++ b/src/main/resources/assets/worldhandler/lang/ru_ru.json @@ -67,6 +67,7 @@ "gui.worldhandler.tab.player.advancements": "Достижения", "gui.worldhandler.tab.entities.summon": "Призыв", + "gui.worldhandler.tab.entities.butcher": "Butcher", "gui.worldhandler.tab.world.world": "Мир", "gui.worldhandler.tab.world.gamerules": "Правила игры", @@ -83,6 +84,7 @@ "gui.worldhandler.tab.multiplayer": "Сетевая игра", "gui.worldhandler.title.entities.summon": "Призыв", + "gui.worldhandler.title.entities.butcher": "Butcher", "gui.worldhandler.title.items.custom_item": "Пользовательский предмет", "gui.worldhandler.title.items.enchantment": "Зачарование", @@ -101,7 +103,7 @@ "gui.worldhandler.title.player.experience": "Опыт", "gui.worldhandler.title.player.advancements": "Достижения", - "gui.worldhandler.title.butcher": "Мясник", + "gui.worldhandler.title.command_stack": "Command Stack", "gui.worldhandler.title.change_world": "Изменить мир", "gui.worldhandler.title.potions": "Зелья", @@ -157,6 +159,11 @@ "gui.worldhandler.potions.effect.lingering": "Длительный", "gui.worldhandler.potions.effect.tipped_arrow": "Стрела", + "gui.worldhandler.command_stack.insert_command": "Insert Command", + "gui.worldhandler.command_stack.remove_command": "Remove Command", + "gui.worldhandler.command_stack.copy_command": "Copy Command", + "gui.worldhandler.command_stack.command_n": "Command %d", + "gui.worldhandler.entities": "Сущности", "gui.worldhandler.items": "Предметы", "gui.worldhandler.scoreboard": "Таблица счёта", @@ -353,7 +360,7 @@ "gui.worldhandler.potion.time.seconds": "Секунд", "gui.worldhandler.shortcuts.tooltip.home": "Дом", - "gui.worldhandler.shortcuts.tooltip.butcher": "Мясник", + "gui.worldhandler.shortcuts.tooltip.command_stack": "Command Stack", "gui.worldhandler.shortcuts.tooltip.settings": "Настройки", "gui.worldhandler.shortcuts.tooltip.potions": "Зелья", @@ -401,6 +408,8 @@ "gui.worldhandler.actions.send": "Отправить", "gui.worldhandler.actions.copy": "Копировать", "gui.worldhandler.actions.place_command_block": "Разместить блок команды", + "gui.worldhandler.actions.move_up": "Move Up", + "gui.worldhandler.actions.move_down": "Move Down", "gui.worldhandler.color": "Цвет", "gui.worldhandler.color.black": "Чёрный", diff --git a/src/main/resources/assets/worldhandler/lang/zh_cn.json b/src/main/resources/assets/worldhandler/lang/zh_cn.json index 56d4432..83bf60d 100644 --- a/src/main/resources/assets/worldhandler/lang/zh_cn.json +++ b/src/main/resources/assets/worldhandler/lang/zh_cn.json @@ -68,6 +68,7 @@ "gui.worldhandler.tab.player.advancements": "进度", "gui.worldhandler.tab.entities.summon": "召唤", + "gui.worldhandler.tab.entities.butcher": "Butcher", "gui.worldhandler.tab.world.world": "世界", "gui.worldhandler.tab.world.gamerules": "游戏规则", @@ -84,6 +85,7 @@ "gui.worldhandler.tab.multiplayer": "多人", "gui.worldhandler.title.entities.summon": "召唤", + "gui.worldhandler.title.entities.butcher": "Butcher", "gui.worldhandler.title.items.custom_item": "给予自定义物品", "gui.worldhandler.title.items.enchantment": "附魔", @@ -102,7 +104,7 @@ "gui.worldhandler.title.player.experience": "经验等级", "gui.worldhandler.title.player.advancements": "进度", - "gui.worldhandler.title.butcher": "屠宰", + "gui.worldhandler.title.command_stack": "Command Stack", "gui.worldhandler.title.change_world": "更改世界", "gui.worldhandler.title.potions": "药水", @@ -158,6 +160,11 @@ "gui.worldhandler.potions.effect.lingering": "滞留", "gui.worldhandler.potions.effect.tipped_arrow": "箭", + "gui.worldhandler.command_stack.insert_command": "Insert Command", + "gui.worldhandler.command_stack.remove_command": "Remove Command", + "gui.worldhandler.command_stack.copy_command": "Copy Command", + "gui.worldhandler.command_stack.command_n": "Command %d", + "gui.worldhandler.entities": "实体", "gui.worldhandler.items": "物品", "gui.worldhandler.scoreboard": "记分板", @@ -354,7 +361,7 @@ "gui.worldhandler.potion.time.seconds": "秒", "gui.worldhandler.shortcuts.tooltip.home": "主页", - "gui.worldhandler.shortcuts.tooltip.butcher": "屠宰", + "gui.worldhandler.shortcuts.tooltip.command_stack": "Command Stack", "gui.worldhandler.shortcuts.tooltip.settings": "设置", "gui.worldhandler.shortcuts.tooltip.potions": "药水", @@ -402,6 +409,8 @@ "gui.worldhandler.actions.send": "发送", "gui.worldhandler.actions.copy": "复制", "gui.worldhandler.actions.place_command_block": "放置命令方块", + "gui.worldhandler.actions.move_up": "Move Up", + "gui.worldhandler.actions.move_down": "Move Down", "gui.worldhandler.color": "颜色", "gui.worldhandler.color.black": "黑色",