Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CapCompScreen extends ContainerScreen<CapCompContainer> implements IHasContainer<CapCompContainer> {
- private static final ResourceLocation BUTTON_RIGHT_TEXTURE = Main.getId("textures/gui/container/right.png");
- private static final ResourceLocation BUTTON_LEFT_TEXTURE = Main.getId("textures/gui/container/left.png");
- private final int containerID;
- private final int containerInd;
- private final int xLeft;
- private final int yTop;
- private int newContainerInd;
- public static void register() {
- ScreenManager.registerFactory(ModContainerTypes.MULTI_9X3.get(), CapCompScreen::new);
- }
- /** The ResourceLocation containing the chest GUI texture. */
- private static final ResourceLocation CHEST_GUI_TEXTURE = Main.getId("textures/gui/container/multi_27_default.png");
- public CapCompScreen(CapCompContainer p_i51095_1_, PlayerInventory p_i51095_2_, ITextComponent p_i51095_3_) {
- super(p_i51095_1_, p_i51095_2_, p_i51095_3_);
- this.field_230711_n_ = false;
- this.guiLeft = 0;
- this.guiTop = 0;
- this.xSize = 176;
- this.ySize = 186;
- this.xLeft = this.guiLeft + this.xSize;
- this.yTop = this.guiTop + this.ySize;
- this.field_238742_p_ = 8; //xTitle
- this.field_238743_q_ = 8; //yTitle
- this.field_238744_r_ = 8; //xInventory
- this.field_238745_s_ = 93; //yInventory
- //this.container = p_i51095_1_;
- this.containerInd = p_i51095_1_.getInvInd();
- this.newContainerInd = this.containerInd;
- this.containerID = p_i51095_1_.getID();
- }
- protected void func_231160_c_() {
- super.func_231160_c_();
- this.func_230480_a_(
- new ImageButton(this.guiLeft + this.xSize - 20, this.guiTop - 20 - 6,
- 20, 20,
- 0, 0, 21, BUTTON_RIGHT_TEXTURE, (p_214076_1_) -> {
- this.newContainerInd++;
- if (this.newContainerInd > 15) {
- this.newContainerInd = 0;
- }
- PacketUpdateContainer packet = new PacketUpdateContainer(this.containerID, this.newContainerInd);
- PacketHandler.sendToServer(packet);
- })
- );
- this.func_230480_a_(
- new ImageButton(this.guiLeft, this.guiTop - 20 - 6,
- 20, 20,
- 0, 0, 21, BUTTON_LEFT_TEXTURE, (p_214076_1_) -> {
- this.newContainerInd--;
- if (this.newContainerInd < 0) {
- this.newContainerInd = 15;
- }
- PacketUpdateContainer packet = new PacketUpdateContainer(this.containerID, this.newContainerInd);
- PacketHandler.sendToServer(packet);
- })
- );
- }
- public void func_230430_a_(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
- this.func_230446_a_(p_230430_1_);
- super.func_230430_a_(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
- this.func_230459_a_(p_230430_1_, p_230430_2_, p_230430_3_);
- }
- protected void func_230450_a_(MatrixStack p_230450_1_, float p_230450_2_, int p_230450_3_, int p_230450_4_) {
- RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.field_230706_i_.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
- this.func_238474_b_(p_230450_1_, this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement