Created
April 20, 2020 12:49
-
-
Save tyhdefu/8d6f73ad8ca7c7653c9df17216536353 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Mixin(net.minecraft.world.storage.MapData.class) | |
public class MapDataBridgeMixin implements MapDataBridge { | |
@Shadow public byte dimension; | |
private static Field mapDataBridgeMixin$dimensionId; | |
static { | |
try { | |
if (SpongeImplHooks.isDeobfuscatedEnvironment()) { | |
mapDataBridgeMixin$dimensionId = MapData.class.getDeclaredField("dimension"); | |
} else { | |
mapDataBridgeMixin$dimensionId = MapData.class.getDeclaredField("field_76200_c"); | |
} | |
} catch (NoSuchFieldException e) { | |
e.printStackTrace(); | |
} | |
} | |
@Override | |
public int bridge$getDimensionId() { | |
try { | |
return (int)mapDataBridgeMixin$dimensionId.get(this); | |
} catch (IllegalAccessException e) { | |
e.printStackTrace(); | |
return 0; | |
} | |
} | |
@Override | |
public void bridge$setDimensionId(int dimensionId) { | |
try { | |
mapDataBridgeMixin$dimensionId.set(this, dimensionId); | |
} catch (IllegalAccessException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment