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