Skip to content

Commit

Permalink
fix :progress
Browse files Browse the repository at this point in the history
  • Loading branch information
m1919810 committed Oct 6, 2024
1 parent 749117e commit d38b15e
Show file tree
Hide file tree
Showing 19 changed files with 6,522 additions and 6,013 deletions.
103 changes: 60 additions & 43 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static void registerListeners(Plugin plugin,PluginManager manager){
register(VANILLACRAFT_ALLOW);
register(ENTITYFEAT_LISTENER);
register(LASER_ON_HEAD_LISTENER);
register(SUPERSPONGE_DRY_LISTENER);
}
public static Plugin plugin;
public static PluginManager manager;
Expand All @@ -40,4 +41,5 @@ public static void register(Listener listener){
public static final Listener VANILLACRAFT_ALLOW=new CraftingListener();
public static final Listener ENTITYFEAT_LISTENER=new SpawnerListener();
public static final Listener LASER_ON_HEAD_LISTENER=new LaserGunOnHeadListener();
public static final Listener SUPERSPONGE_DRY_LISTENER=new SuperSpongeDryListener();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package me.matl114.logitech.Listeners.Listeners;

import me.matl114.logitech.SlimefunItem.AddItem;
import me.matl114.logitech.Utils.CraftUtils;
import me.matl114.logitech.Utils.Debug;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.Container;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Furnace;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.inventory.FurnaceInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;

public class SuperSpongeDryListener implements Listener {
@EventHandler
public void onFurnaceDryFinish(FurnaceSmeltEvent event){
ItemStack stack=event.getSource();
if(stack.getType()== Material.WET_SPONGE&& CraftUtils.matchItemStack(stack,AddItem.SUPERSPONGE_USED,false)){
Block block=event.getBlock();
BlockState blockData=block.getState();
if(blockData instanceof Container ih){
Inventory inventory=ih.getInventory();
if(inventory instanceof FurnaceInventory fi){
ItemStack fuelSlot=fi.getFuel();
ItemStack outputSlot=fi.getResult();
if(outputSlot==null||outputSlot.getType()==Material.AIR){
//槽位是空的,直接输入该输出就行
event.setResult(AddItem.SUPERSPONGE.clone());
if(fuelSlot!=null&&fuelSlot.getType()== Material.BUCKET){
//燃料修改
fuelSlot.setType(Material.POWDER_SNOW_BUCKET);
}
}
else if( CraftUtils.matchItemStack(outputSlot,AddItem.SUPERSPONGE,false)){
//由于bukkit特性,需要我们自己设置数量
ItemStack source=fi.getSmelting();
if(CraftUtils.matchItemStack(source,AddItem.SUPERSPONGE_USED,false)){
outputSlot.setAmount(outputSlot.getAmount()+1);
source.setAmount(source.getAmount()-1);
if(fuelSlot!=null&&fuelSlot.getType()== Material.BUCKET){
//燃料修改
fuelSlot.setType(Material.POWDER_SNOW_BUCKET);
}
event.setCancelled(true);
}
}
}
}
}
}

}
9 changes: 4 additions & 5 deletions src/main/java/me/matl114/logitech/MyAddon.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
import me.matl114.logitech.SlimefunItem.AddSlimefunItems;
import me.matl114.logitech.SlimefunItem.Blocks.MultiBlockTypes;
import me.matl114.logitech.SlimefunItem.Cargo.Storages;
import me.matl114.logitech.Utils.BukkitUtils;
import me.matl114.logitech.Utils.CraftUtils;
import me.matl114.logitech.Utils.DataCache;
import me.matl114.logitech.Utils.Debug;
import me.matl114.logitech.Utils.*;
import me.matl114.logitech.Utils.UtilClass.MultiBlockClass.MultiBlockService;
import net.guizhanss.guizhanlibplugin.updater.GuizhanUpdater;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -106,7 +103,9 @@ public void onEnable() {
RadiationRegion.setup();
//加载配方工具
CraftUtils.setup();
//加载原版工作台注入
//加载世界操作工具
WorldUtils.setup();
//加载Bukkit操作工具
BukkitUtils.setup();
Debug.logger("指令注册完毕");
command.register();
Expand Down
Loading

0 comments on commit d38b15e

Please sign in to comment.