added modid to main, better particle spawning, update to 4.0.0
This commit is contained in:
@@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
loom_version=1.11-SNAPSHOT
|
||||
|
||||
# Mod Properties
|
||||
mod_version=3.0.1
|
||||
mod_version=4.0.0
|
||||
maven_group=com.lizistired
|
||||
archives_base_name=cave_dust
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@ import static net.lizistired.cavedust.utils.KeybindingHelper.*;
|
||||
public class CaveDust implements ClientModInitializer {
|
||||
//logger
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("cavedust");
|
||||
|
||||
//modid
|
||||
public static final String modid = "cave_dust";
|
||||
|
||||
//make class static
|
||||
private static CaveDust instance;
|
||||
public static CaveDust getInstance() {
|
||||
@@ -54,7 +58,7 @@ public class CaveDust implements ClientModInitializer {
|
||||
return config;
|
||||
}
|
||||
|
||||
public static ParticleEffect WHITE_ASH_ID = (ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of("cavedust", "cave_dust"));
|
||||
public static ParticleEffect WHITE_ASH_ID = (ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of(modid, "cave_dust"));
|
||||
public static int PARTICLE_AMOUNT = 0;
|
||||
public static int PARTICLE_RADIUS_PLUME = 50;
|
||||
CubeCreator cubeCreator = new CubeCreator();
|
||||
@@ -66,8 +70,8 @@ public class CaveDust implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
//config path and loading
|
||||
Path CaveDustFolder = GamePaths.getConfigDirectory().resolve("cavedust");
|
||||
config = new CaveDustConfig(CaveDustFolder.getParent().resolve("cavedust.json"), this);
|
||||
Path CaveDustFolder = GamePaths.getConfigDirectory().resolve(modid);
|
||||
config = new CaveDustConfig(CaveDustFolder.getParent().resolve(modid + ".json"), this);
|
||||
config.load();
|
||||
registerKeyBindings();
|
||||
ParticleFactoryRegistry.getInstance().register(CaveDustServer.CAVE_DUST_MOTE, CaveDustMoteParticleFactory.Factory::new);
|
||||
@@ -106,8 +110,11 @@ public class CaveDust implements ClientModInitializer {
|
||||
if (client.world == null) return;
|
||||
World world = client.world;
|
||||
|
||||
for (int i = 0; i < 5000; i++) {
|
||||
cubeCreator.randomSphereCreator(5, 0, 0, 0);
|
||||
for (int i = 0; i < 5; i++) {
|
||||
cubeCreator.randomSphereCreator(5, 0, 0, 0, Identifier.of(modid, "cave_dust_mote"));
|
||||
}
|
||||
for (int i = 0; i < 1; i++) {
|
||||
cubeCreator.randomSphereCreator(20, 0, 0, 0, Identifier.of(modid, "cave_dust_plume"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -136,8 +143,8 @@ public class CaveDust implements ClientModInitializer {
|
||||
// }
|
||||
|
||||
//cubeCreator.cubeCreator(50, 0, 0, 0);
|
||||
for (int i = 0; i < 5000; i++) {
|
||||
cubeCreator.randomSphereCreator(5, 0, 0, 0);
|
||||
for (int i = 0; i < 1; i++) {
|
||||
cubeCreator.randomSphereCreator(5, 0, 0, 0, Identifier.of("cavedust", "cave_dust_mote"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -102,7 +102,6 @@ public class ModMenuConfigScreenAdvanced extends GameGui {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
||||
renderBackground(context, mouseX, mouseY, partialTicks);
|
||||
super.render(context, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
package net.lizistired.cavedust.utils;
|
||||
|
||||
import com.jcraft.jorbis.Block;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.particle.ParticleEffect;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class CubeCreator {
|
||||
|
||||
|
||||
// 3 nesting for loops to create a hollow border cube around the player
|
||||
public void cubeCreator(int steps, int offsetXInitial, int offsetYInitial, int offsetZInitial) {
|
||||
public void cubeCreator(int steps, int offsetXInitial, int offsetYInitial, int offsetZInitial, Identifier caveDust) {
|
||||
BlockPos playerPos = MinecraftClient.getInstance().player.getBlockPos();
|
||||
|
||||
// Loop over the range of steps around the player
|
||||
@@ -30,7 +27,7 @@ public class CubeCreator {
|
||||
|
||||
// If it's on the border, spawn the particle
|
||||
if (onBorder) {
|
||||
spawnParticleClient(playerPos.getX() + x, playerPos.getY() + y, playerPos.getZ() + z);
|
||||
spawnParticleClient(playerPos.getX() + x, playerPos.getY() + y, playerPos.getZ() + z, caveDust);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +35,7 @@ public class CubeCreator {
|
||||
}
|
||||
|
||||
// Create a hollow sphere around the player
|
||||
public void sphereCreator(int radius, int offsetXInitial, int offsetYInitial, int offsetZInitial) {
|
||||
public void sphereCreator(int radius, int offsetXInitial, int offsetYInitial, int offsetZInitial, Identifier caveDust) {
|
||||
BlockPos playerPos = MinecraftClient.getInstance().player.getBlockPos();
|
||||
|
||||
// Loop over the range of steps around the player (we are using a cube bounding box to check)
|
||||
@@ -53,14 +50,15 @@ public class CubeCreator {
|
||||
if (Math.abs(distance - radius) < 1.5) { // Threshold for thickness of the border
|
||||
spawnParticleClient(playerPos.getX() + x + offsetXInitial,
|
||||
playerPos.getY() + y + offsetYInitial,
|
||||
playerPos.getZ() + z + offsetZInitial);
|
||||
playerPos.getZ() + z + offsetZInitial,
|
||||
caveDust);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void randomSphereCreator(int radius, int offsetXInitial, int offsetYInitial, int offsetZInitial) {
|
||||
public void randomSphereCreator(int radius, int offsetXInitial, int offsetYInitial, int offsetZInitial, Identifier caveDust) {
|
||||
Random random = new Random(); // Random number generator
|
||||
|
||||
// Generate random spherical angles
|
||||
@@ -82,10 +80,10 @@ public class CubeCreator {
|
||||
float randomX = random.nextFloat() + spawnX;
|
||||
float randomY = random.nextFloat() + spawnY;
|
||||
float randomZ = random.nextFloat() + spawnZ;
|
||||
spawnParticleClient(randomX, randomY, randomZ);
|
||||
spawnParticleClient(randomX, randomY, randomZ, caveDust);
|
||||
}
|
||||
|
||||
private void spawnParticleClient(float x, float y, float z) {
|
||||
MinecraftClient.getInstance().world.addParticleClient((ParticleEffect) Registries.PARTICLE_TYPE.get(Identifier.of("cavedust", "cave_dust_mote")), x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
private void spawnParticleClient(float x, float y, float z, Identifier caveDust) {
|
||||
MinecraftClient.getInstance().world.addParticleClient((ParticleEffect) Registries.PARTICLE_TYPE.get(caveDust), x, y, z, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user