Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Jun 4, 2024
2 parents 8173d83 + cbd63cf commit 4c36fd9
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 6 deletions.
Binary file added images/mixin-export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions tags/faq/appendproperties.ytag
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
type: text

---

When trying to create a block with block state properties you might come across an error like this:
`java.lang.IllegalArgumentException: Cannot set property ... as it does not exist in Block{minecraft:air}`

This happens when you don't (correctly) override the `appendProperties` method in your block class. Overriding this method is necessary to tell minecraft which properties your block has.
It should look something like this:
```java
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
builder.add(YOUR, PROPERTIES, HERE);
}
```

On older versions (before 1.20.5) the method has to be `public` instead of `protected`.

The error refers to your block as `minecraft:air` because it usually hasn't been registered by the time the error is thrown.
You can usually find which block is having issues by looking for the constructor of it in the stacktrace.
2 changes: 2 additions & 0 deletions tags/faq/chatgpt.ytag
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type: alias
target: faq/llm
2 changes: 2 additions & 0 deletions tags/faq/copilot.ytag
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type: alias
target: faq/llm
2 changes: 2 additions & 0 deletions tags/faq/gemini.ytag
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type: alias
target: faq/llm
16 changes: 16 additions & 0 deletions tags/faq/llm.ytag
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
type: text

---

Whilst LLMs (Large Language Models) like [ChatGPT](<https://chat.openai.com/>) and [Gemini](<https://gemini.google.com/>) are impressive tools, **they are not recommended for first-time Fabric mod developers due to their inconsistency and potential for generating inaccurate code. **

LLMs may generate incorrect code that:

- Targets the wrong Minecraft version, leading to outdated or incompatible features.
- Uses incorrect mappings, causing errors or unexpected behavior.
- Is designed for the wrong loader (NeoForge vs. Fabric), resulting in incompatibility.
- Relies on non-existent Fabric API modules, creating code that references features that don't exist (called LLM hallucinations)

It's crucial to remember that LLMs should be seen as **problem-solving aids**, not code-generating machines. The output they provide often requires significant modification and understanding of Java before it can be implemented as a functional mod.

**Therefore, learning Java is an absolute necessity before attempting to use any LLM-generated code in your mod.** Knowing how the generated code works is key to using it effectively and fixing any problems that may arise.
5 changes: 0 additions & 5 deletions tags/guide/mixindebug.ytag

This file was deleted.

25 changes: 25 additions & 0 deletions tags/guide/mixinexport.ytag
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
type: embed

colour: black
embed:
title: Exporting Mixin Classes
image:
url: "https://raw.githubusercontent.com/FabricMC/community/main/images/mixin-export.png"

---

Annotate your Mixin class with `@Debug(export = true)`, which will export the individual Mixin.

Example:
```java
@Debug(export = true)
@Mixin(...)
public class MyMixin {
// Mixin code here
}
```
You can export **all** Mixin classes by adding `-Dmixin.debug.export=true` to your VM options.
> IntelliJ IDEA - [Run/debug configurations - More options](https://www.jetbrains.com/help/idea/run-debug-configuration-java-application.html#more_options) (See "VM options")
> VSCode - [Running and debugging Java - Configuration options](https://code.visualstudio.com/docs/java/java-debugging#_configuration-options) (See "vmArgs")

Exported finalized classes will appear in `run/.mixin.out`.
3 changes: 2 additions & 1 deletion tags/link/jdk.ytag
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ embed:

---

[Java 17](https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot) for Minecraft 1.17 and later
[Java 21](https://adoptium.net/?variant=openjdk21&jvmVariant=hotspot) for Minecraft 1.20.5 and later
[Java 17](https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot) for Minecraft 1.17 to 1.20.4
[Java 8](https://adoptium.net/?variant=openjdk8&jvmVariant=hotspot) for Minecraft 1.16 and earlier

0 comments on commit 4c36fd9

Please sign in to comment.