based
This commit is contained in:
@@ -3,14 +3,14 @@ org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=1.18.2+build.1
|
||||
minecraft_version=1.18.1
|
||||
yarn_mappings=1.18.1+build.22
|
||||
loader_version=0.13.3
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.0
|
||||
maven_group = com.example
|
||||
archives_base_name = fabric-example-mod
|
||||
maven_group = com.lizistired
|
||||
archives_base_name = dust
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.47.8+1.18.2
|
||||
fabric_version=0.46.4+1.18
|
||||
|
||||
@@ -1,21 +1,47 @@
|
||||
package net.fabricmc.example;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
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.
|
||||
ClientPlayConnectionEvents.JOIN.register((handler, sender, client) -> {
|
||||
ClientTickEvents.START_CLIENT_TICK.register((client1) -> {
|
||||
|
||||
LOGGER.info("Hello Fabric world!");
|
||||
World world = client1.world;
|
||||
if (!client1.player.clientWorld.isSkyVisible(client.player.getBlockPos())) {
|
||||
double d = 0;
|
||||
double e = 0;
|
||||
double f = 0;
|
||||
double probabilityClamped = lerp(64,-64,client.player.getBlockY());
|
||||
for (int i = 0; i < probabilityClamped; i++) {
|
||||
d = client.player.getPos().getX() + getRandomNumberUsingInts(-5, 5);
|
||||
e = client.player.getPos().getY() + getRandomNumberUsingInts(-20, 20);
|
||||
f = client.player.getPos().getZ() + getRandomNumberUsingInts(-5, 5);
|
||||
world.addParticle(ParticleTypes.WHITE_ASH, d, e, f, getRandomNumberUsingInts(-5, 20), getRandomNumberUsingInts(-5, 20), getRandomNumberUsingInts(-5, 20));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public int getRandomNumberUsingInts(int min, int max) {
|
||||
Random random = new Random();
|
||||
return random.ints(min,max)
|
||||
.findFirst()
|
||||
.getAsInt();
|
||||
}
|
||||
public static double lerp(double min, double max, double val) {
|
||||
return 1 - ((val - min) / (max - min));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 126 KiB |
@@ -3,14 +3,14 @@
|
||||
"id": "modid",
|
||||
"version": "${version}",
|
||||
|
||||
"name": "Example Mod",
|
||||
"description": "This is an example description! Tell everyone what your mod is about!",
|
||||
"name": "Dust",
|
||||
"description": "Makes dust underground that scales with depth!",
|
||||
"authors": [
|
||||
"Me!"
|
||||
"LizIsTired"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "https://fabricmc.net/",
|
||||
"sources": "https://github.com/FabricMC/fabric-example-mod"
|
||||
"homepage": "https://github.com/LizIsTired/dust",
|
||||
"sources": "https://github.com/LizIsTired/dust"
|
||||
},
|
||||
|
||||
"license": "CC0-1.0",
|
||||
@@ -22,12 +22,9 @@
|
||||
"net.fabricmc.example.ExampleMod"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
"modid.mixins.json"
|
||||
],
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.13.3",
|
||||
"fabricloader": ">=0.12.11",
|
||||
"fabric": "*",
|
||||
"minecraft": "1.18.x",
|
||||
"java": ">=17"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "net.fabricmc.example.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ExampleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user