本文整理汇总了Java中me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem类的典型用法代码示例。如果您正苦于以下问题:Java SlimefunItem类的具体用法?Java SlimefunItem怎么用?Java SlimefunItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SlimefunItem类属于me.mrCookieSlime.Slimefun.Objects.SlimefunItem包,在下文中一共展示了SlimefunItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
@Override
public void register(boolean slimefun) {
addItemHandler(new BlockTicker() {
@Override
public void tick(Block b, SlimefunItem sf, Config data) {
AContainer.this.tick(b);
}
@Override
public void uniqueTick() {
}
@Override
public boolean isSynchronized() {
return false;
}
});
super.register(slimefun);
}
示例2: register
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
@Override
public void register(boolean slimefun) {
addItemHandler(new BlockTicker() {
@Override
public void tick(Block b, SlimefunItem sf, Config data) {
AutomatedCraftingChamber.this.tick(b);
}
@Override
public void uniqueTick() {
}
@Override
public boolean isSynchronized() {
return false;
}
});
super.register(slimefun);
}
示例3: register
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
public void register()
{
SlimefunStartup.getResearchCfg().setDefaultValue("enable-researching", Boolean.valueOf(true));
if(SlimefunStartup.getResearchCfg().contains((new StringBuilder(String.valueOf(getID()))).append(".enabled").toString()) && !SlimefunStartup.getResearchCfg().getBoolean((new StringBuilder(String.valueOf(getID()))).append(".enabled").toString()))
{
for(Iterator iterator = items.iterator(); iterator.hasNext(); iterator.remove())
{
SlimefunItem item = (SlimefunItem)iterator.next();
if(item != null)
item.bindToResearch(null);
}
return;
}
SlimefunStartup.getResearchCfg().setDefaultValue((new StringBuilder(String.valueOf(getID()))).append(".name").toString(), getName());
SlimefunStartup.getResearchCfg().setDefaultValue((new StringBuilder(String.valueOf(getID()))).append(".cost").toString(), Integer.valueOf(getCost()));
SlimefunStartup.getResearchCfg().setDefaultValue((new StringBuilder(String.valueOf(getID()))).append(".enabled").toString(), Boolean.valueOf(true));
name = SlimefunStartup.getResearchCfg().getString((new StringBuilder(String.valueOf(getID()))).append(".name").toString());
cost = SlimefunStartup.getResearchCfg().getInt((new StringBuilder(String.valueOf(getID()))).append(".cost").toString());
list.add(this);
if(SlimefunStartup.getCfg().getBoolean("options.print-out-loading"))
System.out.println((new StringBuilder("[Slimefun] Loaded Research \"")).append(getName()).append("\"").toString());
}
示例4: hasUnlocked
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
public boolean hasUnlocked(Player p)
{
for(Iterator iterator = parents.iterator(); iterator.hasNext();)
{
Category category = (Category)iterator.next();
for(Iterator iterator1 = category.getItems().iterator(); iterator1.hasNext();)
{
SlimefunItem item = (SlimefunItem)iterator1.next();
if(Slimefun.isEnabled(p, item.getItem(), false) && Slimefun.hasPermission(p, item, false) && item.getResearch() != null && !item.getResearch().hasUnlocked(p))
return false;
}
}
return true;
}
示例5: refreshCache
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
private static void refreshCache(BlockStorage storage, Location l, String key, String value, boolean updateTicker) {
Config cfg = storage.cache_blocks.containsKey(key) ? storage.cache_blocks.get(key): new Config(path_blocks + l.getWorld().getName() + "/" + key + ".sfb");
cfg.setValue(serializeLocation(l), value);
storage.cache_blocks.put(key, cfg);
if (updateTicker) {
SlimefunItem item = SlimefunItem.getByID(key);
if (item != null && item.isTicking()) {
Chunk chunk = l.getChunk();
if (value != null) {
Set<Block> blocks = ticking_chunks.containsKey(chunk.toString()) ? ticking_chunks.get(chunk.toString()): new HashSet<Block>();
blocks.add(l.getBlock());
ticking_chunks.put(chunk.toString(), blocks);
if (!loaded_tickers.contains(chunk.toString())) loaded_tickers.add(chunk.toString());
}
}
}
}
示例6: hasUnlocked
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
public static boolean hasUnlocked(Player p, SlimefunItem sfItem, boolean message)
{
if(isEnabled(p, sfItem, message) && hasPermission(p, sfItem, message))
{
if(sfItem.getResearch() == null)
return true;
if(sfItem.getResearch().hasUnlocked(p))
return true;
if(message && !(sfItem instanceof VanillaItem))
Messages.local.sendTranslation(p, "messages.not-researched", true, new Variable[0]);
return false;
} else
{
return false;
}
}
示例7: isEnabled
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
public static boolean isEnabled(Player p, ItemStack item, boolean message)
{
String world = p.getWorld().getName();
SlimefunItem sfItem = SlimefunItem.getByItem(item);
if(sfItem == null)
return !SlimefunItem.isDisabled(item);
if(SlimefunStartup.getWhitelist().contains((new StringBuilder(String.valueOf(world))).append(".enabled").toString()))
{
if(SlimefunStartup.getWhitelist().getBoolean((new StringBuilder(String.valueOf(world))).append(".enabled").toString()))
{
if(!SlimefunStartup.getWhitelist().contains((new StringBuilder(String.valueOf(world))).append(".enabled-items.").append(sfItem.getName()).toString()))
SlimefunStartup.getWhitelist().setDefaultValue((new StringBuilder(String.valueOf(world))).append(".enabled-items.").append(sfItem.getName()).toString(), Boolean.valueOf(true));
if(SlimefunStartup.getWhitelist().getBoolean((new StringBuilder(String.valueOf(world))).append(".enabled-items.").append(sfItem.getName()).toString()))
return true;
if(message)
Messages.local.sendTranslation(p, "messages.disabled-in-world", true, new Variable[0]);
return false;
}
if(message)
Messages.local.sendTranslation(p, "messages.disabled-in-world", true, new Variable[0]);
return false;
} else
{
return true;
}
}
示例8: onBlockRegister
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockRegister(BlockPlaceEvent e) {
if (BlockStorage.hasBlockInfo(e.getBlock())) {
e.setCancelled(true);
return;
}
ItemStack item = e.getItemInHand();
if (item != null && item.getType() == Material.INK_SACK) return;
SlimefunItem sfItem = SlimefunItem.getByItem(item);
if (sfItem != null && !(sfItem instanceof NotPlaceable)){
BlockStorage.addBlockInfo(e.getBlock(), "id", sfItem.getID(), true);
if (SlimefunItem.blockhandler.containsKey(sfItem.getID())) {
SlimefunItem.blockhandler.get(sfItem.getID()).onPlace(e.getPlayer(), e.getBlock(), sfItem);
}
}
else {
for (ItemHandler handler: SlimefunItem.getHandlers("BlockPlaceHandler")) {
if (((BlockPlaceHandler) handler).onBlockPlace(e, item)) break;
}
}
}
示例9: onEntityExplode
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onEntityExplode(EntityExplodeEvent e) {
Iterator<Block> blocks = e.blockList().iterator();
while (blocks.hasNext()) {
Block block = blocks.next();
SlimefunItem item = BlockStorage.check(block);
if (item != null) {
blocks.remove();
if (!item.getID().equalsIgnoreCase("HARDENED_GLASS") && !item.getID().equalsIgnoreCase("WITHER_PROOF_OBSIDIAN") && !item.getID().equalsIgnoreCase("WITHER_PROOF_GLASS") && !item.getID().equalsIgnoreCase("FORCEFIELD_PROJECTOR") && !item.getID().equalsIgnoreCase("FORCEFIELD_RELAY")) {
boolean success = true;
if (SlimefunItem.blockhandler.containsKey(item.getID())) {
success = SlimefunItem.blockhandler.get(item.getID()).onBreak(null, block, item, UnregisterReason.EXPLODE);
}
if (success) {
BlockStorage.clearBlockInfo(block);
block.setType(Material.AIR);
}
}
}
}
}
示例10: onBlockBreak
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
/**
*
* @param e BlockBreakEvent
* @since 4.2.0
*/
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
List<ItemStack> drops = new ArrayList<ItemStack>();
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
int fortune = 1;
if (item != null) {
if (item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS) && !item.getEnchantments().containsKey(Enchantment.SILK_TOUCH)) {
fortune = SlimefunStartup.randomize(item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) + 2) - 1;
if (fortune <= 0) fortune = 1;
fortune = (e.getBlock().getType() == Material.LAPIS_ORE ? 4 + SlimefunStartup.randomize(5) : 1) * (fortune + 1);
}
if (!item.getEnchantments().containsKey(Enchantment.SILK_TOUCH) && e.getBlock().getType().toString().endsWith("_ORE")) {
if (Talisman.checkFor(e, SlimefunItem.getByID("MINER_TALISMAN"))) {
if (drops.isEmpty()) drops = (List<ItemStack>) e.getBlock().getDrops();
for (ItemStack drop : new ArrayList<ItemStack>(drops)) {
if (!drop.getType().isBlock()) drops.add(new CustomItem(drop, fortune * 2));
}
}
}
}
}
示例11: onEntityChangeBlock
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
@EventHandler(priority=EventPriority.LOWEST)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
if (e.getEntity() instanceof FallingBlock) {
if (Variables.blocks.contains(e.getEntity().getUniqueId())) {
e.setCancelled(true);
e.getEntity().remove();
}
}
else if (e.getEntity() instanceof Wither) {
SlimefunItem item = BlockStorage.check(e.getBlock());
if (item != null) {
if (item.getName().equals("WITHER_PROOF_OBSIDIAN")) e.setCancelled(true);
if (item.getName().equals("WITHER_PROOF_GLASS")) e.setCancelled(true);
}
}
}
示例12: onArrowSuccessfulHit
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
public void onArrowSuccessfulHit(EntityDamageByEntityEvent e)
{
if(e.getDamager() instanceof Arrow)
{
if(Variables.arrows.containsKey(e.getDamager().getUniqueId()) && (e.getEntity() instanceof LivingEntity))
{
for(Iterator iterator = SlimefunItem.getHandlers("BowShootHandler").iterator(); iterator.hasNext();)
{
ItemHandler handler = (ItemHandler)iterator.next();
if(((BowShootHandler)handler).onHit(e, (LivingEntity)e.getEntity()))
break;
}
Variables.arrows.remove(e.getDamager().getUniqueId());
}
handleGrapplingHook((Arrow)e.getDamager());
}
}
示例13: dropFruitFromTree
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
public void dropFruitFromTree(Block block) {
for (int x = -1; x < 2; x++) {
for (int y = -1; y < 2; y++) {
for (int z = -1; z < 2; z++) { //inspect a cube at the reference
Block drop = block.getRelative(x, y, z);
SlimefunItem check = BlockStorage.check(drop);
if (check != null) {
for (Tree tree: ExoticGarden.trees) {
if (check.getName().equalsIgnoreCase(tree.fruit)) {
BlockStorage.clearBlockInfo(drop);
ItemStack fruits = check.getItem();
drop.getWorld().playEffect(drop.getLocation(), Effect.STEP_SOUND, Material.LEAVES);
drop.getWorld().dropItemNaturally(drop.getLocation(), fruits);
drop.setType(Material.AIR);
}
}
}
}
}
}
}
示例14: registerMagicalPlant
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
public void registerMagicalPlant(String name, ItemStack item, String skull, ItemStack[] recipe) {
ItemStack essence = new CustomItem(new MaterialData(Material.BLAZE_POWDER), "&rMagical Essence", "", "�7" + name);
Berry berry = new Berry(essence, name.toUpperCase() + "_ESSENCE", PlantType.ORE_PLANT, new PlantData(skull));
berries.add(berry);
new SlimefunItem(category_magic, new CustomItem(Material.SAPLING, "&r" + name + " Plant", 0), name.toUpperCase().replace(" ", "_") + "_PLANT", RecipeType.ENHANCED_CRAFTING_TABLE,
recipe)
.register();
HandledBlock plant = new HandledBlock(category_magic, essence, name.toUpperCase().replace(" ", "_") + "_ESSENCE", RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {essence, essence, essence, essence, null, essence, essence, essence, essence});
plant.setRecipeOutput(item.clone());
plant.register();
}
示例15: register
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem; //导入依赖的package包/类
@Override
public void register(boolean slimefun) {
addItemHandler(new BlockTicker() {
@Override
public void tick(Block b, SlimefunItem sf, Config data) {
AFarm.this.tick(b);
}
@Override
public void uniqueTick() {
}
@Override
public boolean isSynchronized() {
return true;
}
});
super.register(slimefun);
}