Jump to content

Earthcomputer

Forge Modder
  • Posts

    114
  • Joined

  • Last visited

Everything posted by Earthcomputer

  1. Just noticed you're using Blocks.CAULDRON. Cauldrons have their own separate item. Try Items.CAULDRON
  2. ModItems.CHOCOLATE_BAR seems to be null when you register the recipe. Make sure you;re registering the recipe after you register the items
  3. [I'm not sure whether this is the most appropriate place to post this, if not please tell me where to post it and I'll move it there] Hi, I am making a buildscript for a Jar Mod someone else is making, so that they can make it open source. For this I am using ForgeGradle. Since I am not the owner of this project I cannot simply switch away from Jar modding (trust me, I've tried persuading them!). The build system is very similar to how Forge itself is built. I've got the setupCarpet (equivalent of setupForge) task to build successfully. Next I tried to get genPatches to work, but I'm having trouble with this. I'm getting compile errors in the src/main/start classes complaining that the launchwrapper classes don't exist. This is one of them: C:\Users\owner\Documents\CarpetOpenSource\ForgeGradleTest\projects\Carpet\src\main\start\net\minecraftforge\gradle\tweakers\CoremodTweaker.java:28: error: package net.minecraft.launchwrapper does not exist import net.minecraft.launchwrapper.ITweaker; ^ Obviously the launchwrapper library is missing, I have tried many different variations in the buildscript to try and get it to compile with launchwrapper in the classpath, with no success. Here is my latest attempt: subprojects { repositories { maven {url "http://libraries.minecraft.net/"} } dependencies { forgeGradleMcDeps 'net.minecraft:launchwrapper:1.11' } } What's really puzzling me about this is how does Forge not have these errors? I've been following along with Forge's build.gradle and other files and have not seen anything I've done differently. My full buildscript is attached. Thanks in advance for help! build.gradle
  4. The only other thing I can think of is to check whether the texture really exists in src/main/resources/assets/<modid>/textures/icon_party.png, check the spellings exactly, make sure your mod ID is all lower case, and refresh the folder so the IDE knows it's there. If none of those work, I'm at as much of a loss as you are.
  5. What happens if you remove this line? What happens if you change it to 1.0f, 1.0f, 1.0f? (May not be useful right now, but once you've solved the missing texture problem...)
  6. The updateScreen method in GuiScreen is called once per tick and can be overridden in your custom GUI. If you were to make a spinning wheel, for example, you would update the rotation of the wheel every tick in the updateScreen method and then make the wheel spin look smoother in the drawScreen method by using partialTicks.
  7. In class TheDarkness, you have then line: GameRegistry.registerWorldGenerator(new WorldGenReliquaryChest(), 0); You have set the generation weight to zero, which means there is zero chance that the world generator will generate.
  8. First of all, to get the wooden sword item, see the Items class (net.minecraft.init.Items). It contains a list of all the items in vanilla. To test if an item is a wooden sword: if (item == Items.WOODEN_SWORD) To clear the player's inventory of wooden swords: player.inventory.clearMatchingItems(Items.WOODEN_SWORD, -1, 1, null); As for player-sensitive recipes, consider making a custom IRecipe implementation. Diesieben07 made a tutorial on how to do this.
  9. Here's an option: Override IContainerListener and add the listener to the container when it is created using Container.addListener. Perhaps the sendSlotContents method is the one you're looking for?
  10. I am planning on writing a buildscript which involves downloading the Minecraft client and server from where they are hosted on amazonaws. I know how to do this, I just want to ask about how legal it would be to do so. ForgeGradle does it, but is that just because they got permission? Thanks in advance for answers
  11. - You can use event.getEntity() to get the player. - You are running on the client if e.worldObj.isRemote or if e instanceof AbstractClientPlayer - You will have to cast the entity to EntityPlayer If you want to get the player without the event and you're sure the code is running client-side, use Minecraft.getMinecraft().thePlayer Edit: to check if single player (and you're sure the code is running client-side), there's something along the lines of Minecraft.getMinecraft().isIntegratedServerRunning
  12. Try running the command set JAVA_OPTS=-Xmx2g before running gradlew setupDecompWorkspace if you don't want to modify the gradle.properties file
  13. After more code digging, I noticed that when the debug screen is opened, GlStateManager.enableTexture2D() is called, and GlStateManager.disableTexture2D() is not called, leading to the inconsistent behaviour with my lines. So, I fixed all my problems with GlStateManager.disableTexture2D() and GlStateManager.disableDepth(). And we all lived happily ever after.
  14. - initEntityAI() is called by a superconstructor, which is called when you write 'super()' in the second constructor of EntitySkeletonWarrior. - The compiler then inserts statements after this call to the superconstructor to initialize your fields. - Thus, aiAttackOnCollide is null when initEntityAI() is called To fix this, you would probably initialize aiAttackOnCollide inside the addAttackTasks() method you have, instead of where the field is declared.
  15. Switching to DrawBlockHighlightEvent fixed the lines randomly disappearing (out of interest, why?). - I have also changed GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT) to GlStateManager.disableDepth(), because it was causing other issues. However there is still the problem that the lines are appearing black. - I have tried GlStateManager.color(1f, 1f, 1f), that didn't fix it. - I also discovered that when looking at a redstone torch with the debug screen open, the lines turn blue and partially transparent (doesn't work with redstone dust or when the debug screen is closed). I can't figure out what's causing this problem, more help would be appreciated
  16. - Subscribe an event listener to MinecraftForge.ORE_GEN_BUS - Subscribe to OreGenEvent.GenerateMinable - If event.getType() == OreGenEvent.GenerateMinable.EventType.COAL: - Cancel the event - Generate your own ore instead (using WorldGenMinable)
  17. This code is supposed to render lines above a redstone component when it is hovered over showing the inputs and outputs of the component (it should be rendered on top of all the blocks, even if it is behind them). It works sort of, but inconsistently - all the lines turn black or are darker than they should be, and sometimes the lines disappear completely. Picture of the black lines: https://goo.gl/uh7ert Relevant code: An interesting effect is that if you open the chat GUI while looking at a redstone component, the lines blink on and off (very strange). It's almost as if OpenGL is being distracted by the chat cursor so doesn't draw the lines. If you want to reproduce this yourself, all the code is also on github: https://github.com/Earthcomputer/RedBuilder If you want to reproduce the behaviour, remember to turn the mod setting called 'Enable Redstone Power Info' to true, or the lines won't ever appear. The lines still may not appear (this is the bug), though it helps to reload the chunks if you want to see them. Thanks in advance for help, if any can be given!
  18. Not true, the ResourceLocation class has existed for a long time.
  19. Have a look at how the chestplate is rendered on players, zombies and skeletons (you may have to do a bit of searching). Rendering a shirt shouldn't be too much different.
  20. Actually this is not true. After running a simple test on a dedicated server: @EventHandler @SideOnly(Side.CLIENT) public void init(FMLInitializationEvent e) { System.out.println("Init called"); } The server ran fine and "Init called" was not printed into the console. I've used this technique a lot for very simple mods which I am using to figure out changes between updates, and I worry about "bad practice" after I get it to work. Anyway, here is not the place to argue
  21. @diesieben07: Thanks for this! I knew it was something I didn't understand about the registries. @Choonster: I am aware that it is better to use proxies, but in this case @SideOnly doesn't hurt because logical sides don't exist at loading time, so I used it for a temporary simple mod. However, as diesieben07 said to move the ModelLoader stuff to preinit, it looks like making proxies is the next stage
  22. I have already done that in the code I have given. Look again at the method registerTexture(Block block, String textureName, IProperty<?>... ignoredProperties) . Does anyone know why this isn't working?
  23. Thanks! Isn't there a way to tell Minecraft that a certain property doesn't make a difference to the appearance, as my block is very similar to the vanilla dispenser, and my blockstate file is nearly the same as the dispenser blockstate file?
  24. Hi This is the first time I've tried to add custom blocks since block models have been added (I normally don't do this kind of stuff, I've done items though). My item displays as you'd expect, like any other itemblock, but my block just uses the pink and black missing model and I get this error in the console on loading: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justdoable:crafter#facing=up,triggered=false with loader VariantLoader.INSTANCE, skipping at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:134) ~[ModelLoaderRegistry.class:?] at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:222) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:144) ~[ModelBakery.class:?] at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:210) ~[ModelLoader.class:?] at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:127) ~[ModelLoader.class:?] at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:130) [simpleReloadableResourceManager.class:?] at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:111) [simpleReloadableResourceManager.class:?] at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:792) [Minecraft.class:?] at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:323) [FMLClientHandler.class:?] at net.minecraft.client.Minecraft.startGame(Minecraft.java:554) [Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:381) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_65] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_65] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_65] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_65] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:26) [start/:?] Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:75) ~[ModelBlockDefinition.class:?] at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1159) ~[ModelLoader$VariantLoader.class:?] at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:130) ~[ModelLoaderRegistry.class:?] ... 24 more It is only a very simple mod atm, so the block is registered and stuff in my main mod file: package net.earthcomputer.justdoable; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.oredict.ShapedOreRecipe; @Mod(modid = JustDoable.MODID, name = JustDoable.NAME, version = JustDoable.VERSION) public class JustDoable { public static final String MODID = "justdoable"; public static final String NAME = "Just Doable"; public static final String VERSION = "1.0"; @Instance(MODID) public static JustDoable instance; public static BlockCrafter crafter; public static CreativeTabs CREATIVE_TAB = new CreativeTabs(MODID) { @Override public Item getTabIconItem() { return Item.getItemFromBlock(crafter); } }; @EventHandler public void preinit(FMLPreInitializationEvent e) { crafter = (BlockCrafter) new BlockCrafter().setUnlocalizedName("crafter").setCreativeTab(CREATIVE_TAB) .setRegistryName("crafter"); GameRegistry.register(crafter); GameRegistry.register(new ItemBlock(crafter).setRegistryName(crafter.getRegistryName())); GameRegistry.addRecipe(new ShapedOreRecipe(crafter, "SSS", "SCS", "SRS", 'S', "cobblestone", 'C', Blocks.crafting_table, 'R', "dustRedstone")); GameRegistry.registerTileEntity(TileEntityCrafter.class, "Crafter"); NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler()); } @SideOnly(Side.CLIENT) @EventHandler public void init(FMLInitializationEvent e) { registerTexture(crafter, "crafter", BlockCrafter.TRIGGERED); } private static void registerTexture(Block block, String textureName, IProperty<?>... ignoredProperties) { ModelLoader.setCustomStateMapper(block, new StateMap.Builder().ignore(ignoredProperties).build()); registerTexture(Item.getItemFromBlock(block), textureName); } private static void registerTexture(Item item, String textureName) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(MODID + ":" + textureName, "inventory")); } } assets/justdoable/blockstates/crafter.json: { "variants": { "facing=down": { "model": "justdoable:crafter_vertical", "x": 180 }, "facing=up": { "model": "justdoable:crafter_vertical" }, "facing=north": { "model": "justdoable:crafter" }, "facing=south": { "model": "justdoable:crafter", "y": 180 }, "facing=west": { "model": "justdoable:crafter", "y": 270 }, "facing=east": { "model": "justdoable:crafter", "y": 90 } } } assets/justdoable/models/block/crafter.json: { "parent": "block/orientable", "textures": { "top": "blocks/furnace_top", "front": "blocks/dispenser_front_horizontal", "side": "blocks/furnace_side" } } assets/justdoable/models/block/crafter_vertical.json: { "parent": "block/orientable_vertical", "textures": { "front": "blocks/dispenser_front_vertical", "side": "blocks/furnace_top" } } Thanks in advance for help! I hope this isn't too much of a nooby question, knowing me I've probably done something really nooby that's caused it anyways
×
×
  • Create New...

Important Information

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