本文整理汇总了Java中org.bukkit.event.inventory.FurnaceSmeltEvent类的典型用法代码示例。如果您正苦于以下问题:Java FurnaceSmeltEvent类的具体用法?Java FurnaceSmeltEvent怎么用?Java FurnaceSmeltEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FurnaceSmeltEvent类属于org.bukkit.event.inventory包,在下文中一共展示了FurnaceSmeltEvent类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onSmelt
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
public void onSmelt(FurnaceSmeltEvent e)
{
if(BlockStorage.check(e.getBlock()) != null && (BlockStorage.check(e.getBlock()) instanceof EnhancedFurnace))
{
EnhancedFurnace furnace = (EnhancedFurnace)BlockStorage.check(e.getBlock());
Furnace f = (Furnace)e.getBlock().getState();
int amount = f.getInventory().getSmelting().getType().toString().endsWith("_ORE") ? furnace.getOutput() : 1;
ItemStack output = RecipeCalculator.getSmeltedOutput(f.getInventory().getSmelting().getType());
ItemStack result = f.getInventory().getResult();
if(result != null)
result = result.clone();
f.getInventory().setResult(null);
if(result != null)
f.getInventory().setResult(new CustomItem(result, result.getAmount() + amount <= result.getMaxStackSize() ? result.getAmount() + amount : result.getMaxStackSize()));
else
f.getInventory().setResult(new CustomItem(output, output.getAmount() + amount <= output.getType().getMaxStackSize() ? output.getAmount() + amount : output.getType().getMaxStackSize()));
}
}
开发者ID:StarWishsama,项目名称:Slimefun4-Chinese-Version,代码行数:19,代码来源:FurnaceListener.java
示例2: onFurnaceSmelt
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
/**
* Handles the action of smelting all items at once, exploding the furnace, and dropping the smelted items on the
* ground.
*
* @param event The event
*/
@EventHandler(ignoreCancelled = true)
public void onFurnaceSmelt(FurnaceSmeltEvent event) {
ItemStack resultItem = event.getResult();
final Material result = resultItem.getType();
//TODO: Verify that the "smelting amount" contains any extra ingredients
final int amount = ((Furnace) event.getBlock().getState()).getInventory().getSmelting().getAmount();
event.getSource().setType(Material.AIR);
resultItem.setType(Material.AIR);
Block block = event.getBlock();
block.setType(Material.AIR);
Location location = block.getLocation().add(0.5, 0.5, 0.5);
World world = location.getWorld();
world.createExplosion(location, 7);
world.dropItem(location, new ItemStack(result, amount));
}
开发者ID:twizmwazin,项目名称:OpenUHC,代码行数:24,代码来源:Overcook.java
示例3: get
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@Override
protected Slot[] get(final Event e, final Block[] source) {
return get(source, new Getter<Slot, Block>() {
@SuppressWarnings("null")
@Override
@Nullable
public Slot get(final Block b) {
if (b.getType() != Material.FURNACE && b.getType() != Material.BURNING_FURNACE)
return null;
if (getTime() >= 0 && (e instanceof FurnaceSmeltEvent && b.equals(((FurnaceSmeltEvent) e).getBlock()) || e instanceof FurnaceBurnEvent && b.equals(((FurnaceBurnEvent) e).getBlock())) && !Delay.isDelayed(e)) {
return new FurnaceEventSlot(e, ((Furnace) b.getState()).getInventory());
} else {
return new InventorySlot(((Furnace) b.getState()).getInventory(), slot);
}
}
});
}
开发者ID:nfell2009,项目名称:Skript,代码行数:18,代码来源:ExprFurnaceSlot.java
示例4: onFurnaceSmelt
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler(ignoreCancelled = false)
public void onFurnaceSmelt(cn.nukkit.event.inventory.FurnaceSmeltEvent event) {
if (canIgnore(FurnaceSmeltEvent.getHandlerList())) {
return;
}
Block furnace = PokkitBlock.toBukkit(event.getBlock());
ItemStack source = PokkitItemStack.toBukkitCopy(event.getSource());
ItemStack result = PokkitItemStack.toBukkitCopy(event.getResult());
FurnaceSmeltEvent bukkitEvent = new FurnaceSmeltEvent(furnace, source, result);
callCancellable(event, bukkitEvent);
PokkitItemStack.overwriteNukkit(bukkitEvent.getSource(), event.getSource());
PokkitItemStack.overwriteNukkit(bukkitEvent.getResult(), event.getResult());
}
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:17,代码来源:InventoryEvents.java
示例5: onFurnaceSmeltEvent
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
Block furnaceBlock = event.getBlock();
ItemStack smelting = event.getSource();
if (!ItemUtils.isSmeltable(smelting)) {
return;
}
Player player = getPlayerFromFurnace(furnaceBlock);
if (!UserManager.hasPlayerDataKey(player) || !SkillType.SMELTING.getPermissions(player)) {
return;
}
event.setResult(UserManager.getPlayer(player).getSmeltingManager().smeltProcessing(smelting, event.getResult()));
}
开发者ID:Pershonkey,项目名称:McMMOPlus,代码行数:18,代码来源:InventoryListener.java
示例6: onEvent
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
private void onEvent(FurnaceSmeltEvent event) {
for (PlayerModel model : DGData.PLAYER_R.fromAspect(Aspects.CRAFTING_ASPECT_I)) {
try {
if (model.getOnline() && model.getLocation().getWorld().equals(event.getBlock().getWorld()) &&
model.getLocation().distance(event.getBlock().getLocation()) <
(int) Math.round(20 * Math.pow(model.getExperience(Aspects.CRAFTING_ASPECT_I), 0.15))) {
int amount = event.getResult().getAmount() * 2;
ItemStack out = event.getResult();
out.setAmount(amount);
event.setResult(out);
}
} catch (Exception oops) {
oops.printStackTrace();
}
}
}
开发者ID:DemigodsRPG,项目名称:DemigodsRPG,代码行数:18,代码来源:AbilityListener.java
示例7: onFurnaceSmelt
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onFurnaceSmelt(FurnaceSmeltEvent event) {
final List<FXRecipe> recipes = registry.get().getRecipes(event.getResult());
// Check custom items not used in non-plugin recipes
if (recipes.isEmpty()) {
if (registry.get().getDefinition(event.getSource()).isPresent()) {
event.setCancelled(true);
}
}
// Check if valid furnace recipe
else if (!recipes.stream().filter(r -> r instanceof FXFurnaceRecipe)
.map(r -> (FXFurnaceRecipe) r)
// Check input matches the recipe
.filter(r -> registry.get().isSimilar(r.getInput(), event.getSource()))
.findAny().isPresent()) {
event.setCancelled(true);
}
}
开发者ID:t7seven7t,项目名称:CraftFX,代码行数:19,代码来源:RecipeListener.java
示例8: OnFurnaceSmelt
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler
public void OnFurnaceSmelt(FurnaceSmeltEvent event){
if(!EpicSystem.furnaceList.containsKey(event.getBlock().getLocation())) return;
EpicPlayer epicPlayer = EpicSystem.furnaceList.get(event.getBlock().getLocation());
List<EpicQuestTask> taskList = epicPlayer.getTasksByType(TaskTypes.SMELT_ITEM);
for(EpicQuestTask task : taskList){
Material itemID = event.getSource().getType();
Material itemNeeded = Material.matchMaterial(task.getTaskID());
if(itemID == itemNeeded){
task.ProgressTask(1, epicPlayer, true);
}
}
}
开发者ID:Randehh,项目名称:EpicQuest,代码行数:17,代码来源:TypeSmelt.java
示例9: setItem
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@SuppressWarnings("synthetic-access")
@Override
public void setItem(final @Nullable ItemStack item) {
if (e instanceof FurnaceSmeltEvent) {
if (slot == RESULT && getTime() >= 0) {
if (item == null || item.getType() == Material.AIR) { // null/air crashes the server on account of a NPE if using event.setResult(...)
Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() {
@Override
public void run() {
FurnaceEventSlot.super.setItem(null);
}
});
} else {
((FurnaceSmeltEvent) e).setResult(item);
}
} else if (slot == ORE && getTime() >= 0) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() {
@Override
public void run() {
FurnaceEventSlot.super.setItem(item);
}
});
} else {
super.setItem(item);
}
} else {
if (slot == FUEL && getTime() >= 0) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Skript.getInstance(), new Runnable() {
@Override
public void run() {
FurnaceEventSlot.super.setItem(item);
}
});
} else {
super.setItem(item);
}
}
}
开发者ID:nfell2009,项目名称:Skript,代码行数:39,代码来源:ExprFurnaceSlot.java
示例10: burn
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
public void burn() {
if (this.canBurn()) {
ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);
// CraftBukkit start - fire FurnaceSmeltEvent
CraftItemStack source = CraftItemStack.asCraftMirror(this.items[0]);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack);
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), source, result);
this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
if (furnaceSmeltEvent.isCancelled()) {
return;
}
result = furnaceSmeltEvent.getResult();
itemstack = CraftItemStack.asNMSCopy(result);
if (itemstack != null) {
if (this.items[2] == null) {
this.items[2] = itemstack;
} else if (CraftItemStack.asCraftMirror(this.items[2]).isSimilar(result)) {
this.items[2].count += itemstack.count;
} else {
return;
}
}
// CraftBukkit end
--this.items[0].count;
if (this.items[0].count <= 0) {
this.items[0] = null;
}
}
}
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:36,代码来源:TileEntityFurnace.java
示例11: onSmelt
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onSmelt(FurnaceSmeltEvent e) {
if (BlockStorage.check(e.getBlock()) != null && BlockStorage.check(e.getBlock()) instanceof EnhancedFurnace) {
EnhancedFurnace furnace = (EnhancedFurnace) BlockStorage.check(e.getBlock());
Furnace f = (Furnace) e.getBlock().getState();
int amount = f.getInventory().getSmelting().getType().toString().endsWith("_ORE") ? furnace.getOutput(): 1;
ItemStack output = RecipeCalculator.getSmeltedOutput(f.getInventory().getSmelting().getType());
ItemStack result = f.getInventory().getResult();
if (result != null) result = result.clone();
f.getInventory().setResult(null);
if (result != null) f.getInventory().setResult(new CustomItem(result, result.getAmount() + amount > result.getMaxStackSize() ? result.getMaxStackSize(): result.getAmount() + amount));
else f.getInventory().setResult(new CustomItem(output, output.getAmount() + amount > output.getType().getMaxStackSize() ? output.getType().getMaxStackSize(): output.getAmount() + amount));
}
}
开发者ID:TheBusyBiscuit,项目名称:Slimefun4,代码行数:15,代码来源:FurnaceListener.java
示例12: burn
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
public void burn() {
if (this.canBurn()) {
ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0].getItem().id);
// CraftBukkit start
CraftItemStack source = CraftItemStack.asCraftMirror(this.items[0]);
CraftItemStack result = CraftItemStack.asCraftMirror(itemstack.cloneItemStack());
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(this.x, this.y, this.z), source, result);
this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
if (furnaceSmeltEvent.isCancelled()) {
return;
}
itemstack = CraftItemStack.asNMSCopy(furnaceSmeltEvent.getResult());
if (this.items[2] == null) {
this.items[2] = itemstack.cloneItemStack();
} else if (this.items[2].id == itemstack.id) {
// CraftBukkit - compare damage too
if (this.items[2].getData() == itemstack.getData()) {
this.items[2].count += itemstack.count;
}
// CraftBukkit end
}
--this.items[0].count;
if (this.items[0].count <= 0) {
this.items[0] = null;
}
}
}
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:34,代码来源:TileEntityFurnace.java
示例13: smeltFast
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler
public void smeltFast(FurnaceSmeltEvent e) {
if (!(e.getBlock().getState() instanceof Furnace)) return;
Furnace f = (Furnace) e.getBlock().getState();
if (!RUtils.isInInfectedWorld(f.getLocation())) return;
ConfManager cm = ConfManager.getConfManager("otherdata.yml");
Location l = f.getLocation();
String path = "furnaces." + l.getWorld().getName() + "," + l.getBlockX() + "," + l.getBlockY() + "," + l.getBlockZ();
if (!cm.getBoolean(path, false)) return;
f.setCookTime((short) 140); // 7 seconds in = 3 seconds left
}
开发者ID:RoyalDev,项目名称:RoyalSurvivors,代码行数:12,代码来源:SurvivorsListener.java
示例14: setTime
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean setTime(final int time) {
return super.setTime(time, getExpr(), FurnaceSmeltEvent.class, FurnaceBurnEvent.class);
}
开发者ID:nfell2009,项目名称:Skript,代码行数:6,代码来源:ExprFurnaceSlot.java
示例15: onItemSmelt
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler
public void onItemSmelt(FurnaceSmeltEvent e) {
if (e.getBlock().getLocation().equals(furnace.getLocation())) {
e.setCancelled(true);
}
}
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:7,代码来源:CookingGui.java
示例16: smeltItem
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
public void smeltItem()
{
if (this.canSmelt())
{
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
// CraftBukkit start
CraftItemStack source = CraftItemStack.asCraftMirror(this.furnaceItemStacks[0]);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack);
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.worldObj.getWorld().getBlockAt(this.xCoord, this.yCoord, this.zCoord), source, result);
this.worldObj.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
if (furnaceSmeltEvent.isCancelled())
{
return;
}
result = furnaceSmeltEvent.getResult();
itemstack = CraftItemStack.asNMSCopy(result);
if (itemstack != null)
{
if (this.furnaceItemStacks[2] == null)
{
this.furnaceItemStacks[2] = itemstack;
}
else if (CraftItemStack.asCraftMirror(this.furnaceItemStacks[2]).isSimilar(result))
{
this.furnaceItemStacks[2].stackSize += itemstack.stackSize;
}
else
{
return;
}
}
// CraftBukkit end
--this.furnaceItemStacks[0].stackSize;
if (this.furnaceItemStacks[0].stackSize <= 0)
{
this.furnaceItemStacks[0] = null;
}
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:45,代码来源:TileEntityFurnace.java
示例17: onSmeltItem
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
@EventHandler
public void onSmeltItem(FurnaceSmeltEvent event) {
Config.getStringList("Global Settings.Unsmeltable Items").stream().filter((s) -> (event.getResult().getType().equals(Material.getMaterial(s)))).forEach((_item) -> {
event.setCancelled(true);
});
}
开发者ID:N1T3SLAY3R,项目名称:Empirecraft,代码行数:7,代码来源:OnSmeltItem.java
示例18: burn
import org.bukkit.event.inventory.FurnaceSmeltEvent; //导入依赖的package包/类
public void burn() {
if (this.canBurn()) {
ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]);
// CraftBukkit start - fire FurnaceSmeltEvent
CraftItemStack source = CraftItemStack.asCraftMirror(this.items[0]);
org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack);
FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), source, result);
this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent);
if (furnaceSmeltEvent.isCancelled()) {
return;
}
result = furnaceSmeltEvent.getResult();
itemstack = CraftItemStack.asNMSCopy(result);
if (itemstack != null) {
if (this.items[2] == null) {
this.items[2] = itemstack;
} else if (CraftItemStack.asCraftMirror(this.items[2]).isSimilar(result)) {
this.items[2].count += itemstack.count;
} else {
return;
}
}
/*
if (this.items[2] == null) {
this.items[2] = itemstack.cloneItemStack();
} else if (this.items[2].getItem() == itemstack.getItem()) {
++this.items[2].count;
}
*/
// CraftBukkit end
if (this.items[0].getItem() == Item.getItemOf(Blocks.SPONGE) && this.items[0].getData() == 1 && this.items[1] != null && this.items[1].getItem() == Items.BUCKET) {
this.items[1] = new ItemStack(Items.WATER_BUCKET);
}
--this.items[0].count;
if (this.items[0].count <= 0) {
this.items[0] = null;
}
}
}
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:49,代码来源:TileEntityFurnace.java
注:本文中的org.bukkit.event.inventory.FurnaceSmeltEvent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论