本文整理汇总了Java中net.minecraftforge.event.AnvilUpdateEvent.getCost方法的典型用法代码示例。如果您正苦于以下问题:Java AnvilUpdateEvent.getCost方法的具体用法?Java AnvilUpdateEvent.getCost怎么用?Java AnvilUpdateEvent.getCost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.event.AnvilUpdateEvent
的用法示例。
在下文中一共展示了AnvilUpdateEvent.getCost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAnvilChange
import net.minecraftforge.event.AnvilUpdateEvent; //导入方法依赖的package包/类
public static boolean onAnvilChange(ContainerRepair container, ItemStack left, ItemStack right, IInventory outputSlot, String name, int baseCost)
{
AnvilUpdateEvent e = new AnvilUpdateEvent(left, right, name, baseCost);
if (MinecraftForge.EVENT_BUS.post(e)) return false;
if (e.getOutput() == null) return true;
outputSlot.setInventorySlotContents(0, e.getOutput());
container.maximumCost = e.getCost();
container.materialCost = e.getMaterialCost();
return false;
}
示例2: onAnvilChange
import net.minecraftforge.event.AnvilUpdateEvent; //导入方法依赖的package包/类
private boolean onAnvilChange(@Nonnull ItemStack inputItem, @Nonnull ItemStack modifierItem, String itemName, int baseCost) {
AnvilUpdateEvent e = new AnvilUpdateEvent(inputItem, modifierItem, itemName, baseCost);
if (MinecraftForge.EVENT_BUS.post(e)) return false;
if (!e.getOutput().isEmpty()) {
this.outputStack = e.getOutput();
this.maximumCost = e.getCost();
this.materialCost = e.getMaterialCost();
return false;
}
return true;
}
示例3: onAnvil
import net.minecraftforge.event.AnvilUpdateEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onAnvil(AnvilUpdateEvent event){
AnvilRecipe eventIn = new AnvilRecipe(event.getLeft(), event.getRight(), event.getOutput(), event.getCost(), false);
for(AnvilRecipe recipe : AnvilRecipes.getRecipes()){
if(eventIn.equals(recipe)){
event.setCost(recipe.getCost());
event.setOutput(recipe.getOutput().copy());
return;
}
}
}