32 lines
		
	
	
	
		
			1,015 B
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			1,015 B
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.util.datafix.fixes;
 | |
| 
 | |
| import com.google.common.collect.ImmutableMap;
 | |
| import com.mojang.datafixers.schemas.Schema;
 | |
| import com.mojang.serialization.Dynamic;
 | |
| import java.util.Map;
 | |
| 
 | |
| public class JigsawRotationFix extends AbstractBlockPropertyFix {
 | |
| 	private static final Map<String, String> RENAMES = ImmutableMap.<String, String>builder()
 | |
| 		.put("down", "down_south")
 | |
| 		.put("up", "up_north")
 | |
| 		.put("north", "north_up")
 | |
| 		.put("south", "south_up")
 | |
| 		.put("west", "west_up")
 | |
| 		.put("east", "east_up")
 | |
| 		.build();
 | |
| 
 | |
| 	public JigsawRotationFix(Schema outputSchema) {
 | |
| 		super(outputSchema, "jigsaw_rotation_fix");
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	protected boolean shouldFix(String name) {
 | |
| 		return name.equals("minecraft:jigsaw");
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	protected <T> Dynamic<T> fixProperties(String name, Dynamic<T> properties) {
 | |
| 		String string = properties.get("facing").asString("north");
 | |
| 		return properties.remove("facing").set("orientation", properties.createString((String)RENAMES.getOrDefault(string, string)));
 | |
| 	}
 | |
| }
 |