Update to 1.14.2
This commit is contained in:
@@ -16,7 +16,7 @@ import exopandora.worldhandler.builder.types.GreedyString;
|
||||
import exopandora.worldhandler.builder.types.ItemResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import exopandora.worldhandler.builder.types.Type;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -106,7 +106,7 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
|
||||
this.set(index, resource != null ? resource.get() : null, Type.BLOCK_RESOURCE_LOCATION);
|
||||
}
|
||||
|
||||
protected void setNode(int index, NBTTagCompound nbt)
|
||||
protected void setNode(int index, CompoundNBT nbt)
|
||||
{
|
||||
this.set(index, nbt, Type.NBT);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected NBTTagCompound getNodeAsNBT(int index)
|
||||
protected CompoundNBT getNodeAsNBT(int index)
|
||||
{
|
||||
return this.get(index, Type.NBT);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -46,19 +46,19 @@ public abstract class CommandBuilderNBT extends CommandBuilder implements IComma
|
||||
return super.toActualCommand();
|
||||
}
|
||||
|
||||
private NBTTagCompound buildNBT()
|
||||
private CompoundNBT buildNBT()
|
||||
{
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
|
||||
for(IBuilderComponent component : this.TAG_TO_COMPONENT)
|
||||
{
|
||||
INBTBase serialized = component.serialize();
|
||||
INBT serialized = component.serialize();
|
||||
|
||||
if(serialized != null)
|
||||
{
|
||||
if(!nbt.hasKey(component.getTag()))
|
||||
if(!nbt.contains(component.getTag()))
|
||||
{
|
||||
nbt.setTag(component.getTag(), serialized);
|
||||
nbt.put(component.getTag(), serialized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package exopandora.worldhandler.builder;
|
||||
|
||||
import com.mojang.realmsclient.gui.ChatFormatting;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -29,7 +28,7 @@ public class CommandString
|
||||
}
|
||||
else
|
||||
{
|
||||
this.command.append(" " + ChatFormatting.RED + "[error]" + ChatFormatting.RESET);
|
||||
this.command.append(" " + TextFormatting.RED + "[error]" + TextFormatting.RESET);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package exopandora.worldhandler.builder;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface ICommandBuilderNBT extends ICommandBuilder
|
||||
{
|
||||
void setNBT(NBTTagCompound nbt);
|
||||
void setNBT(CompoundNBT nbt);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package exopandora.worldhandler.builder.component;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -10,6 +10,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public interface IBuilderComponent
|
||||
{
|
||||
@Nullable
|
||||
INBTBase serialize();
|
||||
INBT serialize();
|
||||
String getTag();
|
||||
}
|
||||
|
||||
@@ -8,37 +8,37 @@ import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract class ComponentPotion implements IBuilderComponent
|
||||
{
|
||||
protected final Map<Potion, PotionMetadata> potions = new HashMap<Potion, PotionMetadata>();
|
||||
protected final Map<Effect, EffectData> potions = new HashMap<Effect, EffectData>();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBTBase serialize()
|
||||
public INBT serialize()
|
||||
{
|
||||
NBTTagList list = new NBTTagList();
|
||||
ListNBT list = new ListNBT();
|
||||
|
||||
for(Entry<Potion, PotionMetadata> entry : this.potions.entrySet())
|
||||
for(Entry<Effect, EffectData> entry : this.potions.entrySet())
|
||||
{
|
||||
PotionMetadata potion = entry.getValue();
|
||||
EffectData potion = entry.getValue();
|
||||
|
||||
if(potion.getAmplifier() > 0)
|
||||
{
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
|
||||
compound.setByte("Id", (byte) Potion.getIdFromPotion(entry.getKey()));
|
||||
compound.setByte("Amplifier", (byte) (potion.getAmplifier() - 1));
|
||||
compound.setInt("Duration", Math.min(potion.toTicks(), 1000000));
|
||||
compound.setBoolean("Ambient", potion.getAmbient());
|
||||
compound.setBoolean("ShowParticles", potion.getShowParticles());
|
||||
compound.putByte("Id", (byte) Effect.getIdFromPotion(entry.getKey()));
|
||||
compound.putByte("Amplifier", (byte) (potion.getAmplifier() - 1));
|
||||
compound.putInt("Duration", Math.min(potion.toTicks(), 1000000));
|
||||
compound.putBoolean("Ambient", potion.getAmbient());
|
||||
compound.putBoolean("ShowParticles", potion.getShowParticles());
|
||||
|
||||
list.add(compound);
|
||||
}
|
||||
@@ -52,87 +52,87 @@ public abstract class ComponentPotion implements IBuilderComponent
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setAmplifier(Potion potion, byte amplifier)
|
||||
public void setAmplifier(Effect potion, byte amplifier)
|
||||
{
|
||||
this.getMetadata(potion).setAmplifier(amplifier);
|
||||
}
|
||||
|
||||
public byte getAmplifier(Potion potion)
|
||||
public byte getAmplifier(Effect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getAmplifier();
|
||||
}
|
||||
|
||||
public void setSeconds(Potion potion, int seconds)
|
||||
public void setSeconds(Effect potion, int seconds)
|
||||
{
|
||||
this.getMetadata(potion).setSeconds(seconds);
|
||||
}
|
||||
|
||||
public int getSeconds(Potion potion)
|
||||
public int getSeconds(Effect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getSeconds();
|
||||
}
|
||||
|
||||
public void setMinutes(Potion potion, int minutes)
|
||||
public void setMinutes(Effect potion, int minutes)
|
||||
{
|
||||
this.getMetadata(potion).setMinutes(minutes);
|
||||
}
|
||||
|
||||
public int getMinutes(Potion potion)
|
||||
public int getMinutes(Effect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getMinutes();
|
||||
}
|
||||
|
||||
public void setHours(Potion potion, int hours)
|
||||
public void setHours(Effect potion, int hours)
|
||||
{
|
||||
this.getMetadata(potion).setHours(hours);
|
||||
}
|
||||
|
||||
public int getHours(Potion potion)
|
||||
public int getHours(Effect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getHours();
|
||||
}
|
||||
|
||||
public void setShowParticles(Potion potion, boolean showParticles)
|
||||
public void setShowParticles(Effect potion, boolean showParticles)
|
||||
{
|
||||
this.getMetadata(potion).setShowParticles(showParticles);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(Potion potion)
|
||||
public boolean getShowParticles(Effect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getShowParticles();
|
||||
}
|
||||
|
||||
public void setAmbient(Potion potion, boolean ambient)
|
||||
public void setAmbient(Effect potion, boolean ambient)
|
||||
{
|
||||
this.getMetadata(potion).setAmbient(ambient);
|
||||
}
|
||||
|
||||
public boolean getAmbient(Potion potion)
|
||||
public boolean getAmbient(Effect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getAmbient();
|
||||
}
|
||||
|
||||
private PotionMetadata getMetadata(Potion potion)
|
||||
private EffectData getMetadata(Effect potion)
|
||||
{
|
||||
return this.potions.get(this.validate(potion));
|
||||
}
|
||||
|
||||
private Potion validate(Potion potion)
|
||||
private Effect validate(Effect potion)
|
||||
{
|
||||
if(!this.potions.containsKey(potion))
|
||||
{
|
||||
this.potions.put(potion, new PotionMetadata());
|
||||
this.potions.put(potion, new EffectData());
|
||||
}
|
||||
|
||||
return potion;
|
||||
}
|
||||
|
||||
public Set<Potion> getPotions()
|
||||
public Set<Effect> getEffects()
|
||||
{
|
||||
return this.potions.keySet();
|
||||
}
|
||||
|
||||
public void remove(Potion potion)
|
||||
public void remove(Effect potion)
|
||||
{
|
||||
this.potions.remove(potion);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class PotionMetadata
|
||||
public class EffectData
|
||||
{
|
||||
private byte amplifier;
|
||||
private int seconds;
|
||||
@@ -13,12 +13,12 @@ public class PotionMetadata
|
||||
private boolean showParticles;
|
||||
private boolean ambient;
|
||||
|
||||
public PotionMetadata()
|
||||
public EffectData()
|
||||
{
|
||||
this((byte) 0, 0, 0, 0, true, false);
|
||||
}
|
||||
|
||||
public PotionMetadata(byte amplifier, int seconds, int minutes, int hours, boolean showParticles, boolean ambient)
|
||||
public EffectData(byte amplifier, int seconds, int minutes, int hours, boolean showParticles, boolean ambient)
|
||||
{
|
||||
this.amplifier = amplifier;
|
||||
this.seconds = seconds;
|
||||
@@ -90,12 +90,12 @@ public class PotionMetadata
|
||||
|
||||
public int toTicks()
|
||||
{
|
||||
return PotionMetadata.toTicks(this.seconds, this.minutes, this.hours);
|
||||
return EffectData.toTicks(this.seconds, this.minutes, this.hours);
|
||||
}
|
||||
|
||||
public int toSeconds()
|
||||
{
|
||||
return PotionMetadata.toSeconds(this.seconds, this.minutes, this.hours);
|
||||
return EffectData.toSeconds(this.seconds, this.minutes, this.hours);
|
||||
}
|
||||
|
||||
public static int toTicks(int seconds, int minutes, int hours)
|
||||
@@ -108,37 +108,37 @@ public class PotionMetadata
|
||||
return seconds + minutes * 60 + hours * 3600;
|
||||
}
|
||||
|
||||
public PotionMetadata withAmplifier(byte amplifier)
|
||||
public EffectData withAmplifier(byte amplifier)
|
||||
{
|
||||
this.amplifier = amplifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PotionMetadata withShowParticles(boolean showParticles)
|
||||
public EffectData withShowParticles(boolean showParticles)
|
||||
{
|
||||
this.showParticles = showParticles;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PotionMetadata withSeconds(int seconds)
|
||||
public EffectData withSeconds(int seconds)
|
||||
{
|
||||
this.seconds = seconds;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PotionMetadata withMinutes(int minutes)
|
||||
public EffectData withMinutes(int minutes)
|
||||
{
|
||||
this.minutes = minutes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PotionMetadata withHours(int hours)
|
||||
public EffectData withHours(int hours)
|
||||
{
|
||||
this.hours = hours;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PotionMetadata withAmbient(boolean ambient)
|
||||
public EffectData withAmbient(boolean ambient)
|
||||
{
|
||||
this.ambient = ambient;
|
||||
return this;
|
||||
@@ -8,9 +8,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.abstr.ComponentAttribute;
|
||||
import exopandora.worldhandler.builder.impl.abstr.EnumAttributes;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -24,22 +24,22 @@ public class ComponentAttributeItem extends ComponentAttribute
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBTBase serialize()
|
||||
public INBT serialize()
|
||||
{
|
||||
NBTTagList attributes = new NBTTagList();
|
||||
ListNBT attributes = new ListNBT();
|
||||
|
||||
for(Entry<EnumAttributes, Double> entry : this.attributes.entrySet())
|
||||
{
|
||||
if(this.applyable.apply(entry.getKey()) && entry.getValue() != 0)
|
||||
{
|
||||
NBTTagCompound attribute = new NBTTagCompound();
|
||||
CompoundNBT attribute = new CompoundNBT();
|
||||
|
||||
attribute.setString("AttributeName", entry.getKey().getAttribute());
|
||||
attribute.setString("Name", entry.getKey().getAttribute());
|
||||
attribute.setDouble("Amount", entry.getKey().calculate(entry.getValue()));
|
||||
attribute.setInt("Operation", entry.getKey().getOperation().ordinal());
|
||||
attribute.setLong("UUIDLeast", UUID.nameUUIDFromBytes(entry.getKey().getAttribute().getBytes()).getLeastSignificantBits());
|
||||
attribute.setLong("UUIDMost", UUID.nameUUIDFromBytes(entry.getKey().getAttribute().getBytes()).getMostSignificantBits());
|
||||
attribute.putString("AttributeName", entry.getKey().getAttribute());
|
||||
attribute.putString("Name", entry.getKey().getAttribute());
|
||||
attribute.putDouble("Amount", entry.getKey().calculate(entry.getValue()));
|
||||
attribute.putInt("Operation", entry.getKey().getOperation().ordinal());
|
||||
attribute.putLong("UUIDLeast", UUID.nameUUIDFromBytes(entry.getKey().getAttribute().getBytes()).getLeastSignificantBits());
|
||||
attribute.putLong("UUIDMost", UUID.nameUUIDFromBytes(entry.getKey().getAttribute().getBytes()).getMostSignificantBits());
|
||||
|
||||
attributes.add(attribute);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.abstr.ComponentAttribute;
|
||||
import exopandora.worldhandler.builder.impl.abstr.EnumAttributes;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -23,18 +23,18 @@ public class ComponentAttributeMob extends ComponentAttribute
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBTBase serialize()
|
||||
public INBT serialize()
|
||||
{
|
||||
NBTTagList attributes = new NBTTagList();
|
||||
ListNBT attributes = new ListNBT();
|
||||
|
||||
for(Entry<EnumAttributes, Double> entry : this.attributes.entrySet())
|
||||
{
|
||||
if(this.applyable.apply(entry.getKey()) && entry.getValue() != 0)
|
||||
{
|
||||
NBTTagCompound attribute = new NBTTagCompound();
|
||||
CompoundNBT attribute = new CompoundNBT();
|
||||
|
||||
attribute.setString("Name", entry.getKey().getAttribute());
|
||||
attribute.setDouble("Base", entry.getKey().calculate(entry.getValue()));
|
||||
attribute.putString("Name", entry.getKey().getAttribute());
|
||||
attribute.putDouble("Base", entry.getKey().calculate(entry.getValue()));
|
||||
|
||||
attributes.add(attribute);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package exopandora.worldhandler.builder.component.impl;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.format.text.ColoredString;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -18,30 +18,30 @@ public class ComponentDisplay implements IBuilderComponent
|
||||
private String[] lore = new String[2];
|
||||
|
||||
@Override
|
||||
public INBTBase serialize()
|
||||
public INBT serialize()
|
||||
{
|
||||
NBTTagCompound display = new NBTTagCompound();
|
||||
CompoundNBT display = new CompoundNBT();
|
||||
|
||||
String name = this.name.getText();
|
||||
|
||||
if(name != null && !name.isEmpty())
|
||||
{
|
||||
display.setString("Name", ITextComponent.Serializer.toJson(new TextComponentString(this.name.toString())));
|
||||
display.putString("Name", ITextComponent.Serializer.toJson(new StringTextComponent(this.name.toString())));
|
||||
}
|
||||
|
||||
NBTTagList lore = new NBTTagList();
|
||||
ListNBT lore = new ListNBT();
|
||||
|
||||
for(int x = 0; x < this.lore.length; x++)
|
||||
{
|
||||
if(this.lore[x] != null && !this.lore[x].isEmpty())
|
||||
{
|
||||
lore.add(new NBTTagString(this.lore[x]));
|
||||
lore.add(new StringNBT(this.lore[x]));
|
||||
}
|
||||
}
|
||||
|
||||
if(!lore.isEmpty())
|
||||
{
|
||||
display.setTag("Lore", lore);
|
||||
display.put("Lore", lore);
|
||||
}
|
||||
|
||||
if(!display.isEmpty())
|
||||
|
||||
@@ -9,9 +9,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -23,18 +23,18 @@ public class ComponentEnchantment implements IBuilderComponent
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBTBase serialize()
|
||||
public INBT serialize()
|
||||
{
|
||||
NBTTagList enchantments = new NBTTagList();
|
||||
ListNBT enchantments = new ListNBT();
|
||||
|
||||
for(Entry<Enchantment, Short> entry : this.enchantments.entrySet())
|
||||
{
|
||||
if(entry.getValue() > 0)
|
||||
{
|
||||
NBTTagCompound enchantment = new NBTTagCompound();
|
||||
CompoundNBT enchantment = new CompoundNBT();
|
||||
|
||||
enchantment.setString("id", ForgeRegistries.ENCHANTMENTS.getKey(entry.getKey()).toString());
|
||||
enchantment.setShort("lvl", entry.getValue());
|
||||
enchantment.putString("id", ForgeRegistries.ENCHANTMENTS.getKey(entry.getKey()).toString());
|
||||
enchantment.putShort("lvl", entry.getValue());
|
||||
|
||||
enchantments.add(enchantment);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@ import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.helper.ResourceHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
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;
|
||||
@@ -61,44 +61,44 @@ public class ComponentSummon implements IBuilderComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public INBTBase serialize()
|
||||
public INBT serialize()
|
||||
{
|
||||
if(this.name != null)
|
||||
{
|
||||
if(this.name.equalsIgnoreCase("Cat"))
|
||||
{
|
||||
this.tag = "CatType";
|
||||
return new NBTTagInt(this.random.nextInt(3) + 1);
|
||||
return new IntNBT(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 new NBTTagInt(0);
|
||||
return new IntNBT(0);
|
||||
}
|
||||
else if(this.name.equalsIgnoreCase("Librarian") || this.name.equalsIgnoreCase("Carthographer"))
|
||||
{
|
||||
this.tag = "Profession";
|
||||
return new NBTTagInt(1);
|
||||
return new IntNBT(1);
|
||||
}
|
||||
else if(this.name.equalsIgnoreCase("Cleric") || this.name.equalsIgnoreCase("Priest"))
|
||||
{
|
||||
this.tag = "Profession";
|
||||
return new NBTTagInt(2);
|
||||
return new IntNBT(2);
|
||||
}
|
||||
else if(this.name.equalsIgnoreCase("Armorer") || this.name.equalsIgnoreCase("Blacksmith") || this.name.equalsIgnoreCase("WeaponSmith") || this.name.equalsIgnoreCase("ToolSmith"))
|
||||
{
|
||||
this.tag = "Profession";
|
||||
return new NBTTagInt(3);
|
||||
return new IntNBT(3);
|
||||
}
|
||||
else if(this.name.equalsIgnoreCase("Butcher") || this.name.equalsIgnoreCase("Leatherworker"))
|
||||
{
|
||||
this.tag = "Profession";
|
||||
return new NBTTagInt(4);
|
||||
return new IntNBT(4);
|
||||
}
|
||||
else if(this.name.equalsIgnoreCase("Nitwit"))
|
||||
{
|
||||
this.tag = "Profession";
|
||||
return new NBTTagInt(5);
|
||||
return new IntNBT(5);
|
||||
}
|
||||
|
||||
if(this.entity != null)
|
||||
@@ -108,18 +108,18 @@ public class ComponentSummon implements IBuilderComponent
|
||||
if(StringUtils.containsIgnoreCase(this.name, "Baby"))
|
||||
{
|
||||
this.tag = "IsBaby";
|
||||
return new NBTTagByte((byte) 1);
|
||||
return new ByteNBT((byte) 1);
|
||||
}
|
||||
}
|
||||
else if(this.entity.equals(EntityType.CHICKEN.getRegistryName()))
|
||||
{
|
||||
if(StringUtils.containsIgnoreCase(this.name, "Jockey") && !this.hasPassenger)
|
||||
{
|
||||
NBTTagCompound passenger = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
CompoundNBT passenger = new CompoundNBT();
|
||||
ListNBT list = new ListNBT();
|
||||
|
||||
passenger.setString("id", EntityType.ZOMBIE.getRegistryName().toString());
|
||||
passenger.setBoolean("IsBaby", true);
|
||||
passenger.putString("id", EntityType.ZOMBIE.getRegistryName().toString());
|
||||
passenger.putBoolean("IsBaby", true);
|
||||
list.add(passenger);
|
||||
|
||||
this.tag = "Passengers";
|
||||
@@ -130,10 +130,10 @@ public class ComponentSummon implements IBuilderComponent
|
||||
{
|
||||
if(StringUtils.containsIgnoreCase(this.name, "Jockey") && !this.hasPassenger)
|
||||
{
|
||||
NBTTagCompound passenger = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
CompoundNBT passenger = new CompoundNBT();
|
||||
ListNBT list = new ListNBT();
|
||||
|
||||
passenger.setString("id", EntityType.SKELETON.getRegistryName().toString());
|
||||
passenger.putString("id", EntityType.SKELETON.getRegistryName().toString());
|
||||
list.add(passenger);
|
||||
|
||||
this.tag = "Passengers";
|
||||
|
||||
@@ -7,35 +7,35 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.WorldHandler;
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagByteArray;
|
||||
import net.minecraft.nbt.NBTTagDouble;
|
||||
import net.minecraft.nbt.NBTTagFloat;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagIntArray;
|
||||
import net.minecraft.nbt.NBTTagLong;
|
||||
import net.minecraft.nbt.NBTTagLongArray;
|
||||
import net.minecraft.nbt.NBTTagShort;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.nbt.ByteArrayNBT;
|
||||
import net.minecraft.nbt.ByteNBT;
|
||||
import net.minecraft.nbt.DoubleNBT;
|
||||
import net.minecraft.nbt.FloatNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.IntArrayNBT;
|
||||
import net.minecraft.nbt.IntNBT;
|
||||
import net.minecraft.nbt.LongArrayNBT;
|
||||
import net.minecraft.nbt.LongNBT;
|
||||
import net.minecraft.nbt.ShortNBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ComponentTag<T> implements IBuilderComponent
|
||||
{
|
||||
private final Function<T, INBTBase> serializer;
|
||||
private final Function<T, INBT> serializer;
|
||||
private final String tag;
|
||||
private T value;
|
||||
|
||||
public ComponentTag(String tag, T value, Function<T, INBTBase> serializer)
|
||||
public ComponentTag(String tag, T value, Function<T, INBT> serializer)
|
||||
{
|
||||
this.tag = tag;
|
||||
this.value = value;
|
||||
this.serializer = serializer;
|
||||
}
|
||||
|
||||
public ComponentTag(String tag, Function<T, INBTBase> serializer)
|
||||
public ComponentTag(String tag, Function<T, INBT> serializer)
|
||||
{
|
||||
this(tag, null, serializer);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class ComponentTag<T> implements IBuilderComponent
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBTBase serialize()
|
||||
public INBT serialize()
|
||||
{
|
||||
if(this.value != null)
|
||||
{
|
||||
@@ -80,9 +80,9 @@ public class ComponentTag<T> implements IBuilderComponent
|
||||
return null;
|
||||
}
|
||||
|
||||
return new NBTTagString(string);
|
||||
return new StringNBT(string);
|
||||
}
|
||||
else if(this.value instanceof INBTBase)
|
||||
else if(this.value instanceof INBT)
|
||||
{
|
||||
if(this.value instanceof Collection<?>)
|
||||
{
|
||||
@@ -94,43 +94,43 @@ public class ComponentTag<T> implements IBuilderComponent
|
||||
}
|
||||
}
|
||||
|
||||
return (INBTBase) this.value;
|
||||
return (INBT) this.value;
|
||||
}
|
||||
else if(this.value instanceof Integer)
|
||||
{
|
||||
return new NBTTagInt((Integer) this.value);
|
||||
return new IntNBT((Integer) this.value);
|
||||
}
|
||||
else if(this.value instanceof Byte)
|
||||
{
|
||||
return new NBTTagByte((Byte) this.value);
|
||||
return new ByteNBT((Byte) this.value);
|
||||
}
|
||||
else if(this.value instanceof Float)
|
||||
{
|
||||
return new NBTTagFloat((Float) this.value);
|
||||
return new FloatNBT((Float) this.value);
|
||||
}
|
||||
else if(this.value instanceof Double)
|
||||
{
|
||||
return new NBTTagDouble((Double) this.value);
|
||||
return new DoubleNBT((Double) this.value);
|
||||
}
|
||||
else if(this.value instanceof Long)
|
||||
{
|
||||
return new NBTTagLong((Long) this.value);
|
||||
return new LongNBT((Long) this.value);
|
||||
}
|
||||
else if(this.value instanceof Short)
|
||||
{
|
||||
return new NBTTagShort((Short) this.value);
|
||||
return new ShortNBT((Short) this.value);
|
||||
}
|
||||
else if(this.value instanceof Byte[])
|
||||
{
|
||||
return new NBTTagByteArray((byte[]) this.value);
|
||||
return new ByteArrayNBT((byte[]) this.value);
|
||||
}
|
||||
else if(this.value instanceof Integer[])
|
||||
{
|
||||
return new NBTTagIntArray((int[]) this.value);
|
||||
return new IntArrayNBT((int[]) this.value);
|
||||
}
|
||||
else if(this.value instanceof Long[])
|
||||
{
|
||||
return new NBTTagLongArray((long[]) this.value);
|
||||
return new LongArrayNBT((long[]) this.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import exopandora.worldhandler.builder.types.Type;
|
||||
import exopandora.worldhandler.helper.EnumHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -25,7 +25,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
super(2);
|
||||
}
|
||||
|
||||
public BuilderData(EnumMode mode, ResourceLocation entity, NBTTagCompound nbt)
|
||||
public BuilderData(EnumMode mode, ResourceLocation entity, CompoundNBT nbt)
|
||||
{
|
||||
this();
|
||||
this.setMode(mode);
|
||||
@@ -33,7 +33,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
this.setNBT(nbt);
|
||||
}
|
||||
|
||||
public BuilderData(EnumMode mode, BlockPos pos, NBTTagCompound nbt)
|
||||
public BuilderData(EnumMode mode, BlockPos pos, CompoundNBT nbt)
|
||||
{
|
||||
this();
|
||||
this.setMode(mode);
|
||||
@@ -129,7 +129,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(NBTTagCompound nbt)
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
{
|
||||
if(this.getMode() == null || !this.getMode().equals(EnumMode.MERGE))
|
||||
{
|
||||
@@ -155,7 +155,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public NBTTagCompound getNBT()
|
||||
public CompoundNBT getNBT()
|
||||
{
|
||||
if(this.getMode() != null && this.getMode().equals(EnumMode.MERGE))
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ import exopandora.worldhandler.builder.Syntax;
|
||||
import exopandora.worldhandler.builder.types.ItemResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.Type;
|
||||
import exopandora.worldhandler.helper.ResourceHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -68,13 +68,13 @@ public class BuilderGive extends CommandBuilderNBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(NBTTagCompound nbt)
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
{
|
||||
this.itemResourceLocation.setNBT(nbt);
|
||||
this.setNode(1, this.itemResourceLocation);
|
||||
}
|
||||
|
||||
public NBTTagCompound getNBT()
|
||||
public CompoundNBT getNBT()
|
||||
{
|
||||
return this.getNodeAsItemResourceLocation(1).getNBT();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.NoteBlockInstrument;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@@ -4,9 +4,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.Syntax;
|
||||
import exopandora.worldhandler.builder.component.abstr.PotionMetadata;
|
||||
import exopandora.worldhandler.builder.component.abstr.EffectData;
|
||||
import exopandora.worldhandler.builder.types.Type;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -57,7 +57,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
return this.getNodeAsString(1);
|
||||
}
|
||||
|
||||
public void setEffect(Potion effect)
|
||||
public void setEffect(Effect effect)
|
||||
{
|
||||
this.setEffect(effect.getRegistryName());
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Potion getEffectAsPotion()
|
||||
public Effect getEffectAsPotion()
|
||||
{
|
||||
ResourceLocation location = this.getNodeAsResourceLocation(2);
|
||||
|
||||
@@ -123,7 +123,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
public void setSeconds(int seconds)
|
||||
{
|
||||
this.seconds = seconds;
|
||||
this.setDuration(PotionMetadata.toSeconds(this.seconds, this.minutes, this.hours));
|
||||
this.setDuration(EffectData.toSeconds(this.seconds, this.minutes, this.hours));
|
||||
}
|
||||
|
||||
public int getMinutes()
|
||||
@@ -134,7 +134,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
public void setMinutes(int minutes)
|
||||
{
|
||||
this.minutes = minutes;
|
||||
this.setDuration(PotionMetadata.toSeconds(this.seconds, this.minutes, this.hours));
|
||||
this.setDuration(EffectData.toSeconds(this.seconds, this.minutes, this.hours));
|
||||
}
|
||||
|
||||
public int getHours()
|
||||
@@ -145,7 +145,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
public void setHours(int hours)
|
||||
{
|
||||
this.hours = hours;
|
||||
this.setDuration(PotionMetadata.toSeconds(this.seconds, this.minutes, this.hours));
|
||||
this.setDuration(EffectData.toSeconds(this.seconds, this.minutes, this.hours));
|
||||
}
|
||||
|
||||
public BuilderGeneric getGiveCommand()
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Set;
|
||||
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentPotionItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -25,69 +25,69 @@ public class BuilderPotionItem extends BuilderGive
|
||||
this.potion = this.registerNBTComponent(potion);
|
||||
}
|
||||
|
||||
public void setAmplifier(Potion potion, byte amplifier)
|
||||
public void setAmplifier(Effect potion, byte amplifier)
|
||||
{
|
||||
this.potion.setAmplifier(potion, amplifier);
|
||||
}
|
||||
|
||||
public void setSeconds(Potion potion, int seconds)
|
||||
public void setSeconds(Effect potion, int seconds)
|
||||
{
|
||||
this.potion.setSeconds(potion, seconds);
|
||||
}
|
||||
|
||||
public void setMinutes(Potion potion, int minutes)
|
||||
public void setMinutes(Effect potion, int minutes)
|
||||
{
|
||||
this.potion.setMinutes(potion, minutes);
|
||||
}
|
||||
|
||||
public void setHours(Potion potion, int hours)
|
||||
public void setHours(Effect potion, int hours)
|
||||
{
|
||||
this.potion.setHours(potion, hours);
|
||||
}
|
||||
|
||||
public void setShowParticles(Potion potion, boolean showParticles)
|
||||
public void setShowParticles(Effect potion, boolean showParticles)
|
||||
{
|
||||
this.potion.setShowParticles(potion, showParticles);
|
||||
}
|
||||
|
||||
public void setAmbient(Potion potion, boolean ambient)
|
||||
public void setAmbient(Effect potion, boolean ambient)
|
||||
{
|
||||
this.potion.setAmbient(potion, ambient);
|
||||
}
|
||||
|
||||
public byte getAmplifier(Potion potion)
|
||||
public byte getAmplifier(Effect potion)
|
||||
{
|
||||
return this.potion.getAmplifier(potion);
|
||||
}
|
||||
|
||||
public int getSeconds(Potion potion)
|
||||
public int getSeconds(Effect potion)
|
||||
{
|
||||
return this.potion.getSeconds(potion);
|
||||
}
|
||||
|
||||
public int getMinutes(Potion potion)
|
||||
public int getMinutes(Effect potion)
|
||||
{
|
||||
return this.potion.getMinutes(potion);
|
||||
}
|
||||
|
||||
public int getHours(Potion potion)
|
||||
public int getHours(Effect potion)
|
||||
{
|
||||
return this.potion.getHours(potion);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(Potion potion)
|
||||
public boolean getShowParticles(Effect potion)
|
||||
{
|
||||
return this.potion.getShowParticles(potion);
|
||||
}
|
||||
|
||||
public boolean getAmbient(Potion potion)
|
||||
public boolean getAmbient(Effect potion)
|
||||
{
|
||||
return this.potion.getAmbient(potion);
|
||||
}
|
||||
|
||||
public Set<Potion> getPotions()
|
||||
public Set<Effect> getEffects()
|
||||
{
|
||||
return this.potion.getPotions();
|
||||
return this.potion.getEffects();
|
||||
}
|
||||
|
||||
public BuilderPotionItem getBuilderForPotion(Item item)
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BuilderRecipe extends CommandBuilder
|
||||
return this.getNodeAsString(1);
|
||||
}
|
||||
|
||||
public void setRecipe(IRecipe recipe)
|
||||
public void setRecipe(IRecipe<?> recipe)
|
||||
{
|
||||
this.setRecipe(recipe.getId());
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import exopandora.worldhandler.builder.impl.abstr.BuilderBlockPos;
|
||||
import exopandora.worldhandler.builder.types.BlockResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.builder.types.Type;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -58,7 +58,7 @@ public class BuilderSetBlock extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(NBTTagCompound nbt)
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
{
|
||||
this.blockResourceLocation.setNBT(nbt);
|
||||
this.setNode(3, this.blockResourceLocation);
|
||||
|
||||
@@ -5,7 +5,7 @@ import javax.annotation.Nullable;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentTag;
|
||||
import exopandora.worldhandler.format.text.ColoredString;
|
||||
import exopandora.worldhandler.format.text.SignText;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class BuilderSignEditor extends BuilderData
|
||||
|
||||
for(int x = 0; x < 4; x++)
|
||||
{
|
||||
this.sign[x] = this.registerNBTComponent(new ComponentTag<SignText>("Text" + (x + 1), new SignText(x), text -> new NBTTagString(text.toString())));
|
||||
this.sign[x] = this.registerNBTComponent(new ComponentTag<SignText>("Text" + (x + 1), new SignText(x), text -> new StringNBT(text.toString())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,16 +19,16 @@ import exopandora.worldhandler.builder.types.CoordinateDouble;
|
||||
import exopandora.worldhandler.builder.types.Type;
|
||||
import exopandora.worldhandler.format.text.ColoredString;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.INBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -37,9 +37,9 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
{
|
||||
private final ComponentAttributeMob attribute;
|
||||
private final ComponentTag<ColoredString> customName;
|
||||
private final ComponentTag<NBTTagList> passengers;
|
||||
private final ComponentTag<NBTTagList> armorItems;
|
||||
private final ComponentTag<NBTTagList> handItems;
|
||||
private final ComponentTag<ListNBT> passengers;
|
||||
private final ComponentTag<ListNBT> armorItems;
|
||||
private final ComponentTag<ListNBT> 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()};
|
||||
@@ -49,9 +49,9 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
{
|
||||
this.attribute = this.registerNBTComponent(new ComponentAttributeMob(attribute -> attribute.getApplyable().equals(Applyable.BOTH) || attribute.getApplyable().equals(Applyable.MOB)));
|
||||
this.customName = this.registerNBTComponent(new ComponentTag<ColoredString>("CustomName", new ColoredString(), this::colorStringSerializer));
|
||||
this.passengers = this.registerNBTComponent(new ComponentTag<NBTTagList>("Passengers"));
|
||||
this.armorItems = this.registerNBTComponent(new ComponentTag<NBTTagList>("ArmorItems", this::itemListSerializer));
|
||||
this.handItems = this.registerNBTComponent(new ComponentTag<NBTTagList>("HandItems", this::itemListSerializer));
|
||||
this.passengers = this.registerNBTComponent(new ComponentTag<ListNBT>("Passengers"));
|
||||
this.armorItems = this.registerNBTComponent(new ComponentTag<ListNBT>("ArmorItems", this::itemListSerializer));
|
||||
this.handItems = this.registerNBTComponent(new ComponentTag<ListNBT>("HandItems", this::itemListSerializer));
|
||||
this.summon = this.registerNBTComponent(new ComponentSummon(), "summon");
|
||||
this.potion = this.registerNBTComponent(new ComponentPotionMob());
|
||||
this.setX(new CoordinateDouble(0.0, CoordinateType.LOCAL));
|
||||
@@ -154,10 +154,10 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
{
|
||||
if(entityName != null)
|
||||
{
|
||||
NBTTagCompound passenger = new NBTTagCompound();
|
||||
passenger.setString("id", entityName.toString());
|
||||
CompoundNBT passenger = new CompoundNBT();
|
||||
passenger.putString("id", entityName.toString());
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
ListNBT list = new ListNBT();
|
||||
list.add(passenger);
|
||||
|
||||
this.passengers.setValue(list);
|
||||
@@ -171,7 +171,7 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
@Nullable
|
||||
public ResourceLocation getPassenger()
|
||||
{
|
||||
NBTTagList list = this.passengers.getValue();
|
||||
ListNBT list = this.passengers.getValue();
|
||||
|
||||
if(list != null && !list.isEmpty())
|
||||
{
|
||||
@@ -198,13 +198,13 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
|
||||
public void setArmorItems(ResourceLocation[] armor)
|
||||
{
|
||||
NBTTagList list = new NBTTagList();
|
||||
ListNBT list = new ListNBT();
|
||||
|
||||
for(ResourceLocation item : armor)
|
||||
{
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("id", item.toString());
|
||||
compound.setInt("Count", 1);
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
compound.putString("id", item.toString());
|
||||
compound.putInt("Count", 1);
|
||||
list.add(compound);
|
||||
}
|
||||
|
||||
@@ -247,13 +247,13 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
|
||||
public void setHandItems(ResourceLocation[] armor)
|
||||
{
|
||||
NBTTagList list = new NBTTagList();
|
||||
ListNBT list = new ListNBT();
|
||||
|
||||
for(ResourceLocation item : armor)
|
||||
{
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("id", item.toString());
|
||||
compound.setInt("Count", 1);
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
compound.putString("id", item.toString());
|
||||
compound.putInt("Count", 1);
|
||||
list.add(compound);
|
||||
}
|
||||
|
||||
@@ -270,72 +270,72 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
return Blocks.AIR.getRegistryName();
|
||||
}
|
||||
|
||||
public void setAmplifier(Potion potion, byte amplifier)
|
||||
public void setAmplifier(Effect potion, byte amplifier)
|
||||
{
|
||||
this.potion.setAmplifier(potion, amplifier);
|
||||
}
|
||||
|
||||
public void setSeconds(Potion potion, int seconds)
|
||||
public void setSeconds(Effect potion, int seconds)
|
||||
{
|
||||
this.potion.setSeconds(potion, seconds);
|
||||
}
|
||||
|
||||
public void setMinutes(Potion potion, int minutes)
|
||||
public void setMinutes(Effect potion, int minutes)
|
||||
{
|
||||
this.potion.setMinutes(potion, minutes);
|
||||
}
|
||||
|
||||
public void setHours(Potion potion, int hours)
|
||||
public void setHours(Effect potion, int hours)
|
||||
{
|
||||
this.potion.setHours(potion, hours);
|
||||
}
|
||||
|
||||
public void setShowParticles(Potion potion, boolean showParticles)
|
||||
public void setShowParticles(Effect potion, boolean showParticles)
|
||||
{
|
||||
this.potion.setShowParticles(potion, showParticles);
|
||||
}
|
||||
|
||||
public void setAmbient(Potion potion, boolean ambient)
|
||||
public void setAmbient(Effect potion, boolean ambient)
|
||||
{
|
||||
this.potion.setAmbient(potion, ambient);
|
||||
}
|
||||
|
||||
public byte getAmplifier(Potion potion)
|
||||
public byte getAmplifier(Effect potion)
|
||||
{
|
||||
return this.potion.getAmplifier(potion);
|
||||
}
|
||||
|
||||
public int getSeconds(Potion potion)
|
||||
public int getSeconds(Effect potion)
|
||||
{
|
||||
return this.potion.getSeconds(potion);
|
||||
}
|
||||
|
||||
public int getMinutes(Potion potion)
|
||||
public int getMinutes(Effect potion)
|
||||
{
|
||||
return this.potion.getMinutes(potion);
|
||||
}
|
||||
|
||||
public int getHours(Potion potion)
|
||||
public int getHours(Effect potion)
|
||||
{
|
||||
return this.potion.getHours(potion);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(Potion potion)
|
||||
public boolean getShowParticles(Effect potion)
|
||||
{
|
||||
return this.potion.getShowParticles(potion);
|
||||
}
|
||||
|
||||
public boolean getAmbient(Potion potion)
|
||||
public boolean getAmbient(Effect potion)
|
||||
{
|
||||
return this.potion.getAmbient(potion);
|
||||
}
|
||||
|
||||
public Set<Potion> getPotions()
|
||||
public Set<Effect> getEffects()
|
||||
{
|
||||
return this.potion.getPotions();
|
||||
return this.potion.getEffects();
|
||||
}
|
||||
|
||||
private INBTBase itemListSerializer(NBTTagList list)
|
||||
private INBT itemListSerializer(ListNBT list)
|
||||
{
|
||||
for(int x = 0; x < list.size(); x++)
|
||||
{
|
||||
@@ -348,18 +348,18 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
return null;
|
||||
}
|
||||
|
||||
private INBTBase colorStringSerializer(ColoredString string)
|
||||
private INBT colorStringSerializer(ColoredString string)
|
||||
{
|
||||
if(string.getText() != null && !string.getText().isEmpty())
|
||||
{
|
||||
return new NBTTagString(ITextComponent.Serializer.toJson(new TextComponentString(string.toString())));
|
||||
return new StringNBT(ITextComponent.Serializer.toJson(new StringTextComponent(string.toString())));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(NBTTagCompound nbt)
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
{
|
||||
this.setNode(4, nbt);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ import javax.annotation.Nullable;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.arguments.BlockStateParser;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -17,7 +17,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class BlockResourceLocation extends ItemResourceLocation
|
||||
{
|
||||
private IBlockState state;
|
||||
private BlockState state;
|
||||
|
||||
public BlockResourceLocation()
|
||||
{
|
||||
@@ -29,13 +29,13 @@ public class BlockResourceLocation extends ItemResourceLocation
|
||||
this(resource, null, null);
|
||||
}
|
||||
|
||||
public BlockResourceLocation(ResourceLocation resource, IBlockState state, NBTTagCompound nbt)
|
||||
public BlockResourceLocation(ResourceLocation resource, BlockState state, CompoundNBT nbt)
|
||||
{
|
||||
super(resource, nbt);
|
||||
this.state = this.findState(state, resource);
|
||||
}
|
||||
|
||||
private IBlockState findState(IBlockState state, ResourceLocation resource)
|
||||
private BlockState findState(BlockState state, ResourceLocation resource)
|
||||
{
|
||||
boolean matchOld = this.state != null && this.state.getBlock().getRegistryName().equals(resource);
|
||||
boolean matchNew = state != null && state.getBlock().getRegistryName().equals(resource);
|
||||
@@ -65,7 +65,7 @@ public class BlockResourceLocation extends ItemResourceLocation
|
||||
this.state = this.findState(null, resource);
|
||||
}
|
||||
|
||||
public IBlockState getState()
|
||||
public BlockState getState()
|
||||
{
|
||||
return this.state;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public class BlockResourceLocation extends ItemResourceLocation
|
||||
return null;
|
||||
}
|
||||
|
||||
IBlockState state = parser.getState();
|
||||
BlockState state = parser.getState();
|
||||
|
||||
if(state != null)
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -14,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public class ItemResourceLocation
|
||||
{
|
||||
protected ResourceLocation resource;
|
||||
protected NBTTagCompound nbt;
|
||||
protected CompoundNBT nbt;
|
||||
|
||||
public ItemResourceLocation()
|
||||
{
|
||||
@@ -26,7 +26,7 @@ public class ItemResourceLocation
|
||||
this(resource, null);
|
||||
}
|
||||
|
||||
public ItemResourceLocation(ResourceLocation resource, NBTTagCompound nbt)
|
||||
public ItemResourceLocation(ResourceLocation resource, CompoundNBT nbt)
|
||||
{
|
||||
this.resource = resource;
|
||||
this.nbt = nbt;
|
||||
@@ -42,12 +42,12 @@ public class ItemResourceLocation
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public NBTTagCompound getNBT()
|
||||
public CompoundNBT getNBT()
|
||||
{
|
||||
return this.nbt;
|
||||
}
|
||||
|
||||
public void setNBT(NBTTagCompound nbt)
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
{
|
||||
this.nbt = nbt;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class ItemResourceLocation
|
||||
{
|
||||
int start = input.indexOf("{");
|
||||
ResourceLocation resource = new ResourceLocation(input.substring(0, start));
|
||||
NBTTagCompound nbt = null;
|
||||
CompoundNBT nbt = null;
|
||||
|
||||
if(start > 0)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ import javax.annotation.Nullable;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -27,7 +27,7 @@ public enum Type
|
||||
RESOURCE_LOCATION(Type::parseResourceLocation),
|
||||
ITEM_RESOURCE_LOCATION(ItemResourceLocation::valueOf),
|
||||
BLOCK_RESOURCE_LOCATION(BlockResourceLocation::valueOf),
|
||||
NBT(Type::parseNBTTagCompound),
|
||||
NBT(Type::parseCompoundNBT),
|
||||
COORDINATE_INT(CoordinateInt::valueOf),
|
||||
COORDINATE_DOUBLE(CoordinateDouble::valueOf),
|
||||
TARGET_SELECTOR(TargetSelector::valueOf);
|
||||
@@ -53,7 +53,7 @@ public enum Type
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static NBTTagCompound parseNBTTagCompound(String value)
|
||||
public static CompoundNBT parseCompoundNBT(String value)
|
||||
{
|
||||
if(value != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user