use of com.ldtteam.structurize.util.TickedWorldOperation in project minecolonies by Minecolonies.
the class CreativeRaiderStructureHandler method loadAndPlaceStructureWithRotation.
/**
* Load a structure into this world and place it in the right position and rotation.
*
* @param worldObj the world to load it in
* @param name the structures name
* @param pos coordinates
* @param rotation the rotation.
* @param mirror the mirror used.
* @param fancyPlacement if fancy or complete.
* @param colonyId the colony id.
* @param event the raid event.
* @param player the placing player.
* @return the placed blueprint.
*/
public static Blueprint loadAndPlaceStructureWithRotation(final World worldObj, @NotNull final String name, @NotNull final BlockPos pos, final Rotation rotation, @NotNull final Mirror mirror, final boolean fancyPlacement, final int colonyId, final IColonyRaidEvent event, @Nullable final ServerPlayerEntity player) {
try {
@NotNull final IStructureHandler structure = new CreativeRaiderStructureHandler(worldObj, pos, name, new PlacementSettings(mirror, rotation), fancyPlacement, event, colonyId);
if (structure.hasBluePrint()) {
@NotNull final StructurePlacer instantPlacer = new StructurePlacer(structure);
Manager.addToQueue(new TickedWorldOperation(instantPlacer, player));
}
return structure.getBluePrint();
} catch (final IllegalStateException e) {
Log.getLogger().warn("Could not load structure!", e);
}
return null;
}
use of com.ldtteam.structurize.util.TickedWorldOperation in project Structurize by ldtteam.
the class StructurePlacementUtils method loadAndPlaceStructureWithRotation.
/**
* Load a structure into this world
* and place it in the right position and rotation.
*
* @param worldObj the world to load it in
* @param name the structures name
* @param pos coordinates
* @param rotation the rotation.
* @param mirror the mirror used.
* @param fancyPlacement if fancy or complete.
* @param player the placing player.
*/
public static void loadAndPlaceStructureWithRotation(final World worldObj, @NotNull final String name, @NotNull final BlockPos pos, final Rotation rotation, @NotNull final Mirror mirror, final boolean fancyPlacement, final ServerPlayerEntity player) {
try {
@NotNull final IStructureHandler structure = new CreativeStructureHandler(worldObj, pos, name, new PlacementSettings(mirror, rotation), fancyPlacement);
structure.getBluePrint().rotateWithMirror(rotation, mirror, worldObj);
@NotNull final StructurePlacer instantPlacer = new StructurePlacer(structure);
Manager.addToQueue(new TickedWorldOperation(instantPlacer, player));
} catch (final IllegalStateException e) {
Log.getLogger().warn("Could not load structure!", e);
}
}
use of com.ldtteam.structurize.util.TickedWorldOperation in project Structurize by ldtteam.
the class Manager method redo.
/**
* Undo a change to the world made by a player.
*
* @param player the player who made it.
* @param operationID
*/
public static void redo(final PlayerEntity player, final int operationID) {
final List<ChangeStorage> list = changeQueue.get(player.getUUID());
if (list == null || list.isEmpty()) {
player.sendMessage(new TranslationTextComponent("structurize.gui.undoredo.redo.notfound"), player.getUUID());
return;
}
for (final ChangeStorage storage : list) {
if (storage.getID() == operationID) {
if (!storage.isDone()) {
player.sendMessage(new TranslationTextComponent("structurize.gui.undoredo.redo.inprogress", storage.getOperation()), player.getUUID());
return;
}
player.sendMessage(new TranslationTextComponent("structurize.gui.undoredo.redo.add", storage.getOperation()), player.getUUID());
addToQueue(new TickedWorldOperation(storage, player, TickedWorldOperation.OperationType.REDO));
return;
}
}
player.sendMessage(new TranslationTextComponent("structurize.gui.undoredo.redo.notfound"), player.getUUID());
}
use of com.ldtteam.structurize.util.TickedWorldOperation in project minecolonies by ldtteam.
the class CreativeRaiderStructureHandler method loadAndPlaceStructureWithRotation.
/**
* Load a structure into this world and place it in the right position and rotation.
*
* @param worldObj the world to load it in
* @param name the structures name
* @param pos coordinates
* @param rotation the rotation.
* @param mirror the mirror used.
* @param fancyPlacement if fancy or complete.
* @param colonyId the colony id.
* @param event the raid event.
* @param player the placing player.
* @return the placed blueprint.
*/
public static Blueprint loadAndPlaceStructureWithRotation(final World worldObj, @NotNull final String name, @NotNull final BlockPos pos, final Rotation rotation, @NotNull final Mirror mirror, final boolean fancyPlacement, final int colonyId, final IColonyRaidEvent event, @Nullable final ServerPlayerEntity player) {
try {
@NotNull final IStructureHandler structure = new CreativeRaiderStructureHandler(worldObj, pos, name, new PlacementSettings(mirror, rotation), fancyPlacement, event, colonyId);
if (structure.hasBluePrint()) {
@NotNull final StructurePlacer instantPlacer = new StructurePlacer(structure);
Manager.addToQueue(new TickedWorldOperation(instantPlacer, player));
}
return structure.getBluePrint();
} catch (final IllegalStateException e) {
Log.getLogger().warn("Could not load structure!", e);
}
return null;
}
use of com.ldtteam.structurize.util.TickedWorldOperation in project minecolonies by Minecolonies.
the class CreativeBuildingStructureHandler method loadAndPlaceStructureWithRotation.
/**
* Load a structure into this world and place it in the right position and rotation.
*
* @param worldObj the world to load it in
* @param name the structures name
* @param pos coordinates
* @param rotation the rotation.
* @param mirror the mirror used.
* @param fancyPlacement if fancy or complete.
* @param player the placing player.
* @return the placed blueprint.
*/
public static Blueprint loadAndPlaceStructureWithRotation(final World worldObj, @NotNull final String name, @NotNull final BlockPos pos, final Rotation rotation, @NotNull final Mirror mirror, final boolean fancyPlacement, @Nullable final ServerPlayerEntity player) {
try {
@NotNull final IStructureHandler structure = new CreativeBuildingStructureHandler(worldObj, pos, name, new PlacementSettings(mirror, rotation), fancyPlacement);
if (structure.hasBluePrint()) {
structure.getBluePrint().rotateWithMirror(rotation, mirror, worldObj);
@NotNull final StructurePlacer instantPlacer = new StructurePlacer(structure);
Manager.addToQueue(new TickedWorldOperation(instantPlacer, player));
}
return structure.getBluePrint();
} catch (final IllegalStateException e) {
Log.getLogger().warn("Could not load structure!", e);
}
return null;
}
Aggregations