Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by Vinyarion

  1. Well, that was anticlimactic. New build.gradle: buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } // maven { url = 'https://files.minecraftforge.net/maven' } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true } } apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. . . . rest of file as normal So much for not editing above the line. BUILD SUCCESSFUL in 14s
  2. Recently updated my IntelliJ IDEA, and the project imported just fine. Then out of the blue, the gradle refresh fails: This was unexpected, as literally no problems were happening before this. build.gradle: Upon clicking the url of the location searched, I get this: [Screenshot] I have tried manually specifying different gradle versions, Java versions for gradle, and reimported the project several times (deleting the idea project entirely) with the exact same result. Edit: Probably has something to do with the migration of files.minecraftforge.net/maven to maven.minecraftforge.net
  3. Part of diesieben's point is that if the mod was written for 1.15, it will not run on any 1.16 version, regardless of whether you add the license thing.
  4. You will want to use a custom network channel, for example, NetworkRegistry.newSimpleChannel gives you a SimpleChannel, where you can then register packets and handlers.
  5. Mod blocks must have block models loaded from resource packs just like vanilla blocks. The vanilla air model is assets/minecraft/models/block/air.json, and the blockstates are assets/minecraft/blockstates/air.json
  6. 1. Learn java, it will definitely make everything less confusing. 2. copy the block model that minecraft:air uses
  7. Your tile entity could have a flag that starts as true at construction, then in the tick method, if(flag){flag=false;/* check for surrounding blocks */}
  8. You need to register the dimension during the event, like this: @SubscribeEvent public static void dimReg(RegisterDimensionsEvent event) { while (sky() == null); } public static DimensionType sky() { ModDimension sky = SKY_DIM.get(); return DimensionManager.registerOrGetDimension(sky.getRegistryName(), sky, null, true); }
  9. This is the thing Draco said you should look at, it says exactly what folder the relevant file is in. If it doesn't exist, that might mean you need to create it. Add license="<your license here>" to that file.
  10. If it rotates with the player, have you thought of rotating the rendering by -player's rotation?
  11. You should probably make a capability that attaches to furnaces, then check if your item is in the output slot of the furnace. The capability stores the previous size of the output stack so you don't generate your effects every tick, only when the stack size of your item increases. To run things every tick, you'll want to subscribe to a `WorldTickEvent` and iterate through the `World.tickableTileEntities`.
  12. Your java installation is incorrect. You are running this project in the jre inside your jdk. You need to point your IDE to use the jdk instead.
  13. `DimensionManager.registerOrGetDimension(ResourceLocation,ModDimension,PacketBuffer,boolean)` returns a DimensionType.
  14. This forum only supports the newest versions of Forge, you need to upgrade to 1.15.X (preferably 1.16.X) to recieve support. There's a lot of tutorials out there for 1.15 and later, it's not difficult to find one.
  15. If you want to look at type heirarchy or annotation data, Forge has already searched the classpath for annotations and types for mod loading and event bus subscription. Here's what it would look like to use it for something: public static Set<Class<? extends ParentClass>> init() { return ModList.get() .getAllScanData() .stream() .map(ModFileScanData::getClasses) .flatMap(Collection::stream) .filter(data -> "your.ParentClass".equals(data.parent.getClassName())) .map(Type::getClassName) .map(Class::forName) .map(ParentClass.class::asSubclass) .collect(Collectors.toSet()); } This is very simplistic, because the `parent` field is private, so you would have to use reflection, and `Class.forName(String)` throws some things, so it can't be used in a method reference like that, but otherwise, this kind of thing has worked for me before.
  16. Use reflection, in particular, look at the `ObfuscationReflectionHelper` class, you're interested in the `setPrivateValue` method
  17. No problem, sometimes imitation is the fastest method to gain knowledge/wisdom.
  18. Your json probably looks like this: { "values": [ "mod:item", "mod:item2" // You want this to be optional ] } You need this: { "values": [ "mod:item" ], "optional": [ "mod:item2" // Now it's optional ] }
  19. Take a look at how `EntityRenderer.renderName(Entity,String,MatrixStack,IRenderTypeBuffer,int)void` does it, and copy something like it. You could also use something like this that I wrote for 1.15, it should be pretty similar in 1.16: public static void renderName(Quaternion cameraOrientation, FontRenderer fontrenderer, String displayNameIn, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn, double x, double y, double z) { matrixStackIn.push(); matrixStackIn.translate(x, y, z); matrixStackIn.rotate(cameraOrientation); matrixStackIn.scale(-0.025F, -0.025F, 0.025F); Matrix4f matrix4f = matrixStackIn.getLast().getMatrix(); float f1 = Minecraft.getInstance().gameSettings.getTextBackgroundOpacity(0.25F); int j = (int) (f1 * 255.0F) << 24; float f2 = (float) (-fontrenderer.getStringWidth(displayNameIn) / 2); fontrenderer.renderString(displayNameIn, f2, 0, 553648127, false, matrix4f, bufferIn, false, j, packedLightIn); fontrenderer.renderString(displayNameIn, f2, 0, -1, false, matrix4f, bufferIn, false, 0, packedLightIn); matrixStackIn.pop(); }
  20. Forge adds the ability to have an "optional" object in the tag json definition, put those items in there
  21. You should probably be using the IResourceManager instead. If your data is client-side, you use the resource manager instance from the Minecraft class, if for the server, from the MinecraftServer class.
  22. If I remember correctly, you can just use the deobf fully-qualified name for reflection purposes. When the end-user installs a forge client/server, Forge maps the obf names to the srg names.
  23. I'm quite positive the `ItemStack.shrink(1)` method is what you're looking for. Edit: So you will probably want to retrieve an ItemStack that exists in the player's inventory, and call shrink on it.
  24. Yes, you need to subscribe to `GuiScreenEvent.InitGuiEvent.Pr e event)` in order to add widgets, the event itself has a method `addWidget`. Here's an example of how it could be used: @SubscribeEvent public void addCustomButtonToInventory(GuiScreenEvent.InitGuiEvent.Pre event) { if (event.getGui() instanceof InventoryScreen) { event.addWidget(new Button(x, y, width, height, text, button -> { Minecraft.getInstance().displayGuiScreen(new CustomGUI()); })); } } If you aren't familiar with the `button -> {...}` syntax, this Button constructor takes an Button.IPressable as a parameter, which is the behavior that happens when you click. Equivalent code would look like this: @SubscribeEvent public void addCustomButtonToInventory(GuiScreenEvent.InitGuiEvent.Pre event) { if (event.getGui() instanceof InventoryScreen) { event.addWidget(new Button(x, y, width, height, text, new CustomAction())); } } class CustomAction implements IPressable { public void onPress(Button button) { Minecraft.getInstance().displayGuiScreen(new CustomGUI()); } } Hope this helps!
  • Create New...

Important Information

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