|
Download mc/mc-0049.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 2.4 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/main/mc/mc-0049.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm/mc/mc-0049.jsonl
-
curl -L -o mc-0049.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/main/mc/mc-0049.jsonl
2.4 kB
| {"type": "session", "harness": "opencode", "id": "mc-0049", "name": "Mixin Basics"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert Fabric mod developer. You write idiomatic Minecraft Fabric mods using Java, Fabric API, and Yarn mappings."}} | |
| {"type": "message", "message": {"role": "user", "content": "How do I use Mixin basics like @Inject, @Redirect, and @ModifyVariable in a Fabric mod?"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "mymod.mixins.json:\n```json\n{\"required\": true, \"minVersion\": \"0.8\", \"package\": \"com.example.mymod.mixin\",\n \"compatibilityLevel\": \"JAVA_21\", \"mixins\": [\"ExampleMixin\"], \"client\": [\"ClientMixin\"],\n \"injectors\": {\"defaultRequire\": 1}}\n```\n\n@Inject example:\n```java\n@Mixin(PlayerEntity.class)\npublic abstract class PlayerEntityMixin {\n @Inject(method = \"tick\", at = @At(\"HEAD\"))\n private void onTick(CallbackInfo ci) {\n PlayerEntity self = (PlayerEntity) (Object) this;\n // Custom logic every tick\n }\n\n @Inject(method = \"isCreative\", at = @At(\"HEAD\"), cancellable = true)\n private void onIsCreative(CallbackInfoReturnable<Boolean> cir) {\n cir.setReturnValue(true);\n cir.cancel();\n }\n}\n```\n\n@Redirect example:\n```java\n@Mixin(Block.class)\npublic abstract class BlockMixin {\n @Redirect(method = \"onUse\", at = @At(value = \"INVOKE\",\n target = \"Lnet/minecraft/entity/player/PlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;\"))\n private ItemStack redirectGetStackInHand(PlayerEntity player, Hand hand) {\n return player.getStackInHand(hand);\n }\n}\n```\n\n@ModifyVariable example:\n```java\n@Mixin(LivingEntity.class)\npublic abstract class LivingEntityMixin {\n @ModifyVariable(method = \"damage\", at = @At(\"HEAD\"), argsOnly = true)\n private float modifyDamage(float amount) { return amount * 1.5f; }\n}\n```\n\n@ModifyArg example:\n```java\n@Mixin(Explosion.class)\npublic class ExplosionMixin {\n @ModifyArg(method = \"collectItemsAndDamageEntities\", at = @At(value = \"INVOKE\",\n target = \"Lnet/minecraft/world/World;getEntities(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/Box;)Ljava/util/List;\"),\n index = 1)\n private Box modifyExplosionBox(Box box) { return box.expand(2.0); }\n}\n```"}} | |