本文整理汇总了Java中net.minecraft.village.MerchantRecipe.isRecipeDisabled方法的典型用法代码示例。如果您正苦于以下问题:Java MerchantRecipe.isRecipeDisabled方法的具体用法?Java MerchantRecipe.isRecipeDisabled怎么用?Java MerchantRecipe.isRecipeDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.village.MerchantRecipe
的用法示例。
在下文中一共展示了MerchantRecipe.isRecipeDisabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: func_146976_a
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
protected void func_146976_a(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(field_147038_v);
int var4 = (this.width - this.field_146999_f) / 2;
int var5 = (this.height - this.field_147000_g) / 2;
this.drawTexturedModalRect(var4, var5, 0, 0, this.field_146999_f, this.field_147000_g);
MerchantRecipeList var6 = this.field_147037_w.getRecipes(this.mc.thePlayer);
if (var6 != null && !var6.isEmpty())
{
int var7 = this.field_147041_z;
MerchantRecipe var8 = (MerchantRecipe)var6.get(var7);
if (var8.isRecipeDisabled())
{
this.mc.getTextureManager().bindTexture(field_147038_v);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
this.drawTexturedModalRect(this.field_147003_i + 83, this.field_147009_r + 21, 212, 0, 28, 21);
this.drawTexturedModalRect(this.field_147003_i + 83, this.field_147009_r + 51, 212, 0, 28, 21);
}
}
}
示例2: drawGuiContainerBackgroundLayer
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(field_147038_v);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
MerchantRecipeList merchantrecipelist = this.field_147037_w.getRecipes(this.mc.thePlayer);
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
{
int i1 = this.field_147041_z;
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(i1);
if (merchantrecipe.isRecipeDisabled())
{
this.mc.getTextureManager().bindTexture(field_147038_v);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21);
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21);
}
}
}
示例3: drawGuiContainerBackgroundLayer
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
/**
* Draws the background layer of this container (behind the items).
*/
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
{
int k = this.selectedMerchantRecipe;
if (k < 0 || k >= merchantrecipelist.size())
{
return;
}
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
if (merchantrecipe.isRecipeDisabled())
{
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21);
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21);
}
}
}
示例4: drawGuiContainerBackgroundLayer
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
/**
* Args : renderPartialTicks, mouseX, mouseY
*/
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
{
int k = this.selectedMerchantRecipe;
if (k < 0 || k >= merchantrecipelist.size())
{
return;
}
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
if (merchantrecipe.isRecipeDisabled())
{
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21);
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21);
}
}
}
示例5: drawGuiContainerBackgroundLayer
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
/**
* Draws the background layer of this container (behind the items).
*/
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.player);
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
{
int k = this.selectedMerchantRecipe;
if (k < 0 || k >= merchantrecipelist.size())
{
return;
}
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
if (merchantrecipe.isRecipeDisabled())
{
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21);
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21);
}
}
}
示例6: updateAITasks
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
protected void updateAITasks() {
if (!this.isTrading() && this.timeUntilReset > 0) {
--this.timeUntilReset;
if (this.timeUntilReset <= 0) {
if (this.needsInitilization) {
AOTA.logDebug("Initializing Tradeable entity " + hashCode());
for (MerchantRecipe merchantrecipe : this.buyingList) {
if (merchantrecipe.isRecipeDisabled()) {
merchantrecipe.increaseMaxTradeUses(this.rand.nextInt(6) + this.rand.nextInt(6) + 2);
}
}
this.populateBuyingList();
this.needsInitilization = false;
if (this.lastBuyingPlayer != null) {
this.world.setEntityState(this, (byte) 14);
}
}
this.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
}
}
super.updateAITasks();
}
示例7: drawGuiContainerBackgroundLayer
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.player);
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
int k = this.selectedMerchantRecipe;
if (k < 0 || k >= merchantrecipelist.size()) {
return;
}
MerchantRecipe merchantrecipe = merchantrecipelist.get(k);
if (merchantrecipe.isRecipeDisabled()) {
this.mc.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21);
this.drawTexturedModalRect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21);
}
}
}
示例8: onEntityInteractEvent
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@SubscribeEvent
public void onEntityInteractEvent(EntityInteract event) {
if (event.getEntity() instanceof EntityPlayer == false) {
return;
}
EntityPlayer player = (EntityPlayer) event.getEntity();
// ItemStack held = player.getHeldItemMainhand();
ItemStack itemstack = event.getItemStack();
if (itemstack != null && itemstack.getItem() instanceof ItemAppleEmerald && itemstack.getCount() > 0) {
if (event.getTarget() instanceof EntityVillager) {
EntityVillager villager = ((EntityVillager) event.getTarget());
int count = 0;
for (MerchantRecipe merchantrecipe : villager.getRecipes(player)) {
if (merchantrecipe.isRecipeDisabled()) {
//vanilla code as of 1.9.4 odes this (2d6+2)
merchantrecipe.increaseMaxTradeUses(villager.getEntityWorld().rand.nextInt(6) + villager.getEntityWorld().rand.nextInt(6) + 2);
count++;
}
}
if (count > 0) {
UtilChat.addChatMessage(player, UtilChat.lang("item.apple_emerald.merchant") + count);
consumeSelf(itemstack);
}
event.setCanceled(true);// stop the GUI inventory opening && horse mounting
}
}
}
示例9: drawButton
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float p) {
super.drawButton(mc, mouseX, mouseY, p);
if (this.visible) {
MerchantRecipeList merchantrecipelist = parent.getContainer().getTrades();
if (merchantrecipelist == null) {
return;
}
if (recipeIndex >= merchantrecipelist.size()) {
//in 1.11.2 the draw cycles happen before the recipe list is finished syncing from server, so we get index OOB errors
//just keep it hidden if we have and index for a recipe that is valid but not in the current list.
// see https://github.com/PrinceOfAmber/Cyclic/issues/324
this.visible = false;
return;//wait until its done loading until next draw
}
this.visible = true;
MerchantRecipe r = merchantrecipelist.get(recipeIndex);
if (r == null) {
return;
}
int x = this.x + 2;
int y = this.y + 1;
GlStateManager.pushMatrix();
ModCyclic.proxy.renderItemOnGui(r.getItemToBuy(), parent.itemRender, parent.fontRenderer, x, y);
x += spacing;
ModCyclic.proxy.renderItemOnGui(r.getSecondItemToBuy(), parent.itemRender, parent.fontRenderer, x, y);
x += spacing;
ModCyclic.proxy.renderItemOnGui(r.getItemToSell(), parent.itemRender, parent.fontRenderer, x, y);
GlStateManager.popMatrix();
RenderHelper.enableGUIStandardItemLighting();//IMPORTANT: without this, any button with transparent item (glass) well have messed up shading
if (r.isRecipeDisabled()) {
parent.mc.getTextureManager().bindTexture(TRADE_REDX);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
int sizeOfX = 30 / 2;//real physical texture is 30x30 pixels, and we just reduce it a touch
Gui.drawModalRectWithCustomSizedTexture(x - 18, y + 1, 0, 0, sizeOfX, sizeOfX,
sizeOfX, sizeOfX);
}
}
}
示例10: getTooltips
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
public List<String> getTooltips() {
List<String> tt = new ArrayList<String>();
MerchantRecipeList merchantrecipelist = parent.getContainer().getTrades();
if (merchantrecipelist == null) {
return tt;
}
MerchantRecipe r = merchantrecipelist.get(recipeIndex);
if (r == null) {
return tt;
}
if (r.isRecipeDisabled()) {
tt.add(UtilChat.lang("merchant.deprecated"));
}
else {
tt.add(UtilChat.lang("tile.tool_trade.button.tooltip"));
}
if (r.getItemToSell() != null) {// && r.getItemToSell().getItem() == Items.ENCHANTED_BOOK
Map<Enchantment, Integer> map = EnchantmentHelper.getEnchantments(r.getItemToSell());
if (map != null) {
for (Map.Entry<Enchantment, Integer> entry : map.entrySet()) {
tt.add(entry.getKey().getTranslatedName(entry.getValue()));
}
}
}
return tt;
}
示例11: resetRecipeAndSlots
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void resetRecipeAndSlots() {
this.currentRecipe = null;
ItemStack itemstack = this.inv.get(0);
ItemStack itemstack1 = this.inv.get(1);
if (itemstack.isEmpty()) {
itemstack = itemstack1;
itemstack1 = ItemStack.EMPTY;
}
if (itemstack.isEmpty()) {
this.setInventorySlotContents(2, ItemStack.EMPTY);
}
else {
MerchantRecipeList merchantrecipelist = this.getRecipes();
if (merchantrecipelist != null) {
MerchantRecipe merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack, itemstack1, this.currentRecipeIndex);
if (merchantrecipe != null && !merchantrecipe.isRecipeDisabled()) {
this.currentRecipe = merchantrecipe;
this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy());
}
else if (!itemstack1.isEmpty()) {
merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack1, itemstack, this.currentRecipeIndex);
if (merchantrecipe != null && !merchantrecipe.isRecipeDisabled()) {
this.currentRecipe = merchantrecipe;
this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy());
}
else {
this.setInventorySlotContents(2, ItemStack.EMPTY);
}
}
else {
this.setInventorySlotContents(2, ItemStack.EMPTY);
}
}
}
this.theMerchant.verifySellingItem(this.getStackInSlot(2));
}
示例12: updateAITasks
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
@SuppressWarnings("rawtypes")
protected void updateAITasks() {
if (!isTrading() && timeUntilReset > 0)
{
--timeUntilReset;
if (timeUntilReset <= 0)
{
if (needsInitilization)
{
if (tradingList.size() > 1)
{
Iterator iterator = tradingList.iterator();
while (iterator.hasNext())
{
MerchantRecipe merchantrecipe = (MerchantRecipe)iterator.next();
if (merchantrecipe.isRecipeDisabled())
merchantrecipe.increaseMaxTradeUses(rand.nextInt(6) + rand.nextInt(6) + 2);
}
}
addDefaultEquipmentAndRecipies(1);
needsInitilization = false;
}
addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 200, 0));
}
}
super.updateAITasks();
}
示例13: refreshTradingList
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
@Override
protected void refreshTradingList() {
for (ListIterator<MerchantRecipe> iterator = trades.listIterator(); iterator.hasNext();) {
MerchantRecipe trade = iterator.next();
// replace bomb trades so he can't ever become sold out
if (isBombTrade(trade) && trade.getToolUses() > 49) {
iterator.set(getRefreshedBombTrade(trade));
} else if (trade.isRecipeDisabled()) {
trade.increaseMaxTradeUses(rand.nextInt(6) + rand.nextInt(6) + 2);
}
}
}
示例14: refreshTradingList
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
/**
* Called each time the trading list is refreshed. The default implementation
* increases the max trade uses of any disabled recipes, just as vanilla does.
*/
protected void refreshTradingList() {
for (Iterator<MerchantRecipe> iterator = trades.iterator(); iterator.hasNext();) {
MerchantRecipe trade = iterator.next();
if (trade.isRecipeDisabled()) {
trade.increaseMaxTradeUses(rand.nextInt(6) + rand.nextInt(6) + 2);
}
}
}
示例15: resetRecipeAndSlots
import net.minecraft.village.MerchantRecipe; //导入方法依赖的package包/类
public void resetRecipeAndSlots()
{
this.currentRecipe = null;
ItemStack itemstack = this.theInventory[0];
ItemStack itemstack1 = this.theInventory[1];
if (itemstack == null)
{
itemstack = itemstack1;
itemstack1 = null;
}
if (itemstack == null)
{
this.setInventorySlotContents(2, (ItemStack)null);
}
else
{
MerchantRecipeList merchantrecipelist = this.theMerchant.getRecipes(this.thePlayer);
if (merchantrecipelist != null)
{
MerchantRecipe merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack, itemstack1, this.currentRecipeIndex);
if (merchantrecipe != null && !merchantrecipe.isRecipeDisabled())
{
this.currentRecipe = merchantrecipe;
this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy());
}
else if (itemstack1 != null)
{
merchantrecipe = merchantrecipelist.canRecipeBeUsed(itemstack1, itemstack, this.currentRecipeIndex);
if (merchantrecipe != null && !merchantrecipe.isRecipeDisabled())
{
this.currentRecipe = merchantrecipe;
this.setInventorySlotContents(2, merchantrecipe.getItemToSell().copy());
}
else
{
this.setInventorySlotContents(2, (ItemStack)null);
}
}
else
{
this.setInventorySlotContents(2, (ItemStack)null);
}
}
}
this.theMerchant.verifySellingItem(this.getStackInSlot(2));
}