Treat null as a default value
This commit is contained in:
@@ -4,8 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.util.NBTHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -46,21 +46,13 @@ public abstract class CommandBuilderNBT extends CommandBuilder implements IComma
|
||||
return super.toActualCommand();
|
||||
}
|
||||
|
||||
private CompoundNBT buildNBT()
|
||||
protected CompoundNBT buildNBT()
|
||||
{
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
|
||||
for(IBuilderComponent component : this.TAG_TO_COMPONENT)
|
||||
{
|
||||
INBT serialized = component.serialize();
|
||||
|
||||
if(component.getTag() != null && serialized != null)
|
||||
{
|
||||
if(!nbt.contains(component.getTag()))
|
||||
{
|
||||
nbt.put(component.getTag(), serialized);
|
||||
}
|
||||
}
|
||||
NBTHelper.append(nbt, component);
|
||||
}
|
||||
|
||||
if(nbt.isEmpty())
|
||||
|
||||
@@ -70,7 +70,7 @@ public class BlockResourceLocation extends ItemResourceLocation
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> void withState(IProperty<T> property, T value)
|
||||
public <T extends Comparable<T>> void setProperty(IProperty<T> property, T value)
|
||||
{
|
||||
if(this.state != null && this.state.has(property))
|
||||
{
|
||||
@@ -105,12 +105,6 @@ public class BlockResourceLocation extends ItemResourceLocation
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockResourceLocation get()
|
||||
{
|
||||
return (BlockResourceLocation) super.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
||||
@@ -52,16 +52,6 @@ public class ItemResourceLocation
|
||||
this.nbt = nbt;
|
||||
}
|
||||
|
||||
public ItemResourceLocation get()
|
||||
{
|
||||
if(this.resource != null)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ItemResourceLocation valueOf(String input)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user