From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../fbs/pottery/usable/PotteryAppraisal.java | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java (limited to 'src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java') diff --git a/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java new file mode 100644 index 0000000..62cc097 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/pottery/usable/PotteryAppraisal.java @@ -0,0 +1,40 @@ +package jp.plusplus.fbs.pottery.usable; + +import jp.plusplus.fbs.alchemy.AlchemyRegistry; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; + +import javax.annotation.Nullable; + +/** + * Created by plusplus_F on 2016/04/02. + */ +public class PotteryAppraisal extends PotteryKeep { + @Override + public String getUnlocalizedName() { + return "pottery.fbs.pot.appraisal"; + } + + @Override + public float getPriceScale(ItemStack pottery){ + return 1.5f; + } + + @Override + public ItemStack onInventoryClosing(EntityPlayer player, ItemStack pottery, int index, @Nullable ItemStack itemStack){ + if(itemStack!=null && !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index) && AlchemyRegistry.CanAppraisal(itemStack)){ + ItemStack ret=AlchemyRegistry.GetRandomAppraisal(itemStack); + if(ret!=null){ + ret.stackSize=Math.min(itemStack.stackSize, ret.getMaxStackSize()); + return ret; + } + } + return itemStack; + } + + @Override + public boolean canTakeStack(EntityPlayer player, ItemStack pottery, int index, ItemStack itemStack){ + return !pottery.getTagCompound().getBoolean(CHANGED_INDEXES+index); + } +} -- cgit v1.2.3