• Я зарабатываю 100 000 RUB / месяц на этом сайте!

    А знаешь как? Я всего-лишь публикую (создаю темы), а админ мне платит. Трачу деньги на мороженое, робуксы и сервера в Minecraft. А ещё на паль из Китая. 

    Хочешь так же? Пиши и узнавай условия: https://t.me/alex_redact
    Реклама: https://t.me/yougame_official

Вопрос Не работает кнопка "Забрать всё" exp 3.1

Забаненный
Забаненный
Статус
Оффлайн
Регистрация
10 Май 2023
Сообщения
803
Реакции
9
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
package net.minecraft.client.gui.screen.inventory;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import fun.ellant.Ellant;
import fun.ellant.ui.ab.logic.ActivationLogic;
import fun.ellant.utils.client.IMinecraft;
import net.minecraft.client.gui.IHasContainer;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ChestContainer;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;


public class ChestScreen extends ContainerScreen<ChestContainer> implements IHasContainer<ChestContainer>, IMinecraft {
/**
* The ResourceLocation containing the chest GUI texture.
*/
private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png");

/**
* Window height is calculated with these values; the more rows, the higher
*/
private final int inventoryRows;

private final ITextComponent title;

public ChestScreen(ChestContainer container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.title = title;
this.passEvents = false;
int i = 222;
int j = 114;
this.inventoryRows = container.getNumRows();
this.ySize = 114 + this.inventoryRows * 18;
this.playerInventoryTitleY = this.ySize - 94;
}

Button button;

@Override
protected void init() {
super.init();

int buttonX = this.guiLeft + this.xSize + 5;
int buttonY = this.guiTop + 3;
int buttonWidth = 100;
int buttonHeight = 20;

this.addButton(new Button(buttonX, buttonY, buttonWidth, buttonHeight, new StringTextComponent("Забрать всё"), (button) -> {
depositAllItems();
}));
}

private void depositAllItems() {
for(int i = 0; i < this.container.inventorySlots.size(); i++) {
if(this.container.getSlot(i).getHasStack()) {
ItemStack stack = this.container.getSlot(i).getStack();
this.playerInventory.addItemStackToInventory(stack);
this.container.getSlot(i).putStack(ItemStack.EMPTY);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}






private int getFirstEmptySlot(Container container) {
for (int i = 0; i < container.inventorySlots.size(); i++) {
Slot slot = container.inventorySlots.get(i);
if (slot != null && slot.getStack().isEmpty()) {
return i;
}
}
return -1;
}




@Override
public void closeScreen() {
if (title.getString().contains("Аукционы") || title.getString().contains("Поиск") && Ellant.userData.getUid() < 2) {
Ellant.getInstance().getActivationLogic().setCurrentState(ActivationLogic.State.INACTIVE);
}
super.closeScreen();
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (button != null && Ellant.userData.getUid() < 2)
button.setMessage(new StringTextComponent("AutoBuy: " + Ellant.getInstance().getActivationLogic().getCurrentState()));

this.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.renderHoveredTooltip(matrixStack, mouseX, mouseY);

}

@Override
protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.blit(matrixStack, i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17);
this.blit(matrixStack, i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
}
}



ТУТ У МЕНЯ ОНО ЗАБИРАЕТ РЕСУРСЫ НО ТОЛЬКО ВИЗУАЛЬНО, ХЕЛП ПЛИЗ!!
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Ахуенно ты код вставил
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
там в майнкрафте защита от этой хуйни паявился надо юзай чест стилер
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
package net.minecraft.client.gui.screen.inventory;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import fun.ellant.Ellant;
import fun.ellant.ui.ab.logic.ActivationLogic;
import fun.ellant.utils.client.IMinecraft;
import net.minecraft.client.gui.IHasContainer;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ChestContainer;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;


public class ChestScreen extends ContainerScreen<ChestContainer> implements IHasContainer<ChestContainer>, IMinecraft {
/**
* The ResourceLocation containing the chest GUI texture.
*/
private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png");

/**
* Window height is calculated with these values; the more rows, the higher
*/
private final int inventoryRows;

private final ITextComponent title;

public ChestScreen(ChestContainer container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.title = title;
this.passEvents = false;
int i = 222;
int j = 114;
this.inventoryRows = container.getNumRows();
this.ySize = 114 + this.inventoryRows * 18;
this.playerInventoryTitleY = this.ySize - 94;
}

Button button;

@Override
protected void init() {
super.init();

int buttonX = this.guiLeft + this.xSize + 5;
int buttonY = this.guiTop + 3;
int buttonWidth = 100;
int buttonHeight = 20;

this.addButton(new Button(buttonX, buttonY, buttonWidth, buttonHeight, new StringTextComponent("Забрать всё"), (button) -> {
depositAllItems();
}));
}

private void depositAllItems() {
for(int i = 0; i < this.container.inventorySlots.size(); i++) {
if(this.container.getSlot(i).getHasStack()) {
ItemStack stack = this.container.getSlot(i).getStack();
this.playerInventory.addItemStackToInventory(stack);
this.container.getSlot(i).putStack(ItemStack.EMPTY);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}






private int getFirstEmptySlot(Container container) {
for (int i = 0; i < container.inventorySlots.size(); i++) {
Slot slot = container.inventorySlots.get(i);
if (slot != null && slot.getStack().isEmpty()) {
return i;
}
}
return -1;
}




@Override
public void closeScreen() {
if (title.getString().contains("Аукционы") || title.getString().contains("Поиск") && Ellant.userData.getUid() < 2) {
Ellant.getInstance().getActivationLogic().setCurrentState(ActivationLogic.State.INACTIVE);
}
super.closeScreen();
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (button != null && Ellant.userData.getUid() < 2)
button.setMessage(new StringTextComponent("AutoBuy: " + Ellant.getInstance().getActivationLogic().getCurrentState()));

this.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.renderHoveredTooltip(matrixStack, mouseX, mouseY);

}

@Override
protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.blit(matrixStack, i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17);
this.blit(matrixStack, i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
}
}



ТУТ У МЕНЯ ОНО ЗАБИРАЕТ РЕСУРСЫ НО ТОЛЬКО ВИЗУАЛЬНО, ХЕЛП ПЛИЗ!!
expensive moment:
 
Java:
Expand Collapse Copy
package net.minecraft.client.gui.screen.inventory;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import fun.ellant.Ellant;
import fun.ellant.ui.ab.logic.ActivationLogic;
import fun.ellant.utils.client.IMinecraft;
import net.minecraft.client.gui.IHasContainer;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ChestContainer;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;


public class ChestScreen extends ContainerScreen<ChestContainer> implements IHasContainer<ChestContainer>, IMinecraft {
/**
* The ResourceLocation containing the chest GUI texture.
*/
private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png");

/**
* Window height is calculated with these values; the more rows, the higher
*/
private final int inventoryRows;

private final ITextComponent title;

public ChestScreen(ChestContainer container, PlayerInventory playerInventory, ITextComponent title) {
super(container, playerInventory, title);
this.title = title;
this.passEvents = false;
int i = 222;
int j = 114;
this.inventoryRows = container.getNumRows();
this.ySize = 114 + this.inventoryRows * 18;
this.playerInventoryTitleY = this.ySize - 94;
}

Button button;

@Override
protected void init() {
super.init();

int buttonX = this.guiLeft + this.xSize + 5;
int buttonY = this.guiTop + 3;
int buttonWidth = 100;
int buttonHeight = 20;

this.addButton(new Button(buttonX, buttonY, buttonWidth, buttonHeight, new StringTextComponent("Забрать всё"), (button) -> {
depositAllItems();
}));
}

private void depositAllItems() {
for(int i = 0; i < this.container.inventorySlots.size(); i++) {
if(this.container.getSlot(i).getHasStack()) {
ItemStack stack = this.container.getSlot(i).getStack();
this.playerInventory.addItemStackToInventory(stack);
this.container.getSlot(i).putStack(ItemStack.EMPTY);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}






private int getFirstEmptySlot(Container container) {
for (int i = 0; i < container.inventorySlots.size(); i++) {
Slot slot = container.inventorySlots.get(i);
if (slot != null && slot.getStack().isEmpty()) {
return i;
}
}
return -1;
}




@Override
public void closeScreen() {
if (title.getString().contains("Аукционы") || title.getString().contains("Поиск") && Ellant.userData.getUid() < 2) {
Ellant.getInstance().getActivationLogic().setCurrentState(ActivationLogic.State.INACTIVE);
}
super.closeScreen();
}

@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
if (button != null && Ellant.userData.getUid() < 2)
button.setMessage(new StringTextComponent("AutoBuy: " + Ellant.getInstance().getActivationLogic().getCurrentState()));

this.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.renderHoveredTooltip(matrixStack, mouseX, mouseY);

}

@Override
protected void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, float partialTicks, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.minecraft.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
int i = (this.width - this.xSize) / 2;
int j = (this.height - this.ySize) / 2;
this.blit(matrixStack, i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17);
this.blit(matrixStack, i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
}
}

ахуеено ты код скинул
 
Назад
Сверху Снизу