Merge pull request #882 from altrisi/not-fromItemStack

Replace usages of deprecated ListValue::fromItemStack and remove it
This commit is contained in:
gnembon authored and GitHub committed 2021-05-25 00:50:53 -03:00
commit 7b4176f717
3 files changed
+8 -15

No files matched your search

@@ -484,7 +484,7 @@ public class EntityValue extends Value
put("age", (e, a) -> new NumericValue(e.age));
put("breeding_age", (e, a) -> e instanceof PassiveEntity?new NumericValue(((PassiveEntity) e).getBreedingAge()):Value.NULL);
put("despawn_timer", (e, a) -> e instanceof LivingEntity?new NumericValue(((LivingEntity) e).getDespawnCounter()):Value.NULL);
put("item", (e, a) -> (e instanceof ItemEntity)?ListValue.fromItemStack(((ItemEntity) e).getStack()):Value.NULL);
put("item", (e, a) -> (e instanceof ItemEntity)?ValueConversions.of(((ItemEntity) e).getStack()):Value.NULL);
put("count", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntity) e).getStack().getCount()):Value.NULL);
put("pickup_delay", (e, a) -> (e instanceof ItemEntity)?new NumericValue(((ItemEntityInterface) e).getPickupDelayCM()):Value.NULL);
put("portal_cooldown", (e , a) ->new NumericValue(((EntityInterface)e).getPortalTimer()));
@@ -732,7 +732,7 @@ public class EntityValue extends Value
if (where == null)
throw new InternalExpressionException("Unknown inventory slot: "+a.getString());
if (e instanceof LivingEntity)
return ListValue.fromItemStack(((LivingEntity)e).getEquippedStack(where));
return ValueConversions.of(((LivingEntity)e).getEquippedStack(where));
return Value.NULL;
});
@@ -4,7 +4,6 @@ import carpet.script.LazyValue;
import carpet.script.exception.InternalExpressionException;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.AbstractNumberTag;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.DoubleTag;
@@ -75,12 +74,6 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
items = list;
}
@Deprecated
public static Value fromItemStack(ItemStack itemstack)
{
return ValueConversions.of(itemstack);
}
public static Value fromTriple(double a, double b, double c)
{
return ListValue.of(new NumericValue(a), new NumericValue(b), new NumericValue(c));