use of com.wuest.prefab.structures.predefined.StructureAlternateStart in project MC-Prefab by Brian-Wuest.
the class HouseConfiguration method ConfigurationSpecificBuildStructure.
/**
* This is used to actually build the structure as it creates the structure instance and calls build structure.
*
* @param player The player which requested the build.
* @param world The world instance where the build will occur.
* @param hitBlockPos This hit block position.
*/
@Override
protected void ConfigurationSpecificBuildStructure(Player player, ServerLevel world, BlockPos hitBlockPos) {
boolean houseBuilt = true;
// Build the alternate starter house instead.
StructureAlternateStart structure = StructureAlternateStart.CreateInstance(this.houseStyle.getStructureLocation(), StructureAlternateStart.class);
houseBuilt = structure.BuildStructure(this, world, hitBlockPos, player);
// The house was successfully built, remove the item from the inventory.
if (houseBuilt) {
EntityPlayerConfiguration playerConfig = EntityPlayerConfiguration.loadFromEntityData(player);
playerConfig.builtStarterHouse = true;
playerConfig.saveToPlayer(player);
this.RemoveStructureItemFromPlayer(player, ModRegistry.StartHouse.get());
// Make sure to send a message to the client to sync up the server player information and the client player
// information.
Prefab.network.sendTo(new PlayerEntityTagMessage(playerConfig.getModIsPlayerNewTag(player)), ((ServerPlayer) player).connection.connection, NetworkDirection.PLAY_TO_CLIENT);
}
}
Aggregations