
TheDubsteppingNinja
Members-
Posts
10 -
Joined
-
Last visited
Everything posted by TheDubsteppingNinja
-
What I need to know is how to: -use multiple different textures at the same time for each itemstack of my item -change these textures while the game is running without any performance issues like refreshresources ex: itemStack1 renders with itemTextureA itemStack2 renders with itemTextureB itemStack3 renders with itemTextureC ... ... ... Changed itemStack1 to render with itemTextureD I remember this was sorta possible before, but is it still possible in 1.8+? Would modelbakery work? Maybe something with a BufferedImage?
-
[SOLVED][1.8] Centering GUI Texture
TheDubsteppingNinja replied to TheDubsteppingNinja's topic in Modder Support
Okay I get it now, thanks man! That worked perfectly! -
In a class that extends GuiContainer, I used this to center my texture.... int x = (this.width-textureWidth)/2;//my texture is a 256x256 texture therefore, textureWidth and textureHeight = 256 int y = (this.height-textureHeight)/2; and this to place it..... this.drawTexturedModalRect(x, y, 0, 0, guiWidth, guiHeight); registering the guihandler in preinit like this NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); But for some reason the texture is being placed at the top left corner at the screen with 3 quarters of the texture being cut off. The center of the texture is being placed at 0, 0 instead of the center of the screen like intended. Yes, I'm new to Forge, but I am not a complete idiot, I used the debugger to figure out that "this.height" and "this.width" equals 0, therefore placing the gui at -128,-128. So why is this happening and can someone tell me how to fix it??? Is the container affecting it? Is it where I'm registering the guihandler?
-
[1.8] Need help with placement of GUI texture
TheDubsteppingNinja replied to TheDubsteppingNinja's topic in Modder Support
Yes, the gui is taking up the full size of the png -
So I'm trying to experiment with GUI's and ran into a brick wall here. public class test_GUIScreen extends GuiScreen { int guiWidth = 256; //image is a 256x256 png int guiHeight = 256; int guiX = (width-guiWidth)/2; //centering int guiY = (height-guiHeight)/2; GuiButton Test; //unused buton @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GL11.glColor4f(1, 1, 1, 1); drawDefaultBackground(); mc.renderEngine.bindTexture(new ResourceLocation("test", "textures/gui/testtex3.png")); this.drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight); super.drawScreen(mouseX, mouseY, partialTicks); } @Override public void initGui() { // buttonList.clear(); // buttonList.add(Test = new GuiButton(0, guiX+1, guiY+2, 30, 20, "Test")); super.initGui(); } @Override protected void actionPerformed(GuiButton Button) throws IOException { switch(Button.id) { case 0: case 1: case 2: } super.actionPerformed(Button); } @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); } } This code is making the texture appear in the top left corner of the screen but I need it in the center . Can someone please share their insight? :'(
-
net.minecraftforge.fml.common.LoaderException: java.lang.NoSuchMethodException: com.thedubsteppingninja.MyMod.MyItemBlock.<init>(net.minecraft.block.Block) at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:225) at net.minecraftforge.fml.common.registry.GameRegistry.registerBlock(GameRegistry.java:182) at com.thedubsteppingninja.MyMod.Mod.init(Mod.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:208) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:187) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:692) at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:291) at net.minecraft.client.Minecraft.startGame(Minecraft.java:484) at net.minecraft.client.Minecraft.run(Minecraft.java:325) at net.minecraft.client.main.Main.main(Main.java:117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) at GradleStart.main(GradleStart.java:45) So I tracked down where the problem happened..... public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name, Object... itemCtorArgs) { if (Loader.instance().isInState(LoaderState.CONSTRUCTING)) { FMLLog.warning("The mod %s is attempting to register a block whilst it it being constructed. This is bad modding practice - please use a proper mod lifecycle event.", Loader.instance().activeModContainer()); } try { assert block != null : "registerBlock: block cannot be null"; ItemBlock i = null; if (itemclass != null) { Class<?>[] ctorArgClasses = new Class<?>[itemCtorArgs.length + 1]; ctorArgClasses[0] = Block.class; for (int idx = 1; idx < ctorArgClasses.length; idx++) { ctorArgClasses[idx] = itemCtorArgs[idx-1].getClass(); } Constructor<? extends ItemBlock> itemCtor = itemclass.getConstructor(ctorArgClasses); -.getConstructor is throwing this exception but I don't know how........... @EventHandler public void init(FMLInitializationEvent event) { variableMyBlock = new MyBlock(Material.wood); GameRegistry.registerBlock(MyBlock, MyItemBlock.class, "name"); CommonProxy.registerRenderThings(); } -Where I registered everything public class MyItemBlock extends ItemBlock { public MyItemBlock() { super(MyMod.variableMyBlock); //calling the block made in the forge mod file this.maxStackSize = 16; this.setCreativeTab(CreativeTabs.tabDecorations); this.setHasSubtypes(true); this.setMaxDamage(0); } -Constructor of my ItemBlock Class So can someone explain to me what I am doing wrong?
-
So basically, I need to use a method in Minecraft.class, I know that you can't just use it like "Minecraft.doSomething()" because I need to use the specific instance of Minecraft.class that is created by Main.class, only thing is, this is how the instance is created: (new Minecraft(gameconfiguration)).run(); Is there a way in Java to get the instance of a class that was not created as a variable?