Jump to content

Big_Bad_E

Members
  • Posts

    312
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Big_Bad_E

  1. 5 hour bump.
  2. I have a slot, it has a texuture, the slot appears, but not the texture. GUI: public class BWGui extends GuiContainer { private final int BUTTON_X = 20; private final int BUTTON_Y = 20; private static final ResourceLocation GUI_BACKGROUND = new ResourceLocation("enhancedbows", "textures/gui/workbench_gui.png"); private static final ResourceLocation GUI_WIDGETS = new ResourceLocation("enhancedbows", "textures/gui/workbench_widgets.png"); BWContainer container; public BWGui(Container inventorySlotsIn) { super(inventorySlotsIn); container = (BWContainer) inventorySlotsIn; } @Override public void initGui() { super.initGui(); buttonList.clear(); int id = 1; for(int i = 0; i < BowTypes.values().length; i++) { buttonList.add(new GuiButtonImage(id, BUTTON_X*((id-1)/8)+Minecraft.getMinecraft().displayWidth/10, BUTTON_Y*((id-1)%8)+Minecraft.getMinecraft().displayHeight/20, 25, 25, 64*((id-1)/8), 64*((id-1)%8), 1, GUI_WIDGETS)); id += 1; } container.updateType(); } @Override protected void actionPerformed(GuiButton button) { container.updateType(); } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { drawDefaultBackground(); Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_BACKGROUND); drawTexturedModalRect(this.guiLeft/3*2, this.guiTop/4, 0, 0, 256, 256); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { } } Container: public class BWContainer extends Container { private TEBowWorkbench tile; private ItemStackHandler handler; public BowTypes type = null; BWContainer(InventoryPlayer inventory, TEBowWorkbench tile) { this.tile = tile; for(BowTypes type : BowTypes.values()) { if(type.ordinal() == tile.getTab()) { this.type = type; } } if(type == null) type = BowTypes.SHORTBOW; int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { addSlotToContainer(new Slot(inventory, j + i * 9 + 9, Minecraft.getMinecraft().displayWidth/10 + j * 18, Minecraft.getMinecraft().displayHeight/10 + i * 18)); } } // add hotbar slots for (i = 0; i < 9; ++i) { addSlotToContainer(new Slot(inventory, i, Minecraft.getMinecraft().displayWidth/10 + i * 18, Minecraft.getMinecraft().displayHeight/10)); } } public void updateType() { int i = 0; if(type == null) type = BowTypes.SHORTBOW; if(handler != null) for(int i2 = 0; i2 < handler.getSlots(); i2++) inventorySlots.remove(i2); handler = new ItemStackHandler(type.materials.length); } @Override @ParametersAreNonnullByDefault public boolean canInteractWith(EntityPlayer playerIn) { return true; } @Override @MethodsReturnNonnullByDefault public ItemStack transferStackInSlot(EntityPlayer playerIn, int slotIndex) { ItemStack itemStack1 = null; Slot slot = inventorySlots.get(slotIndex); if (slot != null && slot.getHasStack()) { ItemStack itemStack2 = slot.getStack(); itemStack1 = itemStack2.copy(); // player inventory slots if (slotIndex >= 9 && slotIndex < 36) { if (!mergeItemStack(itemStack2, 9, 35, false)) return null; // hotbar slots } else if (slotIndex < 9 && !mergeItemStack(itemStack2, 2, 28, false)) { if (!mergeItemStack(itemStack2, 0, 8, false)) return null; } else if (!mergeItemStack(itemStack2, 0, 35, false)) { return null; } if (itemStack2.getCount() == 0) { slot.putStack(ItemStack.EMPTY); } else { slot.onSlotChanged(); } if (itemStack2.getCount() == itemStack1.getCount()) { return null; } } return itemStack1; } } Misc enums are simple and I know the resource locations are correct, there are no errors in console. I'm 99% sure I am doing a ton of things wrong with the positioning, but right now I am just focusing on getting the background textures to work.
  3. Look at the post, I figured it out. Spaceboy was right.
  4. Now the texture is still blank, but I don't get a file not found error.
  5. I just copy pasted all the files from another mod and it worked for some reason... .-.
  6. I deleted everything in the folder when I tried the 3 times
  7. How is that done? That will probably fix everything.
  8. It's not without gradle, but I copy pasted another mod I made, and changed the src files, which obviously was dumb and caused problems.
  9. The code works, it was working until I tried to get gradle working properly, but to test I've tested a different mod I know works and no dice.
  10. Bump because I'd like to continue modding, and I can't do pretty much anything.
  11. I've done that 3 times! I even tried it with gradlew intellij (or idea idk), but nothing!
  12. For some reason Forge/Intellij isn't finding my mod that I have. I set it up by extracting forge into my mod folder (EnhancedBows), then running gradlew setupDecompWorkspace, then setupDevWorkspace ideaModule, then imported the build.gradle, then ran genIntellijRuns. I opened Intellij again, ran Minecraft Client, and no dice. I tried it 3 times, tried setting up the mod in a forge folder then imported it as a module. Still nothing. I have no idea what is wrong, I've done this a ton and this has never happened to me. The 4 Forge default mods load btw. Console log: Log: http://www.mediafire.com/file/mx4lnaw19ha3wpc/debug.log
  13. That was probaly my problem, but I was lazy and copy pasted the files from another set up mod and gradle was hating me for it.
  14. I just had a placeholder for the draw to see if the gui actually opened, saw the error, and didn't fix the placeholder. Thanks for telling me the buttons draw themself, didn't know.
  15. I forgot to refresh, but still didn't change anything. Nothing else, but I think I know what the problem is. Thanks for the help.
  16. What do you mean a caused by part? Its a FileNotFoundException, look in the spoiler.
  17. Yes, I said it can't find the texture. The method is being called bc the drawDefaultBackground() method is being called
  18. Idea still shows you all the methods, and maybe try the method named getItem().
  19. I have a TileEntity and a GUIContainer and a Container. WHen I right click on the Block, the GUI opens, and there is no background. Code: public class BWGui extends GuiContainer { private final int BUTTON_X = 20; private final int BUTTON_Y = 20; private static final ResourceLocation GUI_BACKGROUND = new ResourceLocation("enhancedbows", "textures/gui/workbench_gui.png"); private static final ResourceLocation GUI_WIDGETS = new ResourceLocation("enhancedbows", "textures/gui/workbench_widgets.png"); BWContainer container; public BWGui(Container inventorySlotsIn) { super(inventorySlotsIn); container = (BWContainer) inventorySlotsIn; } @Override public void initGui() { super.initGui(); buttonList.clear(); int id = 1; for(int i = 0; i > 1; i++) { buttonList.add(new GuiButtonImage(id, BUTTON_X*((id-1)/8), BUTTON_Y*((id-1)%8), 64, 64, 64*((id-1)/8), 64*((id-1)%8), 0, GUI_WIDGETS)); id += 1; } container.updateType(); } @Override protected void actionPerformed(GuiButton button) { BowTypes type = null; for(BowTypes type1 : BowTypes.values()) if(type1.ordinal() == button.id) type = type1; container.type = type; } @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { drawDefaultBackground(); Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_BACKGROUND); this.drawTexturedModalRect(Minecraft.getMinecraft().displayWidth-256, 0f,0, 0, 256, 256); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { } } The background is grayed out, the inventory works, but apparently it can't find my background texture. Never mind, found my problem. Thanks for the help everyone. (It was the pack.mcmeta I think) File layout: src\main\resources\assets\enhancedbows\textures\gui\workbench_gui.png Also the button (A GuiButtonImage) doesn't draw, I have no idea why.
  20. I have no idea what's wrong, help is appreciated (I can't respond rn but I will tomorrow, also no errors)
  21. Updated my code, when I place the block it shows the missing block model texture, when I refresh it shows the model with the missing texture texture.
  22. Well it worked with no error so forgive my ignorance.
  23. BLockState code: @Override @MethodsReturnNonnullByDefault public BlockStateContainer createBlockState() { CrystalColor color = new CrystalColor(CrystalColor.colors[rand.nextInt(5)]); BlockStateContainer.Builder container = new BlockStateContainer.Builder(this).add(color); return container.build(); } @Override public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, createBlockState().getBaseState()); worldIn.getBlockState(pos).getProperties().forEach((prop, value) -> System.out.println(prop.getName() + ", " + value + ", " + value.toString())); System.out.println("test"); } Test gets outprinted twice. Also no properties are outprinted of course. Why does it get outprinted twice and what am I doing wrong with my properties? I am supposed to use a property map? Also, I don't really need the brackets cause it is just one item.
  24. Fixed it, but I don't get an error for that so, idk what's wrong
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.