
Everything posted by Vinyarion
-
[1.16.5] Could not find mappings_official-1.16.5.zip
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
-
[1.16.5] Could not find mappings_official-1.16.5.zip
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
-
Failure message: Missing License Information in file Mod File
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.
-
Network client to server
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.
-
[1.16.4]I don't know how to make blocks transparent
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
-
[1.16.4]I don't know how to make blocks transparent
1. Learn java, it will definitely make everything less confusing. 2. copy the block model that minecraft:air uses
-
Am I able to save a list of TileEntities to CompoundNBT
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 */}
-
get ModDimension as DimensionType
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); }
-
Failure message: Missing License Information in file Mod File
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.
-
[1.15.2] Trying to render custom sun and moon textures in new dimension.
If it rotates with the player, have you thought of rotating the rendering by -player's rotation?
-
Get the Furnace, that finished smelting item
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`.
-
Can't get custom item in ItemStack
[deleted]
-
Error when running Client
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.
-
get ModDimension as DimensionType
`DimensionManager.registerOrGetDimension(ResourceLocation,ModDimension,PacketBuffer,boolean)` returns a DimensionType.
-
[1.12.2] Example project crashes on run
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.
-
Using Reflections doesn't work outside deobfuscated environments
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.
-
Change private entity data
Use reflection, in particular, look at the `ObfuscationReflectionHelper` class, you're interested in the `setPrivateValue` method
-
Tagging disabled items with forge/tags errors my whole game
No problem, sometimes imitation is the fastest method to gain knowledge/wisdom.
-
Tagging disabled items with forge/tags errors my whole game
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 ] }
-
Rendering Text above Entity
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(); }
-
Tagging disabled items with forge/tags errors my whole game
Forge adds the ability to have an "optional" object in the tag json definition, put those items in there
-
[solved][1.15.2] Accessing resource in my mod jar
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.
-
ObfuscationReflectionHelper.findClass()?
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.
-
[1.16.1] Help with an Event
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.
-
[1.15] Adding a Button to a player inventory
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!
IPS spam blocked by CleanTalk.