Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Fix reddust, particle metadata rewriting, translations
Dieser Commit ist enthalten in:
Ursprung
9ba70424e8
Commit
a203c17e06
@ -98,7 +98,9 @@ public class MetadataRewriter {
|
|||||||
// Handle AreaEffectCloud outside the loop
|
// Handle AreaEffectCloud outside the loop
|
||||||
if (type != null && type.is(Entity1_13Types.EntityType.AREA_EFFECT_CLOUD) && particleId != -1) {
|
if (type != null && type.is(Entity1_13Types.EntityType.AREA_EFFECT_CLOUD) && particleId != -1) {
|
||||||
Particle particle = ParticleRewriter.rewriteParticle(particleId, new Integer[]{parameter1, parameter2});
|
Particle particle = ParticleRewriter.rewriteParticle(particleId, new Integer[]{parameter1, parameter2});
|
||||||
metadatas.add(new Metadata(9, MetaType1_13.PARTICLE, particle));
|
if (particle != null && particle.getId() != -1) {
|
||||||
|
metadatas.add(new Metadata(9, MetaType1_13.PARTICLE, particle));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class MappingData {
|
|||||||
String[] keyAndTranslation = line.split("=", 2);
|
String[] keyAndTranslation = line.split("=", 2);
|
||||||
if (keyAndTranslation.length != 2) continue;
|
if (keyAndTranslation.length != 2) continue;
|
||||||
String key = keyAndTranslation[0];
|
String key = keyAndTranslation[0];
|
||||||
String translation = keyAndTranslation[1];
|
String translation = keyAndTranslation[1].replaceAll("%(\\d\\$)?d", "%$1s");
|
||||||
if (!translateData.containsKey(key)) {
|
if (!translateData.containsKey(key)) {
|
||||||
translateMapping.put(key, translation);
|
translateMapping.put(key, translation);
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,11 +11,10 @@ import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
public class ParticleRewriter {
|
public class ParticleRewriter {
|
||||||
private static List<NewParticle> particles = new LinkedList<>();
|
private static List<NewParticle> particles = new LinkedList<>();
|
||||||
private static Random rand = new Random();
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
add(34); // (0->34) explode -> minecraft:poof
|
add(34); // (0->34) explode -> minecraft:poof
|
||||||
@ -108,17 +107,17 @@ public class ParticleRewriter {
|
|||||||
return new ParticleDataHandler() {
|
return new ParticleDataHandler() {
|
||||||
@Override
|
@Override
|
||||||
public Particle handler(Particle particle, Integer[] data) {
|
public Particle handler(Particle particle, Integer[] data) {
|
||||||
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomFloat())); // Red 0 - 1
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomBool() ? 1f : 0f)); // Red 0 - 1
|
||||||
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomFloat())); // Green 0 - 1
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 0f)); // Green 0 - 1
|
||||||
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomFloat())); // Blue 0 - 1
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, randomBool() ? 1f : 0f)); // Blue 0 - 1
|
||||||
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 1));// Scale 0.01 - 4
|
particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, 1f));// Scale 0.01 - 4
|
||||||
return particle;
|
return particle;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float randomFloat() {
|
private static boolean randomBool() {
|
||||||
return rand.nextFloat();
|
return ThreadLocalRandom.current().nextBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite IconCrack items to new format :)
|
// Rewrite IconCrack items to new format :)
|
||||||
|
@ -415,15 +415,20 @@ public class WorldPackets {
|
|||||||
if (particle.getId() == 11) {
|
if (particle.getId() == 11) {
|
||||||
int count = wrapper.get(Type.INT, 1);
|
int count = wrapper.get(Type.INT, 1);
|
||||||
float speed = wrapper.get(Type.FLOAT, 6);
|
float speed = wrapper.get(Type.FLOAT, 6);
|
||||||
// Only handle for count = 0 & speed = 1
|
// Only handle for count = 0
|
||||||
if (count == 0 && speed == 1) {
|
if (count == 0) {
|
||||||
wrapper.set(Type.INT, 1, 1);
|
wrapper.set(Type.INT, 1, 1);
|
||||||
wrapper.set(Type.FLOAT, 6, 0f);
|
wrapper.set(Type.FLOAT, 6, 0f);
|
||||||
|
|
||||||
List<Particle.ParticleData> arguments = particle.getArguments();
|
List<Particle.ParticleData> arguments = particle.getArguments();
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
//RGB values are represented by the X/Y/Z offset
|
//RGB values are represented by the X/Y/Z offset
|
||||||
arguments.get(i).setValue(wrapper.get(Type.FLOAT, i + 3));
|
float colorValue = wrapper.get(Type.FLOAT, i + 3) * speed;
|
||||||
|
if (colorValue == 0 && i == 0) {
|
||||||
|
// https://minecraft.gamepedia.com/User:Alphappy/reddust
|
||||||
|
colorValue = 1;
|
||||||
|
}
|
||||||
|
arguments.get(i).setValue(colorValue);
|
||||||
wrapper.set(Type.FLOAT, i + 3, 0f);
|
wrapper.set(Type.FLOAT, i + 3, 0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren