fix broken particle parsing
This commit is contained in:
1 parent
ac72645cb4
commit
da5b937e78
7 files changed
+18
-19
No files matched your search
@@ -22,7 +22,7 @@ clients will actually be able to receive (they may have more available via resou
|
|||||||
Renders a cloud of particles `name` centered around `pos` position, by default `count` 10 of them, default `speed`
|
Renders a cloud of particles `name` centered around `pos` position, by default `count` 10 of them, default `speed`
|
||||||
of 0, and to all players nearby, but these options can be changed via optional arguments. Follow vanilla `/particle`
|
of 0, and to all players nearby, but these options can be changed via optional arguments. Follow vanilla `/particle`
|
||||||
command on details on those options. Valid particle names are
|
command on details on those options. Valid particle names are
|
||||||
for example `'angry_villager', 'item diamond', 'block stone', 'dust 0.8 0.1 0.1 4'`.
|
for example `'angry_villager', 'item diamond', 'block stone', 'dust{"scale": 4, "color": [0.8, 0.1, 0.1]}'`.
|
||||||
|
|
||||||
Used with no arguments, return the list of available particle names. Note that some of the names do not correspond to a valid
|
Used with no arguments, return the list of available particle names. Note that some of the names do not correspond to a valid
|
||||||
particle that can be fed to `particle(...)` function due to a fact that some particles need more configuration
|
particle that can be fed to `particle(...)` function due to a fact that some particles need more configuration
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check https://fabricmc.net/develop/
|
# check https://fabricmc.net/develop/
|
||||||
minecraft_version=25w09a
|
minecraft_version=1.21.5-pre1
|
||||||
loader_version=0.16.10
|
loader_version=0.16.10
|
||||||
jsr305_version=3.0.2
|
jsr305_version=3.0.2
|
||||||
fabric_version=0.110.5+1.21.4
|
fabric_version=0.110.5+1.21.4
|
||||||
|
|||||||
@@ -1,19 +1,13 @@
|
|||||||
package carpet.helpers;
|
package carpet.helpers;
|
||||||
|
|
||||||
import carpet.script.utils.ParticleParser;
|
|
||||||
import net.minecraft.core.HolderLookup;
|
|
||||||
import net.minecraft.core.particles.ParticleOptions;
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
import net.minecraft.core.particles.ParticleType;
|
|
||||||
import net.minecraft.core.registries.Registries;
|
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public class ParticleDisplay
|
public class ParticleDisplay
|
||||||
{
|
{
|
||||||
public static void drawParticleLine(ServerPlayer player, Vec3 from, Vec3 to, String main, String accent, int count, double spread)
|
public static void drawParticleLine(ServerPlayer player, Vec3 from, Vec3 to, ParticleOptions mainParticle, ParticleOptions accentParticle, int count, double spread)
|
||||||
{
|
{
|
||||||
ParticleOptions accentParticle = ParticleParser.getEffect(accent, player.server.registryAccess());
|
|
||||||
ParticleOptions mainParticle = ParticleParser.getEffect(main, player.server.registryAccess());
|
|
||||||
|
|
||||||
if (accentParticle != null) player.serverLevel().sendParticles(
|
if (accentParticle != null) player.serverLevel().sendParticles(
|
||||||
player,
|
player,
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package carpet.logging.logHelpers;
|
|||||||
|
|
||||||
import carpet.helpers.ParticleDisplay;
|
import carpet.helpers.ParticleDisplay;
|
||||||
import carpet.logging.LoggerRegistry;
|
import carpet.logging.LoggerRegistry;
|
||||||
|
import net.minecraft.core.particles.DustParticleOptions;
|
||||||
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
@@ -31,8 +34,8 @@ public class PathfindingVisualizer
|
|||||||
if (minDuration < 1)
|
if (minDuration < 1)
|
||||||
minDuration = 1;
|
minDuration = 1;
|
||||||
|
|
||||||
String accent = successful ? "happy_villager" : "angry_villager";
|
ParticleOptions accent = successful ? ParticleTypes.HAPPY_VILLAGER : ParticleTypes.ANGRY_VILLAGER;
|
||||||
String color = (miliseconds/minDuration < 2)? "dust 1 1 0 1" : ((miliseconds/minDuration < 4)?"dust 1 0.5 0 1":"dust 1 0 0 1");
|
ParticleOptions color = (miliseconds/minDuration < 2)? new DustParticleOptions(0xffffff00, 1) : ((miliseconds/minDuration < 4)?new DustParticleOptions(0xFFFF7700, 1): new DustParticleOptions(0xFFFF0000, 1));
|
||||||
ParticleDisplay.drawParticleLine((ServerPlayer) player, entity.position(), target, color, accent, 5, 0.5);
|
ParticleDisplay.drawParticleLine((ServerPlayer) player, entity.position(), target, color, accent, 5, 0.5);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package carpet.mixins;
|
|||||||
import carpet.helpers.ParticleDisplay;
|
import carpet.helpers.ParticleDisplay;
|
||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
import carpet.utils.MobAI;
|
import carpet.utils.MobAI;
|
||||||
|
import net.minecraft.core.particles.DustParticleOptions;
|
||||||
import net.minecraft.world.entity.ai.village.poi.PoiTypes;
|
import net.minecraft.world.entity.ai.village.poi.PoiTypes;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -131,7 +132,7 @@ public abstract class Villager_aiMixin extends AbstractVillager
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ParticleDisplay.drawParticleLine((ServerPlayer) playerEntity_1, position(), Vec3.atCenterOf(bedPos.pos()), "dust 0 0 0 1", "happy_villager", 100, 0.2); // pos+0.5v
|
ParticleDisplay.drawParticleLine((ServerPlayer) playerEntity_1, position(), Vec3.atCenterOf(bedPos.pos()), new DustParticleOptions(0xff000000, 1), ParticleTypes.HAPPY_VILLAGER, 100, 0.2); // pos+0.5v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (itemStack_1.getItem() == Items.ROTTEN_FLESH)
|
else if (itemStack_1.getItem() == Items.ROTTEN_FLESH)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import net.minecraft.core.BlockPos;
|
|||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
import net.minecraft.core.particles.DustParticleOptions;
|
||||||
import net.minecraft.core.particles.ParticleOptions;
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.nbt.ByteTag;
|
import net.minecraft.nbt.ByteTag;
|
||||||
@@ -46,6 +47,7 @@ import net.minecraft.resources.ResourceLocation;
|
|||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.util.ARGB;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.util.RandomSource;
|
import net.minecraft.util.RandomSource;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
@@ -435,10 +437,8 @@ public class ShapeDispatcher
|
|||||||
|
|
||||||
protected ParticleOptions replacementParticle(RegistryAccess regs)
|
protected ParticleOptions replacementParticle(RegistryAccess regs)
|
||||||
{
|
{
|
||||||
String particleName = fa == 0 ?
|
boolean bg = fa == 0;
|
||||||
String.format(Locale.ROOT, "dust %.1f %.1f %.1f 1.0", r, g, b) :
|
return new DustParticleOptions(ARGB.colorFromFloat(1.0f, (bg ?r:fr), (bg ?r:fr), (bg ?r:fr)), 1);
|
||||||
String.format(Locale.ROOT, "dust %.1f %.1f %.1f 1.0", fr, fg, fb);
|
|
||||||
return getParticleData(particleName, regs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1069,7 +1069,7 @@ public class ShapeDispatcher
|
|||||||
}
|
}
|
||||||
if (fa > 0.0f)
|
if (fa > 0.0f)
|
||||||
{
|
{
|
||||||
ParticleOptions locparticledata = getParticleData(String.format(Locale.ROOT, "dust %.1f %.1f %.1f %.1f", fr, fg, fb, fa), p.level().registryAccess());
|
ParticleOptions locparticledata = new DustParticleOptions(ARGB.colorFromFloat(1.0f, fr, fg, fb), 1);
|
||||||
for (Vec3 v : getAlterPoint(p))
|
for (Vec3 v : getAlterPoint(p))
|
||||||
{
|
{
|
||||||
p.serverLevel().sendParticles(p, locparticledata, true, true,
|
p.serverLevel().sendParticles(p, locparticledata, true, true,
|
||||||
|
|||||||
@@ -127,8 +127,9 @@ _start_with(points_supplier) ->
|
|||||||
global_dimension = p~'dimension';
|
global_dimension = p~'dimension';
|
||||||
|
|
||||||
code = abs(hash_code(str(p))-123456);
|
code = abs(hash_code(str(p))-123456);
|
||||||
global_color_a = str('dust %.1f %.1f %.1f 1',(code%10)/10,(((code/10)%10)/10), (((code/100)%10)/10) ); // 'dust 0.1 0.9 0.1 1',
|
|
||||||
global_color_b = str('dust %.1f %.1f %.1f 1',(((code/1000)%10)/10),(((code/10000)%10)/10), (((code/100000)%10)/10) );// 'dust 0.6 0.6 0.6 1'
|
global_color_a = str('dust{"scale": 1, "color": [%.1f, %.1f, %.1f]}',(code%10)/10,(((code/10)%10)/10), (((code/100)%10)/10) ); // 'dust 0.1 0.9 0.1 1',
|
||||||
|
global_color_b = str('dust{"scale": 1, "color": [%.1f, %.1f, %.1f]}',(((code/1000)%10)/10),(((code/10000)%10)/10), (((code/100000)%10)/10) );// 'dust 0.6 0.6 0.6 1'
|
||||||
|
|
||||||
global_points = call(points_supplier);
|
global_points = call(points_supplier);
|
||||||
global_selected_point = null;
|
global_selected_point = null;
|
||||||
|
|||||||
Reference in new issue
Block a user