public abstract class MixinWorldExample extends Object implements IWorld
This is an example Mixin class. This code will be merged into the class(es) specified in the Mixin
annotation at load time and any
interfaces implemented here will be monkey-patched onto the target class as well. Mixin classes must have the same superclass as their
target class, thus calls to super.whatever() and any methods in the parent class will be correct.
In order to provide support for referring to fields and methods in the target class which are not accessible, "shadow" methods and fields
may be created in order to allow mixin code to reference them. These shadow methods and fields must be annotated with the Shadow
annotation in order for the obfuscator to locate and appropriately transform them when doing a production build. In general, shadow methods will
be declared as abstract but this is not a requirement.
See below for examples.
Constructor and Description |
---|
MixinWorldExample() |
Modifier and Type | Method and Description |
---|---|
int |
exampleMethodToComputeLightValue(int x,
int y,
int z,
net.minecraft.world.EnumSkyBlock block)
Even more tenuous example
|
void |
func_175722_b(net.minecraft.util.BlockPos pos,
net.minecraft.block.Block block)
Overwrites the NotifyBlockChange method in the target class
|
int |
getAmbientTickCountdown()
Stupid example
|
Object |
getBlock(int x,
int y,
int z)
This method implements getBlock from the
IWorld interface. |
public int getAmbientTickCountdown()
IWorld
getAmbientTickCountdown
in interface IWorld
public int exampleMethodToComputeLightValue(int x, int y, int z, net.minecraft.world.EnumSkyBlock block)
IWorld
exampleMethodToComputeLightValue
in interface IWorld
x
- The x coordinatey
- The y coordinatez
- The z coordinateblock
- The SkyBlock valuepublic Object getBlock(int x, int y, int z)
IWorld
interface. However since the method signature overlaps with the "getBlock" method
above, it is necessary to use the Shadow.prefix()
functionality in the Shadow
annotation to prevent a name clash at compile
time.getBlock
in interface IWorld
x
- The x coordinatey
- The y coordinatez
- The z coordinateIWorld.getBlock(int, int, int)
public void func_175722_b(net.minecraft.util.BlockPos pos, net.minecraft.block.Block block)
pos
- The block locationblock
- The block