mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-06-25 10:14:57 +02:00
Hide Footstep particle from Fabric registry sync
Closes https://github.com/ViaVersion/ViaFabricPlus/issues/430
This commit is contained in:
parent
ba925d0a65
commit
8c34100ee1
|
@ -36,7 +36,8 @@ import net.minecraft.util.math.Vec3d;
|
|||
|
||||
public class FootStepParticle1_12_2 extends SpriteBillboardParticle {
|
||||
|
||||
public static int ID;
|
||||
public static final Identifier ID = new Identifier("viafabricplus", "footstep");
|
||||
public static int RAW_ID;
|
||||
|
||||
protected FootStepParticle1_12_2(ClientWorld clientWorld, double x, double y, double z) {
|
||||
super(clientWorld, x, y, z);
|
||||
|
@ -80,10 +81,10 @@ public class FootStepParticle1_12_2 extends SpriteBillboardParticle {
|
|||
public static void init() {
|
||||
final SimpleParticleType footStepType = FabricParticleTypes.simple(true);
|
||||
|
||||
Registry.register(Registries.PARTICLE_TYPE, new Identifier("viafabricplus", "footstep"), footStepType);
|
||||
Registry.register(Registries.PARTICLE_TYPE, ID, footStepType);
|
||||
ParticleFactoryRegistry.getInstance().register(footStepType, FootStepParticle1_12_2.Factory::new);
|
||||
|
||||
ID = Registries.PARTICLE_TYPE.getRawId(footStepType);
|
||||
RAW_ID = Registries.PARTICLE_TYPE.getRawId(footStepType);
|
||||
}
|
||||
|
||||
public static class Factory implements ParticleFactory<SimpleParticleType> {
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of ViaFabricPlus - https://github.com/FlorianMichael/ViaFabricPlus
|
||||
* Copyright (C) 2021-2024 FlorianMichael/EnZaXD <florian.michael07@gmail.com> and RK_01/RaphiMC
|
||||
* Copyright (C) 2023-2024 contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.injection.mixin.compat.fabricapi;
|
||||
|
||||
import de.florianmichael.viafabricplus.fixes.versioned.visual.FootStepParticle1_12_2;
|
||||
import net.fabricmc.fabric.impl.registry.sync.RegistrySyncManager;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(RegistrySyncManager.class)
|
||||
public abstract class MixinRegistrySyncManager {
|
||||
|
||||
@Redirect(method = "createAndPopulateRegistryMap", at = @At(value = "INVOKE", target = "Lnet/minecraft/registry/Registry;getId(Ljava/lang/Object;)Lnet/minecraft/util/Identifier;"))
|
||||
private static @Nullable <T> Identifier skipFootStepParticle(Registry<T> instance, T t) {
|
||||
final Identifier id = instance.getId(t);
|
||||
if (id == FootStepParticle1_12_2.ID) {
|
||||
return null;
|
||||
} else {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ public abstract class MixinMappingDataBase {
|
|||
|
||||
@Inject(method = "getNewParticleId", at = @At("HEAD"), cancellable = true)
|
||||
private void passthroughFootStepParticle(int id, CallbackInfoReturnable<Integer> cir) {
|
||||
if (id == FootStepParticle1_12_2.ID) {
|
||||
if (id == FootStepParticle1_12_2.RAW_ID) {
|
||||
cir.setReturnValue(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public abstract class MixinParticleIdMappings1_13 {
|
|||
|
||||
@Inject(method = "<clinit>", at = @At("RETURN"))
|
||||
private static void checkFootStepIdOverlap(CallbackInfo ci) {
|
||||
if (FootStepParticle1_12_2.ID < particles.size()) {
|
||||
if (FootStepParticle1_12_2.RAW_ID < particles.size()) {
|
||||
throw new IllegalStateException("ViaFabricPlus FootStepParticle ID overlaps with a vanilla 1.12.2 particle ID");
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ public abstract class MixinParticleIdMappings1_13 {
|
|||
@ModifyArg(method = "add(I)V", at = @At(value = "INVOKE", target = "Lcom/viaversion/viaversion/protocols/v1_12_2to1_13/data/ParticleIdMappings1_13$NewParticle;<init>(ILcom/viaversion/viaversion/protocols/v1_12_2to1_13/data/ParticleIdMappings1_13$ParticleDataHandler;)V"))
|
||||
private static int replaceFootStepId(int id) {
|
||||
if (particles.size() == 28) { // minecraft:footstep -> viafabricplus:footstep
|
||||
return FootStepParticle1_12_2.ID;
|
||||
return FootStepParticle1_12_2.RAW_ID;
|
||||
} else {
|
||||
return id;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public abstract class MixinParticleMappings extends FullMappingsBase {
|
|||
|
||||
@Override
|
||||
public int getNewId(int id) {
|
||||
if (id == FootStepParticle1_12_2.ID) {
|
||||
if (id == FootStepParticle1_12_2.RAW_ID) {
|
||||
return id;
|
||||
} else {
|
||||
return super.getNewId(id);
|
||||
|
|
|
@ -199,7 +199,8 @@
|
|||
"fixes.viaversion.MixinWorldPacketRewriter1_19",
|
||||
"viabedrock.MixinJoinPackets",
|
||||
"vialegacy.MixinExtensionProtocolMetadataStorage",
|
||||
"vialegacy.MixinViaLegacyConfig"
|
||||
"vialegacy.MixinViaLegacyConfig",
|
||||
"compat.fabricapi.MixinRegistrySyncManager"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user