API used for rewinding Time on the world and players
Can be used normally with /rewind [ticks] [radius]
Rewinds: Blocks, items, mobs, stats, entities, projectiles,etc
this project is easily usable and addable to any mod, its meant to be used for mods that need time rewind functions, freely usuable in any mod.
Documentation:
API used for rewinding Time on the world and players
Can be used normally with /rewind [ticks] [radius]
Rewinds: Blocks, items, mobs, stats, entities, projectiles,etc
this project is easily usable and addable to any mod, its meant to be used for mods that need time rewind functions, freely usuable in any mod.
Documentation:
/**
* TimeRewindAPI v1.0
*
* Public API for interacting with the Time Rewind system.
*
* Supports:
* - Player rewind
* - Entity rewind
* - Projectile rewind
* - Item entity rewind
* - Block rewind
* - Block entity rewind
* - Fluid rewind
* - Potion rewind
* - Inventory rewind
* - Armor rewind
* - Offhand rewind
* - XP rewind
* - Hunger rewind
* - Dimension rewind
* - Death rewind
*
* Example:
*
* TimeRewindAPI.rewindPlayer(player, 200);
*
* TimeRewindAPI.rewindEntity(zombie, 100);
*
* TimeRewindAPI.rewindProjectile(arrow, 40);
*
* TimeRewindAPI.rewindWorld(
* level,
* player.blockPosition(),
* 600,
* 100
* );
*/
public final class TimeRewindAPI {
/**
* Current API version.
*/
public static final String VERSION = "1.0.0";
private TimeRewindAPI() {
}
/**
* Rewind a player.
*
* @param player Player to rewind
* @param ticks Number of ticks to rewind
*/
public static void rewindPlayer(
ServerPlayer player,
int ticks
) {
RewindManager.rewind(
player,
ticks
);
}
/**
* Rewind a living entity.
*
* @param entity Entity to rewind
* @param ticks Number of ticks to rewind
*/
public static void rewindEntity(
Entity entity,
int ticks
) {
EntityRewindManager.rewind(
entity,
ticks
);
}
/**
* Rewind a projectile.
*
* Works with arrows, tridents,
* snowballs, eggs, etc.
*/
public static void rewindProjectile(
Entity projectile,
int ticks
) {
ProjectileRewindManager.rewind(
projectile,
ticks
);
}
/**
* Rewind an item entity.
*
* Works with dropped items.
*/
public static void rewindItemEntity(
ItemEntity itemEntity,
int ticks
) {
ItemEntityRewindManager.rewind(
itemEntity,
ticks
);
}
/**
* Rewind blocks, block entities,
* and fluids around a position.
*
* @param level World to rewind in
* @param center Center position
* @param ticks Ticks to rewind
* @param radius Radius to affect
*/
public static void rewindWorld(
ServerLevel level,
BlockPos center,
int ticks,
int radius
) {
BlockRewindManager.rewind(
level,
center,
ticks,
radius
);
BlockEntityRewindManager.rewind(
level,
center,
ticks,
radius
);
FluidRewindManager.rewind(
level,
center,
ticks,
radius
);
}
}