minecraft_25w45a_unobfuscated/net/minecraft/util/datafix/fixes/EntityItemFrameDirectionFix.java
2025-11-24 22:52:51 +03:00

51 lines
1.4 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* com.mojang.datafixers.DSL
* com.mojang.datafixers.Typed
* com.mojang.datafixers.schemas.Schema
* com.mojang.serialization.Dynamic
*/
package net.minecraft.util.datafix.fixes;
import com.mojang.datafixers.DSL;
import com.mojang.datafixers.Typed;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.serialization.Dynamic;
import net.minecraft.util.datafix.fixes.NamedEntityFix;
import net.minecraft.util.datafix.fixes.References;
public class EntityItemFrameDirectionFix
extends NamedEntityFix {
public EntityItemFrameDirectionFix(Schema outputSchema, boolean changesType) {
super(outputSchema, changesType, "EntityItemFrameDirectionFix", References.ENTITY, "minecraft:item_frame");
}
public Dynamic<?> fixTag(Dynamic<?> input) {
return input.set("Facing", input.createByte(EntityItemFrameDirectionFix.direction2dTo3d(input.get("Facing").asByte((byte)0))));
}
@Override
protected Typed<?> fix(Typed<?> entity) {
return entity.update(DSL.remainderFinder(), this::fixTag);
}
private static byte direction2dTo3d(byte dir) {
switch (dir) {
default: {
return 2;
}
case 0: {
return 3;
}
case 1: {
return 4;
}
case 3:
}
return 5;
}
}