优化功能

This commit is contained in:
yuyu 2024-06-05 16:44:12 +08:00
parent c9265ab612
commit 7c180ba8cf
6 changed files with 404 additions and 93 deletions

View File

@ -1,6 +1,5 @@
package com.yuyu.srappraise.appraise;
import com.germ.germplugin.api.dynamic.DynamicBase;
import com.germ.germplugin.api.dynamic.gui.*;
import com.sakurarealm.sritem.api.ItemStackHelper;
import com.sakurarealm.sritem.api.SrItemAPI;
@ -14,10 +13,11 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.*;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @BelongsProject: SrAppraise
@ -30,7 +30,7 @@ import java.util.Random;
*/
public class AppraiseGuiService extends GermGuiScreen {
private GermGuiScreen gifScreen;
// private GermGuiScreen gifScreen;
private HashMap<String,GermGuiSlot> germGuiSlotHashMap;
private List<ItemStack> itemStackHashMap;
private int index;
@ -46,7 +46,7 @@ public class AppraiseGuiService extends GermGuiScreen {
this.btnRegister();
this.registerLeft();
this.registerRight();
this.gifScreen = GermGuiScreen.getGermGuiScreen("player_inventory-appraise", AppraiseManager.getAppraiseGif());
// this.gifScreen = GermGuiScreen.getGermGuiScreen("player_inventory-appraise", AppraiseManager.getAppraiseGif());
this.setClosedHandler(((player, germGuiScreen) -> {
//窗口关闭事件
this.returnItemStacks(player);
@ -65,30 +65,43 @@ public class AppraiseGuiService extends GermGuiScreen {
List<GermGuiSlot> allGuiParts = canvas.getAllGuiParts(GermGuiSlot.class);
for (GermGuiSlot guiPart : allGuiParts) {
if (guiPart.getItemStack().getType() == Material.AIR || (boolean)guiPart.getInteract() == false) {
continue;
}else {
//不是空气就把东西放进玩家背包中去
player.getInventory().addItem(guiPart.getItemStack());
//清空所有槽位
guiPart.setItemStack(Material.AIR);
}
}
//这样就能确保上一次的东西不会在下次打开的时候出现
this.itemStackHashMap.clear();
}
/**
* 清空产物槽
*/
public void clearSlotProduct(){
for (int i = 1;i<=5;i++){
String slot = "slot_product_"+i;
GermGuiSlot germGuiSlot = this.germGuiSlotHashMap.get(slot);
germGuiSlot.setItemStack(Material.AIR);
}
}
public void getSoltGui(){
//先获取canvas再获取canvas中的槽位
GermGuiCanvas canvas = (GermGuiCanvas) getGuiPart("utility");
GermGuiSlot slot_biomass = (GermGuiSlot) canvas.getGuiPart("slot_consume");
GermGuiSlot slot_biomass = (GermGuiSlot) canvas.getGuiPart("slotConsume");
GermGuiSlot slot_product_1 = (GermGuiSlot) canvas.getGuiPart("slot_product_1");
GermGuiSlot slot_product_2 = (GermGuiSlot) canvas.getGuiPart("slot_product_2");
GermGuiSlot slot_product_3 = (GermGuiSlot) canvas.getGuiPart("slot_product_3");
GermGuiSlot slot_product_4 = (GermGuiSlot) canvas.getGuiPart("slot_product_4");
GermGuiSlot slot_product_5 = (GermGuiSlot) canvas.getGuiPart("slot_product_5");
this.germGuiSlotHashMap.put("slot_consume",slot_biomass);
this.germGuiSlotHashMap.put("slotConsume",slot_biomass);
this.germGuiSlotHashMap.put("slot_product_1",slot_product_1);
this.germGuiSlotHashMap.put("slot_product_2",slot_product_2);
this.germGuiSlotHashMap.put("slot_product_3",slot_product_3);
@ -96,18 +109,35 @@ public class AppraiseGuiService extends GermGuiScreen {
this.germGuiSlotHashMap.put("slot_product_5",slot_product_5);
}
/**
* 监听物品槽
*/
synchronized public void soltRegister() {
GermGuiSlot slot_biomass = this.germGuiSlotHashMap.get("slot_consume");
GermGuiSlot slot_biomass = this.germGuiSlotHashMap.get("slotConsume");
GermGuiCanvas canvas = (GermGuiCanvas) getGuiPart("utility");
GermGuiButton button_consume = (GermGuiButton) canvas.getGuiPart("button_consume");
button_consume.registerCallbackHandler((player, germGuiSlot) -> {
for (int i = 1;i<=5;i++){
String slot = "slot_product_"+i;
GermGuiSlot Germslot = this.germGuiSlotHashMap.get(slot);
if (Germslot.getItemStack().getType() != Material.AIR && (boolean)Germslot.getInteract()) {
player.sendMessage(ChatColor.RED+"请拿出产物槽的物品!");
return;
}
}
slot_biomass.registerCallbackHandler((player, germGuiSlot) -> {
ItemStack itemStack = slot_biomass.getItemStack();
//如果放上去空气直接返回不管
if(itemStack == null || itemStack.getType() == Material.AIR) {
//清空产物槽
this.clearSlotProduct();
return;
}else if (ItemStackHelper.getSrItemHandler(itemStack) == null){
return;
@ -119,39 +149,53 @@ public class AppraiseGuiService extends GermGuiScreen {
//这个是item的名字
String itemName = title.substring(title.indexOf('l') + 1);
if (SrAppraise.getConfigManager().getAppraiseItemMap().containsKey(itemName)){
if (SrAppraise.getConfigManager().getAppraiseItemMap().containsKey(itemName)){
itemStackHashMap.clear();
itemStackHashMap.clear();
HashMap<String, AppraiseProduct> appraiseProductHashMap =
SrAppraise.getConfigManager().getAppraiseItemMap().get(itemName);
for (String key : appraiseProductHashMap.keySet()){
//获取ItemStack
ItemStack product = appraiseProductHashMap.get(key).getItemStack();
if (product != null) {
product.setAmount(1);
this.itemStackHashMap.add(product);
}
}
//把可能的产物放上槽位中
for (int i = 1;i<= this.itemStackHashMap.size() && i <= 5;i++){
//物品槽位
String slot = "slot_product_"+ i;
//获取产物
ItemStack product = this.itemStackHashMap.get(i - 1);
GermGuiSlot productSlot = this.germGuiSlotHashMap.get(slot);
productSlot.setItemStack(product);
//把展示槽锁住
productSlot.setInteract(false);
}
this.index = 1;
}else {
//不包含就返回
return;
HashMap<String, AppraiseProduct> appraiseProductHashMap =
SrAppraise.getConfigManager().getAppraiseItemMap().get(itemName);
for (String key : appraiseProductHashMap.keySet()){
//获取ItemStack
ItemStack product = appraiseProductHashMap.get(key).getItemStack();
if (product != null) {
product.setAmount(1);
this.itemStackHashMap.add(product);
}
},GermGuiSlot.EventType.LEFT_CLICK); //左键点击时触发注意可能会放空气进去
}
//把可能的产物放上槽位中
for (int i = 1;i<= this.itemStackHashMap.size() && i <= 5;i++){
//物品槽位
String slot = "slot_product_"+ i;
//获取产物
ItemStack product = this.itemStackHashMap.get(i - 1);
GermGuiSlot productSlot = this.germGuiSlotHashMap.get(slot);
productSlot.setItemStack(product);
//把展示槽锁住
productSlot.setInteract(false);
}
this.index = 1;
}else {
//不包含就返回
return;
}
},GermGuiButton.EventType.BEGIN_HOVER,GermGuiButton.EventType.LEAVE_HOVER);
}
/**
* 用来判断是否可以左右移动产物槽中的物品
* @return
*/
public boolean boolToSlotMove(){
GermGuiSlot germGuiSlot = this.germGuiSlotHashMap.get("slot_product_1");
if ((boolean)germGuiSlot.getInteract()){
return false;
}else {
return true;
}
}
/**
@ -163,11 +207,13 @@ public class AppraiseGuiService extends GermGuiScreen {
leftButton.registerCallbackHandler((player, germGuiSlot) -> {
if (this.itemStackHashMap.size() <= 5){
//如果可能的产物小于五个或者产物槽可以交互就不能移动槽位中的产品
if (this.itemStackHashMap.size() <= 5 || !this.boolToSlotMove()){
return;
}
GermGuiSlot slotConsume = this.germGuiSlotHashMap.get("slot_consume");
GermGuiSlot slotConsume = this.germGuiSlotHashMap.get("slotConsume");
if (slotConsume.getItemStack().getType() == Material.AIR) {
return;
@ -194,11 +240,12 @@ public class AppraiseGuiService extends GermGuiScreen {
rightButton.registerCallbackHandler((player, germGuiSlot) -> {
if (this.itemStackHashMap.size() <= 5){
//如果可能的产物小于五个或者产物槽可以交互就不能移动槽位中的产品
if (this.itemStackHashMap.size() <= 5 || !this.boolToSlotMove()){
return;
}
GermGuiSlot slotConsume = this.germGuiSlotHashMap.get("slot_consume");
GermGuiSlot slotConsume = this.germGuiSlotHashMap.get("slotConsume");
if (slotConsume.getItemStack().getType() == Material.AIR) {
return;
@ -240,24 +287,40 @@ public class AppraiseGuiService extends GermGuiScreen {
}
/**
* 此方法用于绑定鉴定事件的发生
*/
public void btnRegister() {
GermGuiCanvas canvas = (GermGuiCanvas) getGuiPart("utility");
synchronized public void btnRegister() {
GermGuiCanvas canvas = (GermGuiCanvas) getGuiPart("utility");
GermGuiButton confrimBtn = (GermGuiButton) canvas.getGuiPart("b_confirm");
confrimBtn.registerCallbackHandler((clickPlayer, btn) -> {
Random random = new Random();
HashMap<String,ItemStack> itemStacks= new HashMap<>();
//获取物品槽
GermGuiSlot slot_biomass = this.germGuiSlotHashMap.get("slot_consume");
//开始之前循环一边产品槽判断是否有东西没有取出来
for (int i = 1;i <= 5;i++){
String slot = "slot_product_"+ i;
GermGuiSlot germGuiSlot = this.germGuiSlotHashMap.get(slot);
if ((boolean)germGuiSlot.getInteract() && germGuiSlot.getItemStack().getType() != Material.AIR){
clickPlayer.sendMessage(ChatColor.RED+"请把上次鉴定的产物拿出来!");
return;
}
}
Random random = new Random();
HashMap<String,ItemStack> itemStacks= new LinkedHashMap<>();
//获取物品槽
GermGuiSlot slot_biomass = this.germGuiSlotHashMap.get("slotConsume");
//获取透明gui
// GermGuiScreen touMingGui = GermGuiScreen.getGermGuiScreen("touming", AppraiseManager.getTouMingButton());
// touMingGui.openChildGui(clickPlayer);
//开始鉴定后把槽位锁住
slot_biomass.setInteract(true);
//获取鉴定的物品
ItemStack itemStack = slot_biomass.getItemStack();
AtomicInteger amount = new AtomicInteger(itemStack.getAmount());
// slot_biomass.setInteract(false);
if(itemStack == null || itemStack.getType() == Material.AIR) {
clickPlayer.sendMessage(ChatColor.RED + "你必须在鉴定槽中放一个东西!");
@ -265,8 +328,8 @@ public class AppraiseGuiService extends GermGuiScreen {
}else if (ItemStackHelper.getSrItemHandler(itemStack) == null){
return;
}
gifScreen.openChildGui(clickPlayer);
GermGuiScreen gifScreen = GermGuiScreen.getGermGuiScreen("player_inventory-appraise", AppraiseManager.getAppraiseGif());
gifScreen.openChildGui(clickPlayer);
SrItemHandler srItemHandler = ItemStackHelper.getSrItemHandler(itemStack);
String title = srItemHandler.getTitle();
@ -288,17 +351,16 @@ public class AppraiseGuiService extends GermGuiScreen {
HashMap<String, AppraiseProduct> stringAppraiseProductHashMap =
SrAppraise.getConfigManager().getAppraiseItemMap().get(itemName);
int amount = itemStack.getAmount();
//如果同时鉴定多个
for (int i = 0;i < amount;i++) {
for (int i = 0; i < amount.get(); i++) {
//利用Random生成一个随机数来确定产物
float probility = random.nextFloat();
for (String product : stringAppraiseProductHashMap.keySet()) {
AppraiseProduct appraiseProduct = stringAppraiseProductHashMap.get(product);
if (probility >= appraiseProduct.getProMin() && probility < appraiseProduct.getProMax()) {
//概率通过获取该产物
//概率通过获取该产物 TODO(此处注意appraiseProduct对象中的产物只能用来展示鉴定不能做出任何修改)
ItemStack item =
appraiseProduct.getItemStack();
SrItemAPI.getItem(appraiseProduct.getIndexName(),new HashMap<>(),null,true,true);
//获取产物后将产物StringItemStack K-V 的形式存到map中
if (itemStacks.containsKey(product)) {
ItemStack itemStack1 = itemStacks.get(product);
@ -311,42 +373,70 @@ public class AppraiseGuiService extends GermGuiScreen {
}
}
}
//所有物品全部结束循环的时候
int j = 1;
int timeRun = 8000 / itemStacks.size();
for (ItemStack srItem : itemStacks.values()){
try {
Thread.sleep(timeRun);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
//拼接物品槽的名字
String slot = "slot_product_" + j;
GermGuiSlot product = this.germGuiSlotHashMap.get(slot);
ItemStack itemStack1 = product.getItemStack();
//有五个物品槽
if (j <= 5 && itemStack1.getType() == Material.AIR){
product.setItemStack(srItem);
itemStack.setAmount(itemStack.getAmount() - srItem.getAmount());
slot_biomass.setItemStack(itemStack);
}else {
//多出来的放进玩家背包
PlayerInventory inventory = clickPlayer.getInventory();
inventory.addItem(srItem);
itemStack.setAmount(itemStack.getAmount() - srItem.getAmount());
slot_biomass.setItemStack(itemStack);
int timeRun = 9 / itemStacks.size();
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
AtomicInteger j = new AtomicInteger(0);
//定时执行的函数
executor.scheduleAtFixedRate(() -> {
if (j.intValue() == 0){
j.incrementAndGet();
return;
}
j++;
}
//迭代循环
if (!itemStacks.isEmpty()) {
Iterator<Map.Entry<String, ItemStack>> iterator = itemStacks.entrySet().iterator();
if (iterator.hasNext()) {
Map.Entry<String, ItemStack> entry = iterator.next();
iterator.remove();//删除元素
if (j.get() <= 5) {
String slot = "slot_product_" + j;
GermGuiSlot germGuiSlot = this.germGuiSlotHashMap.get(slot);
germGuiSlot.setItemStack(entry.getValue());
amount.set(amount.get() - entry.getValue().getAmount());
if (itemStack == slot_biomass.getItemStack()) {
itemStack.setAmount(itemStack.getAmount() - entry.getValue().getAmount());
slot_biomass.setItemStack(itemStack);
}else {
clickPlayer.sendMessage(ChatColor.RED+"请不要在鉴定过程中取出鉴定物品!!!");
germGuiSlot.setItemStack(new ItemStack(Material.AIR));
executor.shutdown();
}
}else {
//j大于5直接放进背包
PlayerInventory inventory = clickPlayer.getInventory();
inventory.addItem(entry.getValue());
amount.set(amount.get() - entry.getValue().getAmount());
if (itemStack == slot_biomass.getItemStack()) {
itemStack.setAmount(itemStack.getAmount() - entry.getValue().getAmount());
slot_biomass.setItemStack(itemStack);
}else{
inventory.remove(entry.getValue());
clickPlayer.sendMessage(ChatColor.RED+"请不要在鉴定过程中取出鉴定物品!!!");
executor.shutdown();
}
}
j.incrementAndGet();
//最后放一个j++
}
}else {
//集合为空就结束
executor.shutdown();
}
},0 , timeRun , TimeUnit.SECONDS);
}else {
int amount = itemStack.getAmount();
clickPlayer.sendMessage(ChatColor.AQUA+"这是"+amount+""+itemName);
}
slot_biomass.setInteract(false);
if(itemStack.getAmount() > 0){
//如果鉴定完产物还有多的放入槽位中 TODO(一般不会出现这种情况)
itemStack.setAmount(amount.intValue());
slot_biomass.setItemStack(itemStack);
}
// touMingGui.close();
gifScreen.close();
slot_biomass.setInteract(true);
}, GermGuiButton.EventType.LEFT_CLICK);
}

View File

@ -4,8 +4,11 @@ import com.germ.germplugin.api.dynamic.gui.GermGuiScreen;
import com.sakurarealm.sritem.germ.GermGuiService;
import lombok.Getter;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.File;
/**
* @BelongsProject: SrAppraise
* @BelongsPackage: com.yuyu.srappraise
@ -23,16 +26,29 @@ public class AppraiseManager {
private AppraiseManager() {
}
public static ConfigurationSection getGermGui(String directoryPath, String guiName) {
if (directoryPath != null && !directoryPath.startsWith(File.separator))
directoryPath = File.separator + directoryPath;
return YamlConfiguration.loadConfiguration(
new File(GermGuiService.germPluginFilePath.getAbsolutePath()
+ File.separator + "gui" + directoryPath + File.separator
+ guiName + ".yml")
).getConfigurationSection(guiName);
}
public static ConfigurationSection getForgePlayerInventory() {
return GermGuiService.getGermGui("appraise", "player_inventory-appraise");
return AppraiseManager.getGermGui( "appraise","player_inventory-appraise");
}
public static ConfigurationSection getAppraiseInventory() {
return GermGuiService.getGermGui("appraise", "appraise");
return AppraiseManager.getGermGui( "appraise","appraise");
}
public static ConfigurationSection getAppraiseGif(){
return GermGuiService.getGermGui("appraise", "appraise_gif");
return AppraiseManager.getGermGui( "appraise","appraise_gif");
}
public static ConfigurationSection getTouMingButton(){
return AppraiseManager.getGermGui( "appraise","touming");
}

View File

@ -0,0 +1,134 @@
package com.yuyu.srappraise.config;
import com.yuyu.srappraise.pojo.AppraiseProduct;
import org.bukkit.ChatColor;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
/**
* @BelongsProject: SrAppraise
* @BelongsPackage: com.yuyu.srappraise.config
* @FileName: ConfigManager
* @Author:
* @Date: 2024/4/23-14:14
* @Version: 1.0
* @Description:用于加载文件
*/
public class ConfigManager {
//用于存放鉴定的物品,根据玩家放入的物品获取名称用于此map集合获取可能得到的物品集合然后随机数判断
private HashMap<String,HashMap<String, AppraiseProduct>> appraiseItemMap;
private Plugin plugin;
public HashMap<String, HashMap<String, AppraiseProduct>> getAppraiseItemMap() {
return appraiseItemMap;
}
public ConfigManager(Plugin plugin) {
Logger logger = plugin.getLogger();
this.plugin = plugin;
HashMap<String,HashMap<String, AppraiseProduct>> hashMapHashMap = new HashMap<>();
//保存文件
plugin.saveResource("AppraiseItem.yml",false);
plugin.saveResource("ItemAppraiseProduct.yml",false);
plugin.saveResource("AppraiseToProduct.yml",false);
File appraiseItemFile = new File(plugin.getDataFolder(), "AppraiseItem.yml");
File ItemAppraiseProduct = new File(plugin.getDataFolder(), "ItemAppraiseProduct.yml");
File AppraiseToProduct = new File(plugin.getDataFolder(), "AppraiseToProduct.yml");
FileConfiguration appraiseItemConfig = YamlConfiguration.loadConfiguration(appraiseItemFile);
FileConfiguration itemAppraiseProduct = YamlConfiguration.loadConfiguration(ItemAppraiseProduct);
FileConfiguration appraiseToProduct = YamlConfiguration.loadConfiguration(AppraiseToProduct);
//获取可以鉴定的物品的列表
List<String> stringList = appraiseItemConfig.getStringList("SrItem.Appraise");
for (String srItem : stringList){//读取到每个可以鉴定的物品
HashMap<String,AppraiseProduct> productMap = new HashMap<>();
//读取该物品可以得到的产物
List<String> productList = appraiseToProduct.getStringList("SrItem." + srItem);
for (String product : productList){
//读取配置文件中的数据
Double proMax = itemAppraiseProduct.getDouble("SrItem."+srItem+"."+product+".probabilityMax");
Double proMin = itemAppraiseProduct.getDouble("SrItem."+srItem+"."+product+".probabilityMin");
String index = itemAppraiseProduct.getString("SrItem."+srItem+"."+product+".index");
AppraiseProduct appraiseProduct = new AppraiseProduct(product, index, proMax, proMin);
logger.info(ChatColor.AQUA+"鉴定物品:"+srItem+"产物:"+ appraiseProduct.toString());
//针对产物存放
productMap.put(product,appraiseProduct);
}
//针对鉴定物品存放
hashMapHashMap.put(srItem,productMap);
}
this.appraiseItemMap = hashMapHashMap;
}
public void reloadConfig(){
appraiseItemMap.clear();
plugin.reloadConfig();
HashMap<String,HashMap<String, AppraiseProduct>> hashMapHashMap = new HashMap<>();
//保存文件
plugin.saveResource("AppraiseItem.yml",false);
plugin.saveResource("ItemAppraiseProduct.yml",false);
plugin.saveResource("AppraiseToProduct.yml",false);
File appraiseItemFile = new File(plugin.getDataFolder(), "AppraiseItem.yml");
File ItemAppraiseProduct = new File(plugin.getDataFolder(), "ItemAppraiseProduct.yml");
File AppraiseToProduct = new File(plugin.getDataFolder(), "AppraiseToProduct.yml");
FileConfiguration appraiseItemConfig = YamlConfiguration.loadConfiguration(appraiseItemFile);
FileConfiguration itemAppraiseProduct = YamlConfiguration.loadConfiguration(ItemAppraiseProduct);
FileConfiguration appraiseToProduct = YamlConfiguration.loadConfiguration(AppraiseToProduct);
//获取可以鉴定的物品的列表
List<String> stringList = appraiseItemConfig.getStringList("SrItem.Appraise");
for (String srItem : stringList){//读取到每个可以鉴定的物品
HashMap<String,AppraiseProduct> productMap = new HashMap<>();
//读取该物品可以得到的产物
List<String> productList = appraiseToProduct.getStringList("SrItem." + srItem);
for (String product : productList){
//读取配置文件中的数据
Double proMax = itemAppraiseProduct.getDouble("SrItem."+srItem+"."+product+".probabilityMax");
Double proMin = itemAppraiseProduct.getDouble("SrItem."+srItem+"."+product+".probabilityMin");
String index = itemAppraiseProduct.getString("SrItem."+srItem+"."+product+".index");
AppraiseProduct appraiseProduct = new AppraiseProduct(product, index, proMax, proMin);
this.plugin.getLogger().info(ChatColor.AQUA+"鉴定物品:"+srItem+"产物:"+ appraiseProduct.toString());
//针对产物存放
productMap.put(product,appraiseProduct);
}
//针对鉴定物品存放
hashMapHashMap.put(srItem,productMap);
}
this.appraiseItemMap = hashMapHashMap;
}
}

View File

@ -0,0 +1,67 @@
package com.yuyu.srappraise.pojo;
import com.sakurarealm.sritem.api.SrItemAPI;
import org.bukkit.inventory.ItemStack;
import java.util.HashMap;
/**
* @BelongsProject: SrAppraise
* @BelongsPackage: com.yuyu.srappraise.pojo
* @FileName: AppraiseProduct
* @Author:
* @Date: 2024/4/23-14:09
* @Version: 1.0
* @Description: 鉴定的产物
*/
public class AppraiseProduct {
//物品的名称
private final String ItemName;
//物品的索引
private final String indexName;
//最大的概率
private final double ProMax;
//最小的概率
private final double ProMin;
//获取ItemStack
private final ItemStack itemStack;
public String getItemName() {
return ItemName;
}
public String getIndexName() {
return indexName;
}
public double getProMax() {
return ProMax;
}
public double getProMin() {
return ProMin;
}
public AppraiseProduct(String itemName, String indexName, double proMax, double proMin) {
ItemName = itemName;
this.indexName = indexName;
ProMax = proMax;
ProMin = proMin;
this.itemStack = SrItemAPI.getItem(indexName,new HashMap<>(),null,true,true);
}
public ItemStack getItemStack() {
return itemStack;
}
@Override
public String toString() {
return "AppraiseProduct{" +
"ItemName='" + ItemName + '\'' +
", indexName='" + indexName + '\'' +
", ProMax=" + ProMax +
", ProMin=" + ProMin +
", itemStack=" + itemStack +
'}';
}
}

View File

@ -0,0 +1,4 @@
SrItem: #这里填每个可以刷新的物品对于的产物
巴尔伐楼伽的怨牙:
- 环齿原胚
- 保密试作品HC-03原胚