rebrand and first mixin \o/
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package me.youhavetrouble.moregamerules;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
|
||||
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
|
||||
import net.minecraft.world.GameRules;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class MoreGameRules implements ModInitializer {
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("moregamerules");
|
||||
|
||||
public static GameRules.Key<GameRules.BooleanRule> MAGMA_BLOCK_DAMAGE;
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
||||
MAGMA_BLOCK_DAMAGE = GameRuleRegistry.register(
|
||||
"magmaBlockDamage",
|
||||
GameRules.Category.MISC,
|
||||
GameRuleFactory.createBooleanRule(true)
|
||||
);
|
||||
|
||||
LOGGER.info("Finished loading up!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package me.youhavetrouble.moregamerules.mixin;
|
||||
|
||||
import me.youhavetrouble.moregamerules.MoreGameRules;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.MagmaBlock;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
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(MagmaBlock.class)
|
||||
public class MagmaBlockMixin extends Block {
|
||||
|
||||
public MagmaBlockMixin(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "onSteppedOn", cancellable = true)
|
||||
private void injectedOnSteppedOn(World world, BlockPos pos, BlockState state, Entity entity, CallbackInfo info) {
|
||||
if (!world.getGameRules().getBoolean(MoreGameRules.MAGMA_BLOCK_DAMAGE)) info.cancel();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package net.fabricmc.example;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ExampleMod 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");
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
||||
// However, some things (like resources) may still be uninitialized.
|
||||
// Proceed with mild caution.
|
||||
|
||||
LOGGER.info("Hello Fabric world!");
|
||||
}
|
||||
}
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 453 B |
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"gamerule.magmaBlockDamage": "Magma block damage",
|
||||
"gamerule.magmaBlockDamage.description": "Controls if magma blocks should do damage when stepped on"
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "modid",
|
||||
"id": "moregamerules",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Example Mod",
|
||||
"description": "This is an example description! Tell everyone what your mod is about!",
|
||||
"name": "More Game Rules",
|
||||
"description": "More gamerules for easy gameplay customization",
|
||||
"authors": [
|
||||
"Me!"
|
||||
"YouHaveTrouble"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://fabricmc.net/",
|
||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
||||
"homepage": "https://youhavetrouble.me/",
|
||||
"sources": "https://github.com/YouHaveTrouble/MoreGameRules"
|
||||
},
|
||||
|
||||
"license": "CC0-1.0",
|
||||
@@ -19,11 +19,11 @@
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"net.fabricmc.example.ExampleMod"
|
||||
"me.youhavetrouble.moregamerules.MoreGameRules"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"modid.mixins.json"
|
||||
"moregamerules.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "net.fabricmc.example.mixin",
|
||||
"package": "me.youhavetrouble.moregamerules.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ExampleMixin"
|
||||
"mixins": [],
|
||||
"client": [],
|
||||
"server": [
|
||||
"MagmaBlockMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
Reference in New Issue
Block a user