basic functionality

This commit is contained in:
2022-05-22 16:35:39 +03:00
parent 8fa3af15f5
commit 9a192a429c
9 changed files with 68 additions and 157 deletions

View File

@ -1,16 +0,0 @@
package net.fabricmc.example.mixin;
import net.fabricmc.example.ExampleMod;
import net.minecraft.client.gui.screen.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(TitleScreen.class)
public class ExampleMixin {
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
ExampleMod.LOGGER.info("This line is printed by an example mod mixin!");
}
}

View File

@ -1,14 +1,14 @@
package net.fabricmc.example;
package ru.xzeldon.removeblockoutline;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExampleMod implements ModInitializer {
public class RemoveBlockOutline implements ModInitializer {
// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LoggerFactory.getLogger("modid");
public static final Logger LOGGER = LoggerFactory.getLogger("removeblockoutline");
@Override
public void onInitialize() {
@ -16,6 +16,6 @@ public class ExampleMod implements ModInitializer {
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
LOGGER.info("Hello Fabric world!");
LOGGER.info("RemoveBlockOutline mod initialized");
}
}

View File

@ -0,0 +1,20 @@
package ru.xzeldon.removeblockoutline.mixin;
import net.minecraft.block.BlockState;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(WorldRenderer.class)
public class RemoveBlockOutlineMixin {
@Inject(method = "drawBlockOutline", at = @At("HEAD"), cancellable = true)
private void onDrawBlockOutline(MatrixStack matrixStack, VertexConsumer vertexConsumer, Entity entity, double cameraX, double cameraY, double cameraZ, BlockPos blockPos, BlockState blockState, CallbackInfo ci) {
ci.cancel();
}
}

View File

Before

Width:  |  Height:  |  Size: 453 B

After

Width:  |  Height:  |  Size: 453 B

View File

@ -1,29 +1,29 @@
{
"schemaVersion": 1,
"id": "modid",
"id": "removeblockoutline",
"version": "${version}",
"name": "Example Mod",
"description": "This is an example description! Tell everyone what your mod is about!",
"name": "RemoveBlockOutline",
"description": "This mod removes the outlines that get drawn when the player mouse over a block.",
"authors": [
"Me!"
"xzeldon"
],
"contact": {
"homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-example-mod"
"homepage": "https://zeldon.ru/",
"sources": "https://github.com/xzeldon/RemoveBlockOutline"
},
"license": "CC0-1.0",
"icon": "assets/modid/icon.png",
"license": "MIT",
"icon": "assets/removeblockoutline/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"net.fabricmc.example.ExampleMod"
"ru.xzeldon.removeblockoutline.RemoveBlockOutline"
]
},
"mixins": [
"modid.mixins.json"
"removeblockoutline.mixins.json"
],
"depends": {

View File

@ -1,12 +1,12 @@
{
"required": true,
"minVersion": "0.8",
"package": "net.fabricmc.example.mixin",
"package": "ru.xzeldon.removeblockoutline.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
"ExampleMixin"
"RemoveBlockOutlineMixin"
],
"injectors": {
"defaultRequire": 1